]> git.pond.sub.org Git - empserver/commitdiff
(satdisp, satdisp_sect, satdisp_units): Split satdisp() into
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 14 Jun 2006 17:38:16 +0000 (17:38 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 14 Jun 2006 17:38:16 +0000 (17:38 +0000)
satdisp_sect() and satdisp_units().
(satmap): Call only satdisp_sect().  No functional change.
(aircombat): Call both, and call satdisp_units() even over sea.  This
lets spy planes spot surface ships at sea.  Closes #906035.

include/prototypes.h
src/lib/subs/aircombat.c
src/lib/subs/satmap.c

index 30679173e439950a3ff46e8cf9539d80a42bb187..296d44d33cab72afbf57abe5a86e37e6705f847b 100644 (file)
@@ -620,7 +620,8 @@ extern int sarg_area(char *, struct range *);
 extern int sarg_range(char *, coord *, coord *, int *);
 extern int sarg_list(char *, int *, int);
 /* satmap.c */
-extern void satdisp(struct sctstr *, int, int);
+extern void satdisp_sect(struct sctstr *, int);
+extern void satdisp_units(coord, coord);
 extern void satmap(int, int, int, int, int, int);
 extern void sathead(void);
 /* sect.c */
index ad4f89f727a1a8d7a917ed8696ccb33c385181f8..bb11fc3ff2a2b4c3d73edb81eb28b7b0ef1381b1 100644 (file)
@@ -162,7 +162,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
                                   sect.sct_x, sect.sct_y,
                                   dchr[sect.sct_type].d_mnem, 0);
            } else if (mission_flags & P_S) {
-               satdisp(&sect, (mission_flags & P_I) ? 10 : 50, 1);
+               satdisp_sect(&sect, (mission_flags & P_I) ? 10 : 50);
            } else {
                /* This is borrowed from lookout */
                if (sect.sct_own == plane_owner)
@@ -193,6 +193,8 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
                       mil : roundintby(mil, 25));
                PR(plane_owner, "@ %s\n", xyas(x, y, plane_owner));
            }
+           if (mission_flags & P_S)
+               satdisp_units(sect.sct_x, sect.sct_y);
        } else {
            PR(plane_owner, "flying over %s at %s\n",
               dchr[sect.sct_type].d_name, xyas(x, y, plane_owner));
index bd6f036843a287e9f89f255c111117d7089c529e..d11107d698a9f48e1eeb370f33cd5d80dd492797 100644 (file)
@@ -120,7 +120,7 @@ satmap(int x, int y, int eff, int range, int flags, int type)
                continue;
            if (flags & P_S) {
                if (sect.sct_own && sect.sct_own != player->cnum) {
-                   satdisp(&sect, acc, 0);
+                   satdisp_sect(&sect, acc);
                    ++count;
                    if (opt_HIDDEN)
                        setcont(player->cnum, sect.sct_own, FOUND_FLY);
@@ -274,13 +274,8 @@ sathead(void)
 }
 
 void
-satdisp(struct sctstr *sp, int acc, int showstuff)
+satdisp_sect(struct sctstr *sp, int acc)
 {
-    int first;
-    struct nstr_item ni;
-    struct shpstr ship;
-    struct lndstr land;
-
     prxy("%4d,%-4d   ", sp->sct_x, sp->sct_y, player->cnum);
     pr("%c  %3d  %3d %3d %3d %3d %4d %4d %4d %4d %4d %4d %5d\n",
        dchr[sp->sct_type].d_mnem,
@@ -297,9 +292,17 @@ satdisp(struct sctstr *sp, int acc, int showstuff)
        roundintby(sp->sct_item[I_FOOD], acc));
     map_set(player->cnum, sp->sct_x, sp->sct_y, dchr[sp->sct_type].d_mnem,
            0);
-    if (!showstuff)
-       return;
-    snxtitem_xy(&ni, EF_SHIP, sp->sct_x, sp->sct_y);
+}
+
+void
+satdisp_units(coord x, coord y)
+{
+    int first;
+    struct nstr_item ni;
+    struct shpstr ship;
+    struct lndstr land;
+
+    snxtitem_xy(&ni, EF_SHIP, x, y);
     first = 1;
     while (nxtitem(&ni, &ship)) {
        if (ship.shp_own == 0)
@@ -320,7 +323,7 @@ satdisp(struct sctstr *sp, int acc, int showstuff)
     if (!first)
        pr("\n");
 
-    snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
+    snxtitem_xy(&ni, EF_LAND, x, y);
     first = 1;
 
     while (nxtitem(&ni, &land)) {