Skip to content

Commit

Permalink
Merge pull request #721 from ennorehling/master
Browse files Browse the repository at this point in the history
BUG 2357: new players must be able to recruit
  • Loading branch information
ennorehling authored Aug 18, 2017
2 parents b8e755c + aa61860 commit d13cd0d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/kernel/faction.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d13cd0d

Please sign in to comment.