OpenTTD Source 20241224-master-gf74b0cf984
|
Functions related to subsidies. More...
#include "core/geometry_type.hpp"
#include "station_type.h"
#include "company_type.h"
#include "cargo_type.h"
#include "news_type.h"
#include "subsidy_base.h"
Go to the source code of this file.
Functions | |
std::pair< NewsReferenceType, NewsReferenceType > | SetupSubsidyDecodeParam (const struct Subsidy *s, SubsidyDecodeParamType mode, uint parameter_offset=0) |
void | DeleteSubsidyWith (SourceType type, SourceID index) |
Delete the subsidies associated with a given cargo source type and id. | |
bool | CheckSubsidised (CargoID cargo_type, CompanyID company, SourceType src_type, SourceID src, const Station *st) |
Tests whether given delivery is subsidised and possibly awards the subsidy to delivering company. | |
void | RebuildSubsidisedSourceAndDestinationCache () |
Perform a full rebuild of the subsidies cache. | |
Functions related to subsidies.
Definition in file subsidy_func.h.
bool CheckSubsidised | ( | CargoID | cargo_type, |
CompanyID | company, | ||
SourceType | src_type, | ||
SourceID | src, | ||
const Station * | st | ||
) |
Tests whether given delivery is subsidised and possibly awards the subsidy to delivering company.
cargo_type | type of cargo |
company | company delivering the cargo |
src_type | type of src |
src | index of source |
st | station where the cargo is delivered to |
Definition at line 564 of file subsidy.cpp.
References Town::cache, Station::catchment_tiles, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), include(), Station::industries_near, Industry, INVALID_SOURCE, INVALID_TILE, IsTileType(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_subsidy_pool >::Iterate(), MP_HOUSE, TownCache::part_of_subsidy, POS_DST, POS_SRC, BaseStation::rect, and Town.
Referenced by DeliverGoods().
void DeleteSubsidyWith | ( | SourceType | type, |
SourceID | index | ||
) |
Delete the subsidies associated with a given cargo source type and id.
type | Cargo source type of the id. |
index | Id to remove. |
Definition at line 151 of file subsidy.cpp.
References InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_subsidy_pool >::Iterate(), RebuildSubsidisedSourceAndDestinationCache(), and WC_SUBSIDIES_LIST.
Referenced by Town::~Town().
void RebuildSubsidisedSourceAndDestinationCache | ( | ) |
Perform a full rebuild of the subsidies cache.
Definition at line 134 of file subsidy.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_subsidy_pool >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::Iterate(), POS_DST, POS_NONE, POS_SRC, and SetPartOfSubsidyFlag().
Referenced by ChangeOwnershipOfCompanyItems(), CheckCaches(), DeleteSubsidyWith(), and InitializeWindowsAndCaches().