summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-11-01 17:42:34 +0000
committerpeter1138 <peter1138@openttd.org>2006-11-01 17:42:34 +0000
commit2073980e82a20340079259cfdb68f11c1cc53038 (patch)
tree82d60705561f73e564327cc50ff514837d218f67
parent5dc56b3f9e6d04bf58a369a927b3313b8879e683 (diff)
downloadopenttd-2073980e82a20340079259cfdb68f11c1cc53038.tar.xz
(svn r7031) -Codechange: Use _skip_sprites to skip the rest of the NewGRF when disabled by GRM, and add a shortcut so that the rest of the file isn't scanned.
-rw-r--r--newgrf.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/newgrf.c b/newgrf.c
index 7ce6270b8..c984d44c5 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -2664,6 +2664,9 @@ static void ParamSet(byte *buf, int len)
/* Deactivate GRF */
grfmsg(GMS_FATAL, "GRM: Unable to allocate %d vehicles, deactivating", count);
SETBIT(_cur_grffile->flags, 2);
+ CLRBIT(_cur_grffile->flags, 1);
+
+ _skip_sprites = -1;
return;
}
@@ -3459,11 +3462,10 @@ static void LoadNewGRFFile(const char* filename, uint file_index, uint stage)
if (type == 0xFF) {
if (_skip_sprites == 0) {
DecodeSpecialSprite(num, stage);
- if (HASBIT(_cur_grffile->flags, 2)) {
- /* GRF has been deactivated... */
- CLRBIT(_cur_grffile->flags, 1);
- return;
- }
+
+ /* Stop all processing if we are to skip the remaining sprites */
+ if (_skip_sprites == -1) break;
+
continue;
} else {
FioSkipBytes(num);