From 81587337452dfbc56decf44cdc038ef10ef8bcdc Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 15 Jan 2012 15:57:33 +0400 Subject: [PATCH] Support changing the custom profession via rename. Likewise, it works for any unit, including animals and enemies. --- plugins/rename.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/rename.cpp b/plugins/rename.cpp index 8ffc3af05..9cd864042 100644 --- a/plugins/rename.cpp +++ b/plugins/rename.cpp @@ -40,7 +40,9 @@ DFhackCExport command_result plugin_init (Core *c, std::vector & "rename", "Rename various things.", rename, false, " rename squad \"name\"\n" " rename hotkey \"name\"\n" + " (identified by ordinal index)\n" " rename unit \"nickname\"\n" + " rename unit-profession \"custom profession\"\n" " (a unit must be highlighted in the ui)\n" )); } @@ -123,6 +125,17 @@ static command_result rename(Core * c, vector ¶meters) if (figure) 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 { if (!parameters.empty() && cmd != "?")