forked from github/server
- asserting on valid return values from recruit-function
- fixing crashbug with --lomem)
This commit is contained in:
parent
d8c0e47b44
commit
c1e86e4fa0
|
@ -389,21 +389,22 @@ expandrecruit(region * r, request * recruitorders)
|
||||||
/* centaurs: */
|
/* centaurs: */
|
||||||
recruits = select_recruitment(&recruitorders, horse_recruiters, &total);
|
recruits = select_recruitment(&recruitorders, horse_recruiters, &total);
|
||||||
if (recruits) {
|
if (recruits) {
|
||||||
int horses = rhorses(r) * 2;
|
int recruited, horses = rhorses(r) * 2;
|
||||||
if (total<horses) horses = total;
|
if (total<horses) horses = total;
|
||||||
horses = horses / 2 - do_recruiting(recruits, horses);
|
recruited = do_recruiting(recruits, horses);
|
||||||
rsethorses(r, horses);
|
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, &total);
|
||||||
if (recruits) {
|
if (recruits) {
|
||||||
int peasants = rpeasants(r);
|
int recruited, peasants = rpeasants(r) * 2;
|
||||||
int rfrac = (2 * peasants) / RECRUITFRACTION; /* anzahl orks. 2 ork = 1 bauer */
|
int rfrac = peasants / RECRUITFRACTION; /* anzahl orks. 2 ork = 1 bauer */
|
||||||
if (total<rfrac) rfrac = total;
|
if (total<rfrac) rfrac = total;
|
||||||
peasants = peasants - (1 + do_recruiting(recruits, rfrac))/2;
|
recruited = do_recruiting(recruits, rfrac);
|
||||||
rsetpeasants(r, peasants);
|
assert(recruited<=rfrac);
|
||||||
|
rsetpeasants(r, (peasants - recruited)/2);
|
||||||
free_recruitments(recruits);
|
free_recruitments(recruits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -810,7 +810,7 @@ free_region(region * r)
|
||||||
while (r->individual_messages) {
|
while (r->individual_messages) {
|
||||||
struct individual_message * msg = r->individual_messages;
|
struct individual_message * msg = r->individual_messages;
|
||||||
r->individual_messages = msg->next;
|
r->individual_messages = msg->next;
|
||||||
free_messagelist(msg->msgs);
|
if (msg->msgs) free_messagelist(msg->msgs);
|
||||||
free(msg);
|
free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue