mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-20 06:12:57 +01:00
Replace many C-style casts (#11720)
This commit is contained in:
committed by
GitHub
parent
a261b4ce33
commit
d7637cd70f
@@ -4027,7 +4027,7 @@ static void window_ride_maintenance_mousedown(rct_window* w, rct_widgetindex wid
|
|||||||
gDropdownItemsArgs[0] = STR_DEBUG_FIX_RIDE;
|
gDropdownItemsArgs[0] = STR_DEBUG_FIX_RIDE;
|
||||||
for (int32_t i = 0; i < 8; i++)
|
for (int32_t i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
assert(j < (int32_t)std::size(rideEntry->ride_type));
|
assert(j < static_cast<int32_t>(std::size(rideEntry->ride_type)));
|
||||||
if (RideTypeDescriptors[rideEntry->ride_type[j]].AvailableBreakdowns & static_cast<uint8_t>(1 << i))
|
if (RideTypeDescriptors[rideEntry->ride_type[j]].AvailableBreakdowns & static_cast<uint8_t>(1 << i))
|
||||||
{
|
{
|
||||||
if (i == BREAKDOWN_BRAKES_FAILURE
|
if (i == BREAKDOWN_BRAKES_FAILURE
|
||||||
@@ -4170,7 +4170,7 @@ static void window_ride_maintenance_dropdown(rct_window* w, rct_widgetindex widg
|
|||||||
int32_t num_items = 1;
|
int32_t num_items = 1;
|
||||||
for (i = 0; i < BREAKDOWN_COUNT; i++)
|
for (i = 0; i < BREAKDOWN_COUNT; i++)
|
||||||
{
|
{
|
||||||
assert(j < (int32_t)std::size(rideEntry->ride_type));
|
assert(j < static_cast<int32_t>(std::size(rideEntry->ride_type)));
|
||||||
if (RideTypeDescriptors[rideEntry->ride_type[j]].AvailableBreakdowns & static_cast<uint8_t>(1 << i))
|
if (RideTypeDescriptors[rideEntry->ride_type[j]].AvailableBreakdowns & static_cast<uint8_t>(1 << i))
|
||||||
{
|
{
|
||||||
if (i == BREAKDOWN_BRAKES_FAILURE
|
if (i == BREAKDOWN_BRAKES_FAILURE
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
Peep* peep = GET_PEEP(_peepId);
|
Peep* peep = GET_PEEP(_peepId);
|
||||||
if (peep == nullptr)
|
if (peep == nullptr)
|
||||||
{
|
{
|
||||||
log_error("Used invalid sprite index for peep: %u", (uint32_t)_peepId);
|
log_error("Used invalid sprite index for peep: %u", static_cast<uint32_t>(_peepId));
|
||||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_THIS);
|
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_THIS);
|
||||||
}
|
}
|
||||||
return std::make_unique<GameActionResult>();
|
return std::make_unique<GameActionResult>();
|
||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
Peep* peep = GET_PEEP(_peepId);
|
Peep* peep = GET_PEEP(_peepId);
|
||||||
if (peep == nullptr)
|
if (peep == nullptr)
|
||||||
{
|
{
|
||||||
log_error("Used invalid sprite index for peep: %u", (uint32_t)_peepId);
|
log_error("Used invalid sprite index for peep: %u", static_cast<uint32_t>(_peepId));
|
||||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_THIS);
|
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_THIS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
auto ride = get_ride(_rideIndex);
|
auto ride = get_ride(_rideIndex);
|
||||||
if (ride == nullptr)
|
if (ride == nullptr)
|
||||||
{
|
{
|
||||||
log_warning("Invalid game command for ride %d", (int32_t)_rideIndex);
|
log_warning("Invalid game command for ride %d", static_cast<int32_t>(_rideIndex));
|
||||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, errorTitle);
|
return MakeResult(GA_ERROR::INVALID_PARAMETERS, errorTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ public:
|
|||||||
auto ride = get_ride(_rideIndex);
|
auto ride = get_ride(_rideIndex);
|
||||||
if (ride == nullptr)
|
if (ride == nullptr)
|
||||||
{
|
{
|
||||||
log_warning("Invalid game command for ride %d", (int32_t)_rideIndex);
|
log_warning("Invalid game command for ride %d", static_cast<int32_t>(_rideIndex));
|
||||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, errorTitle);
|
return MakeResult(GA_ERROR::INVALID_PARAMETERS, errorTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
auto ride = get_ride(_rideIndex);
|
auto ride = get_ride(_rideIndex);
|
||||||
if (ride == nullptr)
|
if (ride == nullptr)
|
||||||
{
|
{
|
||||||
log_warning("Invalid ride id %d for entrance/exit removal", (int32_t)_rideIndex);
|
log_warning("Invalid ride id %d for entrance/exit removal", static_cast<int32_t>(_rideIndex));
|
||||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,8 +108,8 @@ public:
|
|||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
log_warning(
|
log_warning(
|
||||||
"Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y, (int32_t)_rideIndex,
|
"Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y,
|
||||||
_stationNum);
|
static_cast<int32_t>(_rideIndex), _stationNum);
|
||||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ public:
|
|||||||
auto ride = get_ride(_rideIndex);
|
auto ride = get_ride(_rideIndex);
|
||||||
if (ride == nullptr)
|
if (ride == nullptr)
|
||||||
{
|
{
|
||||||
log_warning("Invalid ride id %d for entrance/exit removal", (int32_t)_rideIndex);
|
log_warning("Invalid ride id %d for entrance/exit removal", static_cast<int32_t>(_rideIndex));
|
||||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,8 +168,8 @@ public:
|
|||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
log_warning(
|
log_warning(
|
||||||
"Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y, (int32_t)_rideIndex,
|
"Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y,
|
||||||
_stationNum);
|
static_cast<int32_t>(_rideIndex), _stationNum);
|
||||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
auto ride = get_ride(_rideIndex);
|
auto ride = get_ride(_rideIndex);
|
||||||
if (ride == nullptr)
|
if (ride == nullptr)
|
||||||
{
|
{
|
||||||
log_warning("Invalid ride: #%d.", (int32_t)_rideIndex);
|
log_warning("Invalid ride: #%d.", static_cast<int32_t>(_rideIndex));
|
||||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ public:
|
|||||||
auto ride = get_ride(_rideIndex);
|
auto ride = get_ride(_rideIndex);
|
||||||
if (ride == nullptr)
|
if (ride == nullptr)
|
||||||
{
|
{
|
||||||
log_warning("Invalid ride: #%d.", (int32_t)_rideIndex);
|
log_warning("Invalid ride: #%d.", static_cast<int32_t>(_rideIndex));
|
||||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ private:
|
|||||||
if (_staffType >= STAFF_TYPE_COUNT)
|
if (_staffType >= STAFF_TYPE_COUNT)
|
||||||
{
|
{
|
||||||
// Invalid staff type.
|
// Invalid staff type.
|
||||||
log_error("Tried to use invalid staff type: %u", (uint32_t)_staffType);
|
log_error("Tried to use invalid staff type: %u", static_cast<uint32_t>(_staffType));
|
||||||
|
|
||||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ private:
|
|||||||
if (_entertainerType >= ENTERTAINER_COSTUME_COUNT)
|
if (_entertainerType >= ENTERTAINER_COSTUME_COUNT)
|
||||||
{
|
{
|
||||||
// Invalid entertainer costume
|
// Invalid entertainer costume
|
||||||
log_error("Tried to use invalid entertainer type: %u", (uint32_t)_entertainerType);
|
log_error("Tried to use invalid entertainer type: %u", static_cast<uint32_t>(_entertainerType));
|
||||||
|
|
||||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ private:
|
|||||||
if (!(availableCostumes & (1 << _entertainerType)))
|
if (!(availableCostumes & (1 << _entertainerType)))
|
||||||
{
|
{
|
||||||
// Entertainer costume unavailable
|
// Entertainer costume unavailable
|
||||||
log_error("Tried to use unavailable entertainer type: %u", (uint32_t)_entertainerType);
|
log_error("Tried to use unavailable entertainer type: %u", static_cast<uint32_t>(_entertainerType));
|
||||||
|
|
||||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,13 +104,13 @@ public:
|
|||||||
auto ride = get_ride(_rideIndex);
|
auto ride = get_ride(_rideIndex);
|
||||||
if (ride == nullptr)
|
if (ride == nullptr)
|
||||||
{
|
{
|
||||||
log_warning("Invalid ride for track placement, rideIndex = %d", (int32_t)_rideIndex);
|
log_warning("Invalid ride for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex));
|
||||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||||
}
|
}
|
||||||
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
|
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
|
||||||
if (rideEntry == nullptr)
|
if (rideEntry == nullptr)
|
||||||
{
|
{
|
||||||
log_warning("Invalid ride subtype for track placement, rideIndex = %d", (int32_t)_rideIndex);
|
log_warning("Invalid ride subtype for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex));
|
||||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,14 +429,14 @@ public:
|
|||||||
auto ride = get_ride(_rideIndex);
|
auto ride = get_ride(_rideIndex);
|
||||||
if (ride == nullptr)
|
if (ride == nullptr)
|
||||||
{
|
{
|
||||||
log_warning("Invalid ride for track placement, rideIndex = %d", (int32_t)_rideIndex);
|
log_warning("Invalid ride for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex));
|
||||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
|
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
|
||||||
if (rideEntry == nullptr)
|
if (rideEntry == nullptr)
|
||||||
{
|
{
|
||||||
log_warning("Invalid ride subtype for track placement, rideIndex = %d", (int32_t)_rideIndex);
|
log_warning("Invalid ride subtype for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex));
|
||||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ char* strndup(const char* src, size_t size);
|
|||||||
// Time (represented as number of 100-nanosecond intervals since 0001-01-01T00:00:00Z)
|
// Time (represented as number of 100-nanosecond intervals since 0001-01-01T00:00:00Z)
|
||||||
using datetime64 = uint64_t;
|
using datetime64 = uint64_t;
|
||||||
|
|
||||||
#define DATETIME64_MIN ((datetime64)0)
|
constexpr const datetime64 DATETIME64_MIN = 0;
|
||||||
|
|
||||||
// Represent fixed point numbers. dp = decimal point
|
// Represent fixed point numbers. dp = decimal point
|
||||||
using fixed8_1dp = uint8_t;
|
using fixed8_1dp = uint8_t;
|
||||||
|
|||||||
@@ -268,12 +268,12 @@ public:
|
|||||||
{
|
{
|
||||||
if (value < 128)
|
if (value < 128)
|
||||||
{
|
{
|
||||||
_buffer.push_back((uint8_t)value);
|
_buffer.push_back(static_cast<uint8_t>(value));
|
||||||
}
|
}
|
||||||
else if (value <= std::numeric_limits<uint8_t>().max())
|
else if (value <= std::numeric_limits<uint8_t>().max())
|
||||||
{
|
{
|
||||||
_buffer.push_back(0b10000001);
|
_buffer.push_back(0b10000001);
|
||||||
_buffer.push_back((uint8_t)value);
|
_buffer.push_back(static_cast<uint8_t>(value));
|
||||||
}
|
}
|
||||||
else if (value <= std::numeric_limits<uint16_t>().max())
|
else if (value <= std::numeric_limits<uint16_t>().max())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ template<typename _Ty, size_t _Size> struct DataSerializerTraitsPODArray
|
|||||||
{
|
{
|
||||||
static void encode(IStream* stream, const _Ty (&val)[_Size])
|
static void encode(IStream* stream, const _Ty (&val)[_Size])
|
||||||
{
|
{
|
||||||
uint16_t len = (uint16_t)_Size;
|
uint16_t len = static_cast<uint16_t>(_Size);
|
||||||
uint16_t swapped = ByteSwapBE(len);
|
uint16_t swapped = ByteSwapBE(len);
|
||||||
stream->Write(&swapped);
|
stream->Write(&swapped);
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@ template<typename _Ty, size_t _Size> struct DataSerializerTraits<std::array<_Ty,
|
|||||||
{
|
{
|
||||||
static void encode(IStream* stream, const std::array<_Ty, _Size>& val)
|
static void encode(IStream* stream, const std::array<_Ty, _Size>& val)
|
||||||
{
|
{
|
||||||
uint16_t len = (uint16_t)_Size;
|
uint16_t len = static_cast<uint16_t>(_Size);
|
||||||
uint16_t swapped = ByteSwapBE(len);
|
uint16_t swapped = ByteSwapBE(len);
|
||||||
stream->Write(&swapped);
|
stream->Write(&swapped);
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ template<typename _Ty> struct DataSerializerTraits<std::vector<_Ty>>
|
|||||||
{
|
{
|
||||||
static void encode(IStream* stream, const std::vector<_Ty>& val)
|
static void encode(IStream* stream, const std::vector<_Ty>& val)
|
||||||
{
|
{
|
||||||
uint16_t len = (uint16_t)val.size();
|
uint16_t len = static_cast<uint16_t>(val.size());
|
||||||
uint16_t swapped = ByteSwapBE(len);
|
uint16_t swapped = ByteSwapBE(len);
|
||||||
stream->Write(&swapped);
|
stream->Write(&swapped);
|
||||||
|
|
||||||
|
|||||||
@@ -160,8 +160,8 @@ private:
|
|||||||
|
|
||||||
stats.TotalFiles++;
|
stats.TotalFiles++;
|
||||||
stats.TotalFileSize += fileInfo->Size;
|
stats.TotalFileSize += fileInfo->Size;
|
||||||
stats.FileDateModifiedChecksum ^= (uint32_t)(fileInfo->LastModified >> 32)
|
stats.FileDateModifiedChecksum ^= static_cast<uint32_t>(fileInfo->LastModified >> 32)
|
||||||
^ (uint32_t)(fileInfo->LastModified & 0xFFFFFFFF);
|
^ static_cast<uint32_t>(fileInfo->LastModified & 0xFFFFFFFF);
|
||||||
stats.FileDateModifiedChecksum = ror32(stats.FileDateModifiedChecksum, 5);
|
stats.FileDateModifiedChecksum = ror32(stats.FileDateModifiedChecksum, 5);
|
||||||
stats.PathChecksum += GetPathChecksum(path);
|
stats.PathChecksum += GetPathChecksum(path);
|
||||||
}
|
}
|
||||||
@@ -309,7 +309,7 @@ private:
|
|||||||
header.VersionB = _version;
|
header.VersionB = _version;
|
||||||
header.LanguageId = language;
|
header.LanguageId = language;
|
||||||
header.Stats = stats;
|
header.Stats = stats;
|
||||||
header.NumItems = (uint32_t)items.size();
|
header.NumItems = static_cast<uint32_t>(items.size());
|
||||||
fs.WriteValue(header);
|
fs.WriteValue(header);
|
||||||
|
|
||||||
// Write items
|
// Write items
|
||||||
|
|||||||
@@ -572,7 +572,7 @@ void load_palette()
|
|||||||
|
|
||||||
if (water_type != nullptr)
|
if (water_type != nullptr)
|
||||||
{
|
{
|
||||||
openrct2_assert(water_type->image_id != (uint32_t)-1, "Failed to load water palette");
|
openrct2_assert(water_type->image_id != 0xFFFFFFFF, "Failed to load water palette");
|
||||||
palette = water_type->image_id;
|
palette = water_type->image_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1885,7 +1885,9 @@ uint8_t get_current_rotation()
|
|||||||
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
|
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
|
||||||
if (rotation != rotation_masked)
|
if (rotation != rotation_masked)
|
||||||
{
|
{
|
||||||
log_error("Found wrong rotation %d! Will return %d instead.", (uint32_t)rotation, (uint32_t)rotation_masked);
|
log_error(
|
||||||
|
"Found wrong rotation %d! Will return %d instead.", static_cast<uint32_t>(rotation),
|
||||||
|
static_cast<uint32_t>(rotation_masked));
|
||||||
}
|
}
|
||||||
#endif // DEBUG_LEVEL_1
|
#endif // DEBUG_LEVEL_1
|
||||||
return rotation_masked;
|
return rotation_masked;
|
||||||
|
|||||||
@@ -714,8 +714,8 @@ paint_struct* sub_98196C(
|
|||||||
paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x,
|
paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x,
|
||||||
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset)
|
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset)
|
||||||
{
|
{
|
||||||
assert((uint16_t)bound_box_length_x == (int16_t)bound_box_length_x);
|
assert(static_cast<uint16_t>(bound_box_length_x) == static_cast<int16_t>(bound_box_length_x));
|
||||||
assert((uint16_t)bound_box_length_y == (int16_t)bound_box_length_y);
|
assert(static_cast<uint16_t>(bound_box_length_y) == static_cast<int16_t>(bound_box_length_y));
|
||||||
|
|
||||||
session->LastRootPS = nullptr;
|
session->LastRootPS = nullptr;
|
||||||
session->UnkF1AD2C = nullptr;
|
session->UnkF1AD2C = nullptr;
|
||||||
@@ -923,8 +923,8 @@ paint_struct* sub_98198C(
|
|||||||
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x,
|
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x,
|
||||||
int16_t bound_box_offset_y, int16_t bound_box_offset_z)
|
int16_t bound_box_offset_y, int16_t bound_box_offset_z)
|
||||||
{
|
{
|
||||||
assert((uint16_t)bound_box_length_x == bound_box_length_x);
|
assert(static_cast<uint16_t>(bound_box_length_x) == static_cast<int16_t>(bound_box_length_x));
|
||||||
assert((uint16_t)bound_box_length_y == bound_box_length_y);
|
assert(static_cast<uint16_t>(bound_box_length_y) == static_cast<int16_t>(bound_box_length_y));
|
||||||
|
|
||||||
session->LastRootPS = nullptr;
|
session->LastRootPS = nullptr;
|
||||||
session->UnkF1AD2C = nullptr;
|
session->UnkF1AD2C = nullptr;
|
||||||
@@ -965,8 +965,8 @@ paint_struct* sub_98199C(
|
|||||||
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x,
|
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x,
|
||||||
int16_t bound_box_offset_y, int16_t bound_box_offset_z)
|
int16_t bound_box_offset_y, int16_t bound_box_offset_z)
|
||||||
{
|
{
|
||||||
assert((uint16_t)bound_box_length_x == (int16_t)bound_box_length_x);
|
assert(static_cast<uint16_t>(bound_box_length_x) == static_cast<int16_t>(bound_box_length_x));
|
||||||
assert((uint16_t)bound_box_length_y == (int16_t)bound_box_length_y);
|
assert(static_cast<uint16_t>(bound_box_length_y) == static_cast<int16_t>(bound_box_length_y));
|
||||||
|
|
||||||
if (session->LastRootPS == nullptr)
|
if (session->LastRootPS == nullptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ static void platform_ticks_init()
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
LARGE_INTEGER freq;
|
LARGE_INTEGER freq;
|
||||||
QueryPerformanceFrequency(&freq);
|
QueryPerformanceFrequency(&freq);
|
||||||
_frequency = (uint32_t)(freq.QuadPart / 1000);
|
_frequency = static_cast<uint32_t>(freq.QuadPart / 1000);
|
||||||
QueryPerformanceCounter(&_entryTimestamp);
|
QueryPerformanceCounter(&_entryTimestamp);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -158,9 +158,9 @@ uint32_t platform_get_ticks()
|
|||||||
LARGE_INTEGER runningDelta;
|
LARGE_INTEGER runningDelta;
|
||||||
runningDelta.QuadPart = pfc.QuadPart - _entryTimestamp.QuadPart;
|
runningDelta.QuadPart = pfc.QuadPart - _entryTimestamp.QuadPart;
|
||||||
|
|
||||||
return (uint32_t)(runningDelta.QuadPart / _frequency);
|
return static_cast<uint32_t>(runningDelta.QuadPart / _frequency);
|
||||||
#elif defined(__APPLE__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200)
|
#elif defined(__APPLE__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200)
|
||||||
return (uint32_t)(((mach_absolute_time() * _mach_base_info.numer) / _mach_base_info.denom) / 1000000);
|
return static_cast<uint32_t>(((mach_absolute_time() * _mach_base_info.numer) / _mach_base_info.denom) / 1000000);
|
||||||
#else
|
#else
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
|
if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
|
||||||
|
|||||||
@@ -402,8 +402,8 @@ uint8_t platform_get_locale_date_format()
|
|||||||
wchar_t first[sizeof(dateFormat)];
|
wchar_t first[sizeof(dateFormat)];
|
||||||
wchar_t second[sizeof(dateFormat)];
|
wchar_t second[sizeof(dateFormat)];
|
||||||
if (swscanf_s(
|
if (swscanf_s(
|
||||||
dateFormat, L"%l[dyM]%*l[^dyM]%l[dyM]%*l[^dyM]%*l[dyM]", first, (uint32_t)std::size(first), second,
|
dateFormat, L"%l[dyM]%*l[^dyM]%l[dyM]%*l[^dyM]%*l[dyM]", first, static_cast<uint32_t>(std::size(first)), second,
|
||||||
(uint32_t)std::size(second))
|
static_cast<uint32_t>(std::size(second)))
|
||||||
!= 2)
|
!= 2)
|
||||||
{
|
{
|
||||||
return DATE_FORMAT_DAY_MONTH_YEAR;
|
return DATE_FORMAT_DAY_MONTH_YEAR;
|
||||||
|
|||||||
@@ -110,11 +110,12 @@ namespace OpenRCT2::Scripting
|
|||||||
|
|
||||||
for (size_t i = 0; i < enabledPermissions.size(); i++)
|
for (size_t i = 0; i < enabledPermissions.size(); i++)
|
||||||
{
|
{
|
||||||
auto toggle = (enabledPermissions[i] != (network_can_perform_action(groupIndex, (uint32_t)i) != 0));
|
auto toggle
|
||||||
|
= (enabledPermissions[i] != (network_can_perform_action(groupIndex, static_cast<uint32_t>(i)) != 0));
|
||||||
if (toggle)
|
if (toggle)
|
||||||
{
|
{
|
||||||
auto networkAction2 = NetworkModifyGroupAction(
|
auto networkAction2 = NetworkModifyGroupAction(
|
||||||
ModifyGroupType::SetPermissions, _id, "", (uint32_t)i, PermissionState::Toggle);
|
ModifyGroupType::SetPermissions, _id, "", static_cast<uint32_t>(i), PermissionState::Toggle);
|
||||||
GameActions::Execute(&networkAction2);
|
GameActions::Execute(&networkAction2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define LOCATION_NULL ((int16_t)(uint16_t)0x8000)
|
constexpr const int16_t LOCATION_NULL = -32768;
|
||||||
|
|
||||||
constexpr const int32_t COORDS_XY_STEP = 32;
|
constexpr const int32_t COORDS_XY_STEP = 32;
|
||||||
constexpr const int32_t COORDS_Z_STEP = 8;
|
constexpr const int32_t COORDS_Z_STEP = 8;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ protected:
|
|||||||
MemoryStream ms(encodedDataBuffer, encodedDataSize);
|
MemoryStream ms(encodedDataBuffer, encodedDataSize);
|
||||||
SawyerChunkReader reader(&ms);
|
SawyerChunkReader reader(&ms);
|
||||||
auto chunk = reader.ReadChunk();
|
auto chunk = reader.ReadChunk();
|
||||||
ASSERT_EQ((uint8_t)chunk->GetEncoding(), chdr_in.encoding);
|
ASSERT_EQ(static_cast<uint8_t>(chunk->GetEncoding()), chdr_in.encoding);
|
||||||
ASSERT_EQ(chunk->GetLength(), chdr_in.length);
|
ASSERT_EQ(chunk->GetLength(), chdr_in.length);
|
||||||
auto result = memcmp(chunk->GetData(), randomdata, sizeof(randomdata));
|
auto result = memcmp(chunk->GetData(), randomdata, sizeof(randomdata));
|
||||||
ASSERT_EQ(result, 0);
|
ASSERT_EQ(result, 0);
|
||||||
@@ -54,7 +54,7 @@ protected:
|
|||||||
MemoryStream ms(data, size);
|
MemoryStream ms(data, size);
|
||||||
SawyerChunkReader reader(&ms);
|
SawyerChunkReader reader(&ms);
|
||||||
auto chunk = reader.ReadChunk();
|
auto chunk = reader.ReadChunk();
|
||||||
ASSERT_EQ((uint8_t)chunk->GetEncoding(), chdr_in->encoding);
|
ASSERT_EQ(static_cast<uint8_t>(chunk->GetEncoding()), chdr_in->encoding);
|
||||||
ASSERT_EQ(chunk->GetLength(), sizeof(randomdata));
|
ASSERT_EQ(chunk->GetLength(), sizeof(randomdata));
|
||||||
auto result = memcmp(chunk->GetData(), randomdata, sizeof(randomdata));
|
auto result = memcmp(chunk->GetData(), randomdata, sizeof(randomdata));
|
||||||
ASSERT_EQ(result, 0);
|
ASSERT_EQ(result, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user