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
develop
Robert Heinrich 2012-04-14 19:06:03 +02:00
parent 2100a95ad5
commit 9f95e67c75
2 changed files with 11 additions and 5 deletions

@ -227,6 +227,10 @@ static command_result tweak(color_ostream &out, vector <string> &parameters)
unit->flags1.bits.forest = 0;
if(unit->civ_id != df::global::ui->civ_id)
unit->civ_id = df::global::ui->civ_id;
if(unit->profession == df::profession::MERCHANT)
unit->profession = df::profession::TRADER;
if(unit->profession2 == df::profession::MERCHANT)
unit->profession2 = df::profession::TRADER;
return fix_clothing_ownership(out, unit);
}
else

@ -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;