From 67106dc0633c50ef6545d0ab6253384b276ab40e Mon Sep 17 00:00:00 2001 From: yexo Date: Tue, 18 Aug 2009 18:51:42 +0000 Subject: (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. --- src/ai/api/ai_basestation.hpp | 1 - src/ai/api/ai_basestation.hpp.sq | 1 - src/ai/api/ai_order.cpp | 6 ------ src/ai/api/ai_order.hpp | 5 ----- src/ai/api/ai_order.hpp.sq | 1 - src/ai/api/ai_sign.cpp | 6 ------ src/ai/api/ai_sign.hpp | 8 -------- src/ai/api/ai_sign.hpp.sq | 13 ++++++------- src/ai/api/ai_subsidy.cpp | 42 ---------------------------------------- src/ai/api/ai_subsidy.hpp | 42 ---------------------------------------- src/ai/api/ai_subsidy.hpp.sq | 4 ---- src/ai/api/ai_tile.cpp | 8 -------- src/ai/api/ai_tile.hpp | 10 ---------- src/ai/api/ai_tile.hpp.sq | 3 +-- 14 files changed, 7 insertions(+), 143 deletions(-) (limited to 'src/ai/api') 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 @@ -403,11 +403,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. 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 @@ -28,14 +28,6 @@ public: ERR_SIGN_TOO_MANY_SIGNS, // [STR_ERROR_TOO_MANY_SIGNS] }; - /** - * 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. 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 @@ -69,27 +69,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. @@ -108,27 +87,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. 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 @@ -232,16 +232,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. 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"); -- cgit v1.2.3-54-g00ecf