From 293df6a68f9e10f1fa43139306eaf73af7ab6c09 Mon Sep 17 00:00:00 2001 From: David Fioramonti Date: Thu, 3 Aug 2017 15:21:40 -0700 Subject: TITANIC: Max saved games const centralized Before the const specifying the max number of save/load games was in titanic.h, core/project_item.cpp, main_game_window, and detection.cpp. Since they all inherit from titanic.h they should just use the const there. Also the saved game const in core/project_item.cpp was named differently so I also changed that. --- engines/titanic/core/project_item.cpp | 3 +-- engines/titanic/detection.cpp | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'engines/titanic') diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index a3ac284af8..2655b6cbd5 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -35,7 +35,6 @@ namespace Titanic { #define CURRENT_SAVEGAME_VERSION 1 -#define MAX_SAVEGAME_SLOTS 99 #define MINIMUM_SAVEGAME_VERSION 1 static const char *const SAVEGAME_STR = "TNIC"; @@ -464,7 +463,7 @@ SaveStateList CProjectItem::getSavegameList(const Common::String &target) { const char *ext = strrchr(file->c_str(), '.'); int slot = ext ? atoi(ext + 1) : -1; - if (slot >= 0 && slot < MAX_SAVEGAME_SLOTS) { + if (slot >= 0 && slot < MAX_SAVES) { Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file); if (in) { diff --git a/engines/titanic/detection.cpp b/engines/titanic/detection.cpp index 8c990e2525..6c3177d718 100644 --- a/engines/titanic/detection.cpp +++ b/engines/titanic/detection.cpp @@ -33,8 +33,6 @@ #include "graphics/colormasks.h" #include "graphics/surface.h" -#define MAX_SAVES 99 - namespace Titanic { struct TitanicGameDescription { -- cgit v1.2.3 From eb050826174c1996e9d052d554c946420c192bc8 Mon Sep 17 00:00:00 2001 From: David Fioramonti Date: Thu, 3 Aug 2017 15:56:24 -0700 Subject: TITANIC: Allow last saved game to be loaded --- engines/titanic/core/project_item.cpp | 2 +- engines/titanic/detection.cpp | 2 +- engines/titanic/main_game_window.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/titanic') diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 2655b6cbd5..b16d076f14 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -463,7 +463,7 @@ SaveStateList CProjectItem::getSavegameList(const Common::String &target) { const char *ext = strrchr(file->c_str(), '.'); int slot = ext ? atoi(ext + 1) : -1; - if (slot >= 0 && slot < MAX_SAVES) { + if (slot >= 0 && slot <= MAX_SAVES) { Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file); if (in) { diff --git a/engines/titanic/detection.cpp b/engines/titanic/detection.cpp index 6c3177d718..098c20ca1d 100644 --- a/engines/titanic/detection.cpp +++ b/engines/titanic/detection.cpp @@ -118,7 +118,7 @@ SaveStateList TitanicMetaEngine::listSaves(const char *target) const { const char *ext = strrchr(file->c_str(), '.'); int slot = ext ? atoi(ext + 1) : -1; - if (slot >= 0 && slot < MAX_SAVES) { + if (slot >= 0 && slot <= MAX_SAVES) { Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file); if (in) { diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index b578bb942e..559e186f70 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -117,7 +117,7 @@ int CMainGameWindow::selectSavegame() { bool hasSavegames = false; // Loop through save slots to find any existing save slots - for (int idx = 0; idx < MAX_SAVES; ++idx) { + for (int idx = 0; idx <= MAX_SAVES; ++idx) { CString saveName = g_vm->getSavegameName(idx); if (!saveName.empty()) { dialog.addSavegame(idx, saveName); -- cgit v1.2.3