]> git.pond.sub.org Git - empserver/commitdiff
Make escort mission obey op-area
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 22 Nov 2008 19:52:20 +0000 (14:52 -0500)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 25 Dec 2008 10:47:32 +0000 (11:47 +0100)
Before, the escort mission didn't support an op-area, and planes on
escort mission escorted anywhere.  Change mission() to define the
op-area for escort missions as well.  Show it in mission() and
show_mission().  Check it in find_escorts().

info/mission.t
src/lib/commands/miss.c
src/lib/subs/mission.c

index b7f67064bcc21b1218f66db24266eb424fa3ec95..f299f442077f4cc4fe26a6980eb237a372f9449d 100644 (file)
@@ -222,7 +222,8 @@ Only planes with the 'tactical' ability can fly support missions.
 ESCORT MISSIONS (planes only)
 .s1
 When given an escort mission, an escort or intercept capable plane will attempt
-to escort any plane flying a support or interdict mission from the same airport.
+to escort any plane flying a support or interdict mission from the
+same airport into its op-area.
 If even 1 plane flies a support or interdiction mission from an airport, all
 planes on escort duty at that airport will attempt to escort. Planes with escort
 duty will NOT attempt to escort planes taking off from other airports, so it
index e59f23f7404b9102ca6177d7e8ab8e8276493023..d2c7e7a2bb6ca5e585c88357f8fc0465cf0a7501 100644 (file)
@@ -148,7 +148,7 @@ mission(void)
        return RET_FAIL;
     }
 
-    if (mission && mission != MI_ESCORT) {
+    if (mission) {
        if ((p = getstarg(player->argp[4], "operations point? ", buf)) == 0
            || *p == 0)
            return RET_SYN;
@@ -207,7 +207,7 @@ mission(void)
        radius = 999;
        if (mission == MI_INTERDICT || mission == MI_SUPPORT ||
            mission == MI_OSUPPORT || mission == MI_DSUPPORT ||
-           mission == MI_RESERVE ||
+           mission == MI_RESERVE || mission == MI_ESCORT ||
            mission == MI_AIR_DEFENSE) {
            radius = oprange(gp, mission);
            if (radius < dist) {
@@ -285,7 +285,7 @@ mission(void)
 
        if (mission == MI_INTERDICT || mission == MI_SUPPORT ||
            mission == MI_OSUPPORT || mission == MI_DSUPPORT ||
-           mission == MI_RESERVE ||
+           mission == MI_RESERVE || mission == MI_ESCORT ||
            mission == MI_AIR_DEFENSE)
            gp->radius = radius;
        else
@@ -293,7 +293,7 @@ mission(void)
 
        if (mission == MI_SUPPORT || mission == MI_OSUPPORT ||
            mission == MI_DSUPPORT || mission == MI_INTERDICT ||
-           mission == MI_RESERVE ||
+           mission == MI_RESERVE || mission == MI_ESCORT ||
            mission == MI_AIR_DEFENSE) {
            pr("%s on %s mission, centered on %s, radius %d\n",
               obj_nameof(gp), mission_name(mission),
index dbad24fb77a1778f12ab8a76651db37d91ce7d39..c4243b4f9149645c255016b487a7ff3bed580ba0 100644 (file)
@@ -355,20 +355,15 @@ find_escorts(coord x, coord y, natid cn, struct emp_qelem *escorts)
     struct nstr_item ni;
     struct plist *plp;
     struct plnstr plane;
-    int dist;
 
     snxtitem_all(&ni, EF_PLANE);
     while (nxtitem(&ni, &plane)) {
        if (plane.pln_own != cn)
            continue;
-
        if (plane.pln_mission != MI_ESCORT)
            continue;
-
-       dist = mapdist(x, y, plane.pln_x, plane.pln_y);
-       if (dist > plane.pln_range / 2)
+       if (!in_oparea((struct empobj *)&plane, x, y))
            continue;
-
        plp = malloc(sizeof(struct plist));
        memset(plp, 0, sizeof(struct plist));
        plp->pcp = &plchr[(int)plane.pln_type];
@@ -768,16 +763,13 @@ show_mission(int type, struct nstr_item *np)
        case MI_INTERDICT:
        case MI_SUPPORT:
        case MI_RESERVE:
+       case MI_ESCORT:
        case MI_AIR_DEFENSE:
        case MI_DSUPPORT:
        case MI_OSUPPORT:
            prxy(" %3d,%-3d", gp->opx, gp->opy, player->cnum);
            pr("  %4d", gp->radius);
            break;
-       case MI_ESCORT:
-           pr("        ");
-           pr("  %4d", item.plane.pln_range / 2);
-           break;
        default:
            CANT_REACH();
            /* fall through */