Advertisement
Guest User

Untitled

a guest
Jan 4th, 2021
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. bool CanTerraformFloodingTile(TileIndex tile, int z_new, Slope tileh_new)
  2. {
  3.     if (GetFloodingBehaviour(tile) != FLOOD_NONE) {
  4.         if (tileh_new == SLOPE_FLAT || z_new == 1) {
  5.             return false;
  6.         }
  7.  
  8.         Slope tileh = GetTileSlope(tile);
  9.  
  10.         if (IsSlopeWithThreeCornersRaised(tileh)) {
  11.             if (tileh_new == SLOPE_NS || tileh_new == SLOPE_EW) {
  12.                 return true;
  13.             }
  14.  
  15.             if (IsSteepSlope(tileh_new) &&
  16.                     OppositeCorner(GetHighestSlopeCorner(ComplementSlope(tileh))) == GetHighestSlopeCorner(tileh_new)) {
  17.                 return true;
  18.             }
  19.         }
  20.  
  21.         if (IsSteepSlope(tileh)) {
  22.             if (IsSlopeWithThreeCornersRaised(tileh_new) &&
  23.                     GetHighestSlopeCorner(tileh) == OppositeCorner(GetHighestSlopeCorner(ComplementSlope(tileh_new)))) {
  24.                 return true;
  25.             }
  26.         }
  27.  
  28.         return false;
  29.     }
  30.  
  31.     return true;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement