Loading

Paste #pm2z02db9

  1.     if (!IsTileFlat(tile_cur)) {
  2.         if (GetTileZ(tile) == 0 && GetTileZ(tile_cur) == 0) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
  3.         int z_tile = GetTileMaxZ(tile);
  4.         int z_tile_cur = GetTileMaxZ(tile_cur);
  5.         bool z = Delta(z_tile_cur, z_tile) == 0;
  6.         Slope slope = GetTileSlope(tile_cur);
  7.  
  8.         /* Mark the tile as already cleared for the terraform command.
  9.         * Do this for all tiles (like trees), not only objects. */
  10.         ClearedObjectArea *coa = FindClearedObject(tile_cur);
  11.         if (coa == NULL) {
  12.             coa = _cleared_object_areas.Append();
  13.             coa->first_tile = tile_cur;
  14.             coa->area = TileArea(tile_cur, 1, 1);
  15.         }
  16.         /* Hide the tile from the terraforming command */
  17.         TileIndex tile_cur_before = coa->first_tile;
  18.         coa->first_tile = INVALID_TILE;
  19.         ret = DoCommand(tile_cur, z ? slope : ComplementSlope(slope), z ? 0 : 1, flags | DC_NO_WATER, CMD_TERRAFORM_LAND);
  20.         coa->first_tile = tile_cur_before;
  21.         if (ret.Failed()) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
  22.         cost.AddCost(ret);
  23.     }

Version history

Revision # Author Created at
pvgnf721h Anonymous 18 Sep 2016, 17:36:16 UTC Diff

Comments