(svn r1865) Fix some warnings
authortron
Sun, 13 Feb 2005 08:12:03 +0000
changeset 1361 10d9b95e7a81
parent 1360 887083b34669
child 1362 adfd229bdc01
(svn r1865) Fix some warnings
spritecache.c
spritecache.h
--- a/spritecache.c	Sun Feb 13 07:44:32 2005 +0000
+++ b/spritecache.c	Sun Feb 13 08:12:03 2005 +0000
@@ -147,10 +147,11 @@
 	}
 }
 
-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 @@
 	/* 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 @@
 		sprite->y_offs = FioReadWord();
 		dest = sprite->data;
 		num -= 8;
+	} else {
+		dest = buffer;
 	}
 
 	if (type & 2) {
@@ -680,12 +683,7 @@
 }
 #endif
 
-const Sprite *GetSprite(SpriteID sprite)
-{
-	return GetNonSprite(sprite);
-}
-
-const byte *GetNonSprite(SpriteID sprite)
+const void *GetRawSprite(SpriteID sprite)
 {
 	byte *p;
 
--- a/spritecache.h	Sun Feb 13 07:44:32 2005 +0000
+++ b/spritecache.h	Sun Feb 13 08:12:03 2005 +0000
@@ -17,8 +17,17 @@
 } 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);