forked from github/server
do not call can_survive all this much.
This commit is contained in:
parent
ef43aaa830
commit
26a416c5ba
|
@ -299,6 +299,8 @@ static direction_t random_neighbour(region * r, unit * u)
|
||||||
next[i] = NULL;
|
next[i] = NULL;
|
||||||
}
|
}
|
||||||
c2++;
|
c2++;
|
||||||
|
} else {
|
||||||
|
next[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +323,7 @@ static direction_t random_neighbour(region * r, unit * u)
|
||||||
c = -1;
|
c = -1;
|
||||||
for (i = 0; i != MAXDIRECTIONS; i++) {
|
for (i = 0; i != MAXDIRECTIONS; i++) {
|
||||||
region *rn = next[i];
|
region *rn = next[i];
|
||||||
if (rn && can_survive(u, rn)) {
|
if (rn) {
|
||||||
c++;
|
c++;
|
||||||
if (c == rr) {
|
if (c == rr) {
|
||||||
return (direction_t)i;
|
return (direction_t)i;
|
||||||
|
|
Loading…
Reference in New Issue