subs: Factor lnd_insque() out of lnd_sel(), ask_olist(), ...

... get_dlist(), att_reacting_units().

This loses malloc() error checking in ask_olist() and get_dlist().  No
great loss, because we don't check in so many other places, including
att_reacting_units().  We should use a wrapper that terminates on
error, though.  Left for another day.

ask_olist(), get_dlist() and att_reacting_units() zero the struct
ulist with memset().  lnd_insque() doesn't, so these functions need to
zero any members not otherwise initialized explicitly now.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-01-25 10:44:50 +01:00
parent e62af86066
commit 62b9399cdf
3 changed files with 26 additions and 35 deletions

View file

@ -30,7 +30,7 @@
* Thomas Ruschak, 1992
* Ken Stevens, 1995
* Steve McClure, 1998
* Markus Armbruster, 2004-2013
* Markus Armbruster, 2004-2014
*/
#ifndef LAND_H
@ -170,6 +170,7 @@ extern double lnd_fire_range(struct lndstr *);
extern void lnd_sweep(struct emp_qelem *, int, int, natid);
extern int lnd_interdict(struct emp_qelem *, coord, coord, natid);
extern void lnd_sel(struct nstr_item *, struct emp_qelem *);
extern struct ulist *lnd_insque(struct lndstr *, struct emp_qelem *);
extern int lnd_check_mines(struct emp_qelem *);
extern double lnd_pathcost(struct lndstr *, double);
extern int lnd_mobtype(struct lndstr *);