summaryrefslogtreecommitdiff
path: root/src/spriteloader
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-01-22 07:27:06 +0000
committerpeter1138 <peter1138@openttd.org>2008-01-22 07:27:06 +0000
commit78156065cf5dcf3d08d28dffce70eb327f697e62 (patch)
treeaa8442d483b420571317c63234db3640f7e6df7b /src/spriteloader
parenta83b91dbc52f237a120e805672a7d676fa592e7d (diff)
downloadopenttd-78156065cf5dcf3d08d28dffce70eb327f697e62.tar.xz
(svn r11940) -Codechange: Store short filename once per open file instead of once per sprite cache entry. Not all file types need this, but most of the time no sprite cache entry needed it either.
Diffstat (limited to 'src/spriteloader')
-rw-r--r--src/spriteloader/grf.cpp2
-rw-r--r--src/spriteloader/grf.hpp2
-rw-r--r--src/spriteloader/png.cpp3
-rw-r--r--src/spriteloader/png.hpp2
-rw-r--r--src/spriteloader/spriteloader.hpp2
5 files changed, 6 insertions, 5 deletions
diff --git a/src/spriteloader/grf.cpp b/src/spriteloader/grf.cpp
index d0bc0e334..bbc9d3f8f 100644
--- a/src/spriteloader/grf.cpp
+++ b/src/spriteloader/grf.cpp
@@ -9,7 +9,7 @@
#include "../core/alloc_func.hpp"
#include "grf.hpp"
-bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, const char *filename, uint8 file_slot, uint32 file_pos)
+bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos)
{
/* Open the right file and go to the correct position */
FioSeekToFile(file_slot, file_pos);
diff --git a/src/spriteloader/grf.hpp b/src/spriteloader/grf.hpp
index fe9405339..65b5f6233 100644
--- a/src/spriteloader/grf.hpp
+++ b/src/spriteloader/grf.hpp
@@ -12,7 +12,7 @@ public:
/**
* Load a sprite from the disk and return a sprite struct which is the same for all loaders.
*/
- bool LoadSprite(SpriteLoader::Sprite *sprite, const char *filename, uint8 file_slot, uint32 file_pos);
+ bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos);
};
#endif /* SPRITELOADER_GRF_HPP */
diff --git a/src/spriteloader/png.cpp b/src/spriteloader/png.cpp
index abfce00fa..2af9d0253 100644
--- a/src/spriteloader/png.cpp
+++ b/src/spriteloader/png.cpp
@@ -181,8 +181,9 @@ static bool LoadPNG(SpriteLoader::Sprite *sprite, const char *filename, uint32 i
return true;
}
-bool SpriteLoaderPNG::LoadSprite(SpriteLoader::Sprite *sprite, const char *filename, uint8 file_slot, uint32 file_pos)
+bool SpriteLoaderPNG::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos)
{
+ const char *filename = FioGetFilename(file_slot);
if (!LoadPNG(sprite, filename, file_pos, false)) return false;
if (!LoadPNG(sprite, filename, file_pos, true)) return false;
return true;
diff --git a/src/spriteloader/png.hpp b/src/spriteloader/png.hpp
index eb3719180..7d821dc71 100644
--- a/src/spriteloader/png.hpp
+++ b/src/spriteloader/png.hpp
@@ -12,7 +12,7 @@ public:
/**
* Load a sprite from the disk and return a sprite struct which is the same for all loaders.
*/
- bool LoadSprite(SpriteLoader::Sprite *sprite, const char *filename, uint8 file_slot, uint32 file_pos);
+ bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos);
};
#endif /* SPRITELOADER_PNG_HPP */
diff --git a/src/spriteloader/spriteloader.hpp b/src/spriteloader/spriteloader.hpp
index 47d1b7d40..09ad505a8 100644
--- a/src/spriteloader/spriteloader.hpp
+++ b/src/spriteloader/spriteloader.hpp
@@ -26,7 +26,7 @@ public:
/**
* Load a sprite from the disk and return a sprite struct which is the same for all loaders.
*/
- virtual bool LoadSprite(SpriteLoader::Sprite *sprite, const char *filename, uint8 file_slot, uint32 file_pos) = 0;
+ virtual bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos) = 0;
virtual ~SpriteLoader() { }
};