DemandCalculator Class Reference

Calculate the demands. More...

#include <demands.h>

Public Member Functions

 DemandCalculator (LinkGraphComponent *graph)
 Create the DemandCalculator and immediately do the calculation.

Private Member Functions

template<class Tscaler >
void CalcDemand (LinkGraphComponent *graph, Tscaler scaler)
 Do the actual demand calculation, called from constructor.

Private Attributes

int32 max_distance
 Maximum distance possible on the map.
int32 mod_dist
 Distance modifier, determines how much demands decrease with distance.
int32 accuracy
 Accuracy of the calculation.

Detailed Description

Calculate the demands.

This class has a state, but is recreated for each call to of DemandHandler::Run.

Definition at line 128 of file demands.h.


Constructor & Destructor Documentation

DemandCalculator::DemandCalculator ( LinkGraphComponent graph  ) 

Create the DemandCalculator and immediately do the calculation.

Parameters:
graph Component to calculate the demands for.

Definition at line 160 of file demands.cpp.

References LinkGraphSettings::accuracy, accuracy, LinkGraphSettings::demand_distance, LinkGraphSettings::demand_size, DT_ASYMMETRIC, DT_SYMMETRIC, LinkGraphComponent::GetCargo(), LinkGraphComponent::GetSettings(), and mod_dist.


Member Function Documentation

template<class Tscaler >
void DemandCalculator::CalcDemand ( LinkGraphComponent graph,
Tscaler  scaler 
) [inline, private]

Do the actual demand calculation, called from constructor.

Parameters:
graph Component to calculate the demands for.

Definition at line 58 of file demands.cpp.

References accuracy, Node::demand, Edge::distance, LinkGraphComponent::GetEdge(), LinkGraphComponent::GetNode(), LinkGraphComponent::GetSize(), max_distance, min(), mod_dist, Node::supply, and Node::undelivered_supply.


The documentation for this class was generated from the following files:

Generated on Fri May 27 04:20:39 2011 for OpenTTD by  doxygen 1.6.1