Changeset - r26982:abc6aff31993
[Not reviewed]
master
0 2 0
glx22 - 15 months ago 2023-03-04 16:45:29
glx@openttd.org
Codechange: Use SQInteger for generic numbers in script_order
2 files changed with 9 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/script/api/script_order.cpp
Show inline comments
 
@@ -234,7 +234,7 @@ static int ScriptOrderPositionToRealOrde
 
	}
 
}
 

	
 
/* 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 ScriptOrderPositionToRealOrde
 
	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 ScriptOrderPositionToRealOrde
 
	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 _DoCommandReturnSetOrderFlag
 
	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)) {
src/script/api/script_order.hpp
Show inline comments
 
@@ -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)
 

	
0 comments (0 inline, 0 general)