(unit_put): New, create by combining shp_put() and lnd_put().

(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.
This commit is contained in:
Ron Koenderink 2007-01-23 23:51:02 +00:00
parent 038cc74d4e
commit d94d269769
8 changed files with 39 additions and 56 deletions

View file

@ -94,3 +94,35 @@ unit_list(struct emp_qelem *unit_list)
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;
}
}