Increase size of ride_id_t to 16 bits

This commit is contained in:
Michael Steenbeek 2020-02-16 22:21:17 +01:00 committed by GitHub
parent 38907fd0c7
commit 1690361b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 26 deletions

View File

@ -297,7 +297,7 @@ private:
if (it.element->GetType() != TILE_ELEMENT_TYPE_TRACK)
continue;
if (it.element->AsTrack()->GetRideIndex() != (ride_idnew_t)_rideIndex)
if (it.element->AsTrack()->GetRideIndex() != (ride_id_t)_rideIndex)
continue;
int32_t x = it.x * 32, y = it.y * 32;

View File

@ -114,7 +114,7 @@ template<typename T, size_t _TypeID> struct NetworkObjectId_t
// NOTE: When adding new types make sure to have no duplicate _TypeID's otherwise
// there is no way to specialize templates if they have the exact symbol.
using NetworkPlayerId_t = NetworkObjectId_t<int32_t, 0>;
using NetworkRideId_t = NetworkObjectId_t<ride_idnew_t, 1>;
using NetworkRideId_t = NetworkObjectId_t<ride_id_t, 1>;
using NetworkCheatType_t = NetworkObjectId_t<int32_t, 2>;
enum NetworkStatisticsGroup

View File

@ -43,7 +43,6 @@ struct Staff;
#define RIDE_TYPE_NULL 255
#define RIDE_ADJACENCY_CHECK_DISTANCE 5
constexpr ride_id_t RIDE_ID_NULL = std::numeric_limits<ride_id_t>::max();
constexpr uint16_t const MAX_INVERSIONS = RCT12_MAX_INVERSIONS;
constexpr uint16_t const MAX_GOLF_HOLES = RCT12_MAX_GOLF_HOLES;
constexpr uint16_t const MAX_HELICES = RCT12_MAX_HELICES;

View File

@ -10,9 +10,10 @@
#pragma once
#include <cstdint>
#include <limits>
typedef uint8_t ride_id_t;
typedef uint16_t ride_idnew_t; // Temporary, old one can be removed after switching save format.
using ride_id_t = uint16_t;
struct Ride;
constexpr const ride_idnew_t RideIdNewNull = 0xFFFF;
constexpr const ride_id_t RIDE_ID_NULL = 0xFF; // std::numeric_limits<ride_id_t>::max();
constexpr const ride_id_t RideIdNewNull = std::numeric_limits<ride_id_t>::max();

View File

@ -1325,12 +1325,12 @@ void TrackElement::SetDoorBState(uint8_t newState)
ColourScheme |= ((newState << 5) & TRACK_ELEMENT_COLOUR_DOOR_B_MASK);
}
ride_idnew_t TrackElement::GetRideIndex() const
ride_id_t TrackElement::GetRideIndex() const
{
return RideIndex;
}
void TrackElement::SetRideIndex(ride_idnew_t newRideIndex)
void TrackElement::SetRideIndex(ride_id_t newRideIndex)
{
RideIndex = newRideIndex;
}

View File

@ -2682,15 +2682,12 @@ static void vehicle_update_waiting_to_depart(Vehicle* vehicle)
}
}
#pragma pack(push, 1)
struct rct_synchronised_vehicle
{
ride_id_t ride_id;
uint8_t station_id;
uint16_t vehicle_id;
};
assert_struct_size(rct_synchronised_vehicle, 4);
#pragma pack(pop)
constexpr int32_t SYNCHRONISED_VEHICLE_COUNT = 16;

View File

@ -234,12 +234,12 @@ void EntranceElement::SetEntranceType(uint8_t newType)
entranceType = newType;
}
ride_idnew_t EntranceElement::GetRideIndex() const
ride_id_t EntranceElement::GetRideIndex() const
{
return rideIndex;
}
void EntranceElement::SetRideIndex(ride_idnew_t newRideIndex)
void EntranceElement::SetRideIndex(ride_id_t newRideIndex)
{
rideIndex = newRideIndex;
}

View File

@ -189,7 +189,7 @@ private:
union
{
uint8_t additionStatus; // 7
ride_id_t rideIndex;
uint8_t rideIndex;
};
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
@ -287,7 +287,7 @@ private:
};
};
uint8_t Flags2;
ride_idnew_t RideIndex;
ride_id_t RideIndex;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
uint8_t pad[3];
@ -300,8 +300,8 @@ public:
uint8_t GetSequenceIndex() const;
void SetSequenceIndex(uint8_t newSequenceIndex);
ride_idnew_t GetRideIndex() const;
void SetRideIndex(ride_idnew_t newRideIndex);
ride_id_t GetRideIndex() const;
void SetRideIndex(ride_id_t newRideIndex);
uint8_t GetColourScheme() const;
void SetColourScheme(uint8_t newColourScheme);
@ -470,11 +470,11 @@ assert_struct_size(WallElement, 16);
struct EntranceElement : TileElementBase
{
private:
uint8_t entranceType; // 4
uint8_t SequenceIndex; // 5. Only uses the lower nibble.
uint8_t StationIndex; // 6
uint8_t pathType; // 7
ride_idnew_t rideIndex; // 8
uint8_t entranceType; // 4
uint8_t SequenceIndex; // 5. Only uses the lower nibble.
uint8_t StationIndex; // 6
uint8_t pathType; // 7
ride_id_t rideIndex; // 8
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
uint8_t pad_0A[6];
@ -484,8 +484,8 @@ public:
uint8_t GetEntranceType() const;
void SetEntranceType(uint8_t newType);
ride_idnew_t GetRideIndex() const;
void SetRideIndex(ride_idnew_t newRideIndex);
ride_id_t GetRideIndex() const;
void SetRideIndex(ride_id_t newRideIndex);
uint8_t GetStationIndex() const;
void SetStationIndex(uint8_t newStationIndex);

View File

@ -305,12 +305,12 @@ uint8_t TrackElement::GetDoorBState() const
return (ColourScheme & TRACK_ELEMENT_COLOUR_DOOR_B_MASK) >> 5;
}
ride_idnew_t TrackElement::GetRideIndex() const
ride_id_t TrackElement::GetRideIndex() const
{
return RideIndex;
}
void TrackElement::SetRideIndex(ride_idnew_t newRideIndex)
void TrackElement::SetRideIndex(ride_id_t newRideIndex)
{
RideIndex = newRideIndex;
}