From ebc1a6d85e89db03bcf79ae671bedb6dad9b64ca Mon Sep 17 00:00:00 2001 From: Japa Date: Tue, 8 Nov 2016 13:40:08 +0530 Subject: [PATCH] Add functions to get and set the pause state in DF --- plugins/remotefortressreader.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/remotefortressreader.cpp b/plugins/remotefortressreader.cpp index 4caa8e55f..d1803dc0b 100644 --- a/plugins/remotefortressreader.cpp +++ b/plugins/remotefortressreader.cpp @@ -145,6 +145,8 @@ static command_result GetPlantRaws(color_ostream &stream, const EmptyMessage *in static command_result CopyScreen(color_ostream &stream, const EmptyMessage *in, ScreenCapture *out); static command_result PassKeyboardEvent(color_ostream &stream, const KeyboardEvent *in); static command_result SendDigCommand(color_ostream &stream, const DigCommand *in); +static command_result SetPauseState(color_ostream & stream, const SingleBool * in); +static command_result GetPauseState(color_ostream & stream, const EmptyMessage * in, SingleBool * out); void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem); @@ -250,6 +252,8 @@ DFhackCExport RPCService *plugin_rpcconnect(color_ostream &) svc->addFunction("CopyScreen", CopyScreen); svc->addFunction("PassKeyboardEvent", PassKeyboardEvent); svc->addFunction("SendDigCommand", SendDigCommand); + svc->addFunction("SetPauseState", SetPauseState); + svc->addFunction("GetPauseState", GetPauseState); return svc; } @@ -3008,3 +3012,15 @@ static command_result SendDigCommand(color_ostream &stream, const DigCommand *in mc.WriteAll(); return CR_OK; } + +static command_result SetPauseState(color_ostream &stream, const SingleBool *in) +{ + DFHack::World::SetPauseState(in->value()); + return CR_OK; +} + +static command_result GetPauseState(color_ostream &stream, const EmptyMessage *in, SingleBool *out) +{ + out->set_value(World::ReadPauseState()); + return CR_OK; +} \ No newline at end of file