diff --git a/src/common/gamecode/randenc.c b/src/common/gamecode/randenc.c index 0fa4fc9a8..f58470a44 100644 --- a/src/common/gamecode/randenc.c +++ b/src/common/gamecode/randenc.c @@ -437,7 +437,7 @@ encounters(void) int n = rng_int() % c; for (u = r->units; u; u = u->next) { - if (i+u->number>c) break; + if (i+u->number>n) break; } assert(u && u->number); encounter(r, u);