summaryrefslogtreecommitdiff
path: root/library/Core.cpp
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-03-14 19:57:29 +0400
committerAlexander Gavrilov2012-03-14 19:57:29 +0400
commit560e977f0589ac1c0feb6ea825d20d351e325826 (patch)
treee32bf2135261fa1e9129fae4c2c7ae068b6ef4cc /library/Core.cpp
parentc42e2ff053bc3acbded353112cd6412c8211f279 (diff)
downloaddfhack-560e977f0589ac1c0feb6ea825d20d351e325826.tar.gz
dfhack-560e977f0589ac1c0feb6ea825d20d351e325826.tar.bz2
dfhack-560e977f0589ac1c0feb6ea825d20d351e325826.tar.xz
Implement trivial RPC interface for dfhack via TCP & protobufs.
Use it to make an executable capable of calling commands remotely.
Diffstat (limited to 'library/Core.cpp')
-rw-r--r--library/Core.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/library/Core.cpp b/library/Core.cpp
index 9a005d33..0765f4cd 100644
--- a/library/Core.cpp
+++ b/library/Core.cpp
@@ -48,6 +48,7 @@ using namespace std;
#include "modules/World.h"
#include "modules/Graphic.h"
#include "modules/Windows.h"
+#include "RemoteServer.h"
using namespace DFHack;
#include "df/ui.h"
@@ -570,6 +571,7 @@ Core::Core()
last_world_data_ptr = NULL;
top_viewscreen = NULL;
screen_window = NULL;
+ server = NULL;
};
void Core::fatal (std::string output, bool deactivate)
@@ -678,6 +680,12 @@ bool Core::Init()
screen_window = new Windows::top_level_window();
screen_window->addChild(new Windows::dfhack_dummy(5,10));
started = true;
+
+ cerr << "Starting the TCP listener.\n";
+ server = new ServerMain();
+ if (!server->listen(RemoteClient::GetDefaultPort()))
+ cerr << "TCP listen failed.\n";
+
cerr << "DFHack is running.\n";
return true;
}