2010-11-07 01:49:33 -07:00
|
|
|
// This forces the game to pause.
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
#include <DFHack.h>
|
|
|
|
#include <dfhack/modules/Gui.h>
|
2011-05-17 00:36:38 -06:00
|
|
|
#include <dfhack/extra/termutil.h>
|
2010-11-07 01:49:33 -07:00
|
|
|
|
2010-11-10 18:09:43 -07:00
|
|
|
int main (int argc, char** argv)
|
2010-11-07 01:49:33 -07:00
|
|
|
{
|
2011-05-14 22:10:47 -06:00
|
|
|
bool temporary_terminal = TemporaryTerminal();
|
2010-11-10 18:09:43 -07:00
|
|
|
bool quiet = false;
|
|
|
|
for(int i = 1; i < argc; i++)
|
|
|
|
{
|
|
|
|
string test = argv[i];
|
|
|
|
if(test == "-q")
|
|
|
|
{
|
|
|
|
quiet = true;
|
|
|
|
}
|
2010-11-10 18:32:33 -07:00
|
|
|
}
|
|
|
|
|
2010-11-07 01:49:33 -07:00
|
|
|
DFHack::ContextManager DFMgr("Memory.xml");
|
|
|
|
DFHack::Context *DF;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
DF = DFMgr.getSingleContext();
|
|
|
|
DF->Attach();
|
|
|
|
}
|
|
|
|
catch (exception& e)
|
|
|
|
{
|
|
|
|
cerr << e.what() << endl;
|
2011-05-14 22:10:47 -06:00
|
|
|
if(!quiet && temporary_terminal)
|
|
|
|
cin.ignore();
|
2010-11-07 01:49:33 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-03-18 04:38:37 -06:00
|
|
|
DFHack::World *World =DF->getWorld();
|
2010-11-07 01:49:33 -07:00
|
|
|
cout << "Pausing..." << endl;
|
|
|
|
|
2011-03-18 04:38:37 -06:00
|
|
|
World->SetPauseState(true);
|
2010-11-07 01:49:33 -07:00
|
|
|
DF->Resume();
|
2011-05-14 22:10:47 -06:00
|
|
|
cout << "Done. The current game frame will have to finish first. This can take some time on bugged maps." << endl;
|
|
|
|
if(!quiet && temporary_terminal)
|
|
|
|
cin.ignore();
|
2010-11-07 01:49:33 -07:00
|
|
|
return 0;
|
|
|
|
}
|