mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Load unknown objects as "Nothing" object
This commit is contained in:
		| @@ -405,6 +405,8 @@ public: | ||||
| 	enum Type | ||||
| 	{ | ||||
| 		NO_OBJ = -1, | ||||
|  | ||||
| 		NOTHING = 0, | ||||
| 		ALTAR_OF_SACRIFICE [[deprecated]] = 2, | ||||
| 		ANCHOR_POINT = 3, | ||||
| 		ARENA = 4, | ||||
|   | ||||
| @@ -116,6 +116,22 @@ void MapIdentifiersH3M::remapTemplate(ObjectTemplate & objectTemplate) | ||||
| 		objectTemplate.subid = mappedType.subID; | ||||
| 	} | ||||
|  | ||||
| 	if (VLC->objtypeh->knownObjects().count(objectTemplate.id) == 0) | ||||
| 	{ | ||||
| 		logGlobal->warn("Unknown object found: %d | %d", objectTemplate.id, objectTemplate.subid); | ||||
|  | ||||
| 		objectTemplate.id = Obj::NOTHING; | ||||
| 		objectTemplate.subid = {}; | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		if (VLC->objtypeh->knownSubObjects(objectTemplate.id).count(objectTemplate.subid) == 0) | ||||
| 		{ | ||||
| 			logGlobal->warn("Unknown subobject found: %d | %d", objectTemplate.id, objectTemplate.subid); | ||||
| 			objectTemplate.subid = {}; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if (objectTemplate.id == Obj::TOWN || objectTemplate.id == Obj::RANDOM_DWELLING_FACTION) | ||||
| 		objectTemplate.subid = remap(FactionID(objectTemplate.subid)); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user