Changeset - r22379:3604f2df7905
[Not reviewed]
master
0 1 0
frosch - 8 years ago 2016-05-22 10:23:22
frosch@openttd.org
(svn r27574) -Fix [FS#6432]: The house id as returned by house variable 66 was incorrect when querying neighboured tiles. (adf88)
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/newgrf_house.cpp
Show inline comments
 
@@ -396,23 +396,24 @@ static uint32 GetDistanceFromNearbyHouse
 
		case 0x65: return GetDistanceFromNearbyHouse(parameter, this->tile, this->house_id);
 

	
 
		/* Class and ID of nearby house tile */
 
		case 0x66: {
 
			TileIndex testtile = GetNearbyTile(parameter, this->tile);
 
			if (!IsTileType(testtile, MP_HOUSE)) return 0xFFFFFFFF;
 
			HouseSpec *hs = HouseSpec::Get(GetHouseType(testtile));
 
			HouseID nearby_house_id = GetHouseType(testtile);
 
			HouseSpec *hs = HouseSpec::Get(nearby_house_id);
 
			/* Information about the grf local classid if the house has a class */
 
			uint houseclass = 0;
 
			if (hs->class_id != HOUSE_NO_CLASS) {
 
				houseclass = (hs->grf_prop.grffile == this->ro.grffile ? 1 : 2) << 8;
 
				houseclass |= _class_mapping[hs->class_id].class_id;
 
			}
 
			/* old house type or grf-local houseid */
 
			uint local_houseid = 0;
 
			if (this->house_id < NEW_HOUSE_OFFSET) {
 
				local_houseid = this->house_id;
 
			if (nearby_house_id < NEW_HOUSE_OFFSET) {
 
				local_houseid = nearby_house_id;
 
			} else {
 
				local_houseid = (hs->grf_prop.grffile == this->ro.grffile ? 1 : 2) << 8;
 
				local_houseid |= hs->grf_prop.local_id;
 
			}
 
			return houseclass << 16 | local_houseid;
 
		}
0 comments (0 inline, 0 general)