OpenTTD Source 20241224-master-gee860a5c8e
|
Calculate the demands. More...
#include <demands.h>
Public Member Functions | |
DemandCalculator (LinkGraphJob &job) | |
Create the DemandCalculator and immediately do the calculation. | |
Private Member Functions | |
template<class Tscaler > | |
void | CalcDemand (LinkGraphJob &job, Tscaler scaler) |
Do the actual demand calculation, called from constructor. | |
Private Attributes | |
int32_t | base_distance |
Base distance for scaling purposes. | |
int32_t | mod_dist |
Distance modifier, determines how much demands decrease with distance. | |
int32_t | accuracy |
Accuracy of the calculation. | |
Calculate the demands.
This class has a state, but is recreated for each call to of DemandHandler::Run.
DemandCalculator::DemandCalculator | ( | LinkGraphJob & | job | ) |
Create the DemandCalculator and immediately do the calculation.
job | Job to calculate the demands for. |
Definition at line 262 of file demands.cpp.
References accuracy, LinkGraphSettings::accuracy, LinkGraphJob::Cargo(), LinkGraphSettings::demand_distance, DT_ASYMMETRIC, DT_SYMMETRIC, mod_dist, LinkGraphJob::Settings(), and settings.
|
private |
Do the actual demand calculation, called from constructor.
job | Job to calculate the demands for. |
Tscaler | Scaler to be used for scaling demands. |
Definition at line 165 of file demands.cpp.
References accuracy, base_distance, DistanceMaxPlusManhattan(), mod_dist, and LinkGraphJob::Size().
|
private |
Accuracy of the calculation.
Definition at line 19 of file demands.h.
Referenced by CalcDemand(), and DemandCalculator().
|
private |
Base distance for scaling purposes.
Definition at line 17 of file demands.h.
Referenced by CalcDemand().
|
private |
Distance modifier, determines how much demands decrease with distance.
Definition at line 18 of file demands.h.
Referenced by CalcDemand(), and DemandCalculator().