فهرست منبع

CGHeroInstance::setType: fix to give proper subID to random heroes

Hero class id is used to determine hero object appearance, but after than we use subID to store it's unique id.
This change should fix issues 2127 and 2277 since random heroes not going to override others in heroesPool.
Arseniy Shestakov 9 سال پیش
والد
کامیت
635c48f889
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      lib/mapObjects/CGHeroInstance.cpp

+ 2 - 1
lib/mapObjects/CGHeroInstance.cpp

@@ -255,7 +255,8 @@ void CGHeroInstance::setType(si32 ID, si32 subID)
 	assert(ID == Obj::HERO); // just in case
 	type = VLC->heroh->heroes[subID];
 	portrait = type->imageIndex;
-	CGObjectInstance::setType(ID, type->heroClass->id);
+	CGObjectInstance::setType(ID, type->heroClass->id); // to find object handler we must use heroClass->id
+	this->subID = subID; // after setType subID used to store unique hero identify id. Check issue 2277 for details
 	randomizeArmy(type->heroClass->faction);
 }