Files
@ r27835:eabfaa878ced
Branch filter:
Location: cpp/openttd-patchpack/source/src/linkgraph/demands.h - annotation
r27835:eabfaa878ced
1.1 KiB
text/x-c
Add: calendar date for Survey results
This means no heuristics is possible on around which date people
play the game.
This means no heuristics is possible on around which date people
play the game.
r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r27737:728d55b97775 r27737:728d55b97775 r27737:728d55b97775 r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r23838:bfeaabaa7b1d r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r23023:7b8669afd1db r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f r27372:06d384d76bd2 r20342:25da7cb85f9f r20342:25da7cb85f9f r20342:25da7cb85f9f | /** @file demands.h Declaration of demand calculating link graph handler. */
#ifndef DEMANDS_H
#define DEMANDS_H
#include "linkgraphjob_base.h"
/**
* Calculate the demands. This class has a state, but is recreated for each
* call to of DemandHandler::Run.
*/
class DemandCalculator {
public:
DemandCalculator(LinkGraphJob &job);
private:
int32_t max_distance; ///< Maximum distance possible on the map.
int32_t mod_dist; ///< Distance modifier, determines how much demands decrease with distance.
int32_t accuracy; ///< Accuracy of the calculation.
template<class Tscaler>
void CalcDemand(LinkGraphJob &job, Tscaler scaler);
};
/**
* Stateless, thread safe demand handler. Doesn't do anything but call DemandCalculator.
*/
class DemandHandler : public ComponentHandler {
public:
/**
* Call the demand calculator on the given component.
* @param job Component to calculate the demands for.
*/
virtual void Run(LinkGraphJob &job) const { DemandCalculator c(job); }
/**
* Virtual destructor has to be defined because of virtual Run().
*/
virtual ~DemandHandler() = default;
};
#endif /* DEMANDS_H */
|