1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

Fix stacking of bonuses from buildings like Tavern

- Same buildings in different towns of the same faction that provide
bonuses with propagators will now correctly stack their bonuses. This
fixes Tavern and possibly other such buildings
- Brotherhood of Sword now correctly adds bonus to thieves guild access
This commit is contained in:
Ivan Savenko 2025-02-14 14:29:58 +00:00
parent b69e1ce1fb
commit 58a6185b43
2 changed files with 11 additions and 3 deletions

View File

@ -202,6 +202,11 @@
{ {
"type": "MORALE", "type": "MORALE",
"val": 2 "val": 2
},
{
"propagator": "PLAYER_PROPAGATOR",
"type": "THIEVES_GUILD_ACCESS",
"val": 1
} }
], ],
"upgrades" : "tavern" "upgrades" : "tavern"

View File

@ -754,8 +754,6 @@ void CGTownInstance::recreateBuildingsBonuses()
for(const auto & b : bl) for(const auto & b : bl)
removeBonus(b); removeBonus(b);
for(const auto & bid : builtBuildings) for(const auto & bid : builtBuildings)
{ {
bool bonusesReplacedByUpgrade = false; bool bonusesReplacedByUpgrade = false;
@ -777,7 +775,12 @@ void CGTownInstance::recreateBuildingsBonuses()
continue; continue;
for(auto & bonus : building->buildingBonuses) for(auto & bonus : building->buildingBonuses)
addNewBonus(bonus); {
// Add copy of bonus to bonus system
// Othervice, bonuses with player or global propagator will not stack if player has multiple towns of same faction
auto bonusCopy = std::make_shared<Bonus>(*bonus);
addNewBonus(bonusCopy);
}
} }
} }