(svn r22757) -Fix [FS#4730]: [NewGRF] Invalid memory access when querying the grfID of the default objects

This commit is contained in:
planetmaker 2011-08-18 14:08:51 +00:00
parent 2dd798149b
commit 86234253a5
1 changed files with 5 additions and 0 deletions

View File

@ -140,6 +140,11 @@ static uint32 GetObjectIDAtOffset(TileIndex tile, uint32 cur_grfid)
const ObjectSpec *spec = ObjectSpec::GetByTile(tile);
/* Default objects have no associated NewGRF file */
if (spec->grf_prop.grffile == NULL) {
return 0xFFFE; // Defined in another grf file
}
if (spec->grf_prop.grffile->grfid == cur_grfid) { // same object, same grf ?
return spec->grf_prop.local_id;
}