1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Merge branch 'develop' into bank_support

This commit is contained in:
Laserlicht
2024-08-09 23:36:59 +02:00
committed by GitHub
117 changed files with 5308 additions and 746 deletions

View File

@@ -227,7 +227,7 @@ TResources CGTownInstance::dailyIncome() const
auto playerSettings = cb->gameState()->scenarioOps->getIthPlayersSettings(getOwner());
for(TResources::nziterator it(ret); it.valid(); it++)
// always round up income - we don't want to always produce zero if handicap in use
ret[it->resType] = (ret[it->resType] * playerSettings.handicap.percentIncome + 99) / 100;
ret[it->resType] = vstd::divideAndCeil(ret[it->resType] * playerSettings.handicap.percentIncome, 100);
return ret;
}
@@ -281,7 +281,7 @@ void CGTownInstance::setOwner(const PlayerColor & player) const
cb->setOwner(this, player);
}
void CGTownInstance::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const
void CGTownInstance::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{
for (auto building : bonusingBuildings)
building->blockingDialogAnswered(hero, answer);
@@ -1229,6 +1229,12 @@ void CGTownInstance::serializeJsonOptions(JsonSerializeFormat & handler)
handler.serializeIdArray( "possibleSpells", possibleSpells);
handler.serializeIdArray( "obligatorySpells", obligatorySpells);
}
{
auto eventsHandler = handler.enterArray("events");
eventsHandler.syncSize(events, JsonNode::JsonType::DATA_VECTOR);
eventsHandler.serializeStruct(events);
}
}
FactionID CGTownInstance::getFaction() const
@@ -1279,7 +1285,7 @@ int GrowthInfo::totalGrowth() const
ret += entry.count;
// always round up income - we don't want buildings to always produce zero if handicap in use
return (ret * handicapPercentage + 99) / 100;
return vstd::divideAndCeil(ret * handicapPercentage, 100);
}
void CGTownInstance::fillUpgradeInfo(UpgradeInfo & info, const CStackInstance &stack) const