summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-02-13 08:12:03 +0000
committertron <tron@openttd.org>2005-02-13 08:12:03 +0000
commit58c46bed4072a563f037278d5f023c0bbf3c83a7 (patch)
tree93914d7bc0ccd415e8ec9d364681b6c4ee81f290
parentac6857ee280487777d02b7429988a9eabcdf77f7 (diff)
downloadopenttd-58c46bed4072a563f037278d5f023c0bbf3c83a7.tar.xz
(svn r1865) Fix some warnings
-rw-r--r--spritecache.c14
-rw-r--r--spritecache.h13
2 files changed, 17 insertions, 10 deletions
diff --git a/spritecache.c b/spritecache.c
index fee938f73..bcf9ec4d3 100644
--- a/spritecache.c
+++ b/spritecache.c
@@ -147,10 +147,11 @@ static void ReadSpriteHeaderSkipData(int num, int load_index)
}
}
-static void ReadSprite(SpriteID id, byte *dest)
+static void ReadSprite(SpriteID id, void *buffer)
{
uint num = _sprite_size[id];
byte type;
+ byte* dest;
FioSeekToFile(_sprite_file_pos[id]);
@@ -158,7 +159,7 @@ static void ReadSprite(SpriteID id, byte *dest)
/* We've decoded special sprites when reading headers. */
if (type != 0xFF) {
/* read sprite hdr */
- Sprite* sprite = dest;
+ Sprite* sprite = buffer;
sprite->info = type;
sprite->height = FioReadByte();
if (id == 142) sprite->height = 10; // Compensate for a TTD bug
@@ -167,6 +168,8 @@ static void ReadSprite(SpriteID id, byte *dest)
sprite->y_offs = FioReadWord();
dest = sprite->data;
num -= 8;
+ } else {
+ dest = buffer;
}
if (type & 2) {
@@ -680,12 +683,7 @@ static uint RotateSprite(uint s)
}
#endif
-const Sprite *GetSprite(SpriteID sprite)
-{
- return GetNonSprite(sprite);
-}
-
-const byte *GetNonSprite(SpriteID sprite)
+const void *GetRawSprite(SpriteID sprite)
{
byte *p;
diff --git a/spritecache.h b/spritecache.h
index c5b50cb41..70acb2d39 100644
--- a/spritecache.h
+++ b/spritecache.h
@@ -17,8 +17,17 @@ typedef struct {
} SpriteDimension;
const SpriteDimension *GetSpriteDimension(SpriteID sprite);
-const Sprite *GetSprite(SpriteID sprite);
-const byte *GetNonSprite(SpriteID sprite);
+const void *GetRawSprite(SpriteID sprite);
+
+static inline const Sprite *GetSprite(SpriteID sprite)
+{
+ return GetRawSprite(sprite);
+}
+
+static inline const byte *GetNonSprite(SpriteID sprite)
+{
+ return GetRawSprite(sprite);
+}
void GfxLoadSprites(void);
void IncreaseSpriteLRU(void);