瀏覽代碼

AI: rough hero chain stabilisation

Andrii Danylchenko 4 年之前
父節點
當前提交
62e5366a08

+ 0 - 2
AI/Nullkiller/CMakeLists.txt

@@ -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

+ 3 - 3
AI/Nullkiller/Pathfinding/AINodeStorage.cpp

@@ -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);

+ 2 - 0
AI/Nullkiller/Pathfinding/AINodeStorage.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+#define VCMI_TRACE_PATHFINDER
+
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/mapObjects/CGHeroInstance.h"
 #include "../AIUtility.h"

+ 1 - 1
AI/Nullkiller/Pathfinding/AIPathfinderConfig.cpp

@@ -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)
 		};

+ 0 - 27
AI/Nullkiller/Pathfinding/Rules/AIMovementCostRule.cpp

@@ -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
-	{
-	}
-}

+ 0 - 35
AI/Nullkiller/Pathfinding/Rules/AIMovementCostRule.h

@@ -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;
-	};
-}