From bb811df758d3563157216a7d7942179c21ab70b3 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 1 Mar 2004 17:21:40 +0000 Subject: [PATCH] (genitem, ship, plane, land): Remove unused member sell & equivalents. (genitem_ca, ship_ca, plane_ca, land_ca): Remove selector "sell". (comstr, trdstr): Members trd_price, com_price have no effect. Use them instead of trd_maxprice, com_maxprice and remove the latter. (commodity_ca, trade_ca): Remove selector "maxprice". --- include/commodity.h | 1 - include/genitem.h | 1 - include/land.h | 1 - include/plane.h | 1 - include/ship.h | 1 - include/trade.h | 1 - src/lib/commands/buil.c | 9 +++------ src/lib/commands/buy.c | 12 ++++++------ src/lib/commands/mark.c | 4 ++-- src/lib/commands/new.c | 1 - src/lib/commands/rese.c | 2 -- src/lib/commands/sell.c | 1 - src/lib/commands/set.c | 2 -- src/lib/commands/trad.c | 14 +++++++------- src/lib/global/nsc.c | 4 +--- 15 files changed, 19 insertions(+), 36 deletions(-) diff --git a/include/commodity.h b/include/commodity.h index b5dfa76e1..5fb31a4e6 100644 --- a/include/commodity.h +++ b/include/commodity.h @@ -44,7 +44,6 @@ struct comstr { int com_amount; float com_price; int com_maxbidder; - float com_maxprice; time_t com_markettime; coord com_x; coord com_y; diff --git a/include/genitem.h b/include/genitem.h index 6f02cb66e..75c3a125f 100644 --- a/include/genitem.h +++ b/include/genitem.h @@ -50,7 +50,6 @@ struct genitem { s_char type; s_char effic; s_char mobil; - short sell; short tech; s_char group; coord opx, opy; diff --git a/include/land.h b/include/land.h index f74a8e6c4..9661e7dfd 100644 --- a/include/land.h +++ b/include/land.h @@ -56,7 +56,6 @@ struct lndstr { s_char lnd_type; /* index in lchr[] */ s_char lnd_effic; /* 0% to 100% */ s_char lnd_mobil; /* mobility units made int for RS/6000 */ - short lnd_sell; /* pointer to trade file */ short lnd_tech; /* tech level ship was built at */ s_char lnd_army; /* group membership */ coord lnd_opx, lnd_opy; /* Op sector coords */ diff --git a/include/plane.h b/include/plane.h index 61a2be0dd..90533b17a 100644 --- a/include/plane.h +++ b/include/plane.h @@ -54,7 +54,6 @@ struct plnstr { s_char pln_type; /* index in plchr[] */ s_char pln_effic; /* actually "training" */ s_char pln_mobil; /* plane mobility */ - short pln_sell; /* index into trade file */ short pln_tech; /* plane's tech level */ s_char pln_wing; /* like fleet */ coord pln_opx; /* Op sector coords */ diff --git a/include/ship.h b/include/ship.h index 7987f6762..db829afd6 100644 --- a/include/ship.h +++ b/include/ship.h @@ -75,7 +75,6 @@ struct shpstr { s_char shp_type; /* index in mchr[] */ s_char shp_effic; /* 0% to 100% */ s_char shp_mobil; /* mobility units */ - short shp_sell; /* pointer to trade file */ short shp_tech; /* tech level ship was built at */ s_char shp_fleet; /* group membership */ coord shp_opx, shp_opy; /* Op sector coords */ diff --git a/include/trade.h b/include/trade.h index a63271811..d2ab6d21c 100644 --- a/include/trade.h +++ b/include/trade.h @@ -51,7 +51,6 @@ struct trdstr { short trd_unitid; long trd_price; int trd_maxbidder; - int trd_maxprice; time_t trd_markettime; coord trd_x; coord trd_y; diff --git a/src/lib/commands/buil.c b/src/lib/commands/buil.c index f7c13be39..7283fbcf7 100644 --- a/src/lib/commands/buil.c +++ b/src/lib/commands/buil.c @@ -436,7 +436,6 @@ build_ship(register struct sctstr *sp, register struct mchrstr *mp, ship.shp_nchoppers = 0; ship.shp_fleet = ' '; ship.shp_nv = 0; - ship.shp_sell = 0; ship.shp_tech = tlev; techdiff = (int)(tlev - mp->m_tech); @@ -572,7 +571,6 @@ build_land(register struct sctstr *sp, register struct lchrstr *lp, } else { land.lnd_mobil = 0; } - land.lnd_sell = 0; land.lnd_tech = tlev; land.lnd_uid = nstr.cur; land.lnd_army = ' '; @@ -617,12 +615,12 @@ build_land(register struct sctstr *sp, register struct lchrstr *lp, (vec[I_CIVIL] + vec[I_MILIT] + vec[I_UW])+1; if ((vec[I_FOOD]-max_amt) < food_needed) max_amt = (vec[I_FOOD]-food_needed); - + if (max_amt < 0) max_amt = 0; - + vec[I_FOOD] -= max_amt; - + memset(lvec, 0, sizeof(lvec)); getvec(VT_ITEM, lvec, (s_char *)&land, EF_LAND); lvec[I_FOOD] += max_amt; @@ -975,7 +973,6 @@ build_plane(register struct sctstr *sp, register struct plchrstr *pp, plane.pln_uid = nstr.cur; plane.pln_nuketype = -1; plane.pln_harden = 0; - plane.pln_sell = 0; plane.pln_flags = 0; makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid, plane.pln_x, plane.pln_y); diff --git a/src/lib/commands/buy.c b/src/lib/commands/buy.c index ab92e0eb7..888441ce4 100644 --- a/src/lib/commands/buy.c +++ b/src/lib/commands/buy.c @@ -127,13 +127,13 @@ buy(void) for (q = 0; gettrade(q, &tmpt); q++) { if (tmpt.trd_maxbidder == player->cnum && tmpt.trd_unitid >= 0 && tmpt.trd_owner != player->cnum) { - tally += tmpt.trd_maxprice * tradetax; + tally += tmpt.trd_price * tradetax; } } for (q = 0; getcomm(q, &comt); q++) { if (comt.com_maxbidder == player->cnum && comt.com_owner != 0 && comt.com_owner != player->cnum) { - tally += (comt.com_maxprice * comt.com_amount) * buytax; + tally += (comt.com_price * comt.com_amount) * buytax; } } canspend = natp->nat_money - tally; @@ -188,8 +188,8 @@ buy(void) pr("That lot has been taken off the market.\n"); return RET_FAIL; } - if (bid > 0.04 + comm.com_maxprice) { - comm.com_maxprice = bid; + if (bid > 0.04 + comm.com_price) { + comm.com_price = bid; /* Add five minutes to the time if less than 5 minutes */ time(&now); if (((MARK_DELAY - (now - comm.com_markettime)) < 300) && @@ -254,8 +254,8 @@ check_market(void) monleft = 0; - price = comm.com_maxprice * comm.com_amount * buytax; - gain = comm.com_maxprice * comm.com_amount; + price = comm.com_price * comm.com_amount * buytax; + gain = comm.com_price * comm.com_amount; natp = getnatp(comm.com_maxbidder); tmoney = natp->nat_money; diff --git a/src/lib/commands/mark.c b/src/lib/commands/mark.c index 94b326c55..a10b992a3 100644 --- a/src/lib/commands/mark.c +++ b/src/lib/commands/mark.c @@ -68,7 +68,7 @@ pr_mark(struct comstr *comm) tleft = 0.0; pr(" %3d $%12.2f %2d %5.2f hrs (%3d) %c %6d ", comm->com_uid, - comm->com_maxprice, + comm->com_price, comm->com_maxbidder, tleft, comm->com_owner, comm->com_type, comm->com_amount); if (comm->com_owner == player->cnum || player->god) @@ -127,7 +127,7 @@ display_mark(s_char *arg) continue; if (cheapest_items[i] != -1) { getcomm(cheapest_items[i], &comm2); - if (comm.com_maxprice < comm2.com_maxprice) { + if (comm.com_price < comm2.com_price) { cheapest_items[i] = sellers; } } else { diff --git a/src/lib/commands/new.c b/src/lib/commands/new.c index 4ee237ff8..b59a5c08d 100644 --- a/src/lib/commands/new.c +++ b/src/lib/commands/new.c @@ -333,7 +333,6 @@ deity_build_land(int type, coord x, coord y, natid own, int tlev) land.lnd_type = type; land.lnd_effic = 100; land.lnd_mobil = land_mob_max; - land.lnd_sell = 0; land.lnd_tech = tlev; land.lnd_uid = nstr.cur; land.lnd_army = ' '; diff --git a/src/lib/commands/rese.c b/src/lib/commands/rese.c index 88d6b01f9..5c1097764 100644 --- a/src/lib/commands/rese.c +++ b/src/lib/commands/rese.c @@ -142,8 +142,6 @@ rese(void) comm.com_price = price; (void)time(&now); comm.com_markettime = now; - if ((int)price < comm.com_maxprice) - comm.com_maxprice = (int)price; if (!putcomm(number_set, &comm)) { pr("Problems with the commodities file, Call the Deity\n"); return RET_OK; diff --git a/src/lib/commands/sell.c b/src/lib/commands/sell.c index 61c50279d..a0090a265 100644 --- a/src/lib/commands/sell.c +++ b/src/lib/commands/sell.c @@ -182,7 +182,6 @@ sell(void) comm.com_owner = player->cnum; comm.com_price = price; comm.com_maxbidder = player->cnum; - comm.com_maxprice = price; comm.com_markettime = now; comm.com_amount = totalcom; comm.com_x = 0; diff --git a/src/lib/commands/set.c b/src/lib/commands/set.c index 3dbeb4ac2..85d1ffa7e 100644 --- a/src/lib/commands/set.c +++ b/src/lib/commands/set.c @@ -148,7 +148,6 @@ set(void) (void)time(&now); trade.trd_markettime = now; trade.trd_maxbidder = player->cnum; - trade.trd_maxprice = 0; puttrade(ni_trade.cur, &trade); } else if (price > 0) { trade.trd_x = item.gen.trg_x; @@ -160,7 +159,6 @@ set(void) (void)time(&now); trade.trd_markettime = now; trade.trd_maxbidder = player->cnum; - trade.trd_maxprice = price; if (foundslot >= 0) id = foundslot; else if (freeslot >= 0) diff --git a/src/lib/commands/trad.c b/src/lib/commands/trad.c index e4ef961f1..f021d4280 100644 --- a/src/lib/commands/trad.c +++ b/src/lib/commands/trad.c @@ -115,7 +115,7 @@ trad(void) TRADE_DELAY / 3600.0 - (now - trade.trd_markettime) / 3600.0; if (tleft < 0.0) tleft = 0.0; - pr("$%7d %2d %5.2f hrs ", trade.trd_maxprice, + pr("$%7d %2d %5.2f hrs ", trade.trd_price, trade.trd_maxbidder, tleft); (void)trade_desc(&trade, &tg); /* XXX */ pr("\n"); @@ -174,7 +174,7 @@ trad(void) pr("You can't buy from yourself!\n"); return RET_OK; } - price = trade.trd_maxprice; + price = trade.trd_price; natp = getnatp(player->cnum); if (natp->nat_money < price) { pr("You don't have %.2f to spend!\n", price); @@ -184,13 +184,13 @@ trad(void) for (q = 0; gettrade(q, &tmpt); q++) { if (tmpt.trd_maxbidder == player->cnum && tmpt.trd_unitid >= 0 && tmpt.trd_owner != player->cnum) { - tally += tmpt.trd_maxprice * tradetax; + tally += tmpt.trd_price * tradetax; } } for (q = 0; getcomm(q, &comt); q++) { if (comt.com_maxbidder == player->cnum && comt.com_owner != 0 && comt.com_owner != player->cnum) { - tally += (comt.com_maxprice * comt.com_amount) * buytax; + tally += (comt.com_price * comt.com_amount) * buytax; } } canspend = natp->nat_money - tally; @@ -275,13 +275,13 @@ trad(void) pr("You don't have %.2f to spend!\n", price); return RET_OK; } - if (bid > trade.trd_maxprice) { + if (bid > trade.trd_price) { /* Add five minutes to the time if less than 5 minutes left. */ time(&now); if (((TRADE_DELAY - (now - trade.trd_markettime)) < 300) && trade.trd_maxbidder != player->cnum) trade.trd_markettime += 300; - trade.trd_maxprice = bid; + trade.trd_price = bid; trade.trd_maxbidder = player->cnum; trade.trd_x = sx; trade.trd_y = sy; @@ -355,7 +355,7 @@ check_trade(void) } monleft = 0; - price = trade.trd_maxprice; + price = trade.trd_price; natp = getnatp(trade.trd_maxbidder); if (natp->nat_money <= 0) monleft = price; diff --git a/src/lib/global/nsc.c b/src/lib/global/nsc.c index eff1faf4f..a7f2af0f4 100644 --- a/src/lib/global/nsc.c +++ b/src/lib/global/nsc.c @@ -142,7 +142,6 @@ struct castr sect_ca[] = { { NSC_UCHAR | NSC_OFF | fldoff(genitem, type), "type", 0},\ { NSC_UCHAR | NSC_OFF | fldoff(genitem, effic), "effic", 0},\ { NSC_CHAR | NSC_OFF | fldoff(genitem, mobil), "mobil", 0},\ -{ NSC_SHORT | NSC_OFF | fldoff(genitem, sell), "sell", 0},\ { NSC_SHORT | NSC_OFF | fldoff(genitem, tech), "tech", 0},\ { NSC_CHAR | NSC_OFF | fldoff(genitem, group), "group", 0},\ { NSC_XCOORD | NSC_OFF | fldoff(genitem, opx), "opx", 0},\ @@ -274,7 +273,6 @@ struct castr commodity_ca[] = { {NSC_UCHAR | NSC_OFF | fldoff(comstr, com_type), "type", 0}, {NSC_INT | NSC_OFF | fldoff(comstr, com_amount), "amount", 0}, {NSC_INT | NSC_OFF | fldoff(comstr, com_maxbidder), "maxbidder", 0}, - {NSC_FLOAT | NSC_OFF | fldoff(comstr, com_maxprice), "maxprice", 0}, {NSC_TIME | NSC_OFF | fldoff(comstr, com_markettime), "markettime", 0}, /* could let maxbidder access these, but we can't express that yet: */ {NSC_DEITY | NSC_INT | NSC_OFF | fldoff(comstr, com_x), "xbuy", 0}, @@ -293,8 +291,8 @@ struct castr trade_ca[] = { {NSC_SHORT | NSC_OFF | fldoff(trdstr, trd_unitid), "unitid", 0}, {NSC_LONG | NSC_OFF | fldoff(trdstr, trd_price), "price", 0}, {NSC_INT | NSC_OFF | fldoff(trdstr, trd_maxbidder), "maxbidder", 0}, - {NSC_INT | NSC_OFF | fldoff(trdstr, trd_maxprice), "maxprice", 0}, {NSC_TIME | NSC_OFF | fldoff(trdstr, trd_markettime), "markettime", 0}, + /* could let the owner access these, but we can't express that yet: */ {NSC_DEITY | NSC_XCOORD | NSC_OFF | fldoff(trdstr, trd_x), "xloc", 0}, {NSC_DEITY | NSC_YCOORD | NSC_OFF | fldoff(trdstr, trd_y), "yloc", 0}, {0, 0, 0} -- 2.43.0