(sail_nav_fleet, shp_nav_one_sector): Replace shp_put() with unit_put().
(lnd_mar_one_sector, att_fight, move_in_land): Replace lnd_put() with unit_put().
(shp_put, lnd_put): Remove.
extern void count_units(struct shpstr *);
extern void lnd_count_units(struct lndstr *);
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_nav(struct emp_qelem *, double *, double *, int *, natid);
extern int shp_sweep(struct emp_qelem *, int, int, natid);
extern char *shp_path(int, struct shpstr *, char *);
-extern void shp_put(struct emp_qelem *, natid);
extern int shp_check_nav(struct sctstr *, struct shpstr *);
extern int sect_has_dock(struct sctstr *);
extern int shp_hardtarget(struct shpstr *);
* unit.h: Generalize unit data structures and functions.
*
* Known contributors to this file:
- * Ron Koenderink, 2006
+ * Ron Koenderink, 2006-2007
* Markus Armbruster, 2006
*/
};
extern void unit_list(struct emp_qelem *);
+extern void unit_put(struct emp_qelem *list, natid actor);
send_reacting_units_home(dlist);
/* putland the defending land */
- lnd_put(dlist, 0);
+ unit_put(dlist, 0);
/* putland the attacking land */
put_land(olist);
}
if (QEMPTY(olist))
return;
- lnd_put(olist, 0);
+ unit_put(olist, 0);
}
/*
}
}
-void
-lnd_put(struct emp_qelem *list, natid actor)
-{
- struct emp_qelem *qp;
- struct emp_qelem *newqp;
- struct ulist *llp;
-
- qp = list->q_back;
- while (qp != list) {
- llp = (struct ulist *)qp;
- if (actor) {
- mpr(actor, "%s stopped at %s\n", prland(&llp->unit.land),
- xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y,
- llp->unit.land.lnd_own));
- if (llp->mobil < -127)
- llp->mobil = -127;
- llp->unit.land.lnd_mobil = llp->mobil;
- }
- putland(llp->unit.land.lnd_uid, &llp->unit.land);
- newqp = qp->q_back;
- emp_remque(qp);
- free(qp);
- qp = newqp;
- }
-}
-
void
lnd_sweep(struct emp_qelem *land_list, int verbose, int takemob,
natid actor)
int oldown;
if (dir <= DIR_STOP || dir >= DIR_VIEW) {
- lnd_put(list, actor);
+ unit_put(list, actor);
return 1;
}
dx = diroff[dir][0];
}
}
-void
-shp_put(struct emp_qelem *list, natid actor)
-{
- struct emp_qelem *qp;
- struct emp_qelem *newqp;
- struct ulist *mlp;
-
- qp = list->q_back;
- while (qp != list) {
- mlp = (struct ulist *)qp;
- mpr(actor, "%s stopped at %s\n", prship(&mlp->unit.ship),
- xyas(mlp->unit.ship.shp_x, mlp->unit.ship.shp_y,
- mlp->unit.ship.shp_own));
- mlp->unit.ship.shp_mobil = (int)mlp->mobil;
- putship(mlp->unit.ship.shp_uid, &mlp->unit.ship);
- newqp = qp->q_back;
- emp_remque(qp);
- free(qp);
- qp = newqp;
- }
-}
-
int
shp_sweep(struct emp_qelem *ship_list, int verbose, int takemob, natid actor)
{
int navigate;
if (dir <= DIR_STOP || dir >= DIR_VIEW) {
- shp_put(list, actor);
+ unit_put(list, actor);
return 1;
}
dx = diroff[dir][0];
pr("\n");
}
}
+
+void
+unit_put(struct emp_qelem *list, natid actor)
+{
+ struct emp_qelem *qp;
+ struct emp_qelem *newqp;
+ struct ulist *ulp;
+
+ qp = list->q_back;
+ while (qp != list) {
+ ulp = (struct ulist *)qp;
+ if (actor) {
+ mpr(actor, "%s stopped at %s\n", obj_nameof(&ulp->unit.gen),
+ xyas(ulp->unit.gen.x, ulp->unit.gen.y,
+ ulp->unit.gen.own));
+ if (ulp->unit.ef_type == EF_LAND) {
+ if (ulp->mobil < -127)
+ ulp->mobil = -127;
+ ulp->unit.land.lnd_mobil = ulp->mobil;
+ }
+ }
+ if (ulp->unit.ef_type == EF_SHIP)
+ ulp->unit.ship.shp_mobil = (int)ulp->mobil;
+ put_empobj(&ulp->unit.gen);
+ newqp = qp->q_back;
+ emp_remque(qp);
+ free(qp);
+ qp = newqp;
+ }
+}
+
+
fltp->maxmoves = 1;
--fltp->maxmoves;
}
- shp_put(&ship_list, own);
+ unit_put(&ship_list, own);
getship(sp->shp_uid, &ship);
fltp->x = ship.shp_x;
fltp->y = ship.shp_y;