OpenTTD
demands.h
Go to the documentation of this file.
1 
3 #ifndef DEMANDS_H
4 #define DEMANDS_H
5 
6 #include "linkgraphjob_base.h"
7 
13 public:
15 
16 private:
17  int32 max_distance;
18  int32 mod_dist;
19  int32 accuracy;
20 
21  template<class Tscaler>
22  void CalcDemand(LinkGraphJob &job, Tscaler scaler);
23 };
24 
29 public:
30 
35  virtual void Run(LinkGraphJob &job) const { DemandCalculator c(job); }
36 
40  virtual ~DemandHandler() {}
41 };
42 
43 #endif /* DEMANDS_H */
virtual ~DemandHandler()
Virtual destructor has to be defined because of virtual Run().
Definition: demands.h:40
void CalcDemand(LinkGraphJob &job, Tscaler scaler)
Do the actual demand calculation, called from constructor.
Definition: demands.cpp:165
int32 mod_dist
Distance modifier, determines how much demands decrease with distance.
Definition: demands.h:18
DemandCalculator(LinkGraphJob &job)
Create the DemandCalculator and immediately do the calculation.
Definition: demands.cpp:259
int32 max_distance
Maximum distance possible on the map.
Definition: demands.h:17
virtual void Run(LinkGraphJob &job) const
Call the demand calculator on the given component.
Definition: demands.h:35
int32 accuracy
Accuracy of the calculation.
Definition: demands.h:19
A handler doing "something" on a link graph component.
Stateless, thread safe demand hander.
Definition: demands.h:28
Some typedefs for component handlers.
Calculate the demands.
Definition: demands.h:12
Class for calculation jobs to be run on link graphs.
Definition: linkgraphjob.h:31