equal
deleted
inserted
replaced
69 } |
69 } |
70 |
70 |
71 return true; |
71 return true; |
72 } |
72 } |
73 |
73 |
|
74 /* Check if the given Sprite ID exists */ |
|
75 bool SpriteExists(SpriteID id) |
|
76 { |
|
77 /* Special case for Sprite ID zero -- its position is also 0... */ |
|
78 return _sprite_file_pos[id] != 0 || id == 0; |
|
79 } |
|
80 |
74 static void* AllocSprite(size_t); |
81 static void* AllocSprite(size_t); |
75 |
82 |
76 static void* ReadSprite(SpriteID id) |
83 static void* ReadSprite(SpriteID id) |
77 { |
84 { |
78 uint num; |
85 uint num; |
79 byte type; |
86 byte type; |
80 |
87 |
81 DEBUG(spritecache, 9) ("load sprite %d", id); |
88 DEBUG(spritecache, 9) ("load sprite %d", id); |
82 |
89 |
83 if (_sprite_file_pos[id] == 0 && id != 0) { |
90 if (!SpriteExists(id)) { |
84 error( |
91 error( |
85 "Tried to load non-existing sprite #%d.\n" |
92 "Tried to load non-existing sprite #%d.\n" |
86 "Probable cause: Wrong/missing NewGRFs", |
93 "Probable cause: Wrong/missing NewGRFs", |
87 id |
94 id |
88 ); |
95 ); |