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
This commit is contained in:
Ivan Savenko committed 2025-01-23 15:28:44 +00:00
1 parent ced98f4698
commit 32391dc7a9
38 files changed
+249 -131

No files matched your search

+18
View File
@@ -97,6 +97,8 @@
#include "../lib/networkPacks/PacksForServer.h"
#include "../lib/pathfinder/CGPathNode.h"
#include "../lib/pathfinder/PathfinderCache.h"
#include "../lib/pathfinder/PathfinderOptions.h"
#include "../lib/serializer/CTypeList.h"
#include "../lib/serializer/ESerializationVersion.h"
@@ -156,6 +158,7 @@ CPlayerInterface::~CPlayerInterface()
if (LOCPLINT == this)
LOCPLINT = nullptr;
}
void CPlayerInterface::initGameInterface(std::shared_ptr<Environment> ENV, std::shared_ptr<CCallback> CB)
{
cb = CB;
@@ -164,9 +167,20 @@ void CPlayerInterface::initGameInterface(std::shared_ptr<Environment> ENV, std::
CCS->musich->loadTerrainMusicThemes();
initializeHeroTownList();
pathfinderCache = std::make_unique<PathfinderCache>(cb.get(), PathfinderOptions(cb.get()));
adventureInt.reset(new AdventureMapInterface());
}
std::shared_ptr<const CPathsInfo> CPlayerInterface::getPathsInfo(const CGHeroInstance * h)
{
return pathfinderCache->getPathsInfo(h);
}
void CPlayerInterface::invalidatePaths()
{
pathfinderCache->invalidatePaths();
}
void CPlayerInterface::closeAllDialogs()
{
// remove all active dialogs that do not expect query answer
@@ -464,6 +478,8 @@ void CPlayerInterface::heroSecondarySkillChanged(const CGHeroInstance * hero, in
EVENT_HANDLER_CALLED_BY_CLIENT;
for (auto cuw : GH.windows().findWindows<IMarketHolder>())
cuw->updateSecondarySkills();
localState->verifyPath(hero);
}
void CPlayerInterface::heroManaPointsChanged(const CGHeroInstance * hero)
@@ -580,6 +596,8 @@ void CPlayerInterface::garrisonsChanged(std::vector<const CArmedInstance *> objs
if (hero)
{
localState->verifyPath(hero);
adventureInt->onHeroChanged(hero);
if(hero->inTownGarrison && hero->visitedTown != town)
adventureInt->onTownChanged(hero->visitedTown);