AISubsidy Class Reference
Class that handles all subsidy related functions.
More...
Detailed Description
Class that handles all subsidy related functions.
Member Function Documentation
static bool AISubsidy::DestinationIsTown |
( |
SubsidyID |
subsidy_id |
) |
[static] |
Is the destination of the subsidy a town or an industry.
- Parameters:
-
| subsidy_id | The SubsidyID to check. |
- Precondition:
- IsValidSubsidy(subsidy_id) && !IsAwarded(subsidy_id).
- Returns:
- True if the destination is a town, false if it is an industry.
Get the company index of the company this subsidy is awarded to.
- Parameters:
-
| subsidy_id | The SubsidyID to check. |
- Precondition:
- IsAwarded(subsidy_id).
- Returns:
- The companyindex of the company this subsidy is awarded to.
Get the cargo type that has to be transported in order to be awarded this subsidy.
- Parameters:
-
| subsidy_id | The SubsidyID to check. |
- Precondition:
- IsValidSubsidy(subsidy_id).
- Returns:
- The cargo type to transport.
static 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.
- Parameters:
-
| subsidy_id | the SubsidyID to check. |
- Precondition:
- IsValidSubsidy(subsidy_id).
- Returns:
- One of TownID/IndustryID/StationID.
static 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.
- Parameters:
-
| subsidy_id | The SubsidyID to check. |
- Precondition:
- IsValidSubsidy(subsidy_id).
- Returns:
- The last valid date of this subsidy.
- Note:
- The return value of this function will change if the subsidy is awarded.
static 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.
- Parameters:
-
| subsidy_id | The SubsidyID to check. |
- Precondition:
- IsValidSubsidy(subsidy_id).
- Returns:
- One of TownID/IndustryID/StationID.
static bool AISubsidy::IsAwarded |
( |
SubsidyID |
subsidy_id |
) |
[static] |
Checks whether this subsidy is already awarded to some company.
- Parameters:
-
| subsidy_id | The SubsidyID to check. |
- Precondition:
- IsValidSubsidy(subsidy).
- Returns:
- True if and only if this subsidy is already awarded.
static bool AISubsidy::IsValidSubsidy |
( |
SubsidyID |
subsidy_id |
) |
[static] |
Check whether this is a valid SubsidyID.
- Parameters:
-
| subsidy_id | The SubsidyID to check. |
- Returns:
- True if and only if this subsidy is still valid.
static bool AISubsidy::SourceIsTown |
( |
SubsidyID |
subsidy_id |
) |
[static] |
Is the source of the subsidy a town or an industry.
- Parameters:
-
| subsidy_id | The SubsidyID to check. |
- Precondition:
- IsValidSubsidy(subsidy_id) && !IsAwarded(subsidy_id).
- Returns:
- True if the source is a town, false if it is an industry.