diff options
author | frosch <frosch@openttd.org> | 2008-07-26 16:14:10 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-07-26 16:14:10 +0000 |
commit | 6684bc12d575265d5db59387cdc33dffb602303b (patch) | |
tree | 3a62ec9adb234e8726387b1573747436f7d43e9f /src/water_map.h | |
parent | c64e3b488273010ace06cebb2d4b55b03735eb1c (diff) | |
download | openttd-6684bc12d575265d5db59387cdc33dffb602303b.tar.xz |
(svn r13838) -Codechange: Make industry tiles aware of WaterClasses.
Diffstat (limited to 'src/water_map.h')
-rw-r--r-- | src/water_map.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/water_map.h b/src/water_map.h index 94e805342..a0faab036 100644 --- a/src/water_map.h +++ b/src/water_map.h @@ -16,6 +16,7 @@ enum WaterClass { WATER_CLASS_SEA, WATER_CLASS_CANAL, WATER_CLASS_RIVER, + WATER_CLASS_INVALID, ///< Used for industry tiles on land (also for oilrig if newgrf says so) }; enum DepotPart { @@ -45,14 +46,18 @@ static inline WaterTileType GetWaterTileType(TileIndex t) static inline WaterClass GetWaterClass(TileIndex t) { - assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION)); - return (WaterClass)GB(_m[t].m3, 0, 2); + assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY)); + return (WaterClass)(IsTileType(t, MP_INDUSTRY) ? GB(_m[t].m1, 5, 2) : GB(_m[t].m3, 0, 2)); } static inline void SetWaterClass(TileIndex t, WaterClass wc) { - assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION)); - SB(_m[t].m3, 0, 2, wc); + assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY)); + if (IsTileType(t, MP_INDUSTRY)) { + SB(_m[t].m1, 5, 2, wc); + } else { + SB(_m[t].m3, 0, 2, wc); + } } /** IsWater return true if any type of clear water like ocean, river, canal */ |