zone: fixed major derp (assign commands would accidentally free caged creatures). tweak: added cheat to kidnap caravan escorts (works fine even for other races, does NOT work for traders because they can't be assigned any labors for whatever reason)

develop
Robert Heinrich 2012-04-14 13:36:22 +02:00
parent fba83bb597
commit 2100a95ad5
2 changed files with 22 additions and 1 deletions

@ -101,6 +101,8 @@ command_result fix_clothing_ownership(color_ostream &out, df::unit* unit)
{ {
df::unit_inventory_item* inv_item = unit->inventory[j]; df::unit_inventory_item* inv_item = unit->inventory[j];
df::item* item = inv_item->item; df::item* item = inv_item->item;
// unforbid items (for the case of kidnapping caravan escorts who have their stuff forbidden by default)
inv_item->item->flags.bits.forbid = 0;
if(inv_item->mode == df::unit_inventory_item::T_mode::Worn) if(inv_item->mode == df::unit_inventory_item::T_mode::Worn)
{ {
// ignore armor? // ignore armor?
@ -207,6 +209,26 @@ static command_result tweak(color_ostream &out, vector <string> &parameters)
return fix_clothing_ownership(out, unit); return fix_clothing_ownership(out, unit);
} }
else if (cmd == "makeown")
{
// force a unit into your fort, regardless of civ or race
// allows to "steal" caravan guards etc
df::unit *unit = getSelectedUnit(out);
if (!unit)
{
out << "No unit selected!" << endl;
return CR_FAILURE;
}
if (unit->flags2.bits.resident)
unit->flags2.bits.resident = 0;
if(unit->flags1.bits.merchant)
unit->flags1.bits.merchant = 0;
if(unit->flags1.bits.forest)
unit->flags1.bits.forest = 0;
if(unit->civ_id != df::global::ui->civ_id)
unit->civ_id = df::global::ui->civ_id;
return fix_clothing_ownership(out, unit);
}
else else
return CR_WRONG_USAGE; return CR_WRONG_USAGE;

@ -963,7 +963,6 @@ bool isInBuiltCage(df::unit* unit)
{ {
if(oldcage->assigned_creature[oc] == unit->id) if(oldcage->assigned_creature[oc] == unit->id)
{ {
oldcage->assigned_creature.erase(oldcage->assigned_creature.begin() + oc);
caged = true; caged = true;
break; break;
} }