diff options
author | darkvater <darkvater@openttd.org> | 2005-01-16 18:19:33 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2005-01-16 18:19:33 +0000 |
commit | a1e94b67d5c10c102b4fe1361e2445f1bceecf47 (patch) | |
tree | 5e72298cb7925377eeac485f5f2e3e75ebef9d4f /console.c | |
parent | 85213673734ddaf2bd02f6be74341a5e0eeda47c (diff) | |
download | openttd-a1e94b67d5c10c102b4fe1361e2445f1bceecf47.tar.xz |
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
-Fix: [1103113] font size changing. Dedicated server did not have code filtering, 'tab' could result in bigger fonts
-Fix: [1103069] console backspace key with ded server; fixed due to normal console handling
-Fix: [1101963] console in dedicated server; see above
-Fix: dedicated server also writes to log file if active
Diffstat (limited to 'console.c')
-rw-r--r-- | console.c | 35 |
1 files changed, 27 insertions, 8 deletions
@@ -192,9 +192,8 @@ static void IConsoleWndProc(Window* w, WindowEvent* e) IConsolePrintF(_iconsole_color_commands, "] %s", _iconsole_cmdline); _iconsole_cmdbufferpos = 19; IConsoleCmdBufferAdd(_iconsole_cmdline); - if (strlen(_iconsole_cmdline) != 0) // only execute if there is something typed obviously - IConsoleCmdExec(_iconsole_cmdline); + IConsoleCmdExec(_iconsole_cmdline); IConsoleClearCommand(); break; case WKC_CTRL | WKC_RETURN: @@ -271,11 +270,31 @@ void IConsoleClear(void) free(_iconsole_buffer[i]); } +static void IConsoleWriteToLogFile(const char* string) +{ + if (_iconsole_output_file != NULL) { + // if there is an console output file ... also print it there + fwrite(string, strlen(string), 1, _iconsole_output_file); + fwrite("\n", 1, 1, _iconsole_output_file); + } +} + +bool CloseConsoleLogIfActive(void) +{ + if (_iconsole_output_file != NULL) { + IConsolePrintF(_iconsole_color_default, "file output complete"); + fclose(_iconsole_output_file); + return true; + } + + return false; +} + void IConsoleFree(void) { _iconsole_inited = false; IConsoleClear(); - if (_iconsole_output_file != NULL) fclose(_iconsole_output_file); + CloseConsoleLogIfActive(); } void IConsoleResize(void) @@ -382,6 +401,7 @@ void IConsolePrint(uint16 color_code, const char* string) if (_network_dedicated) { printf("%s\n", string); + IConsoleWriteToLogFile(string); return; } @@ -403,11 +423,7 @@ void IConsolePrint(uint16 color_code, const char* string) } free(_ex); - if (_iconsole_output_file != NULL) { - // if there is an console output file ... also print it there - fwrite(string, strlen(string), 1, _iconsole_output_file); - fwrite("\n", 1, 1, _iconsole_output_file); - } + IConsoleWriteToLogFile(string); if (_iconsole_win != NULL) SetWindowDirty(_iconsole_win); } @@ -1072,6 +1088,9 @@ void IConsoleCmdExec(const char* cmdstr) uint c; uint i; uint l; + + if (strlen(cmdstr) == 0) // only execute if there is something typed obviously + return; if (_stdlib_con_developer) IConsolePrintF(_iconsole_color_debug, "CONDEBUG: execution_cmdline: %s", cmdstr); |