1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-13 11:40:38 +02:00

Nullkiller: fix build and some warnings

This commit is contained in:
Andrii Danylchenko 2021-05-15 22:04:31 +03:00 committed by Andrii Danylchenko
parent ada76a5603
commit fdd5be1e40
4 changed files with 9 additions and 13 deletions

View File

@ -10,7 +10,7 @@
#pragma once
#include "../VCAI.h"
#include "../AIHelper.h"
#include "../AIhelper.h"
struct HitMapInfo
{

View File

@ -195,7 +195,7 @@ void ExistingSkillRule::evaluateScore(const CGHeroInstance * hero, SecondarySkil
upgradesLeft += SecSkillLevel::EXPERT - heroSkill.second;
}
if(score >= 2 || score >= 1 && upgradesLeft <= 1)
if(score >= 2 || (score >= 1 && upgradesLeft <= 1))
score += 1.5;
}

View File

@ -263,9 +263,6 @@ bool AINodeStorage::calculateHeroChain()
for(AIPathNode & node : chains)
{
if(node.coord.x == 60 && node.coord.y == 56 && node.actor)
logAi->trace(node.actor->toString());
if(node.turns <= heroChainTurn && node.action != CGPathNode::ENodeAction::UNKNOWN)
existingChains.push_back(&node);
}
@ -304,8 +301,10 @@ void AINodeStorage::calculateHeroChain(
{
for(AIPathNode * node : variants)
{
if(node == srcNode || !node->actor || node->turns > heroChainTurn
|| node->action == CGPathNode::ENodeAction::UNKNOWN && node->actor->hero
if(node == srcNode
|| !node->actor
|| node->turns > heroChainTurn
|| (node->action == CGPathNode::ENodeAction::UNKNOWN && node->actor->hero)
|| (node->actor->chainMask & srcNode->actor->chainMask) != 0)
{
continue;
@ -331,7 +330,7 @@ void AINodeStorage::calculateHeroChain(
std::vector<ExchangeCandidate> & result) const
{
if(carrier->armyLoss < carrier->actor->armyValue
&& (carrier->action != CGPathNode::BATTLE || carrier->actor->allowBattle && carrier->specialAction)
&& (carrier->action != CGPathNode::BATTLE || (carrier->actor->allowBattle && carrier->specialAction))
&& other->armyLoss < other->actor->armyValue
&& carrier->actor->canExchange(other->actor))
{
@ -429,10 +428,7 @@ ExchangeCandidate AINodeStorage::calculateExchange(
AIPathNode * otherParentNode) const
{
ExchangeCandidate candidate;
auto carrierActor = carrierParentNode->actor;
auto otherActor = otherParentNode->actor;
candidate.layer = carrierParentNode->layer;
candidate.coord = carrierParentNode->coord;
candidate.carrierParent = carrierParentNode;

View File

@ -136,7 +136,7 @@ Goals::TGoalVec PathfindingManager::findPaths(
for(auto path : chainInfo)
{
if(hero && hero.get() != path.targetHero || path.nodes.empty())
if((hero && hero.get() != path.targetHero) || path.nodes.empty())
continue;
const AIPathNodeInfo & firstNode = path.firstNode();