do not call can_survive all this much.

This commit is contained in:
Enno Rehling 2016-10-03 16:38:17 +02:00
parent ef43aaa830
commit 26a416c5ba
1 changed files with 3 additions and 1 deletions

View File

@ -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;