Simplify unit_put()

This commit is contained in:
Markus Armbruster 2008-02-23 08:35:13 +01:00
parent e7e61687f4
commit 1aa3cdb0ca

View file

@ -102,23 +102,24 @@ unit_put(struct emp_qelem *list, natid actor)
struct emp_qelem *qp; struct emp_qelem *qp;
struct emp_qelem *newqp; struct emp_qelem *newqp;
struct ulist *ulp; struct ulist *ulp;
struct empobj *unit;
qp = list->q_back; qp = list->q_back;
while (qp != list) { while (qp != list) {
ulp = (struct ulist *)qp; ulp = (struct ulist *)qp;
unit = &ulp->unit.gen;
if (actor) { if (actor) {
mpr(actor, "%s stopped at %s\n", obj_nameof(&ulp->unit.gen), mpr(actor, "%s stopped at %s\n", obj_nameof(unit),
xyas(ulp->unit.gen.x, ulp->unit.gen.y, xyas(unit->x, unit->y, unit->own));
ulp->unit.gen.own)); if (unit->ef_type == EF_LAND) {
if (ulp->unit.ef_type == EF_LAND) {
if (ulp->mobil < -127) if (ulp->mobil < -127)
ulp->mobil = -127; ulp->mobil = -127;
ulp->unit.land.lnd_mobil = ulp->mobil; unit->mobil = ulp->mobil;
} }
} }
if (ulp->unit.ef_type == EF_SHIP) if (unit->ef_type == EF_SHIP)
ulp->unit.ship.shp_mobil = (int)ulp->mobil; unit->mobil = (int)ulp->mobil;
put_empobj(ulp->unit.gen.ef_type, ulp->unit.gen.uid, &ulp->unit.gen); put_empobj(unit->ef_type, unit->uid, unit);
newqp = qp->q_back; newqp = qp->q_back;
emp_remque(qp); emp_remque(qp);
free(qp); free(qp);