From 0d60b87f3b0486c896cc1b0c5cc2a37d4e5687cc Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 31 Jan 2023 23:43:43 +0200 Subject: [PATCH] Fix assignment of hero type on object creation --- mapeditor/inspector/inspector.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mapeditor/inspector/inspector.cpp b/mapeditor/inspector/inspector.cpp index e575f660a..7dd6986f3 100644 --- a/mapeditor/inspector/inspector.cpp +++ b/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; } }