浏览代码

attempt to fix hero placeholder while reading h3m

godric3 1 年之前
父节点
当前提交
cda66c4196
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      lib/mapObjectConstructors/CObjectClassesHandler.cpp
  2. 1 1
      mapeditor/inspector/inspector.cpp

+ 1 - 1
lib/mapObjectConstructors/CObjectClassesHandler.cpp

@@ -343,7 +343,7 @@ TObjectTypeHandler CObjectClassesHandler::getHandlerFor(MapObjectID type, MapObj
 			return objects.front()->objects.front();
 
 		auto subID = subtype.getNum();
-		if (type == Obj::PRISON)
+		if (type == Obj::PRISON || type == Obj::HERO_PLACEHOLDER)
 			subID = 0;
 		auto result = objects.at(type.getNum())->objects.at(subID);
 

+ 1 - 1
mapeditor/inspector/inspector.cpp

@@ -475,7 +475,7 @@ void Inspector::updateProperties()
 	addProperty("TypeName", obj->typeName);
 	addProperty("SubTypeName", obj->subTypeName);
 	
-	if(!dynamic_cast<CGHeroInstance*>(obj))
+	if(!dynamic_cast<CGHeroInstance*>(obj) && obj->ID != Obj::HERO_PLACEHOLDER)
 	{
 		auto factory = VLC->objtypeh->getHandlerFor(obj->ID, obj->subID);
 		addProperty("IsStatic", factory->isStaticObject());