mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-28 03:57:02 +02:00
Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
2bf7b3200b
@ -106,10 +106,17 @@ int32_t convertToGold(const TResources & res)
|
|||||||
+ 125 * (res[EGameResID::GEMS] + res[EGameResID::CRYSTAL] + res[EGameResID::MERCURY] + res[EGameResID::SULFUR]);
|
+ 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
|
TResources BuildAnalyzer::getResourcesRequiredNow() const
|
||||||
{
|
{
|
||||||
auto resourcesAvailable = ai->getFreeResources();
|
auto resourcesAvailable = ai->getFreeResources();
|
||||||
auto result = requiredResources - resourcesAvailable;
|
auto result = withoutGold(armyCost) + requiredResources - resourcesAvailable;
|
||||||
|
|
||||||
result.positive();
|
result.positive();
|
||||||
|
|
||||||
@ -119,7 +126,7 @@ TResources BuildAnalyzer::getResourcesRequiredNow() const
|
|||||||
TResources BuildAnalyzer::getTotalResourcesRequired() const
|
TResources BuildAnalyzer::getTotalResourcesRequired() const
|
||||||
{
|
{
|
||||||
auto resourcesAvailable = ai->getFreeResources();
|
auto resourcesAvailable = ai->getFreeResources();
|
||||||
auto result = totalDevelopmentCost - resourcesAvailable;
|
auto result = totalDevelopmentCost + withoutGold(armyCost) - resourcesAvailable;
|
||||||
|
|
||||||
result.positive();
|
result.positive();
|
||||||
|
|
||||||
@ -340,6 +347,7 @@ void TownDevelopmentInfo::addExistingDwelling(const BuildingInfo & existingDwell
|
|||||||
void TownDevelopmentInfo::addBuildingToBuild(const BuildingInfo & nextToBuild)
|
void TownDevelopmentInfo::addBuildingToBuild(const BuildingInfo & nextToBuild)
|
||||||
{
|
{
|
||||||
townDevelopmentCost += nextToBuild.buildCostWithPrerequisites;
|
townDevelopmentCost += nextToBuild.buildCostWithPrerequisites;
|
||||||
|
townDevelopmentCost += withoutGold(nextToBuild.armyCost);
|
||||||
|
|
||||||
if(nextToBuild.canBuild)
|
if(nextToBuild.canBuild)
|
||||||
{
|
{
|
||||||
|
@ -15,9 +15,9 @@ InputVariable: scoutTurnDistance
|
|||||||
range: 0.000 10.000
|
range: 0.000 10.000
|
||||||
lock-range: true
|
lock-range: true
|
||||||
term: LOWEST Ramp 0.250 0.000
|
term: LOWEST Ramp 0.250 0.000
|
||||||
term: LOW Discrete 0.000 1.000 0.500 0.800 1.000 0.000
|
term: LOW Discrete 0.000 1.000 1.000 0.800 2.500 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: 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 1.000 0.000 1.500 0.200 3.000 0.800 10.000 1.000
|
term: LONG Discrete 2.500 0.000 3.500 0.200 5.000 0.800 10.000 1.000
|
||||||
InputVariable: goldReward
|
InputVariable: goldReward
|
||||||
description: estimated amount of gold received
|
description: estimated amount of gold received
|
||||||
enabled: true
|
enabled: true
|
||||||
|
@ -523,6 +523,7 @@ CGameHandler::CGameHandler(CVCMIServer * lobby)
|
|||||||
, turnOrder(std::make_unique<TurnOrderProcessor>(this))
|
, turnOrder(std::make_unique<TurnOrderProcessor>(this))
|
||||||
, queries(std::make_unique<QueriesProcessor>())
|
, queries(std::make_unique<QueriesProcessor>())
|
||||||
, playerMessages(std::make_unique<PlayerMessageProcessor>(this))
|
, playerMessages(std::make_unique<PlayerMessageProcessor>(this))
|
||||||
|
, randomNumberGenerator(std::make_unique<CRandomGenerator>())
|
||||||
, complainNoCreatures("No creatures to split")
|
, complainNoCreatures("No creatures to split")
|
||||||
, complainNotEnoughCreatures("Cannot split that stack, not enough creatures!")
|
, complainNotEnoughCreatures("Cannot split that stack, not enough creatures!")
|
||||||
, complainInvalidSlot("Invalid slot accessed!")
|
, complainInvalidSlot("Invalid slot accessed!")
|
||||||
@ -552,7 +553,6 @@ void CGameHandler::reinitScripting()
|
|||||||
|
|
||||||
void CGameHandler::init(StartInfo *si, Load::ProgressAccumulator & progressTracking)
|
void CGameHandler::init(StartInfo *si, Load::ProgressAccumulator & progressTracking)
|
||||||
{
|
{
|
||||||
randomNumberGenerator = std::make_unique<CRandomGenerator>();
|
|
||||||
int requestedSeed = settings["server"]["seed"].Integer();
|
int requestedSeed = settings["server"]["seed"].Integer();
|
||||||
if (requestedSeed != 0)
|
if (requestedSeed != 0)
|
||||||
randomNumberGenerator->setSeed(requestedSeed);
|
randomNumberGenerator->setSeed(requestedSeed);
|
||||||
|
@ -238,7 +238,7 @@ public:
|
|||||||
template <typename Handler> void serialize(Handler &h)
|
template <typename Handler> void serialize(Handler &h)
|
||||||
{
|
{
|
||||||
h & QID;
|
h & QID;
|
||||||
h & randomNumberGenerator;
|
h & *randomNumberGenerator;
|
||||||
h & *battles;
|
h & *battles;
|
||||||
h & *heroPool;
|
h & *heroPool;
|
||||||
h & *playerMessages;
|
h & *playerMessages;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user