1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-04 00:15:53 +02:00
vcmi/AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.h

65 lines
1.8 KiB
C++
Raw Normal View History

2021-05-15 18:22:44 +02:00
/*
* AILayerTransitionRule.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"
2021-05-16 14:39:38 +02:00
#include "../../AIGateway.h"
2021-05-15 18:22:44 +02:00
#include "../Actions/BoatActions.h"
2023-09-16 11:33:02 +02:00
#include "../Actions/AdventureSpellCastMovementActions.h"
2021-05-15 18:22:44 +02:00
#include "../../../../CCallback.h"
#include "../../../../lib/mapObjects/MapObjects.h"
#include "../../../../lib/pathfinder/PathfindingRules.h"
2021-05-15 18:22:44 +02:00
2022-09-26 20:01:07 +02:00
namespace NKAI
{
2021-05-15 18:22:44 +02:00
namespace AIPathfinding
{
class AILayerTransitionRule : public LayerTransitionRule
{
private:
CPlayerSpecificInfoCallback * cb;
Nullkiller * ai;
2021-05-15 18:22:44 +02:00
std::map<int3, std::shared_ptr<const BuildBoatAction>> virtualBoats;
std::shared_ptr<AINodeStorage> nodeStorage;
2021-05-15 18:22:49 +02:00
std::map<const CGHeroInstance *, std::shared_ptr<const SummonBoatAction>> summonableVirtualBoats;
2023-09-16 11:33:02 +02:00
std::map<const CGHeroInstance *, std::shared_ptr<const WaterWalkingAction>> waterWalkingActions;
std::map<const CGHeroInstance *, std::shared_ptr<const AirWalkingAction>> airWalkingActions;
2021-05-15 18:22:44 +02:00
public:
AILayerTransitionRule(
CPlayerSpecificInfoCallback * cb,
Nullkiller * ai,
2024-03-28 15:37:30 +02:00
std::shared_ptr<AINodeStorage> nodeStorage);
2021-05-15 18:22:44 +02:00
virtual void process(
const PathNodeInfo & source,
CDestinationNodeInfo & destination,
const PathfinderConfig * pathfinderConfig,
CPathfinderHelper * pathfinderHelper) const override;
private:
void setup();
2023-09-16 11:33:02 +02:00
void collectVirtualBoats();
2021-05-15 18:22:44 +02:00
std::shared_ptr<const VirtualBoatAction> findVirtualBoat(
CDestinationNodeInfo & destination,
const PathNodeInfo & source) const;
2023-09-16 11:33:02 +02:00
bool tryUseSpecialAction(
2021-05-15 18:22:44 +02:00
CDestinationNodeInfo & destination,
const PathNodeInfo & source,
2023-09-16 11:33:02 +02:00
std::shared_ptr<const SpecialAction> specialAction,
EPathNodeAction targetAction) const;
2021-05-15 18:22:44 +02:00
};
}
2022-09-26 20:01:07 +02:00
}