[Scummvm-cvs-logs] SF.net SVN: scummvm:[34970] scummvm/trunk
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sun Nov 9 21:07:46 CET 2008
Revision: 34970
http://scummvm.svn.sourceforge.net/scummvm/?rev=34970&view=rev
Author: thebluegr
Date: 2008-11-09 20:07:46 +0000 (Sun, 09 Nov 2008)
Log Message:
-----------
Added a new SaveStateDescriptor flag, is_write_protected, which can be used to stop the user from overwriting certain saves (e.g. the auto save, the restart save in the Kyrandia games, the quicksaves etc)
Modified Paths:
--------------
scummvm/trunk/engines/game.cpp
scummvm/trunk/engines/game.h
scummvm/trunk/gui/launcher.cpp
Modified: scummvm/trunk/engines/game.cpp
===================================================================
--- scummvm/trunk/engines/game.cpp 2008-11-09 19:30:09 UTC (rev 34969)
+++ scummvm/trunk/engines/game.cpp 2008-11-09 20:07:46 UTC (rev 34970)
@@ -115,6 +115,10 @@
setVal("is_deletable", state ? "true" : "false");
}
+void SaveStateDescriptor::setWriteProtectedFlag(bool state) {
+ setVal("is_write_protected", state ? "true" : "false");
+}
+
void SaveStateDescriptor::setSaveDate(int year, int month, int day) {
char buffer[32];
snprintf(buffer, 32, "%.2d.%.2d.%.4d", day, month, year);
Modified: scummvm/trunk/engines/game.h
===================================================================
--- scummvm/trunk/engines/game.h 2008-11-09 19:30:09 UTC (rev 34969)
+++ scummvm/trunk/engines/game.h 2008-11-09 20:07:46 UTC (rev 34970)
@@ -151,12 +151,18 @@
bool getBool(const Common::String &key) const;
/**
- * Sets the 'is_deletable' key, which indicates, if the
+ * Sets the 'is_deletable' key, which indicates if the
* given savestate is safe for deletion.
*/
void setDeletableFlag(bool state);
/**
+ * Sets the 'is_write_protected' key, which indicates if the
+ * given savestate can be overwritten or not
+ */
+ void setWriteProtectedFlag(bool state);
+
+ /**
* Return a thumbnail graphics surface representing the savestate visually.
* This is usually a scaled down version of the game graphics. The size
* should be either 160x100 or 160x120 pixels, depending on the aspect
Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp 2008-11-09 19:30:09 UTC (rev 34969)
+++ scummvm/trunk/gui/launcher.cpp 2008-11-09 20:07:46 UTC (rev 34970)
@@ -673,11 +673,13 @@
int selItem = _list->getSelected();
bool isDeletable = _delSupport;
+ bool isWriteProtected = false;
if (selItem >= 0 && !_list->getSelectedString().empty() && _metaInfoSupport) {
SaveStateDescriptor desc = (*_plugin)->querySaveMetaInfos(_target.c_str(), atoi(_saveList[selItem].save_slot().c_str()));
isDeletable = desc.getBool("is_deletable") && _delSupport;
+ isWriteProtected = desc.getBool("is_write_protected");
if (_thumbnailSupport) {
const Graphics::Surface *thumb = desc.getThumbnail();
@@ -720,7 +722,7 @@
// Disable these buttons if nothing is selected, or if an empty
// list item is selected.
- _chooseButton->setEnabled(selItem >= 0 && (!_list->getSelectedString().empty()));
+ _chooseButton->setEnabled(selItem >= 0 && (!_list->getSelectedString().empty()) && !isWriteProtected);
// Delete will always be disabled if the engine doesn't support it.
_deleteButton->setEnabled(isDeletable && (selItem >= 0) && (!_list->getSelectedString().empty()));
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