1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-07 03:45:33 +00:00

Merge branch 'safecomplete' into 'master'

Only autocomplete string refids

See merge request OpenMW/openmw!2904
This commit is contained in:
psi29a 2023-04-08 15:12:56 +00:00
commit 7d86a56d22

View file

@ -107,22 +107,27 @@ namespace MWGui
scanner.listKeywords(mNames); scanner.listKeywords(mNames);
// identifier // identifier
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
std::vector<ESM::RefId> ids; std::vector<ESM::RefId> ids;
for (MWWorld::ESMStore::iterator it = store.begin(); it != store.end(); ++it) for (const auto* store : esmStore)
{ {
(*it)->listIdentifier(ids); store->listIdentifier(ids);
for (auto id : ids) for (auto id : ids)
{ {
visit(
[&](auto&& variant) {
using T = std::decay_t<decltype(variant)>;
if constexpr (std::is_same_v<T, ESM::StringRefId>)
mNames.push_back(id.getRefIdString()); mNames.push_back(id.getRefIdString());
},
id);
} }
ids.clear(); ids.clear();
} }
// exterior cell names aren't technically identifiers, but since the COC function accepts them, // exterior cell names aren't technically identifiers, but since the COC function accepts them,
// we should list them too // we should list them too
for (MWWorld::Store<ESM::Cell>::iterator it = store.get<ESM::Cell>().extBegin(); for (auto it = esmStore.get<ESM::Cell>().extBegin(); it != esmStore.get<ESM::Cell>().extEnd(); ++it)
it != store.get<ESM::Cell>().extEnd(); ++it)
{ {
if (!it->mName.empty()) if (!it->mName.empty())
mNames.push_back(it->mName); mNames.push_back(it->mName);