(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.
This commit is contained in:
@@ -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.
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -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");
|
||||
|
@@ -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);
|
||||
|
@@ -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.
|
||||
|
@@ -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");
|
||||
|
@@ -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);
|
||||
|
@@ -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.
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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.
|
||||
|
@@ -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");
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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.
|
||||
|
@@ -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");
|
||||
|
Reference in New Issue
Block a user