1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00
vcmi/lib/pathfinder/PathfinderCache.h
Ivan Savenko 32391dc7a9 Pathfinder cache is now stored separately per playerBlocked
- human player will now use pathfinder settings from config (as before)
- nullkiller AI will now use its own, modified settings
- added option to configure NKAI usage of monolith to config
- fixed pathfinder costs not updating on receiving levelup
2025-01-23 15:28:44 +00:00

41 lines
1.1 KiB
C++

/*
* PathfinderCache.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 "PathfinderOptions.h"
VCMI_LIB_NAMESPACE_BEGIN
class CGameInfoCallback;
class CGHeroInstance;
class PathfinderConfig;
struct CPathsInfo;
class DLL_LINKAGE PathfinderCache
{
const CGameInfoCallback * cb;
std::mutex pathCacheMutex;
std::map<const CGHeroInstance *, std::shared_ptr<CPathsInfo>> pathCache;
PathfinderOptions options;
std::shared_ptr<PathfinderConfig> createConfig(const CGHeroInstance *h, CPathsInfo &out);
std::shared_ptr<CPathsInfo> buildPaths(const CGHeroInstance *h);
public:
PathfinderCache(const CGameInfoCallback * cb, const PathfinderOptions & options);
/// Invalidates and erases all existing paths from the cache
void invalidatePaths();
/// Returns compute path information for requested hero
std::shared_ptr<const CPathsInfo> getPathsInfo(const CGHeroInstance * h);
};
VCMI_LIB_NAMESPACE_END