diff options
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/api/ai_subsidy.cpp | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/ai/api/ai_subsidy.cpp b/src/ai/api/ai_subsidy.cpp index 6e43982c3..fd3e29745 100644 --- a/src/ai/api/ai_subsidy.cpp +++ b/src/ai/api/ai_subsidy.cpp @@ -10,21 +10,21 @@ /* static */ bool AISubsidy::IsValidSubsidy(SubsidyID subsidy_id) { - return Subsidy::IsValidID(subsidy_id); + return ::Subsidy::IsValidID(subsidy_id); } /* static */ bool AISubsidy::IsAwarded(SubsidyID subsidy_id) { if (!IsValidSubsidy(subsidy_id)) return false; - return Subsidy::Get(subsidy_id)->IsAwarded(); + return ::Subsidy::Get(subsidy_id)->IsAwarded(); } /* static */ AICompany::CompanyID AISubsidy::GetAwardedTo(SubsidyID subsidy_id) { if (!IsAwarded(subsidy_id)) return AICompany::COMPANY_INVALID; - return (AICompany::CompanyID)((byte)Station::Get(Subsidy::Get(subsidy_id)->from)->owner); + return (AICompany::CompanyID)((byte)::Station::Get(::Subsidy::Get(subsidy_id)->src)->owner); } /* static */ int32 AISubsidy::GetExpireDate(SubsidyID subsidy_id) @@ -35,9 +35,9 @@ int month = AIDate::GetMonth(AIDate::GetCurrentDate()); if (IsAwarded(subsidy_id)) { - month += 24 - Subsidy::Get(subsidy_id)->age; + month += 24 - ::Subsidy::Get(subsidy_id)->age; } else { - month += 12 - Subsidy::Get(subsidy_id)->age; + month += 12 - ::Subsidy::Get(subsidy_id)->age; } year += (month - 1) / 12; @@ -50,42 +50,33 @@ { if (!IsValidSubsidy(subsidy_id)) return CT_INVALID; - return Subsidy::Get(subsidy_id)->cargo_type; + return ::Subsidy::Get(subsidy_id)->cargo_type; } /* static */ bool AISubsidy::SourceIsTown(SubsidyID subsidy_id) { if (!IsValidSubsidy(subsidy_id) || IsAwarded(subsidy_id)) return false; - return CargoSpec::Get(GetCargoType(subsidy_id))->town_effect == TE_PASSENGERS || - CargoSpec::Get(GetCargoType(subsidy_id))->town_effect == TE_MAIL; + return ::Subsidy::Get(subsidy_id)->src_type == ST_TOWN; } /* static */ int32 AISubsidy::GetSource(SubsidyID subsidy_id) { if (!IsValidSubsidy(subsidy_id)) return INVALID_STATION; - return Subsidy::Get(subsidy_id)->from; + return ::Subsidy::Get(subsidy_id)->src; } /* static */ bool AISubsidy::DestinationIsTown(SubsidyID subsidy_id) { if (!IsValidSubsidy(subsidy_id) || IsAwarded(subsidy_id)) return false; - switch (CargoSpec::Get(GetCargoType(subsidy_id))->town_effect) { - case TE_PASSENGERS: - case TE_MAIL: - case TE_GOODS: - case TE_FOOD: - return true; - default: - return false; - } + return ::Subsidy::Get(subsidy_id)->dst_type == ST_TOWN; } /* static */ int32 AISubsidy::GetDestination(SubsidyID subsidy_id) { if (!IsValidSubsidy(subsidy_id)) return INVALID_STATION; - return Subsidy::Get(subsidy_id)->to; + return ::Subsidy::Get(subsidy_id)->dst; } |