(svn r1882) Add a basic check if a non-existent sprite gets accessed.

Now ottd bails out with an error message instead of segfaulting.
This is far from perfect, some checks after loading a savegame should be added.
pull/155/head
tron 20 years ago
parent 2eda5228d1
commit 56a8302642

@ -154,6 +154,14 @@ static void ReadSprite(SpriteID id, void *buffer)
byte type;
byte* dest;
if (_sprite_file_pos[id] == 0) {
error(
"Tried to load non-existing sprite #%d.\n"
"Probable cause: Wrong/missing NewGRFs",
id
);
}
FioSeekToFile(_sprite_file_pos[id]);
type = FioReadByte();

Loading…
Cancel
Save