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