diff options
author | rubidium <rubidium@openttd.org> | 2007-09-23 19:27:35 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-09-23 19:27:35 +0000 |
commit | 2b89ecca47e654578481ea64743d2d703bb049ed (patch) | |
tree | 8d414b503256ed5d9878145e189d1eecce904f00 /src/industry_map.h | |
parent | 893842a8a39d1e0b0606598738ec564d65a033b5 (diff) | |
download | openttd-2b89ecca47e654578481ea64743d2d703bb049ed.tar.xz |
(svn r11151) -Codechange: add (partial) support for randomizing industry triggers (part of the backend for it). Furthermore update the documentation of the map's bits wrt to industries.
Diffstat (limited to 'src/industry_map.h')
-rw-r--r-- | src/industry_map.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/industry_map.h b/src/industry_map.h index 888f8f7a6..7cf93af5a 100644 --- a/src/industry_map.h +++ b/src/industry_map.h @@ -253,12 +253,24 @@ static inline void SetIndustryAnimationState(TileIndex tile, byte state) * @param tile TileIndex of the tile to query * @pre IsTileType(tile, MP_INDUSTRY) * @return requested bits - * @todo implement the storage in map array */ static inline byte GetIndustryRandomBits(TileIndex tile) { assert(IsTileType(tile, MP_INDUSTRY)); - return 0; + return _me[tile].m7; +} + +/** + * Set the random bits for this tile. + * Used for grf callbacks + * @param tile TileIndex of the tile to query + * @param bits the random bits + * @pre IsTileType(tile, MP_INDUSTRY) + */ +static inline byte GetIndustryRandomBits(TileIndex tile, byte bits) +{ + assert(IsTileType(tile, MP_INDUSTRY)); + _me[tile].m7 = bits; } /** @@ -267,12 +279,11 @@ static inline byte GetIndustryRandomBits(TileIndex tile) * @param tile TileIndex of the tile to query * @pre IsTileType(tile, MP_INDUSTRY) * @return requested triggers - * @todo implement the storage in map array */ static inline byte GetIndustryTriggers(TileIndex tile) { assert(IsTileType(tile, MP_INDUSTRY)); - return 0; + return GB(_m[tile].m6, 3, 3); } @@ -280,12 +291,13 @@ static inline byte GetIndustryTriggers(TileIndex tile) * Set the activated triggers bits for this industry tile * Used for grf callbacks * @param tile TileIndex of the tile to query + * @param triggers the triggers to set * @pre IsTileType(tile, MP_INDUSTRY) - * @todo implement the storage in map array */ static inline void SetIndustryTriggers(TileIndex tile, byte triggers) { assert(IsTileType(tile, MP_INDUSTRY)); + SB(_m[tile].m6, 3, 3, triggers); } #endif /* INDUSTRY_MAP_H */ |