forked from github/server
further reduce teh amount of temporary storage required by the economy module.
This commit is contained in:
parent
6f7c8743b3
commit
5b61f895a2
2 changed files with 5 additions and 7 deletions
|
@ -185,9 +185,6 @@ unsigned int expand_production(region * r, econ_request * requests, econ_request
|
||||||
static void free_requests(econ_request *requests) {
|
static void free_requests(econ_request *requests) {
|
||||||
while (requests) {
|
while (requests) {
|
||||||
econ_request *req = requests->next;
|
econ_request *req = requests->next;
|
||||||
if (requests->ord) {
|
|
||||||
free_order(requests->ord);
|
|
||||||
}
|
|
||||||
free(requests);
|
free(requests);
|
||||||
requests = req;
|
requests = req;
|
||||||
}
|
}
|
||||||
|
@ -347,7 +344,7 @@ static int do_recruiting(recruitment * recruits, int available)
|
||||||
if (number > afford) number = afford;
|
if (number > afford) number = afford;
|
||||||
}
|
}
|
||||||
if (u->number + number > UNIT_MAXSIZE) {
|
if (u->number + number > UNIT_MAXSIZE) {
|
||||||
ADDMSG(&u->faction->msgs, msg_feedback(u, req->ord, "error_unit_size",
|
ADDMSG(&u->faction->msgs, msg_feedback(u, req->type.recruit.ord, "error_unit_size",
|
||||||
"maxsize", UNIT_MAXSIZE));
|
"maxsize", UNIT_MAXSIZE));
|
||||||
number = UNIT_MAXSIZE - u->number;
|
number = UNIT_MAXSIZE - u->number;
|
||||||
assert(number >= 0);
|
assert(number >= 0);
|
||||||
|
@ -382,7 +379,6 @@ void free_recruitments(recruitment * recruits)
|
||||||
while (rec->requests) {
|
while (rec->requests) {
|
||||||
econ_request *req = rec->requests;
|
econ_request *req = rec->requests;
|
||||||
rec->requests = req->next;
|
rec->requests = req->next;
|
||||||
free_order(req->ord);
|
|
||||||
free(req);
|
free(req);
|
||||||
}
|
}
|
||||||
free(rec);
|
free(rec);
|
||||||
|
@ -560,7 +556,7 @@ static void recruit(unit * u, struct order *ord, econ_request ** recruitorders)
|
||||||
o = (econ_request *)calloc(1, sizeof(econ_request));
|
o = (econ_request *)calloc(1, sizeof(econ_request));
|
||||||
o->qty = n;
|
o->qty = n;
|
||||||
o->unit = u;
|
o->unit = u;
|
||||||
o->ord = copy_order(ord);
|
o->type.recruit.ord = ord;
|
||||||
addlist(recruitorders, o);
|
addlist(recruitorders, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,11 @@ extern "C" {
|
||||||
typedef struct econ_request {
|
typedef struct econ_request {
|
||||||
struct econ_request *next;
|
struct econ_request *next;
|
||||||
struct unit *unit;
|
struct unit *unit;
|
||||||
struct order *ord;
|
|
||||||
int qty;
|
int qty;
|
||||||
union {
|
union {
|
||||||
|
struct {
|
||||||
|
struct order *ord;
|
||||||
|
} recruit;
|
||||||
struct {
|
struct {
|
||||||
int no;
|
int no;
|
||||||
bool goblin; /* stealing */
|
bool goblin; /* stealing */
|
||||||
|
|
Loading…
Reference in a new issue