1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-14 02:33:51 +02:00

Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Xilmi 2024-07-19 22:05:58 +02:00
commit 2bf7b3200b
4 changed files with 15 additions and 7 deletions

View File

@ -106,10 +106,17 @@ int32_t convertToGold(const TResources & res)
+ 125 * (res[EGameResID::GEMS] + res[EGameResID::CRYSTAL] + res[EGameResID::MERCURY] + res[EGameResID::SULFUR]);
}
TResources withoutGold(TResources other)
{
other[GameResID::GOLD] = 0;
return other;
}
TResources BuildAnalyzer::getResourcesRequiredNow() const
{
auto resourcesAvailable = ai->getFreeResources();
auto result = requiredResources - resourcesAvailable;
auto result = withoutGold(armyCost) + requiredResources - resourcesAvailable;
result.positive();
@ -119,7 +126,7 @@ TResources BuildAnalyzer::getResourcesRequiredNow() const
TResources BuildAnalyzer::getTotalResourcesRequired() const
{
auto resourcesAvailable = ai->getFreeResources();
auto result = totalDevelopmentCost - resourcesAvailable;
auto result = totalDevelopmentCost + withoutGold(armyCost) - resourcesAvailable;
result.positive();
@ -340,6 +347,7 @@ void TownDevelopmentInfo::addExistingDwelling(const BuildingInfo & existingDwell
void TownDevelopmentInfo::addBuildingToBuild(const BuildingInfo & nextToBuild)
{
townDevelopmentCost += nextToBuild.buildCostWithPrerequisites;
townDevelopmentCost += withoutGold(nextToBuild.armyCost);
if(nextToBuild.canBuild)
{

View File

@ -15,9 +15,9 @@ InputVariable: scoutTurnDistance
range: 0.000 10.000
lock-range: true
term: LOWEST Ramp 0.250 0.000
term: LOW Discrete 0.000 1.000 0.500 0.800 1.000 0.000
term: MEDIUM Discrete 0.000 0.000 0.500 0.200 1.000 1.000 2.500 0.300 4.000 0.000
term: LONG Discrete 1.000 0.000 1.500 0.200 3.000 0.800 10.000 1.000
term: LOW Discrete 0.000 1.000 1.000 0.800 2.500 0.000
term: MEDIUM Discrete 0.000 0.000 1.000 0.200 2.500 1.000 3.500 0.300 5.000 0.000
term: LONG Discrete 2.500 0.000 3.500 0.200 5.000 0.800 10.000 1.000
InputVariable: goldReward
description: estimated amount of gold received
enabled: true

View File

@ -523,6 +523,7 @@ CGameHandler::CGameHandler(CVCMIServer * lobby)
, turnOrder(std::make_unique<TurnOrderProcessor>(this))
, queries(std::make_unique<QueriesProcessor>())
, playerMessages(std::make_unique<PlayerMessageProcessor>(this))
, randomNumberGenerator(std::make_unique<CRandomGenerator>())
, complainNoCreatures("No creatures to split")
, complainNotEnoughCreatures("Cannot split that stack, not enough creatures!")
, complainInvalidSlot("Invalid slot accessed!")
@ -552,7 +553,6 @@ void CGameHandler::reinitScripting()
void CGameHandler::init(StartInfo *si, Load::ProgressAccumulator & progressTracking)
{
randomNumberGenerator = std::make_unique<CRandomGenerator>();
int requestedSeed = settings["server"]["seed"].Integer();
if (requestedSeed != 0)
randomNumberGenerator->setSeed(requestedSeed);

View File

@ -238,7 +238,7 @@ public:
template <typename Handler> void serialize(Handler &h)
{
h & QID;
h & randomNumberGenerator;
h & *randomNumberGenerator;
h & *battles;
h & *heroPool;
h & *playerMessages;