Corrected logic of scheduler.c/findWorkArea()
This commit is contained in:
parent
51a3fc3719
commit
4f54f3030b
|
@ -34,6 +34,9 @@ struct {
|
|||
int x;
|
||||
int y;
|
||||
int z;
|
||||
int xmax;
|
||||
int ymax;
|
||||
int zmax;
|
||||
} typedef Arrow_t;
|
||||
|
||||
struct {
|
||||
|
|
|
@ -54,20 +54,20 @@ static Center_t *findWorkArea(Center_t *centersList, Arrow_t *electedArrow,
|
|||
|
||||
while (currentCenter){
|
||||
//printLog("Center : %d\n", currentCenter->x);
|
||||
if ( abs(electedArrow->x - currentCenter->x) >= ruleRadius
|
||||
&& abs(electedArrow->y - currentCenter->y) >= ruleRadius
|
||||
&& abs(electedArrow->z - currentCenter->z) >= ruleRadius
|
||||
if ( abs(electedArrow->x - currentCenter->x) <= ruleRadius
|
||||
|| abs(electedArrow->y - currentCenter->y) <= ruleRadius
|
||||
|| abs(electedArrow->z - currentCenter->z) <= ruleRadius
|
||||
){
|
||||
newCenter->x = electedArrow->x;
|
||||
newCenter->y = electedArrow->y;
|
||||
newCenter->z = electedArrow->z;
|
||||
return newCenter;
|
||||
free(newCenter);
|
||||
return NULL;
|
||||
}
|
||||
currentCenter = currentCenter->next;
|
||||
}
|
||||
|
||||
free(newCenter);
|
||||
return NULL;
|
||||
newCenter->x = electedArrow->x;
|
||||
newCenter->y = electedArrow->y;
|
||||
newCenter->z = electedArrow->z;
|
||||
return newCenter;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
|
Loading…
Reference in New Issue