changeset 17781:dceca5355f39 draft

(svn r22566) -Codechange: Define and use OverrideManagerBase::GetGRFID function.
author terkhen <terkhen@openttd.org>
date Sun, 12 Jun 2011 20:42:23 +0000
parents 6da2ed3e68e4
children 043b87d0dbec
files src/newgrf_commons.cpp src/newgrf_commons.h src/newgrf_house.cpp
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_commons.cpp
+++ b/src/newgrf_commons.cpp
@@ -142,6 +142,16 @@
 }
 
 /**
+ * Gives the GRFID of the file the entity belongs to.
+ * @param entity_id ID of the entity being queried.
+ * @return GRFID.
+ */
+uint16 OverrideManagerBase::GetGRFID(uint16 entity_id) const
+{
+	return mapping_ID[entity_id].grfid;
+}
+
+/**
  * Gives the substitute of the entity, as specified by the grf file
  * @param entity_id of the entity being queried
  * @return mapped id
--- a/src/newgrf_commons.h
+++ b/src/newgrf_commons.h
@@ -185,6 +185,7 @@
 	void Add(uint8 local_id, uint32 grfid, uint entity_type);
 	virtual uint16 AddEntityID(byte grf_local_id, uint32 grfid, byte substitute_id);
 
+	uint16 GetGRFID(uint16 entity_id) const;
 	uint16 GetSubstituteID(uint16 entity_id) const;
 	virtual uint16 GetID(uint8 grf_local_id, uint32 grfid) const;
 
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -344,7 +344,7 @@
 			if (house_id < NEW_HOUSE_OFFSET) return 0;
 			/* Checking the grffile information via HouseSpec doesn't work
 			 * in case the newgrf was removed. */
-			return _house_mngr.mapping_ID[house_id].grfid;
+			return _house_mngr.GetGRFID(house_id);
 		}
 	}