summaryrefslogtreecommitdiff
path: root/os2.c
diff options
context:
space:
mode:
Diffstat (limited to 'os2.c')
-rw-r--r--os2.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/os2.c b/os2.c
index a76f3dc10..d4411bbb8 100644
--- a/os2.c
+++ b/os2.c
@@ -139,7 +139,9 @@ FiosItem *FiosGetSavegameList(int *num, int mode)
if (stat(filename, &sb) || S_ISDIR(sb.st_mode)) continue;
t = strrchr(dirent->d_name, '.');
- if (t != NULL && strcasecmp(t, ".sav") == 0) { // OpenTTD
+ if (t == NULL) continue;
+
+ if (strcasecmp(t, ".sav") == 0) { // OpenTTD
fios = FiosAlloc();
fios->type = FIOS_TYPE_FILE;
fios->mtime = sb.st_mtime;
@@ -148,11 +150,9 @@ FiosItem *FiosGetSavegameList(int *num, int mode)
*t = '\0'; // strip extension
ttd_strlcpy(fios->title, dirent->d_name, lengthof(fios->title));
} else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO) {
- if (t != NULL && (
- strcasecmp(t, ".ss1") == 0 ||
- strcasecmp(t, ".sv1") == 0 ||
- strcasecmp(t, ".sv2") == 0
- )) { // TTDLX(Patch)
+ if (strcasecmp(t, ".ss1") == 0 ||
+ strcasecmp(t, ".sv1") == 0 ||
+ strcasecmp(t, ".sv2") == 0) { // TTDLX(Patch)
fios = FiosAlloc();
fios->type = FIOS_TYPE_OLDFILE;
fios->mtime = sb.st_mtime;
@@ -265,7 +265,9 @@ FiosItem *FiosGetScenarioList(int *num, int mode)
if (stat(filename, &sb) || S_ISDIR(sb.st_mode)) continue;
t = strrchr(dirent->d_name, '.');
- if (t != NULL && strcasecmp(t, ".scn") == 0) { // OpenTTD
+ if (t == NULL) continue;
+
+ if (strcasecmp(t, ".scn") == 0) { // OpenTTD
fios = FiosAlloc();
fios->type = FIOS_TYPE_SCENARIO;
fios->mtime = sb.st_mtime;
@@ -275,10 +277,8 @@ FiosItem *FiosGetScenarioList(int *num, int mode)
ttd_strlcpy(fios->title, dirent->d_name, lengthof(fios->title));
} else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO ||
mode == SLD_NEW_GAME) {
- if (t != NULL && (
- strcasecmp(t, ".sv0") == 0 ||
- strcasecmp(t, ".ss0") == 0
- )) { // TTDLX(Patch)
+ if (strcasecmp(t, ".sv0") == 0 ||
+ strcasecmp(t, ".ss0") == 0) { // TTDLX(Patch)
fios = FiosAlloc();
fios->type = FIOS_TYPE_OLD_SCENARIO;
fios->mtime = sb.st_mtime;