diff options
author | belugas <belugas@openttd.org> | 2008-01-14 18:19:29 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2008-01-14 18:19:29 +0000 |
commit | e91e9d9b4e2b900d71091f2c85bfc40fd3190d09 (patch) | |
tree | 4e5205e079a64c2541f8bb7a427f9c04b6f5ddaf | |
parent | a4ba98af869e33a5ad6a83c563f1bd708232e8f4 (diff) | |
download | openttd-e91e9d9b4e2b900d71091f2c85bfc40fd3190d09.tar.xz |
(svn r11851) -Codechange: A few magic numbers removal, plus a little code style
-rw-r--r-- | src/newgrf_callbacks.h | 5 | ||||
-rw-r--r-- | src/town_cmd.cpp | 11 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/newgrf_callbacks.h b/src/newgrf_callbacks.h index 3dffdcf03..b21b29f8e 100644 --- a/src/newgrf_callbacks.h +++ b/src/newgrf_callbacks.h @@ -297,10 +297,11 @@ enum IndustryTileCallbackMask { }; /** - * Result of a failed callback. + * Different values for Callback result evaluations */ enum { - CALLBACK_FAILED = 0xFFFF + CALLBACK_FAILED = 0xFFFF, ///< Result of a failed callback. + CALLBACK_HOUSEPRODCARGO_END = 0x20FF, ///< Sentinel indicating that the loop for CBID_HOUSE_PRODUCE_CARGO has ended }; #endif /* NEWGRF_CALLBACKS_H */ diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index ed83f4884..e6ee6c208 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -435,8 +435,7 @@ static void TileLoop_Town(TileIndex tile) for (uint i = 0; i < 256; i++) { uint16 callback = GetHouseCallback(CBID_HOUSE_PRODUCE_CARGO, i, r, house_id, t, tile); - if (callback == CALLBACK_FAILED) break; - if (callback == 0x20FF) break; + if (callback == CALLBACK_FAILED || callback == CALLBACK_HOUSEPRODCARGO_END) break; CargoID cargo = GetCargoTranslation(GB(callback, 8, 7), hs->grffile); if (cargo == CT_INVALID) continue; @@ -1604,9 +1603,9 @@ static bool CheckBuildHouseMode(TileIndex tile, Slope tileh, int mode) int b; Slope slope; - static const byte _masks[8] = { - 0xC,0x3,0x9,0x6, - 0x3,0xC,0x6,0x9, + static const Slope _masks[8] = { + SLOPE_NE, SLOPE_SW, SLOPE_NW, SLOPE_SE, + SLOPE_SW, SLOPE_NE, SLOPE_SE, SLOPE_NW, }; slope = GetTileSlope(tile, NULL); @@ -1616,7 +1615,7 @@ static bool CheckBuildHouseMode(TileIndex tile, Slope tileh, int mode) b = 0; if ((slope != SLOPE_FLAT && ~slope & _masks[mode])) b = ~b; - if ((tileh != SLOPE_FLAT && ~tileh & _masks[mode+4])) b = ~b; + if ((tileh != SLOPE_FLAT && ~tileh & _masks[mode + 4])) b = ~b; if (b) return false; |