]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/mission.c
Use relations_with() where its different value doesn't matter
[empserver] / src / lib / subs / mission.c
index 8b475cc667a38222ba612509624b7715ebc657ea..bd612cc50c65150f4c2d5fd0baefe2b26e5f8613 100644 (file)
@@ -105,7 +105,7 @@ ground_interdict(coord x, coord y, natid victim, char *s)
     memset(mi, 0, sizeof(mi));
     act[0] = 0;
     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]);
     }
 
@@ -231,6 +231,11 @@ def_support(coord x, coord y, natid victim, natid actee)
     return dosupport(x, y, victim, actee, MI_DSUPPORT);
 }
 
+/*
+ * Perform support missions in X,Y against VICTIM for ACTEE.
+ * MISSION is either MI_OSUPPORT or MI_DSUPPORT.
+ * Return total damage.
+ */
 static int
 dosupport(coord x, coord y, natid victim, natid actee, int mission)
 {
@@ -243,9 +248,7 @@ dosupport(coord x, coord y, natid victim, natid actee, int mission)
     memset(mi, 0, sizeof(mi));
     act[0] = 0;
     for (cn = 1; cn < MAXNOC; cn++) {
-       act[cn] = (cn == actee
-                  || (getrel(getnatp(cn), actee) == ALLIED
-                      && getrel(getnatp(cn), victim) == AT_WAR));
+       act[cn] = feels_like_helping(cn, actee, victim);
        emp_initque((struct emp_qelem *)&mi[cn]);
     }
 
@@ -1038,7 +1041,7 @@ air_damage(struct emp_qelem *bombers, coord x, coord y, int mission,
                   prplane(pp), xyas(x, y, pp->pln_own));
                continue;
            }
-           if (getrel(getnatp(pp->pln_own), victim) > HOSTILE) {
+           if (relations_with(pp->pln_own, victim) > HOSTILE) {
                wu(0, pp->pln_own,
                   "\t%s tracks %s %s at %s\n",
                   prplane(pp), cname(victim), s, xyas(x, y, pp->pln_own));