diff options
author | truelight <truelight@openttd.org> | 2007-06-13 19:05:42 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2007-06-13 19:05:42 +0000 |
commit | 402052509f991672d97a1783a888109dc7688e24 (patch) | |
tree | 5d6feec5a89d4e271e7d1a317a3df1df6591183d | |
parent | 063c4f7862693c6ea3c0698e049a88c3196e2d80 (diff) | |
download | openttd-402052509f991672d97a1783a888109dc7688e24.tar.xz |
(svn r10149) -Fix r10143: MSVC warnings... (tnx boekabart and glx)
-rw-r--r-- | src/spritecache.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/spritecache.cpp b/src/spritecache.cpp index 3e9faef4a..d85af6b70 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -252,13 +252,16 @@ bool LoadNextSprite(int load_index, byte file_index) sc->lru = 0; sc->id = load_index; - char *grf_name = strrchr(FioGetFilename(), PATHSEPCHAR); - if (grf_name == NULL) grf_name = (char *)FioGetFilename(); - /* Copy the string, make it lowercase, strip .grf */ - grf_name = strdup(grf_name); - char *t = strrchr(grf_name, '.'); - if (t != NULL) *t = '\0'; + const char *fio_grf_name = FioGetFilename(); + const char *t = strrchr(fio_grf_name, PATHSEPCHAR); + char *grf_name; + if (t == NULL) grf_name = strdup(fio_grf_name); + else grf_name = strdup(t); + /* Make the string lowercase and strip extension */ + char *t2 = strrchr(grf_name, '.'); + if (t2 != NULL) *t2 = '\0'; strtolower(grf_name); + free((char *)sc->grf_name); sc->grf_name = grf_name; |