1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Merge pull request #2101 from Nordsoft91/rewardable-expand

Part 2: refactoring for rewardable object
This commit is contained in:
Nordsoft91
2023-05-02 01:19:57 +04:00
committed by GitHub
20 changed files with 1323 additions and 1083 deletions

View File

@@ -319,7 +319,7 @@ bool isWeeklyRevisitable(const CGObjectInstance * obj)
//TODO: allow polling of remaining creatures in dwelling
if(const auto * rewardable = dynamic_cast<const CRewardableObject *>(obj))
return rewardable->getResetDuration() == 7;
return rewardable->configuration.getResetDuration() == 7;
if(dynamic_cast<const CGDwelling *>(obj))
return true;

View File

@@ -72,10 +72,10 @@ void AIMemory::markObjectVisited(const CGObjectInstance * obj)
// TODO: maybe this logic belongs to CaptureObjects::shouldVisit
if(const auto * rewardable = dynamic_cast<const CRewardableObject *>(obj))
{
if (rewardable->getVisitMode() == CRewardableObject::VISIT_HERO) //we may want to visit it with another hero
if (rewardable->configuration.getVisitMode() == Rewardable::VISIT_HERO) //we may want to visit it with another hero
return;
if (rewardable->getVisitMode() == CRewardableObject::VISIT_BONUS) //or another time
if (rewardable->configuration.getVisitMode() == Rewardable::VISIT_BONUS) //or another time
return;
}

View File

@@ -1605,10 +1605,10 @@ void VCAI::markObjectVisited(const CGObjectInstance * obj)
if(const auto * rewardable = dynamic_cast<const CRewardableObject *>(obj)) //we may want to visit it with another hero
{
if (rewardable->getVisitMode() == CRewardableObject::VISIT_HERO) //we may want to visit it with another hero
if (rewardable->configuration.getVisitMode() == Rewardable::VISIT_HERO) //we may want to visit it with another hero
return;
if (rewardable->getVisitMode() == CRewardableObject::VISIT_BONUS) //or another time
if (rewardable->configuration.getVisitMode() == Rewardable::VISIT_BONUS) //or another time
return;
}
@@ -2746,7 +2746,7 @@ bool isWeeklyRevisitable(const CGObjectInstance * obj)
{
//TODO: allow polling of remaining creatures in dwelling
if(const auto * rewardable = dynamic_cast<const CRewardableObject *>(obj))
return rewardable->getResetDuration() == 7;
return rewardable->configuration.getResetDuration() == 7;
if(dynamic_cast<const CGDwelling *>(obj))
return true;