summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-08-18 18:51:42 +0000
committeryexo <yexo@openttd.org>2009-08-18 18:51:42 +0000
commit67106dc0633c50ef6545d0ab6253384b276ab40e (patch)
tree09964556afb30a650b4549b0a919ba38230e363a
parent58a0ff945c4025e20e30868c8774c8528909600c (diff)
downloadopenttd-67106dc0633c50ef6545d0ab6253384b276ab40e.tar.xz
(svn r17214) -Add [NoAI]: GetAPIVersion() as optional function in info.nut. Return "0.7" to get an api compatible (as much as possible) with the 0.7 api or "0.8" to get the latest api.
-Change [NoAI]: move all deprecated functions to a separate squirrel script that is only loaded if an AI requests an old API version.
-rw-r--r--bin/ai/compat_0.7.nut71
-rw-r--r--bin/ai/compat_0.8.nut1
-rw-r--r--bin/ai/regression/regression.nut2
-rw-r--r--bin/ai/regression/regression_info.nut1
-rw-r--r--src/ai/ai_info.cpp18
-rw-r--r--src/ai/ai_info.hpp6
-rw-r--r--src/ai/ai_instance.cpp29
-rw-r--r--src/ai/ai_instance.hpp5
-rw-r--r--src/ai/api/ai_basestation.hpp1
-rw-r--r--src/ai/api/ai_basestation.hpp.sq1
-rw-r--r--src/ai/api/ai_order.cpp6
-rw-r--r--src/ai/api/ai_order.hpp5
-rw-r--r--src/ai/api/ai_order.hpp.sq1
-rw-r--r--src/ai/api/ai_sign.cpp6
-rw-r--r--src/ai/api/ai_sign.hpp8
-rw-r--r--src/ai/api/ai_sign.hpp.sq13
-rw-r--r--src/ai/api/ai_subsidy.cpp42
-rw-r--r--src/ai/api/ai_subsidy.hpp42
-rw-r--r--src/ai/api/ai_subsidy.hpp.sq4
-rw-r--r--src/ai/api/ai_tile.cpp8
-rw-r--r--src/ai/api/ai_tile.hpp10
-rw-r--r--src/ai/api/ai_tile.hpp.sq3
22 files changed, 139 insertions, 144 deletions
diff --git a/bin/ai/compat_0.7.nut b/bin/ai/compat_0.7.nut
new file mode 100644
index 000000000..c38234a3a
--- /dev/null
+++ b/bin/ai/compat_0.7.nut
@@ -0,0 +1,71 @@
+/* $Id$ */
+
+AISign.GetMaxSignID <- function()
+{
+ AILog.Warning("AISign::GetMaxSignID is deprecated and will be removed soon, please use AISignList instead.");
+ local list = AISignList();
+ local max_id = 0;
+ foreach (id, d in list) {
+ if (id > max_id) max_id = id;
+ }
+ return max_id;
+}
+
+AITile.GetHeight <- function(tile)
+{
+ AILog.Warning("AITile::GetHeight is deprecated and will be removed soon, please use GetMinHeight/GetMaxHeight/GetCornerHeight instead.");
+ if (!AIMap.IsValidTile(tile)) return -1;
+
+ return AITile.GetCornerHeight(tile, AITile.CORNER_N);
+}
+
+AIOrder.ChangeOrder <- function(vehicle_id, order_position, order_flags)
+{
+ AILog.Warning("AIOrder::ChangeOrder is deprecated and will be removed soon, please use AIOrder::SetOrderFlags instead.")
+
+ return AIOrder.SetOrderFlags(vehicle_id, order_position, order_flags);
+}
+
+AIWaypoint.WAYPOINT_INVALID <- 0xFFFF;
+
+AISubsidy.SourceIsTown <- function(subsidy_id)
+{
+ AILog.Warning("AISubsidy::SourceIsTown is deprecated and will be removed soon, please use AISubsidy::GetSourceType instead.");
+ if (!AISubsidy.IsValidSubsidy(subsidy_id) || AISubsidy.IsAwarded(subsidy_id)) return false;
+
+ return AISubsidy.GetSourceType(subsidy_id) == AISubsidy.SPT_TOWN;
+}
+
+AISubsidy.GetSource <- function(subsidy_id)
+{
+ AILog.Warning("AISubsidy::GetSource is deprecated and will be removed soon, please use AISubsidy::GetSourceIndex instead.");
+ if (!AISubsidy.IsValidSubsidy(subsidy_id)) return AIBaseStation.INVALID_STATION;
+
+ if (AISubsidy.IsAwarded(subsidy_id)) {
+ AILog.Error("AISubsidy::GetSource returned INVALID_STATION due to internal changes in the Subsidy logic.");
+ return AIBaseStation.INVALID_STATION;
+ }
+
+ return AISubsidy.GetSourceIndex(subsidy_id);
+}
+
+AISubsidy.DestinationIsTown <- function(subsidy_id)
+{
+ AILog.Warning("AISubsidy::DestinationIsTown is deprecated and will be removed soon, please use AISubsidy::GetDestinationType instead.");
+ if (!AISubsidy.IsValidSubsidy(subsidy_id) || AISubsidy.IsAwarded(subsidy_id)) return false;
+
+ return AISubsidy.GetDestinationType(subsidy_id) == AISubsidy.SPT_TOWN;
+}
+
+AISubsidy.GetDestination <- function(subsidy_id)
+{
+ AILog.Warning("AISubsidy::GetDestination is deprecated and will be removed soon, please use AISubsidy::GetDestinationIndex instead.");
+ if (!AISubsidy.IsValidSubsidy(subsidy_id)) return AIBaseStation.INVALID_STATION;
+
+ if (AISubsidy.IsAwarded(subsidy_id)) {
+ AILog.Error("AISubsidy::GetDestination returned INVALID_STATION due to internal changes in the Subsidy logic.");
+ return AIBaseStation.INVALID_STATION;
+ }
+
+ return AISubsidy.GetDestinationIndex(subsidy_id);
+}
diff --git a/bin/ai/compat_0.8.nut b/bin/ai/compat_0.8.nut
new file mode 100644
index 000000000..a0749a0c2
--- /dev/null
+++ b/bin/ai/compat_0.8.nut
@@ -0,0 +1 @@
+/* $Id$ */
diff --git a/bin/ai/regression/regression.nut b/bin/ai/regression/regression.nut
index 5e1ab100a..c5b7d2cfb 100644
--- a/bin/ai/regression/regression.nut
+++ b/bin/ai/regression/regression.nut
@@ -1204,7 +1204,7 @@ function Regression::TileList()
list.AddRectangle(34436, 256 * 2 + 34436 + 8);
print(" Count(): " + list.Count());
- list.Valuate(AITile.GetHeight);
+ list.Valuate(AITile.GetCornerHeight, AITile.CORNER_N);
print(" Height(): done");
print(" Count(): " + list.Count());
print(" ListDump:");
diff --git a/bin/ai/regression/regression_info.nut b/bin/ai/regression/regression_info.nut
index 5eb8201c7..8c870c571 100644
--- a/bin/ai/regression/regression_info.nut
+++ b/bin/ai/regression/regression_info.nut
@@ -6,6 +6,7 @@ class Regression extends AIInfo {
function GetShortName() { return "REGR"; }
function GetDescription() { return "This runs regression-tests on all commands. On the same map the result should always be the same."; }
function GetVersion() { return 1; }
+ function GetAPIVersion() { return "0.8"; }
function GetDate() { return "2007-03-18"; }
function CreateInstance() { return "Regression"; }
}
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp
index 0ae9582ed..22e2dcded 100644
--- a/src/ai/ai_info.cpp
+++ b/src/ai/ai_info.cpp
@@ -12,6 +12,7 @@
#include "ai_scanner.hpp"
#include "../settings_type.h"
#include "../openttd.h"
+#include "../debug.h"
AIConfigItem _start_date_config = {
"start_date",
@@ -42,6 +43,11 @@ AILibrary::~AILibrary()
return 0;
}
+static bool CheckAPIVersion(const char *api_version)
+{
+ return strcmp(api_version, "0.7") == 0 || strcmp(api_version, "0.8") == 0;
+}
+
/* static */ SQInteger AIInfo::Constructor(HSQUIRRELVM vm)
{
/* Get the AIInfo */
@@ -72,6 +78,16 @@ AILibrary::~AILibrary()
} else {
info->use_as_random = true;
}
+ /* Try to get the API version the AI is written for. */
+ if (info->engine->MethodExists(*info->SQ_instance, "GetAPIVersion")) {
+ if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "GetAPIVersion", &info->api_version)) return SQ_ERROR;
+ if (!CheckAPIVersion(info->api_version)) {
+ DEBUG(ai, 1, "Loading info.nut from (%s.%d): GetAPIVersion returned invalid version", info->GetName(), info->GetVersion());
+ return SQ_ERROR;
+ }
+ } else {
+ info->api_version = strdup("0.7");
+ }
/* Remove the link to the real instance, else it might get deleted by RegisterAI() */
sq_setinstanceup(vm, 2, NULL);
@@ -86,6 +102,7 @@ AILibrary::~AILibrary()
SQUserPointer instance;
sq_getinstanceup(vm, 2, &instance, 0);
AIInfo *info = (AIInfo *)instance;
+ info->api_version = NULL;
SQInteger res = AIFileInfo::Constructor(vm, info);
if (res != 0) return res;
@@ -116,6 +133,7 @@ AIInfo::~AIInfo()
}
}
this->config_list.clear();
+ free((void*)this->api_version);
}
bool AIInfo::CanLoadFromVersion(int version) const
diff --git a/src/ai/ai_info.hpp b/src/ai/ai_info.hpp
index 81b1def3e..0a6e51eda 100644
--- a/src/ai/ai_info.hpp
+++ b/src/ai/ai_info.hpp
@@ -99,10 +99,16 @@ public:
*/
bool UseAsRandomAI() const { return this->use_as_random; }
+ /**
+ * Get the API version this AI is written for.
+ */
+ const char *GetAPIVersion() const { return this->api_version; }
+
private:
AIConfigItemList config_list;
int min_loadable_version;
bool use_as_random;
+ const char *api_version;
};
class AILibrary : public AIFileInfo {
diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp
index f5a78e269..6d3397a70 100644
--- a/src/ai/ai_instance.cpp
+++ b/src/ai/ai_instance.cpp
@@ -80,6 +80,8 @@
#undef DEFINE_SCRIPT_FILES
+#include "../fileio_func.h"
+
AIStorage::~AIStorage()
{
/* Free our pointers */
@@ -121,6 +123,11 @@ AIInstance::AIInstance(AIInfo *info) :
/* Register the API functions and classes */
this->RegisterAPI();
+ if (!this->LoadCompatibilityScripts(info->GetAPIVersion())) {
+ this->Died();
+ return;
+ }
+
/* Load and execute the script for this AI */
const char *main_script = info->GetMainScript();
if (strcmp(main_script, "%_dummy") == 0) {
@@ -239,6 +246,28 @@ void AIInstance::RegisterAPI()
this->engine->SetGlobalPointer(this->engine);
}
+bool AIInstance::LoadCompatibilityScripts(const char *api_version)
+{
+ char script_name[32];
+ seprintf(script_name, lastof(script_name), "compat_%s.nut", api_version);
+ char buf[MAX_PATH];
+ Searchpath sp;
+ FOR_ALL_SEARCHPATHS(sp) {
+ FioAppendDirectory(buf, MAX_PATH, sp, AI_DIR);
+ ttd_strlcat(buf, script_name, MAX_PATH);
+ if (!FileExists(buf)) continue;
+
+ if (this->engine->LoadScript(buf)) return true;
+
+ AILog::Error("Failed to load API compatibility script");
+ DEBUG(ai, 0, "Error compiling / running API compatibility script: %s", buf);
+ return false;
+ }
+
+ AILog::Warning("API compatibility script not found");
+ return true;
+}
+
void AIInstance::Continue()
{
assert(this->suspend < 0);
diff --git a/src/ai/ai_instance.hpp b/src/ai/ai_instance.hpp
index 41653dba1..f260d46d4 100644
--- a/src/ai/ai_instance.hpp
+++ b/src/ai/ai_instance.hpp
@@ -131,6 +131,11 @@ private:
void RegisterAPI();
/**
+ * Load squirrel scipts to emulate an older API.
+ */
+ bool LoadCompatibilityScripts(const char *api_version);
+
+ /**
* Tell the AI it died.
*/
void Died();
diff --git a/src/ai/api/ai_basestation.hpp b/src/ai/api/ai_basestation.hpp
index 609d350c2..52e0b79fc 100644
--- a/src/ai/api/ai_basestation.hpp
+++ b/src/ai/api/ai_basestation.hpp
@@ -23,7 +23,6 @@ public:
STATION_NEW = 0xFFFD, //!< Build a new station
STATION_JOIN_ADJACENT = 0xFFFE, //!< Join an neighbouring station if one exists
STATION_INVALID = 0xFFFF, //!< Invalid station id.
- WAYPOINT_INVALID = 0xFFFF, //!< @deprecated Use STATION_INVALID instead.
};
/**
diff --git a/src/ai/api/ai_basestation.hpp.sq b/src/ai/api/ai_basestation.hpp.sq
index abbf7e69b..315b2be3a 100644
--- a/src/ai/api/ai_basestation.hpp.sq
+++ b/src/ai/api/ai_basestation.hpp.sq
@@ -24,7 +24,6 @@ void SQAIBaseStation_Register(Squirrel *engine) {
SQAIBaseStation.DefSQConst(engine, AIBaseStation::STATION_NEW, "STATION_NEW");
SQAIBaseStation.DefSQConst(engine, AIBaseStation::STATION_JOIN_ADJACENT, "STATION_JOIN_ADJACENT");
SQAIBaseStation.DefSQConst(engine, AIBaseStation::STATION_INVALID, "STATION_INVALID");
- SQAIBaseStation.DefSQConst(engine, AIBaseStation::WAYPOINT_INVALID, "WAYPOINT_INVALID");
SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::IsValidBaseStation, "IsValidBaseStation", 2, ".i");
SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetName, "GetName", 2, ".i");
diff --git a/src/ai/api/ai_order.cpp b/src/ai/api/ai_order.cpp
index 50d94d346..0cc9a88fc 100644
--- a/src/ai/api/ai_order.cpp
+++ b/src/ai/api/ai_order.cpp
@@ -476,12 +476,6 @@ static void _DoCommandReturnSetOrderFlags(class AIInstance *instance)
return AIOrder::_SetOrderFlags();
}
-/* static */ bool AIOrder::ChangeOrder(VehicleID vehicle_id, OrderPosition order_position, AIOrder::AIOrderFlags order_flags)
-{
- AILog::Warning("AIOrder::ChangeOrder is deprecated and will be removed soon, please use AIOrder::SetOrderFlags instead.");
- return SetOrderFlags(vehicle_id, order_position, order_flags);
-}
-
/* static */ bool AIOrder::MoveOrder(VehicleID vehicle_id, OrderPosition order_position_move, OrderPosition order_position_target)
{
order_position_move = AIOrder::ResolveOrderPosition(vehicle_id, order_position_move);
diff --git a/src/ai/api/ai_order.hpp b/src/ai/api/ai_order.hpp
index c04ffd799..1f56d458e 100644
--- a/src/ai/api/ai_order.hpp
+++ b/src/ai/api/ai_order.hpp
@@ -404,11 +404,6 @@ public:
static bool SetOrderFlags(VehicleID vehicle_id, OrderPosition order_position, AIOrderFlags order_flags);
/**
- * @Deprecated, use SetOrderFlags instead.
- */
- static bool ChangeOrder(VehicleID vehicle_id, OrderPosition order_position, AIOrderFlags order_flags);
-
- /**
* Move an order inside the orderlist
* @param vehicle_id The vehicle to move the orders.
* @param order_position_move The order to move.
diff --git a/src/ai/api/ai_order.hpp.sq b/src/ai/api/ai_order.hpp.sq
index 5b3f0ce08..d02e8ee42 100644
--- a/src/ai/api/ai_order.hpp.sq
+++ b/src/ai/api/ai_order.hpp.sq
@@ -99,7 +99,6 @@ void SQAIOrder_Register(Squirrel *engine) {
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertConditionalOrder, "InsertConditionalOrder", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::RemoveOrder, "RemoveOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderFlags, "SetOrderFlags", 4, ".iii");
- SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ChangeOrder, "ChangeOrder", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::MoveOrder, "MoveOrder", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SkipToOrder, "SkipToOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::CopyOrders, "CopyOrders", 3, ".ii");
diff --git a/src/ai/api/ai_sign.cpp b/src/ai/api/ai_sign.cpp
index 326f1211d..e9c1c58ee 100644
--- a/src/ai/api/ai_sign.cpp
+++ b/src/ai/api/ai_sign.cpp
@@ -14,12 +14,6 @@
#include "../../tile_map.h"
#include "../../company_func.h"
-/* static */ SignID AISign::GetMaxSignID()
-{
- AILog::Warning("AISign::GetMaxSignID is deprecated and will be removed soon, please use AISignList instead.");
- return (SignID)::Sign::GetPoolSize();
-}
-
/* static */ bool AISign::IsValidSign(SignID sign_id)
{
const Sign *si = ::Sign::GetIfValid(sign_id);
diff --git a/src/ai/api/ai_sign.hpp b/src/ai/api/ai_sign.hpp
index e7e20dc46..9c6347d99 100644
--- a/src/ai/api/ai_sign.hpp
+++ b/src/ai/api/ai_sign.hpp
@@ -29,14 +29,6 @@ public:
};
/**
- * Gets the maximum sign index; there are no valid signs with a higher index.
- * @deprecated This function is deprecated and might be removed in future versions of the API. Use AISignList() instead.
- * @return The maximum sign index.
- * @post Return value is always non-negative.
- */
- static SignID GetMaxSignID();
-
- /**
* Checks whether the given sign index is valid.
* @param sign_id The index to check.
* @return True if and only if the sign is valid.
diff --git a/src/ai/api/ai_sign.hpp.sq b/src/ai/api/ai_sign.hpp.sq
index 33ac6720b..2c5ef8039 100644
--- a/src/ai/api/ai_sign.hpp.sq
+++ b/src/ai/api/ai_sign.hpp.sq
@@ -28,13 +28,12 @@ void SQAISign_Register(Squirrel *engine) {
AIError::RegisterErrorMapString(AISign::ERR_SIGN_TOO_MANY_SIGNS, "ERR_SIGN_TOO_MANY_SIGNS");
- SQAISign.DefSQStaticMethod(engine, &AISign::GetMaxSignID, "GetMaxSignID", 1, ".");
- SQAISign.DefSQStaticMethod(engine, &AISign::IsValidSign, "IsValidSign", 2, ".i");
- SQAISign.DefSQStaticMethod(engine, &AISign::SetName, "SetName", 3, ".is");
- SQAISign.DefSQStaticMethod(engine, &AISign::GetName, "GetName", 2, ".i");
- SQAISign.DefSQStaticMethod(engine, &AISign::GetLocation, "GetLocation", 2, ".i");
- SQAISign.DefSQStaticMethod(engine, &AISign::BuildSign, "BuildSign", 3, ".is");
- SQAISign.DefSQStaticMethod(engine, &AISign::RemoveSign, "RemoveSign", 2, ".i");
+ SQAISign.DefSQStaticMethod(engine, &AISign::IsValidSign, "IsValidSign", 2, ".i");
+ SQAISign.DefSQStaticMethod(engine, &AISign::SetName, "SetName", 3, ".is");
+ SQAISign.DefSQStaticMethod(engine, &AISign::GetName, "GetName", 2, ".i");
+ SQAISign.DefSQStaticMethod(engine, &AISign::GetLocation, "GetLocation", 2, ".i");
+ SQAISign.DefSQStaticMethod(engine, &AISign::BuildSign, "BuildSign", 3, ".is");
+ SQAISign.DefSQStaticMethod(engine, &AISign::RemoveSign, "RemoveSign", 2, ".i");
SQAISign.PostRegister(engine);
}
diff --git a/src/ai/api/ai_subsidy.cpp b/src/ai/api/ai_subsidy.cpp
index df6889ac7..3a0629c77 100644
--- a/src/ai/api/ai_subsidy.cpp
+++ b/src/ai/api/ai_subsidy.cpp
@@ -50,27 +50,6 @@
return ::Subsidy::Get(subsidy_id)->cargo_type;
}
-/* 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;
-}
-
-/* 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)) {
- AILog::Error("AISubsidy::GetSource returned INVALID_STATION due to internal changes in the Subsidy logic.");
- return INVALID_STATION;
- }
-
- return ::Subsidy::Get(subsidy_id)->src;
-}
-
/* static */ AISubsidy::SubsidyParticipantType AISubsidy::GetSourceType(SubsidyID subsidy_id)
{
if (!IsValidSubsidy(subsidy_id)) return SPT_INVALID;
@@ -85,27 +64,6 @@
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;
-}
-
-/* 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)) {
- AILog::Error("AISubsidy::GetDestination returned INVALID_STATION due to internal changes in the Subsidy logic.");
- return INVALID_STATION;
- }
-
- return ::Subsidy::Get(subsidy_id)->dst;
-}
-
/* static */ AISubsidy::SubsidyParticipantType AISubsidy::GetDestinationType(SubsidyID subsidy_id)
{
if (!IsValidSubsidy(subsidy_id)) return SPT_INVALID;
diff --git a/src/ai/api/ai_subsidy.hpp b/src/ai/api/ai_subsidy.hpp
index b4d190bbf..5aa937f22 100644
--- a/src/ai/api/ai_subsidy.hpp
+++ b/src/ai/api/ai_subsidy.hpp
@@ -70,27 +70,6 @@ public:
static CargoID GetCargoType(SubsidyID subsidy_id);
/**
- * Is the source 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 source is a town, false if it is an industry.
- * @deprecated Use GetSourceType() instead.
- */
- static bool SourceIsTown(SubsidyID subsidy_id);
-
- /**
- * Return the source TownID/IndustryID/StationID the subsidy is for.
- * \li IsAwarded(subsidy_id) -> return INVALID_STATION.
- * \li !IsAwarded(subsidy_id) && SourceIsTown(subsidy_id) -> return the TownID.
- * \li !IsAwarded(subsidy_id) && !SourceIsTown(subsidy_id) -> return the IndustryID.
- * @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).
@@ -109,27 +88,6 @@ public:
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);
-
- /**
- * Return the destination TownID/IndustryID/StationID the subsidy is for.
- * \li IsAwarded(subsidy_id) -> return INVALID_STATION.
- * \li !IsAwarded(subsidy_id) && DestinationIsTown(subsidy_id) -> return the TownID.
- * \li !IsAwarded(subsidy_id) && !DestinationIsTown(subsidy_id) -> return the IndustryID.
- * @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).
diff --git a/src/ai/api/ai_subsidy.hpp.sq b/src/ai/api/ai_subsidy.hpp.sq
index 8221e2338..ad0e34839 100644
--- a/src/ai/api/ai_subsidy.hpp.sq
+++ b/src/ai/api/ai_subsidy.hpp.sq
@@ -30,12 +30,8 @@ void SQAISubsidy_Register(Squirrel *engine) {
SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetAwardedTo, "GetAwardedTo", 2, ".i");
SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetExpireDate, "GetExpireDate", 2, ".i");
SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetCargoType, "GetCargoType", 2, ".i");
- SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::SourceIsTown, "SourceIsTown", 2, ".i");
- SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetSource, "GetSource", 2, ".i");
SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetSourceType, "GetSourceType", 2, ".i");
SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetSourceIndex, "GetSourceIndex", 2, ".i");
- SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::DestinationIsTown, "DestinationIsTown", 2, ".i");
- SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetDestination, "GetDestination", 2, ".i");
SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetDestinationType, "GetDestinationType", 2, ".i");
SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetDestinationIndex, "GetDestinationIndex", 2, ".i");
diff --git a/src/ai/api/ai_tile.cpp b/src/ai/api/ai_tile.cpp
index 42b95241a..78fc27421 100644
--- a/src/ai/api/ai_tile.cpp
+++ b/src/ai/api/ai_tile.cpp
@@ -130,14 +130,6 @@
return (Slope)::ComplementSlope((::Slope)slope);
}
-/* static */ int32 AITile::GetHeight(TileIndex tile)
-{
- AILog::Warning("AITile::GetHeight is deprecated and will be removed soon, please use GetMinHeight/GetMaxHeight/GetCornerHeight instead.");
- if (!::IsValidTile(tile)) return -1;
-
- return ::TileHeight(tile);
-}
-
/* static */ int32 AITile::GetMinHeight(TileIndex tile)
{
if (!::IsValidTile(tile)) return -1;
diff --git a/src/ai/api/ai_tile.hpp b/src/ai/api/ai_tile.hpp
index b35bcc270..305770395 100644
--- a/src/ai/api/ai_tile.hpp
+++ b/src/ai/api/ai_tile.hpp
@@ -233,16 +233,6 @@ public:
static Slope GetComplementSlope(Slope slope);
/**
- * Get the height of the north corner of a tile.
- * The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
- * @deprecated This function is deprecated and might be removed in future versions of the API. Use GetMinHeight(), GetMaxHeight() or GetCornerHeight() instead.
- * @param tile The tile to check on.
- * @pre AIMap::IsValidTile(tile).
- * @return The height of the north corner of the tile, ranging from 0 to 15.
- */
- static int32 GetHeight(TileIndex tile);
-
- /**
* Get the minimal height on a tile.
* The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
* @param tile The tile to check on.
diff --git a/src/ai/api/ai_tile.hpp.sq b/src/ai/api/ai_tile.hpp.sq
index 4c46df1bb..484ada59e 100644
--- a/src/ai/api/ai_tile.hpp.sq
+++ b/src/ai/api/ai_tile.hpp.sq
@@ -67,7 +67,7 @@ void SQAITile_Register(Squirrel *engine) {
AIError::RegisterErrorMap(STR_ERROR_ALREADY_AT_SEA_LEVEL, AITile::ERR_TILE_TOO_HIGH);
AIError::RegisterErrorMap(STR_ERROR_ALREADY_AT_SEA_LEVEL, AITile::ERR_TILE_TOO_LOW);
- AIError::RegisterErrorMap(STR_ERROR_ALREADY_LEVELLED, AITile::ERR_AREA_ALREADY_FLAT);
+ AIError::RegisterErrorMap(STR_ERROR_ALREADY_LEVELLED, AITile::ERR_AREA_ALREADY_FLAT);
AIError::RegisterErrorMap(STR_ERROR_EXCAVATION_WOULD_DAMAGE, AITile::ERR_EXCAVATION_WOULD_DAMAGE);
AIError::RegisterErrorMapString(AITile::ERR_TILE_TOO_HIGH, "ERR_TILE_TOO_HIGH");
@@ -90,7 +90,6 @@ void SQAITile_Register(Squirrel *engine) {
SQAITile.DefSQStaticMethod(engine, &AITile::IsDesertTile, "IsDesertTile", 2, ".i");
SQAITile.DefSQStaticMethod(engine, &AITile::GetSlope, "GetSlope", 2, ".i");
SQAITile.DefSQStaticMethod(engine, &AITile::GetComplementSlope, "GetComplementSlope", 2, ".i");
- SQAITile.DefSQStaticMethod(engine, &AITile::GetHeight, "GetHeight", 2, ".i");
SQAITile.DefSQStaticMethod(engine, &AITile::GetMinHeight, "GetMinHeight", 2, ".i");
SQAITile.DefSQStaticMethod(engine, &AITile::GetMaxHeight, "GetMaxHeight", 2, ".i");
SQAITile.DefSQStaticMethod(engine, &AITile::GetCornerHeight, "GetCornerHeight", 3, ".ii");