Use relations_with() for US==THEM || getrel(getnatp(US), THEM)

Replacing getrel(getnatp(US), THEM) by relations_with(US, THEM) makes
a difference only when US equals THEM.

Replace patterns like "us == them || getrel(getnatp(us), them)..." by
"relations_with(us, them)...".
This commit is contained in:
Markus Armbruster 2011-01-26 19:41:28 +01:00 committed by Markus Armbruster
parent ef7b9cedc3
commit 8e75b22e0d
Notes: Markus Armbruster 2013-01-26 12:01:24 +01:00
Author: Markus Armbruster <armbru@pond.sub.org>

Same guy, wrong e-mail address.
13 changed files with 25 additions and 46 deletions

View file

@ -501,8 +501,7 @@ lnd_mar(struct emp_qelem *list, double *minmobp, double *maxmobp,
lnd_stays(actor, "has no mil on it to guide it", llp);
continue;
}
if (sect.sct_own != actor &&
getrel(getnatp(sect.sct_own), actor) != ALLIED &&
if (relations_with(sect.sct_own, actor) != ALLIED &&
!(lchr[(int)llp->unit.land.lnd_type].l_flags & L_SPY) &&
sect.sct_own) {
sprintf(mess, "has been kidnapped by %s", cname(sect.sct_own));
@ -782,8 +781,7 @@ lnd_fort_interdiction(struct emp_qelem *list,
while (nxtsct(&ns, &fsect)) {
if (fsect.sct_own == 0)
continue;
if (fsect.sct_own == victim
|| getrel(getnatp(fsect.sct_own), victim) >= NEUTRAL)
if (relations_with(fsect.sct_own, victim) >= NEUTRAL)
continue;
range = roundrange(fortrange(&fsect));
trange = mapdist(newx, newy, fsect.sct_x, fsect.sct_y);
@ -1170,7 +1168,7 @@ has_helpful_engineer(coord x, coord y, natid cn)
snxtitem_xy(&ni, EF_LAND, x, y);
while (nxtitem(&ni, &land)) {
if (land.lnd_own != cn && getrel(getnatp(land.lnd_own), cn) != ALLIED)
if (relations_with(land.lnd_own, cn) != ALLIED)
continue;
if (lchr[(int)land.lnd_type].l_flags & L_ENGINEER)
return 1;