[Scummvm-cvs-logs] SF.net SVN: scummvm:[53145] scummvm/trunk/engines/hugo
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Mon Oct 11 01:24:57 CEST 2010
Revision: 53145
http://scummvm.svn.sourceforge.net/scummvm/?rev=53145&view=rev
Author: mthreepwood
Date: 2010-10-10 23:24:57 +0000 (Sun, 10 Oct 2010)
Log Message:
-----------
HUGO: Use _targetName for naming save files
Modified Paths:
--------------
scummvm/trunk/engines/hugo/detection.cpp
scummvm/trunk/engines/hugo/file.cpp
scummvm/trunk/engines/hugo/hugo.h
Modified: scummvm/trunk/engines/hugo/detection.cpp
===================================================================
--- scummvm/trunk/engines/hugo/detection.cpp 2010-10-10 23:10:14 UTC (rev 53144)
+++ scummvm/trunk/engines/hugo/detection.cpp 2010-10-10 23:24:57 UTC (rev 53145)
@@ -189,21 +189,14 @@
namespace Hugo {
void HugoEngine::initGame(const HugoGameDescription *gd) {
- char tmpStr[8];
-
_gameType = gd->gameType;
_platform = gd->desc.platform;
_packedFl = (getFeatures() & GF_PACKED);
_gameVariant = _gameType - 1 + ((_platform == Common::kPlatformWindows) ? 0 : 3);
-//Generate filenames
- if (gd->desc.platform == Common::kPlatformWindows)
- sprintf(tmpStr, "%s%c", gd->desc.gameid, 'w');
- else
- sprintf(tmpStr, "%s%c", gd->desc.gameid, 'd');
-
- sprintf(_initFilename, "%s-00.SAV", tmpStr);
- sprintf(_saveFilename, "%s-%s.SAV", tmpStr, "%d");
+ // Generate filenames
+ _initFilename = _targetName + "-00.SAV";
+ _saveFilename = _targetName + "-%d.SAV";
}
} // End of namespace Hugo
Modified: scummvm/trunk/engines/hugo/file.cpp
===================================================================
--- scummvm/trunk/engines/hugo/file.cpp 2010-10-10 23:10:14 UTC (rev 53144)
+++ scummvm/trunk/engines/hugo/file.cpp 2010-10-10 23:24:57 UTC (rev 53145)
@@ -318,15 +318,16 @@
debugC(1, kDebugFile, "saveGame(%d, %s)", slot, descrip);
// Get full path of saved game file - note test for INITFILE
- char path[256]; // Full path of saved game
+ Common::String path; // Full path of saved game
+
if (slot == -1)
- sprintf(path, "%s", _vm._initFilename);
+ path = _vm._initFilename;
else
- sprintf(path, _vm._saveFilename, slot);
+ path = Common::String::printf(_vm._saveFilename.c_str(), slot);
- Common::WriteStream *out = 0;
- if (!(out = _vm.getSaveFileManager()->openForSaving(path))) {
- warning("Can't create file '%s', game not saved", path);
+ Common::WriteStream *out = _vm.getSaveFileManager()->openForSaving(path);
+ if (!out) {
+ warning("Can't create file '%s', game not saved", path.c_str());
return;
}
@@ -389,14 +390,15 @@
_vm.initStatus();
// Get full path of saved game file - note test for INITFILE
- char path[256]; // Full path of saved game
+ Common::String path; // Full path of saved game
+
if (slot == -1)
- sprintf(path, "%s", _vm._initFilename);
+ path = _vm._initFilename;
else
- sprintf(path, _vm._saveFilename, slot);
+ path = Common::String::printf(_vm._saveFilename.c_str(), slot);
- Common::SeekableReadStream *in = 0;
- if (!(in = _vm.getSaveFileManager()->openForLoading(path)))
+ Common::SeekableReadStream *in = _vm.getSaveFileManager()->openForLoading(path);
+ if (!in)
return;
// Check version, can't restore from different versions
@@ -473,20 +475,17 @@
// The net result is a valid INITFILE, with status.savesize initialized.
debugC(1, kDebugFile, "initSavedGame");
- // Get full path of INITFILE
- char path[256]; // Full path of INITFILE
- sprintf(path, "%s", _vm._initFilename);
-
// Force save of initial game
if (_vm.getGameStatus().initSaveFl)
saveGame(-1, "");
// If initial game doesn't exist, create it
- Common::SeekableReadStream *in = 0;
- if (!(in = _vm.getSaveFileManager()->openForLoading(path))) {
+ Common::SeekableReadStream *in = _vm.getSaveFileManager()->openForLoading(_vm._initFilename);
+ if (!in) {
saveGame(-1, "");
- if (!(in = _vm.getSaveFileManager()->openForLoading(path))) {
- Utils::Error(WRITE_ERR, "%s", path);
+ in = _vm.getSaveFileManager()->openForLoading(_vm._initFilename);
+ if (!in) {
+ Utils::Error(WRITE_ERR, "%s", _vm._initFilename.c_str());
return;
}
}
@@ -497,7 +496,7 @@
// Check sanity - maybe disk full or path set to read-only drive?
if (_vm.getGameStatus().saveSize == -1)
- Utils::Error(WRITE_ERR, "%s", path);
+ Utils::Error(WRITE_ERR, "%s", _vm._initFilename.c_str());
}
void FileManager::openPlaybackFile(bool playbackFl, bool recordFl) {
Modified: scummvm/trunk/engines/hugo/hugo.h
===================================================================
--- scummvm/trunk/engines/hugo/hugo.h 2010-10-10 23:10:14 UTC (rev 53144)
+++ scummvm/trunk/engines/hugo/hugo.h 2010-10-10 23:24:57 UTC (rev 53145)
@@ -142,8 +142,7 @@
const char *_episode;
const char *_picDir;
- char _initFilename[20];
- char _saveFilename[20];
+ Common::String _initFilename, _saveFilename;
command_t _statusLine;
command_t _scoreLine;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list