File diff r21382:9d5f35b3c6bb → r21383:942c32fb8b0e
src/linkgraph/linkgraph.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/*
 
 * This file is part of OpenTTD.
 
 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 
 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
/** @file linkgraph.cpp Definition of link graph classes used for cargo distribution. */
 

	
 
#include "../stdafx.h"
 
#include "../core/pool_func.hpp"
 
#include "linkgraph.h"
 

	
 
#include "../safeguards.h"
 

	
 
/* Initialize the link-graph-pool */
 
LinkGraphPool _link_graph_pool("LinkGraph");
 
INSTANTIATE_POOL_METHODS(LinkGraph)
 

	
 
/**
 
 * Create a node or clear it.
 
 * @param st ID of the associated station.
 
 * @param demand Demand for cargo at the station.
 
 */
 
inline void LinkGraph::BaseNode::Init(StationID st, uint demand)
 
{
 
	this->supply = 0;
 
	this->demand = demand;
 
	this->station = st;
 
	this->last_update = INVALID_DATE;
 
}
 

	
 
/**
 
 * Create an edge.
 
 * @param distance Length of the link as manhattan distance.
 
 */
 
inline void LinkGraph::BaseEdge::Init(uint distance)
 
{
 
	this->distance = distance;