aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2008-04-05 02:40:28 +0000
committerJohannes Schickel2008-04-05 02:40:28 +0000
commitdd8676877e665c405d8d56f52d5fbeea62eb1cc1 (patch)
tree1552e9c7ac37e32915058ec34c45b4db0d2c5a9a
parentc1319f8034a6c66caaa21fbf1a16f68e637457e0 (diff)
downloadscummvm-rg350-dd8676877e665c405d8d56f52d5fbeea62eb1cc1.tar.gz
scummvm-rg350-dd8676877e665c405d8d56f52d5fbeea62eb1cc1.tar.bz2
scummvm-rg350-dd8676877e665c405d8d56f52d5fbeea62eb1cc1.zip
- cleanup
- sort savefiles in kyra from newest -> oldest svn-id: r31397
-rw-r--r--common/func.h9
-rw-r--r--engines/kyra/gui.cpp8
-rw-r--r--engines/kyra/gui_v2.cpp9
3 files changed, 14 insertions, 12 deletions
diff --git a/common/func.h b/common/func.h
index c262c149c6..cff4e2d304 100644
--- a/common/func.h
+++ b/common/func.h
@@ -44,12 +44,17 @@ struct BinaryFunction {
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>
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index d0151f0ed5..c46c3cc241 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -301,7 +301,6 @@ int GUI::redrawShadedButtonCallback(Button *button) {
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 @@ void GUI::updateSaveList() {
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() {
diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp
index dd94cdab80..496254ac90 100644
--- a/engines/kyra/gui_v2.cpp
+++ b/engines/kyra/gui_v2.cpp
@@ -1336,9 +1336,6 @@ void GUI_v2::renewHighlight(Menu &menu) {
}
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 @@ int GUI_v2::saveMenu(Button *caller) {
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;