OpenTTD Source 20250205-master-gfd85ab1e2c
subsidy_base.h File Reference

Subsidy base class. More...

#include "cargo_type.h"
#include "company_type.h"
#include "subsidy_type.h"
#include "core/pool_type.hpp"

Go to the source code of this file.

Data Structures

struct  Subsidy
 Struct about subsidies, offered and awarded. More...
 

Typedefs

typedef Pool< Subsidy, SubsidyID, 1, 256 > SubsidyPool
 

Enumerations

enum class  SubsidyDecodeParamType : uint8_t { NewsOffered = 0 , NewsAwarded = 1 , NewsWithdrawn = 2 , Gui = 3 }
 Types of subsidy news messages, which determine how the date is printed and whether to use singular or plural cargo names. More...
 

Variables

SubsidyPool _subsidy_pool
 
static const uint SUBSIDY_OFFER_MONTHS = 12
 Constants related to subsidies.
 
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)
 

Detailed Description

Subsidy base class.

Definition in file subsidy_base.h.

Typedef Documentation

◆ SubsidyPool

typedef Pool<Subsidy, SubsidyID, 1, 256> SubsidyPool

Definition at line 18 of file subsidy_base.h.

Enumeration Type Documentation

◆ SubsidyDecodeParamType

enum class SubsidyDecodeParamType : uint8_t
strong

Types of subsidy news messages, which determine how the date is printed and whether to use singular or plural cargo names.

Enumerator
NewsOffered 

News item for an offered subsidy.

NewsAwarded 

News item for an awarded subsidy.

NewsWithdrawn 

News item for a subsidy offer withdrawn, or expired subsidy.

Gui 

Subsidies listed in the Subsidy GUI.

Definition at line 62 of file subsidy_base.h.

Variable Documentation

◆ SUBSIDY_CARGO_MIN_POPULATION

const uint SUBSIDY_CARGO_MIN_POPULATION = 900
static

Min. population of destination town for cargo route.

Definition at line 56 of file subsidy_base.h.

Referenced by FindSubsidyTownCargoRoute().

◆ SUBSIDY_MAX_DISTANCE

const uint SUBSIDY_MAX_DISTANCE = 70
static

Max. length of subsidised route (DistanceManhattan)

Definition at line 58 of file subsidy_base.h.

Referenced by CheckSubsidyDistance(), and FindSubsidyPassengerRoute().

◆ SUBSIDY_MAX_PCT_TRANSPORTED

const uint SUBSIDY_MAX_PCT_TRANSPORTED = 42
static

Subsidy will be created only for towns/industries with less % transported.

Definition at line 57 of file subsidy_base.h.

Referenced by FindSubsidyIndustryCargoRoute(), FindSubsidyPassengerRoute(), and FindSubsidyTownCargoRoute().

◆ SUBSIDY_OFFER_MONTHS

const uint SUBSIDY_OFFER_MONTHS = 12
static

Constants related to subsidies.

Duration of subsidy offer

Definition at line 54 of file subsidy_base.h.

Referenced by CreateSubsidy().

◆ SUBSIDY_PAX_MIN_POPULATION

const uint SUBSIDY_PAX_MIN_POPULATION = 400
static

Min. population of towns for subsidised pax route.

Definition at line 55 of file subsidy_base.h.

Referenced by FindSubsidyPassengerRoute().

◆ SUBSIDY_TOWN_CARGO_RADIUS

const uint SUBSIDY_TOWN_CARGO_RADIUS = 6
static

Extent of a tile area around town center when scanning for town cargo acceptance and production (6 ~= min catchmement + min station / 2)

Definition at line 59 of file subsidy_base.h.

Referenced by FindSubsidyCargoDestination(), and FindSubsidyTownCargoRoute().