diff options
| author | Robert Heinrich | 2012-04-10 00:22:38 +0200 |
|---|---|---|
| committer | Robert Heinrich | 2012-04-10 00:22:38 +0200 |
| commit | 674337e3aea18203d69820c8f6f429d8af439738 (patch) | |
| tree | 47fa67eaa0045df431428315eb726fafe5af0992 /plugins/tweak.cpp | |
| parent | e26fbd4e4cadd260b5467274006a601f897e8fbd (diff) | |
| download | dfhack-674337e3aea18203d69820c8f6f429d8af439738.tar.gz dfhack-674337e3aea18203d69820c8f6f429d8af439738.tar.bz2 dfhack-674337e3aea18203d69820c8f6f429d8af439738.tar.xz | |
added tweak clear-resident which fixes bugged migrants and makes them proper members of the fortress. added tweak clear-merchant which assimilates merchants who linger at the map edge into the fortress. updated readme.rst
Diffstat (limited to 'plugins/tweak.cpp')
| -rw-r--r-- | plugins/tweak.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/plugins/tweak.cpp b/plugins/tweak.cpp index d2fef313..edfa7081 100644 --- a/plugins/tweak.cpp +++ b/plugins/tweak.cpp @@ -50,6 +50,14 @@ 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" )); return CR_OK; } @@ -106,6 +114,46 @@ static command_result tweak(color_ostream &out, vector <string> ¶meters) return CR_FAILURE; } } + else if (cmd == "clear-resident") + { + 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) + { + // remove resident flag + unit->flags2.bits.resident = 0; + } + else + { + out.print("That's not a resident dwarf of your civilization!\n"); + 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 + unit->flags1.bits.merchant = 0; + } + else + { + out.print("That's not a dwarf merchant of your civilization!\n"); + return CR_FAILURE; + } + } else return CR_WRONG_USAGE; return CR_OK; |
