mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Updated C::B projects, fixed a few warnings
This commit is contained in:
@@ -535,11 +535,13 @@ ui64 howManyReinforcementsCanBuy(HeroPtr h, const CGDwelling * t)
|
||||
{
|
||||
//can be merged with another stack?
|
||||
SlotID dst = h->getSlotFor(ci.creID);
|
||||
if (!h->hasStackAtSlot(dst)) //need another new slot for this stack
|
||||
if (!freeHeroSlots) //no more place for stacks
|
||||
if(!h->hasStackAtSlot(dst)) //need another new slot for this stack
|
||||
{
|
||||
if(!freeHeroSlots) //no more place for stacks
|
||||
continue;
|
||||
else
|
||||
freeHeroSlots--; //new slot will be occupied
|
||||
}
|
||||
|
||||
//we found matching occupied or free slot
|
||||
aivalue += ci.count * ci.cre->AIValue;
|
||||
|
@@ -35,7 +35,7 @@ void AINodeStorage::updateAINode(CGPathNode * node, std::function<void(AIPathNod
|
||||
|
||||
bool AINodeStorage::isBattleNode(const CGPathNode * node) const
|
||||
{
|
||||
return getAINode(node)->chainMask & BATTLE_CHAIN > 0;
|
||||
return (getAINode(node)->chainMask & BATTLE_CHAIN) > 0;
|
||||
}
|
||||
|
||||
AIPathNode * AINodeStorage::getNode(const int3 & coord, const EPathfindingLayer layer, int chainNumber)
|
||||
@@ -140,7 +140,7 @@ bool AINodeStorage::hasBetterChain(const PathNodeInfo & source, CDestinationNode
|
||||
if(node.danger <= destinationNode->danger && destinationNode->chainMask == 1 && node.chainMask == 0)
|
||||
{
|
||||
if(node.turns < destinationNode->turns
|
||||
|| node.turns == destinationNode->turns && node.moveRemains >= destinationNode->moveRemains)
|
||||
|| (node.turns == destinationNode->turns && node.moveRemains >= destinationNode->moveRemains))
|
||||
{
|
||||
logAi->trace(
|
||||
"Block ineficient move %s:->%s, mask=%i, mp diff: %i",
|
||||
|
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "../../../lib/CPathfinder.h"
|
||||
#include "../../../lib/mapObjects/CGHeroInstance.h"
|
||||
#include "AIUtility.h"
|
||||
#include "../AIUtility.h"
|
||||
|
||||
class IVirtualObject
|
||||
{
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "AIUtility.h"
|
||||
#include "../AIUtility.h"
|
||||
#include "AINodeStorage.h"
|
||||
|
||||
class AIPathfinder
|
||||
|
@@ -41,12 +41,10 @@ public:
|
||||
if(blocker == BlockingReason::NONE)
|
||||
return;
|
||||
|
||||
auto srcNode = nodeStorage->getAINode(source.node);
|
||||
|
||||
if(blocker == BlockingReason::DESTINATION_BLOCKVIS && destination.nodeObject)
|
||||
{
|
||||
auto objID = destination.nodeObject->ID;
|
||||
if(objID == Obj::HERO && destination.objectRelations != PlayerRelations::ENEMIES
|
||||
if((objID == Obj::HERO && destination.objectRelations != PlayerRelations::ENEMIES)
|
||||
|| objID == Obj::SUBTERRANEAN_GATE || objID == Obj::MONOLITH_TWO_WAY
|
||||
|| objID == Obj::MONOLITH_ONE_WAY_ENTRANCE || objID == Obj::MONOLITH_ONE_WAY_EXIT
|
||||
|| objID == Obj::WHIRLPOOL)
|
||||
@@ -202,7 +200,8 @@ public:
|
||||
const PathfinderConfig * pathfinderConfig,
|
||||
CPathfinderHelper * pathfinderHelper) const override
|
||||
{
|
||||
auto blocker = getBlockingReason(source, destination, pathfinderConfig, pathfinderHelper);
|
||||
//FIXME: unused
|
||||
// auto blocker = getBlockingReason(source, destination, pathfinderConfig, pathfinderHelper);
|
||||
|
||||
if(source.guarded)
|
||||
{
|
||||
|
@@ -95,6 +95,14 @@
|
||||
<Unit filename="Goals.h" />
|
||||
<Unit filename="MapObjectsEvaluator.cpp" />
|
||||
<Unit filename="MapObjectsEvaluator.h" />
|
||||
<Unit filename="Pathfinding/AINodeStorage.cpp" />
|
||||
<Unit filename="Pathfinding/AINodeStorage.h" />
|
||||
<Unit filename="Pathfinding/AIPathfinder.cpp" />
|
||||
<Unit filename="Pathfinding/AIPathfinder.h" />
|
||||
<Unit filename="Pathfinding/AIPathfinderConfig.cpp" />
|
||||
<Unit filename="Pathfinding/AIPathfinderConfig.h" />
|
||||
<Unit filename="Pathfinding/PathfindingManager.cpp" />
|
||||
<Unit filename="Pathfinding/PathfindingManager.h" />
|
||||
<Unit filename="ResourceManager.cpp" />
|
||||
<Unit filename="ResourceManager.h" />
|
||||
<Unit filename="SectorMap.cpp" />
|
||||
|
@@ -2389,7 +2389,6 @@ Goals::TSubgoal VCAI::decomposeGoal(Goals::TSubgoal ultimateGoal)
|
||||
}
|
||||
|
||||
const int searchDepth = 30;
|
||||
const int searchDepth2 = searchDepth - 2;
|
||||
Goals::TSubgoal abstractGoal = sptr(Goals::Invalid());
|
||||
|
||||
Goals::TSubgoal goal = ultimateGoal;
|
||||
|
Reference in New Issue
Block a user