From ff67ed58da6b78f0318ce94f0325424ebc42fc7b Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 13 Dec 2009 00:24:53 +0000 Subject: [PATCH] (svn r18477) [0.7] -Backport from trunk: - Fix: On slopes the original and better road layouts did not check their minimum distance requirements [FS#3332] (r18415) - Fix: Aqueducts were not influenced by the "long bridges" setting [FS#3338] (r18407) - Fix: Drive through road stops did not get flooded (r18401) - Fix: [YAPP] Trains on bridges were not found, when searching for the origin of a reservation [FS#3345] (r18392) --- src/pbs.cpp | 4 +++- src/station_cmd.cpp | 3 +++ src/town_cmd.cpp | 19 ++++--------------- src/tunnelbridge_cmd.cpp | 2 ++ 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/pbs.cpp b/src/pbs.cpp index a738da913c..b20ddf99e5 100644 --- a/src/pbs.cpp +++ b/src/pbs.cpp @@ -233,7 +233,9 @@ static Vehicle *FindTrainOnTrackEnum(Vehicle *v, void *data) { FindTrainOnTrackInfo *info = (FindTrainOnTrackInfo *)data; - if (v->type == VEH_TRAIN && !(v->vehstatus & VS_CRASHED) && HasBit((TrackBits)v->u.rail.track, TrackdirToTrack(info->res.trackdir))) { + if (v->type != VEH_TRAIN || (v->vehstatus & VS_CRASHED)) return NULL; + + if (v->u.rail.track == TRACK_BIT_WORMHOLE || HasBit((TrackBits)v->u.rail.track, TrackdirToTrack(info->res.trackdir))) { v = v->First(); /* ALWAYS return the lowest ID (anti-desync!) */ diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 7bb02e2228..f3f9dc631e 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3154,6 +3154,9 @@ static void ChangeTileOwner_Station(TileIndex tile, Owner old_owner, Owner new_o */ static bool CanRemoveRoadWithStop(TileIndex tile, DoCommandFlag flags) { + /* Yeah... water can always remove stops, right? */ + if (_current_company == OWNER_WATER) return true; + Owner road_owner = _current_company; Owner tram_owner = _current_company; diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index f01daf0451..89ccaf8871 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -760,19 +760,8 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir) } cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationSlope(tile, NULL) : GetTileSlope(tile, NULL); - if (cur_slope == SLOPE_FLAT) { -no_slope: - /* Tile has no slope */ - switch (t->layout) { - default: NOT_REACHED(); - - case TL_ORIGINAL: // Disallow the road if any neighboring tile has a road (distance: 1) - return !IsNeighborRoadTile(tile, dir, 1); - - case TL_BETTER_ROADS: // Disallow the road if any neighboring tile has a road (distance: 1 and 2). - return !IsNeighborRoadTile(tile, dir, 2); - } - } + bool ret = !IsNeighborRoadTile(tile, dir, t->layout == TL_ORIGINAL ? 1 : 2); + if (cur_slope == SLOPE_FLAT) return ret; /* If the tile is not a slope in the right direction, then * maybe terraform some. */ @@ -787,12 +776,12 @@ no_slope: } if (CmdFailed(res) && Chance16(1, 3)) { /* We can consider building on the slope, though. */ - goto no_slope; + return ret; } } return false; } - return true; + return ret; } } diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index b8f1c5fb3a..d3f93c87c2 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -248,6 +248,8 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u if (transport_type != TRANSPORT_WATER) { /* set and test bridge length, availability */ if (!CheckBridge_Stuff(bridge_type, bridge_len, flags)) return_cmd_error(STR_5015_CAN_T_BUILD_BRIDGE_HERE); + } else { + if (bridge_len > (_settings_game.construction.longbridges ? 100U : 16U)) return_cmd_error(STR_5015_CAN_T_BUILD_BRIDGE_HERE); } /* retrieve landscape height and ensure it's on land */