aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorD G Turner2012-07-04 02:13:40 +0100
committerD G Turner2012-07-04 02:13:40 +0100
commitefb1d96d98e7bc856522772bbcdb266e11e26a29 (patch)
treed3fd4b2e56f3bd76bb7721af83decb30d6a01015 /engines
parent604c6bde91a9f1fb71d18f8fdcc172fc738ff9ef (diff)
downloadscummvm-rg350-efb1d96d98e7bc856522772bbcdb266e11e26a29.tar.gz
scummvm-rg350-efb1d96d98e7bc856522772bbcdb266e11e26a29.tar.bz2
scummvm-rg350-efb1d96d98e7bc856522772bbcdb266e11e26a29.zip
TEENAGENT: Fix erroneous files in savegame listing.
This was achieved by making the detection pattern stricter to avoid matching the dat file or other extraneous files in the savegame path. This fixes bug #3539774 "TEENAGENT : teenagent.dat considered as a savegame". Also did some minor formatting and string function usage cleanup.
Diffstat (limited to 'engines')
-rw-r--r--engines/teenagent/detection.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp
index f516ee06c1..2de6f49c44 100644
--- a/engines/teenagent/detection.cpp
+++ b/engines/teenagent/detection.cpp
@@ -80,7 +80,7 @@ static const ADGameDescription teenAgentGameDescriptions[] = {
};
enum {
- MAX_SAVES = 20
+ MAX_SAVES = 20
};
class TeenAgentMetaEngine : public AdvancedMetaEngine {
@@ -123,16 +123,15 @@ public:
virtual SaveStateList listSaves(const char *target) const {
Common::String pattern = target;
- pattern += ".*";
+ pattern += ".??";
Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);
Common::sort(filenames.begin(), filenames.end());
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
- int slot;
- const char *ext = strrchr(file->c_str(), '.');
- if (ext && (slot = atoi(ext + 1)) >= 0 && slot < MAX_SAVES) {
+ int slot = atoi(file->c_str() + file->size() - 2);
+ if (slot >= 0 && slot < MAX_SAVES) {
Common::ScopedPtr<Common::InSaveFile> in(g_system->getSavefileManager()->openForLoading(*file));
if (!in)
continue;