From: Markus Armbruster Date: Tue, 25 Nov 2008 01:31:22 +0000 (-0500) Subject: Remove non-mission land unit reaction X-Git-Tag: v4.3.20~110 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=bf89453f8abadd16a2c360c724228e36d6ec550e Remove non-mission land unit reaction 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(). --- diff --git a/include/land.h b/include/land.h index 59adea1a9..9f4b617a5 100644 --- a/include/land.h +++ b/include/land.h @@ -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 */ - 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 */ diff --git a/include/prototypes.h b/include/prototypes.h index c3c6ab4b6..cf6f0847f 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -149,7 +149,6 @@ int load(void); int look(void); int lost(void); int lrad(void); -int lrange(void); int lretr(void); int lsta(void); int ltend(void); diff --git a/info/Attacking.t b/info/Attacking.t index 35282d362..0034c22a2 100644 --- a/info/Attacking.t +++ b/info/Attacking.t @@ -133,20 +133,18 @@ strength of your sectors. .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 +- 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 unit must be in range. .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 diff --git a/info/Land-units.t b/info/Land-units.t index 89b4169bd..0c37c502a 100644 --- a/info/Land-units.t +++ b/info/Land-units.t @@ -24,19 +24,19 @@ Let's look at a typical land unit: .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, -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) -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 @@ -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 -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 @@ -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. -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 diff --git a/info/Novice.t b/info/Novice.t index fb5ea5dd3..3833653d8 100644 --- a/info/Novice.t +++ b/info/Novice.t @@ -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, - 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. diff --git a/info/land.t b/info/land.t index d8b369bbb..e8f7d48f4 100644 --- a/info/land.t +++ b/info/land.t @@ -6,10 +6,10 @@ The land unit report command is a census of your land units. For 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 @@ -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), -.L rd -the land unit's reaction radius (see info \*Qfortify\*U), .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 index 91dc17efe..000000000 --- a/info/lrange.t +++ /dev/null @@ -1,11 +0,0 @@ -.TH Command LRANGE -.NA lrange "Edit the reaction range of a unit" -.LV Expert -.SY "lrange " -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" diff --git a/info/mission.t b/info/mission.t index 722639cc5..b7f67064b 100644 --- a/info/mission.t +++ b/info/mission.t @@ -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 -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 diff --git a/src/lib/commands/edit.c b/src/lib/commands/edit.c index e6c47fe98..e28b262c6 100644 --- a/src/lib/commands/edit.c +++ b/src/lib/commands/edit.c @@ -347,7 +347,6 @@ pr_land(struct lndstr *land) pr("Fortification : %d\t", land->lnd_harden); pr("Land unit : %d\n", land->lnd_land); pr("Ship : %d\t\t", land->lnd_ship); - pr("Radius

: %d\n", land->lnd_rad_max); pr("Retreat percentage : %d\n", land->lnd_retreat); pr("Retreat path : '%s'\t\tRetreat Flags : %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_rad_max = arg; + warn_deprecated(op); break; case 'Z': land->lnd_retreat = arg; diff --git a/src/lib/commands/land.c b/src/lib/commands/land.c index b2adc8b6c..5bbaf984d 100644 --- a/src/lib/commands/land.c +++ b/src/lib/commands/land.c @@ -57,7 +57,7 @@ land(void) 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++; @@ -74,7 +74,6 @@ land(void) 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) diff --git a/src/lib/commands/ldump.c b/src/lib/commands/ldump.c index 930810fc6..cc51db6c3 100644 --- a/src/lib/commands/ldump.c +++ b/src/lib/commands/ldump.c @@ -343,7 +343,7 @@ ldump(void) pr(" %d", land.lnd_retreat); break; case 13: - pr(" %d", land.lnd_rad_max); + pr(" 0"); break; case 14: pr(" %d", lnd_nxlight(&land)); diff --git a/src/lib/commands/rang.c b/src/lib/commands/rang.c index a62c0e4ff..a7c4cac77 100644 --- a/src/lib/commands/rang.c +++ b/src/lib/commands/rang.c @@ -68,34 +68,3 @@ range(void) 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; -} diff --git a/src/lib/common/nsc.c b/src/lib/common/nsc.c index 0efd0e7f8..635cf70df 100644 --- a/src/lib/common/nsc.c +++ b/src/lib/common/nsc.c @@ -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}, - {"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}, diff --git a/src/lib/player/empmod.c b/src/lib/player/empmod.c index 283d44c3f..02e12ab5d 100644 --- a/src/lib/player/empmod.c +++ b/src/lib/player/empmod.c @@ -142,7 +142,6 @@ struct cmndstr player_coms[] = { {"lookout ", 1, look, 0, NORM + CAP}, {"lost", 0, lost, 0, NORM}, {"lradar ", 1, lrad, 0, NORM + CAP}, - {"lrange ", 1, lrange, C_MOD, NORM + CAP}, {"lretreat [i|h|b|c]", 1, lretr, C_MOD, NORM + CAP}, {"lstat ", 0, lsta, C_MOD, NORM}, diff --git a/src/lib/subs/attsub.c b/src/lib/subs/attsub.c index c55fc5009..bec3fd8ff 100644 --- a/src/lib/subs/attsub.c +++ b/src/lib/subs/attsub.c @@ -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; - if (!land.lnd_rad_max) + if (land.lnd_mission != MI_RESERVE) 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 (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, §); getsect(def->x, def->y, &dsect); diff --git a/src/lib/subs/lndsub.c b/src/lib/subs/lndsub.c index 763e5155b..10a38a4a7 100644 --- a/src/lib/subs/lndsub.c +++ b/src/lib/subs/lndsub.c @@ -131,8 +131,8 @@ lnd_reaction_range(struct lndstr *lp) getsect(lp->lnd_x, lp->lnd_y, §); 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 diff --git a/src/lib/subs/unitsub.c b/src/lib/subs/unitsub.c index 1d6da175d..1d99e08f5 100644 --- a/src/lib/subs/unitsub.c +++ b/src/lib/subs/unitsub.c @@ -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_rad_max = 0; break; case EF_NUKE: break;