[Fix] Change calculation of absolute value to support floating point variables.

This commit is contained in:
Rtch90 2012-02-20 21:34:50 +00:00
parent 2e50097502
commit 61f1f2b2a4

View File

@ -70,7 +70,7 @@ void NPC::Move(void) {
if(_walkInPath && !_moving) {
Vec2 targetPos((float)_target->GetX(), (float)_target->GetY());
if(abs(Vec2::Distance(targetPos, realPos)) <= CHARACTER_SPEED) {
if(fabs(Vec2::Distance(targetPos, realPos)) <= CHARACTER_SPEED) {
_target = _astar.GetSolutionNext();
if(_target == NULL || _target == _lastTarget) {
_walkInPath = false;