瀏覽代碼

fix AINodeStorage::calculateChainInfo using invalid/unverified/lost heroes which lead to multiple issues down the line in makeTurn

Mircea TheHonestCTO 3 月之前
父節點
當前提交
19076ee29d
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      AI/Nullkiller2/Pathfinding/AINodeStorage.cpp

+ 8 - 0
AI/Nullkiller2/Pathfinding/AINodeStorage.cpp

@@ -1431,6 +1431,14 @@ void AINodeStorage::calculateChainInfo(std::vector<AIPath> & paths, const int3 &
 			continue;
 			continue;
 		}
 		}
 
 
+		if(HeroPtr heroPtr(node.actor->hero, aiNk->cc); !heroPtr.isVerified())
+		{
+#if NK2AI_TRACE_LEVEL >= 1
+			logAi->warn("AINodeStorage::calculateChainInfo Skipping unverified hero: %s", heroPtr.nameOrDefault());
+#endif
+			continue;
+		}
+
 		AIPath & path = paths.emplace_back();
 		AIPath & path = paths.emplace_back();
 
 
 		path.targetHero = node.actor->hero;
 		path.targetHero = node.actor->hero;