Functions

# subsidy_func.h File Reference

Functions related to subsidies. More...

`#include "core/geometry_type.hpp"`
`#include "station_type.h"`
`#include "company_type.h"`
`#include "cargo_type.h"`

Go to the source code of this file.

## Functions
Pair | SetupSubsidyDecodeParam (const struct Subsidy *s, bool mode)
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.
void | DeleteSubsidy (struct Subsidy *s)

## Detailed Description

Functions related to subsidies.

Definition in file subsidy_func.h.

## Function Documentation

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.

Parameters:

  | 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

Returns:
  is the delivery subsidised?

Definition at line 525 of file subsidy.cpp.

References Subsidy::awarded, Subsidy::AwardTo(), SmallVector< T, S >::Begin(), Subsidy::cargo_type, Subsidy::dst, Subsidy::dst_type, SmallVector< T, S >::End(), 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(), Station::GetCatchmentRect(), SmallVector< T, S >::Include(), Station::industries_near, INVALID_SOURCE, Subsidy::IsAwarded(), IsTileType(), MP_HOUSE, Town::part_of_subsidy, POS_DST, POS_SRC, BaseStation::rect, Subsidy::src, Subsidy::src_type, ST_INDUSTRY, ST_TOWN, and TileXY().

Referenced by DeliverGoods().

void DeleteSubsidyWith | ( | SourceType | type,
|  | SourceID | index |
| ) |  |  |

Delete the subsidies associated with a given cargo source type and id.

Parameters:

  | type | Cargo source type of the id.
  | index | Id to remove.

Definition at line 150 of file subsidy.cpp.

References Subsidy::dst, Subsidy::dst_type, InvalidateWindowData(), RebuildSubsidisedSourceAndDestinationCache(), Subsidy::src, Subsidy::src_type, and WC_SUBSIDIES_LIST.

Referenced by Town::~Town().

void RebuildSubsidisedSourceAndDestinationCache | ( |  | ) |

Perform a full rebuild of the subsidies cache.

Definition at line 130 of file subsidy.cpp.

References Subsidy::dst, Subsidy::dst_type, Industry::part_of_subsidy, Town::part_of_subsidy, POS_DST, POS_SRC, SetPartOfSubsidyFlag(), Subsidy::src, and Subsidy::src_type.

Referenced by ChangeOwnershipOfCompanyItems(), DeleteSubsidyWith(), InitializeWindowsAndCaches(), and SubsidyMonthlyLoop().