summaryrefslogtreecommitdiff
path: root/src/newgrf_house.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-11-08 17:26:49 +0000
committerfrosch <frosch@openttd.org>2011-11-08 17:26:49 +0000
commit30874b5e81af0fff2f42d34b9b105ee86666b8ac (patch)
tree6fd8200f08019910de826cf6f1b9b6e92f7d2d69 /src/newgrf_house.cpp
parentb98c7763de42eda4b3d19604bc3f33452b9b05e4 (diff)
downloadopenttd-30874b5e81af0fff2f42d34b9b105ee86666b8ac.tar.xz
(svn r23147) -Change: [NewGRF v8] Unify the return values of boolean callbacks, and check the results for validity.
Diffstat (limited to 'src/newgrf_house.cpp')
-rw-r--r--src/newgrf_house.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index 6b44277c0..5e841b7d1 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -489,7 +489,7 @@ void DrawNewHouseTile(TileInfo *ti, HouseID house_id)
if (HasBit(hs->callback_mask, CBM_HOUSE_DRAW_FOUNDATIONS)) {
/* Called to determine the type (if any) of foundation to draw for the house tile */
uint32 callback_res = GetHouseCallback(CBID_HOUSE_DRAW_FOUNDATIONS, 0, 0, house_id, Town::GetByTile(ti->tile), ti->tile);
- draw_old_one = (callback_res != 0);
+ if (callback_res != CALLBACK_FAILED) draw_old_one = ConvertBooleanCallback(hs->grf_prop.grffile, CBID_HOUSE_DRAW_FOUNDATIONS, callback_res);
}
if (draw_old_one) DrawFoundation(ti, FOUNDATION_LEVELED);
@@ -552,7 +552,7 @@ bool CanDeleteHouse(TileIndex tile)
if (HasBit(hs->callback_mask, CBM_HOUSE_DENY_DESTRUCTION)) {
uint16 callback_res = GetHouseCallback(CBID_HOUSE_DENY_DESTRUCTION, 0, 0, GetHouseType(tile), Town::GetByTile(tile), tile);
- return (callback_res == CALLBACK_FAILED || callback_res == 0);
+ return (callback_res == CALLBACK_FAILED || !ConvertBooleanCallback(hs->grf_prop.grffile, CBID_HOUSE_DENY_DESTRUCTION, callback_res));
} else {
return !(hs->extra_flags & BUILDING_IS_PROTECTED);
}
@@ -600,7 +600,7 @@ bool NewHouseTileLoop(TileIndex tile)
/* Check callback 21, which determines if a house should be destroyed. */
if (HasBit(hs->callback_mask, CBM_HOUSE_DESTRUCTION)) {
uint16 callback_res = GetHouseCallback(CBID_HOUSE_DESTRUCTION, 0, 0, GetHouseType(tile), Town::GetByTile(tile), tile);
- if (callback_res != CALLBACK_FAILED && GB(callback_res, 0, 8) > 0) {
+ if (callback_res != CALLBACK_FAILED && Convert8bitBooleanCallback(hs->grf_prop.grffile, CBID_HOUSE_DESTRUCTION, callback_res)) {
ClearTownHouse(Town::GetByTile(tile), tile);
return false;
}