Fix crash updating DORDER_PATROL.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9487 4a71c877-e1ca-e34f-864e-861f7616d084
master
Guangcong Luo 2010-01-24 22:30:05 +00:00 committed by Git SVN Gateway
parent bac704a7cf
commit ccef0c4b47
1 changed files with 2 additions and 2 deletions

View File

@ -535,14 +535,14 @@ void orderUpdateDroid(DROID *psDroid)
{
tooFarFromPath = false;
}
else if (deltaX >= deltaY &&
else if (abs(deltaX) >= abs(deltaY) &&
(SDWORD)MIN(psDroid->orderX, psDroid->orderX2)-SCOUT_DIST <= psDroid->pos.x &&
psDroid->pos.x <= (SDWORD)MAX(psDroid->orderX, psDroid->orderX2)+SCOUT_DIST)
{
tooFarFromPath = (abs(((SDWORD)psDroid->pos.x - (SDWORD)psDroid->orderX) * deltaY/deltaX +
(SDWORD)psDroid->orderY - (SDWORD)psDroid->pos.y) > SCOUT_DIST);
}
else if (deltaX <= deltaY &&
else if (abs(deltaX) <= abs(deltaY) &&
(SDWORD)MIN(psDroid->orderY, psDroid->orderY2)-SCOUT_DIST <= psDroid->pos.y &&
psDroid->pos.y <= (SDWORD)MAX(psDroid->orderY, psDroid->orderY2)+SCOUT_DIST)
{