Support changing the custom profession via rename.

Likewise, it works for any unit, including animals and enemies.
develop
Alexander Gavrilov 2012-01-15 15:57:33 +04:00
parent bcb51d8ff7
commit 8158733745
1 changed files with 13 additions and 0 deletions

@ -40,7 +40,9 @@ DFhackCExport command_result plugin_init (Core *c, std::vector <PluginCommand> &
"rename", "Rename various things.", rename, false, "rename", "Rename various things.", rename, false,
" rename squad <index> \"name\"\n" " rename squad <index> \"name\"\n"
" rename hotkey <index> \"name\"\n" " rename hotkey <index> \"name\"\n"
" (identified by ordinal index)\n"
" rename unit \"nickname\"\n" " rename unit \"nickname\"\n"
" rename unit-profession \"custom profession\"\n"
" (a unit must be highlighted in the ui)\n" " (a unit must be highlighted in the ui)\n"
)); ));
} }
@ -123,6 +125,17 @@ static command_result rename(Core * c, vector <string> &parameters)
if (figure) if (figure)
set_nickname(&figure->name, parameters[1]); set_nickname(&figure->name, parameters[1]);
} }
else if (cmd == "unit-profession")
{
if (parameters.size() != 2)
return CR_WRONG_USAGE;
df::unit *unit = getSelectedUnit(c);
if (!unit)
return CR_WRONG_USAGE;
unit->custom_profession = parameters[1];
}
else else
{ {
if (!parameters.empty() && cmd != "?") if (!parameters.empty() && cmd != "?")