Codechange: Use SQInteger for generic numbers in script_order

This commit is contained in:
glx22 2023-03-04 17:45:29 +01:00 committed by Loïc Guilloux
parent 49ea69fdef
commit 777b4d0987
2 changed files with 9 additions and 9 deletions

View File

@ -234,7 +234,7 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
}
}
/* static */ int32 ScriptOrder::GetOrderCount(VehicleID vehicle_id)
/* static */ SQInteger ScriptOrder::GetOrderCount(VehicleID vehicle_id)
{
return ScriptVehicle::IsPrimaryVehicle(vehicle_id) ? ::Vehicle::Get(vehicle_id)->GetNumManualOrders() : -1;
}
@ -349,13 +349,13 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
return (CompareFunction)order->GetConditionComparator();
}
/* static */ int32 ScriptOrder::GetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position)
/* static */ SQInteger ScriptOrder::GetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position)
{
if (!IsValidVehicleOrder(vehicle_id, order_position)) return -1;
if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return -1;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
int32 value = order->GetConditionValue();
SQInteger value = order->GetConditionValue();
if (order->GetConditionVariable() == OCV_MAX_SPEED) value = value * 16 / 10;
return value;
}
@ -408,7 +408,7 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
return ScriptObject::Command<CMD_MODIFY_ORDER>::Do(0, vehicle_id, order_pos, MOF_COND_COMPARATOR, compare);
}
/* static */ bool ScriptOrder::SetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position, int32 value)
/* static */ bool ScriptOrder::SetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position, SQInteger value)
{
EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
EnforcePrecondition(false, order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position));
@ -666,7 +666,7 @@ static void _DoCommandReturnSetOrderFlags(class ScriptInstance *instance)
return ScriptObject::Command<CMD_CLONE_ORDER>::Do(0, CO_UNSHARE, vehicle_id, 0);
}
/* static */ uint ScriptOrder::GetOrderDistance(ScriptVehicle::VehicleType vehicle_type, TileIndex origin_tile, TileIndex dest_tile)
/* static */ SQInteger ScriptOrder::GetOrderDistance(ScriptVehicle::VehicleType vehicle_type, TileIndex origin_tile, TileIndex dest_tile)
{
if (vehicle_type == ScriptVehicle::VT_AIR) {
if (ScriptTile::IsStationTile(origin_tile)) {

View File

@ -250,7 +250,7 @@ public:
* @return The number of orders for the given vehicle or a negative
* value when the vehicle does not exist.
*/
static int32 GetOrderCount(VehicleID vehicle_id);
static SQInteger GetOrderCount(VehicleID vehicle_id);
/**
* Gets the destination of the given order for the given vehicle.
@ -320,7 +320,7 @@ public:
* @pre order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position).
* @return The value to compare against of the order.
*/
static int32 GetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position);
static SQInteger GetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position);
/**
* Gets the stoplocation of the given order for the given train.
@ -398,7 +398,7 @@ public:
* @return Whether the order has been/can be changed.
* @api -game
*/
static bool SetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position, int32 value);
static bool SetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position, SQInteger value);
/**
* Sets the stoplocation of the given order for the given train.
@ -601,7 +601,7 @@ public:
* not be compared with map distances
* @see ScriptEngine::GetMaximumOrderDistance and ScriptVehicle::GetMaximumOrderDistance
*/
static uint GetOrderDistance(ScriptVehicle::VehicleType vehicle_type, TileIndex origin_tile, TileIndex dest_tile);
static SQInteger GetOrderDistance(ScriptVehicle::VehicleType vehicle_type, TileIndex origin_tile, TileIndex dest_tile);
};
DECLARE_ENUM_AS_BIT_SET(ScriptOrder::ScriptOrderFlags)