Codechange: Use SQInteger for generic numbers in script_rail

This commit is contained in:
glx22 2023-03-04 17:46:43 +01:00 committed by Loïc Guilloux
parent cb2e76aae3
commit 4f6a2f31b5
2 changed files with 10 additions and 10 deletions

View File

@ -147,7 +147,7 @@
return ScriptObject::Command<CMD_BUILD_TRAIN_DEPOT>::Do(tile, (::RailType)ScriptObject::GetRailType(), entrance_dir);
}
/* static */ bool ScriptRail::BuildRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id)
/* static */ bool ScriptRail::BuildRailStation(TileIndex tile, RailTrack direction, SQInteger num_platforms, SQInteger platform_length, StationID station_id)
{
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
EnforcePrecondition(false, ::IsValidTile(tile));
@ -161,7 +161,7 @@
return ScriptObject::Command<CMD_BUILD_RAIL_STATION>::Do(tile, (::RailType)GetCurrentRailType(), direction == RAILTRACK_NW_SE ? AXIS_Y : AXIS_X, num_platforms, platform_length, STAT_CLASS_DFLT, 0, ScriptStation::IsValidStation(station_id) ? station_id : INVALID_STATION, adjacent);
}
/* static */ bool ScriptRail::BuildNewGRFRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, int distance, bool source_station)
/* static */ bool ScriptRail::BuildNewGRFRailStation(TileIndex tile, RailTrack direction, SQInteger num_platforms, SQInteger platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, SQInteger distance, bool source_station)
{
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
EnforcePrecondition(false, ::IsValidTile(tile));
@ -181,10 +181,10 @@
0,
source_industry,
goal_industry,
std::min(255, distance / 2),
std::min<SQInteger>(255, distance / 2),
AICE_STATION_GET_STATION_ID,
source_station ? 0 : 1,
std::min(15u, num_platforms) << 4 | std::min(15u, platform_length),
std::min<SQInteger>(15u, num_platforms) << 4 | std::min<SQInteger>(15u, platform_length),
&file
);
@ -504,14 +504,14 @@ static bool IsValidSignalType(int signal_type)
}
}
/* static */ int32 ScriptRail::GetMaxSpeed(RailType railtype)
/* static */ SQInteger ScriptRail::GetMaxSpeed(RailType railtype)
{
if (!ScriptRail::IsRailTypeAvailable(railtype)) return -1;
return ::GetRailTypeInfo((::RailType)railtype)->max_speed;
}
/* static */ uint16 ScriptRail::GetMaintenanceCostFactor(RailType railtype)
/* static */ SQInteger ScriptRail::GetMaintenanceCostFactor(RailType railtype)
{
if (!ScriptRail::IsRailTypeAvailable(railtype)) return 0;

View File

@ -260,7 +260,7 @@ public:
* @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
* @return Whether the station has been/can be build or not.
*/
static bool BuildRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id);
static bool BuildRailStation(TileIndex tile, RailTrack direction, SQInteger num_platforms, SQInteger platform_length, StationID station_id);
/**
* Build a NewGRF rail station. This calls callback 18 to let a NewGRF
@ -297,7 +297,7 @@ public:
* @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
* @return Whether the station has been/can be build or not.
*/
static bool BuildNewGRFRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, int distance, bool source_station);
static bool BuildNewGRFRailStation(TileIndex tile, RailTrack direction, SQInteger num_platforms, SQInteger platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, SQInteger distance, bool source_station);
/**
* Build a rail waypoint.
@ -486,7 +486,7 @@ public:
* This is mph / 1.6, which is roughly km/h.
* To get km/h multiply this number by 1.00584.
*/
static int32 GetMaxSpeed(RailType railtype);
static SQInteger GetMaxSpeed(RailType railtype);
/**
* Get the maintenance cost factor of a railtype.
@ -494,7 +494,7 @@ public:
* @pre IsRailTypeAvailable(railtype)
* @return Maintenance cost factor of the railtype.
*/
static uint16 GetMaintenanceCostFactor(RailType railtype);
static SQInteger GetMaintenanceCostFactor(RailType railtype);
};
#endif /* SCRIPT_RAIL_HPP */