Fix loopholes that let you load and unload foreign commodities
The Chainsaw 3 feature to let you load/unload to a specific amount through a negative amount argument created loopholes: it let you load your ships in friendly sectors with the unload command, and unload friendly ships with the load command. Likewise for land units, with allied instead of friendly, of course. Empire 4.0.0 fixed that for the case of loading a land unit from an allied sector. Get rid of that check, and fix it for good in load_comm_ok().
This commit is contained in:
parent
92a366ce24
commit
a78f71ff99
1 changed files with 4 additions and 5 deletions
|
@ -327,6 +327,10 @@ load_comm_ok(struct sctstr *sectp, natid unit_own,
|
|||
{
|
||||
if (!move_amt)
|
||||
return 0;
|
||||
if (move_amt < 0 && !player->god && unit_own != player->cnum)
|
||||
return 0;
|
||||
if (move_amt > 0 && !player->god && sectp->sct_own != player->cnum)
|
||||
return 0;
|
||||
if (sectp->sct_oldown != unit_own && item == I_CIVIL) {
|
||||
pr("%s civilians refuse to %s at %s!\n",
|
||||
(move_amt < 0 ? unit_own : sectp->sct_oldown) == player->cnum
|
||||
|
@ -868,11 +872,6 @@ load_comm_land(struct sctstr *sectp, struct lndstr *lp,
|
|||
move_amt = sect_amt - ITEM_MAX;
|
||||
if (!load_comm_ok(sectp, lp->lnd_own, item, move_amt))
|
||||
return RET_OK;
|
||||
if (sectp->sct_own != player->cnum && move_amt > 0) {
|
||||
pr("Sector %s is not yours.\n",
|
||||
xyas(lp->lnd_x, lp->lnd_y, player->cnum));
|
||||
return RET_FAIL;
|
||||
}
|
||||
sectp->sct_item[item] = sect_amt - move_amt;
|
||||
lp->lnd_item[item] = land_amt + move_amt;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue