summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-11 23:39:21 +0000
committerdarkvater <darkvater@openttd.org>2005-01-11 23:39:21 +0000
commit1a450b0b39dc78b20c1df46c091534f8c4ad74a5 (patch)
tree9691fab7c204aa07e946f54f881222346460e3ee
parent4873c0b1ea98a75d46cc50a0b4f87996433305c3 (diff)
downloadopenttd-1a450b0b39dc78b20c1df46c091534f8c4ad74a5.tar.xz
(svn r1484) -Fix: [1099197] scrolling through console sometimes crashed the whole game. Also added MarkWholeScreenDirty() to have redrawing of console resize instant (sign_de)
-rw-r--r--console.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/console.c b/console.c
index 1a4671593..f1ede12ec 100644
--- a/console.c
+++ b/console.c
@@ -94,9 +94,6 @@ static void IConsoleClearCommand(void)
static void IConsoleWndProc(Window* w, WindowEvent* e)
{
- // only do window events with the console
- w = FindWindowById(WC_CONSOLE, 0);
-
switch(e->event) {
case WE_PAINT:
{
@@ -104,7 +101,7 @@ static void IConsoleWndProc(Window* w, WindowEvent* e)
int max = (w->height / ICON_LINE_HEIGHT) - 1;
int delta = 0;
GfxFillRect(w->left, w->top, w->width, w->height - 1, 0);
- while ((i > _iconsole_scroll - max) && (_iconsole_buffer[i] != NULL)) {
+ while ((i > 0) && (i > _iconsole_scroll - max) && (_iconsole_buffer[i] != NULL)) {
DoDrawString(_iconsole_buffer[i], 5,
w->height - (_iconsole_scroll + 2 - i) * ICON_LINE_HEIGHT, _iconsole_cbuffer[i]);
i--;
@@ -281,6 +278,9 @@ void IConsoleFree(void)
void IConsoleResize(void)
{
+
+ _iconsole_win = FindWindowById(WC_CONSOLE, 0);
+
switch (_iconsole_mode) {
case ICONSOLE_OPENED:
_iconsole_win->height = _screen.height / 3;
@@ -293,6 +293,8 @@ void IConsoleResize(void)
default:
break;
}
+
+ MarkWholeScreenDirty();
}
void IConsoleSwitch(void)
@@ -315,6 +317,8 @@ void IConsoleSwitch(void)
_iconsole_mode = ICONSOLE_CLOSED;
break;
}
+
+ MarkWholeScreenDirty();
}
void IConsoleClose(void)