From 90143b2e387062e46819d16e84f8268139231f01 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Thu, 9 Jan 2025 12:34:45 +0100 Subject: [PATCH] Address review comments --- src/openrct2-ui/windows/Staff.cpp | 2 +- src/openrct2-ui/windows/StaffList.cpp | 1 - src/openrct2/EditorObjectSelectionSession.cpp | 1 - src/openrct2/object/PeepAnimationsObject.cpp | 5 ----- src/openrct2/park/ParkFile.cpp | 1 - src/openrct2/rct2/S6Importer.cpp | 1 - src/openrct2/scripting/bindings/entity/ScStaff.cpp | 3 --- 7 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 55b0ff0668..7a82fd97a8 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -800,7 +800,7 @@ namespace OpenRCT2::Ui::Windows auto numCostumes = _availableCostumes.size(); for (auto i = 0u; i < numCostumes; i++) { - // TODO: refactor this hack + // TODO: rework interface to dropdown arguments so memcpy won't be needed auto* nameStr = _availableCostumes[i].friendlyName.c_str(); std::memcpy(&gDropdownItems[i].Args, &nameStr, sizeof(const char*)); gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 2fd81fa4ce..e1f8cd013d 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -552,7 +552,6 @@ namespace OpenRCT2::Ui::Windows staffOrders = STAFF_ORDERS_INSPECT_RIDES | STAFF_ORDERS_FIX_RIDES; } - // Select a (random) costume for this staff member auto animPeepType = AnimationPeepType(static_cast(staffType) + 1); ObjectEntryIndex costume; if (staffType == StaffType::Entertainer) diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 8ae69fc4eb..4ffb6f6f71 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -250,7 +250,6 @@ void SetupInUseSelectionFlags() Editor::SetSelectedObject(ObjectType::Music, ride.music, ObjectSelectionFlags::InUse); } - // Figure out what peep animations are in use ObjectEntryIndex lastIndex = OBJECT_ENTRY_INDEX_NULL; for (auto* peep : EntityList()) { diff --git a/src/openrct2/object/PeepAnimationsObject.cpp b/src/openrct2/object/PeepAnimationsObject.cpp index f8488ef125..fd4288f6e6 100644 --- a/src/openrct2/object/PeepAnimationsObject.cpp +++ b/src/openrct2/object/PeepAnimationsObject.cpp @@ -81,7 +81,6 @@ void PeepAnimationsObject::ReadJson(IReadObjectContext* context, json_t& root) PeepAnimations group = ReadAnimations(requiredAnimationMap, groupJson["animations"]); - // Is this animation group replacing a legacy group? if (groupJson.contains("legacyPosition")) { auto position = Json::GetNumber(groupJson["legacyPosition"]); @@ -95,11 +94,7 @@ void PeepAnimationsObject::ReadJson(IReadObjectContext* context, json_t& root) group.legacyPosition = RCT12PeepAnimationGroup::Invalid; } - // Should we play back the walking animation more slowly? group.isSlowWalking = Json::GetBoolean(groupJson["isSlowWalking"], false); - - // Do we have a preferred way of addressing this object in scripts? - // If not, just use the object identifier. group.scriptName = Json::GetString(groupJson["scriptName"], std::string(GetIdentifier())); _animationGroups.push_back(group); diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index ff9f10f884..b6df72a670 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -387,7 +387,6 @@ namespace OpenRCT2 if (version < kPeepAnimationObjectsVersion) { - // Add all legacy peep animation objects auto animObjects = GetLegacyPeepAnimationObjects(requiredObjects); AppendRequiredObjects(requiredObjects, ObjectType::PeepAnimations, animObjects); } diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 87da509615..3f3b960d8a 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1905,7 +1905,6 @@ namespace OpenRCT2::RCT2 AppendRequiredObjects( objectList, ObjectType::ScenarioText, std::vector({ desc.textObjectId })); - // Add all legacy peep animation objects auto animObjects = GetLegacyPeepAnimationObjects(objectList); AppendRequiredObjects(objectList, ObjectType::PeepAnimations, animObjects); diff --git a/src/openrct2/scripting/bindings/entity/ScStaff.cpp b/src/openrct2/scripting/bindings/entity/ScStaff.cpp index 51937be074..852c7ccad5 100644 --- a/src/openrct2/scripting/bindings/entity/ScStaff.cpp +++ b/src/openrct2/scripting/bindings/entity/ScStaff.cpp @@ -166,7 +166,6 @@ namespace OpenRCT2::Scripting auto& costumes = costumesByStaffType(peep->AssignedStaffType); - // Find the peep's current costume in the list auto costume = std::find_if(costumes.begin(), costumes.end(), [peep](auto& candidate) { return candidate.objectId == peep->AnimationObjectIndex; }); @@ -195,14 +194,12 @@ namespace OpenRCT2::Scripting // Split by type passed so as to not break old plugins if (value.type() == DukValue::Type::STRING) { - // Find the peep's current costume by string costume = std::find_if(costumes.begin(), costumes.end(), [value](auto& candidate) { return candidate.scriptName == value.as_string(); }); } else if (value.type() == DukValue::Type::NUMBER) { - // Find the peep's current costume by legacy number auto target = RCT12PeepAnimationGroup(value.as_uint() + EnumValue(RCT12PeepAnimationGroup::EntertainerPanda)); costume = std::find_if( costumes.begin(), costumes.end(), [target](auto& candidate) { return candidate.legacyPosition == target; });