Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 authored Oct 5, 2023
1 parent 2a842c0 commit 89be6f5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugins/preserve-tombs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static command_result do_command(color_ostream& out, std::vector<std::string>& p
DFhackCExport command_result plugin_init(color_ostream &out, std::vector <PluginCommand> &commands) {
commands.push_back(PluginCommand(
plugin_name,
"Preserves tomb assignments to units when they die.",
"Preserve tomb assignments when assigned units die.",
do_command));
return CR_OK;
}
Expand Down Expand Up @@ -144,6 +144,8 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
DFhackCExport command_result plugin_shutdown (color_ostream &out) {
DEBUG(config,out).print("shutting down %s\n", plugin_name);

// PluginManager handles unregistering our handler from EventManager,
// so we don't have to do that here
return CR_OK;
}

Expand Down Expand Up @@ -201,11 +203,11 @@ void onUnitDeath(color_ostream& out, void* ptr) {
// assign that unit to their previously assigned tomb in life
int32_t building_id = it->second;
if (!assign_to_tomb(unit_id, building_id)) {
DEBUG(event, out).print("Unit %d died - but failed to assign them to tomb %d\n", unit_id, building_id);
WARN(event, out).print("Unit %d died - but failed to assign them back to their tomb %d\n", unit_id, building_id);
return;
}
// success, print status update and remove assignment from our memo-list
INFO(event, out).print("Unit %d died - assigning them to tomb %d\n", unit_id, building_id);
INFO(event, out).print("Unit %d died - assigning them back to their tomb\n", unit_id);
tomb_assignments.erase(it);

}
Expand Down

0 comments on commit 89be6f5

Please sign in to comment.