summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--console.c15
-rw-r--r--console.h2
-rw-r--r--ttd.c13
-rw-r--r--window.c3
4 files changed, 13 insertions, 20 deletions
diff --git a/console.c b/console.c
index d1c7e278b..d72d2299d 100644
--- a/console.c
+++ b/console.c
@@ -16,7 +16,7 @@ static byte* _iconsole_buffer[80];
static byte _iconsole_cbuffer[80];
static byte _iconsole_cmdline[255];
static byte _iconsole_cmdpos;
-static byte _iconsole_mode;
+static byte _iconsole_mode = ICONSOLE_CLOSED;
static byte _iconsole_color_default = 1;
static byte _iconsole_color_error = 3;
static byte _iconsole_color_debug = 5;
@@ -66,7 +66,8 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
{
switch(e->event) {
- case WE_PAINT:
+ case WE_PAINT:
+
GfxFillRect(w->left,w->top,w->width,w->height-1,0);
{
int i=_iconsole_scroll;
@@ -82,10 +83,6 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
case WE_TICK:
- if (_iconsole_mode==ICONSOLE_OPENING) {
- _iconsole_mode=ICONSOLE_OPENED;
- }
-
_icursor_counter++;
if (_icursor_counter>_icursor_rate) {
_icursor_state=!_icursor_state;
@@ -223,7 +220,7 @@ void IConsoleSwitch()
_iconsole_win = AllocateWindowDesc(&_iconsole_window_desc);
_iconsole_win->height = _screen.height / 3;
_iconsole_win->width= _screen.width;
- _iconsole_mode=ICONSOLE_OPENING;
+ _iconsole_mode=ICONSOLE_OPENED;
} else
if (_iconsole_mode==ICONSOLE_OPENED) {
DeleteWindow(_iconsole_win);
@@ -236,7 +233,8 @@ void IConsoleSwitch()
}
void IConsoleClose() {
-if (_iconsole_mode==ICONSOLE_OPENED) IConsoleSwitch();
+if (_iconsole_mode==ICONSOLE_OPENED) IConsoleSwitch();
+_iconsole_mode=ICONSOLE_CLOSED;
}
void IConsoleOpen() {
@@ -1188,7 +1186,6 @@ static void IConsoleStdLibRegister() {
var = IConsoleVarAlloc(ICONSOLE_VAR_UINT32);
IConsoleVarInsert(var,"temp_uint32");
-
var = IConsoleVarAlloc(ICONSOLE_VAR_STRING);
IConsoleVarInsert(var,"temp_string");
}
diff --git a/console.h b/console.h
index a7e9a2d6e..0f7c3a28b 100644
--- a/console.h
+++ b/console.h
@@ -3,8 +3,6 @@
enum {
ICONSOLE_OPENED=0,
ICONSOLE_CLOSED,
- ICONSOLE_OPENING,
- ICONSOLE_CLOSING,
} _iconsole_modes;
// ** console parser ** //
diff --git a/ttd.c b/ttd.c
index f395acea6..5b2faee5f 100644
--- a/ttd.c
+++ b/ttd.c
@@ -642,8 +642,8 @@ void LoadIntroGame()
_opt_mod_ptr = &_new_opt;
GfxLoadSprites();
LoadStringWidthTable();
- // Setup main window
- IConsoleClose();
+
+ // Setup main window
InitWindowSystem();
SetupColorsAndInitialWindow();
@@ -672,8 +672,7 @@ void MakeNewGame()
GfxLoadSprites();
- // Reinitialize windows
- IConsoleClose();
+ // Reinitialize windows
InitWindowSystem();
LoadStringWidthTable();
@@ -700,8 +699,7 @@ void MakeNewEditorWorld()
GfxLoadSprites();
- // Re-init the windowing system
- IConsoleClose();
+ // Re-init the windowing system
InitWindowSystem();
// Create toolbars
@@ -735,8 +733,7 @@ void StartScenario()
GfxLoadSprites();
- // Reinitialize windows
- IConsoleClose();
+ // Reinitialize windows
InitWindowSystem();
LoadStringWidthTable();
diff --git a/window.c b/window.c
index c51245972..e0450867d 100644
--- a/window.c
+++ b/window.c
@@ -574,7 +574,8 @@ Window *FindWindowFromPt(int x, int y)
void InitWindowSystem()
-{
+{
+ IConsoleClose();
memset(&_windows, 0, sizeof(_windows));
_last_window = _windows;
memset(_viewports, 0, sizeof(_viewports));