diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index b40da1e82a..2e9570642b 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -251,7 +251,7 @@ void window_guest_list_refresh_list() for (auto peep : EntityList(SPRITE_LIST_PEEP)) { sprite_set_flashing(peep, false); - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) continue; if (_window_guest_list_selected_filter != -1) { @@ -950,7 +950,7 @@ static void window_guest_list_find_groups() { for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark == 0) + if (!peep->OutsideOfPark) { peep->flags |= SPRITE_FLAGS_PEEP_VISIBLE; } @@ -959,7 +959,7 @@ static void window_guest_list_find_groups() // For each guest / group for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark != 0 || !(peep->flags & SPRITE_FLAGS_PEEP_VISIBLE)) + if (peep->OutsideOfPark || !(peep->flags & SPRITE_FLAGS_PEEP_VISIBLE)) continue; // New group, cap at 240 though @@ -982,7 +982,7 @@ static void window_guest_list_find_groups() // Find more peeps that belong to same group for (auto peep2 : EntityList(SPRITE_LIST_PEEP)) { - if (peep2->OutsideOfPark != 0 || !(peep2->flags & SPRITE_FLAGS_PEEP_VISIBLE)) + if (peep2->OutsideOfPark || !(peep2->flags & SPRITE_FLAGS_PEEP_VISIBLE)) continue; // Get and check if in same group diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index 4082fddc63..ccdf936b52 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -167,7 +167,7 @@ private: newPeep->ActionSpriteType = PEEP_ACTION_SPRITE_TYPE_NONE; newPeep->PathCheckOptimisation = 0; newPeep->AssignedPeepType = PEEP_TYPE_STAFF; - newPeep->OutsideOfPark = 0; + newPeep->OutsideOfPark = false; newPeep->PeepFlags = 0; newPeep->PaidToEnter = 0; newPeep->PaidOnRides = 0; diff --git a/src/openrct2/management/Award.cpp b/src/openrct2/management/Award.cpp index c1090416d1..8623f8537d 100644 --- a/src/openrct2/management/Award.cpp +++ b/src/openrct2/management/Award.cpp @@ -86,7 +86,7 @@ static bool award_is_deserved_most_untidy(int32_t activeAwardTypes) uint32_t negativeCount = 0; for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) continue; if (peep->Thoughts[0].freshness > 5) @@ -115,7 +115,7 @@ static bool award_is_deserved_most_tidy(int32_t activeAwardTypes) uint32_t negativeCount = 0; for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) continue; if (peep->Thoughts[0].freshness > 5) @@ -196,7 +196,7 @@ static bool award_is_deserved_most_beautiful(int32_t activeAwardTypes) auto list = EntityList(SPRITE_LIST_PEEP); for (auto peep : list) { - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) continue; if (peep->Thoughts[0].freshness > 5) @@ -238,7 +238,7 @@ static bool award_is_deserved_safest([[maybe_unused]] int32_t activeAwardTypes) auto peepsWhoDislikeVandalism = 0; for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) continue; if (peep->Thoughts[0].freshness <= 5 && peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_VANDALISM) peepsWhoDislikeVandalism++; @@ -319,7 +319,7 @@ static bool award_is_deserved_best_food(int32_t activeAwardTypes) auto hungryPeeps = 0; for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) continue; if (peep->Thoughts[0].freshness <= 5 && peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_HUNGRY) @@ -363,7 +363,7 @@ static bool award_is_deserved_worst_food(int32_t activeAwardTypes) auto hungryPeeps = 0; for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) continue; if (peep->Thoughts[0].freshness <= 5 && peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_HUNGRY) @@ -393,7 +393,7 @@ static bool award_is_deserved_best_restrooms([[maybe_unused]] int32_t activeAwar auto guestsWhoNeedRestroom = 0; for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) continue; if (peep->Thoughts[0].freshness <= 5 && peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_TOILET) @@ -520,7 +520,7 @@ static bool award_is_deserved_most_confusing_layout([[maybe_unused]] int32_t act uint32_t peepsLost = 0; for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) continue; peepsCounted++; diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 2e61e6b33b..b20dbdf254 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -804,7 +804,7 @@ void Guest::Tick128UpdateGuest(int32_t index) } } - if (State == PEEP_STATE_WALKING && OutsideOfPark == 0 && !(PeepFlags & PEEP_FLAGS_LEAVING_PARK) && GuestNumRides == 0 + if (State == PEEP_STATE_WALKING && !OutsideOfPark && !(PeepFlags & PEEP_FLAGS_LEAVING_PARK) && GuestNumRides == 0 && GuestHeadingToRideId == RIDE_ID_NULL) { uint32_t time_duration = gScenarioTicks - TimeInPark; @@ -837,7 +837,7 @@ void Guest::Tick128UpdateGuest(int32_t index) * is executed to once every second time the encompassing * conditional executes. */ - if (OutsideOfPark == 0 && (State == PEEP_STATE_WALKING || State == PEEP_STATE_SITTING)) + if (!OutsideOfPark && (State == PEEP_STATE_WALKING || State == PEEP_STATE_SITTING)) { uint8_t num_thoughts = 0; PeepThoughtType possible_thoughts[5]; @@ -3073,7 +3073,7 @@ static void peep_decide_whether_to_leave_park(Peep* peep) peep->Thirst--; } - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) { return; } @@ -5672,7 +5672,7 @@ void Guest::UpdateEnteringPark() } SetState(PEEP_STATE_FALLING); - OutsideOfPark = 0; + OutsideOfPark = false; TimeInPark = gScenarioTicks; increment_guests_in_park(); decrement_guests_heading_for_park(); @@ -5702,7 +5702,7 @@ void Guest::UpdateLeavingPark() return; } - OutsideOfPark = 1; + OutsideOfPark = true; DestinationTolerance = 5; decrement_guests_in_park(); auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index e957f1a321..71914db0cf 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -1912,7 +1912,7 @@ int32_t guest_path_finding(Guest* peep) return guest_surface_path_finding(peep); } - if (peep->OutsideOfPark == 0 && peep->HeadingForRideOrParkExit()) + if (!peep->OutsideOfPark && peep->HeadingForRideOrParkExit()) { /* If this tileElement is adjacent to any non-wide paths, * remove all of the edges to wide paths. */ @@ -1970,7 +1970,7 @@ int32_t guest_path_finding(Guest* peep) // Peep is outside the park. // loc_694F19: - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) { #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 570e365905..b4ff9f3ad6 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -846,7 +846,7 @@ void Peep::Remove() { if (AssignedPeepType == PEEP_TYPE_GUEST) { - if (OutsideOfPark == 0) + if (!OutsideOfPark) { decrement_guests_in_park(); auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); @@ -1178,7 +1178,7 @@ void peep_problem_warnings_update() for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark != 0 || peep->Thoughts[0].freshness > 5) + if (peep->OutsideOfPark || peep->Thoughts[0].freshness > 5) continue; switch (peep->Thoughts[0].type) @@ -1419,7 +1419,7 @@ void peep_applause() { for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark != 0) + if (peep->OutsideOfPark) continue; // Release balloon @@ -1447,7 +1447,7 @@ void peep_update_days_in_queue() { for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark == 0 && peep->State == PEEP_STATE_QUEUING) + if (!peep->OutsideOfPark && peep->State == PEEP_STATE_QUEUING) { if (peep->DaysInQueue < 255) { @@ -1593,7 +1593,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) Peep* peep = &create_sprite(SPRITE_IDENTIFIER_PEEP)->peep; peep->sprite_identifier = SPRITE_IDENTIFIER_PEEP; peep->SpriteType = PEEP_SPRITE_TYPE_NORMAL; - peep->OutsideOfPark = 1; + peep->OutsideOfPark = true; peep->State = PEEP_STATE_FALLING; peep->Action = PEEP_ACTION_NONE_2; peep->SpecialSprite = 0; @@ -2752,7 +2752,7 @@ static void peep_interact_with_path(Peep* peep, int16_t x, int16_t y, TileElemen int16_t z = tile_element->GetBaseZ(); if (map_is_location_owned({ x, y, z })) { - if (peep->OutsideOfPark == 1) + if (peep->OutsideOfPark) { peep_return_to_centre_of_tile(peep); return; @@ -2760,7 +2760,7 @@ static void peep_interact_with_path(Peep* peep, int16_t x, int16_t y, TileElemen } else { - if (peep->OutsideOfPark == 0) + if (!peep->OutsideOfPark) { peep_return_to_centre_of_tile(peep); return; @@ -3043,7 +3043,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result) if (map_is_edge(newLoc)) { - if (OutsideOfPark == 1) + if (OutsideOfPark) { pathing_result |= PATHING_OUTSIDE_PARK; } diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 034755cc86..e001a44680 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -600,7 +600,7 @@ struct Peep : SpriteBase char* Name; CoordsXYZ NextLoc; uint8_t NextFlags; - uint8_t OutsideOfPark; + bool OutsideOfPark; PeepState State; uint8_t SubState; PeepSpriteType SpriteType; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 165504f652..eb7e261063 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1414,7 +1414,7 @@ private: dst->SetName(GetUserString(src->name_string_idx)); } - dst->OutsideOfPark = src->outside_of_park; + dst->OutsideOfPark = static_cast(src->outside_of_park); dst->State = static_cast(src->state); dst->SubState = src->sub_state; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 225090e65f..9574f1c64e 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1137,7 +1137,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->next_y = src->NextLoc.y; dst->next_z = src->NextLoc.z / COORDS_Z_STEP; dst->next_flags = src->NextFlags; - dst->outside_of_park = src->OutsideOfPark; + dst->outside_of_park = static_cast(src->OutsideOfPark); dst->state = static_cast(src->State); dst->sub_state = src->SubState; dst->sprite_type = static_cast(src->SpriteType); diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 48dfe382f2..633c6e6faf 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1418,7 +1418,7 @@ public: } dst->NextLoc = { src->next_x, src->next_y, src->next_z * COORDS_Z_STEP }; dst->NextFlags = src->next_flags; - dst->OutsideOfPark = src->outside_of_park; + dst->OutsideOfPark = static_cast(src->outside_of_park); dst->State = static_cast(src->state); dst->SubState = src->sub_state; dst->SpriteType = static_cast(src->sprite_type); diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 8abca3861d..2d756f26cd 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -5238,7 +5238,7 @@ void Vehicle::KillPassengers(Ride* curRide) for (auto i = 0; i < num_peeps; i++) { Peep* curPeep = GET_PEEP(peep[i]); - if (curPeep->OutsideOfPark == 0) + if (!curPeep->OutsideOfPark) { decrement_guests_in_park(); auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index bee72d557d..3fb6a1ac6b 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -387,7 +387,7 @@ int32_t Park::CalculateParkRating() const uint32_t lostGuestCount = 0; for (auto peep : EntityList(SPRITE_LIST_PEEP)) { - if (peep->OutsideOfPark == 0) + if (!peep->OutsideOfPark) { if (peep->Happiness > 128) { diff --git a/test/tests/Pathfinding.cpp b/test/tests/Pathfinding.cpp index 33f91c772f..8d1c9825bf 100644 --- a/test/tests/Pathfinding.cpp +++ b/test/tests/Pathfinding.cpp @@ -72,7 +72,7 @@ protected: // Peeps that are outside of the park use specialized pathfinding which we don't want to // use here - peep->OutsideOfPark = 0; + peep->OutsideOfPark = false; // An earlier iteration of this code just gave peeps a target position to walk to, but it turns out // that with no actual ride to head towards, when a peep reaches a junction they use the 'aimless'