1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

Fixes identifiers resolving for json serialization

This commit is contained in:
Ivan Savenko
2022-12-06 16:26:32 +02:00
parent 34cd856f53
commit 65f9a1ffd2
2 changed files with 10 additions and 7 deletions

View File

@ -209,8 +209,7 @@ std::vector<CIdentifierStorage::ObjectData> CIdentifierStorage::getPossibleIdent
// called have not specified destination mod explicitly
if (request.remoteScope.empty())
{
// FIXME: temporary, for queries from map loader allow access to any identifer
// should be changed to list of mods that are marked as required by current map
// "map" is special scope that should have access to all in-game objects
if (request.localScope == "map")
{
for (auto const & modName : VLC->modh->getActiveMods())
@ -234,12 +233,16 @@ std::vector<CIdentifierStorage::ObjectData> CIdentifierStorage::getPossibleIdent
else
{
//if destination mod was specified explicitly, restrict lookup to this mod
if(request.remoteScope == "core" )
{
//"core" mod is an implicit dependency for all mods, allow access into it
allowedScopes.insert(request.remoteScope);
}
else if ( request.localScope == "map" )
{
// allow access, "map" is special scope that should have access to all in-game objects
allowedScopes.insert(request.remoteScope);
}
else if(request.remoteScope == request.localScope )
{
// allow self-access