forked from github/server
Enforcing maximum size of units in recruiting.
This commit is contained in:
parent
13e19fb8b3
commit
b1f1f07231
|
@ -353,6 +353,11 @@ do_recruiting(recruitment * recruits, int available)
|
|||
number = min(number, afford);
|
||||
use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, rc->recruitcost*number);
|
||||
}
|
||||
if (u->number+number>UNIT_MAXSIZE) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_unit_size", "maxsize", UNIT_MAXSIZE));
|
||||
number = UNIT_MAXSIZE-u->number;
|
||||
assert(number>=0);
|
||||
}
|
||||
add_recruits(u, number, req->qty);
|
||||
if ((rc->ec_flags & ECF_REC_ETHEREAL)==0) {
|
||||
recruited += number * multi;
|
||||
|
|
|
@ -186,6 +186,7 @@ give_men(int n, unit * u, unit * u2, struct order * ord)
|
|||
if (u2 && n+u2->number > UNIT_MAXSIZE) {
|
||||
n = UNIT_MAXSIZE-u2->number;
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_unit_size", "maxsize", UNIT_MAXSIZE));
|
||||
assert(n>=0);
|
||||
}
|
||||
if (n == 0) {
|
||||
error = 96;
|
||||
|
|
Loading…
Reference in New Issue