From aa618609964a794449f4d6f96ae67fa86784e986 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 18 Aug 2017 20:20:12 +0200 Subject: [PATCH] BUG 2357: make sure starting regions have enough recruits --- src/kernel/faction.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/kernel/faction.c b/src/kernel/faction.c index e804534c4..0b099df0f 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -283,12 +283,20 @@ faction *addfaction(const char *email, const char *password, return f; } +#define PEASANT_MIN (10 * RECRUITFRACTION) +#define PEASANT_MAX (20 * RECRUITFRACTION) + unit *addplayer(region * r, faction * f) { unit *u; const char * name; const struct equipment* eq; + assert(r->land); + if (rpeasants(r) < PEASANT_MIN) { + rsetpeasants(r, PEASANT_MIN + rng_int() % (PEASANT_MAX - PEASANT_MIN)); + } + assert(f->units == NULL); faction_setorigin(f, 0, r->x, r->y); u = create_unit(r, f, 1, f->race, 0, NULL, NULL);