All missions now have op areas, simplify mission()

This commit is contained in:
Markus Armbruster 2008-11-22 15:19:27 -05:00
parent a9b2d9c7f3
commit c1b76a1a2f
2 changed files with 9 additions and 25 deletions

View file

@ -1,7 +1,7 @@
.TH Command MISSION .TH Command MISSION
.NA mission "Assign a mission to a ship/plane/unit" .NA mission "Assign a mission to a ship/plane/unit"
.LV Basic .LV Basic
.SY "mission <TYPE> <UNITS> <s|o|d|i|e|r|a|c|q> [<op sector|.>] [<radius>]" .SY "mission <TYPE> <UNITS> <s|o|d|i|e|r|a|c|q> <op sector|.> [<radius>]"
.s1 .s1
The mission command is used to assign ships, planes, or land units to The mission command is used to assign ships, planes, or land units to
missions. The available missions are: missions. The available missions are:
@ -63,7 +63,7 @@ on a sector until 100 damage is done.
.s1 .s1
OPERATIONS SECTORS OPERATIONS SECTORS
.s1 .s1
Some missions require the designation of an 'op sector', short for operations 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. 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. The op sector may be any sector that is within the unit's range.
(Firing range for ships & land units on interdiction, reaction range (Firing range for ships & land units on interdiction, reaction range

View file

@ -205,10 +205,7 @@ mission(void)
dist = mapdist(gp->x, gp->y, x, y); dist = mapdist(gp->x, gp->y, x, y);
radius = 999; radius = 999;
if (mission == MI_INTERDICT || mission == MI_SUPPORT || if (mission) {
mission == MI_OSUPPORT || mission == MI_DSUPPORT ||
mission == MI_RESERVE || mission == MI_ESCORT ||
mission == MI_AIR_DEFENSE) {
radius = oprange(gp, mission); radius = oprange(gp, mission);
if (radius < dist) { if (radius < dist) {
pr("%s: out of range! (range %d)\n", pr("%s: out of range! (range %d)\n",
@ -283,28 +280,15 @@ mission(void)
num++; /* good one.. go with it */ num++; /* good one.. go with it */
if (mission == MI_INTERDICT || mission == MI_SUPPORT || if (mission) {
mission == MI_OSUPPORT || mission == MI_DSUPPORT ||
mission == MI_RESERVE || mission == MI_ESCORT ||
mission == MI_AIR_DEFENSE)
gp->radius = radius;
else
gp->radius = 0;
if (mission == MI_SUPPORT || mission == MI_OSUPPORT ||
mission == MI_DSUPPORT || mission == MI_INTERDICT ||
mission == MI_RESERVE || mission == MI_ESCORT ||
mission == MI_AIR_DEFENSE) {
pr("%s on %s mission, centered on %s, radius %d\n", pr("%s on %s mission, centered on %s, radius %d\n",
obj_nameof(gp), mission_name(mission), obj_nameof(gp), mission_name(mission),
xyas(x, y, player->cnum), gp->radius); xyas(x, y, player->cnum), radius);
} else if (mission) {
pr("%s on %s mission\n", obj_nameof(gp),
mission_name(mission));
}
if (mission)
gp->mobil -= mobused; gp->mobil -= mobused;
gp->radius = radius;
} else
gp->radius = 0;
gp->mission = mission; gp->mission = mission;
gp->opx = x; gp->opx = x;
gp->opy = y; gp->opy = y;