Make land units on reserve mission react within op-area

Before, they always reacted to their maximum range, and the op-area
was unused.  Change mission() to define the op-area for reserve
missions as well.  Remove the special-case for showing reserve
missions from mission() and show_mission().  New lnd_reaction_range()
factored out of att_reacting_units().  Use it in oprange() to cover
reserve missions.  Pass the mission as separate parameter to oprange()
for now, because miss() doesn't set it in the object until later.
This commit is contained in:
Markus Armbruster 2008-11-22 14:40:37 -05:00
parent 40d8357746
commit 8e527b6cff
7 changed files with 40 additions and 52 deletions

View file

@ -1469,8 +1469,6 @@ att_reacting_units(struct combat *def, struct emp_qelem *list, int a_spy,
double new_land = 0;
double mobcost;
double pathcost;
int dist;
int radius;
int origx, origy;
double eff = att_combat_eff(def);
char buf[1024];
@ -1502,18 +1500,16 @@ att_reacting_units(struct combat *def, struct emp_qelem *list, int a_spy,
if (!has_supply(&land))
continue;
dist = mapdist(land.lnd_x, land.lnd_y, def->x, def->y);
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;
}
getsect(land.lnd_x, land.lnd_y, &sect);
/* Units on efficient headquarters can react 1 farther */
if ((sect.sct_type == SCT_HEADQ) && (sect.sct_effic >= 60))
radius = land.lnd_rad_max + 1;
else
radius = land.lnd_rad_max;
if (dist > radius)
continue;
getsect(def->x, def->y, &dsect);
if (!BestLandPath(buf, &sect, &dsect, &pathcost,
lnd_mobtype(&land)))