diff options
| author | Petr Mrázek | 2011-11-06 01:26:57 +0100 |
|---|---|---|
| committer | Petr Mrázek | 2011-11-06 01:26:57 +0100 |
| commit | 5007419fcd58b0eff8d53abe587b7807e2ccfc74 (patch) | |
| tree | 9fe85bdd5f5c586595a7dd6a855bb6b020ae857c /plugins/reveal.cpp | |
| parent | 9be4092c7fe80fda6c566c74773672970a90e808 (diff) | |
| download | dfhack-5007419fcd58b0eff8d53abe587b7807e2ccfc74.tar.gz dfhack-5007419fcd58b0eff8d53abe587b7807e2ccfc74.tar.bz2 dfhack-5007419fcd58b0eff8d53abe587b7807e2ccfc74.tar.xz | |
Add nopause command.
Diffstat (limited to 'plugins/reveal.cpp')
| -rw-r--r-- | plugins/reveal.cpp | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/plugins/reveal.cpp b/plugins/reveal.cpp index 93bc3d43..5d7c1df2 100644 --- a/plugins/reveal.cpp +++ b/plugins/reveal.cpp @@ -47,6 +47,7 @@ struct hideblock // the saved data. we keep map size to check if things still match uint32_t x_max, y_max, z_max; std::vector <hideblock> hidesaved; +bool nopause_state = false; enum revealstate { @@ -62,6 +63,7 @@ DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> & DFhackCExport command_result unreveal(DFHack::Core * c, std::vector<std::string> & params); DFhackCExport command_result revtoggle(DFHack::Core * c, std::vector<std::string> & params); DFhackCExport command_result revflood(DFHack::Core * c, std::vector<std::string> & params); +DFhackCExport command_result nopause(DFHack::Core * c, std::vector<std::string> & params); DFhackCExport const char * plugin_name ( void ) { @@ -75,21 +77,26 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> commands.push_back(PluginCommand("unreveal","Revert the map to its previous state.",unreveal)); commands.push_back(PluginCommand("revtoggle","Reveal/unreveal depending on state.",revtoggle)); commands.push_back(PluginCommand("revflood","Hide all, reveal all tiles reachable from cursor position.",revflood)); + commands.push_back(PluginCommand("nopause","Disable pausing (doesn't affect pause forced by reveal).",nopause)); return CR_OK; } DFhackCExport command_result plugin_onupdate ( Core * c ) { - // if the map is revealed and we're in fortress mode, force the game to pause. - if(revealed == REVEALED) + DFHack::World *World =c->getWorld(); + t_gamemodes gm; + World->ReadGameMode(gm); + if(gm.g_mode == GAMEMODE_DWARF) { - DFHack::World *World =c->getWorld(); - t_gamemodes gm; - World->ReadGameMode(gm); - if(gm.g_mode == GAMEMODE_DWARF) + // if the map is revealed and we're in fortress mode, force the game to pause. + if(revealed == REVEALED) { World->SetPauseState(true); } + else if(nopause_state) + { + World->SetPauseState(false); + } } return CR_OK; } @@ -99,6 +106,25 @@ DFhackCExport command_result plugin_shutdown ( Core * c ) return CR_OK; } +command_result nopause (Core * c, std::vector <std::string> & parameters) +{ + if (parameters.size() == 1 && (parameters[0] == "0" || parameters[0] == "1")) + { + if (parameters[0] == "0") + nopause_state = 0; + else + nopause_state = 1; + c->con.print("nopause %sactivated.\n", (nopause_state ? "" : "de")); + } + else + { + c->con.print("Disable pausing (doesn't affect pause forced by reveal).\nActivate with 'nopause 1', deactivate with 'nopause 0'.\nCurrent state: %d.\n", nopause_state); + } + + return CR_OK; +} + + DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> & params) { bool no_hell = true; |
