Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* lower tile */
- bool is_already_canal = HasTileWaterGround(tile - delta) && GetWaterClass(tile - delta) == WATER_CLASS_CANAL;
- WaterClass wc_lower = HasTileWaterGround(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL;
- Owner oc_lower = is_already_canal ? GetCanalOwner(tile - delta) : _current_company;
- bool add_cost_lower = !IsWaterTile(tile - delta);
- /* At this point we got a tile - delta with no bridge over it. Check for ownership. */
- if (IsWaterTile(tile - delta) && IsCanal(tile - delta)) {
- if (oc_lower != OWNER_NONE) {
- ret = CheckTileOwnership(tile - delta);
- if (ret.Failed() && !_settings_game.construction.build_on_competitor_canal) return ret;
- }
- } else {
- ret = DoCommand(tile - delta, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
- if (ret.Failed()) return ret;
- if (add_cost_lower) {
- cost.AddCost(ret);
- if (wc_lower == WATER_CLASS_CANAL) {
- if (oc_lower != OWNER_NONE) {
- ret = CheckOwnership(oc_lower, tile - delta);
- if (ret.Failed()) {
- if (!_settings_game.construction.build_on_competitor_canal) return ret;
- } else {
- if (!is_already_canal) cost.AddCost(_price[PR_BUILD_CANAL]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement