]> git.pond.sub.org Git - empserver/commitdiff
Use relations_with() in getilists()
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 30 Jan 2011 16:37:36 +0000 (17:37 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 16 Feb 2011 06:57:43 +0000 (07:57 +0100)
No functional change, even though this changes rel[intruder] from
NEUTRAL to ALLIED.  Uses of rel[]:

* getilists() and ac_encounter() compare rel[cn] to HOSTILE.  No
  change, because NEUTRAL and ALLIED are both greater than HOSTILE.

* ac_encounter() compares rel[cn] to ALLIED, but only when cn !=
  plane_owner.  Because it passes plane_owner as argument for
  getilists() parameter intruder, rel[cn] can't refer to the changed
  element of rel[] here.

The new value of rel[plane_owner] permits simplifying cn ==
plane_owner || rel[cn] == ALLIED to just rel[cn] == ALLIED.

src/lib/subs/aircombat.c

index 29df52f1215563009b8587dc3ae55a676ad186e5..41d774e28268b8198a85e5f868bb5d37c9023fff 100644 (file)
@@ -172,7 +172,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
        if (!evaded) {
            overfly[sect.sct_own]++;
            for (cn = 1; cn < MAXNOC; cn++) {
-               if (cn == plane_owner || rel[cn] == ALLIED)
+               if (rel[cn] == ALLIED)
                    continue;
                if (cn != sect.sct_own && !gotships[cn] && !gotlands[cn])
                    continue;
@@ -220,8 +220,6 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
 
     /* Let's report all of the overflights even if aborted */
     for (cn = 1; cn < MAXNOC; cn++) {
-       if (plane_owner == cn)
-           continue;
        if (overfly[cn] > 0 && rel[cn] != ALLIED)
            nreport(plane_owner, N_OVFLY_SECT, cn, overfly[cn]);
     }
@@ -762,7 +760,7 @@ getilists(struct emp_qelem *list, unsigned char *rel, natid intruder)
 
     rel[0] = NEUTRAL;
     for (cn = 1; cn < MAXNOC; cn++) {
-       rel[cn] = getrel(getnatp(cn), intruder);
+       rel[cn] = relations_with(cn, intruder);
        emp_initque(&list[cn]);
     }