Fixed problem: unit unable to find path to goal if unit is next to goal

Patch by Neil Tan
This commit is contained in:
Pali Rohár 2012-01-07 16:49:03 +01:00
parent 84d1fe7fcd
commit 780a035f95

View file

@ -559,11 +559,13 @@ static inline int CostMoveTo(unsigned int index, void *data)
// moving unit are crossable
cost += AStarMovingUnitCrossingCost;
} else {
// for non moving unit Always Fail
// FIXME: Need support for moving a fixed unit to add cost
*c = -1;
return -1;
//cost += AStarFixedUnitCrossingCost;
// for non moving unit Always Fail unless goal is unit
if((CUnit *) data != goal) {
// FIXME: Need support for moving a fixed unit to add cost
*c = -1;
return -1;
//cost += AStarFixedUnitCrossingCost;
}
}
}
// Add cost of crossing unknown tiles if required