summaryrefslogtreecommitdiff
path: root/tunnelbridge_cmd.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-08-20 09:32:32 +0000
committertruelight <truelight@openttd.org>2004-08-20 09:32:32 +0000
commit788ace088d8b3ba2afd77a8b21b532abc40d9eba (patch)
tree493248c0850e836b9a0d35c0fdddf9673b2a01b3 /tunnelbridge_cmd.c
parent80b1e25b6ce190a773ab9fe50927a983c8f2d038 (diff)
downloadopenttd-788ace088d8b3ba2afd77a8b21b532abc40d9eba.tar.xz
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
-Add: generalised A* Algorithm -Add: generalised queues (Fifo, Stack, InsSort, BinaryHeap)
Diffstat (limited to 'tunnelbridge_cmd.c')
-rw-r--r--tunnelbridge_cmd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 92bafbe65..5326c161a 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -239,9 +239,9 @@ int32 CmdBuildBridge(int x, int y, uint32 flags, uint32 p1, uint32 p2)
terraformcost = CheckBridgeSlope(direction, ti_start.tileh, true); // true - bridge-start-tile, false - bridge-end-tile
- // the AI and towns are not allowed to use bridges on slopes.
+ // towns are not allowed to use bridges on slopes.
if (terraformcost == CMD_ERROR ||
- (terraformcost && (_is_ai_player || _current_player == OWNER_TOWN || !_patches.build_on_slopes)))
+ (terraformcost && ((!_patches.ainew_active && _is_ai_player) || _current_player == OWNER_TOWN || !_patches.build_on_slopes)))
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
cost += terraformcost;
@@ -253,9 +253,9 @@ int32 CmdBuildBridge(int x, int y, uint32 flags, uint32 p1, uint32 p2)
terraformcost = CheckBridgeSlope(direction, ti_end.tileh, false); // false - end tile slope check
- // the AI and towns are not allowed to use bridges on slopes.
+ // towns are not allowed to use bridges on slopes.
if (terraformcost == CMD_ERROR ||
- (terraformcost && (_is_ai_player || _current_player == OWNER_TOWN || !_patches.build_on_slopes)))
+ (terraformcost && ((!_patches.ainew_active && _is_ai_player) || _current_player == OWNER_TOWN || !_patches.build_on_slopes)))
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
cost += terraformcost;
@@ -377,10 +377,10 @@ not_valid_below:;
It's unnecessary to execute this command every time for every bridge. So it is done only
and cost is computed in "bridge_gui.c". For AI, Towns this has to be of course calculated
*/
- if (!(flags & DC_QUERY_COST)) {
+ if (!(flags & DC_QUERY_COST)) {
bridge_len += 2; // begin and end tiles/ramps
- if (_current_player < MAX_PLAYERS && IS_HUMAN_PLAYER(_current_player))
+ if (_current_player < MAX_PLAYERS && !(_is_ai_player && !_patches.ainew_active))
bridge_len = CalcBridgeLenCostFactor(bridge_len);
cost += ((bridge_len * _price.build_bridge) * _bridge_type_price_mod[bridge_type]) >> 8;
@@ -887,7 +887,7 @@ int32 DoConvertTunnelBridgeRail(uint tile, uint totype, bool exec)
// fast routine for getting the height of a middle bridge tile. 'tile' MUST be a middle bridge tile.
-static uint GetBridgeHeight(const TileInfo *ti)
+uint GetBridgeHeight(const TileInfo *ti)
{
uint delta;
TileInfo ti_end;
@@ -966,7 +966,7 @@ static void DrawBridgePillars(TileInfo *ti, int x, int y, int z)
}
}
-static uint GetBridgeFoundation(uint tileh, byte direction) {
+uint GetBridgeFoundation(uint tileh, byte direction) {
int i;
// normal level sloped building (7, 11, 13, 14)
if (BRIDGE_FULL_LEVELED_FOUNDATION & (1 << tileh))