#ifndef OPENMW_MWCLASS_NAMEORID_H #define OPENMW_MWCLASS_NAMEORID_H #include #include "../mwworld/livecellref.hpp" #include "../mwworld/ptr.hpp" #include namespace MWClass { template std::string_view getNameOrId(const MWWorld::ConstPtr& ptr) { const MWWorld::LiveCellRef* ref = ptr.get(); if (!ref->mBase->mName.empty()) return ref->mBase->mName; if (const auto* id = ref->mBase->mId.template getIf()) return id->getValue(); return {}; } } #endif