(unit_view): New, create by expanding shp_view() to work for
land_unit as well. (do_unit_move): Add view option for land units using unit_view(). Combine ship and land viewing using the unit_view(). (shp_view): Remove, not used any more, replaced by unit_view().
This commit is contained in:
parent
aee2bc78e2
commit
7434da679e
5 changed files with 28 additions and 29 deletions
|
@ -667,7 +667,6 @@ extern int shp_sweep(struct emp_qelem *, int, int, natid);
|
||||||
extern int shp_check_nav(struct sctstr *, struct shpstr *);
|
extern int shp_check_nav(struct sctstr *, struct shpstr *);
|
||||||
extern int sect_has_dock(struct sctstr *);
|
extern int sect_has_dock(struct sctstr *);
|
||||||
extern int shp_hardtarget(struct shpstr *);
|
extern int shp_hardtarget(struct shpstr *);
|
||||||
extern void shp_view(struct emp_qelem *);
|
|
||||||
extern int shp_nav_one_sector(struct emp_qelem *, int, natid, int);
|
extern int shp_nav_one_sector(struct emp_qelem *, int, natid, int);
|
||||||
extern int shp_missile_defense(coord, coord, natid, int);
|
extern int shp_missile_defense(coord, coord, natid, int);
|
||||||
extern void shp_missdef(struct shpstr *, natid);
|
extern void shp_missdef(struct shpstr *, natid);
|
||||||
|
|
|
@ -45,3 +45,4 @@ struct ulist {
|
||||||
extern void unit_list(struct emp_qelem *);
|
extern void unit_list(struct emp_qelem *);
|
||||||
extern void unit_put(struct emp_qelem *list, natid actor);
|
extern void unit_put(struct emp_qelem *list, natid actor);
|
||||||
extern char *unit_path(int, struct empobj *, char *);
|
extern char *unit_path(int, struct empobj *, char *);
|
||||||
|
extern void unit_view(struct emp_qelem *);
|
||||||
|
|
|
@ -255,13 +255,10 @@ do_unit_move(struct emp_qelem *ulist, int *together,
|
||||||
player->btused++;
|
player->btused++;
|
||||||
continue;
|
continue;
|
||||||
case 'v':
|
case 'v':
|
||||||
if (leader->ef_type != EF_SHIP)
|
unit_view(ulist);
|
||||||
break;
|
|
||||||
shp_view(ulist);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
direrr("`%c' to stop",
|
direrr("`%c' to stop", ", `%c' to view", NULL);
|
||||||
type == EF_SHIP ? ", `%c' to view" : NULL, NULL);
|
|
||||||
pr(", `i' to list %s, `f' to change %s,\n",
|
pr(", `i' to list %s, `f' to change %s,\n",
|
||||||
type == EF_SHIP ? "ships" : "units",
|
type == EF_SHIP ? "ships" : "units",
|
||||||
type == EF_SHIP ? "flagship" : "leader");
|
type == EF_SHIP ? "flagship" : "leader");
|
||||||
|
|
|
@ -735,29 +735,6 @@ shp_hit_mine(struct shpstr *sp, struct mchrstr *mcp)
|
||||||
return (int)m;
|
return (int)m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
shp_view(struct emp_qelem *list)
|
|
||||||
{
|
|
||||||
struct sctstr sect;
|
|
||||||
struct emp_qelem *qp;
|
|
||||||
struct emp_qelem *next;
|
|
||||||
struct ulist *mlp;
|
|
||||||
|
|
||||||
for (qp = list->q_back; qp != list; qp = next) {
|
|
||||||
next = qp->q_back;
|
|
||||||
mlp = (struct ulist *)qp;
|
|
||||||
getsect(mlp->unit.ship.shp_x, mlp->unit.ship.shp_y, §);
|
|
||||||
if (((struct mchrstr *)mlp->chrp)->m_flags & M_FOOD)
|
|
||||||
mpr(mlp->unit.ship.shp_own, "[fert:%d] ", sect.sct_fertil);
|
|
||||||
if (((struct mchrstr *)mlp->chrp)->m_flags & M_OIL)
|
|
||||||
mpr(mlp->unit.ship.shp_own, "[oil:%d] ", sect.sct_oil);
|
|
||||||
mpr(mlp->unit.ship.shp_own, "%s @ %s %d%% %s\n",
|
|
||||||
prship(&mlp->unit.ship),
|
|
||||||
xyas(mlp->unit.ship.shp_x, mlp->unit.ship.shp_y, player->cnum),
|
|
||||||
sect.sct_effic, dchr[sect.sct_type].d_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
|
shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
|
||||||
int together)
|
int together)
|
||||||
|
|
|
@ -176,3 +176,28 @@ unit_path(int together, struct empobj *unit, char *buf)
|
||||||
}
|
}
|
||||||
return cp;
|
return cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
unit_view(struct emp_qelem *list)
|
||||||
|
{
|
||||||
|
struct sctstr sect;
|
||||||
|
struct emp_qelem *qp;
|
||||||
|
struct emp_qelem *next;
|
||||||
|
struct ulist *ulp;
|
||||||
|
|
||||||
|
for (qp = list->q_back; qp != list; qp = next) {
|
||||||
|
next = qp->q_back;
|
||||||
|
ulp = (struct ulist *)qp;
|
||||||
|
getsect(ulp->unit.gen.x, ulp->unit.gen.y, §);
|
||||||
|
if (ulp->unit.ef_type == EF_SHIP) {
|
||||||
|
if (((struct mchrstr *)ulp->chrp)->m_flags & M_FOOD)
|
||||||
|
mpr(ulp->unit.gen.own, "[fert:%d] ", sect.sct_fertil);
|
||||||
|
if (((struct mchrstr *)ulp->chrp)->m_flags & M_OIL)
|
||||||
|
mpr(ulp->unit.gen.own, "[oil:%d] ", sect.sct_oil);
|
||||||
|
}
|
||||||
|
mpr(ulp->unit.gen.own, "%s @ %s %d%% %s\n",
|
||||||
|
obj_nameof(&ulp->unit.gen),
|
||||||
|
xyas(ulp->unit.gen.x, ulp->unit.gen.y, player->cnum),
|
||||||
|
sect.sct_effic, dchr[sect.sct_type].d_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue