From 36a372ecd1a8c04399cb4ba996ac0bfbb0f907aa Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Thu, 1 Nov 2007 18:42:22 +0000 Subject: fix previous commit svn-id: r29367 --- engines/queen/journal.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/engines/queen/journal.cpp b/engines/queen/journal.cpp index 22d746a4a0..e9f02ff41b 100644 --- a/engines/queen/journal.cpp +++ b/engines/queen/journal.cpp @@ -382,30 +382,31 @@ void Journal::handleMouseDown(int x, int y) { void Journal::drawPanelText(int y, const char *text) { debug(7, "Journal::drawPanelText(%d, '%s')", y, text); - char s[80]; - strncpy(s, text, 79); - s[79] = 0; + char s[128]; + strncpy(s, text, 127); + s[127] = 0; // remove leading and trailing spaces (necessary for spanish version) for (char *p = s + strlen(s) - 1; p >= s && *p == ' '; --p) { *p = 0; } + text = s; for (char *p = s; *p == ' '; ++p) { - *p = 0; + text = p + 1; } // draw the substrings - char *p = strchr(s, ' '); + char *p = strchr(text, ' '); if (!p) { - int x = (128 - _vm->display()->textWidth(s)) / 2; - _vm->display()->setText(x, y, s, false); + int x = (128 - _vm->display()->textWidth(text)) / 2; + _vm->display()->setText(x, y, text, false); assert(_panelTextCount < MAX_PANEL_TEXTS); _panelTextY[_panelTextCount++] = y; } else { *p++ = '\0'; if (_vm->resource()->getLanguage() == Common::HB_ISR) { drawPanelText(y - 5, p); - drawPanelText(y + 5, s); + drawPanelText(y + 5, text); } else { - drawPanelText(y - 5, s); + drawPanelText(y - 5, text); drawPanelText(y + 5, p); } } -- cgit v1.2.3