Use relations_with() where its different value doesn't matter
Switching from getrel() to relations_with() can change the value from NEUTRAL to ALLIED. The change doesn't matter when the value's only compared to HOSTILE, as both old and new value are greater than HOSTILE. Likewise for >= NEUTRAL.
This commit is contained in:
parent
8e75b22e0d
commit
6807cd91b5
5 changed files with 8 additions and 8 deletions
|
@ -618,7 +618,7 @@ ac_shipflak(struct emp_qelem *list, coord x, coord y)
|
||||||
mcp = &mchr[(int)ship.shp_type];
|
mcp = &mchr[(int)ship.shp_type];
|
||||||
if (mcp->m_flags & M_SUB)
|
if (mcp->m_flags & M_SUB)
|
||||||
continue;
|
continue;
|
||||||
if (getrel(getnatp(ship.shp_own), plane_owner) > HOSTILE)
|
if (relations_with(ship.shp_own, plane_owner) > HOSTILE)
|
||||||
continue;
|
continue;
|
||||||
gun = shp_usable_guns(&ship);
|
gun = shp_usable_guns(&ship);
|
||||||
if (gun == 0)
|
if (gun == 0)
|
||||||
|
@ -669,7 +669,7 @@ ac_landflak(struct emp_qelem *list, coord x, coord y)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_ship >= 0 || land.lnd_land >= 0)
|
if (land.lnd_ship >= 0 || land.lnd_land >= 0)
|
||||||
continue;
|
continue;
|
||||||
if (getrel(getnatp(land.lnd_own), plane_owner) > HOSTILE)
|
if (relations_with(land.lnd_own, plane_owner) > HOSTILE)
|
||||||
continue;
|
continue;
|
||||||
flak = aaf * 1.5 * land.lnd_effic / 100.0;
|
flak = aaf * 1.5 * land.lnd_effic / 100.0;
|
||||||
ngun += flak;
|
ngun += flak;
|
||||||
|
|
|
@ -105,7 +105,7 @@ ground_interdict(coord x, coord y, natid victim, char *s)
|
||||||
memset(mi, 0, sizeof(mi));
|
memset(mi, 0, sizeof(mi));
|
||||||
act[0] = 0;
|
act[0] = 0;
|
||||||
for (cn = 1; cn < MAXNOC; cn++) {
|
for (cn = 1; cn < MAXNOC; cn++) {
|
||||||
act[cn] = getrel(getnatp(cn), victim) <= HOSTILE;
|
act[cn] = relations_with(cn, victim) <= HOSTILE;
|
||||||
emp_initque((struct emp_qelem *)&mi[cn]);
|
emp_initque((struct emp_qelem *)&mi[cn]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1041,7 +1041,7 @@ air_damage(struct emp_qelem *bombers, coord x, coord y, int mission,
|
||||||
prplane(pp), xyas(x, y, pp->pln_own));
|
prplane(pp), xyas(x, y, pp->pln_own));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (getrel(getnatp(pp->pln_own), victim) > HOSTILE) {
|
if (relations_with(pp->pln_own, victim) > HOSTILE) {
|
||||||
wu(0, pp->pln_own,
|
wu(0, pp->pln_own,
|
||||||
"\t%s tracks %s %s at %s\n",
|
"\t%s tracks %s %s at %s\n",
|
||||||
prplane(pp), cname(victim), s, xyas(x, y, pp->pln_own));
|
prplane(pp), cname(victim), s, xyas(x, y, pp->pln_own));
|
||||||
|
|
|
@ -199,7 +199,7 @@ msl_sel(struct emp_qelem *list, coord x, coord y, natid victim,
|
||||||
if (mission &&
|
if (mission &&
|
||||||
plane.pln_radius < mapdist(x, y, plane.pln_opx, plane.pln_opy))
|
plane.pln_radius < mapdist(x, y, plane.pln_opx, plane.pln_opy))
|
||||||
continue;
|
continue;
|
||||||
if (getrel(getnatp(plane.pln_own), victim) >= NEUTRAL)
|
if (relations_with(plane.pln_own, victim) >= NEUTRAL)
|
||||||
continue;
|
continue;
|
||||||
/* missiles go one way, so we can use all the range */
|
/* missiles go one way, so we can use all the range */
|
||||||
if (plane.pln_range < mapdist(x, y, plane.pln_x, plane.pln_y))
|
if (plane.pln_range < mapdist(x, y, plane.pln_x, plane.pln_y))
|
||||||
|
|
|
@ -84,7 +84,7 @@ nreport(natid actor, int event, natid victim, int times)
|
||||||
return;
|
return;
|
||||||
if (!chance((double)-nice * times / 20.0))
|
if (!chance((double)-nice * times / 20.0))
|
||||||
return;
|
return;
|
||||||
if (getrel(getnatp(victim), actor) < HOSTILE)
|
if (relations_with(victim, actor) < HOSTILE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setrel(victim, actor, HOSTILE);
|
setrel(victim, actor, HOSTILE);
|
||||||
|
|
|
@ -611,7 +611,7 @@ shp_fort_interdiction(struct emp_qelem *list, coord newx, coord newy,
|
||||||
return 0; /* Only coastwatch notify in nofortfire */
|
return 0; /* Only coastwatch notify in nofortfire */
|
||||||
/* Only fire at Hostile ships */
|
/* Only fire at Hostile ships */
|
||||||
for (i = 0; i < MAXNOC; ++i) {
|
for (i = 0; i < MAXNOC; ++i) {
|
||||||
if (getrel(getnatp(i), victim) >= NEUTRAL)
|
if (relations_with(i, victim) >= NEUTRAL)
|
||||||
notified[i] = 0;
|
notified[i] = 0;
|
||||||
}
|
}
|
||||||
snxtsct_dist(&ns, newx, newy, fort_max_interdiction_range);
|
snxtsct_dist(&ns, newx, newy, fort_max_interdiction_range);
|
||||||
|
@ -849,7 +849,7 @@ shp_missile_defense(coord dx, coord dy, natid bombown, int hardtarget)
|
||||||
if (!(mchr[(int)ship.shp_type].m_flags & M_ANTIMISSILE))
|
if (!(mchr[(int)ship.shp_type].m_flags & M_ANTIMISSILE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (getrel(getnatp(ship.shp_own), bombown) >= NEUTRAL)
|
if (relations_with(ship.shp_own, bombown) >= NEUTRAL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ship.shp_effic < 60)
|
if (ship.shp_effic < 60)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue