2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 * related information and legal notices. It is expected that any future
24 * projects/authors will amend these files as needed.
28 * snxtit_subs.c: arrange item selection using one of many criteria.
30 * Known contributors to this file:
43 snxtitem_area(register struct nstr_item *np, int type, struct range *range)
45 bzero((s_char *)np, sizeof(*np));
52 np->flags = ef_flags(type);
53 xysize_range(&np->range);
58 snxtitem_dist(register struct nstr_item *np, int type, int cx, int cy, int dist)
62 bzero((s_char *)np, sizeof(*np));
63 xydist_range(cx, cy, dist, &range);
73 np->flags = ef_flags(type);
75 /* This is no longer proper. */
76 /* It did the wrong thing for small, hitech worlds. */
77 xysize_range(&np->range);
83 snxtitem_xy(register struct nstr_item *np, int type, coord x, coord y)
85 bzero((s_char *)np, sizeof(*np));
94 np->flags = ef_flags(type);
99 snxtitem_all(register struct nstr_item *np, int type)
101 bzero((s_char *)np, sizeof(*np));
107 np->flags = ef_flags(type);
108 xysize_range(&np->range);
113 snxtitem_group(register struct nstr_item *np, int type, s_char group)
117 bzero((s_char *)np, sizeof(*np));
124 np->flags = ef_flags(type);
125 xysize_range(&np->range);
130 snxtitem_rewind(struct nstr_item *np)
134 ef_zapcache(np->type);
138 snxtitem_list(register struct nstr_item *np, int type, int *list, int len)
142 bzero((s_char *)np, sizeof(*np));
148 np->flags = ef_flags(type);
149 if (len <= 0 || len > NS_LSIZE)
151 for (i=0; i<len; i++)
152 np->list[i] = list[i];