Advertisement
Guest User

Untitled

a guest
Jan 14th, 2020
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1.     /* lower tile */
  2.     bool is_already_canal = HasTileWaterGround(tile - delta) && GetWaterClass(tile - delta) == WATER_CLASS_CANAL;
  3.  
  4.     WaterClass wc_lower = HasTileWaterGround(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL;
  5.     Owner oc_lower = is_already_canal ? GetCanalOwner(tile - delta) : _current_company;
  6.     bool add_cost_lower = !IsWaterTile(tile - delta);
  7.  
  8.     /* At this point we got a tile - delta with no bridge over it. Check for ownership. */
  9.     if (IsWaterTile(tile - delta) && IsCanal(tile - delta)) {
  10.         if (oc_lower != OWNER_NONE) {
  11.             ret = CheckTileOwnership(tile - delta);
  12.             if (ret.Failed() && !_settings_game.construction.build_on_competitor_canal) return ret;
  13.         }
  14.     } else {
  15.         ret = DoCommand(tile - delta, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
  16.         if (ret.Failed()) return ret;
  17.         if (add_cost_lower) {
  18.             cost.AddCost(ret);
  19.             if (wc_lower == WATER_CLASS_CANAL) {
  20.                 if (oc_lower != OWNER_NONE) {
  21.                     ret = CheckOwnership(oc_lower, tile - delta);
  22.                     if (ret.Failed()) {
  23.                         if (!_settings_game.construction.build_on_competitor_canal) return ret;
  24.                     } else {
  25.                         if (!is_already_canal) cost.AddCost(_price[PR_BUILD_CANAL]);
  26.                     }
  27.                 }
  28.             }
  29.         }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement