summaryrefslogtreecommitdiff
path: root/plugins/zone.cpp
diff options
context:
space:
mode:
authorRobert Heinrich2012-04-17 16:57:41 +0200
committerRobert Heinrich2012-04-17 16:57:41 +0200
commit40f36c19128f2daa7e40c5a1d882ffd1f5b5f47f (patch)
tree8d0755ca672f1e596ddb9a2763db8023ebbe2de8 /plugins/zone.cpp
parent6d180d61c483350d19f08c5cdb74edd4aaff21da (diff)
downloaddfhack-40f36c19128f2daa7e40c5a1d882ffd1f5b5f47f.tar.gz
dfhack-40f36c19128f2daa7e40c5a1d882ffd1f5b5f47f.tar.bz2
dfhack-40f36c19128f2daa7e40c5a1d882ffd1f5b5f47f.tar.xz
minor stuff, use building->is_room instead of building->isRoom() which returns unexpected values
Diffstat (limited to 'plugins/zone.cpp')
-rw-r--r--plugins/zone.cpp37
1 files changed, 9 insertions, 28 deletions
diff --git a/plugins/zone.cpp b/plugins/zone.cpp
index 968fda72..3c0f645f 100644
--- a/plugins/zone.cpp
+++ b/plugins/zone.cpp
@@ -1065,10 +1065,10 @@ bool isInBuiltCageRoom(df::unit* unit)
{
df::building* building = world->buildings.all[b];
- // !!! for whatever reason isRoom() returns true if a cage is not a room
- // !!! and false if it was defined as a room/zoo ingame
- // !!! (seems not general behaviour, activity zones return false, for example)
- if(building->isRoom())
+ // !!! building->isRoom() returns true if the building can be made a room but currently isn't
+ // !!! except for coffins/tombs which always return false
+ // !!! using the bool is_room however gives the correct state/value
+ if(!building->is_room)
continue;
if(building->getType() == building_type::Cage)
@@ -1594,11 +1594,6 @@ void zoneInfo(color_ostream & out, df::building* building, bool verbose)
else
out << "not active";
- //if(building->isRoom())
- // out <<", room";
- //else
- // out << ", not a room";
-
if(civ->zone_flags.bits.pen_pasture)
out << ", pen/pasture";
else if (civ->zone_flags.bits.pit_pond)
@@ -1655,16 +1650,7 @@ void cageInfo(color_ostream & out, df::building* building, bool verbose)
<< " z:" << building->z
<< endl;
- //if(building->isRoom())
- // out <<", bldg room";
- //else
- // out << ", bldg not a room";
-
df::building_cagest * cage = (df::building_cagest*) building;
- //if(cage->isRoom())
- // out <<", cage is room";
- //else
- // out << ", cage is not a room";
int32_t creaturecount = cage->assigned_creature.size();
out << "Creatures in this cage: " << creaturecount << endl;
@@ -2277,8 +2263,8 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
// find building under cursor
if (!all &&
!(building->x1 <= cursor->x && cursor->x <= building->x2 &&
- building->y1 <= cursor->y && cursor->y <= building->y2 &&
- building->z == cursor->z))
+ building->y1 <= cursor->y && cursor->y <= building->y2 &&
+ building->z == cursor->z))
continue;
zoneInfo(out, building, verbose);
@@ -2465,12 +2451,9 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
else
{
// must have unit selected
- df::unit *unit = getSelectedUnit(out);
+ df::unit *unit = getSelectedUnit(out, true);
if (!unit)
- {
- out << "No unit selected." << endl;
return CR_WRONG_USAGE;
- }
if(unit_info)
{
@@ -2503,18 +2486,16 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
if(building_unassign)
{
// must have unit selected
- df::unit *unit = getSelectedUnit(out);
+ df::unit *unit = getSelectedUnit(out, true);
if (!unit)
- {
- out << "No unit selected." << endl;
return CR_WRONG_USAGE;
- }
// remove assignment reference from unit and old zone
if(unassignUnitFromBuilding(unit))
out << "Unit unassigned." << endl;
else
out << "Unit is not assigned to an activity zone!" << endl;
+
return CR_OK;
}