aboutsummaryrefslogtreecommitdiff
path: root/queen/display.cpp
diff options
context:
space:
mode:
authorGregory Montoir2004-06-04 17:29:26 +0000
committerGregory Montoir2004-06-04 17:29:26 +0000
commit39f49de6bb0a465561c3e5b5b8ad230218ab5f56 (patch)
treea119bc7cb882763202f00564376f848dc8ced21d /queen/display.cpp
parent6be8956d2c253770ee1001838cd9d7019a58a5fc (diff)
downloadscummvm-rg350-39f49de6bb0a465561c3e5b5b8ad230218ab5f56.tar.gz
scummvm-rg350-39f49de6bb0a465561c3e5b5b8ad230218ab5f56.tar.bz2
scummvm-rg350-39f49de6bb0a465561c3e5b5b8ad230218ab5f56.zip
handle long command strings better (see bug report 962828)
svn-id: r13928
Diffstat (limited to 'queen/display.cpp')
-rw-r--r--queen/display.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/queen/display.cpp b/queen/display.cpp
index 5586f8a0ee..47a7f5cd32 100644
--- a/queen/display.cpp
+++ b/queen/display.cpp
@@ -828,8 +828,18 @@ void Display::setText(uint16 x, uint16 y, const char *text, bool outlined) {
}
void Display::setTextCentered(uint16 y, const char *text, bool outlined) {
- uint16 x = (GAME_SCREEN_WIDTH - textWidth(text)) / 2;
- setText(x, y, text, outlined);
+ int len = strlen(text);
+ int16 x;
+ while ((x = (GAME_SCREEN_WIDTH - textWidth(text, len)) / 2) <= 0) {
+ ++text;
+ len -= 2;
+ }
+ assert(y < GAME_SCREEN_HEIGHT);
+ TextSlot *pts = &_texts[y];
+ pts->x = x;
+ pts->color = _curTextColor;
+ pts->outlined = outlined;
+ pts->text = Common::String(text, len);
}
void Display::drawTexts() {