1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Fix auto-visit of configurable objects on new day

This commit is contained in:
Ivan Savenko
2024-08-12 13:30:03 +00:00
parent 162535e6d8
commit 19838e2654
2 changed files with 13 additions and 10 deletions

View File

@@ -553,14 +553,6 @@ void CGTownInstance::newTurn(vstd::RNG & rand) const
for(const auto * manaVortex : getBonusingBuildings(BuildingSubID::MANA_VORTEX))
cb->setObjPropertyValue(id, ObjProperty::STRUCTURE_CLEAR_VISITORS, manaVortex->indexOnTV); //reset visitors for Mana Vortex
//get Mana Vortex or Stables bonuses
//same code is in the CGameHandler::buildStructure method
if (garrisonHero != nullptr) //garrison hero first - consistent with original H3 Mana Vortex and Battle Scholar Academy levelup windows order
cb->visitCastleObjects(this, garrisonHero);
if (visitingHero != nullptr)
cb->visitCastleObjects(this, visitingHero);
if (tempOwner == PlayerColor::NEUTRAL) //garrison growth for neutral towns
{
std::vector<SlotID> nativeCrits; //slots

View File

@@ -631,10 +631,21 @@ void CGameHandler::onPlayerTurnStarted(PlayerColor which)
events::PlayerGotTurn::defaultExecute(serverEventBus.get(), which);
turnTimerHandler->onPlayerGetTurn(which);
handleTimeEvents(which);
const auto * playerState = gs->getPlayerState(which);
for (auto t : getPlayerState(which)->towns)
handleTimeEvents(which);
for (auto t : playerState->towns)
handleTownEvents(t);
for (auto t : playerState->towns)
{
//garrison hero first - consistent with original H3 Mana Vortex and Battle Scholar Academy levelup windows order
if (t->garrisonHero != nullptr)
objectVisited(t, t->garrisonHero);
if (t->visitingHero != nullptr)
objectVisited(t, t->visitingHero);
}
}
void CGameHandler::onPlayerTurnEnded(PlayerColor which)