Use ef_blank() when extending treaty, loan, comm and trade file
Only treaty extension initialized ef_type and uid properly. None of them zeroed unused members and holes in the struct. comm and trade extension called ef_extend(), which had no effect, so remove that.
This commit is contained in:
parent
93d8c53f21
commit
2da8d0c796
3 changed files with 6 additions and 8 deletions
|
@ -134,8 +134,7 @@ do_treaty(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trty.ef_type = EF_TREATY;
|
ef_blank(EF_TREATY, nstr.cur, &trty);
|
||||||
trty.trt_uid = nstr.cur;
|
|
||||||
trty.trt_acond = ourcond;
|
trty.trt_acond = ourcond;
|
||||||
trty.trt_bcond = theircond;
|
trty.trt_bcond = theircond;
|
||||||
trty.trt_status = TS_PROPOSED;
|
trty.trt_status = TS_PROPOSED;
|
||||||
|
@ -220,6 +219,7 @@ do_loan(void)
|
||||||
if (loan.l_status == LS_FREE)
|
if (loan.l_status == LS_FREE)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
ef_blank(EF_LOAN, nstr.cur, &loan);
|
||||||
loan.l_loner = player->cnum;
|
loan.l_loner = player->cnum;
|
||||||
loan.l_lonee = recipient;
|
loan.l_lonee = recipient;
|
||||||
loan.l_status = LS_PROPOSED;
|
loan.l_status = LS_PROPOSED;
|
||||||
|
|
|
@ -143,9 +143,8 @@ sell(void)
|
||||||
if (comm.com_owner == 0)
|
if (comm.com_owner == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (getcomm(ii, &comm) == 0)
|
|
||||||
ef_extend(EF_COMM, 1);
|
|
||||||
(void)time(&now);
|
(void)time(&now);
|
||||||
|
ef_blank(EF_COMM, ii, &comm);
|
||||||
comm.com_type = ip->i_uid;
|
comm.com_type = ip->i_uid;
|
||||||
comm.com_owner = player->cnum;
|
comm.com_owner = player->cnum;
|
||||||
comm.com_price = price;
|
comm.com_price = price;
|
||||||
|
|
|
@ -113,7 +113,7 @@ set(void)
|
||||||
if (foundslot >= 0) {
|
if (foundslot >= 0) {
|
||||||
pr("%s #%d (lot #%d) removed from trading\n",
|
pr("%s #%d (lot #%d) removed from trading\n",
|
||||||
trade_nameof(&trade, &item), ni.cur, foundslot);
|
trade_nameof(&trade, &item), ni.cur, foundslot);
|
||||||
memset(&trade, 0, sizeof(trade));
|
trade.trd_owner = 0;
|
||||||
puttrade(ni_trade.cur, &trade);
|
puttrade(ni_trade.cur, &trade);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,10 +121,9 @@ set(void)
|
||||||
id = foundslot;
|
id = foundslot;
|
||||||
else if (freeslot >= 0)
|
else if (freeslot >= 0)
|
||||||
id = freeslot;
|
id = freeslot;
|
||||||
else {
|
else
|
||||||
ef_extend(EF_TRADE, 1);
|
|
||||||
id = ni_trade.cur;
|
id = ni_trade.cur;
|
||||||
}
|
ef_blank(EF_TRADE, id, &trade);
|
||||||
trade.trd_x = item.gen.x;
|
trade.trd_x = item.gen.x;
|
||||||
trade.trd_y = item.gen.y;
|
trade.trd_y = item.gen.y;
|
||||||
trade.trd_type = type;
|
trade.trd_type = type;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue