diff options
| author | Alexander Gavrilov | 2012-06-14 13:08:39 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-06-14 13:08:39 +0400 |
| commit | bbc1fb010ec16ea9260cfc6fe8cc122f79c2d0e6 (patch) | |
| tree | 7f2fbaf5bcb2043270e54791b2a31e2daf142934 /library/Core.cpp | |
| parent | 7eb4fc19de542db0d3e271123f24773e0c8c481e (diff) | |
| download | dfhack-bbc1fb010ec16ea9260cfc6fe8cc122f79c2d0e6.tar.gz dfhack-bbc1fb010ec16ea9260cfc6fe8cc122f79c2d0e6.tar.bz2 dfhack-bbc1fb010ec16ea9260cfc6fe8cc122f79c2d0e6.tar.xz | |
Fix TEXT mode support, even making it work somewhat.
- Initialize the global pointers before trying to use init.
- Print a message suggesting the use of dfhack-run.
- Don't start the console thread if there is no console.
- When console is disabled, print anything given to it to stderr.
Diffstat (limited to 'library/Core.cpp')
| -rw-r--r-- | library/Core.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/library/Core.cpp b/library/Core.cpp index a1090450..3a75991c 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -811,14 +811,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); @@ -833,7 +838,6 @@ bool Core::Init() */ // initialize data defs virtual_identity::Init(this); - df::global::InitGlobals(); // initialize common lua context Lua::Core::Init(con); @@ -843,12 +847,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(); |
