Mercurial > hg > openttd
changeset 15094:217e3f1c5b11 draft
(svn r19720) -Feature: New base costs for building/clearing canals, building/clearing aqueducts and building/clearing locks.
author | terkhen <terkhen@openttd.org> |
---|---|
date | Sun, 25 Apr 2010 13:56:51 +0000 |
parents | e5e511b46e2b |
children | 66d86ca758e3 |
files | src/economy_type.h src/table/pricebase.h src/tunnelbridge_cmd.cpp src/water_cmd.cpp |
diffstat | 4 files changed, 21 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/economy_type.h +++ b/src/economy_type.h @@ -125,6 +125,12 @@ PR_BUILD_FOUNDATION, PR_BUILD_INDUSTRY_RAW, PR_BUILD_TOWN, + PR_BUILD_CANAL, + PR_CLEAR_CANAL, + PR_BUILD_AQUEDUCT, + PR_CLEAR_AQUEDUCT, + PR_BUILD_LOCK, + PR_CLEAR_LOCK, PR_END, INVALID_PRICE = 0xFF
--- a/src/table/pricebase.h +++ b/src/table/pricebase.h @@ -70,5 +70,11 @@ { 250, PCAT_CONSTRUCTION, GSF_END, PR_TERRAFORM }, ///< PR_BUILD_FOUNDATION {8000000, PCAT_CONSTRUCTION, GSF_END, PR_BUILD_INDUSTRY }, ///< PR_BUILD_INDUSTRY_RAW {1000000, PCAT_CONSTRUCTION, GSF_END, PR_BUILD_INDUSTRY }, ///< PR_BUILD_TOWN + { 10000, PCAT_CONSTRUCTION, GSF_END, PR_CLEAR_WATER }, ///< PR_BUILD_CANAL + { 10000, PCAT_CONSTRUCTION, GSF_END, PR_CLEAR_WATER }, ///< PR_CLEAR_CANAL + { 10000, PCAT_CONSTRUCTION, GSF_END, PR_CLEAR_WATER }, ///< PR_BUILD_AQUEDUCT + { 50, PCAT_CONSTRUCTION, GSF_END, PR_CLEAR_BRIDGE }, ///< PR_CLEAR_AQUEDUCT + { 7500, PCAT_CONSTRUCTION, GSF_END, PR_CLEAR_WATER }, ///< PR_BUILD_LOCK + { 20000, PCAT_CONSTRUCTION, GSF_END, PR_CLEAR_WATER }, ///< PR_CLEAR_LOCK }; assert_compile(lengthof(_price_base_specs) == PR_END);
--- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -474,7 +474,7 @@ cost.AddCost((int64)bridge_len * _price[PR_BUILD_BRIDGE] * GetBridgeSpec(bridge_type)->price >> 8); } else { /* Aqueducts use a separate base cost. */ - cost.AddCost((int64)bridge_len * _price[PR_CLEAR_WATER]); + cost.AddCost((int64)bridge_len * _price[PR_BUILD_AQUEDUCT]); } } @@ -787,7 +787,8 @@ } } - return CommandCost(EXPENSES_CONSTRUCTION, (GetTunnelBridgeLength(tile, endtile) + 2) * _price[PR_CLEAR_BRIDGE]); + Money base_cost = (GetTunnelBridgeTransportType(tile) != TRANSPORT_WATER) ? _price[PR_CLEAR_BRIDGE] : _price[PR_CLEAR_AQUEDUCT]; + return CommandCost(EXPENSES_CONSTRUCTION, (GetTunnelBridgeLength(tile, endtile) + 2) * base_cost); } /** Remove a tunnel or a bridge from the game.
--- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -246,7 +246,7 @@ MarkCanalsAndRiversAroundDirty(tile - delta); MarkCanalsAndRiversAroundDirty(tile + delta); } - cost.AddCost(_price[PR_CLEAR_WATER] * 3 / 4); + cost.AddCost(_price[PR_BUILD_LOCK]); return cost; } @@ -281,7 +281,7 @@ MarkCanalsAndRiversAroundDirty(tile + delta); } - return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_WATER] * 2); + return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_LOCK]); } /** Builds a lock. @@ -360,7 +360,7 @@ MarkCanalsAndRiversAroundDirty(tile); } - cost.AddCost(_price[PR_CLEAR_WATER]); + cost.AddCost(_price[PR_BUILD_CANAL]); } if (cost.GetCost() == 0) { @@ -376,6 +376,7 @@ case WATER_TILE_CLEAR: { if (flags & DC_NO_WATER) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER); + Money base_cost = IsCanal(tile) ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER]; /* Make sure freeform edges are allowed or it's not an edge tile. */ if (!_settings_game.construction.freeform_edges && (!IsInsideMM(TileX(tile), 1, MapMaxX() - 1) || !IsInsideMM(TileY(tile), 1, MapMaxY() - 1))) { @@ -395,7 +396,8 @@ DoClearSquare(tile); MarkCanalsAndRiversAroundDirty(tile); } - return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_WATER]); + + return CommandCost(EXPENSES_CONSTRUCTION, base_cost); } case WATER_TILE_COAST: {