Public Member Functions | Data Fields

# Subsidy Struct Reference

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

`#include <subsidy_base.h>`

Inheritance diagram for Subsidy:

## Public Member Functions
| Subsidy ()
| We need an (empty) constructor so struct isn't zeroed (as C++ standard states).
| ~Subsidy ()
| (Empty) destructor has to be defined else operator delete might be called with NULL parameter
bool | IsAwarded () const
| Tests whether this subsidy has been awarded to someone.
void | AwardTo (CompanyID company)
| Marks subsidy as awarded, creates news and AI event.
## Data Fields
CargoID | cargo_type
| Cargo type involved in this subsidy, CT_INVALID for invalid subsidy.
byte | remaining
| Remaining months when this subsidy is valid.
CompanyByte | awarded
| Subsidy is awarded to this company; INVALID_COMPANY if it's not awarded to anyone.
SourceTypeByte | src_type
| Source of subsidised path (ST_INDUSTRY or ST_TOWN).
SourceTypeByte | dst_type
| Destination of subsidised path (ST_INDUSTRY or ST_TOWN).
SourceID | src
| Index of source. Either TownID or IndustryID.
SourceID | dst
| Index of destination. Either TownID or IndustryID.

## Detailed Description

Struct about subsidies, offered and awarded.

Definition at line 24 of file subsidy_base.h.

## Member Function Documentation

void Subsidy::AwardTo | ( | CompanyID | company | ) |

Marks subsidy as awarded, creates news and AI event.

Parameters:

  | company | awarded company

Definition at line 37 of file subsidy.cpp.

References _settings_game, AddNewsItem(), AI::BroadcastNewEvent(), GameSettings::difficulty, InjectDParam(), InvalidateWindowData(), lastof, MAX_CHAR_LENGTH, MAX_LENGTH_COMPANY_NAME_CHARS, Game::NewEvent(), NF_NORMAL, NT_SUBSIDIES, SetDParam(), SetDParamStr(), SetupSubsidyDecodeParam(), SUBSIDY_CONTRACT_MONTHS, DifficultySettings::subsidy_multiplier, and WC_SUBSIDIES_LIST.

Referenced by CheckSubsidised().

bool Subsidy::IsAwarded | ( |  | ) | const`[inline]`

Tests whether this subsidy has been awarded to someone.

Returns:
  is this subsidy awarded?

Definition at line 47 of file subsidy_base.h.

References awarded.

Referenced by CheckSubsidised(), SubsidyListWindow::CountLines(), SubsidyListWindow::DrawWidget(), SubsidyListWindow::OnClick(), and SubsidyMonthlyLoop().

The documentation for this struct was generated from the following files:

- src/subsidy_base.h
- src/subsidy.cpp