Ensures consistent formatting and improves some comments

develop
Josh Cooper 2022-10-12 11:21:59 -07:00
parent a3a06fb363
commit a49538695d
1 changed files with 27 additions and 25 deletions

@ -171,17 +171,17 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
}
void enable_auto_unpause(color_ostream &out, bool state) {
if(unpause_enabled != state && lock_collision) {
// when enabled, lock collision means announcements haven't been disabled
// when disabled, lock collision means announcement are still disabled
// the only state left to consider here is what the lock should be set to
// lock_collision == true means: enable_auto_unpause() was already invoked and didn't complete
// The onupdate function above ensure the procedure properly completes, thus we only care about
// state reversal here ergo `enabled != state`
if (lock_collision && unpause_enabled != state) {
// if unpaused_enabled is true, then a lock collision means: we couldn't save/disable the pause settings,
// therefore nothing to revert and the lock won't even be engaged (nothing to unlock)
lock_collision = false;
unpause_enabled = state;
if (unpause_enabled) {
// a collision means we couldn't restore the pause settings, therefore we only need re-engage the lock
pause_lock->lock();
} else {
// this one should be redundant, the lock should already be unlocked right now
pause_lock->unlock();
}
return;
}
@ -202,7 +202,9 @@ void enable_auto_unpause(color_ostream &out, bool state){
}
}
if (lock_collision) {
out.printerr("auto-unpause: must wait for another Pausing::AnnouncementLock to be lifted. This setting will complete when the lock lifts.\n");
out.printerr(
"auto-unpause: must wait for another Pausing::AnnouncementLock to be lifted."
" This setting will complete when the lock lifts.\n");
}
}