Merge pull request #721 from ennorehling/master

BUG 2357: new players must be able to recruit
This commit is contained in:
Enno Rehling 2017-08-18 20:26:23 +02:00 committed by GitHub
commit d13cd0d0df
1 changed files with 8 additions and 0 deletions

View File

@ -283,12 +283,20 @@ faction *addfaction(const char *email, const char *password,
return f; return f;
} }
#define PEASANT_MIN (10 * RECRUITFRACTION)
#define PEASANT_MAX (20 * RECRUITFRACTION)
unit *addplayer(region * r, faction * f) unit *addplayer(region * r, faction * f)
{ {
unit *u; unit *u;
const char * name; const char * name;
const struct equipment* eq; 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); assert(f->units == NULL);
faction_setorigin(f, 0, r->x, r->y); faction_setorigin(f, 0, r->x, r->y);
u = create_unit(r, f, 1, f->race, 0, NULL, NULL); u = create_unit(r, f, 1, f->race, 0, NULL, NULL);