mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-17 00:07:41 +02:00
Unified income handling, added IOwnableObject interface
This commit is contained in:
@ -93,18 +93,6 @@ void CGMine::onHeroVisit( const CGHeroInstance * h ) const
|
||||
}
|
||||
|
||||
flagMine(h->tempOwner);
|
||||
|
||||
}
|
||||
|
||||
void CGMine::newTurn(vstd::RNG & rand) const
|
||||
{
|
||||
if(cb->getDate() == 1)
|
||||
return;
|
||||
|
||||
if (tempOwner == PlayerColor::NEUTRAL)
|
||||
return;
|
||||
|
||||
cb->giveResource(tempOwner, producedResource, getProducedQuantity());
|
||||
}
|
||||
|
||||
void CGMine::initObj(vstd::RNG & rand)
|
||||
@ -139,11 +127,19 @@ bool CGMine::isAbandoned() const
|
||||
return subID.getNum() >= 7;
|
||||
}
|
||||
|
||||
const IOwnableObject * CGMine::asOwnable() const
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
ResourceSet CGMine::dailyIncome() const
|
||||
{
|
||||
ResourceSet result;
|
||||
result[producedResource] += defaultResProduction();
|
||||
|
||||
const auto & playerSettings = cb->getPlayerSettings(getOwner());
|
||||
result.applyHandicap(playerSettings->handicap.percentIncome);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user