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.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:
parent
6807cd91b5
commit
8cb7b75557
10 changed files with 20 additions and 20 deletions
|
@ -173,7 +173,7 @@ sona(void)
|
|||
if (rad[y][x] != dchr[SCT_WATER].d_mnem && rad[y][x] != 'X')
|
||||
continue;
|
||||
if (tmcp->m_flags & M_SUB &&
|
||||
getrel(getnatp(targ.shp_own), player->cnum) < FRIENDLY) {
|
||||
relations_with(targ.shp_own, player->cnum) < FRIENDLY) {
|
||||
if (mcp->m_vrnge + visib < 8)
|
||||
pr("Sonar detects sub #%d @ %s\n",
|
||||
targ.shp_uid,
|
||||
|
@ -275,7 +275,7 @@ plane_sona(struct emp_qelem *plane_list, int x, int y,
|
|||
pr("Sonar contact in %s\n", xyas(x, y, player->cnum));
|
||||
found = 1;
|
||||
}
|
||||
if (getrel(getnatp(targ->shp_own), pp->pln_own) < FRIENDLY &&
|
||||
if (relations_with(targ->shp_own, pp->pln_own) < FRIENDLY &&
|
||||
roll(100) > pln_identchance(pp, shp_hardtarget(targ),
|
||||
EF_SHIP))
|
||||
if (roll(100) > pln_identchance(pp, shp_hardtarget(targ),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue