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

Moved most of daily income handling to a separate method

This commit is contained in:
Ivan Savenko
2024-08-24 19:18:15 +00:00
parent 58da447f43
commit 189cb1c762
8 changed files with 204 additions and 123 deletions

View File

@@ -478,20 +478,6 @@ void CGTownInstance::newTurn(vstd::RNG & rand) const
{
if (cb->getDate(Date::DAY_OF_WEEK) == 1) //reset on new week
{
//give resources if there's a Mystic Pond
if (hasBuilt(BuildingSubID::MYSTIC_POND)
&& cb->getDate(Date::DAY) != 1
&& (tempOwner.isValidPlayer())
)
{
int resID = rand.nextInt(2, 5); //bonus to random rare resource
resID = (resID==2)?1:resID;
int resVal = rand.nextInt(1, 4);//with size 1..4
cb->giveResource(tempOwner, static_cast<EGameResID>(resID), resVal);
cb->setObjPropertyValue(id, ObjProperty::BONUS_VALUE_FIRST, resID);
cb->setObjPropertyValue(id, ObjProperty::BONUS_VALUE_SECOND, resVal);
}
if (tempOwner == PlayerColor::NEUTRAL) //garrison growth for neutral towns
{
std::vector<SlotID> nativeCrits; //slots