aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2007-05-20 07:24:05 +0000
committerPaul Gilbert2007-05-20 07:24:05 +0000
commit8be618fb47bdd413db8b0dc30e67a9443038c944 (patch)
tree7dd54e5aa6f18ea91f83b2ba4a2da14edc6c521e /engines
parentc80aa9409146079703d14f3882a72d4d53246445 (diff)
downloadscummvm-rg350-8be618fb47bdd413db8b0dc30e67a9443038c944.tar.gz
scummvm-rg350-8be618fb47bdd413db8b0dc30e67a9443038c944.tar.bz2
scummvm-rg350-8be618fb47bdd413db8b0dc30e67a9443038c944.zip
Bugfix to constrain savegame names to the dialog width
svn-id: r26882
Diffstat (limited to 'engines')
-rw-r--r--engines/lure/surface.cpp17
-rw-r--r--engines/lure/surface.h2
2 files changed, 10 insertions, 9 deletions
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index 3a8cd18fa4..d0444391d7 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -385,7 +385,7 @@ Surface *Surface::getScreen(uint16 resourceId) {
return new Surface(decodedData, FULL_SCREEN_WIDTH, decodedData->size() / FULL_SCREEN_WIDTH);
}
-bool Surface::getString(Common::String &line, uint32 maxSize, bool isNumeric, bool varLength, int16 x, int16 y) {
+bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool varLength, int16 x, int16 y) {
OSystem &system = *g_system;
Mouse &mouse = Mouse::getReference();
Events &events = Events::getReference();
@@ -404,7 +404,7 @@ bool Surface::getString(Common::String &line, uint32 maxSize, bool isNumeric, bo
// Display the string
screen.screen().writeString(x, y, newLine, true, DIALOG_TEXT_COLOUR, varLength);
screen.update();
- int stringSize = screen.screen().textWidth(newLine.c_str());
+ int stringSize = textWidth(newLine.c_str());
// Loop until the input string changes
refreshFlag = false;
@@ -420,7 +420,7 @@ bool Surface::getString(Common::String &line, uint32 maxSize, bool isNumeric, bo
if ((ch == 13) || (keycode == 0x10f)) {
// Return character
screen.screen().fillRect(
- Rect(x, y, x + stringSize + 8, y + FONT_HEIGHT), bgColour);
+ Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColour);
screen.update();
newLine.deleteLastChar();
line = newLine;
@@ -430,7 +430,7 @@ bool Surface::getString(Common::String &line, uint32 maxSize, bool isNumeric, bo
else if (ch == 27) {
// Escape character
screen.screen().fillRect(
- Rect(x, y, x + stringSize + 8, y + FONT_HEIGHT), bgColour);
+ Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColour);
screen.update();
abortFlag = true;
} else if (ch == 8) {
@@ -438,14 +438,14 @@ bool Surface::getString(Common::String &line, uint32 maxSize, bool isNumeric, bo
if (newLine.size() == 1) continue;
screen.screen().fillRect(
- Rect(x, y, x + stringSize + 8, y + FONT_HEIGHT), bgColour);
+ Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColour);
newLine.deleteChar(newLine.size() - 2);
refreshFlag = true;
- } else if ((ch >= ' ') && (newLine.size() < maxSize)) {
+ } else if ((ch >= ' ') && (stringSize + 8 < maxSize)) {
if (((ch >= '0') && (ch <= '9')) || !isNumeric) {
screen.screen().fillRect(
- Rect(x, y, x + stringSize + 8, y + FONT_HEIGHT), bgColour);
+ Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColour);
newLine.insertChar(ch, newLine.size() - 1);
refreshFlag = true;
}
@@ -741,7 +741,8 @@ bool SaveRestoreDialog::show(bool saveDialog) {
// If in save mode, allow the entry of a new savename
if (saveDialog) {
- if (!screen.screen().getString(*saveNames[selectedLine], 40,
+ if (!screen.screen().getString(*saveNames[selectedLine],
+ INFO_DIALOG_WIDTH - (DIALOG_EDGE_SIZE * 2),
false, true, SAVE_DIALOG_X + DIALOG_EDGE_SIZE,
SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + selectedLine * FONT_HEIGHT)) {
// Aborted out of name selection, so restore old name and
diff --git a/engines/lure/surface.h b/engines/lure/surface.h
index cc737fafd0..2155f1b820 100644
--- a/engines/lure/surface.h
+++ b/engines/lure/surface.h
@@ -70,7 +70,7 @@ public:
static Surface *newDialog(uint16 width, uint8 numLines, const char **lines, bool varLength = true, uint8 colour = DIALOG_TEXT_COLOUR);
static Surface *newDialog(uint16 width, const char *lines, uint8 colour = DIALOG_TEXT_COLOUR);
static Surface *getScreen(uint16 resourceId);
- bool getString(Common::String &line, uint32 maxSize, bool isNumeric, bool varLength, int16 x, int16 y);
+ bool getString(Common::String &line, int maxSize, bool isNumeric, bool varLength, int16 x, int16 y);
};
class Dialog {