mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 22:58:09 +00:00
AGOS: Simplify string parsing
This commit is contained in:
parent
7d5ec85cc4
commit
acc286142e
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user