diff options
author | Paul Gilbert | 2016-07-20 22:23:42 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-20 22:23:42 -0400 |
commit | 4ff421570679621db76cca59315a036bf64a6550 (patch) | |
tree | 6d53bf3c47c8ac9b51fc06193b4cc3179b182957 | |
parent | 0ed7b463e885e499f2603b6bd3e49929c45af84a (diff) | |
download | scummvm-rg350-4ff421570679621db76cca59315a036bf64a6550.tar.gz scummvm-rg350-4ff421570679621db76cca59315a036bf64a6550.tar.bz2 scummvm-rg350-4ff421570679621db76cca59315a036bf64a6550.zip |
TITANIC: Display first 5 savegame slots in PET RealLife tab
-rw-r--r-- | engines/titanic/pet_control/pet_load_save.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp index 0ae9f3fe77..17e6f5eee5 100644 --- a/engines/titanic/pet_control/pet_load_save.cpp +++ b/engines/titanic/pet_control/pet_load_save.cpp @@ -23,6 +23,7 @@ #include "titanic/pet_control/pet_load_save.h" #include "titanic/pet_control/pet_control.h" #include "titanic/core/project_item.h" +#include "titanic/titanic.h" namespace Titanic { @@ -53,6 +54,7 @@ bool CPetLoadSave::setup(CPetControl *petControl, CPetGlyphs *owner) { bool CPetLoadSave::reset() { highlightChange(); + resetSlots(); CPetControl *pet = getPetControl(); if (pet) { @@ -124,14 +126,29 @@ Rect CPetLoadSave::getSlotBounds(int index) { } void CPetLoadSave::resetSlots() { - CPetControl *pet = getPetControl(); - CProjectItem *project = pet ? pet->getRoot() : nullptr; - for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) { _slotNames[idx].setText("Empty"); - if (project) { - warning("TODO: Get savegame name"); + // Try and open up the savegame for access + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading( + g_vm->generateSaveName(idx)); + + if (in) { + // Read in the savegame header data + CompressedFile file; + file.open(in); + + TitanicSavegameHeader header; + CProjectItem::readSavegameHeader(&file, header); + if (header._thumbnail) { + header._thumbnail->free(); + delete header._thumbnail; + } + + file.close(); + + // Set the name text + _slotNames[idx].setText(header._saveName); } } |