Changeset - r7632:40eddc1d4853
[Not reviewed]
master
0 2 0
belugas - 17 years ago 2007-09-26 02:15:00
belugas@openttd.org
(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.
2 files changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/newgrf_commons.cpp
Show inline comments
 
@@ -105,7 +105,7 @@ uint16 OverrideManagerBase::AddEntityID(
 
	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;
src/newgrf_commons.h
Show inline comments
 
@@ -33,6 +33,7 @@ protected:
 
	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 @@ public:
 

	
 
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) {}
0 comments (0 inline, 0 general)