Merge branch 'master' into jgrpp
# Conflicts: # src/group_gui.cpp # src/lang/german.txt # src/lang/korean.txt # src/lang/traditional_chinese.txt # src/pathfinder/yapf/yapf_rail.cpp # src/saveload/vehicle_sl.cpp # src/window.cpp
This commit is contained in:
@@ -541,6 +541,8 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
|
||||
/* Penalty for reversing in a depot. */
|
||||
assert(IsRailDepot(cur.tile));
|
||||
segment_cost += Yapf().PfGetSettings().rail_depot_reverse_penalty;
|
||||
|
||||
} else if (IsRailDepotTile(cur.tile)) {
|
||||
/* We will end in this pass (depot is possible target) */
|
||||
end_segment_reason |= ESRB_DEPOT;
|
||||
|
||||
@@ -554,9 +556,16 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
|
||||
CFollowTrackRail ft(v);
|
||||
TileIndex t = cur.tile;
|
||||
Trackdir td = cur.td;
|
||||
/* Arbitrary maximum tiles to follow to avoid infinite loops. */
|
||||
uint max_tiles = 20;
|
||||
while (ft.Follow(t, td)) {
|
||||
assert(t != ft.m_new_tile);
|
||||
t = ft.m_new_tile;
|
||||
if (t == cur.tile || --max_tiles == 0) {
|
||||
/* We looped back on ourself or found another loop, bail out. */
|
||||
td = INVALID_TRACKDIR;
|
||||
break;
|
||||
}
|
||||
if (KillFirstBit(ft.m_new_td_bits) != TRACKDIR_BIT_NONE) {
|
||||
/* We encountered a junction; it's going to be too complex to
|
||||
* handle this perfectly, so just bail out. There is no simple
|
||||
@@ -615,7 +624,7 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
|
||||
/* Finish if we already exceeded the maximum path cost (i.e. when
|
||||
* searching for the nearest depot). */
|
||||
if (m_max_cost > 0 && (parent_cost + segment_entry_cost + segment_cost) > m_max_cost) {
|
||||
end_segment_reason |= ESRB_PATH_TOO_LONG;
|
||||
end_segment_reason |= ESRB_MAX_COST_EXCEEDED;
|
||||
}
|
||||
|
||||
/* Move to the next tile/trackdir. */
|
||||
@@ -691,6 +700,9 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
|
||||
|
||||
} // for (;;)
|
||||
|
||||
/* Don't consider path any further it if exceeded max_cost. */
|
||||
if (end_segment_reason & ESRB_MAX_COST_EXCEEDED) return false;
|
||||
|
||||
bool target_seen = false;
|
||||
if ((end_segment_reason & ESRB_POSSIBLE_TARGET) != ESRB_NONE) {
|
||||
/* Depot, station or waypoint. */
|
||||
|
||||
Reference in New Issue
Block a user