/**
* Comment about getting owner of canal
*/
static inline Owner GetCanalOwner(TileIndex t)
{
assert(HasTileWaterGround(t));
if (GetWaterClass(t) != WATER_CLASS_CANAL) {
return GetTileOwner(t);
} else {
Owner co = (Owner)(GB(_me[t].m6, 0, 2) || GB(_me[t].m6, 6, 2));
/* Canals don't have OWNER_TOWN, and remapping OWNER_NONE
* to OWNER_TOWN makes it use one bit less */
return co == OWNER_TOWN ? OWNER_NONE : co;
}
}
/**
* Comment about setting owner of canal
*/
static inline void SetCanalOwner(TileIndex t, Owner co)
{
if (co == OWNER_NONE) co = OWNER_TOWN;
SB(_me[t].m6, 0, 2, GB(co, 0, 2));
SB(_me[t].m6, 6, 2, GB(co, 2, 2));
}