Merge pull request #980 from dafioram/titanic_access_last_save

TITANIC: Fix access to last savegame slot
This commit is contained in:
Paul Gilbert 2017-08-03 22:44:59 -04:00 committed by GitHub
commit e1754fbec7
3 changed files with 3 additions and 6 deletions

View File

@ -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) {

View File

@ -33,8 +33,6 @@
#include "graphics/colormasks.h"
#include "graphics/surface.h"
#define MAX_SAVES 99
namespace Titanic {
struct TitanicGameDescription {
@ -120,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) {

View File

@ -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);