Old revision #pk9ivwxv6 | New revision #pttduycso | ||
---|---|---|---|
1 | /** | ||
2 | * Comment about getting owner of canal | ||
3 | */ | ||
1 | static inline Owner GetCanalOwner(TileIndex t) | 4 | static inline Owner GetCanalOwner(TileIndex t) |
2 | { | 5 | { |
3 | assert(HasTileWaterGround(t)); | 6 | assert(HasTileWaterGround(t)); | … | … |
5 | if (GetWaterClass(t) != WATER_CLASS_CANAL) { | 8 | if (GetWaterClass(t) != WATER_CLASS_CANAL) { |
6 | return GetTileOwner(t); | 9 | return GetTileOwner(t); |
7 | } else { | 10 | } else { |
8 | Owner co = (Owner)0; | 8 | GB(_me[t].m6, 0, 2) || GB(_me[t].m6, 2, 2); |
9 | SB(co, 0, 2, GB(_me[t].m6, 0, 2)); | ||
10 | SB(co, 2, 2, GB(_me[t].m6, 6, 2)); | ||
11 | return co == OWNER_TOWN ? OWNER_NONE : co; | ||
12 | } | 12 | } |
13 | } | 13 | } |
14 | 14 | /** | |
15 | * Comment about setting owner of canal | ||
16 | */ | ||
15 | static inline void SetCanalOwner(TileIndex t, Owner co) | 17 | static inline void SetCanalOwner(TileIndex t, Owner co) |
16 | { | 18 | { |
17 | assert(HasTileWaterGround(t)); | 17 | if (co == OWNER_NONE) co = OWNER_TOWN; |
18 | 18 | SB(_me[t].m6, 0, 2, GB(co, 0, 2)); | |
19 | if (GetWaterClass(t) != WATER_CLASS_CANAL) { | 19 | SB(_me[t].m6, 6, 2, GB(co, 2, 2)); |
20 | SetTileOwner(t, co); | ||
21 | } else { | ||
22 | if (co == OWNER_NONE) co = OWNER_TOWN; | ||
23 | SB(_me[t].m6, 0, 2, GB(co, 0, 2)); | ||
24 | SB(_me[t].m6, 6, 2, GB(co, 2, 2)); | ||
25 | } | ||
26 | } | 22 | } |