1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Cleanup and formatting of H3M loader code

This commit is contained in:
Ivan Savenko
2023-04-03 15:02:15 +03:00
parent 3738171b21
commit f93335d678
5 changed files with 110 additions and 110 deletions

View File

@ -1394,11 +1394,16 @@ void CGArtifact::serializeJsonOptions(JsonSerializeFormat& handler)
void CGWitchHut::initObj(CRandomGenerator & rand)
{
if (allowedAbilities.empty()) //this can happen for RMG. regular maps load abilities from map file
if (allowedAbilities.empty()) //this can happen for RMG and RoE maps.
{
// Necromancy can't be learned on random maps
for(int i = 0; i < VLC->skillh->size(); i++)
if(VLC->skillh->getByIndex(i)->getId() != SecondarySkill::NECROMANCY)
auto defaultAllowed = VLC->skillh->getDefaultAllowed();
// Necromancy and Leadership can't be learned by default
defaultAllowed[SecondarySkill::NECROMANCY] = false;
defaultAllowed[SecondarySkill::LEADERSHIP] = false;
for(int i = 0; i < defaultAllowed.size(); i++)
if (defaultAllowed[i])
allowedAbilities.insert(i);
}
ability = *RandomGeneratorUtil::nextItem(allowedAbilities, rand);