Allow console to be disabled by setting an environment variable

develop
lethosor 2014-10-06 16:46:43 -04:00
parent b0b6a82c92
commit e41a33ddea
1 changed files with 6 additions and 3 deletions

@ -1027,12 +1027,15 @@ bool Core::Init()
cerr << "Initializing Console.\n"; cerr << "Initializing Console.\n";
// init the console. // init the console.
bool is_text_mode = false; bool is_text_mode = (init && init->display.flag.is_set(init_display_flags::TEXT));
if(init && init->display.flag.is_set(init_display_flags::TEXT)) if (is_text_mode || getenv("DFHACK_DISABLE_CONSOLE"))
{ {
is_text_mode = true;
con.init(true); con.init(true);
cerr << "Console is not available. Use dfhack-run to send commands.\n"; cerr << "Console is not available. Use dfhack-run to send commands.\n";
if (!is_text_mode)
{
cout << "Console disabled.\n";
}
} }
else if(con.init(false)) else if(con.init(false))
cerr << "Console is running.\n"; cerr << "Console is running.\n";