Pathfinder Fix
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Stratagus |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Currently, we have the following code in astar.cpp (CostMoveToCall
// for non moving unit Always Fail unless goal is unit, or unit can attack the target
if (&unit != goal) {
if (goal->
&& goal->Variable[
cost += 2 * AStarMovingUnit
} else {
// FIXME: Need support for moving a fixed unit to add cost
return -1;
}
//cost += AStarFixedUnitC
}
The problem is that this makes melee units (or ranged units if the goal is outside range) keep trying to get to a target even if there is something blocking the way.
Modifying that code to this instead solves the issue:
// for non moving unit Always Fail unless goal is unit, or unit can attack the target
if (&unit != goal) {
if (goal->
&& unit.MapDistanc
&& goal->Variable[
cost += 2 * AStarMovingUnit
} else {
// FIXME: Need support for moving a fixed unit to add cost
return -1;
}
//cost += AStarFixedUnitC
}
This project was moved to https:/ /github. com/Wargus/ stratagus. All issues were migrated there.