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;
|
||||
}
|
||||
}
|
||||
trty.ef_type = EF_TREATY;
|
||||
trty.trt_uid = nstr.cur;
|
||||
ef_blank(EF_TREATY, nstr.cur, &trty);
|
||||
trty.trt_acond = ourcond;
|
||||
trty.trt_bcond = theircond;
|
||||
trty.trt_status = TS_PROPOSED;
|
||||
|
@ -220,6 +219,7 @@ do_loan(void)
|
|||
if (loan.l_status == LS_FREE)
|
||||
break;
|
||||
}
|
||||
ef_blank(EF_LOAN, nstr.cur, &loan);
|
||||
loan.l_loner = player->cnum;
|
||||
loan.l_lonee = recipient;
|
||||
loan.l_status = LS_PROPOSED;
|
||||
|
|
|
@ -143,9 +143,8 @@ sell(void)
|
|||
if (comm.com_owner == 0)
|
||||
break;
|
||||
}
|
||||
if (getcomm(ii, &comm) == 0)
|
||||
ef_extend(EF_COMM, 1);
|
||||
(void)time(&now);
|
||||
ef_blank(EF_COMM, ii, &comm);
|
||||
comm.com_type = ip->i_uid;
|
||||
comm.com_owner = player->cnum;
|
||||
comm.com_price = price;
|
||||
|
|
|
@ -113,7 +113,7 @@ set(void)
|
|||
if (foundslot >= 0) {
|
||||
pr("%s #%d (lot #%d) removed from trading\n",
|
||||
trade_nameof(&trade, &item), ni.cur, foundslot);
|
||||
memset(&trade, 0, sizeof(trade));
|
||||
trade.trd_owner = 0;
|
||||
puttrade(ni_trade.cur, &trade);
|
||||
}
|
||||
} else {
|
||||
|
@ -121,10 +121,9 @@ set(void)
|
|||
id = foundslot;
|
||||
else if (freeslot >= 0)
|
||||
id = freeslot;
|
||||
else {
|
||||
ef_extend(EF_TRADE, 1);
|
||||
else
|
||||
id = ni_trade.cur;
|
||||
}
|
||||
ef_blank(EF_TRADE, id, &trade);
|
||||
trade.trd_x = item.gen.x;
|
||||
trade.trd_y = item.gen.y;
|
||||
trade.trd_type = type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue