فهرست منبع

Cleared up comments

Ivan Savenko 3 سال پیش
والد
کامیت
79c96e94fa
2فایلهای تغییر یافته به همراه11 افزوده شده و 2 حذف شده
  1. 8 2
      lib/CModHandler.cpp
  2. 3 0
      lib/mapObjects/CommonConstructors.cpp

+ 8 - 2
lib/CModHandler.cpp

@@ -206,8 +206,11 @@ std::vector<CIdentifierStorage::ObjectData> CIdentifierStorage::getPossibleIdent
 	std::set<std::string> allowedScopes;
 	bool isValidScope = true;
 
+	// 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
 		if (request.localScope == "map")
 		{
 			for (auto const & modName : VLC->modh->getActiveMods())
@@ -221,13 +224,16 @@ std::vector<CIdentifierStorage::ObjectData> CIdentifierStorage::getPossibleIdent
 
 			if(!isValidScope)
 				return std::vector<ObjectData>();
+
+			allowedScopes.insert(request.localScope);
 		}
-		allowedScopes.insert(request.localScope);
+
+		// all mods can access built-in mod
 		allowedScopes.insert("core");
 	}
 	else
 	{
-		//...unless destination mod was specified explicitly
+		//if destination mod was specified explicitly, restrict lookup to this mod
 
 		if(request.remoteScope == "core" )
 		{

+ 3 - 0
lib/mapObjects/CommonConstructors.cpp

@@ -44,6 +44,9 @@ void CTownInstanceConstructor::initTypeData(const JsonNode & input)
 	});
 
 	filtersJson = input["filters"];
+
+	// change scope of "filters" to scope of object that is being loaded
+	// since this filters require to resolve building ID's
 	filtersJson.setMeta(input["faction"].meta);
 }