1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Use std::span for peepAnimObjects, rename to new style

This commit is contained in:
ζeh Matt
2025-04-21 02:54:48 +03:00
parent b30e1b406b
commit 5eabdf8ec9
4 changed files with 9 additions and 8 deletions

View File

@@ -2276,7 +2276,7 @@ void UpdateFootpathsFromMapping(
pathToRailingsMap[entryIndex] = railingIndex;
}
const std::vector<std::string_view> peepAnimObjects = {
static constexpr auto kPeepAnimObjects = std::to_array<std::string_view>({
"rct2.peep_animations.guest",
"rct2.peep_animations.handyman",
"rct2.peep_animations.mechanic",
@@ -2292,11 +2292,11 @@ const std::vector<std::string_view> peepAnimObjects = {
"rct2.peep_animations.entertainer_roman",
"rct2.peep_animations.entertainer_sheriff",
"rct2.peep_animations.entertainer_snowman",
};
});
const std::vector<std::string_view>& GetLegacyPeepAnimationObjects()
std::span<const std::string_view> GetLegacyPeepAnimationObjects()
{
return peepAnimObjects;
return kPeepAnimObjects;
}
using AnimObjectConversionTable = std::map<RCT12PeepAnimationGroup, std::pair<ObjectEntryIndex, PeepAnimationGroup>>;

View File

@@ -14,8 +14,8 @@
#include <cstdint>
#include <optional>
#include <span>
#include <string_view>
#include <vector>
namespace OpenRCT2
{
@@ -48,7 +48,7 @@ void UpdateFootpathsFromMapping(
ObjectList& requiredObjects, ObjectEntryIndex& surfaceCount, ObjectEntryIndex& railingCount, ObjectEntryIndex entryIndex,
const OpenRCT2::RCT2::FootpathMapping* footpathMapping);
const std::vector<std::string_view>& GetLegacyPeepAnimationObjects();
std::span<const std::string_view> GetLegacyPeepAnimationObjects();
void ConvertPeepAnimationTypeToObjects(OpenRCT2::GameState_t& gameState);
std::string_view GetClimateObjectIdFromLegacyClimateType(OpenRCT2::RCT12::ClimateType);

View File

@@ -818,7 +818,7 @@ void RCT12AddDefaultObjects(ObjectList& objectList)
}
}
void AppendRequiredObjects(ObjectList& objectList, ObjectType objectType, const std::vector<std::string_view>& objectNames)
void AppendRequiredObjects(ObjectList& objectList, ObjectType objectType, std::span<const std::string_view> objectNames)
{
for (const auto& objectName : objectNames)
{

View File

@@ -21,6 +21,7 @@
#include "../world/tile_element/TileElementType.h"
#include "Limits.h"
#include <span>
#include <stdexcept>
#include <string>
#include <string_view>
@@ -1255,7 +1256,7 @@ std::string_view GetStationIdentifierFromStyle(uint8_t style);
uint8_t GetStationStyleFromIdentifier(u8string_view identifier);
std::optional<uint8_t> GetStyleFromMusicIdentifier(std::string_view identifier);
void RCT12AddDefaultObjects(ObjectList& objectList);
void AppendRequiredObjects(ObjectList& objectList, ObjectType objectType, const std::vector<std::string_view>& objectNames);
void AppendRequiredObjects(ObjectList& objectList, ObjectType objectType, std::span<const std::string_view> objectNames);
void AppendRequiredObjects(ObjectList& objectList, ObjectType objectType, const OpenRCT2::RCT12::EntryList& entryList);
bool IsUserStringID(StringId stringId);