diff options
author | smatz <smatz@openttd.org> | 2009-08-08 16:53:22 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-08-08 16:53:22 +0000 |
commit | b43fd7266e2cc66028a7d15a1cee75bf89f6988e (patch) | |
tree | 26fb37af2c6fed35dc5fe1bdadc05679715ce917 /src/ai/api/ai_subsidy.hpp | |
parent | ab9c71f0d95da7b9eef0271484ee4b7a93c4c376 (diff) | |
download | openttd-b43fd7266e2cc66028a7d15a1cee75bf89f6988e.tar.xz |
(svn r17115) -Add [NoAI]: AISubsidy::SubsidyParticipantType, AISubsidy::GetSourceType, AISubsidy::GetSourceIndex, AISubsidy::GetDestinationType, AISubsidy::GetDestinationIndex for better subsidy management
-Change [NoAI]: mark AISubsidy::SourceIsTown, AISubsidy::GetSource, AISubsidy::GetDestinationType, AISubsidy::GetDestination as deprecated
Diffstat (limited to 'src/ai/api/ai_subsidy.hpp')
-rw-r--r-- | src/ai/api/ai_subsidy.hpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/ai/api/ai_subsidy.hpp b/src/ai/api/ai_subsidy.hpp index 96ad92c31..b4d190bbf 100644 --- a/src/ai/api/ai_subsidy.hpp +++ b/src/ai/api/ai_subsidy.hpp @@ -16,6 +16,16 @@ public: static const char *GetClassName() { return "AISubsidy"; } /** + * Enumeration for source and destination of a subsidy. + * @note The list of values may grow in future. + */ + enum SubsidyParticipantType { + SPT_INDUSTRY = 0, //!< Subsidy participant is an industry + SPT_TOWN = 1, //!< Subsidy participant is a town + SPT_INVALID = 0xFF, //!< Invalid/unknown participant type + }; + + /** * Check whether this is a valid SubsidyID. * @param subsidy_id The SubsidyID to check. * @return True if and only if this subsidy is still valid. @@ -64,6 +74,7 @@ public: * @param subsidy_id The SubsidyID to check. * @pre IsValidSubsidy(subsidy_id) && !IsAwarded(subsidy_id). * @return True if the source is a town, false if it is an industry. + * @deprecated Use GetSourceType() instead. */ static bool SourceIsTown(SubsidyID subsidy_id); @@ -75,14 +86,34 @@ public: * @param subsidy_id The SubsidyID to check. * @pre IsValidSubsidy(subsidy_id). * @return One of TownID/IndustryID/INVALID_STATION. + * @deprecated Use GetSourceIndex() instead. */ static int32 GetSource(SubsidyID subsidy_id); /** + * Returns the type of source of subsidy. + * @param subsidy_id The SubsidyID to check. + * @pre IsValidSubsidy(subsidy_id). + * @return Type of source of subsidy. + */ + static SubsidyParticipantType GetSourceType(SubsidyID subsidy_id); + + /** + * Return the source IndustryID/TownID the subsidy is for. + * \li GetSourceType(subsidy_id) == SPT_INDUSTRY -> return the IndustryID. + * \li GetSourceType(subsidy_id) == SPT_TOWN -> return the TownID. + * @param subsidy_id The SubsidyID to check. + * @pre IsValidSubsidy(subsidy_id). + * @return One of TownID/IndustryID. + */ + static int32 GetSourceIndex(SubsidyID subsidy_id); + + /** * Is the destination of the subsidy a town or an industry. * @param subsidy_id The SubsidyID to check. * @pre IsValidSubsidy(subsidy_id) && !IsAwarded(subsidy_id). * @return True if the destination is a town, false if it is an industry. + * @deprecated Use GetDestinationType() instead. */ static bool DestinationIsTown(SubsidyID subsidy_id); @@ -94,8 +125,27 @@ public: * @param subsidy_id the SubsidyID to check. * @pre IsValidSubsidy(subsidy_id). * @return One of TownID/IndustryID/INVALID_STATION. + * @deprecated Use GetDestinationIndex() instead. */ static int32 GetDestination(SubsidyID subsidy_id); + + /** + * Returns the type of destination of subsidy. + * @param subsidy_id The SubsidyID to check. + * @pre IsValidSubsidy(subsidy_id). + * @return Type of destination of subsidy. + */ + static SubsidyParticipantType GetDestinationType(SubsidyID subsidy_id); + + /** + * Return the destination IndustryID/TownID the subsidy is for. + * \li GetDestinationType(subsidy_id) == SPT_INDUSTRY -> return the IndustryID. + * \li GetDestinationType(subsidy_id) == SPT_TOWN -> return the TownID. + * @param subsidy_id the SubsidyID to check. + * @pre IsValidSubsidy(subsidy_id). + * @return One of TownID/IndustryID. + */ + static int32 GetDestinationIndex(SubsidyID subsidy_id); }; #endif /* AI_SUBSIDY_HPP */ |