Use relations_with() for getrel(getnatp(US), THEM) where US!=THEM

Replacing getrel(getnatp(US), THEM) by relations_with(US, THEM) makes
a difference only when US equals THEM.  Replace in places where it's
obvious that they're not equal.

Note: getsect() sets player->owner to "player is god or owns this
sector".  Thus, after getsect(..., &sect), sect.sct_own ==
player->cnum implies player->owner.  Conversely, !player->owner
implies sect.sct_own != player->cnum.  Similarly for getship(),
getplane() and nxtitem().
This commit is contained in:
Markus Armbruster 2011-01-29 14:34:40 +01:00
parent 6807cd91b5
commit 8cb7b75557
10 changed files with 20 additions and 20 deletions

View file

@ -134,8 +134,8 @@ tend(void)
return RET_SYN;
total = 0;
while (nxtitem(&targets, &target)) {
if (!player->owner &&
(getrel(getnatp(target.shp_own), player->cnum) < FRIENDLY))
if (!player->owner
&& relations_with(target.shp_own, player->cnum) < FRIENDLY)
continue;
if (target.shp_uid == tender.shp_uid)
continue;
@ -232,8 +232,8 @@ tend_land(struct shpstr *tenderp, char *units)
if (!check_ship_ok(tenderp) || !check_land_ok(&land))
return RET_SYN;
while (nxtitem(&targets, &target)) {
if (!player->owner &&
(getrel(getnatp(target.shp_own), player->cnum) < FRIENDLY))
if (!player->owner
&& relations_with(target.shp_own, player->cnum) < FRIENDLY)
continue;
if (target.shp_uid == tenderp->shp_uid)
continue;