OpenTTD Source: src/subsidy_func.h File Reference

OpenTTD Source 15.3

Functions
subsidy_func.h File Reference

Functions related to subsidies. More...

`#include "source_type.h"`
`#include "station_type.h"`
`#include "company_type.h"`
`#include "cargo_type.h"`

Go to the source code of this file.

## Functions
void | DeleteSubsidyWith (Source src)
| Delete the subsidies associated with a given cargo source type and id.
bool | CheckSubsidised (CargoType cargo_type, CompanyID company, Source 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.

## Detailed Description

Functions related to subsidies.

Definition in file subsidy_func.h.

## Function Documentation

## ◆ CheckSubsidised()

bool CheckSubsidised | ( | CargoType | cargo_type,
|  | CompanyID | company,
|  | Source | 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 | source of cargo
  st | station where the cargo is delivered to

Returns
  is the delivery subsidised?

Definition at line 507 of file subsidy.cpp.

References Town::cache, Station::catchment_tiles, Destination, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_town_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_industry_pool >::Get(), include(), Station::industries_near, Industry, INVALID_TILE, IsTileType(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_subsidy_pool >::Iterate(), MP_HOUSE, TownCache::part_of_subsidy, BaseStation::rect, Source, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Town, and Source::type.

Referenced by DeliverGoods().

## ◆ DeleteSubsidyWith()

void DeleteSubsidyWith | ( | Source | source | ) |

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

Parameters

  source | The source to look for.

Definition at line 119 of file subsidy.cpp.

References InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_subsidy_pool >::Iterate(), RebuildSubsidisedSourceAndDestinationCache(), and WC_SUBSIDIES_LIST.

Referenced by Town::~Town().

## ◆ RebuildSubsidisedSourceAndDestinationCache()

void RebuildSubsidisedSourceAndDestinationCache | ( |  | ) |

Perform a full rebuild of the subsidies cache.

Definition at line 103 of file subsidy.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_town_pool >::Iterate().

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