Loading

Revision differences

Old revision #pghr7xyanNew revision #p4zzsjzk5
1static inline Owner GetCanalOwner(TileIndex t)  1static inline Owner GetCanalOwner(TileIndex t)  
2{  2{  
3    assert(GetWaterClass(t) == WATER_CLASS_CANAL);  3    if (!HasTileWaterGround(t)) return GetTileOwner(t);
4  4  
5    if (IsCanal(t)) return GetTileOwner(t);  5    Owner o = (Owner)(GB(_me[t].m6, 0, 2) | (GB(_me[t].m6, 6, 2) << 2));
6  6  
7    Owner owner_canal = GetTileOwner(t);    
8    SB(owner_canal, 0, 2, GB(_me[t].m6, 0, 2));    
9    SB(owner_canal, 6, 2, GB(_me[t].m6, 6, 2));    
10    /* Canals don't need OWNER_TOWN, and remapping OWNER_NONE  7    /* Canals don't need OWNER_TOWN, and remapping OWNER_NONE  
11    * to OWNER_TOWN makes it use one bit less. */  11    * to OWNER_TOWN makes it use one bit less. */
12    return owner_canal == OWNER_TOWN ? OWNER_NONE : owner_canal;  12    return o == OWNER_TOWN ? OWNER_NONE : o;
13} 10}