Merge branch 'master' into jgrpp
Remove the viewport sign cache as this is now superseded by the kd tree implementation # Conflicts: # src/crashlog.cpp # src/lang/english.txt # src/misc.cpp # src/pathfinder/follow_track.hpp # src/pbs.cpp # src/rail_cmd.cpp # src/saveload/vehicle_sl.cpp # src/settings.cpp # src/settings_gui.cpp # src/ship_cmd.cpp # src/station.cpp # src/station_base.h # src/station_cmd.cpp # src/table/settings.ini # src/thread/thread_morphos.cpp # src/town_cmd.cpp # src/train_cmd.cpp # src/viewport.cpp # src/waypoint.cpp
This commit is contained in:
@@ -973,6 +973,8 @@ static Trackdir RoadFindPathToDest(RoadVehicle *v, TileIndex tile, DiagDirection
|
||||
/* Remove tracks unreachable from the enter dir */
|
||||
trackdirs &= DiagdirReachesTrackdirs(enterdir);
|
||||
if (trackdirs == TRACKDIR_BIT_NONE) {
|
||||
/* If vehicle expected a path, it no longer exists, so invalidate it. */
|
||||
if (!v->path.empty()) v->path.clear();
|
||||
/* No reachable tracks, so we'll reverse */
|
||||
return_track(_road_reverse_table[enterdir]);
|
||||
}
|
||||
@@ -1003,12 +1005,35 @@ static Trackdir RoadFindPathToDest(RoadVehicle *v, TileIndex tile, DiagDirection
|
||||
|
||||
/* Only one track to choose between? */
|
||||
if (KillFirstBit(trackdirs) == TRACKDIR_BIT_NONE) {
|
||||
if (!v->path.empty() && v->path.tile.front() == tile) {
|
||||
/* Vehicle expected a choice here, invalidate its path. */
|
||||
v->path.clear();
|
||||
}
|
||||
return_track(FindFirstBit2x64(trackdirs));
|
||||
}
|
||||
|
||||
/* Attempt to follow cached path. */
|
||||
if (!v->path.empty()) {
|
||||
if (v->path.tile.front() != tile) {
|
||||
/* Vehicle didn't expect a choice here, invalidate its path. */
|
||||
v->path.clear();
|
||||
} else {
|
||||
Trackdir trackdir = v->path.td.front();
|
||||
|
||||
if (HasBit(trackdirs, trackdir)) {
|
||||
v->path.td.pop_front();
|
||||
v->path.tile.pop_front();
|
||||
return_track(trackdir);
|
||||
}
|
||||
|
||||
/* Vehicle expected a choice which is no longer available. */
|
||||
v->path.clear();
|
||||
}
|
||||
}
|
||||
|
||||
switch (_settings_game.pf.pathfinder_for_roadvehs) {
|
||||
case VPF_NPF: best_track = NPFRoadVehicleChooseTrack(v, tile, enterdir, path_found); break;
|
||||
case VPF_YAPF: best_track = YapfRoadVehicleChooseTrack(v, tile, enterdir, trackdirs, path_found); break;
|
||||
case VPF_YAPF: best_track = YapfRoadVehicleChooseTrack(v, tile, enterdir, trackdirs, path_found, v->path); break;
|
||||
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
@@ -1679,6 +1704,13 @@ bool RoadVehicle::Tick()
|
||||
return true;
|
||||
}
|
||||
|
||||
void RoadVehicle::SetDestTile(TileIndex tile)
|
||||
{
|
||||
if (tile == this->dest_tile) return;
|
||||
this->path.clear();
|
||||
this->dest_tile = tile;
|
||||
}
|
||||
|
||||
static void CheckIfRoadVehNeedsService(RoadVehicle *v)
|
||||
{
|
||||
/* If we already got a slot at a stop, use that FIRST, and go to a depot later */
|
||||
|
Reference in New Issue
Block a user