Revert "Revises nopause in reveal with pause API in World module"

This reverts commit 318dd4c7db.
develop
Josh Cooper 2022-10-12 14:15:11 -07:00
parent 63e9192367
commit 303599222c
1 changed files with 5 additions and 21 deletions

@ -62,7 +62,6 @@ struct hideblock
uint32_t x_max, y_max, z_max; uint32_t x_max, y_max, z_max;
vector <hideblock> hidesaved; vector <hideblock> hidesaved;
bool nopause_state = false; bool nopause_state = false;
Pausing::PlayerLock* pause_lock = nullptr;
enum revealstate enum revealstate
{ {
@ -107,7 +106,6 @@ DFhackCExport command_result plugin_init ( color_ostream &out, vector <PluginCom
"nopause", "nopause",
"Disable manual and automatic pausing.", "Disable manual and automatic pausing.",
nopause)); nopause));
pause_lock = World::AcquirePlayerPauseLock("reveal::nopause");
return CR_OK; return CR_OK;
} }
@ -132,7 +130,6 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
DFhackCExport command_result plugin_shutdown ( color_ostream &out ) DFhackCExport command_result plugin_shutdown ( color_ostream &out )
{ {
World::ReleasePauseLock(pause_lock);
return CR_OK; return CR_OK;
} }
@ -140,23 +137,10 @@ command_result nopause (color_ostream &out, vector <string> & parameters)
{ {
if (parameters.size() == 1 && (parameters[0] == "0" || parameters[0] == "1")) if (parameters.size() == 1 && (parameters[0] == "0" || parameters[0] == "1"))
{ {
if (parameters[0] == "0") { if (parameters[0] == "0")
if (nopause_state) {
pause_lock->unlock();
if (!World::EnablePlayerPausing()) {
out.printerr("reveal/nopause: Player pausing is currently locked by another plugin / script. Unable to re-enable.\n");
}
}
nopause_state = 0; nopause_state = 0;
} else { else
if (!nopause_state) {
pause_lock->unlock();
if (!World::DisablePlayerPausing()) {
out.printerr("reveal/nopause: Player pausing is currently locked by another plugin / script. Unable to disable.\n");
}
}
nopause_state = 1; nopause_state = 1;
}
is_active = nopause_state || (revealed == REVEALED); is_active = nopause_state || (revealed == REVEALED);
out.print("nopause %sactivated.\n", (nopause_state ? "" : "de")); out.print("nopause %sactivated.\n", (nopause_state ? "" : "de"));
} }
@ -490,7 +474,7 @@ command_result revflood(color_ostream &out, vector<string> & params)
return CR_WRONG_USAGE; return CR_WRONG_USAGE;
} }
CoreSuspender suspend; CoreSuspender suspend;
uint32_t xmax,ymax,zmax; uint32_t x_max,y_max,z_max;
if (!Maps::IsValid()) if (!Maps::IsValid())
{ {
out.printerr("Map is not available!\n"); out.printerr("Map is not available!\n");
@ -509,7 +493,7 @@ command_result revflood(color_ostream &out, vector<string> & params)
return CR_FAILURE; return CR_FAILURE;
} }
int32_t cx, cy, cz; int32_t cx, cy, cz;
Maps::getSize(xmax, ymax, zmax); Maps::getSize(x_max,y_max,z_max);
Gui::getCursorCoords(cx,cy,cz); Gui::getCursorCoords(cx,cy,cz);
if(cx == -30000) if(cx == -30000)
@ -527,7 +511,7 @@ command_result revflood(color_ostream &out, vector<string> & params)
return CR_FAILURE; return CR_FAILURE;
} }
// hide all tiles, flush cache // hide all tiles, flush cache
Maps::getSize(xmax, ymax, zmax); Maps::getSize(x_max,y_max,z_max);
for(size_t i = 0; i < world->map.map_blocks.size(); i++) for(size_t i = 0; i < world->map.map_blocks.size(); i++)
{ {