Jelajahi Sumber

Fix assignment of hero type on object creation

Ivan Savenko 2 tahun lalu
induk
melakukan
0d60b87f3b
1 mengubah file dengan 4 tambahan dan 3 penghapusan
  1. 4 3
      mapeditor/inspector/inspector.cpp

+ 4 - 3
mapeditor/inspector/inspector.cpp

@@ -109,7 +109,8 @@ void Initializer::initialize(CGLighthouse * o)
 
 void Initializer::initialize(CGHeroInstance * o)
 {
-	if(!o) return;
+	if(!o)
+		return;
 	
 	o->tempOwner = defaultPlayer;
 	if(o->ID == Obj::PRISON)
@@ -119,9 +120,9 @@ void Initializer::initialize(CGHeroInstance * o)
 	{
 		for(auto t : VLC->heroh->objects)
 		{
-			if(t->heroClass == VLC->heroh->classes.objects[o->subID].get())
+			if(t->heroClass->getId() == HeroClassID(o->subID))
 			{
-				o->type = VLC->heroh->objects[o->subID];
+				o->type = t;
 				break;
 			}
 		}