Feature: Configurable subsidy duration

(cherry picked from commit d09210e1c6)
This commit is contained in:
Tyler Trahan
2021-04-22 13:54:32 -04:00
committed by Jonathan G Rennison
parent 4042480806
commit fb0549ea59
11 changed files with 71 additions and 29 deletions

View File

@@ -21,7 +21,7 @@ extern SubsidyPool _subsidy_pool;
/** Struct about subsidies, offered and awarded */
struct Subsidy : SubsidyPool::PoolItem<&_subsidy_pool> {
CargoID cargo_type; ///< Cargo type involved in this subsidy, CT_INVALID for invalid subsidy
byte remaining; ///< Remaining months when this subsidy is valid
uint16 remaining; ///< Remaining months when this subsidy is valid
CompanyID awarded; ///< Subsidy is awarded to this company; INVALID_COMPANY if it's not awarded to anyone
SourceType src_type; ///< Source of subsidised path (ST_INDUSTRY or ST_TOWN)
SourceType dst_type; ///< Destination of subsidised path (ST_INDUSTRY or ST_TOWN)
@@ -52,11 +52,18 @@ struct Subsidy : SubsidyPool::PoolItem<&_subsidy_pool> {
/** Constants related to subsidies */
static const uint SUBSIDY_OFFER_MONTHS = 12; ///< Duration of subsidy offer
static const uint SUBSIDY_CONTRACT_MONTHS = 12; ///< Duration of subsidy after awarding
static const uint SUBSIDY_PAX_MIN_POPULATION = 400; ///< Min. population of towns for subsidised pax route
static const uint SUBSIDY_CARGO_MIN_POPULATION = 900; ///< Min. population of destination town for cargo route
static const uint SUBSIDY_MAX_PCT_TRANSPORTED = 42; ///< Subsidy will be created only for towns/industries with less % transported
static const uint SUBSIDY_MAX_DISTANCE = 70; ///< Max. length of subsidised route (DistanceManhattan)
static const uint SUBSIDY_TOWN_CARGO_RADIUS = 6; ///< Extent of a tile area around town center when scanning for town cargo acceptance and production (6 ~= min catchmement + min station / 2)
/** Types of subsidy news messages, which determine how the date is printed and whether to use singular or plural cargo names */
enum class SubsidyDecodeParamType {
NewsOffered = 0, ///< News item for an offered subsidy
NewsAwarded = 1, ///< News item for an awarded subsidy
NewsWithdrawn = 2, ///< News item for a subsidy offer withdrawn, or expired subsidy
Gui = 3, ///< Subsidies listed in the Subsidy GUI
};
#endif /* SUBSIDY_BASE_H */