1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Move green light functions to struct methods

This commit is contained in:
Michael Steenbeek
2018-09-18 13:43:55 +02:00
committed by Gymnasiast
parent 897a2982a0
commit b965377080
6 changed files with 24 additions and 22 deletions

View File

@@ -61,7 +61,7 @@ static void ride_update_station_blocksection(Ride* ride, int32_t stationIndex)
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG;
if ((ride->station_depart[stationIndex] & STATION_DEPART_FLAG)
|| (tileElement != nullptr && tile_element_get_green_light(tileElement)))
|| (tileElement != nullptr && tileElement->AsTrack()->HasGreenLight()))
ride_invalidate_station_start(ride, stationIndex, false);
}
else
@@ -71,7 +71,7 @@ static void ride_update_station_blocksection(Ride* ride, int32_t stationIndex)
ride->station_depart[stationIndex] |= STATION_DEPART_FLAG;
ride_invalidate_station_start(ride, stationIndex, true);
}
else if (tileElement != nullptr && tile_element_get_green_light(tileElement))
else if (tileElement != nullptr && tileElement->AsTrack()->HasGreenLight())
{
ride_invalidate_station_start(ride, stationIndex, true);
}
@@ -298,7 +298,7 @@ static void ride_invalidate_station_start(Ride* ride, int32_t stationIndex, bool
if (tileElement == nullptr)
return;
tile_element_set_green_light(tileElement, greenLight);
tileElement->AsTrack()->SetHasGreenLight(greenLight);
// Invalidate map tile
map_invalidate_tile_zoom1(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8);

View File

@@ -2201,20 +2201,6 @@ void TrackElement::SetSeatRotation(uint8_t newSeatRotation)
colour |= (newSeatRotation << 4);
}
bool tile_element_get_green_light(const rct_tile_element* tileElement)
{
return (tileElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT) != 0;
}
void tile_element_set_green_light(rct_tile_element* tileElement, bool greenLight)
{
tileElement->properties.track.sequence &= ~MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT;
if (greenLight)
{
tileElement->properties.track.sequence |= MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT;
}
}
bool tile_element_is_taking_photo(const rct_tile_element* tileElement)
{
return (tileElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_TAKING_PHOTO_MASK) != 0;
@@ -2353,3 +2339,18 @@ void TrackElement::SetBrakeBoosterSpeed(uint8_t speed)
sequence &= ~0b11110000;
sequence |= ((speed >> 1) << 4);
}
uint8_t TrackElement::HasGreenLight() const
{
return (sequence & MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT) != 0;
}
void TrackElement::SetHasGreenLight(uint8_t greenLight)
{
sequence &= ~MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT;
if (greenLight)
{
sequence |= MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT;
}
}

View File

@@ -559,8 +559,6 @@ void game_command_set_brakes_speed(
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
bool track_element_is_booster(uint8_t rideType, uint8_t trackType);
bool track_element_has_speed_setting(uint8_t trackType);
bool tile_element_get_green_light(const rct_tile_element* tileElement);
void tile_element_set_green_light(rct_tile_element* tileElement, bool greenLight);
bool tile_element_is_taking_photo(const rct_tile_element* tileElement);
void tile_element_set_onride_photo_timeout(rct_tile_element* tileElement);
void tile_element_decrement_onride_photo_timout(rct_tile_element* tileElement);

View File

@@ -326,7 +326,7 @@ static void track_paint_util_draw_station_impl(
LocationXY16 position = session->MapPosition;
Ride* ride = get_ride(rideIndex);
const rct_ride_entrance_definition* entranceStyle = &RideEntranceDefinitions[ride->entrance_style];
const bool hasGreenLight = tile_element_get_green_light(tileElement);
const bool hasGreenLight = tileElement->AsTrack()->HasGreenLight();
bool hasFence;
uint32_t imageId;
@@ -531,7 +531,7 @@ void track_paint_util_draw_station_inverted(
LocationXY16 position = session->MapPosition;
Ride* ride = get_ride(rideIndex);
const rct_ride_entrance_definition* entranceStyle = &RideEntranceDefinitions[ride->entrance_style];
const bool hasGreenLight = tile_element_get_green_light(tileElement);
const bool hasGreenLight = tileElement->AsTrack()->HasGreenLight();
bool hasFence;
uint32_t imageId;

View File

@@ -408,7 +408,7 @@ static void paint_go_karts_station(
if (tileElement->AsTrack()->GetTrackType() == TRACK_ELEM_END_STATION)
{
const bool hasGreenLight = tile_element_get_green_light(tileElement);
const bool hasGreenLight = tileElement->AsTrack()->HasGreenLight();
switch (direction)
{

View File

@@ -281,6 +281,9 @@ public:
uint8_t GetBrakeBoosterSpeed() const;
void SetBrakeBoosterSpeed(uint8_t speed);
uint8_t HasGreenLight() const;
void SetHasGreenLight(uint8_t greenLight);
uint8_t GetSeatRotation() const;
void SetSeatRotation(uint8_t newSeatRotation);