Loading

Paste #pvjabr0nl

  1. static bool IsPossibleLockLocation(TileIndex tile)
  2. {
  3.     DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
  4.     if (dir == INVALID_DIAGDIR) return false;
  5.  
  6.     TileIndexDiff delta_mid = TileOffsByDiagDir(dir);
  7.     if (!IsTileFlat(tile + delta_mid)) return false;
  8.     if (!IsTileFlat(tile - delta_mid)) return false;
  9.  
  10.     return true;
  11. }
  12.  
  13. /**
  14.  * Check whether a river could (logically) flow into a lock.
  15.  * @param tile the middle tile of a lock.
  16.  * @param recursive whether the function is being called recursively.
  17.  * @return true iff the water can be flowing into a lock.
  18.  */
  19. static bool IsPossibleLockLocationRecursively(TileIndex tile, bool recursive = false)
  20. {
  21.     if (!IsPossibleLockLocation(tile)) return false;
  22.  
  23.     DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
  24.     TileIndexDiff delta_mid = TileOffsByDiagDir(dir);
  25.  
  26.     etc.…;
  27. }

Comments