From 14e0cc5e4acb4e6a07777bca319b06d54e8f150c Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Wed, 13 May 2020 23:01:03 -0300 Subject: [PATCH] Rename Peep::item_standard_flags to ItemStandardFlags --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/RideDemolishAction.hpp | 8 +-- src/openrct2/actions/SetCheatAction.hpp | 6 +-- src/openrct2/management/Marketing.cpp | 8 +-- src/openrct2/peep/Guest.cpp | 56 ++++++++++----------- src/openrct2/peep/GuestPathfinding.cpp | 4 +- src/openrct2/peep/Peep.cpp | 12 ++--- src/openrct2/peep/Peep.h | 4 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 12 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index d53290125b..229b50ea38 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -313,7 +313,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, hat_colour); COMPARE_FIELD(Peep, favourite_ride); COMPARE_FIELD(Peep, favourite_ride_rating); - COMPARE_FIELD(Peep, item_standard_flags); + COMPARE_FIELD(Peep, ItemStandardFlags); } void CompareSpriteDataVehicle( diff --git a/src/openrct2/actions/RideDemolishAction.hpp b/src/openrct2/actions/RideDemolishAction.hpp index 0bc5de3bef..1f85a68b4b 100644 --- a/src/openrct2/actions/RideDemolishAction.hpp +++ b/src/openrct2/actions/RideDemolishAction.hpp @@ -176,20 +176,20 @@ private: } // remove any free voucher for this ride from peep - if (peep->item_standard_flags & PEEP_ITEM_VOUCHER) + if (peep->ItemStandardFlags & PEEP_ITEM_VOUCHER) { if (peep->voucher_type == VOUCHER_TYPE_RIDE_FREE && peep->voucher_arguments == _rideIndex) { - peep->item_standard_flags &= ~(PEEP_ITEM_VOUCHER); + peep->ItemStandardFlags &= ~(PEEP_ITEM_VOUCHER); } } // remove any photos of this ride from peep - if (peep->item_standard_flags & PEEP_ITEM_PHOTO) + if (peep->ItemStandardFlags & PEEP_ITEM_PHOTO) { if (peep->photo1_ride_ref == _rideIndex) { - peep->item_standard_flags &= ~PEEP_ITEM_PHOTO; + peep->ItemStandardFlags &= ~PEEP_ITEM_PHOTO; } } if (peep->item_extra_flags & PEEP_ITEM_PHOTO2) diff --git a/src/openrct2/actions/SetCheatAction.hpp b/src/openrct2/actions/SetCheatAction.hpp index 40f858a4b5..a9e012aa34 100644 --- a/src/openrct2/actions/SetCheatAction.hpp +++ b/src/openrct2/actions/SetCheatAction.hpp @@ -633,15 +633,15 @@ private: peep->cash_in_pocket = MONEY(1000, 00); break; case OBJECT_PARK_MAP: - peep->item_standard_flags |= PEEP_ITEM_MAP; + peep->ItemStandardFlags |= PEEP_ITEM_MAP; break; case OBJECT_BALLOON: - peep->item_standard_flags |= PEEP_ITEM_BALLOON; + peep->ItemStandardFlags |= PEEP_ITEM_BALLOON; peep->balloon_colour = scenario_rand_max(COLOUR_COUNT - 1); peep->UpdateSpriteType(); break; case OBJECT_UMBRELLA: - peep->item_standard_flags |= PEEP_ITEM_UMBRELLA; + peep->ItemStandardFlags |= PEEP_ITEM_UMBRELLA; peep->umbrella_colour = scenario_rand_max(COLOUR_COUNT - 1); peep->UpdateSpriteType(); break; diff --git a/src/openrct2/management/Marketing.cpp b/src/openrct2/management/Marketing.cpp index 0f6fa1faa0..3b3caa930c 100644 --- a/src/openrct2/management/Marketing.cpp +++ b/src/openrct2/management/Marketing.cpp @@ -135,22 +135,22 @@ void marketing_set_guest_campaign(Peep* peep, int32_t campaignType) switch (campaign->Type) { case ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE: - peep->item_standard_flags |= PEEP_ITEM_VOUCHER; + peep->ItemStandardFlags |= PEEP_ITEM_VOUCHER; peep->voucher_type = VOUCHER_TYPE_PARK_ENTRY_FREE; break; case ADVERTISING_CAMPAIGN_RIDE_FREE: - peep->item_standard_flags |= PEEP_ITEM_VOUCHER; + peep->ItemStandardFlags |= PEEP_ITEM_VOUCHER; peep->voucher_type = VOUCHER_TYPE_RIDE_FREE; peep->voucher_arguments = campaign->RideId; peep->guest_heading_to_ride_id = campaign->RideId; peep->peep_is_lost_countdown = 240; break; case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE: - peep->item_standard_flags |= PEEP_ITEM_VOUCHER; + peep->ItemStandardFlags |= PEEP_ITEM_VOUCHER; peep->voucher_type = VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE; break; case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE: - peep->item_standard_flags |= PEEP_ITEM_VOUCHER; + peep->ItemStandardFlags |= PEEP_ITEM_VOUCHER; peep->voucher_type = VOUCHER_TYPE_FOOD_OR_DRINK_FREE; peep->voucher_arguments = campaign->ShopItemType; break; diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index fb704287e6..b27197d49f 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -446,10 +446,10 @@ void Guest::GivePassingPeepsPurpleClothes(Guest* passingPeep) void Guest::GivePassingPeepsPizza(Guest* passingPeep) { - if ((passingPeep->item_standard_flags & PEEP_ITEM_PIZZA)) + if ((passingPeep->ItemStandardFlags & PEEP_ITEM_PIZZA)) return; - passingPeep->item_standard_flags |= PEEP_ITEM_PIZZA; + passingPeep->ItemStandardFlags |= PEEP_ITEM_PIZZA; int32_t peepDirection = (sprite_direction >> 3) ^ 2; int32_t otherPeepOppositeDirection = passingPeep->sprite_direction >> 3; @@ -485,10 +485,10 @@ void Guest::GivePassingPeepsIceCream(Guest* passingPeep) { if (this == passingPeep) return; - if (passingPeep->item_standard_flags & PEEP_ITEM_ICE_CREAM) + if (passingPeep->ItemStandardFlags & PEEP_ITEM_ICE_CREAM) return; - passingPeep->item_standard_flags |= PEEP_ITEM_ICE_CREAM; + passingPeep->ItemStandardFlags |= PEEP_ITEM_ICE_CREAM; passingPeep->UpdateSpriteType(); } @@ -822,7 +822,7 @@ void Guest::Tick128UpdateGuest(int32_t index) } } - if ((scenario_rand() & 0xFFFF) <= ((item_standard_flags & PEEP_ITEM_MAP) ? 8192U : 2184U)) + if ((scenario_rand() & 0xFFFF) <= ((ItemStandardFlags & PEEP_ITEM_MAP) ? 8192U : 2184U)) { PickRideToGoOn(); } @@ -1085,12 +1085,12 @@ void Guest::Tick128UpdateGuest(int32_t index) int32_t chosen_food = bitscanforward(HasFoodStandardFlag()); if (chosen_food != -1) { - item_standard_flags &= ~(1 << chosen_food); + ItemStandardFlags &= ~(1 << chosen_food); uint8_t discard_container = peep_item_containers[chosen_food]; if (discard_container != 0xFF) { - item_standard_flags |= (1 << discard_container); + ItemStandardFlags |= (1 << discard_container); } window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; @@ -1108,7 +1108,7 @@ void Guest::Tick128UpdateGuest(int32_t index) if (discard_container >= 32) item_extra_flags |= (1 << (discard_container - 32)); else - item_standard_flags |= (1 << discard_container); + ItemStandardFlags |= (1 << discard_container); } window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; @@ -1320,7 +1320,7 @@ bool Guest::HasItem(int32_t peepItem) const { if (peepItem < 32) { - return item_standard_flags & (1u << peepItem); + return ItemStandardFlags & (1u << peepItem); } else { @@ -1330,7 +1330,7 @@ bool Guest::HasItem(int32_t peepItem) const int32_t Guest::HasFoodStandardFlag() const { - return item_standard_flags + return ItemStandardFlags & (PEEP_ITEM_DRINK | PEEP_ITEM_BURGER | PEEP_ITEM_CHIPS | PEEP_ITEM_ICE_CREAM | PEEP_ITEM_CANDYFLOSS | PEEP_ITEM_PIZZA | PEEP_ITEM_POPCORN | PEEP_ITEM_HOT_DOG | PEEP_ITEM_TENTACLE | PEEP_ITEM_TOFFEE_APPLE | PEEP_ITEM_DOUGHNUT | PEEP_ITEM_COFFEE | PEEP_ITEM_CHICKEN | PEEP_ITEM_LEMONADE); @@ -1347,7 +1347,7 @@ int32_t Guest::HasFoodExtraFlag() const bool Guest::HasDrinkStandardFlag() const { - return item_standard_flags & (PEEP_ITEM_DRINK | PEEP_ITEM_COFFEE | PEEP_ITEM_LEMONADE); + return ItemStandardFlags & (PEEP_ITEM_DRINK | PEEP_ITEM_COFFEE | PEEP_ITEM_LEMONADE); } bool Guest::HasDrinkExtraFlag() const @@ -1367,7 +1367,7 @@ bool Guest::HasDrink() const int32_t Guest::HasEmptyContainerStandardFlag() const { - return item_standard_flags + return ItemStandardFlags & (PEEP_ITEM_EMPTY_CAN | PEEP_ITEM_EMPTY_BURGER_BOX | PEEP_ITEM_EMPTY_CUP | PEEP_ITEM_RUBBISH | PEEP_ITEM_EMPTY_BOX | PEEP_ITEM_EMPTY_BOTTLE); } @@ -1481,7 +1481,7 @@ bool Guest::DecideAndBuyItem(Ride* ride, int32_t shopItem, money32 price) bool hasVoucher = false; - if ((item_standard_flags & PEEP_ITEM_VOUCHER) && (voucher_type == VOUCHER_TYPE_FOOD_OR_DRINK_FREE) + if ((ItemStandardFlags & PEEP_ITEM_VOUCHER) && (voucher_type == VOUCHER_TYPE_FOOD_OR_DRINK_FREE) && (voucher_arguments == shopItem)) { hasVoucher = true; @@ -1650,7 +1650,7 @@ loc_69B221: if (shopItem >= 32) item_extra_flags |= (1u << (shopItem - 32)); else - item_standard_flags |= (1u << shopItem); + ItemStandardFlags |= (1u << shopItem); if (shopItem == SHOP_ITEM_TSHIRT) tshirt_colour = ride->track_colour[0].main; @@ -1726,7 +1726,7 @@ loc_69B221: expenditure = static_cast(static_cast(expenditure) - 1); if (hasVoucher) { - item_standard_flags &= ~PEEP_ITEM_VOUCHER; + ItemStandardFlags &= ~PEEP_ITEM_VOUCHER; window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; } else if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) @@ -1869,7 +1869,7 @@ void Guest::PickRideToGoOn() window_invalidate_flags |= PEEP_INVALIDATE_PEEP_ACTION; // Make peep look at their map if they have one - if (item_standard_flags & PEEP_ITEM_MAP) + if (ItemStandardFlags & PEEP_ITEM_MAP) { ReadMap(); } @@ -1907,7 +1907,7 @@ std::bitset Guest::FindRidesToGoOn() // FIX Originally checked for a toy, likely a mistake and should be a map, // but then again this seems to only allow the peep to go on // rides they haven't been on before. - if (item_standard_flags & PEEP_ITEM_MAP) + if (ItemStandardFlags & PEEP_ITEM_MAP) { // Consider rides that peep hasn't been on yet for (auto& ride : GetRideManager()) @@ -2413,7 +2413,7 @@ void Guest::ReadMap() static bool peep_has_voucher_for_free_ride(Peep* peep, Ride* ride) { - return peep->item_standard_flags & PEEP_ITEM_VOUCHER && peep->voucher_type == VOUCHER_TYPE_RIDE_FREE + return peep->ItemStandardFlags & PEEP_ITEM_VOUCHER && peep->voucher_type == VOUCHER_TYPE_RIDE_FREE && peep->voucher_arguments == ride->id; } @@ -2634,7 +2634,7 @@ static void peep_update_ride_at_entrance_try_leave(Guest* peep) static bool peep_check_ride_price_at_entrance(Guest* peep, Ride* ride, money32 ridePrice) { - if ((peep->item_standard_flags & PEEP_ITEM_VOUCHER) && peep->voucher_type == VOUCHER_TYPE_RIDE_FREE + if ((peep->ItemStandardFlags & PEEP_ITEM_VOUCHER) && peep->voucher_type == VOUCHER_TYPE_RIDE_FREE && peep->voucher_arguments == peep->current_ride) return true; @@ -3160,7 +3160,7 @@ template static void peep_head_for_nearest_ride(Guest* peep, bool co } std::bitset rideConsideration; - if (!considerOnlyCloseRides && (peep->item_standard_flags & PEEP_ITEM_MAP)) + if (!considerOnlyCloseRides && (peep->ItemStandardFlags & PEEP_ITEM_MAP)) { // Consider all rides in the park for (const auto& ride : GetRideManager()) @@ -3857,10 +3857,10 @@ void Guest::UpdateRideFreeVehicleEnterRide(Ride* ride) money16 ridePrice = ride_get_price(ride); if (ridePrice != 0) { - if ((item_standard_flags & PEEP_ITEM_VOUCHER) && (voucher_type == VOUCHER_TYPE_RIDE_FREE) + if ((ItemStandardFlags & PEEP_ITEM_VOUCHER) && (voucher_type == VOUCHER_TYPE_RIDE_FREE) && (voucher_arguments == current_ride)) { - item_standard_flags &= ~PEEP_ITEM_VOUCHER; + ItemStandardFlags &= ~PEEP_ITEM_VOUCHER; window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; } else @@ -5337,7 +5337,7 @@ void Guest::UpdateWalking() if (pos_stnd != 32) { - item_standard_flags &= ~(1u << pos_stnd); + ItemStandardFlags &= ~(1u << pos_stnd); litterType = item_standard_litter[pos_stnd]; } else @@ -5916,7 +5916,7 @@ void Guest::UpdateUsingBin() // switched to scenario_rand as it is more reliable if ((scenario_rand() & 7) == 0) space_left_in_bin--; - item_standard_flags &= ~(1 << cur_container); + ItemStandardFlags &= ~(1 << cur_container); window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; UpdateSpriteType(); continue; @@ -5927,7 +5927,7 @@ void Guest::UpdateUsingBin() int32_t litterY = y + (scenario_rand() & 7) - 3; litter_create(litterX, litterY, z, scenario_rand() & 3, litterType); - item_standard_flags &= ~(1 << cur_container); + ItemStandardFlags &= ~(1 << cur_container); window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; UpdateSpriteType(); @@ -6855,11 +6855,11 @@ void Guest::UpdateSpriteType() } create_balloon(x, y, z + 9, balloon_colour, isBalloonPopped); } - item_standard_flags &= ~PEEP_ITEM_BALLOON; + ItemStandardFlags &= ~PEEP_ITEM_BALLOON; window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; } - if (climate_is_raining() && (item_standard_flags & PEEP_ITEM_UMBRELLA) && x != LOCATION_NULL) + if (climate_is_raining() && (ItemStandardFlags & PEEP_ITEM_UMBRELLA) && x != LOCATION_NULL) { CoordsXY loc = { x, y }; if (map_is_location_valid(loc.ToTileStart())) @@ -6886,7 +6886,7 @@ void Guest::UpdateSpriteType() { if (item_pref->type == 0) { - if (item_standard_flags & item_pref->item) + if (ItemStandardFlags & item_pref->item) { SetSpriteType(item_pref->sprite_type); return; diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 2046ddabdc..012109648e 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -455,7 +455,7 @@ static uint8_t peep_pathfind_get_max_number_junctions(Peep* peep) return 8; } - if (peep->item_standard_flags & PEEP_ITEM_MAP) + if (peep->ItemStandardFlags & PEEP_ITEM_MAP) return 7; if (peep->peep_flags & PEEP_FLAGS_LEAVING_PARK) @@ -2024,7 +2024,7 @@ int32_t guest_path_finding(Guest* peep) /* If there are still multiple directions to choose from, * peeps with maps will randomly read the map: probability of doing so * is much higher when heading for a ride or the park exit. */ - if (peep->item_standard_flags & PEEP_ITEM_MAP) + if (peep->ItemStandardFlags & PEEP_ITEM_MAP) { // If at least 2 directions consult map if (bitcount(edges) >= 2) diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 6cb641ad29..98fd83019e 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1758,7 +1758,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->pathfind_goal.y = 0xFF; peep->pathfind_goal.z = 0xFF; peep->pathfind_goal.direction = INVALID_DIRECTION; - peep->item_standard_flags = 0; + peep->ItemStandardFlags = 0; peep->item_extra_flags = 0; peep->guest_heading_to_ride_id = RIDE_ID_NULL; peep->litter_count = 0; @@ -2601,18 +2601,18 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl money16 entranceFee = park_get_entrance_fee(); if (entranceFee != 0) { - if (peep->item_standard_flags & PEEP_ITEM_VOUCHER) + if (peep->ItemStandardFlags & PEEP_ITEM_VOUCHER) { if (peep->voucher_type == VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE) { entranceFee /= 2; - peep->item_standard_flags &= ~PEEP_ITEM_VOUCHER; + peep->ItemStandardFlags &= ~PEEP_ITEM_VOUCHER; peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; } else if (peep->voucher_type == VOUCHER_TYPE_PARK_ENTRY_FREE) { entranceFee = 0; - peep->item_standard_flags &= ~PEEP_ITEM_VOUCHER; + peep->ItemStandardFlags &= ~PEEP_ITEM_VOUCHER; peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; } } @@ -3392,9 +3392,9 @@ void decrement_guests_heading_for_park() static void peep_release_balloon(Guest* peep, int16_t spawn_height) { - if (peep->item_standard_flags & PEEP_ITEM_BALLOON) + if (peep->ItemStandardFlags & PEEP_ITEM_BALLOON) { - peep->item_standard_flags &= ~PEEP_ITEM_BALLOON; + peep->ItemStandardFlags &= ~PEEP_ITEM_BALLOON; if (peep->sprite_type == PEEP_SPRITE_TYPE_BALLOON && peep->x != LOCATION_NULL) { diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index b643e3a796..6fed27d33c 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -403,7 +403,7 @@ enum PeepNauseaTolerance enum PeepItem { - // item_standard_flags + // ItemStandardFlags PEEP_ITEM_BALLOON = (1 << 0), PEEP_ITEM_TOY = (1 << 1), PEEP_ITEM_MAP = (1 << 2), @@ -747,7 +747,7 @@ struct Peep : SpriteBase uint8_t hat_colour; uint8_t favourite_ride; uint8_t favourite_ride_rating; - uint32_t item_standard_flags; + uint32_t ItemStandardFlags; public: // Peep Guest* AsGuest(); diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index b881f42780..5bd273095c 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1551,7 +1551,7 @@ private: dst->favourite_ride_rating = 0; } - dst->item_standard_flags = src->item_standard_flags; + dst->ItemStandardFlags = src->item_standard_flags; if (dst->type == PEEP_TYPE_GUEST) { diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 2b4c0f255e..799d4d763d 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1240,7 +1240,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->hat_colour = src->hat_colour; dst->favourite_ride = src->favourite_ride; dst->favourite_ride_rating = src->favourite_ride_rating; - dst->item_standard_flags = src->item_standard_flags; + dst->item_standard_flags = src->ItemStandardFlags; } void S6Exporter::ExportSpriteMisc(RCT12SpriteBase* cdst, const SpriteBase* csrc) diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index f88065df46..ad2e0f0a90 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1505,7 +1505,7 @@ public: dst->hat_colour = src->hat_colour; dst->favourite_ride = src->favourite_ride; dst->favourite_ride_rating = src->favourite_ride_rating; - dst->item_standard_flags = src->item_standard_flags; + dst->ItemStandardFlags = src->item_standard_flags; } void ImportSpriteMisc(SpriteBase* cdst, const RCT12SpriteBase* csrc) diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 45b56ed293..62a7f948dd 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -266,7 +266,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(hat_colour); COMPARE_FIELD(favourite_ride); COMPARE_FIELD(favourite_ride_rating); - COMPARE_FIELD(item_standard_flags); + COMPARE_FIELD(ItemStandardFlags); } static void CompareSpriteDataVehicle(const Vehicle& left, const Vehicle& right)