|
|
@ -392,14 +392,15 @@ public:
|
|
|
|
if (_debug_yapfdesync_level < 1 && _debug_desync_level < 2) {
|
|
|
|
if (_debug_yapfdesync_level < 1 && _debug_desync_level < 2) {
|
|
|
|
result1 = pf1.FindNearestSafeTile(v, t1, td, override_railtype, false);
|
|
|
|
result1 = pf1.FindNearestSafeTile(v, t1, td, override_railtype, false);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
bool result2 = pf1.FindNearestSafeTile(v, t1, td, override_railtype, true);
|
|
|
|
bool found_path_1, found_path_2;
|
|
|
|
|
|
|
|
pf1.FindNearestSafeTile(v, t1, td, override_railtype, true, &found_path_1);
|
|
|
|
Tpf pf2;
|
|
|
|
Tpf pf2;
|
|
|
|
pf2.DisableCache(true);
|
|
|
|
pf2.DisableCache(true);
|
|
|
|
result1 = pf2.FindNearestSafeTile(v, t1, td, override_railtype, false);
|
|
|
|
result1 = pf2.FindNearestSafeTile(v, t1, td, override_railtype, false, &found_path_2);
|
|
|
|
if (result1 != result2) {
|
|
|
|
if (found_path_1 != found_path_2) {
|
|
|
|
DEBUG(desync, 0, "CACHE ERROR: FindSafeTile() = [%s, %s]", result2 ? "T" : "F", result1 ? "T" : "F");
|
|
|
|
DEBUG(desync, 0, "CACHE ERROR: FindSafeTile() = [%s, %s]", found_path_1 ? "T" : "F", found_path_2 ? "T" : "F");
|
|
|
|
DumpState(pf1, pf2);
|
|
|
|
DumpState(pf1, pf2);
|
|
|
|
} else if (result1) {
|
|
|
|
} else if (found_path_2) {
|
|
|
|
CYapfFollowAnySafeTileRailT::stDesyncCheck(pf1, pf2, "CACHE ERROR: FindSafeTile()", true);
|
|
|
|
CYapfFollowAnySafeTileRailT::stDesyncCheck(pf1, pf2, "CACHE ERROR: FindSafeTile()", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -407,13 +408,14 @@ public:
|
|
|
|
return result1;
|
|
|
|
return result1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FindNearestSafeTile(const Train *v, TileIndex t1, Trackdir td, bool override_railtype, bool dont_reserve)
|
|
|
|
bool FindNearestSafeTile(const Train *v, TileIndex t1, Trackdir td, bool override_railtype, bool dont_reserve, bool *found_path = NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Set origin and destination. */
|
|
|
|
/* Set origin and destination. */
|
|
|
|
Yapf().SetOrigin(t1, td);
|
|
|
|
Yapf().SetOrigin(t1, td);
|
|
|
|
Yapf().SetDestination(v, override_railtype);
|
|
|
|
Yapf().SetDestination(v, override_railtype);
|
|
|
|
|
|
|
|
|
|
|
|
bool bFound = Yapf().FindPath(v);
|
|
|
|
bool bFound = Yapf().FindPath(v);
|
|
|
|
|
|
|
|
if (found_path) *found_path = bFound;
|
|
|
|
if (!bFound) return false;
|
|
|
|
if (!bFound) return false;
|
|
|
|
|
|
|
|
|
|
|
|
/* Found a destination, set as reservation target. */
|
|
|
|
/* Found a destination, set as reservation target. */
|
|
|
|