1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-02 15:06:40 +00:00

is Hidden marker now takes a const RefId& instead of a string_view

This commit is contained in:
fteppe 2022-10-03 19:49:20 +02:00 committed by florent.teppe
parent 0d68735e23
commit 2f2e401559
7 changed files with 15 additions and 9 deletions

View file

@ -14,7 +14,7 @@ namespace MWLua
bool isMarker(const MWWorld::Ptr& ptr) bool isMarker(const MWWorld::Ptr& ptr)
{ {
return Misc::ResourceHelpers::isHiddenMarker(ptr.getCellRef().getRefId().getRefIdString()); return Misc::ResourceHelpers::isHiddenMarker(ptr.getCellRef().getRefId());
} }
std::string ptrToString(const MWWorld::Ptr& ptr) std::string ptrToString(const MWWorld::Ptr& ptr)

View file

@ -68,7 +68,7 @@ namespace MWLua
const ESM::RefId& id = ref->mRef.getRefId(); const ESM::RefId& id = ref->mRef.getRefId();
if (id == ESM::RefId::stringRefId("player")) if (id == ESM::RefId::stringRefId("player"))
return ESM::REC_INTERNAL_PLAYER; return ESM::REC_INTERNAL_PLAYER;
if (Misc::ResourceHelpers::isHiddenMarker(id.getRefIdString())) if (Misc::ResourceHelpers::isHiddenMarker(id))
return ESM::REC_INTERNAL_MARKER; return ESM::REC_INTERNAL_MARKER;
return ref->getType(); return ref->getType();
} }

View file

@ -599,7 +599,7 @@ namespace MWRender
continue; continue;
} }
if (Misc::ResourceHelpers::isHiddenMarker(ref.mRefID.getRefIdString())) if (Misc::ResourceHelpers::isHiddenMarker(ref.mRefID))
continue; continue;
int type = store.findStatic(ref.mRefID); int type = store.findStatic(ref.mRefID);

View file

@ -92,7 +92,7 @@ namespace
std::string getModel(const MWWorld::Ptr& ptr, const VFS::Manager* vfs) std::string getModel(const MWWorld::Ptr& ptr, const VFS::Manager* vfs)
{ {
if (Misc::ResourceHelpers::isHiddenMarker(ptr.getCellRef().getRefId().getRefIdString())) if (Misc::ResourceHelpers::isHiddenMarker(ptr.getCellRef().getRefId()))
return {}; return {};
bool useAnim = ptr.getClass().useAnim(); bool useAnim = ptr.getClass().useAnim();
std::string model = ptr.getClass().getModel(ptr); std::string model = ptr.getClass().getModel(ptr);

View file

@ -82,7 +82,7 @@ namespace EsmLoader
T record; T record;
bool deleted = false; bool deleted = false;
record.load(reader, deleted); record.load(reader, deleted);
if (Misc::ResourceHelpers::isHiddenMarker(record.mId.getRefIdString())) if (Misc::ResourceHelpers::isHiddenMarker(record.mId))
return; return;
records.emplace_back(deleted, std::move(record)); records.emplace_back(deleted, std::move(record));
} }

View file

@ -5,6 +5,7 @@
#include <string_view> #include <string_view>
#include <components/esm/common.hpp> #include <components/esm/common.hpp>
#include <components/esm/refid.hpp>
#include <components/misc/pathhelpers.hpp> #include <components/misc/pathhelpers.hpp>
#include <components/misc/strings/algorithm.hpp> #include <components/misc/strings/algorithm.hpp>
@ -157,10 +158,10 @@ std::string Misc::ResourceHelpers::correctSoundPath(std::string_view resPath, co
return vfs->normalizeFilename(resPath); return vfs->normalizeFilename(resPath);
} }
bool Misc::ResourceHelpers::isHiddenMarker(std::string_view id) bool Misc::ResourceHelpers::isHiddenMarker(const ESM::RefId& id)
{ {
return Misc::StringUtils::ciEqual(id, "prisonmarker") || Misc::StringUtils::ciEqual(id, "divinemarker") return id == ESM::RefId::stringRefId("prisonmarker") ||id == ESM::RefId::stringRefId("divinemarker")
|| Misc::StringUtils::ciEqual(id, "templemarker") || Misc::StringUtils::ciEqual(id, "northmarker"); || id == ESM::RefId::stringRefId("templemarker") || id == ESM::RefId::stringRefId("northmarker");
} }
namespace namespace

View file

@ -9,6 +9,11 @@ namespace VFS
class Manager; class Manager;
} }
namespace ESM
{
struct RefId;
}
namespace Misc namespace Misc
{ {
// Workarounds for messy resource handling in vanilla morrowind // Workarounds for messy resource handling in vanilla morrowind
@ -30,7 +35,7 @@ namespace Misc
std::string correctSoundPath(std::string_view resPath, const VFS::Manager* vfs); std::string correctSoundPath(std::string_view resPath, const VFS::Manager* vfs);
/// marker objects that have a hardcoded function in the game logic, should be hidden from the player /// marker objects that have a hardcoded function in the game logic, should be hidden from the player
bool isHiddenMarker(std::string_view id); bool isHiddenMarker(const ESM::RefId& id);
std::string getLODMeshName(int esmVersion, std::string resPath, const VFS::Manager* vfs, unsigned char lod = 0); std::string getLODMeshName(int esmVersion, std::string resPath, const VFS::Manager* vfs, unsigned char lod = 0);
} }
} }