Fix excessive path penalties
This commit is contained in:
parent
4015f8de06
commit
3ed7a71dd5
1 changed files with 19 additions and 7 deletions
|
|
@ -38,9 +38,13 @@ float PlannerHeuristic::gfunctionKillsDistCTWithHostage (int team, int currentIn
|
|||
if (current.flags & NodeFlag::NoHostage) {
|
||||
return kInfiniteHeuristic;
|
||||
}
|
||||
else if (current.flags & (NodeFlag::Crouch | NodeFlag::Ladder)) {
|
||||
return gfunctionKillsDist (team, currentIndex, parentIndex) * 500.0f;
|
||||
else if (current.flags & NodeFlag::Ladder) {
|
||||
return gfunctionKillsDist (team, currentIndex, parentIndex) * 6.0f;
|
||||
}
|
||||
else if (current.flags & NodeFlag::Crouch) {
|
||||
return gfunctionKillsDist (team, currentIndex, parentIndex) * 3.0f;
|
||||
}
|
||||
|
||||
return gfunctionKillsDist (team, currentIndex, parentIndex);
|
||||
}
|
||||
|
||||
|
|
@ -69,9 +73,13 @@ auto PlannerHeuristic::gfunctionKillsCTWithHostage (int team, int currentIndex,
|
|||
if (current.flags & NodeFlag::NoHostage) {
|
||||
return kInfiniteHeuristic;
|
||||
}
|
||||
else if (current.flags & (NodeFlag::Crouch | NodeFlag::Ladder)) {
|
||||
return gfunctionKills (team, currentIndex, parentIndex) * 500.0f;
|
||||
else if (current.flags & NodeFlag::Ladder) {
|
||||
return gfunctionKills (team, currentIndex, parentIndex) * 6.0f;
|
||||
}
|
||||
else if (current.flags & NodeFlag::Crouch) {
|
||||
return gfunctionKills (team, currentIndex, parentIndex) * 3.0f;
|
||||
}
|
||||
|
||||
return gfunctionKills (team, currentIndex, parentIndex);
|
||||
}
|
||||
|
||||
|
|
@ -103,9 +111,13 @@ float PlannerHeuristic::gfunctionPathDistWithHostage (int, int currentIndex, int
|
|||
if (current.flags & NodeFlag::NoHostage) {
|
||||
return kInfiniteHeuristic;
|
||||
}
|
||||
else if (current.flags & (NodeFlag::Crouch | NodeFlag::Ladder)) {
|
||||
return gfunctionPathDist (Team::Unassigned, currentIndex, parentIndex) * 500.0f;
|
||||
else if (current.flags & NodeFlag::Ladder) {
|
||||
return gfunctionPathDist (Team::Unassigned, currentIndex, parentIndex) * 6.0f;
|
||||
}
|
||||
else if (current.flags & NodeFlag::Crouch) {
|
||||
return gfunctionPathDist (Team::Unassigned, currentIndex, parentIndex) * 3.0f;
|
||||
}
|
||||
|
||||
return gfunctionPathDist (Team::Unassigned, currentIndex, parentIndex);
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +215,7 @@ bool AStarAlgo::cantSkipNode (const int a, const int b, bool skipVisCheck) {
|
|||
const float distanceSq = ag.origin.distanceSq (bg.origin);
|
||||
|
||||
const bool tooFar = distanceSq > cr::sqrf (400.0f);
|
||||
const bool tooClose = distanceSq < cr::sqrtf (40.0f);
|
||||
const bool tooClose = distanceSq < cr::sqrf (40.0f);
|
||||
|
||||
if (tooFar || tooClose) {
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue