[Scummvm-cvs-logs] scummvm master -> 4f7768ec6e76e9af32bed1961025b994466c9b8c

lordhoto lordhoto at gmail.com
Mon Nov 14 15:55:41 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4f7768ec6e KYRA: Cleanup _saveSlots array sorting.


Commit: 4f7768ec6e76e9af32bed1961025b994466c9b8c
    https://github.com/scummvm/scummvm/commit/4f7768ec6e76e9af32bed1961025b994466c9b8c
Author: Johannes Schickel (lordhoto at gmail.com)
Date: 2011-11-14T06:54:50-08:00

Commit Message:
KYRA: Cleanup _saveSlots array sorting.

Changed paths:
    engines/kyra/gui.cpp
    engines/kyra/gui.h
    engines/kyra/gui_lol.cpp
    engines/kyra/gui_lol.h



diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index 7fd9880..27f09b6 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 c048926..6e9606f 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 2017a6e..fefcaf7 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 0686926..af48740 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






More information about the Scummvm-git-logs mailing list