mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +02:00
- Implemented serialization of Goals. Loaded games work, at least.
- Attempts to add Subterranean Gates to SectorMap - Extensive use of ClearWayTo goal.
This commit is contained in:
@@ -480,6 +480,32 @@ float FuzzyHelper::evaluate (Goals::GatherArmy & g)
|
||||
float army = g.hero->getArmyStrength();
|
||||
return g.value / std::max(g.value - army, 1000.0f);
|
||||
}
|
||||
|
||||
float FuzzyHelper::evaluate (Goals::ClearWayTo & g)
|
||||
{
|
||||
if (!g.hero.h)
|
||||
throw cannotFulfillGoalException("ClearWayTo called without hero!");
|
||||
|
||||
SectorMap sm(g.hero);
|
||||
int3 t = sm.firstTileToGet(g.hero, g.tile);
|
||||
|
||||
if (t.valid())
|
||||
{
|
||||
if (isSafeToVisit(g.hero, t))
|
||||
{
|
||||
g.setpriority(Goals::VisitTile(g.tile).sethero(g.hero).setisAbstract(g.isAbstract).accept(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
g.setpriority (Goals::GatherArmy(evaluateDanger(t, g.hero.h)*SAFE_ATTACK_CONSTANT).
|
||||
sethero(g.hero).setisAbstract(true).accept(this));
|
||||
}
|
||||
return g.priority;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
float FuzzyHelper::evaluate (Goals::BuildThis & g)
|
||||
{
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user