extern int lnd_spyval(struct lndstr *);
extern void intelligence_report(int, struct lndstr *, int, char *);
extern void lnd_mar(struct emp_qelem *, double *, double *, int *, natid);
+extern void lnd_put(struct emp_qelem *, natid);
extern int lnd_hardtarget(struct lndstr *);
extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int);
extern int lnd_support(natid, natid, coord, coord, int);
extern void shp_sel(struct nstr_item *, struct emp_qelem *);
extern struct ulist *shp_insque(struct shpstr *, struct emp_qelem *);
extern void shp_nav(struct emp_qelem *, double *, double *, int *, natid);
+extern void shp_put(struct emp_qelem *, natid);
extern int shp_sweep(struct emp_qelem *, int, int, natid);
extern enum d_navigation shp_check_nav(struct shpstr *, struct sctstr *);
extern int sect_has_dock(struct sctstr *);
extern char *unit_nameof(struct empobj *);
extern void unit_list(struct emp_qelem *);
-extern void unit_put(struct emp_qelem *list, natid actor);
extern char *unit_path(int, struct empobj *, char *, size_t);
extern void unit_view(struct emp_qelem *);
extern void unit_teleport(struct empobj *, coord, coord);
send_reacting_units_home(dlist);
/* putland the defending land */
- unit_put(dlist, 0);
+ lnd_put(dlist, 0);
/* putland the attacking land */
put_oland(olist);
}
if (QEMPTY(olist))
return;
- unit_put(olist, 0);
+ lnd_put(olist, 0);
}
/*
}
}
+void
+lnd_put(struct emp_qelem *list, natid actor)
+{
+ struct emp_qelem *qp, *next;
+ struct ulist *llp;
+ struct lndstr *lp;
+
+ for (qp = list->q_back; qp != list; qp = next) {
+ next = qp->q_back;
+ llp = (struct ulist *)qp;
+ lp = &llp->unit.land;
+ if (actor) {
+ mpr(actor, "%s stopped at %s\n",
+ prland(lp), xyas(lp->lnd_x, lp->lnd_y, actor));
+ if (llp->mobil < -127)
+ llp->mobil = -127;
+ lp->lnd_mobil = llp->mobil;
+ }
+ putland(lp->lnd_uid, lp);
+ emp_remque(qp);
+ free(qp);
+ }
+}
+
/*
* Sweep landmines with engineers in LAND_LIST for ACTOR.
* If EXPLICIT is non-zero, this is for an explicit sweep command from
int oldown;
if (dir <= DIR_STOP || dir >= DIR_VIEW) {
- unit_put(list, actor);
+ lnd_put(list, actor);
return 1;
}
dx = diroff[dir][0];
}
}
+void
+shp_put(struct emp_qelem *list, natid actor)
+{
+ struct emp_qelem *qp, *next;
+ struct ulist *mlp;
+ struct shpstr *sp;
+
+ for (qp = list->q_back; qp != list; qp = next) {
+ next = qp->q_back;
+ mlp = (struct ulist *)qp;
+ sp = &mlp->unit.ship;
+ mpr(actor, "%s stopped at %s\n",
+ prship(sp), xyas(sp->shp_x, sp->shp_y, actor));
+ sp->shp_mobil = (int)mlp->mobil;
+ putship(sp->shp_uid, sp);
+ emp_remque(qp);
+ free(qp);
+ }
+}
+
int
shp_sweep(struct emp_qelem *ship_list, int verbose, int takemob, natid actor)
{
int navigate;
if (dir <= DIR_STOP || dir >= DIR_VIEW) {
- unit_put(list, actor);
+ shp_put(list, actor);
return 1;
}
dx = diroff[dir][0];
*
* Known contributors to this file:
* Ron Koenderink, 2007
- * Markus Armbruster, 2009-2013
+ * Markus Armbruster, 2009-2014
*/
#include <config.h>
}
}
-void
-unit_put(struct emp_qelem *list, natid actor)
-{
- struct emp_qelem *qp;
- struct emp_qelem *newqp;
- struct ulist *ulp;
- struct empobj *unit;
-
- qp = list->q_back;
- while (qp != list) {
- ulp = (struct ulist *)qp;
- unit = &ulp->unit.gen;
- if (CANT_HAPPEN(unit->ef_type != EF_LAND
- && unit->ef_type != EF_SHIP))
- continue;
- if (actor) {
- mpr(actor, "%s stopped at %s\n", unit_nameof(unit),
- xyas(unit->x, unit->y, actor));
- if (unit->ef_type == EF_LAND) {
- if (ulp->mobil < -127)
- ulp->mobil = -127;
- unit->mobil = ulp->mobil;
- }
- }
- if (unit->ef_type == EF_SHIP)
- unit->mobil = (int)ulp->mobil;
- put_empobj(unit->ef_type, unit->uid, unit);
- newqp = qp->q_back;
- emp_remque(qp);
- free(qp);
- qp = newqp;
- }
-}
-
char *
unit_path(int together, struct empobj *unit, char *buf, size_t bufsz)
{
fltp->maxmoves = 1;
--fltp->maxmoves;
}
- unit_put(&ship_list, own);
+ shp_put(&ship_list, own);
getship(sp->shp_uid, &ship);
fltp->x = ship.shp_x;
fltp->y = ship.shp_y;