mirror of https://github.com/OpenTTD/OpenTTD
(svn r27682) -Fix: Don't check if links are alive for manually routed cargo
parent
662c019136
commit
58fdd3ac98
|
@ -3445,6 +3445,7 @@ void RerouteCargo(Station *st, CargoID c, StationID avoid, StationID avoid2)
|
||||||
void DeleteStaleLinks(Station *from)
|
void DeleteStaleLinks(Station *from)
|
||||||
{
|
{
|
||||||
for (CargoID c = 0; c < NUM_CARGO; ++c) {
|
for (CargoID c = 0; c < NUM_CARGO; ++c) {
|
||||||
|
const bool auto_distributed = (_settings_game.linkgraph.GetDistributionType(c) != DT_MANUAL);
|
||||||
GoodsEntry &ge = from->goods[c];
|
GoodsEntry &ge = from->goods[c];
|
||||||
LinkGraph *lg = LinkGraph::GetIfValid(ge.link_graph);
|
LinkGraph *lg = LinkGraph::GetIfValid(ge.link_graph);
|
||||||
if (lg == NULL) continue;
|
if (lg == NULL) continue;
|
||||||
|
@ -3457,6 +3458,9 @@ void DeleteStaleLinks(Station *from)
|
||||||
assert(_date >= edge.LastUpdate());
|
assert(_date >= edge.LastUpdate());
|
||||||
uint timeout = LinkGraph::MIN_TIMEOUT_DISTANCE + (DistanceManhattan(from->xy, to->xy) >> 3);
|
uint timeout = LinkGraph::MIN_TIMEOUT_DISTANCE + (DistanceManhattan(from->xy, to->xy) >> 3);
|
||||||
if ((uint)(_date - edge.LastUpdate()) > timeout) {
|
if ((uint)(_date - edge.LastUpdate()) > timeout) {
|
||||||
|
bool updated = false;
|
||||||
|
|
||||||
|
if (auto_distributed) {
|
||||||
/* Have all vehicles refresh their next hops before deciding to
|
/* Have all vehicles refresh their next hops before deciding to
|
||||||
* remove the node. */
|
* remove the node. */
|
||||||
OrderList *l;
|
OrderList *l;
|
||||||
|
@ -3478,7 +3482,6 @@ void DeleteStaleLinks(Station *from)
|
||||||
*(vehicles.Append()) = l->GetFirstSharedVehicle();
|
*(vehicles.Append()) = l->GetFirstSharedVehicle();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool updated = false;
|
|
||||||
Vehicle **iter = vehicles.Begin();
|
Vehicle **iter = vehicles.Begin();
|
||||||
while (iter != vehicles.End()) {
|
while (iter != vehicles.End()) {
|
||||||
Vehicle *v = *iter;
|
Vehicle *v = *iter;
|
||||||
|
@ -3499,6 +3502,7 @@ void DeleteStaleLinks(Station *from)
|
||||||
|
|
||||||
if (iter == vehicles.End()) iter = vehicles.Begin();
|
if (iter == vehicles.End()) iter = vehicles.Begin();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!updated) {
|
if (!updated) {
|
||||||
/* If it's still considered dead remove it. */
|
/* If it's still considered dead remove it. */
|
||||||
|
|
Loading…
Reference in New Issue