svn-id: r34545
This commit is contained in:
Johannes Schickel 2008-09-14 21:41:27 +00:00
parent 5719225367
commit a4830d813e
3 changed files with 9 additions and 19 deletions

View File

@ -1164,12 +1164,7 @@ void KyraMetaEngine::removeSaveState(const char *target, int slot) const {
return;
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
char extension[6];
snprintf(extension, sizeof(extension), ".%03d", slot);
Common::String filename = target;
filename += extension;
Common::String filename = Kyra::KyraEngine_v1::getSavegameFilename(target, slot);
saveFileMan->removeSavefile(filename.c_str());
@ -1193,22 +1188,14 @@ void KyraMetaEngine::removeSaveState(const char *target, int slot) const {
// is missing.
saveFileMan->renameSavefile(file->c_str(), filename.c_str());
++slot;
snprintf(extension, sizeof(extension), ".%03d", slot);
filename = target;
filename += extension;
filename = Kyra::KyraEngine_v1::getSavegameFilename(target, ++slot);
}
}
}
Graphics::Surface *KyraMetaEngine::loadThumbnailFromSlot(const char *target, int slot) const {
char extension[6];
snprintf(extension, sizeof(extension), ".%03d", slot);
Common::String filename = target;
filename += extension;
Common::String filename = Kyra::KyraEngine_v1::getSavegameFilename(target, slot);
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str());
Kyra::KyraEngine_v1::SaveHeader header;

View File

@ -275,6 +275,7 @@ protected:
void checkAutosave();
const char *getSavegameFilename(int num);
static Common::String getSavegameFilename(const Common::String &target, int num);
bool saveFileLoadable(int slot);
struct SaveHeader {

View File

@ -216,15 +216,17 @@ Common::WriteStream *KyraEngine_v1::openSaveForWriting(const char *filename, con
const char *KyraEngine_v1::getSavegameFilename(int num) {
static Common::String filename;
filename = getSavegameFilename(_targetName, num);
return filename.c_str();
}
Common::String KyraEngine_v1::getSavegameFilename(const Common::String &target, int num) {
assert(num >= 0 && num <= 999);
char extension[5];
sprintf(extension, "%03d", num);
filename = _targetName + "." + extension;
return filename.c_str();
return target + "." + extension;
}
bool KyraEngine_v1::saveFileLoadable(int slot) {