subs: Factor out lnd_mar_put_one()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-01-25 16:38:34 +01:00
parent 268b05225f
commit 47ccc40e38

View file

@ -523,6 +523,15 @@ lnd_mar(struct emp_qelem *list, double *minmobp, double *maxmobp,
} }
} }
static void
lnd_mar_put_one(struct ulist *llp)
{
if (llp->mobil < -127)
llp->mobil = -127;
llp->unit.land.lnd_mobil = llp->mobil;
lnd_put_one(llp);
}
void void
lnd_mar_put(struct emp_qelem *list, natid actor) lnd_mar_put(struct emp_qelem *list, natid actor)
{ {
@ -536,10 +545,7 @@ lnd_mar_put(struct emp_qelem *list, natid actor)
lp = &llp->unit.land; lp = &llp->unit.land;
mpr(actor, "%s stopped at %s\n", mpr(actor, "%s stopped at %s\n",
prland(lp), xyas(lp->lnd_x, lp->lnd_y, actor)); prland(lp), xyas(lp->lnd_x, lp->lnd_y, actor));
if (llp->mobil < -127) lnd_mar_put_one(llp);
llp->mobil = -127;
lp->lnd_mobil = llp->mobil;
lnd_put_one(llp);
} }
} }
@ -686,10 +692,7 @@ lnd_stays(natid actor, char *str, struct ulist *llp)
mpr(actor, "%s %s & stays in %s\n", mpr(actor, "%s %s & stays in %s\n",
prland(&llp->unit.land), str, prland(&llp->unit.land), str,
xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y, actor)); xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y, actor));
if (llp->mobil < -127) lnd_mar_put_one(llp);
llp->mobil = -127;
llp->unit.land.lnd_mobil = llp->mobil;
lnd_put_one(llp);
} }
static int static int