Change type of cur_test_track_location

This commit is contained in:
duncanspumpkin 2019-12-24 09:03:45 +00:00
parent c08958a705
commit 370a9b1113
5 changed files with 9 additions and 17 deletions

View File

@ -965,12 +965,11 @@ private:
if (src->cur_test_track_location.isNull())
{
dst->cur_test_track_location.setNull();
dst->cur_test_track_z = 0xFF;
}
else
{
dst->cur_test_track_location = { src->cur_test_track_location.x, src->cur_test_track_location.y };
dst->cur_test_track_z = src->cur_test_track_z / 2;
dst->cur_test_track_location = { src->cur_test_track_location.x, src->cur_test_track_location.y,
src->cur_test_track_z / 2 };
}
dst->testing_flags = src->testing_flags;
dst->current_test_segment = src->current_test_segment;

View File

@ -613,13 +613,12 @@ void S6Exporter::ExportRide(rct2_ride* dst, const Ride* src)
if (src->cur_test_track_location.isNull())
{
dst->cur_test_track_location.setNull();
dst->cur_test_track_z = 0xFF;
}
else
{
dst->cur_test_track_location = { static_cast<uint8_t>(src->cur_test_track_location.x),
static_cast<uint8_t>(src->cur_test_track_location.y) };
dst->cur_test_track_z = src->cur_test_track_z;
dst->cur_test_track_z = static_cast<uint8_t>(src->cur_test_track_location.z);
}
dst->turn_count_default = src->turn_count_default;

View File

@ -618,12 +618,11 @@ public:
if (src->cur_test_track_location.isNull())
{
dst->cur_test_track_location.setNull();
dst->cur_test_track_z = 0xFF;
}
else
{
dst->cur_test_track_location = { src->cur_test_track_location.x, src->cur_test_track_location.y };
dst->cur_test_track_z = src->cur_test_track_z;
dst->cur_test_track_location = { src->cur_test_track_location.x, src->cur_test_track_location.y,
src->cur_test_track_z };
}
dst->turn_count_default = src->turn_count_default;

View File

@ -264,9 +264,9 @@ struct Ride
fixed16_2dp previous_vertical_g;
fixed16_2dp previous_lateral_g;
uint32_t testing_flags;
// x y map location of the current track piece during a test
// x y z map location of the current track piece during a test
// this is to prevent counting special tracks multiple times
LocationXY8 cur_test_track_location;
TileCoordsXYZ cur_test_track_location;
// Next 3 variables are related (XXXX XYYY ZZZa aaaa)
uint16_t turn_count_default; // X = current turn count
uint16_t turn_count_banked;
@ -279,8 +279,6 @@ struct Ride
// Unused always 0? Should affect nausea
uint16_t var_11C;
uint8_t num_sheltered_sections; // (?abY YYYY)
// see cur_test_track_location
uint8_t cur_test_track_z;
// Customer counter in the current 960 game tick (about 30 seconds) interval
uint16_t cur_num_customers;
// Counts ticks to update customer intervals, resets each 960 game ticks.

View File

@ -1594,12 +1594,10 @@ static void vehicle_update_measurements(rct_vehicle* vehicle)
}
// If we have already evaluated this track piece skip to next section
uint16_t map_location = (vehicle->track_x / 32) | ((vehicle->track_y / 32) << 8);
TileCoordsXYZ curTrackLoc{ CoordsXYZ{ vehicle->track_x, vehicle->track_y, vehicle->track_z } };
if (curTrackLoc.z != ride->cur_test_track_z || map_location != ride->cur_test_track_location.xy)
if (curTrackLoc != ride->cur_test_track_location)
{
ride->cur_test_track_z = curTrackLoc.z;
ride->cur_test_track_location.xy = map_location;
ride->cur_test_track_location = curTrackLoc;
if (ride_get_entrance_location(ride, ride->current_test_station).isNull())
return;
@ -3076,7 +3074,6 @@ void vehicle_test_reset(rct_vehicle* vehicle)
ride->previous_lateral_g = 0;
ride->testing_flags = 0;
ride->cur_test_track_location.setNull();
ride->cur_test_track_z = 0xFF;
ride->turn_count_default = 0;
ride->turn_count_banked = 0;
ride->turn_count_sloped = 0;