mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Fix: RMG issues: 1) hota 2) assertions
This commit is contained in:
		| @@ -196,11 +196,27 @@ void CObjectClassesHandler::loadObjectEntry(const std::string & identifier, cons | ||||
|  | ||||
| 	//some mods redefine content handlers in the decoration.json in such way: | ||||
| 	//"core:sign" : { "types" : { "forgeSign" : { ... | ||||
| 	if (!obj->subObjects.count(id)) // DO NOT override | ||||
| 	static const std::vector<std::string> knownProblemObjects | ||||
| 	{ | ||||
| 		"hota.hota decorations:hotaPandoraBox" | ||||
| 		, "hota.hota decorations:hotaSubterreanGate" | ||||
| 	}; | ||||
| 	bool overrideForce = !obj->subObjects.count(id) || | ||||
| 	std::any_of(knownProblemObjects.begin(), knownProblemObjects.end(), [obj, id](const std::string & str) | ||||
| 	{ | ||||
| 		return str.compare(obj->subObjects[id]->subTypeName) == 0; | ||||
| 	}); | ||||
|  | ||||
| 	if (overrideForce) // DO NOT override mod handlers by default | ||||
| 	{ | ||||
| 		obj->subObjects[id] = handler; | ||||
| 		obj->subIds[convertedId] = id; | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		logGlobal->warn("Don't override handler %s in object %s(%d)::%s(%d) subTypeName : %s" | ||||
| 			, obj->handlerName, obj->identifier, obj->id, convertedId, id, obj->subObjects[id]->subTypeName); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| CObjectClassesHandler::ObjectContainter * CObjectClassesHandler::loadFromJson(const JsonNode & json, const std::string & name) | ||||
|   | ||||
| @@ -610,15 +610,16 @@ void CMapGenerator::createConnections2() | ||||
|  | ||||
| 				std::vector<int3> commonTiles; | ||||
|  | ||||
| 				//required for set_intersection | ||||
| 				boost::sort(tilesA); | ||||
| 				boost::sort(tilesB); | ||||
|  | ||||
| 				boost::set_intersection(tilesA, tilesB, std::back_inserter(commonTiles), [](const int3 &lhs, const int3 &rhs) -> bool | ||||
| 				auto lambda = [](const int3 & lhs, const int3 & rhs) -> bool | ||||
| 				{ | ||||
| 					//ignore z coordinate | ||||
| 					return lhs.x < rhs.x || lhs.y < rhs.y; | ||||
| 				}); | ||||
| 					//https://stackoverflow.com/questions/45966807/c-invalid-comparator-assert | ||||
| 					return std::tie(lhs.x, lhs.y) < std::tie(rhs.x, rhs.y); //ignore z coordinate | ||||
| 				}; | ||||
| 				//required for set_intersection | ||||
| 				boost::sort(tilesA, lambda); | ||||
| 				boost::sort(tilesB, lambda); | ||||
|  | ||||
| 				boost::set_intersection(tilesA, tilesB, std::back_inserter(commonTiles), lambda); | ||||
|  | ||||
| 				vstd::erase_if(commonTiles, [](const int3 &tile) -> bool | ||||
| 				{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user