subs: Split unit_put() into shp_put() and lnd_put() again

Commit d94d269 combined them into unit_put(), but that has turned out
not to be useful.  Split them again.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-01-25 15:41:58 +01:00
parent 62b9399cdf
commit b5ffc1ca49
8 changed files with 52 additions and 41 deletions

View file

@ -531,6 +531,30 @@ lnd_mar(struct emp_qelem *list, double *minmobp, double *maxmobp,
}
}
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
@ -927,7 +951,7 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
int oldown;
if (dir <= DIR_STOP || dir >= DIR_VIEW) {
unit_put(list, actor);
lnd_put(list, actor);
return 1;
}
dx = diroff[dir][0];