diff options
author | D G Turner | 2011-06-02 19:46:55 +0100 |
---|---|---|
committer | D G Turner | 2011-06-02 19:46:55 +0100 |
commit | 305c6b4d8372178fc2dcd6e55a49ef3774766cf6 (patch) | |
tree | 7c6bb5161f6e2f58bb81870db961e66647330c95 /engines/agi | |
parent | 9e86b0bea1cbff921cef1036f67a9a7d259f4b20 (diff) | |
download | scummvm-rg350-305c6b4d8372178fc2dcd6e55a49ef3774766cf6.tar.gz scummvm-rg350-305c6b4d8372178fc2dcd6e55a49ef3774766cf6.tar.bz2 scummvm-rg350-305c6b4d8372178fc2dcd6e55a49ef3774766cf6.zip |
AGI: Replace snprintf() usage with Common::String::format()
Safer and less portability issues.
Diffstat (limited to 'engines/agi')
-rw-r--r-- | engines/agi/saveload.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index 7eaf13d889..dae3dd42c1 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -551,11 +551,8 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) { #define NUM_VISIBLE_SLOTS 12 const char *AgiEngine::getSavegameFilename(int num) { - static Common::String saveLoadSlot; - char extension[5]; - snprintf(extension, sizeof(extension), ".%.3d", num); - - saveLoadSlot = _targetName + extension; + Common::String saveLoadSlot = _targetName; + saveLoadSlot += Common::String::format(".%.3d", num); return saveLoadSlot.c_str(); } @@ -987,14 +984,12 @@ void AgiEngine::releaseImageStack() { void AgiEngine::checkQuickLoad() { if (ConfMan.hasKey("save_slot")) { - char saveNameBuffer[256]; - - snprintf(saveNameBuffer, 256, "%s.%03d", _targetName.c_str(), ConfMan.getInt("save_slot")); + Common::String saveNameBuffer = Common::String::format("%s.%03d", _targetName.c_str(), ConfMan.getInt("save_slot")); _sprites->eraseBoth(); _sound->stopSound(); - if (loadGame(saveNameBuffer, false) == errOK) { // Do not check game id + if (loadGame(saveNameBuffer.c_str(), false) == errOK) { // Do not check game id _game.exitAllLogics = 1; _menu->enableAll(); } |