mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
AI: rough hero chain stabilisation
This commit is contained in:
parent
ff57a52001
commit
62e5366a08
@ -20,7 +20,6 @@ set(VCAI_SRCS
|
||||
Pathfinding/Rules/AIMovementAfterDestinationRule.cpp
|
||||
Pathfinding/Rules/AIMovementToDestinationRule.cpp
|
||||
Pathfinding/Rules/AIPreviousNodeRule.cpp
|
||||
Pathfinding/Rules/AIMovementCostRule.cpp
|
||||
AIUtility.cpp
|
||||
AIhelper.cpp
|
||||
ResourceManager.cpp
|
||||
@ -77,7 +76,6 @@ set(VCAI_HEADERS
|
||||
Pathfinding/Rules/AIMovementAfterDestinationRule.h
|
||||
Pathfinding/Rules/AIMovementToDestinationRule.h
|
||||
Pathfinding/Rules/AIPreviousNodeRule.h
|
||||
Pathfinding/Rules/AIMovementCostRule.h
|
||||
AIUtility.h
|
||||
AIhelper.h
|
||||
ResourceManager.h
|
||||
|
@ -186,7 +186,7 @@ void AINodeStorage::commit(
|
||||
int movementLeft,
|
||||
float cost) const
|
||||
{
|
||||
destination->action = source->action;
|
||||
destination->action = action;
|
||||
destination->cost = cost;
|
||||
destination->moveRemains = movementLeft;
|
||||
destination->turns = turn;
|
||||
@ -322,9 +322,9 @@ void AINodeStorage::commitExchange(
|
||||
#ifdef VCMI_TRACE_PATHFINDER
|
||||
logAi->trace(
|
||||
"Accepted hero exhange at %s, carrier %s, mp cost %f",
|
||||
destination.coord.toString(),
|
||||
exchangeNode->coord.toString(),
|
||||
carrierActor->hero->name,
|
||||
destination.cost);
|
||||
cost);
|
||||
#endif
|
||||
|
||||
commit(exchangeNode, carrierParentNode, carrierParentNode->action, turns, movementLeft, cost);
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define VCMI_TRACE_PATHFINDER
|
||||
|
||||
#include "../../../lib/CPathfinder.h"
|
||||
#include "../../../lib/mapObjects/CGHeroInstance.h"
|
||||
#include "../AIUtility.h"
|
||||
|
@ -26,7 +26,7 @@ namespace AIPathfinding
|
||||
std::make_shared<AILayerTransitionRule>(cb, ai, nodeStorage),
|
||||
std::make_shared<DestinationActionRule>(),
|
||||
std::make_shared<AIMovementToDestinationRule>(nodeStorage),
|
||||
std::make_shared<AIMovementCostRule>(nodeStorage),
|
||||
std::make_shared<MovementCostRule>(),
|
||||
std::make_shared<AIPreviousNodeRule>(nodeStorage),
|
||||
std::make_shared<AIMovementAfterDestinationRule>(cb, nodeStorage)
|
||||
};
|
||||
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* AIMovementCostRule.cpp, part of VCMI engine
|
||||
*
|
||||
* Authors: listed in file AUTHORS in main folder
|
||||
*
|
||||
* License: GNU General Public License v2.0 or later
|
||||
* Full text of license available in license.txt file, in main folder
|
||||
*
|
||||
*/
|
||||
#include "StdInc.h"
|
||||
#include "AIMovementCostRule.h"
|
||||
|
||||
namespace AIPathfinding
|
||||
{
|
||||
AIMovementCostRule::AIMovementCostRule(std::shared_ptr<AINodeStorage> nodeStorage)
|
||||
: nodeStorage(nodeStorage)
|
||||
{
|
||||
}
|
||||
|
||||
void AIMovementCostRule::process(
|
||||
const PathNodeInfo & source,
|
||||
CDestinationNodeInfo & destination,
|
||||
const PathfinderConfig * pathfinderConfig,
|
||||
CPathfinderHelper * pathfinderHelper) const
|
||||
{
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* AIMovementCostRule.h, part of VCMI engine
|
||||
*
|
||||
* Authors: listed in file AUTHORS in main folder
|
||||
*
|
||||
* License: GNU General Public License v2.0 or later
|
||||
* Full text of license available in license.txt file, in main folder
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../AINodeStorage.h"
|
||||
#include "../../VCAI.h"
|
||||
#include "../../../../CCallback.h"
|
||||
#include "../../../../lib/mapping/CMap.h"
|
||||
#include "../../../../lib/mapObjects/MapObjects.h"
|
||||
|
||||
namespace AIPathfinding
|
||||
{
|
||||
class AIMovementCostRule : public MovementCostRule
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<AINodeStorage> nodeStorage;
|
||||
|
||||
public:
|
||||
AIMovementCostRule(std::shared_ptr<AINodeStorage> nodeStorage);
|
||||
|
||||
virtual void process(
|
||||
const PathNodeInfo & source,
|
||||
CDestinationNodeInfo & destination,
|
||||
const PathfinderConfig * pathfinderConfig,
|
||||
CPathfinderHelper * pathfinderHelper) const override;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user