summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2010-01-22 23:55:20 +0000
committerpeter1138 <peter1138@openttd.org>2010-01-22 23:55:20 +0000
commit200dc6821f7b8698f9228cedcce28619a1e30d4a (patch)
treeee3c57d4a52e459475f8c374f6ec075d91032f24 /src
parent3df9caa86a5b2345931c2070f2c73defb101c8ee (diff)
downloadopenttd-200dc6821f7b8698f9228cedcce28619a1e30d4a.tar.xz
(svn r18891) -Fix: Avoid duplicate path separator when searching for PNG files which prevented tar-lookups.
Diffstat (limited to 'src')
-rw-r--r--src/spriteloader/png.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/spriteloader/png.cpp b/src/spriteloader/png.cpp
index 92e0c6d76..e72f44010 100644
--- a/src/spriteloader/png.cpp
+++ b/src/spriteloader/png.cpp
@@ -39,7 +39,9 @@ static bool OpenPNGFile(const char *filename, uint32 id, bool mask)
{
char png_file[MAX_PATH];
- snprintf(png_file, sizeof(png_file), "sprites" PATHSEP "%s" PATHSEP "%d%s.png", filename, id, mask ? "m" : "");
+ /* Add path separator after 'sprites' if not present */
+ const char *sep = (filename[0] == PATHSEPCHAR) ? "" : PATHSEP;
+ snprintf(png_file, sizeof(png_file), "sprites%s%s" PATHSEP "%d%s.png", sep, filename, id, mask ? "m" : "");
if (FioCheckFileExists(png_file)) {
FioOpenFile(PNG_SLOT, png_file);
return true;