# Subsidy Struct Reference

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

`#include <subsidy_base.h>`

Inheritance diagram for Subsidy:

## Public Member Functions
FORCEINLINE | Subsidy ()
| We need an (empty) constructor so struct isn't zeroed (as C++ standard states).
FORCEINLINE | ~Subsidy ()
| (Empty) destructor has to be defined else operator delete might be called with NULL parameter
FORCEINLINE 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

FORCEINLINE 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, and INVALID_COMPANY.

Referenced by CheckSubsidised().

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

Marks subsidy as awarded, creates news and AI event.

Parameters:

  | company | awarded company

Definition at line 36 of file subsidy.cpp.

References _settings_game, Pair::a, AddNewsItem(), Pair::b, GameSettings::difficulty, InjectDParam(), InvalidateWindowData(), MAX_LENGTH_COMPANY_NAME_BYTES, NS_SUBSIDIES, SetDParam(), SetDParamStr(), SUBSIDY_CONTRACT_MONTHS, and DifficultySettings::subsidy_multiplier.

Referenced by CheckSubsidised().

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

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