aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2011-11-14 15:54:17 +0100
committerJohannes Schickel2011-11-14 15:54:50 +0100
commit4f7768ec6e76e9af32bed1961025b994466c9b8c (patch)
treeaa650b1bc56b3ae08bf6737b978fd538a664b7cb /engines/kyra
parent59ed0ee9ede9f250978df59147751ad0c1a82f34 (diff)
downloadscummvm-rg350-4f7768ec6e76e9af32bed1961025b994466c9b8c.tar.gz
scummvm-rg350-4f7768ec6e76e9af32bed1961025b994466c9b8c.tar.bz2
scummvm-rg350-4f7768ec6e76e9af32bed1961025b994466c9b8c.zip
KYRA: Cleanup _saveSlots array sorting.
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui.cpp4
-rw-r--r--engines/kyra/gui.h2
-rw-r--r--engines/kyra/gui_lol.cpp6
-rw-r--r--engines/kyra/gui_lol.h2
4 files changed, 12 insertions, 2 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index 7fd9880dce..27f09b645e 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -388,6 +388,10 @@ void GUI::updateSaveList(bool excludeQuickSaves) {
if (_saveSlots.begin() == _saveSlots.end())
return;
+ sortSaveSlots();
+}
+
+void GUI::sortSaveSlots() {
Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Less<int>());
if (_saveSlots.size() > 2)
Common::sort(_saveSlots.begin()+1, _saveSlots.end(), Common::Greater<int>());
diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h
index c04892636b..6e9606f1de 100644
--- a/engines/kyra/gui.h
+++ b/engines/kyra/gui.h
@@ -207,6 +207,8 @@ protected:
void updateSaveList(bool excludeQuickSaves = false);
int getNextSavegameSlot();
+ virtual void sortSaveSlots();
+
uint32 _lastScreenUpdate;
Common::KeyState _keyPressed;
void checkTextfieldInput();
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 2017a6e6ba..fefcaf762f 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -2618,8 +2618,6 @@ void GUI_LoL::updateSavegameList() {
_savegameListSize = _saveSlots.size();
if (_savegameListSize) {
- Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Greater<int>());
-
LoLEngine::SaveHeader header;
Common::InSaveFile *in;
@@ -2642,6 +2640,10 @@ void GUI_LoL::updateSavegameList() {
}
}
+void GUI_LoL::sortSaveSlots() {
+ Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Greater<int>());
+}
+
void GUI_LoL::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 flags) {
_screen->fprintString("%s", x, y, c0, c1, _vm->gameFlags().use16ColorMode ? (flags & 3) : flags , str);
}
diff --git a/engines/kyra/gui_lol.h b/engines/kyra/gui_lol.h
index 0686926534..af487402f6 100644
--- a/engines/kyra/gui_lol.h
+++ b/engines/kyra/gui_lol.h
@@ -175,6 +175,8 @@ private:
char **_savegameList;
int _savegameListSize;
bool _savegameListUpdateNeeded;
+
+ virtual void sortSaveSlots();
};
} // End of namespace Kyra