|
@@ -25,14 +25,16 @@
|
|
|
#include "../../airport.h"
|
|
|
#include "../../depot.h"
|
|
|
#include "../../variables.h"
|
|
|
#include "../../bridge.h"
|
|
|
#include "../../date.h"
|
|
|
#include "../../helpers.hpp"
|
|
|
#include "../../tunnelbridge_map.h"
|
|
|
#include "default.h"
|
|
|
|
|
|
|
|
|
// remove some day perhaps?
|
|
|
static uint _ai_service_interval;
|
|
|
|
|
|
typedef void AiStateAction(Player *p);
|
|
|
|
|
|
enum {
|
|
@@ -2230,13 +2232,13 @@ static bool AiRemoveTileAndGoForward(Pla
|
|
|
return false;
|
|
|
p->ai.cur_tile_a = TILE_MASK(_build_tunnel_endtile - TileOffsByDiagDir(p->ai.cur_dir_a));
|
|
|
return true;
|
|
|
} else {
|
|
|
// Check if the bridge points in the right direction.
|
|
|
// This is not really needed the first place AiRemoveTileAndGoForward is called.
|
|
|
if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1)) return false;
|
|
|
if (DiagDirToAxis(GetTunnelBridgeDirection(tile)) != (p->ai.cur_dir_a & 1)) return false;
|
|
|
|
|
|
tile = GetOtherBridgeEnd(tile);
|
|
|
|
|
|
tilenew = TILE_MASK(tile - TileOffsByDiagDir(p->ai.cur_dir_a));
|
|
|
// And clear the bridge.
|
|
|
if (CmdFailed(DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR)))
|
|
@@ -3730,19 +3732,19 @@ pos_3:
|
|
|
DC_EXEC,
|
|
|
CMD_REMOVE_ROAD);
|
|
|
}
|
|
|
} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
|
|
|
if (!IsTileOwner(tile, _current_player) ||
|
|
|
!IsBridge(tile) ||
|
|
|
GetBridgeTransportType(tile) != TRANSPORT_RAIL) {
|
|
|
GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
rails = TRACK_BIT_NONE;
|
|
|
|
|
|
switch (GetBridgeRampDirection(tile)) {
|
|
|
switch (GetTunnelBridgeDirection(tile)) {
|
|
|
default:
|
|
|
case DIAGDIR_NE: goto pos_2;
|
|
|
case DIAGDIR_SE: goto pos_3;
|
|
|
case DIAGDIR_SW: goto pos_0;
|
|
|
case DIAGDIR_NW: goto pos_1;
|
|
|
}
|