mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix type issues
This commit is contained in:
parent
23cf4b580e
commit
4ce425b436
|
@ -1130,7 +1130,7 @@ bool track_element_is_block_start(TileElement* trackElement)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t track_get_actual_bank(TileElement* tileElement, int32_t bank)
|
bank_type_t track_get_actual_bank(TileElement* tileElement, bank_type_t bank)
|
||||||
{
|
{
|
||||||
auto ride = get_ride(tileElement->AsTrack()->GetRideIndex());
|
auto ride = get_ride(tileElement->AsTrack()->GetRideIndex());
|
||||||
if (ride != nullptr)
|
if (ride != nullptr)
|
||||||
|
@ -1141,7 +1141,7 @@ int32_t track_get_actual_bank(TileElement* tileElement, int32_t bank)
|
||||||
return bank;
|
return bank;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t track_get_actual_bank_2(int32_t rideType, bool isInverted, int32_t bank)
|
bank_type_t track_get_actual_bank_2(int32_t rideType, bool isInverted, bank_type_t bank)
|
||||||
{
|
{
|
||||||
if (RideTypeDescriptors[rideType].Flags & RIDE_TYPE_FLAG_HAS_ALTERNATIVE_TRACK_TYPE)
|
if (RideTypeDescriptors[rideType].Flags & RIDE_TYPE_FLAG_HAS_ALTERNATIVE_TRACK_TYPE)
|
||||||
{
|
{
|
||||||
|
@ -1160,7 +1160,7 @@ int32_t track_get_actual_bank_2(int32_t rideType, bool isInverted, int32_t bank)
|
||||||
return bank;
|
return bank;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t track_get_actual_bank_3(bool useInvertedSprites, TileElement* tileElement)
|
bank_type_t track_get_actual_bank_3(bool useInvertedSprites, TileElement* tileElement)
|
||||||
{
|
{
|
||||||
auto trackType = tileElement->AsTrack()->GetTrackType();
|
auto trackType = tileElement->AsTrack()->GetTrackType();
|
||||||
auto bankStart = TrackDefinitions[trackType].bank_start;
|
auto bankStart = TrackDefinitions[trackType].bank_start;
|
||||||
|
|
|
@ -18,15 +18,17 @@ constexpr const uint16_t RideConstructionSpecialPieceSelected = 0x100;
|
||||||
constexpr const int32_t BLOCK_BRAKE_BASE_SPEED = 0x20364;
|
constexpr const int32_t BLOCK_BRAKE_BASE_SPEED = 0x20364;
|
||||||
|
|
||||||
using track_type_t = uint16_t;
|
using track_type_t = uint16_t;
|
||||||
|
using bank_type_t = uint8_t;
|
||||||
|
using vangle_type_t = uint8_t;
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct rct_trackdefinition
|
struct rct_trackdefinition
|
||||||
{
|
{
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint8_t vangle_end;
|
vangle_type_t vangle_end;
|
||||||
uint8_t vangle_start;
|
vangle_type_t vangle_start;
|
||||||
uint8_t bank_end;
|
bank_type_t bank_end;
|
||||||
uint8_t bank_start;
|
bank_type_t bank_start;
|
||||||
int8_t preview_z_offset;
|
int8_t preview_z_offset;
|
||||||
uint8_t pad[2] = {};
|
uint8_t pad[2] = {};
|
||||||
};
|
};
|
||||||
|
@ -35,14 +37,14 @@ assert_struct_size(rct_trackdefinition, 8);
|
||||||
|
|
||||||
struct VAngleAndBank
|
struct VAngleAndBank
|
||||||
{
|
{
|
||||||
uint8_t VAngle;
|
vangle_type_t VAngle;
|
||||||
uint8_t Bank;
|
bank_type_t Bank;
|
||||||
};
|
};
|
||||||
bool operator==(const VAngleAndBank& vb1, const VAngleAndBank& vb2)
|
constexpr bool operator==(const VAngleAndBank& vb1, const VAngleAndBank& vb2)
|
||||||
{
|
{
|
||||||
return vb1.VAngle == vb2.VAngle && vb1.Bank == vb2.Bank;
|
return vb1.VAngle == vb2.VAngle && vb1.Bank == vb2.Bank;
|
||||||
}
|
}
|
||||||
bool operator!=(const VAngleAndBank& vb1, const VAngleAndBank& vb2)
|
constexpr bool operator!=(const VAngleAndBank& vb1, const VAngleAndBank& vb2)
|
||||||
{
|
{
|
||||||
return !(vb1 == vb2);
|
return !(vb1 == vb2);
|
||||||
}
|
}
|
||||||
|
@ -573,9 +575,9 @@ bool track_element_is_block_start(TileElement* trackElement);
|
||||||
bool track_element_is_covered(int32_t trackElementType);
|
bool track_element_is_covered(int32_t trackElementType);
|
||||||
bool track_type_is_station(track_type_t trackType);
|
bool track_type_is_station(track_type_t trackType);
|
||||||
|
|
||||||
int32_t track_get_actual_bank(TileElement* tileElement, int32_t bank);
|
bank_type_t track_get_actual_bank(TileElement* tileElement, bank_type_t bank);
|
||||||
int32_t track_get_actual_bank_2(int32_t rideType, bool isInverted, int32_t bank);
|
bank_type_t track_get_actual_bank_2(int32_t rideType, bool isInverted, bank_type_t bank);
|
||||||
int32_t track_get_actual_bank_3(bool useInvertedSprites, TileElement* tileElement);
|
bank_type_t track_get_actual_bank_3(bool useInvertedSprites, TileElement* tileElement);
|
||||||
|
|
||||||
bool track_add_station_element(CoordsXYZD loc, ride_id_t rideIndex, int32_t flags, bool fromTrackDesign);
|
bool track_add_station_element(CoordsXYZD loc, ride_id_t rideIndex, int32_t flags, bool fromTrackDesign);
|
||||||
bool track_remove_station_element(int32_t x, int32_t y, int32_t z, Direction direction, ride_id_t rideIndex, int32_t flags);
|
bool track_remove_station_element(int32_t x, int32_t y, int32_t z, Direction direction, ride_id_t rideIndex, int32_t flags);
|
||||||
|
|
|
@ -7481,7 +7481,7 @@ static void vehicle_update_scenery_door(Vehicle* vehicle)
|
||||||
*/
|
*/
|
||||||
static VAngleAndBank VAngleAndBankStart(bool useInvertedSprites, TileElement* tileElement)
|
static VAngleAndBank VAngleAndBankStart(bool useInvertedSprites, TileElement* tileElement)
|
||||||
{
|
{
|
||||||
int32_t trackType = tileElement->AsTrack()->GetTrackType();
|
auto trackType = tileElement->AsTrack()->GetTrackType();
|
||||||
return VAngleAndBank{ TrackDefinitions[trackType].vangle_start, track_get_actual_bank_3(useInvertedSprites, tileElement) };
|
return VAngleAndBank{ TrackDefinitions[trackType].vangle_start, track_get_actual_bank_3(useInvertedSprites, tileElement) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8789,7 +8789,6 @@ loc_6DC476:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto vangleAndBankEnd = track_vangle_and_bank_end(GetTrackType());
|
|
||||||
tileElement = map_get_track_element_at_of_type_seq(TrackLocation, GetTrackType(), 0);
|
tileElement = map_get_track_element_at_of_type_seq(TrackLocation, GetTrackType(), 0);
|
||||||
int32_t direction;
|
int32_t direction;
|
||||||
{
|
{
|
||||||
|
@ -8805,7 +8804,8 @@ loc_6DC476:
|
||||||
direction = outDirection;
|
direction = outDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VAngleAndBankStart(HasUpdateFlag(VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES), tileElement) != vangleAndBankEnd)
|
if (VAngleAndBankStart(HasUpdateFlag(VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES), tileElement)
|
||||||
|
!= track_vangle_and_bank_end(GetTrackType()))
|
||||||
{
|
{
|
||||||
goto loc_6DC9BC;
|
goto loc_6DC9BC;
|
||||||
}
|
}
|
||||||
|
@ -8999,7 +8999,6 @@ loc_6DCA9A:
|
||||||
goto loc_6DCC2C;
|
goto loc_6DCC2C;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto vangleAndBankEnd = track_vangle_and_bank_end(GetTrackType());
|
|
||||||
tileElement = map_get_track_element_at_of_type_seq(TrackLocation, GetTrackType(), 0);
|
tileElement = map_get_track_element_at_of_type_seq(TrackLocation, GetTrackType(), 0);
|
||||||
{
|
{
|
||||||
track_begin_end trackBeginEnd;
|
track_begin_end trackBeginEnd;
|
||||||
|
@ -9012,7 +9011,8 @@ loc_6DCA9A:
|
||||||
tileElement = trackBeginEnd.begin_element;
|
tileElement = trackBeginEnd.begin_element;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VAngleAndBankStart(HasUpdateFlag(VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES), tileElement) != vangleAndBankEnd)
|
if (VAngleAndBankStart(HasUpdateFlag(VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES), tileElement)
|
||||||
|
!= track_vangle_and_bank_end(GetTrackType()))
|
||||||
{
|
{
|
||||||
goto loc_6DCD4A;
|
goto loc_6DCD4A;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue