From 47ccc40e38ca016f5040812f2ef1cea4a6de56bb Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 25 Jan 2014 16:38:34 +0100 Subject: [PATCH] subs: Factor out lnd_mar_put_one() Signed-off-by: Markus Armbruster --- src/lib/subs/lndsub.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/lib/subs/lndsub.c b/src/lib/subs/lndsub.c index 0aeecf683..00522a479 100644 --- a/src/lib/subs/lndsub.c +++ b/src/lib/subs/lndsub.c @@ -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 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; 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; - lnd_put_one(llp); + lnd_mar_put_one(llp); } } @@ -686,10 +692,7 @@ lnd_stays(natid actor, char *str, struct ulist *llp) mpr(actor, "%s %s & stays in %s\n", prland(&llp->unit.land), str, xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y, actor)); - if (llp->mobil < -127) - llp->mobil = -127; - llp->unit.land.lnd_mobil = llp->mobil; - lnd_put_one(llp); + lnd_mar_put_one(llp); } static int -- 2.43.0