#include <ai_subsidy.hpp>

Static Public Member Functions | |
| static const char * | GetClassName () |
| static bool | IsValidSubsidy (SubsidyID subsidy_id) |
| Check whether this is a valid SubsidyID. | |
| static bool | IsAwarded (SubsidyID subsidy_id) |
| Checks whether this subsidy is already awarded to some company. | |
| static AICompany::CompanyID | GetAwardedTo (SubsidyID subsidy_id) |
| Get the company index of the company this subsidy is awarded to. | |
| static int32 | GetExpireDate (SubsidyID subsidy_id) |
| Get the date this subsidy expires. | |
| static CargoID | GetCargoType (SubsidyID subsidy_id) |
| Get the cargo type that has to be transported in order to be awarded this subsidy. | |
| static bool | SourceIsTown (SubsidyID subsidy_id) |
| Is the source of the subsidy a town or an industry. | |
| static int32 | GetSource (SubsidyID subsidy_id) |
| Return the source TownID/IndustryID/StationID the subsidy is for. | |
| static bool | DestinationIsTown (SubsidyID subsidy_id) |
| Is the destination of the subsidy a town or an industry. | |
| static int32 | GetDestination (SubsidyID subsidy_id) |
| Return the destination TownID/IndustryID/StationID the subsidy is for. | |
Definition at line 14 of file ai_subsidy.hpp.
| bool AISubsidy::IsValidSubsidy | ( | SubsidyID | subsidy_id | ) | [static] |
Check whether this is a valid SubsidyID.
| subsidy_id | The SubsidyID to check. |
Definition at line 11 of file ai_subsidy.cpp.
References lengthof.
Referenced by DestinationIsTown(), GetCargoType(), GetDestination(), GetExpireDate(), GetSource(), IsAwarded(), and SourceIsTown().
| bool AISubsidy::IsAwarded | ( | SubsidyID | subsidy_id | ) | [static] |
Checks whether this subsidy is already awarded to some company.
| subsidy_id | The SubsidyID to check. |
Definition at line 16 of file ai_subsidy.cpp.
References IsValidSubsidy().
Referenced by DestinationIsTown(), GetAwardedTo(), GetExpireDate(), and SourceIsTown().
| AICompany::CompanyID AISubsidy::GetAwardedTo | ( | SubsidyID | subsidy_id | ) | [static] |
Get the company index of the company this subsidy is awarded to.
| subsidy_id | The SubsidyID to check. |
Definition at line 23 of file ai_subsidy.cpp.
References AICompany::COMPANY_INVALID, and IsAwarded().
| int32 AISubsidy::GetExpireDate | ( | SubsidyID | subsidy_id | ) | [static] |
Get the date this subsidy expires.
In case the subsidy is already awarded, return the date the subsidy expires, else, return the date the offer expires.
| subsidy_id | The SubsidyID to check. |
Definition at line 30 of file ai_subsidy.cpp.
References AIDate::GetCurrentDate(), AIDate::GetDate(), AIDate::GetMonth(), AIDate::GetYear(), IsAwarded(), and IsValidSubsidy().
Get the cargo type that has to be transported in order to be awarded this subsidy.
| subsidy_id | The SubsidyID to check. |
Definition at line 49 of file ai_subsidy.cpp.
References IsValidSubsidy().
Referenced by DestinationIsTown(), and SourceIsTown().
| bool AISubsidy::SourceIsTown | ( | SubsidyID | subsidy_id | ) | [static] |
Is the source of the subsidy a town or an industry.
| subsidy_id | The SubsidyID to check. |
Definition at line 56 of file ai_subsidy.cpp.
References GetCargoType(), IsAwarded(), and IsValidSubsidy().
| int32 AISubsidy::GetSource | ( | SubsidyID | subsidy_id | ) | [static] |
Return the source TownID/IndustryID/StationID the subsidy is for.
1) IsAwarded(subsidy_id) -> return the StationID the subsidy is awarded to. 2) !IsAwarded(subsidy_id) && SourceIsTown(subsidy_id) -> return the TownID. 3) !IsAwarded(subsidy_id) && !SourceIsTown(subsidy_id) -> return the IndustryID.
| subsidy_id | The SubsidyID to check. |
Definition at line 64 of file ai_subsidy.cpp.
References IsValidSubsidy().
| bool AISubsidy::DestinationIsTown | ( | SubsidyID | subsidy_id | ) | [static] |
Is the destination of the subsidy a town or an industry.
| subsidy_id | The SubsidyID to check. |
Definition at line 71 of file ai_subsidy.cpp.
References GetCargoType(), IsAwarded(), and IsValidSubsidy().
| int32 AISubsidy::GetDestination | ( | SubsidyID | subsidy_id | ) | [static] |
Return the destination TownID/IndustryID/StationID the subsidy is for.
1) IsAwarded(subsidy_id) -> return the StationID the subsidy is awarded to. 2) !IsAwarded(subsidy_id) && SourceIsTown(subsidy_id) -> return the TownID. 3) !IsAwarded(subsidy_id) && !SourceIsTown(subsidy_id) -> return the IndustryID.
| subsidy_id | the SubsidyID to check. |
Definition at line 86 of file ai_subsidy.cpp.
References IsValidSubsidy().
1.5.6