summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2016-05-22 10:23:22 +0000
committerfrosch <frosch@openttd.org>2016-05-22 10:23:22 +0000
commitc0c1a4cded52ccb2f197dd4df7e0b1a51fc7c330 (patch)
treea4f814fc93a2dc4ce035e3bc3605dce14edddec3 /src
parent1b84d893e0c2acb34d880a4c1d68f9d2dc95af8e (diff)
downloadopenttd-c0c1a4cded52ccb2f197dd4df7e0b1a51fc7c330.tar.xz
(svn r27574) -Fix [FS#6432]: The house id as returned by house variable 66 was incorrect when querying neighboured tiles. (adf88)
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_house.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index 6c9c614af..2bc85f9ac 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -399,7 +399,8 @@ static uint32 GetDistanceFromNearbyHouse(uint8 parameter, TileIndex tile, HouseI
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) {
@@ -408,8 +409,8 @@ static uint32 GetDistanceFromNearbyHouse(uint8 parameter, TileIndex tile, HouseI
}
/* 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;