diff options
| author | Petr Mrázek | 2012-06-23 00:25:50 +0200 |
|---|---|---|
| committer | Petr Mrázek | 2012-06-23 00:25:50 +0200 |
| commit | 59fb4daa9a366a8f6da879108cd7cee5c2aa0b71 (patch) | |
| tree | 72cd0dcfe6f2db201fc93d235bcfb8bf8964b2ba /library/Core.cpp | |
| parent | 6199d6915cd6e2420dbcd84d09e1d4eb4833eeaf (diff) | |
| parent | 0e582901ee972853999dfc86dbe93093a65cd35b (diff) | |
| download | dfhack-59fb4daa9a366a8f6da879108cd7cee5c2aa0b71.tar.gz dfhack-59fb4daa9a366a8f6da879108cd7cee5c2aa0b71.tar.bz2 dfhack-59fb4daa9a366a8f6da879108cd7cee5c2aa0b71.tar.xz | |
Merge https://github.com/angavrilov/dfhack
Diffstat (limited to 'library/Core.cpp')
| -rw-r--r-- | library/Core.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/library/Core.cpp b/library/Core.cpp index 8c8badf1..df11ca5b 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -264,16 +264,12 @@ static bool init_run_script(color_ostream &out, lua_State *state, void *info) return true; } -static command_result runLuaScript(color_ostream &out, std::string filename, vector<string> &args) +static command_result runLuaScript(color_ostream &out, std::string name, vector<string> &args) { ScriptArgs data; - data.pcmd = &filename; + data.pcmd = &name; data.pargs = &args; -#ifndef LINUX_BUILD - filename = toLower(filename); -#endif - bool ok = Lua::RunCoreQueryLoop(out, Lua::Core::State, init_run_script, &data); return ok ? CR_OK : CR_FAILURE; @@ -610,7 +606,7 @@ command_result Core::runCommand(color_ostream &con, const std::string &first, ve { auto filename = getHackPath() + "scripts/" + first + ".lua"; if (fileExists(filename)) - res = runLuaScript(con, filename, parts); + res = runLuaScript(con, first, parts); else con.printerr("%s is not a recognized command.\n", first.c_str()); } @@ -806,14 +802,19 @@ bool Core::Init() } cerr << "Version: " << vinfo->getVersion() << endl; + // Init global object pointers + df::global::InitGlobals(); + cerr << "Initializing Console.\n"; // init the console. bool is_text_mode = false; if(init && init->display.flag.is_set(init_display_flags::TEXT)) { is_text_mode = true; + con.init(true); + cerr << "Console is not available. Use dfhack-run to send commands.\n"; } - if(con.init(is_text_mode)) + else if(con.init(false)) cerr << "Console is running.\n"; else fatal ("Console has failed to initialize!\n", false); @@ -828,7 +829,6 @@ bool Core::Init() */ // initialize data defs virtual_identity::Init(this); - df::global::InitGlobals(); // initialize common lua context Lua::Core::Init(con); @@ -838,12 +838,15 @@ bool Core::Init() cerr << "Initializing Plugins.\n"; // create plugin manager plug_mgr = new PluginManager(this); - cerr << "Starting IO thread.\n"; - // create IO thread IODATA *temp = new IODATA; temp->core = this; temp->plug_mgr = plug_mgr; - thread * IO = new thread(fIOthread, (void *) temp); + if (!is_text_mode) + { + cerr << "Starting IO thread.\n"; + // create IO thread + thread * IO = new thread(fIOthread, (void *) temp); + } cerr << "Starting DF input capture thread.\n"; // set up hotkey capture HotkeyMutex = new mutex(); |
