mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-05 00:49:09 +02:00
Map objects now use shared_ptr (game)
This commit is contained in:
@ -507,7 +507,7 @@ RumorState NewTurnProcessor::pickNewRumor()
|
||||
|
||||
std::tuple<EWeekType, CreatureID> NewTurnProcessor::pickWeekType(bool newMonth)
|
||||
{
|
||||
for (const CGTownInstance *t : gameHandler->gameState()->getMap().towns)
|
||||
for (const auto & t : gameHandler->gameState()->getMap().towns)
|
||||
{
|
||||
if (t->hasBuilt(BuildingID::GRAIL, ETownType::INFERNO))
|
||||
return { EWeekType::DEITYOFFIRE, CreatureID::IMP };
|
||||
@ -666,8 +666,8 @@ NewTurn NewTurnProcessor::generateNewTurnPack()
|
||||
|
||||
if (newWeek)
|
||||
{
|
||||
for (CGTownInstance *t : gameHandler->gameState()->getMap().towns)
|
||||
n.availableCreatures.push_back(generateTownGrowth(t, n.specialWeek, n.creatureid, firstTurn));
|
||||
for (const auto & t : gameHandler->gameState()->getMap().towns)
|
||||
n.availableCreatures.push_back(generateTownGrowth(t.get(), n.specialWeek, n.creatureid, firstTurn));
|
||||
}
|
||||
|
||||
if (newWeek)
|
||||
@ -695,17 +695,17 @@ void NewTurnProcessor::onNewTurn()
|
||||
|
||||
if (newWeek)
|
||||
{
|
||||
for (CGTownInstance *t : gameHandler->gameState()->getMap().towns)
|
||||
for (const auto & t : gameHandler->gameState()->getMap().towns)
|
||||
if (t->hasBuilt(BuildingSubID::PORTAL_OF_SUMMONING))
|
||||
gameHandler->setPortalDwelling(t, true, (n.specialWeek == EWeekType::PLAGUE ? true : false)); //set creatures for Portal of Summoning
|
||||
gameHandler->setPortalDwelling(t.get(), true, (n.specialWeek == EWeekType::PLAGUE ? true : false)); //set creatures for Portal of Summoning
|
||||
}
|
||||
|
||||
if (newWeek && !firstTurn)
|
||||
{
|
||||
for (CGTownInstance *t : gameHandler->gameState()->getMap().towns)
|
||||
for (const auto & t : gameHandler->gameState()->getMap().towns)
|
||||
{
|
||||
if (!t->getOwner().isValidPlayer())
|
||||
updateNeutralTownGarrison(t, 1 + gameHandler->getDate(Date::DAY) / 7);
|
||||
updateNeutralTownGarrison(t.get(), 1 + gameHandler->getDate(Date::DAY) / 7);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user