summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_subsidy.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-08-08 16:53:22 +0000
committersmatz <smatz@openttd.org>2009-08-08 16:53:22 +0000
commitb43fd7266e2cc66028a7d15a1cee75bf89f6988e (patch)
tree26fb37af2c6fed35dc5fe1bdadc05679715ce917 /src/ai/api/ai_subsidy.cpp
parentab9c71f0d95da7b9eef0271484ee4b7a93c4c376 (diff)
downloadopenttd-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.cpp')
-rw-r--r--src/ai/api/ai_subsidy.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/ai/api/ai_subsidy.cpp b/src/ai/api/ai_subsidy.cpp
index 39358e963..df6889ac7 100644
--- a/src/ai/api/ai_subsidy.cpp
+++ b/src/ai/api/ai_subsidy.cpp
@@ -52,6 +52,7 @@
/* static */ bool AISubsidy::SourceIsTown(SubsidyID subsidy_id)
{
+ AILog::Warning("AISubsidy::SourceIsTown is deprecated and will be removed soon, please use AISubsidy::GetSourceType instead.");
if (!IsValidSubsidy(subsidy_id) || IsAwarded(subsidy_id)) return false;
return ::Subsidy::Get(subsidy_id)->src_type == ST_TOWN;
@@ -59,6 +60,7 @@
/* static */ int32 AISubsidy::GetSource(SubsidyID subsidy_id)
{
+ AILog::Warning("AISubsidy::GetSource is deprecated and will be removed soon, please use AISubsidy::GetSourceIndex instead.");
if (!IsValidSubsidy(subsidy_id)) return INVALID_STATION;
if (IsAwarded(subsidy_id)) {
@@ -69,8 +71,23 @@
return ::Subsidy::Get(subsidy_id)->src;
}
+/* static */ AISubsidy::SubsidyParticipantType AISubsidy::GetSourceType(SubsidyID subsidy_id)
+{
+ if (!IsValidSubsidy(subsidy_id)) return SPT_INVALID;
+
+ return (SubsidyParticipantType)(uint)::Subsidy::Get(subsidy_id)->src_type;
+}
+
+/* static */ int32 AISubsidy::GetSourceIndex(SubsidyID subsidy_id)
+{
+ if (!IsValidSubsidy(subsidy_id)) return INVALID_STATION;
+
+ return ::Subsidy::Get(subsidy_id)->src;
+}
+
/* static */ bool AISubsidy::DestinationIsTown(SubsidyID subsidy_id)
{
+ AILog::Warning("AISubsidy::DestinationIsTown is deprecated and will be removed soon, please use AISubsidy::GetDestinationType instead.");
if (!IsValidSubsidy(subsidy_id) || IsAwarded(subsidy_id)) return false;
return ::Subsidy::Get(subsidy_id)->dst_type == ST_TOWN;
@@ -78,6 +95,7 @@
/* static */ int32 AISubsidy::GetDestination(SubsidyID subsidy_id)
{
+ AILog::Warning("AISubsidy::GetDestination is deprecated and will be removed soon, please use AISubsidy::GetDestinationIndex instead.");
if (!IsValidSubsidy(subsidy_id)) return INVALID_STATION;
if (IsAwarded(subsidy_id)) {
@@ -87,3 +105,17 @@
return ::Subsidy::Get(subsidy_id)->dst;
}
+
+/* static */ AISubsidy::SubsidyParticipantType AISubsidy::GetDestinationType(SubsidyID subsidy_id)
+{
+ if (!IsValidSubsidy(subsidy_id)) return SPT_INVALID;
+
+ return (SubsidyParticipantType)(uint)::Subsidy::Get(subsidy_id)->dst_type;
+}
+
+/* static */ int32 AISubsidy::GetDestinationIndex(SubsidyID subsidy_id)
+{
+ if (!IsValidSubsidy(subsidy_id)) return INVALID_STATION;
+
+ return ::Subsidy::Get(subsidy_id)->dst;
+}