mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fix object clearing
This commit is contained in:
@@ -322,7 +322,6 @@ void CTownRewardableBuilding::newTurn(CRandomGenerator & rand) const
|
||||
}
|
||||
if(configuration.resetParameters.visitors)
|
||||
{
|
||||
cb->setObjProperty(town->id, ObjProperty::REWARD_CLEARED, indexOnTV);
|
||||
cb->setObjProperty(town->id, ObjProperty::STRUCTURE_CLEAR_VISITORS, indexOnTV);
|
||||
}
|
||||
}
|
||||
@@ -344,9 +343,6 @@ void CTownRewardableBuilding::setProperty(ui8 what, ui32 val)
|
||||
case ObjProperty::REWARD_SELECT:
|
||||
selectedReward = val;
|
||||
break;
|
||||
case ObjProperty::REWARD_CLEARED:
|
||||
onceVisitableObjectCleared = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,12 +356,6 @@ void CTownRewardableBuilding::blockingDialogAnswered(const CGHeroInstance *hero,
|
||||
if(visitors.find(hero->id) != visitors.end())
|
||||
return; // query not for this building
|
||||
|
||||
if(answer == 0)
|
||||
{
|
||||
cb->setObjProperty(town->id, ObjProperty::STRUCTURE_CLEAR_VISITORS, indexOnTV);
|
||||
return; // player refused
|
||||
}
|
||||
|
||||
if(answer > 0 && answer-1 < configuration.info.size())
|
||||
{
|
||||
auto list = getAvailableRewards(hero, Rewardable::EEventType::EVENT_FIRST_VISIT);
|
||||
@@ -397,7 +387,7 @@ bool CTownRewardableBuilding::wasVisitedBefore(const CGHeroInstance * contextHer
|
||||
case Rewardable::VISIT_UNLIMITED:
|
||||
return false;
|
||||
case Rewardable::VISIT_ONCE:
|
||||
return onceVisitableObjectCleared;
|
||||
return !visitors.empty();
|
||||
case Rewardable::VISIT_PLAYER:
|
||||
return false; //not supported
|
||||
case Rewardable::VISIT_BONUS:
|
||||
|
@@ -110,8 +110,6 @@ class DLL_LINKAGE CTownRewardableBuilding : public CGTownBuilding, public Reward
|
||||
/// reward selected by player, no serialize
|
||||
ui16 selectedReward = 0;
|
||||
|
||||
bool onceVisitableObjectCleared = false;
|
||||
|
||||
std::set<ObjectInstanceID> visitors;
|
||||
|
||||
bool wasVisitedBefore(const CGHeroInstance * contextHero) const;
|
||||
@@ -139,7 +137,6 @@ public:
|
||||
{
|
||||
h & static_cast<CGTownBuilding&>(*this);
|
||||
h & static_cast<Rewardable::Interface&>(*this);
|
||||
h & onceVisitableObjectCleared;
|
||||
h & visitors;
|
||||
}
|
||||
};
|
||||
|
@@ -71,9 +71,6 @@ void CGTownInstance::setPropertyDer(ui8 what, ui32 val)
|
||||
case ObjProperty::REWARD_RANDOMIZE:
|
||||
bonusingBuildings[val]->setProperty(ObjProperty::REWARD_RANDOMIZE, 0);
|
||||
break;
|
||||
case ObjProperty::REWARD_CLEARED:
|
||||
bonusingBuildings[val]->setProperty(ObjProperty::REWARD_CLEARED, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
CGTownInstance::EFortLevel CGTownInstance::fortLevel() const //0 - none, 1 - fort, 2 - citadel, 3 - castle
|
||||
@@ -550,7 +547,7 @@ void CGTownInstance::newTurn(CRandomGenerator & rand) const
|
||||
|
||||
TQuantity count = creatureGrowth(i);
|
||||
if (!count) // no dwelling
|
||||
count = VLC->creh->objects[c]->getGrowth();
|
||||
count = VLC->creatures()->getByIndex(c)->getGrowth();
|
||||
|
||||
{//no lower tiers or above current month
|
||||
|
||||
|
Reference in New Issue
Block a user