tend ltend: Fix to skip dead ships and land units for deities

Tending to a dead ship destroys, and tending from a dead ship revives.
Has always been that way.  Not actually a problem for ltend anymore,
because the dead can't carry or be carried since commit 64a53c90f0,
v4.3.17.

Fix by checking !own in addition to !player->owner

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2017-09-15 09:49:01 +02:00
parent 333cd7d6d3
commit 55643423f6
5 changed files with 20 additions and 22 deletions

View file

@ -71,7 +71,7 @@ ltend(void)
if (!snxtitem(&tenders, EF_SHIP, player->argp[2], "Tender(s)? "))
return RET_SYN;
while (nxtitem(&tenders, &tender)) {
if (!player->owner) {
if (!player->owner || !tender.shp_own) {
if (tenders.sel == NS_LIST)
pr("You don't own ship #%d!\n", tender.shp_uid);
continue;
@ -100,7 +100,7 @@ ltend(void)
return RET_FAIL;
total = 0;
while (nxtitem(&targets, &target)) {
if (!player->owner) {
if (!player->owner || !target.lnd_own) {
if (targets.sel == NS_LIST)
pr("You don't own land unit #%d!\n", target.lnd_uid);
continue;

View file

@ -85,7 +85,7 @@ tend(void)
return RET_SYN;
while (nxtitem(&tenders, &tender)) {
if (!player->owner) {
if (!player->owner || !tender.shp_own) {
if (tenders.sel == NS_LIST)
pr("You don't own ship #%d!\n", tender.shp_uid);
continue;
@ -195,6 +195,8 @@ tend(void)
static int
can_tend_to(struct shpstr *from, struct shpstr *to)
{
if (!to->shp_own)
return 0;
if (to->shp_own != player->cnum && !player->god
&& relations_with(to->shp_own, player->cnum) < FRIENDLY)
return 0;
@ -227,7 +229,7 @@ tend_land(struct shpstr *tenderp, char *units)
return RET_SYN;
while (nxtitem(&lni, &land)) {
if (!player->owner) {
if (!player->owner || !land.lnd_own) {
if (lni.sel == NS_LIST)
pr("You don't own land unit #%d!\n", land.lnd_uid);
continue;