1
0
mirror of https://github.com/vcmi/vcmi.git synced 2026-05-22 09:55:17 +02:00

AI pathfinding: use own FuzzyHelper for each storage to allow parallel processing without cuncarrent access

This commit is contained in:
Andrii Danylchenko
2019-02-10 15:25:17 +02:00
parent 675406589c
commit 881e7f2061
12 changed files with 146 additions and 157 deletions
+2 -3
View File
@@ -19,6 +19,7 @@
#define UNGUARDED_OBJECT (100.0f) //we consider unguarded objects 100 times weaker than us
extern boost::thread_specific_ptr<VCAI> ai;
extern FuzzyHelper * fh;
engineBase::engineBase()
{
@@ -202,8 +203,6 @@ TacticalAdvantageEngine::TacticalAdvantageEngine()
float TacticalAdvantageEngine::getTacticalAdvantage(const CArmedInstance * we, const CArmedInstance * enemy)
{
boost::unique_lock<boost::mutex> lock(mx);
float output = 1;
try
{
@@ -344,7 +343,7 @@ void HeroMovementGoalEngineBase::setSharedFuzzyVariables(Goals::AbstractGoal & g
}
float strengthRatioData = 10.0f; //we are much stronger than enemy
ui64 danger = evaluateDanger(goal.tile, goal.hero.h);
ui64 danger = fh->evaluateDanger(goal.tile, goal.hero.h);
if(danger)
strengthRatioData = (fl::scalar)goal.hero.h->getTotalStrength() / danger;