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

abstraction layer

This commit is contained in:
Laserlicht
2024-08-05 23:51:07 +02:00
parent 3afddbbf29
commit ebeeff5aa3
6 changed files with 42 additions and 22 deletions

View File

@@ -2360,10 +2360,10 @@ bool CGameHandler::buildStructure(ObjectInstanceID tid, BuildingID requestedID,
//Performs stuff that has to be done before new building is built
auto processBeforeBuiltStructure = [t, this](const BuildingID buildingID)
{
if(buildingID >= BuildingID::DWELL_FIRST) //dwelling
if(BuildingID::getLevel(buildingID) > -1) //dwelling
{
int level = (buildingID - BuildingID::DWELL_FIRST) % t->town->creatures.size();
int upgradeNumber = (buildingID - BuildingID::DWELL_FIRST) / t->town->creatures.size();
int level = BuildingID::getLevel(buildingID) % t->town->creatures.size();
int upgradeNumber = BuildingID::getLevel(buildingID) / t->town->creatures.size();
if(upgradeNumber >= t->town->creatures.at(level).size())
{