[Scummvm-cvs-logs] SF.net SVN: scummvm: [26882] scummvm/trunk/engines/lure

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun May 20 09:24:09 CEST 2007


Revision: 26882
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26882&view=rev
Author:   dreammaster
Date:     2007-05-20 00:24:05 -0700 (Sun, 20 May 2007)

Log Message:
-----------
Bugfix to constrain savegame names to the dialog width

Modified Paths:
--------------
    scummvm/trunk/engines/lure/surface.cpp
    scummvm/trunk/engines/lure/surface.h

Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp	2007-05-20 04:47:12 UTC (rev 26881)
+++ scummvm/trunk/engines/lure/surface.cpp	2007-05-20 07:24:05 UTC (rev 26882)
@@ -385,7 +385,7 @@
 	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 @@
 		// 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 @@
 					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 @@
 					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 @@
 						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 @@
 
 		// 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 

Modified: scummvm/trunk/engines/lure/surface.h
===================================================================
--- scummvm/trunk/engines/lure/surface.h	2007-05-20 04:47:12 UTC (rev 26881)
+++ scummvm/trunk/engines/lure/surface.h	2007-05-20 07:24:05 UTC (rev 26882)
@@ -70,7 +70,7 @@
 	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 {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list