|
|
@ -171,17 +171,17 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void enable_auto_unpause(color_ostream &out, bool state) {
|
|
|
|
void enable_auto_unpause(color_ostream &out, bool state) {
|
|
|
|
if(unpause_enabled != state && lock_collision) {
|
|
|
|
// lock_collision == true means: enable_auto_unpause() was already invoked and didn't complete
|
|
|
|
// when enabled, lock collision means announcements haven't been disabled
|
|
|
|
// The onupdate function above ensure the procedure properly completes, thus we only care about
|
|
|
|
// when disabled, lock collision means announcement are still disabled
|
|
|
|
// state reversal here ergo `enabled != state`
|
|
|
|
// the only state left to consider here is what the lock should be set to
|
|
|
|
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;
|
|
|
|
lock_collision = false;
|
|
|
|
unpause_enabled = state;
|
|
|
|
unpause_enabled = state;
|
|
|
|
if (unpause_enabled) {
|
|
|
|
if (unpause_enabled) {
|
|
|
|
|
|
|
|
// a collision means we couldn't restore the pause settings, therefore we only need re-engage the lock
|
|
|
|
pause_lock->lock();
|
|
|
|
pause_lock->lock();
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// this one should be redundant, the lock should already be unlocked right now
|
|
|
|
|
|
|
|
pause_lock->unlock();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -202,7 +202,9 @@ void enable_auto_unpause(color_ostream &out, bool state){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (lock_collision) {
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|