[Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.81,1.82
Max Horn
fingolfin at users.sourceforge.net
Wed Nov 5 04:49:10 CET 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv3046
Modified Files:
dialogs.cpp
Log Message:
fix for bug #836418 (Crash when saving with blank name): GUI now uses a default savegame name if non is given
Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- dialogs.cpp 3 Nov 2003 23:34:27 -0000 1.81
+++ dialogs.cpp 5 Nov 2003 12:48:42 -0000 1.82
@@ -225,12 +225,9 @@
case kListItemActivatedCmd:
case kListItemDoubleClickedCmd:
if (selItem >= 0) {
- if (!getResultString().isEmpty()) {
+ if (_saveMode || !getResultString().isEmpty()) {
setResult(selItem);
close();
- } else if (_saveMode) {
- // Start editing the selected item, for saving
- _list->startEditMode();
}
}
break;
@@ -238,7 +235,10 @@
if (_saveMode) {
_list->startEditMode();
}
- _chooseButton->setEnabled(selItem >= 0);
+ // Disable button if nothing is selected, or (in load mode) if an empty
+ // list item is selected. We allow choosing an empty item in save mode
+ // because we then just assign a default name.
+ _chooseButton->setEnabled(selItem >= 0 && (_saveMode || !getResultString().isEmpty()));
_chooseButton->draw();
break;
default:
@@ -365,7 +365,16 @@
SaveLoadChooser dialog("Save game:", generateSavegameList(_scumm, true), "Save", true);
idx = dialog.runModal();
if (idx >= 0) {
- _scumm->requestSave(idx + 1, dialog.getResultString().c_str());
+ const String &result = dialog.getResultString();
+ char buffer[20];
+ const char *str;
+ if (result.isEmpty()) {
+ // If the user was lazy and entered no save name, come up with a default name.
+ sprintf(buffer, "Save %d", idx + 1);
+ str = buffer;
+ } else
+ str = result.c_str();
+ _scumm->requestSave(idx + 1, str);
close();
}
}
More information about the Scummvm-git-logs
mailing list