1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-02-02 03:35:09 +01:00

Make var_02/_03 calculation methods private and static

This commit is contained in:
Michael Steenbeek
2017-09-14 14:30:09 +02:00
parent 4164d3aedd
commit a4802983c2
2 changed files with 74 additions and 72 deletions

View File

@@ -302,76 +302,6 @@ void RideObject::Load()
}
}
uint8 RideObject::CalculateVar02(rct_ride_entry_vehicle * vehicleEntry)
{
// 0x6DE90B
uint8 newVar02;
if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_HAS_SPECIAL_FRAMES)
{
newVar02 = vehicleEntry->special_frames;
}
else
{
if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_14))
{
if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_23 && vehicleEntry->var_11 != 6)
{
if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_7))
{
newVar02 = 4;
}
else
{
newVar02 = 2;
}
}
else
{
newVar02 = 1;
}
}
else
{
newVar02 = 32;
}
}
return newVar02;
}
uint8 RideObject::CalculateVar03(rct_ride_entry_vehicle * vehicleEntry)
{
uint8 newVar03;
if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_SWINGING)
{
if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_21) && !(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_27))
{
if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_25)
{
newVar03 = 3;
}
else
{
newVar03 = 5;
}
}
else if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_21) || !(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_27))
{
newVar03 = 7;
}
else
{
newVar03 = 13;
}
}
else
{
newVar03 = 1;
}
return newVar03;
}
void RideObject::Unload()
{
language_free_object_string(_legacyType.name);
@@ -533,3 +463,74 @@ void RideObject::PerformFixes()
_legacyType.enabledTrackPieces &= ~(1ULL << TRACK_SLOPE_STEEP);
}
}
uint8 RideObject::CalculateVar02(const rct_ride_entry_vehicle * vehicleEntry)
{
// 0x6DE90B
uint8 newVar02;
if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_HAS_SPECIAL_FRAMES)
{
newVar02 = vehicleEntry->special_frames;
}
else
{
if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_14))
{
if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_23 && vehicleEntry->var_11 != 6)
{
if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_7))
{
newVar02 = 4;
}
else
{
newVar02 = 2;
}
}
else
{
newVar02 = 1;
}
}
else
{
newVar02 = 32;
}
}
return newVar02;
}
uint8 RideObject::CalculateVar03(const rct_ride_entry_vehicle * vehicleEntry)
{
uint8 newVar03;
if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_SWINGING)
{
if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_21) && !(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_27))
{
if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_25)
{
newVar03 = 3;
}
else
{
newVar03 = 5;
}
}
else if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_21) || !(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_27))
{
newVar03 = 7;
}
else
{
newVar03 = 13;
}
}
else
{
newVar03 = 1;
}
return newVar03;
}

View File

@@ -39,8 +39,6 @@ public:
void ReadLegacy(IReadObjectContext * context, IStream * stream) override;
void Load() override;
uint8 CalculateVar02(rct_ride_entry_vehicle * vehicleEntry) override;
uint8 CalculateVar03(rct_ride_entry_vehicle * vehicleEntry) override;
void Unload() override;
void DrawPreview(rct_drawpixelinfo * dpi, sint32 width, sint32 height) const override;
@@ -53,4 +51,7 @@ public:
private:
void ReadLegacyVehicle(IReadObjectContext * context, IStream * stream, rct_ride_entry_vehicle * vehicle);
void PerformFixes();
static uint8 CalculateVar02(const rct_ride_entry_vehicle * vehicleEntry);
static uint8 CalculateVar03(const rct_ride_entry_vehicle * vehicleEntry);
};