(svn r10109) -Fix [FS#838]: some NewGRFs use the same (unused in the "current" climate) sprite IDs. Normally this gives some artefacts, but when one NewGRF expects it to be a sprite and another NewGRF overwrites it with a non-sprite nasty things happen (drawing a non-sprite crashes OTTD).

This commit is contained in:
rubidium
2007-06-12 09:40:50 +00:00
parent 8efb7e53ec
commit be0539cb43
2 changed files with 20 additions and 6 deletions

View File

@@ -15,17 +15,17 @@ struct Sprite {
extern uint _sprite_cache_size;
const void *GetRawSprite(SpriteID sprite);
const void *GetRawSprite(SpriteID sprite, bool real_sprite);
bool SpriteExists(SpriteID sprite);
static inline const Sprite *GetSprite(SpriteID sprite)
{
return (Sprite*)GetRawSprite(sprite);
return (Sprite*)GetRawSprite(sprite, true);
}
static inline const byte *GetNonSprite(SpriteID sprite)
{
return (byte*)GetRawSprite(sprite);
return (byte*)GetRawSprite(sprite, false);
}
void GfxInitSpriteMem();