]> git.pond.sub.org Git - empserver/commitdiff
Remove non-mission land unit reaction
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 25 Nov 2008 01:31:22 +0000 (20:31 -0500)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 25 Dec 2008 10:47:05 +0000 (11:47 +0100)
Land unit reactions are overly complex because we have two different
concepts controlling them: reaction radius (set with lrange) and
reserve mission (set with mission).  You need to deal with both to set
up or query reactions.

Commit 8d0e1af5 "fixed" this by making reserve missions meaningless.

The previous commit made reserve missions meaningful again: they
support an op-area now.  This brought back the problem of having to
deal with two separate commands to accomplish one thing.

Fix this for good by removing non-mission land unit reaction
alltogether.  The only feature we lose by that is the ability to order
land units to react until the order is explicitely cancelled.  That's
because missions are implicitely cleared by many commands and events,
while non-mission reaction wasn't.  Closes #858121 and #858122.

Remove the non-mission reaction case from att_reacting_units().

Don't limit reserve missions to the land unit's reaction radius: make
lnd_reaction_range() return the type's maximum radius instead of
lnd_rad_max.

The reaction radius is now useless.  Remove the lrange command, and
struct lndstr member lnd_rad_max along with its selector react.
Remove land command's column rd.  Make ldump show column react as
zero.  Deprecate edit key 'P' in dounit(), and don't show it in
pr_land().

17 files changed:
include/land.h
include/prototypes.h
info/Attacking.t
info/Land-units.t
info/Novice.t
info/land.t
info/lrange.t [deleted file]
info/mission.t
src/lib/commands/edit.c
src/lib/commands/land.c
src/lib/commands/ldump.c
src/lib/commands/rang.c
src/lib/common/nsc.c
src/lib/player/empmod.c
src/lib/subs/attsub.c
src/lib/subs/lndsub.c
src/lib/subs/unitsub.c

index 59adea1a9588351f17e140b911002d0296ccdf64..9f4b617a5d3c4fc8dd504c3e0111efe6540c38f5 100644 (file)
@@ -72,7 +72,6 @@ struct lndstr {
     short lnd_retreat;         /* retreat percentage */
     int lnd_rflags;            /* When do I retreat? */
     char lnd_rpath[RET_LEN];   /* retreat path */
     short lnd_retreat;         /* retreat percentage */
     int lnd_rflags;            /* When do I retreat? */
     char lnd_rpath[RET_LEN];   /* retreat path */
-    unsigned char lnd_rad_max; /* max radius for this unit */
     unsigned char lnd_scar;    /* how experienced the unit is (not used) */
     short lnd_item[I_MAX+1];   /* amount of items on board */
     short lnd_pstage;          /* plague stage */
     unsigned char lnd_scar;    /* how experienced the unit is (not used) */
     short lnd_item[I_MAX+1];   /* amount of items on board */
     short lnd_pstage;          /* plague stage */
index c3c6ab4b65142b5a4b54d82189450e59e5a4d2a0..cf6f0847fc353d3edd6b184c52306b04540ca743 100644 (file)
@@ -149,7 +149,6 @@ int load(void);
 int look(void);
 int lost(void);
 int lrad(void);
 int look(void);
 int lost(void);
 int lrad(void);
-int lrange(void);
 int lretr(void);
 int lsta(void);
 int ltend(void);
 int lretr(void);
 int lsta(void);
 int ltend(void);
index 35282d3627df752f907af36178f26821ea8b17af..0034c22a2acf2ba4dd0084da4ded7204392cf65f 100644 (file)
@@ -133,20 +133,18 @@ strength of your sectors.
 .s1
 .L "(4)  Move reacting defensive units to the target sector."
 .s1
 .s1
 .L "(4)  Move reacting defensive units to the target sector."
 .s1
-If the target is not a mountain, then defensive units in nearby
-sectors may react.  Defensive units will keep reacting until the
+If the target is not a mountain, then nearby land units on reserve
+missions may react.  Reserve units will keep reacting until the
 defense strength is 1.2 times the offense strength.  The following
 restrictions apply to reacting land units:
 .NF
 defense strength is 1.2 times the offense strength.  The following
 restrictions apply to reacting land units:
 .NF
+- The target must be in the mission's op-area, and in reaction range.
 - The efficiency of the unit must be higher than it's retreat percentage.
 - The unit must be in supply.
 - The unit must have enough mobility to get to the target.
 - The efficiency of the unit must be higher than it's retreat percentage.
 - The unit must be in supply.
 - The unit must have enough mobility to get to the target.
-- The unit must be in range.
 .FI
 If the unit is in a 60% efficient headquarters, then 1 is added to its
 .FI
 If the unit is in a 60% efficient headquarters, then 1 is added to its
-reaction radius.
-Note that you can limit the reaction radius of your land
-units using the "lrange" command.
+reaction range.
 .s1
 .L "(5)  Calculate support."
 .s1
 .s1
 .L "(5)  Calculate support."
 .s1
index 89b4169bda79579e084bb8ba1ddb5d27a0d4a833..0c37c502a1d54a0aa3734f660e16e5df0ee406f0 100644 (file)
@@ -24,19 +24,19 @@ Let's look at a typical land unit:
 .s1
 .EX land *
 .NF
 .s1
 .EX land *
 .NF
-   # unit type             x,y   a  eff mil fort  mu  fd tech retr rd xl ship
-   0 inf   infantry        8,0      96% 100    0  93  24    0  42%  1  0
+   # unit type          x,y   a   eff mil frt  mu  fd tch retr xl ln carry
+   0 inf   infantry     8,0       96% 100   0  93   1  50  42%  0  0
 1 unit
 .FI
 .s1
 This land unit is an infantry unit, located at 8,0. In many games, you will
 start with 1-2 basic land units of this type. Some of the things about it are
 familiar. It is 96% efficient, has 93 mobility units, carries 1 food,
 1 unit
 .FI
 .s1
 This land unit is an infantry unit, located at 8,0. In many games, you will
 start with 1-2 basic land units of this type. Some of the things about it are
 familiar. It is 96% efficient, has 93 mobility units, carries 1 food,
-and is tech 0 and currently contains 100 mi. It carries 0 extra-light
-planes, and is not on a ship. The 'a'
+and is tech 50 and currently contains 100 mi. It carries 0 extra-light
+planes and land units, and is not on a ship. The 'a'
 stands for army, and is just like fleets or wings, i.e. a way of grouping your
 units. (See info \*Qarmy\*U for more information)
 stands for army, and is just like fleets or wings, i.e. a way of grouping your
 units. (See info \*Qarmy\*U for more information)
-Fort is the level of fortification of the land
+Frt is the level of fortification of the land
 unit. The higher the fortification, the harder the unit is to hurt.
 .s1
 The 'retr' stands for retreat percentage. This
 unit. The higher the fortification, the harder the unit is to hurt.
 .s1
 The 'retr' stands for retreat percentage. This
@@ -48,18 +48,6 @@ you can set this to 100% or some other high number. (For information on
 setting this, see info \*Qmorale\*U. For information on morale checks, see info
 \*QAttacking\*U)
 .s1
 setting this, see info \*Qmorale\*U. For information on morale checks, see info
 \*QAttacking\*U)
 .s1
-The 'rd' field is referred to as the unit's 'reaction radius',
-and is the distance to which the unit can react to defend your country.
-Basically, if an enemy attacks a sector close enough to the unit, it will go
-to the threatened sector and fight, like a plane intercepting. If it survives
-the attack without failing a morale check, it will return to the sector it
-started from, just like a plane would. (For more information on reacting and
-morale checks, see info \*QAttacking\*U) Just as you can use \*Qrange\*U to change the
-range of your planes and control how far away they'll intercept, you can
-change the reaction radius for land units with \*Qlrange\*U. Units with a base reaction
-radius of 0, or those whose radius you have set to 0, will not react.
-When built, the unit will have as its reaction radius set to zero.
-.s1
 .L Cargo
 .s1
 Each land unit can carry cargo. The cargo display for land units is very
 .L Cargo
 .s1
 Each land unit can carry cargo. The cargo display for land units is very
@@ -186,9 +174,6 @@ Don't confuse this spy value with the "spy" capability of a unit.  See
 "info \*QSpies\*U" for more information.
 .s1
 Rad is the maximum reaction radius for the unit.
 "info \*QSpies\*U" for more information.
 .s1
 Rad is the maximum reaction radius for the unit.
-If you change the reaction radius by using
-the \*Qlrange\*U command, you will be able to select any value that is
-between 0 and the maximum.
 .s1
 Frg is the unit's firing range. The unit can fire as far as the frg, modified
 by the unit's tech. Accuracy is the unit's firing accuracy, and helps to
 .s1
 Frg is the unit's firing range. The unit can fire as far as the frg, modified
 by the unit's tech. Accuracy is the unit's firing accuracy, and helps to
index fb5ea5dd3833d779351e5ca857ed10b513b4c0b4..3833653d8da20900c78c6122a458e9c70ef8d189 100644 (file)
@@ -17,8 +17,7 @@ the new server:
 (1) Build 100% forts and put 10 guns and at least 100 shells in them.
 (2) Put at least 5 mil in all of your coastal sectors.
 (3) Build infantry units, put them in the forts, "fortify" them,
 (1) Build 100% forts and put 10 guns and at least 100 shells in them.
 (2) Put at least 5 mil in all of your coastal sectors.
 (3) Build infantry units, put them in the forts, "fortify" them,
-    put them on "reserve" mission (info mission) and set their
-    reaction radius to maximum (info lrange).
+    and put them on "reserve" mission (info mission).
 (4) Build battleships and artillery and put them on "interdiction"
     mission.  Put the artillery in forts and fortify them.
 (5) Put infantry units in your banks and capitals and fortify them.
 (4) Build battleships and artillery and put them on "interdiction"
     mission.  Put the artillery in forts and fortify them.
 (5) Put infantry units in your banks and capitals and fortify them.
index d8b369bbb0d2152935c9b334dcaa0561563a56a4..e8f7d48f4e1ead99f2817190e0452b412b858396 100644 (file)
@@ -6,10 +6,10 @@ The land unit report command is a census of your land units.  For
 example:
 .EX land *
 .NF
 example:
 .EX land *
 .NF
-   # unit type          x,y   a   eff mil frt  mu  fd tch retr rd xl ln carry
-   0 cav   cavalry      1,-1     100%  10   0 127  12 992  75%  3  0  0
-   1 cav   cavalry      0,0      100%   0   0 127  12 968  75%  3  0  0
-   2 cav   cavalry      0,0      100%  10   0 127  12  40  75%  3  0  0
+   # unit type          x,y   a   eff mil frt  mu  fd tch retr xl ln carry
+   0 cav   cavalry      1,-1     100%  10   0 127  12 992  75%  0  0
+   1 cav   cavalry      0,0      100%   0   0 127  12 968  75%  0  0
+   2 cav   cavalry      0,0      100%  10   0 127  12  40  75%  0  0
 3 units
 .FI
 .s1
 3 units
 .FI
 .s1
@@ -38,8 +38,6 @@ the amount of food on board,
 the tech level of the land unit,
 .L retr
 the retreat percentage of the land unit (see info \*morale\*U),
 the tech level of the land unit,
 .L retr
 the retreat percentage of the land unit (see info \*morale\*U),
-.L rd
-the land unit's reaction radius (see info \*Qfortify\*U),
 .L xl
 the number of extra-light planes on board,
 .L ln
 .L xl
 the number of extra-light planes on board,
 .L ln
diff --git a/info/lrange.t b/info/lrange.t
deleted file mode 100644 (file)
index 91dc17e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.TH Command LRANGE
-.NA lrange "Edit the reaction range of a unit"
-.LV Expert
-.SY "lrange <UNITS> <reaction-radius>"
-The \*Qlrange\*U command is used to limit the maximum reaction radius of
-land units. This can be useful in restricting the area which a unit will
-attempt to defend. (see info attack for details of the reaction process)
-.s1
-A unit with a radius of 0 will not react.
-.s1
-.SA "attack, LandUnits"
index 722639cc52d87e191ca2f2a05836e18a1e5cff32..b7f67064bcc21b1218f66db24266eb424fa3ec95 100644 (file)
@@ -67,7 +67,7 @@ Some missions require the designation of an 'op sector', short for operations
 sector. This is the center of an area that the mission is focused on.
 The op sector may be any sector that is within the unit's range.
 (Firing range for ships & land units on interdiction, reaction range
 sector. This is the center of an area that the mission is focused on.
 The op sector may be any sector that is within the unit's range.
 (Firing range for ships & land units on interdiction, reaction range
-for land units on reserve, changeable with lrange command, flying
+for land units on reserve, flying
 range for planes, changeable with range command).
 The unit will exert influence in a radius around the op sector.
 By default, the radius will be as large as possible, i.e. the biggest range
 range for planes, changeable with range command).
 The unit will exert influence in a radius around the op sector.
 By default, the radius will be as large as possible, i.e. the biggest range
index e6c47fe98b04d15fda5dfe7ee3e523de3d4fe98c..e28b262c66439d4193ffa894e60787cf4432d8d9 100644 (file)
@@ -347,7 +347,6 @@ pr_land(struct lndstr *land)
     pr("Fortification <F>: %d\t", land->lnd_harden);
     pr("Land unit <Y>: %d\n", land->lnd_land);
     pr("Ship <S>: %d\t\t", land->lnd_ship);
     pr("Fortification <F>: %d\t", land->lnd_harden);
     pr("Land unit <Y>: %d\n", land->lnd_land);
     pr("Ship <S>: %d\t\t", land->lnd_ship);
-    pr("Radius <P>: %d\n", land->lnd_rad_max);
     pr("Retreat percentage <Z>: %d\n", land->lnd_retreat);
     pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
        land->lnd_rpath, land->lnd_rflags);
     pr("Retreat percentage <Z>: %d\n", land->lnd_retreat);
     pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
        land->lnd_rpath, land->lnd_rflags);
@@ -915,7 +914,7 @@ dounit(char op, int arg, char *p, struct lndstr *land)
        land->lnd_ship = arg;
        break;
     case 'P':
        land->lnd_ship = arg;
        break;
     case 'P':
-       land->lnd_rad_max = arg;
+       warn_deprecated(op);
        break;
     case 'Z':
        land->lnd_retreat = arg;
        break;
     case 'Z':
        land->lnd_retreat = arg;
index b2adc8b6cc92fa02a35a39021ba9599bfa23a605..5bbaf984d01626d6beb5ab39a758aa327c48529a 100644 (file)
@@ -57,7 +57,7 @@ land(void)
            if (player->god)
                pr("own ");
            pr("   # unit type          x,y   a   eff mil frt  mu  fd");
            if (player->god)
                pr("own ");
            pr("   # unit type          x,y   a   eff mil frt  mu  fd");
-           pr(" tch retr rd xl ln carry\n");
+           pr(" tch retr xl ln carry\n");
        }
        if (land.lnd_off)
            noff++;
        }
        if (land.lnd_off)
            noff++;
@@ -74,7 +74,6 @@ land(void)
        pr("%4d", land.lnd_item[I_FOOD]);
        pr("%4d ", land.lnd_tech);
        pr("%3d%%", land.lnd_retreat);
        pr("%4d", land.lnd_item[I_FOOD]);
        pr("%4d ", land.lnd_tech);
        pr("%3d%%", land.lnd_retreat);
-       pr("%3d", land.lnd_rad_max);
        pr("%3d", lnd_nxlight(&land));
        pr("%3d", lnd_nland(&land));
        if (land.lnd_ship >= 0)
        pr("%3d", lnd_nxlight(&land));
        pr("%3d", lnd_nland(&land));
        if (land.lnd_ship >= 0)
index 930810fc617a4643f4de44409efea28432004ea3..cc51db6c37a2dd1a8db49c3e82371e20d69cf8df 100644 (file)
@@ -343,7 +343,7 @@ ldump(void)
                pr(" %d", land.lnd_retreat);
                break;
            case 13:
                pr(" %d", land.lnd_retreat);
                break;
            case 13:
-               pr(" %d", land.lnd_rad_max);
+               pr(" 0");
                break;
            case 14:
                pr(" %d", lnd_nxlight(&land));
                break;
            case 14:
                pr(" %d", lnd_nxlight(&land));
index a62c0e4ff6f6878fbb918b0016f652703ec07c1e..a7c4cac77ee1f2e85d9e13ecf2c5f526ebf9264b 100644 (file)
@@ -68,34 +68,3 @@ range(void)
 
     return RET_OK;
 }
 
     return RET_OK;
 }
-
-int
-lrange(void)
-{
-    struct nstr_item np;
-    struct lndstr land;
-    int i;
-    char *p;
-    char prompt[128];
-    char buf[1024];
-
-    if (!snxtitem(&np, EF_LAND, player->argp[1], NULL))
-       return RET_SYN;
-    while (nxtitem(&np, &land)) {
-       if (!player->owner || land.lnd_own == 0)
-           continue;
-       sprintf(prompt, "New range for %s? ", prland(&land));
-       if ((p = getstarg(player->argp[2], prompt, buf)) == 0)
-           return RET_SYN;
-       if (!check_land_ok(&land))
-           return RET_SYN;
-       if ((i = atoi(p)) < 0)
-           continue;
-       land.lnd_rad_max = MIN(i, lchr[land.lnd_type].l_rad);
-       pr("%s reaction radius changed to %d\n",
-          prland(&land), land.lnd_rad_max);
-       putland(land.lnd_uid, &land);
-    }
-
-    return RET_OK;
-}
index 0efd0e7f878477be831bbbc5b902b9d826b46357..635cf70df7bf934b205a77c87371f979b80efc01 100644 (file)
@@ -344,7 +344,6 @@ struct castr land_ca[] = {
     {"rflags", fldoff(lnd_rflags), NSC_INT, 0, NULL,
      EF_RETREAT_FLAGS, NSC_BITS},
     {"rpath", fldoff(lnd_rpath), NSC_STRINGY, RET_LEN, NULL, EF_BAD, 0},
     {"rflags", fldoff(lnd_rflags), NSC_INT, 0, NULL,
      EF_RETREAT_FLAGS, NSC_BITS},
     {"rpath", fldoff(lnd_rpath), NSC_STRINGY, RET_LEN, NULL, EF_BAD, 0},
-    {"react", fldoff(lnd_rad_max), NSC_UCHAR, 0, NULL, EF_BAD, 0},
     NSC_IVEC(fldoff(lnd_item), ""),
     {"pstage", fldoff(lnd_pstage), NSC_SHORT, 0, NULL,
      EF_PLAGUE_STAGES, NSC_DEITY},
     NSC_IVEC(fldoff(lnd_item), ""),
     {"pstage", fldoff(lnd_pstage), NSC_SHORT, 0, NULL,
      EF_PLAGUE_STAGES, NSC_DEITY},
index 283d44c3f95af9dd313d3c0b97b21ba61620b543..02e12ab5d7105a3cb2419730688ae710e64fa616 100644 (file)
@@ -142,7 +142,6 @@ struct cmndstr player_coms[] = {
     {"lookout <SHIPS>", 1, look, 0, NORM + CAP},
     {"lost", 0, lost, 0, NORM},
     {"lradar <UNITS | SECTS>", 1, lrad, 0, NORM + CAP},
     {"lookout <SHIPS>", 1, look, 0, NORM + CAP},
     {"lost", 0, lost, 0, NORM},
     {"lradar <UNITS | SECTS>", 1, lrad, 0, NORM + CAP},
-    {"lrange <UNITS> <range>", 1, lrange, C_MOD, NORM + CAP},
     {"lretreat <UNITS|ARMY> <PATH> [i|h|b|c]",
      1, lretr, C_MOD, NORM + CAP},
     {"lstat <UNITS>", 0, lsta, C_MOD, NORM},
     {"lretreat <UNITS|ARMY> <PATH> [i|h|b|c]",
      1, lretr, C_MOD, NORM + CAP},
     {"lstat <UNITS>", 0, lsta, C_MOD, NORM},
index c55fc5009f4cf11d41740f1cb73b298aedaed63d..bec3fd8ff28b0e2111653ed0aa61e46a19f92d34 100644 (file)
@@ -1481,7 +1481,7 @@ att_reacting_units(struct combat *def, struct emp_qelem *list, int a_spy,
     while (nxtitem(&ni, &land) && dtotal + new_land * eff < 1.2 * ototal) {
        if (!land.lnd_own)
            continue;
     while (nxtitem(&ni, &land) && dtotal + new_land * eff < 1.2 * ototal) {
        if (!land.lnd_own)
            continue;
-       if (!land.lnd_rad_max)
+       if (land.lnd_mission != MI_RESERVE)
            continue;
        if ((land.lnd_x == def->x) && (land.lnd_y == def->y))
            continue;
            continue;
        if ((land.lnd_x == def->x) && (land.lnd_y == def->y))
            continue;
@@ -1500,14 +1500,8 @@ att_reacting_units(struct combat *def, struct emp_qelem *list, int a_spy,
        if (!has_supply(&land))
            continue;
 
        if (!has_supply(&land))
            continue;
 
-       if (land.lnd_mission == MI_RESERVE) {
-           if (!in_oparea((struct empobj *)&land, def->x, def->y))
-               continue;
-       } else {
-           if (mapdist(land.lnd_x, land.lnd_y, def->x, def->y)
-               > lnd_reaction_range(&land))
-               continue;
-       }
+       if (!in_oparea((struct empobj *)&land, def->x, def->y))
+           continue;
 
        getsect(land.lnd_x, land.lnd_y, &sect);
        getsect(def->x, def->y, &dsect);
 
        getsect(land.lnd_x, land.lnd_y, &sect);
        getsect(def->x, def->y, &dsect);
index 763e5155b47faa10c7375b748161f3b01d0480f2..10a38a4a77bf18f26a054c67b041deb311767822 100644 (file)
@@ -131,8 +131,8 @@ lnd_reaction_range(struct lndstr *lp)
 
     getsect(lp->lnd_x, lp->lnd_y, &sect);
     if (sect.sct_type == SCT_HEADQ && sect.sct_effic >= 60)
 
     getsect(lp->lnd_x, lp->lnd_y, &sect);
     if (sect.sct_type == SCT_HEADQ && sect.sct_effic >= 60)
-       return lp->lnd_rad_max + 1;
-    return lp->lnd_rad_max;
+       return lchr[lp->lnd_type].l_rad + 1;
+    return lchr[lp->lnd_type].l_rad;
 }
 
 void
 }
 
 void
index 1d6da175d49ebfd658a5c13615c54e65764882e2..1d99e08f5cdc4e3e0f33ae63c31f62ef8454be90 100644 (file)
@@ -353,7 +353,6 @@ unit_wipe_orders(struct empobj *unit)
        lp->lnd_retreat = morale_base;
        lp->lnd_rflags = 0;
        lp->lnd_rpath[0] = 0;
        lp->lnd_retreat = morale_base;
        lp->lnd_rflags = 0;
        lp->lnd_rpath[0] = 0;
-       lp->lnd_rad_max = 0;
        break;
     case EF_NUKE:
        break;
        break;
     case EF_NUKE:
        break;