Changeset - r20346:401f2bc98df5
[Not reviewed]
master
0 2 0
fonsinchen - 11 years ago 2013-06-09 13:02:40
fonsinchen@openttd.org
(svn r25359) -Codechange: schedule jobs when tracking capacities of links
2 files changed with 6 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/station.cpp
Show inline comments
 
@@ -25,6 +25,7 @@
 
#include "industry.h"
 
#include "core/random_func.hpp"
 
#include "linkgraph/linkgraph.h"
 
#include "linkgraph/linkgraphschedule.h"
 

	
 
#include "table/strings.h"
 

	
 
@@ -94,6 +95,7 @@ Station::~Station()
 
		if (lg != NULL) {
 
			lg->RemoveNode(this->goods[c].node);
 
			if (lg->Size() == 0) {
 
				LinkGraphSchedule::Instance()->Unqueue(lg);
 
				delete lg;
 
			}
 
		}
src/station_cmd.cpp
Show inline comments
 
@@ -3397,6 +3397,7 @@ void IncreaseStats(Station *st, CargoID 
 
		if (ge2.link_graph == INVALID_LINK_GRAPH) {
 
			if (LinkGraph::CanAllocateItem()) {
 
				lg = new LinkGraph(cargo);
 
				LinkGraphSchedule::Instance()->Queue(lg);
 
				ge2.link_graph = lg->index;
 
				ge2.node = lg->AddNode(st2);
 
			} else {
 
@@ -3418,9 +3419,11 @@ void IncreaseStats(Station *st, CargoID 
 
		if (ge1.link_graph != ge2.link_graph) {
 
			LinkGraph *lg2 = LinkGraph::Get(ge2.link_graph);
 
			if (lg->Size() < lg2->Size()) {
 
				LinkGraphSchedule::Instance()->Unqueue(lg);
 
				lg2->Merge(lg); // Updates GoodsEntries of lg
 
				lg = lg2;
 
			} else {
 
				LinkGraphSchedule::Instance()->Unqueue(lg2);
 
				lg->Merge(lg2); // Updates GoodsEntries of lg2
 
			}
 
		}
 
@@ -3541,6 +3544,7 @@ static uint UpdateStationWaiting(Station
 
	if (ge.link_graph == INVALID_LINK_GRAPH) {
 
		if (LinkGraph::CanAllocateItem()) {
 
			lg = new LinkGraph(type);
 
			LinkGraphSchedule::Instance()->Queue(lg);
 
			ge.link_graph = lg->index;
 
			ge.node = lg->AddNode(st);
 
		} else {
0 comments (0 inline, 0 general)