aboutsummaryrefslogtreecommitdiff
path: root/engines/queen
diff options
context:
space:
mode:
authorGregory Montoir2007-11-01 18:16:52 +0000
committerGregory Montoir2007-11-01 18:16:52 +0000
commitbd3767068db440322b9846dfb47102233ae80efc (patch)
treed6405127520b62677572c27e7beb2aea6cb3a767 /engines/queen
parentd9d15f9e7ec845dfbf21d2dff191dfe4d19b6726 (diff)
downloadscummvm-rg350-bd3767068db440322b9846dfb47102233ae80efc.tar.gz
scummvm-rg350-bd3767068db440322b9846dfb47102233ae80efc.tar.bz2
scummvm-rg350-bd3767068db440322b9846dfb47102233ae80efc.zip
dont call trim(), which relies on isspace(), with specific game charset strings
svn-id: r29365
Diffstat (limited to 'engines/queen')
-rw-r--r--engines/queen/journal.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/engines/queen/journal.cpp b/engines/queen/journal.cpp
index af32be7322..22d746a4a0 100644
--- a/engines/queen/journal.cpp
+++ b/engines/queen/journal.cpp
@@ -383,9 +383,18 @@ 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];
- strcpy(s, text);
+ strncpy(s, text, 79);
+ s[79] = 0;
+ // remove leading and trailing spaces (necessary for spanish version)
+ for (char *p = s + strlen(s) - 1; p >= s && *p == ' '; --p) {
+ *p = 0;
+ }
+ for (char *p = s; *p == ' '; ++p) {
+ *p = 0;
+ }
+ // draw the substrings
char *p = strchr(s, ' ');
- if (p == NULL) {
+ if (!p) {
int x = (128 - _vm->display()->textWidth(s)) / 2;
_vm->display()->setText(x, y, s, false);
assert(_panelTextCount < MAX_PANEL_TEXTS);
@@ -423,14 +432,7 @@ void Journal::drawPanel(const int *frames, const int *titles, int n) {
int y = 8;
while (n--) {
showBob(bobNum++, 32, y, *frames++);
- // trim panel texts for spanish version
- char buf[128];
- strncpy(buf, _vm->logic()->joeResponse(*titles++), 128);
- buf[127] = 0;
- if (_vm->resource()->getLanguage() != Common::GR_GRE)
- drawPanelText(y + 12, Common::trim(buf));
- else
- drawPanelText(y + 12, buf); // don't trim panel text in Greek version
+ drawPanelText(y + 12, _vm->logic()->joeResponse(*titles++));
y += 48;
}
}