summaryrefslogtreecommitdiff
path: root/plugins/zone.cpp
diff options
context:
space:
mode:
authorRobert Heinrich2012-04-14 19:06:03 +0200
committerRobert Heinrich2012-04-14 19:06:03 +0200
commit9f95e67c7575cca9495062eb275ee99a590e41cb (patch)
treecdb88342342c1469cf60334109b72bfbb52b6b0d /plugins/zone.cpp
parent2100a95ad546ad0d4c85483e96357924c05c8b51 (diff)
downloaddfhack-9f95e67c7575cca9495062eb275ee99a590e41cb.tar.gz
dfhack-9f95e67c7575cca9495062eb275ee99a590e41cb.tar.bz2
dfhack-9f95e67c7575cca9495062eb275ee99a590e41cb.tar.xz
tweak makeown: converts MERCHANT to TRADER (otherwise you can't assign jobs to kidnapped merchants.
zone: fixed a bug which could lead to units being assigned to more than one cage and/or accidentally marked for slaughter
Diffstat (limited to 'plugins/zone.cpp')
-rw-r--r--plugins/zone.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/zone.cpp b/plugins/zone.cpp
index 1e90aa1c..2f2b6458 100644
--- a/plugins/zone.cpp
+++ b/plugins/zone.cpp
@@ -905,7 +905,7 @@ bool isAssigned(df::unit* unit)
if( rtype == df::general_ref_type::BUILDING_CIVZONE_ASSIGNED
|| rtype == df::general_ref_type::BUILDING_CAGED
|| rtype == df::general_ref_type::BUILDING_CHAIN
- || (rtype == df::general_ref_type::CONTAINED_IN_ITEM && isBuiltCageAtPos(unit->pos))
+ || (rtype == df::general_ref_type::CONTAINED_IN_ITEM && isInBuiltCage(unit))
)
{
assigned = true;
@@ -958,10 +958,10 @@ bool isInBuiltCage(df::unit* unit)
df::building* building = world->buildings.all[b];
if( building->getType() == building_type::Cage)
{
- df::building_cagest* oldcage = (df::building_cagest*) building;
- for(size_t oc=0; oc<oldcage->assigned_creature.size(); oc++)
+ df::building_cagest* cage = (df::building_cagest*) building;
+ for(size_t c=0; c<cage->assigned_creature.size(); c++)
{
- if(oldcage->assigned_creature[oc] == unit->id)
+ if(cage->assigned_creature[c] == unit->id)
{
caged = true;
break;
@@ -2769,7 +2769,9 @@ command_result autoButcher( color_ostream &out, bool verbose = false )
|| !isTame(unit)
|| isWar(unit) // ignore war dogs etc
|| isHunter(unit) // ignore hunting dogs etc
- || (isContainedInItem(unit) && hasValidMapPos(unit) && isBuiltCageAtPos(unit->pos))
+ // ignore creatures in built cages to leave zoos alone
+ // (TODO: allow some kind of slaughter cages which you can place near the butcher)
+ || (isContainedInItem(unit) && isInBuiltCage(unit))
|| unit->name.has_name
)
continue;