summaryrefslogtreecommitdiff
path: root/plugins/rename.cpp
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-01-15 15:57:33 +0400
committerAlexander Gavrilov2012-01-15 15:57:33 +0400
commit81587337452dfbc56decf44cdc038ef10ef8bcdc (patch)
treedafc40ad8496d9b2af08d4273749377836e5840b /plugins/rename.cpp
parentbcb51d8ff72f3d030a38cbb05f8b84378ca38352 (diff)
downloaddfhack-81587337452dfbc56decf44cdc038ef10ef8bcdc.tar.gz
dfhack-81587337452dfbc56decf44cdc038ef10ef8bcdc.tar.bz2
dfhack-81587337452dfbc56decf44cdc038ef10ef8bcdc.tar.xz
Support changing the custom profession via rename.
Likewise, it works for any unit, including animals and enemies.
Diffstat (limited to 'plugins/rename.cpp')
-rw-r--r--plugins/rename.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/rename.cpp b/plugins/rename.cpp
index 8ffc3af0..9cd86404 100644
--- a/plugins/rename.cpp
+++ b/plugins/rename.cpp
@@ -40,7 +40,9 @@ DFhackCExport command_result plugin_init (Core *c, std::vector <PluginCommand> &
"rename", "Rename various things.", rename, false,
" rename squad <index> \"name\"\n"
" rename hotkey <index> \"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 <string> &parameters)
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 != "?")