forked from github/server
orcs get too many recruits
This commit is contained in:
parent
b5d86690f0
commit
f33d400576
|
@ -229,6 +229,7 @@ select_recruitment(request ** rop, int (*quantify)(const struct race*, int), int
|
||||||
static void
|
static void
|
||||||
add_recruits(unit * u, int number, int wanted)
|
add_recruits(unit * u, int number, int wanted)
|
||||||
{
|
{
|
||||||
|
assert(number<=wanted);
|
||||||
if (number > 0) {
|
if (number > 0) {
|
||||||
unit * unew;
|
unit * unew;
|
||||||
int i = fspecial(u->faction, FS_MILITIA);
|
int i = fspecial(u->faction, FS_MILITIA);
|
||||||
|
@ -348,7 +349,7 @@ do_recruiting(recruitment * recruits, int available)
|
||||||
|
|
||||||
if (rc==new_race[RC_URUK]) multi = 1;
|
if (rc==new_race[RC_URUK]) multi = 1;
|
||||||
|
|
||||||
number = min(req->qty * 2, get) / multi;
|
number = min(req->qty, get / multi);
|
||||||
if (rc->recruitcost) {
|
if (rc->recruitcost) {
|
||||||
int afford = get_pooled(u, u->region, R_SILVER) / rc->recruitcost;
|
int afford = get_pooled(u, u->region, R_SILVER) / rc->recruitcost;
|
||||||
number = min(number, afford);
|
number = min(number, afford);
|
||||||
|
@ -381,32 +382,32 @@ expandrecruit(region * r, request * recruitorders)
|
||||||
{
|
{
|
||||||
recruitment * recruits = NULL;
|
recruitment * recruits = NULL;
|
||||||
|
|
||||||
int total = 0;
|
int orc_total = 0;
|
||||||
|
|
||||||
/* centaurs: */
|
/* centaurs: */
|
||||||
recruits = select_recruitment(&recruitorders, horse_recruiters, &total);
|
recruits = select_recruitment(&recruitorders, horse_recruiters, &orc_total);
|
||||||
if (recruits) {
|
if (recruits) {
|
||||||
int recruited, horses = rhorses(r) * 2;
|
int recruited, horses = rhorses(r) * 2;
|
||||||
if (total<horses) horses = total;
|
if (orc_total<horses) horses = orc_total;
|
||||||
recruited = do_recruiting(recruits, horses);
|
recruited = do_recruiting(recruits, horses);
|
||||||
rsethorses(r, (horses - recruited) / 2);
|
rsethorses(r, (horses - recruited) / 2);
|
||||||
free_recruitments(recruits);
|
free_recruitments(recruits);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* peasant limited: */
|
/* peasant limited: */
|
||||||
recruits = select_recruitment(&recruitorders, peasant_recruiters, &total);
|
recruits = select_recruitment(&recruitorders, peasant_recruiters, &orc_total);
|
||||||
if (recruits) {
|
if (recruits) {
|
||||||
int recruited, peasants = rpeasants(r) * 2;
|
int orc_recruited, orc_peasants = rpeasants(r) * 2;
|
||||||
int rfrac = peasants / RECRUITFRACTION; /* anzahl orks. 2 ork = 1 bauer */
|
int orc_frac = orc_peasants / RECRUITFRACTION; /* anzahl orks. 2 ork = 1 bauer */
|
||||||
if (total<rfrac) rfrac = total;
|
if (orc_total<orc_frac) orc_frac = orc_total;
|
||||||
recruited = do_recruiting(recruits, rfrac);
|
orc_recruited = do_recruiting(recruits, orc_frac);
|
||||||
assert(recruited<=rfrac);
|
assert(orc_recruited<=orc_frac);
|
||||||
rsetpeasants(r, (peasants - recruited)/2);
|
rsetpeasants(r, (orc_peasants - orc_recruited)/2);
|
||||||
free_recruitments(recruits);
|
free_recruitments(recruits);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no limit: */
|
/* no limit: */
|
||||||
recruits = select_recruitment(&recruitorders, any_recruiters, &total);
|
recruits = select_recruitment(&recruitorders, any_recruiters, &orc_total);
|
||||||
if (recruits) {
|
if (recruits) {
|
||||||
do_recruiting(recruits, INT_MAX);
|
do_recruiting(recruits, INT_MAX);
|
||||||
free_recruitments(recruits);
|
free_recruitments(recruits);
|
||||||
|
|
Loading…
Reference in New Issue