1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Moved object type randomization to object class

This commit is contained in:
Ivan Savenko
2023-10-25 13:50:11 +03:00
parent 03e1169781
commit dcb8f4fc7b
17 changed files with 288 additions and 366 deletions

View File

@@ -571,6 +571,17 @@ void CGHeroInstance::SecondarySkillsInfo::resetWisdomCounter()
wisdomCounter = 1;
}
void CGHeroInstance::pickRandomObject(CRandomGenerator & rand)
{
assert(ID == Obj::HERO || ID == Obj::PRISON || ID == Obj::RANDOM_HERO);
if (ID == Obj::RANDOM_HERO)
{
ID = Obj::HERO;
subID = cb->gameState()->pickNextHeroType(getOwner());
}
}
void CGHeroInstance::initObj(CRandomGenerator & rand)
{
if(!type)