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

basic 8th creature support

This commit is contained in:
Laserlicht
2024-08-05 21:15:47 +02:00
parent c1c04b3eb4
commit 1a06a2cc44
9 changed files with 41 additions and 34 deletions

View File

@ -514,16 +514,16 @@ void CGTownInstance::initObj(vstd::RNG & rand) ///initialize town structures
blockVisit = true;
if(townEnvisagesBuilding(BuildingSubID::PORTAL_OF_SUMMONING)) //Dungeon for example
creatures.resize(GameConstants::CREATURES_PER_TOWN + 1);
creatures.resize(town->creatures.size() + 1);
else
creatures.resize(GameConstants::CREATURES_PER_TOWN);
creatures.resize(town->creatures.size());
for (int level = 0; level < GameConstants::CREATURES_PER_TOWN; level++)
for (int level = 0; level < town->creatures.size(); level++)
{
BuildingID buildID = BuildingID(BuildingID::DWELL_FIRST + level);
int upgradeNum = 0;
for (; town->buildings.count(buildID); upgradeNum++, buildID.advance(GameConstants::CREATURES_PER_TOWN))
for (; town->buildings.count(buildID); upgradeNum++, buildID.advance(town->creatures.size()))
{
if (hasBuilt(buildID) && town->creatures.at(level).size() > upgradeNum)
creatures[level].second.push_back(town->creatures[level][upgradeNum]);