summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-04-25 13:56:51 +0000
committerterkhen <terkhen@openttd.org>2010-04-25 13:56:51 +0000
commit52ab1c7d403c2fd6b4ae30a8590fdb8f53c0230f (patch)
treed580e63c18897bbdbb2cd4271f8da00a70af1dbc /src
parenta2b03e54e04303fc1f5a613c56ee5f48d0505ae8 (diff)
downloadopenttd-52ab1c7d403c2fd6b4ae30a8590fdb8f53c0230f.tar.xz
(svn r19720) -Feature: New base costs for building/clearing canals, building/clearing aqueducts and building/clearing locks.
Diffstat (limited to 'src')
-rw-r--r--src/economy_type.h6
-rw-r--r--src/table/pricebase.h6
-rw-r--r--src/tunnelbridge_cmd.cpp5
-rw-r--r--src/water_cmd.cpp10
4 files changed, 21 insertions, 6 deletions
diff --git a/src/economy_type.h b/src/economy_type.h
index a9e3ecee3..2abc9c643 100644
--- a/src/economy_type.h
+++ b/src/economy_type.h
@@ -125,6 +125,12 @@ enum Price {
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
diff --git a/src/table/pricebase.h b/src/table/pricebase.h
index ae93c6a07..ba85dc72a 100644
--- a/src/table/pricebase.h
+++ b/src/table/pricebase.h
@@ -70,5 +70,11 @@ extern const PriceBaseSpec _price_base_specs[] = {
{ 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);
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 4df5a9133..5ffce3ad5 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -474,7 +474,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
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 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags)
}
}
- 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.
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index d1d02d0ba..c3aadec8a 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -246,7 +246,7 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
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 @@ static CommandCost RemoveLock(TileIndex tile, DoCommandFlag flags)
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 @@ CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
MarkCanalsAndRiversAroundDirty(tile);
}
- cost.AddCost(_price[PR_CLEAR_WATER]);
+ cost.AddCost(_price[PR_BUILD_CANAL]);
}
if (cost.GetCost() == 0) {
@@ -376,6 +376,7 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
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 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
DoClearSquare(tile);
MarkCanalsAndRiversAroundDirty(tile);
}
- return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_WATER]);
+
+ return CommandCost(EXPENSES_CONSTRUCTION, base_cost);
}
case WATER_TILE_COAST: {