aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/saveload.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-08-23 19:09:12 +0200
committerWillem Jan Palenstijn2013-08-23 19:09:12 +0200
commitacc286142ea5ccccbedda8be5c8aeec23deee326 (patch)
treece44bf35c53dfdc5c1073e8a6abad96acc1864f4 /engines/agos/saveload.cpp
parent7d5ec85cc40861198e61fda57988c720f212f6b1 (diff)
downloadscummvm-rg350-acc286142ea5ccccbedda8be5c8aeec23deee326.tar.gz
scummvm-rg350-acc286142ea5ccccbedda8be5c8aeec23deee326.tar.bz2
scummvm-rg350-acc286142ea5ccccbedda8be5c8aeec23deee326.zip
AGOS: Simplify string parsing
Diffstat (limited to 'engines/agos/saveload.cpp')
-rw-r--r--engines/agos/saveload.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 48671390f0..3a35c094b0 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -37,7 +37,6 @@ int AGOSEngine::countSaveGames() {
Common::InSaveFile *f = NULL;
Common::StringArray filenames;
uint i = 1;
- char slot[4];
int slotNum;
bool marks[256];
@@ -49,12 +48,8 @@ int AGOSEngine::countSaveGames() {
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file){
//Obtain the last 3 digits of the filename, since they correspond to the save slot
- slot[0] = file->c_str()[file->size()-3];
- slot[1] = file->c_str()[file->size()-2];
- slot[2] = file->c_str()[file->size()-1];
- slot[3] = '\0';
-
- slotNum = atoi(slot);
+ assert(file->size() >= 4);
+ slotNum = atoi(file->c_str() + file->size() - 3);
if (slotNum >= 0 && slotNum < 256)
marks[slotNum] = true; //mark this slot as valid
}