|
OpenTTD Source 20260208-master-g43af8e94d0
|
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 266 of file demands.cpp.
References accuracy, base_distance, LinkGraphJob::Cargo(), DistanceMaxPlusManhattan(), IntSqrt(), mod_dist, LinkGraphJob::Settings(), settings, and TileXY().
|
private |
Do the actual demand calculation, called from constructor.
| job | Job to calculate the demands for. |
| scaler | Scaler to be used for scaling demands. |
Definition at line 169 of file demands.cpp.
References accuracy, base_distance, DistanceMaxPlusManhattan(), mod_dist, and LinkGraphJob::Size().
|
private |
Accuracy of the calculation.
Definition at line 26 of file demands.h.
Referenced by CalcDemand(), and DemandCalculator().
|
private |
Base distance for scaling purposes.
Definition at line 24 of file demands.h.
Referenced by CalcDemand(), and DemandCalculator().
|
private |
Distance modifier, determines how much demands decrease with distance.
Definition at line 25 of file demands.h.
Referenced by CalcDemand(), and DemandCalculator().