update arg changed to 'now' for consistency

develop
Najeeb Al-Shabibi 2023-10-01 17:33:53 +01:00
parent f7fd769232
commit 0956c06341
2 changed files with 6 additions and 8 deletions

@ -16,7 +16,7 @@ Usage
``preserve-tombs [status]`` ``preserve-tombs [status]``
check the status of the plugin, and if the plugin is enabled, check the status of the plugin, and if the plugin is enabled,
lists all currently tracked tomb assignments lists all currently tracked tomb assignments
``preserve-tombs update`` ``preserve-tombs now``
forces an immediate update of the tomb assignments. This plugin forces an immediate update of the tomb assignments. This plugin
automatically updates the tomb assignments once every 100 ticks. automatically updates the tomb assignments once every 100 ticks.

@ -98,7 +98,7 @@ static command_result do_command(color_ostream& out, std::vector<std::string>& p
} }
return CR_OK; return CR_OK;
} }
if (params[0] == "update") { if (params[0] == "now") {
if (!is_enabled) { if (!is_enabled) {
out.printerr("Cannot update %s when not enabled", plugin_name); out.printerr("Cannot update %s when not enabled", plugin_name);
return CR_FAILURE; return CR_FAILURE;
@ -232,11 +232,9 @@ static void update_tomb_assignments(color_ostream &out) {
plugin_name, tomb->assigned_unit_id, tomb->id); plugin_name, tomb->assigned_unit_id, tomb->id);
} }
else { else if (it->second != tomb->id) {
if (it->second != tomb->id) { DEBUG(cycle, out).print("%s tomb assignment to %d changed, (old: %d, new: %d)\n",
DEBUG(cycle, out).print("%s tomb assignment to %d changed, (old: %d, new: %d)\n", plugin_name, tomb->assigned_unit_id, it->second, tomb->id);
plugin_name, tomb->assigned_unit_id, it->second, tomb->id);
}
it->second = tomb->id; it->second = tomb->id;
} }
@ -257,7 +255,7 @@ static void update_tomb_assignments(color_ostream &out) {
return true; return true;
} }
if (tomb->assigned_unit_id != unit_id) { if (tomb->assigned_unit_id != unit_id) {
DEBUG(cycle, out).print("%s unassigned unit %d from tomb %d - removing\n", plugin_name, unit_id, building_id); DEBUG(cycle, out).print("%s unit %d unassigned from tomb %d - removing\n", plugin_name, unit_id, building_id);
return true; return true;
} }