Loading

Paste #p20tkxsoz

  1. /**
  2.  * Comment about getting owner of canal
  3.  */
  4. static inline Owner GetCanalOwner(TileIndex t)
  5. {
  6.     assert(HasTileWaterGround(t));
  7.  
  8.     if (GetWaterClass(t) != WATER_CLASS_CANAL) {
  9.         return GetTileOwner(t);
  10.         } else {
  11.         Owner co = (Owner)(GB(_me[t].m6, 0, 2) || GB(_me[t].m6, 6, 2));
  12.         /* Canals don't have OWNER_TOWN, and remapping OWNER_NONE
  13.         * to OWNER_TOWN makes it use one bit less */
  14.         return co == OWNER_TOWN ? OWNER_NONE : co;
  15.     }
  16. }
  17. /**
  18.  * Comment about setting owner of canal
  19.  */
  20. static inline void SetCanalOwner(TileIndex t, Owner co)
  21. {
  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. }

Comments