|
|
@ -58,6 +58,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include "safeguards.h"
|
|
|
|
#include "safeguards.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Static instance of FlowStat::SharesMap.
|
|
|
|
|
|
|
|
* Note: This instance is created on task start.
|
|
|
|
|
|
|
|
* Lazy creation on first usage results in a data race between the CDist threads.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* static */ const FlowStat::SharesMap FlowStat::empty_sharesmap;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Check whether the given tile is a hangar.
|
|
|
|
* Check whether the given tile is a hangar.
|
|
|
|
* @param t the tile to of whether it is a hangar.
|
|
|
|
* @param t the tile to of whether it is a hangar.
|
|
|
@ -3536,7 +3543,7 @@ void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint c
|
|
|
|
if (ge2.link_graph == INVALID_LINK_GRAPH) {
|
|
|
|
if (ge2.link_graph == INVALID_LINK_GRAPH) {
|
|
|
|
if (LinkGraph::CanAllocateItem()) {
|
|
|
|
if (LinkGraph::CanAllocateItem()) {
|
|
|
|
lg = new LinkGraph(cargo);
|
|
|
|
lg = new LinkGraph(cargo);
|
|
|
|
LinkGraphSchedule::Instance()->Queue(lg);
|
|
|
|
LinkGraphSchedule::instance.Queue(lg);
|
|
|
|
ge2.link_graph = lg->index;
|
|
|
|
ge2.link_graph = lg->index;
|
|
|
|
ge2.node = lg->AddNode(st2);
|
|
|
|
ge2.node = lg->AddNode(st2);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -3558,11 +3565,11 @@ void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint c
|
|
|
|
if (ge1.link_graph != ge2.link_graph) {
|
|
|
|
if (ge1.link_graph != ge2.link_graph) {
|
|
|
|
LinkGraph *lg2 = LinkGraph::Get(ge2.link_graph);
|
|
|
|
LinkGraph *lg2 = LinkGraph::Get(ge2.link_graph);
|
|
|
|
if (lg->Size() < lg2->Size()) {
|
|
|
|
if (lg->Size() < lg2->Size()) {
|
|
|
|
LinkGraphSchedule::Instance()->Unqueue(lg);
|
|
|
|
LinkGraphSchedule::instance.Unqueue(lg);
|
|
|
|
lg2->Merge(lg); // Updates GoodsEntries of lg
|
|
|
|
lg2->Merge(lg); // Updates GoodsEntries of lg
|
|
|
|
lg = lg2;
|
|
|
|
lg = lg2;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
LinkGraphSchedule::Instance()->Unqueue(lg2);
|
|
|
|
LinkGraphSchedule::instance.Unqueue(lg2);
|
|
|
|
lg->Merge(lg2); // Updates GoodsEntries of lg2
|
|
|
|
lg->Merge(lg2); // Updates GoodsEntries of lg2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -3684,7 +3691,7 @@ static uint UpdateStationWaiting(Station *st, CargoID type, uint amount, SourceT
|
|
|
|
if (ge.link_graph == INVALID_LINK_GRAPH) {
|
|
|
|
if (ge.link_graph == INVALID_LINK_GRAPH) {
|
|
|
|
if (LinkGraph::CanAllocateItem()) {
|
|
|
|
if (LinkGraph::CanAllocateItem()) {
|
|
|
|
lg = new LinkGraph(type);
|
|
|
|
lg = new LinkGraph(type);
|
|
|
|
LinkGraphSchedule::Instance()->Queue(lg);
|
|
|
|
LinkGraphSchedule::instance.Queue(lg);
|
|
|
|
ge.link_graph = lg->index;
|
|
|
|
ge.link_graph = lg->index;
|
|
|
|
ge.node = lg->AddNode(st);
|
|
|
|
ge.node = lg->AddNode(st);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|