(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.

This commit is contained in:
peter1138 2006-11-01 17:42:34 +00:00
parent d04846c26b
commit 03ba02aef8

View File

@ -2664,6 +2664,9 @@ static void ParamSet(byte *buf, int len)
/* Deactivate GRF */ /* Deactivate GRF */
grfmsg(GMS_FATAL, "GRM: Unable to allocate %d vehicles, deactivating", count); grfmsg(GMS_FATAL, "GRM: Unable to allocate %d vehicles, deactivating", count);
SETBIT(_cur_grffile->flags, 2); SETBIT(_cur_grffile->flags, 2);
CLRBIT(_cur_grffile->flags, 1);
_skip_sprites = -1;
return; return;
} }
@ -3459,11 +3462,10 @@ static void LoadNewGRFFile(const char* filename, uint file_index, uint stage)
if (type == 0xFF) { if (type == 0xFF) {
if (_skip_sprites == 0) { if (_skip_sprites == 0) {
DecodeSpecialSprite(num, stage); DecodeSpecialSprite(num, stage);
if (HASBIT(_cur_grffile->flags, 2)) {
/* GRF has been deactivated... */ /* Stop all processing if we are to skip the remaining sprites */
CLRBIT(_cur_grffile->flags, 1); if (_skip_sprites == -1) break;
return;
}
continue; continue;
} else { } else {
FioSkipBytes(num); FioSkipBytes(num);