Move show_mission() to sole caller, give it internal linkage

This commit is contained in:
Markus Armbruster 2008-11-22 15:02:18 -05:00
parent c1b76a1a2f
commit 7ac151acac
3 changed files with 44 additions and 43 deletions

View file

@ -486,7 +486,6 @@ extern int def_support(coord, coord, natid, natid);
extern int oprange(struct empobj *, int); extern int oprange(struct empobj *, int);
extern int in_oparea(struct empobj *, coord, coord); extern int in_oparea(struct empobj *, coord, coord);
extern int cando(int, int); extern int cando(int, int);
extern void show_mission(int, struct nstr_item *);
extern int air_defense(coord, coord, natid, struct emp_qelem *, extern int air_defense(coord, coord, natid, struct emp_qelem *,
struct emp_qelem *); struct emp_qelem *);
/* move.c */ /* move.c */

View file

@ -40,6 +40,8 @@
#include "optlist.h" #include "optlist.h"
#include "path.h" #include "path.h"
static void show_mission(int, struct nstr_item *);
/* /*
* mission <type> <planes/ships/units> <mission type> <op sector> [<radius>] * mission <type> <planes/ships/units> <mission type> <op sector> [<radius>]
*/ */
@ -301,3 +303,45 @@ mission(void)
pr("%d %s%s\n", num, ef_nameof(type), splur(num)); pr("%d %s%s\n", num, ef_nameof(type), splur(num));
return RET_OK; return RET_OK;
} }
static void
show_mission(int type, struct nstr_item *np)
{
int first = 1;
union empobj_storage item;
struct empobj *gp;
while (nxtitem(np, &item)) {
gp = (struct empobj *)&item;
if (!player->owner || gp->own == 0)
continue;
if (first) {
pr("Thing x,y op-sect rad mission\n");
first = 0;
}
pr("%-25s", obj_nameof(gp));
prxy(" %3d,%-3d", gp->x, gp->y, player->cnum);
switch (gp->mission) {
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;
default:
CANT_REACH();
/* fall through */
case MI_NONE:
pr(" ");
}
if (gp->mission)
pr(" is on %s mission\n", mission_name(gp->mission));
else
pr(" has no mission.\n");
}
}

View file

@ -741,48 +741,6 @@ mission_name(short mission)
return "a mysterious"; return "a mysterious";
} }
void
show_mission(int type, struct nstr_item *np)
{
int first = 1;
union empobj_storage item;
struct empobj *gp;
while (nxtitem(np, &item)) {
gp = (struct empobj *)&item;
if (!player->owner || gp->own == 0)
continue;
if (first) {
pr("Thing x,y op-sect rad mission\n");
first = 0;
}
pr("%-25s", obj_nameof(gp));
prxy(" %3d,%-3d", gp->x, gp->y, player->cnum);
switch (gp->mission) {
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;
default:
CANT_REACH();
/* fall through */
case MI_NONE:
pr(" ");
}
if (gp->mission)
pr(" is on %s mission\n", mission_name(gp->mission));
else
pr(" has no mission.\n");
}
}
int int
oprange(struct empobj *gp, int mission) oprange(struct empobj *gp, int mission)
{ {