Fix trade to enforce destination rules for satellites and asats
Trade teleports planes to a destination chosen by the buyer, except for satellites in orbit. trad() failed to enforce the usual rules on destinations for satellites (not in orbit) and asat missiles: they could be teleported anywhere. Abusable, because abms intercept from anywhere, and satellites can be launched from unowned sectors, even sea. Broken since BSD Empire 1.1.
This commit is contained in:
parent
0a962c0380
commit
c69c5ff6d2
1 changed files with 7 additions and 10 deletions
|
@ -66,7 +66,6 @@ trad(void)
|
||||||
struct trdstr trade;
|
struct trdstr trade;
|
||||||
struct trdstr tmpt;
|
struct trdstr tmpt;
|
||||||
union empobj_storage tg;
|
union empobj_storage tg;
|
||||||
int plflags;
|
|
||||||
double canspend;
|
double canspend;
|
||||||
time_t now;
|
time_t now;
|
||||||
int bid;
|
int bid;
|
||||||
|
@ -181,14 +180,12 @@ trad(void)
|
||||||
}
|
}
|
||||||
canspend = natp->nat_money - tally;
|
canspend = natp->nat_money - tally;
|
||||||
/*
|
/*
|
||||||
* Find the destination sector for the plane before the trade
|
* Find the destination sector for the plane before the trade is
|
||||||
* is actually made. Must be owned (except for satellites) and
|
* actually made, except for satellites in orbit. Must be owned
|
||||||
* must be a 60% airfield (except for VTOL planes).
|
* and must be a 60% airfield (except for VTOL planes).
|
||||||
*/
|
*/
|
||||||
if (((trade.trd_type == EF_PLANE) || (trade.trd_type == EF_NUKE))
|
if (((trade.trd_type == EF_PLANE) && !(tg.plane.pln_flags & PLN_LAUNCHED))
|
||||||
&& ((trade.trd_type == EF_NUKE) ||
|
|| (trade.trd_type == EF_NUKE)) {
|
||||||
!(tg.plane.pln_flags & PLN_LAUNCHED))) {
|
|
||||||
plflags = plchr[(int)tg.plane.pln_type].pl_flags;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
p = getstring("Destination sector: ", buf);
|
p = getstring("Destination sector: ", buf);
|
||||||
if (!trade_check_ok(&trade, &tg))
|
if (!trade_check_ok(&trade, &tg))
|
||||||
|
@ -200,11 +197,11 @@ trad(void)
|
||||||
pr("Bad sector designation; try again!\n");
|
pr("Bad sector designation; try again!\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!player->owner && !(plflags & P_O)) {
|
if (!player->owner) {
|
||||||
pr("You don't own that sector; try again!\n");
|
pr("You don't own that sector; try again!\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!(plflags & (P_V | P_O))) {
|
if (!(plchr[tg.plane.pln_type].pl_flags & P_V)) {
|
||||||
if (!player->god && (sect.sct_type != SCT_AIRPT)) {
|
if (!player->god && (sect.sct_type != SCT_AIRPT)) {
|
||||||
pr("Destination sector is not an airfield!\n");
|
pr("Destination sector is not an airfield!\n");
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue