code cleanup
This commit is contained in:
parent
7210498517
commit
3421a6e267
@ -117,12 +117,9 @@ public class RegionManager {
|
|||||||
int minDistance = -1;
|
int minDistance = -1;
|
||||||
for(Region r : regions) {
|
for(Region r : regions) {
|
||||||
int check = distance(loc, r.location());
|
int check = distance(loc, r.location());
|
||||||
if (minDistance == -1) {
|
if (minDistance == -1 || check < minDistance) {
|
||||||
nearest = r;
|
nearest = r;
|
||||||
minDistance = check;
|
minDistance = check;
|
||||||
} else if (check < minDistance) {
|
|
||||||
nearest = r;
|
|
||||||
minDistance = check;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nearest;
|
return nearest;
|
||||||
|
Loading…
Reference in New Issue
Block a user