[Scummvm-cvs-logs] SF.net SVN: scummvm: [31397] scummvm/trunk

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Apr 5 04:40:29 CEST 2008


Revision: 31397
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31397&view=rev
Author:   lordhoto
Date:     2008-04-04 19:40:28 -0700 (Fri, 04 Apr 2008)

Log Message:
-----------
- cleanup
- sort savefiles in kyra from newest -> oldest

Modified Paths:
--------------
    scummvm/trunk/common/func.h
    scummvm/trunk/engines/kyra/gui.cpp
    scummvm/trunk/engines/kyra/gui_v2.cpp

Modified: scummvm/trunk/common/func.h
===================================================================
--- scummvm/trunk/common/func.h	2008-04-05 02:24:43 UTC (rev 31396)
+++ scummvm/trunk/common/func.h	2008-04-05 02:40:28 UTC (rev 31397)
@@ -44,14 +44,19 @@
 
 template<class T>
 struct EqualTo : public BinaryFunction<T, T, bool> {
-	bool operator()(const T& x, const T& y) const { return x == y; }
+	bool operator()(const T &x, const T &y) const { return x == y; }
 };
 
 template<class T>
 struct Less : public BinaryFunction<T, T, bool> {
-	bool operator()(const T& x, const T& y) const { return x < y; }
+	bool operator()(const T &x, const T &y) const { return x < y; }
 };
 
+template<class T>
+struct Greater : public BinaryFunction<T, T, bool> {
+	bool operator()(const T &x, const T &y) const { return x > y; }
+};
+
 template<class Op>
 class Binder1st : public UnaryFunction<typename Op::SecondArgumentType, typename Op::ResultType> {
 private:

Modified: scummvm/trunk/engines/kyra/gui.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui.cpp	2008-04-05 02:24:43 UTC (rev 31396)
+++ scummvm/trunk/engines/kyra/gui.cpp	2008-04-05 02:40:28 UTC (rev 31397)
@@ -301,7 +301,6 @@
 void GUI::updateSaveList() {
 	Common::String pattern = _vm->_targetName + ".???";
 	Common::StringList saveFileList = _vm->_saveFileMan->listSavefiles(pattern.c_str());
-	Common::sort(saveFileList.begin(), saveFileList.end());
 	_saveSlots.clear();
 
 	for (Common::StringList::const_iterator i = saveFileList.begin(); i != saveFileList.end(); ++i) {
@@ -311,6 +310,13 @@
 		s3 = (*i)[i->size()-1] - '0';
 		_saveSlots.push_back(s1*100+s2*10+s3);
 	}
+
+	if (_saveSlots.begin() == _saveSlots.end())
+		return;
+
+	Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Less<int>());
+	if (_saveSlots.size() > 2)
+		Common::sort(_saveSlots.begin()+1, _saveSlots.end(), Common::Greater<int>());
 }
 
 int GUI::getNextSavegameSlot() {

Modified: scummvm/trunk/engines/kyra/gui_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.cpp	2008-04-05 02:24:43 UTC (rev 31396)
+++ scummvm/trunk/engines/kyra/gui_v2.cpp	2008-04-05 02:40:28 UTC (rev 31397)
@@ -1336,9 +1336,6 @@
 }
 
 void GUI_v2::setupPalette() {
-	//if (_isDeathMenu)
-	//	memcpy(_vm->_unkBuffer1040Bytes, _screen->getPalette(0), 768);
-
 	memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
 
 	uint8 *palette = _screen->getPalette(0);
@@ -1842,12 +1839,6 @@
 
 	restorePage1(_vm->_screenBuffer);
 	restorePalette();
-	//if (getNextSaveGameslot() == _saveSlot) {
-	//	while (_saveSlot > 1) {
-	//		rename(_vm->getSavegameFilename(_saveSlot-1), _vm->getSavegameFilename(_saveSlot));
-	//		--_saveSlot;
-	//	}
-	//}
 	_vm->saveGame(_vm->getSavegameFilename(_saveSlot), _saveDescription);
 	_displayMenu = false;
 	_madeSave = true;


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