diff options
| author | Robert Heinrich | 2012-04-11 22:29:56 +0200 |
|---|---|---|
| committer | Robert Heinrich | 2012-04-11 22:29:56 +0200 |
| commit | 2caf3fb0643a30decd8d13c981e8c378ccfd1aa1 (patch) | |
| tree | 18ed57dd4ff39b34f3f0e5bb6fda633e003c48db /plugins/tweak.cpp | |
| parent | 42e4fa79c7be8c5c77d3da30201d1add415a0c9b (diff) | |
| download | dfhack-2caf3fb0643a30decd8d13c981e8c378ccfd1aa1.tar.gz dfhack-2caf3fb0643a30decd8d13c981e8c378ccfd1aa1.tar.bz2 dfhack-2caf3fb0643a30decd8d13c981e8c378ccfd1aa1.tar.xz | |
tweak: removed stuff, added new command 'fixmigrants' which will deal with merchants (traders) and other types of bugged migrants. having more than one command for a bug which is basically the same makes no sense.
Diffstat (limited to 'plugins/tweak.cpp')
| -rw-r--r-- | plugins/tweak.cpp | 67 |
1 files changed, 27 insertions, 40 deletions
diff --git a/plugins/tweak.cpp b/plugins/tweak.cpp index 3ac9b625..5f65fe27 100644 --- a/plugins/tweak.cpp +++ b/plugins/tweak.cpp @@ -53,14 +53,12 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi " Intended to fix the case where you can't engrave memorials for ghosts.\n" " Note that this is very dirty and possibly dangerous!\n" " Most probably does not have the positive effect of a proper burial.\n" - " tweak clear-resident\n" - " Remove the resident flag from the selected unit.\n" - " Intended to fix bugged migrants who stay at the map edge.\n" - " Only works for dwarves of the own civilization.\n" - " tweak clear-merchant\n" - " Remove the merchant flag from the selected unit.\n" - " Assimilates bugged merchants who don't leave the map into your fort.\n" - " Only works for dwarves of the own civilization.\n" + " tweak fixmigrant\n" + " Forces the selected unit to become a member or your fortress.\n" + " Intended to fix bugged migrants and merchants who stay at the map edge.\n" + " Only works for units of your own race. Can be used for stealing caravan\n" + " traders and guards, but might result into weirdness during trading.\n" + " Currently all assimilated units will drop all their clothes.\n" )); return CR_OK; } @@ -166,49 +164,38 @@ static command_result tweak(color_ostream &out, vector <string> ¶meters) return CR_FAILURE; } } - else if (cmd == "clear-resident") + else if (cmd == "fixmigrant") { df::unit *unit = getSelectedUnit(out); - if (!unit) - return CR_FAILURE; - // must be own race and civ and a merchant - if ( unit->flags2.bits.resident - && unit->race == df::global::ui->race_id - && unit->civ_id == df::global::ui->civ_id) + if (!unit) { - // remove resident flag - unit->flags2.bits.resident = 0; - return fix_clothing_ownership(out, unit); + out << "No unit selected!" << endl; + return CR_FAILURE; } - else + + if(unit->race != df::global::ui->race_id) { - out.print("That's not a resident dwarf of your civilization!\n"); + out << "Selected unit does not belong to your race!" << endl; return CR_FAILURE; } - } - else if (cmd == "clear-merchant") - { - df::unit *unit = getSelectedUnit(out); - if (!unit) - return CR_FAILURE; - // must be own race and civ and a merchant - if ( unit->flags1.bits.merchant - && unit->race == df::global::ui->race_id - && unit->civ_id == df::global::ui->civ_id) - { - // remove merchant flag + if (unit->flags2.bits.resident) + unit->flags2.bits.resident = 0; + + if(unit->flags1.bits.merchant) unit->flags1.bits.merchant = 0; - return fix_clothing_ownership(out, unit); - } - else - { - out.print("That's not a dwarf merchant of your civilization!\n"); - return CR_FAILURE; - } + + // this one is a cheat, but bugged migrants usually have the same civ_id + // but if it happens that the player has 'foreign' units of the same race + // (dwarves not from moutainhome in vanilla df) on his map, just grab them + if(unit->civ_id != df::global::ui->civ_id) + unit->civ_id = df::global::ui->civ_id; + + return fix_clothing_ownership(out, unit); } - else return CR_WRONG_USAGE; + else + return CR_WRONG_USAGE; return CR_OK; } |
