diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ai/default/default.cpp | 4 | ||||
-rw-r--r-- | src/ai/trolly/build.cpp | 8 | ||||
-rw-r--r-- | src/ai/trolly/pathfinder.cpp | 13 |
3 files changed, 9 insertions, 16 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp index 80956386b..60f7efa4a 100644 --- a/src/ai/default/default.cpp +++ b/src/ai/default/default.cpp @@ -2600,10 +2600,10 @@ static int32 AiDoBuildDefaultRoadBlock(TileIndex tile, const AiDefaultBlockData } else if (p->mode == 1) { if (_want_road_truck_station) { // Truck station - ret = DoCommand(c, p->attr, RoadStop::TRUCK, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_ROAD_STOP); + ret = DoCommand(c, p->attr, ROADTYPES_ROAD << 2 | RoadStop::TRUCK, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_ROAD_STOP); } else { // Bus station - ret = DoCommand(c, p->attr, RoadStop::BUS, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_ROAD_STOP); + ret = DoCommand(c, p->attr, ROADTYPES_ROAD << 2 | RoadStop::BUS, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_ROAD_STOP); } clear_town_stuff:; diff --git a/src/ai/trolly/build.cpp b/src/ai/trolly/build.cpp index 218a4c0e8..ac66bfaa6 100644 --- a/src/ai/trolly/build.cpp +++ b/src/ai/trolly/build.cpp @@ -42,9 +42,9 @@ int AiNew_Build_Station(Player *p, byte type, TileIndex tile, byte length, byte return AI_DoCommand(tile, direction + (numtracks << 8) + (length << 16), 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_RAILROAD_STATION); if (type == AI_BUS) - return AI_DoCommand(tile, direction, RoadStop::BUS, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_STOP); + return AI_DoCommand(tile, direction, ROADTYPES_ROAD << 2 | RoadStop::BUS, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_STOP); - return AI_DoCommand(tile, direction, RoadStop::TRUCK, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_STOP); + return AI_DoCommand(tile, direction, ROADTYPES_ROAD << 2 | RoadStop::TRUCK, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_STOP); } @@ -75,7 +75,7 @@ int AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, byte flag) if (p->ainew.tbt == AI_TRAIN) { return AI_DoCommand(tile_a, tile_b, (0x00 << 8) + type2, flag | DC_AUTO, CMD_BUILD_BRIDGE); } else { - return AI_DoCommand(tile_a, tile_b, (0x80 << 8) + type2, flag | DC_AUTO, CMD_BUILD_BRIDGE); + return AI_DoCommand(tile_a, tile_b, ((0x80 | ROADTYPES_ROAD) << 8) + type2, flag | DC_AUTO, CMD_BUILD_BRIDGE); } } @@ -162,7 +162,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla } else { // Tunnel code if ((AI_PATHFINDER_FLAG_TUNNEL & route_extra[part]) != 0) { - cost += AI_DoCommand(route[part], 0x200, 0, flag, CMD_BUILD_TUNNEL); + cost += AI_DoCommand(route[part], 0x200 | ROADTYPES_ROAD, 0, flag, CMD_BUILD_TUNNEL); PathFinderInfo->position++; // TODO: problems! if (CmdFailed(cost)) { diff --git a/src/ai/trolly/pathfinder.cpp b/src/ai/trolly/pathfinder.cpp index 0091939b1..e7102d642 100644 --- a/src/ai/trolly/pathfinder.cpp +++ b/src/ai/trolly/pathfinder.cpp @@ -237,17 +237,10 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr if (IsTunnel(atile)) { if (GetTunnelDirection(atile) != i) continue; } else { - if ((_m[atile].m5 & 1) != DiagDirToAxis(i)) continue; + if (GetBridgeRampDirection(atile) != i) continue; } } } - // But also if we are on a bridge, we can only move a certain direction - if (!PathFinderInfo->rail_or_road && IsRoad(ctile)) { - if (IsTileType(ctile, MP_TUNNELBRIDGE)) { - // An existing bridge/tunnel... let's test the direction ;) - if ((_m[ctile].m5 & 1) != (i & 1)) continue; - } - } if ((AI_PATHFINDER_FLAG_BRIDGE & current->path.node.user_data[0]) != 0 || (AI_PATHFINDER_FLAG_TUNNEL & current->path.node.user_data[0]) != 0) { @@ -291,9 +284,9 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr dir = 0; } else { // It already has road.. check if we miss any bits! - if ((_m[ctile].m5 & dir) != dir) { + if ((GetRoadBits(ctile, ROADTYPE_ROAD) & dir) != dir) { // We do miss some pieces :( - dir &= ~_m[ctile].m5; + dir &= ~GetRoadBits(ctile, ROADTYPE_ROAD); } else { dir = 0; } |