summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-08-08 09:49:47 +0000
committertron <tron@openttd.org>2005-08-08 09:49:47 +0000
commit47e28d9152521ae2b7469a48f5cb53c2128d11a8 (patch)
tree3327a275a33f421af7f4742482f7f24d82374a98
parent129898cd7716123867480f215af0a508047e9c85 (diff)
downloadopenttd-47e28d9152521ae2b7469a48f5cb53c2128d11a8.tar.xz
(svn r2839) Remove stuff missed in r2833, properly calculate the size of two arrays and simplify GetSpriteDimension() a bit
-rw-r--r--spritecache.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/spritecache.c b/spritecache.c
index 6b39f80b8..c824e053f 100644
--- a/spritecache.c
+++ b/spritecache.c
@@ -51,8 +51,6 @@ static uint16 _sprite_xsize[MAX_SPRITES];
static uint8 _sprite_ysize[MAX_SPRITES];
#endif
-bool _cache_sprites;
-
typedef struct MemBlock {
uint32 size;
byte data[VARARRAY_SIZE];
@@ -349,8 +347,8 @@ static int LoadNewGrfFile(const char *filename, int load_index, int file_index)
/* Clean up. */
_skip_sprites = 0;
- memset(_replace_sprites_count, 0, 16 * sizeof(*_replace_sprites_count));
- memset(_replace_sprites_offset, 0, 16 * sizeof(*_replace_sprites_offset));
+ memset(_replace_sprites_count, 0, sizeof(_replace_sprites_count));
+ memset(_replace_sprites_offset, 0, sizeof(_replace_sprites_offset));
return i;
}
@@ -646,13 +644,6 @@ const void *GetRawSprite(SpriteID sprite)
byte _sprite_page_to_load = 0xFF;
-static const char * const _cached_filenames[4] = {
- "cached_sprites.xxx",
- "cached_sprites.xx1",
- "cached_sprites.xx2",
- "cached_sprites.xx3",
-};
-
#define OPENTTD_SPRITES_COUNT 100
static const SpriteID _openttd_grf_indexes[] = {
SPR_OPENTTD_BASE + 0, SPR_OPENTTD_BASE + 7, // icons etc
@@ -866,24 +857,23 @@ void GfxLoadSprites(void)
const SpriteDimension *GetSpriteDimension(SpriteID sprite)
{
- static SpriteDimension sd_static;
- SpriteDimension *sd = &sd_static;
+ static SpriteDimension sd;
#ifdef WANT_SPRITESIZES
- sd->xoffs = _sprite_xoffs[sprite];
- sd->yoffs = _sprite_yoffs[sprite];
- sd->xsize = _sprite_xsize[sprite];
- sd->ysize = _sprite_ysize[sprite];
+ sd.xoffs = _sprite_xoffs[sprite];
+ sd.yoffs = _sprite_yoffs[sprite];
+ sd.xsize = _sprite_xsize[sprite];
+ sd.ysize = _sprite_ysize[sprite];
#else
const Sprite* p = GetSprite(sprite);
/* decode sprite header */
- sd->xoffs = p->x_offs;
- sd->yoffs = p->y_offs;
- sd->xsize = p->width;
- sd->ysize = p->height;
+ sd.xoffs = p->x_offs;
+ sd.yoffs = p->y_offs;
+ sd.xsize = p->width;
+ sd.ysize = p->height;
#endif
- return sd;
+ return &sd;
}