# HG changeset patch # User belugas # Date 1190772900 0 # Node ID 9fe288a99e999ea59a9edc2ddeaca78f2b322abb # Parent 0cbf1d4a5f6de913049770da54dba2ef0659ab66 (svn r11163) -Codechange: Verify that the IndustryTileOverrideManager skip the magic value of 0xFF when assigning a new tileID. This is really important, since the value is reserved for water checking. diff -r 0cbf1d4a5f6d -r 9fe288a99e99 src/newgrf_commons.cpp --- a/src/newgrf_commons.cpp Wed Sep 26 02:11:30 2007 +0000 +++ b/src/newgrf_commons.cpp Wed Sep 26 02:15:00 2007 +0000 @@ -105,7 +105,7 @@ for (id = max_offset; id < max_new_entities; id++) { map = &mapping_ID[id]; - if (map->entity_id == 0 && map->grfid == 0) { + if (CheckValidNewID(id) && map->entity_id == 0 && map->grfid == 0) { map->entity_id = grf_local_id; map->grfid = grfid; map->substitute_id = substitute_id; diff -r 0cbf1d4a5f6d -r 9fe288a99e99 src/newgrf_commons.h --- a/src/newgrf_commons.h Wed Sep 26 02:11:30 2007 +0000 +++ b/src/newgrf_commons.h Wed Sep 26 02:15:00 2007 +0000 @@ -33,6 +33,7 @@ uint16 max_new_entities; ///< what is the amount of entities, old and new summed uint16 invalid_ID; ///< ID used to dected invalid entities; + virtual bool CheckValidNewID(uint16 testid) { return true; } public: EntityIDMapping *mapping_ID; ///< mapping of ids from grf files. Public out of convenience @@ -76,6 +77,8 @@ struct IndustryTileSpec; class IndustryTileOverrideManager : public OverrideManagerBase { +protected: + virtual bool CheckValidNewID(uint16 testid) { return testid != 0xFF; } public: IndustryTileOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) : OverrideManagerBase(offset, maximum, invalid) {}