summaryrefslogtreecommitdiff
path: root/src/industry_map.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-09-23 19:27:35 +0000
committerrubidium <rubidium@openttd.org>2007-09-23 19:27:35 +0000
commit4dca543135cac8034a5391e797711207ecf446b5 (patch)
tree8d414b503256ed5d9878145e189d1eecce904f00 /src/industry_map.h
parentf4792f29cb1fc948584cd4c3c818ed8d5ae65473 (diff)
downloadopenttd-4dca543135cac8034a5391e797711207ecf446b5.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.h22
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 */