These files were split a long time ago, for technical reasons which

since vanished (linking into different programs).  Undo the split,
because the stuff really belongs together.
This commit is contained in:
Markus Armbruster 2004-02-28 06:40:48 +00:00
parent e8b7ed630b
commit dd35a9637d
7 changed files with 344 additions and 495 deletions

View file

@ -127,9 +127,119 @@ snxtitem(register struct nstr_item *np, int type, s_char *str)
return 1;
}
/*
* The rest of these (snxtitem_area, snxtitem_dist, etc, have been moved
* into the common lib, since they don't use condargs, and are useful
* elsewhere (update, chiefly). ---ts
*
*/
void
snxtitem_area(register struct nstr_item *np, int type, struct range *range)
{
memset(np, 0, sizeof(*np));
np->cur = -1;
np->type = type;
np->sel = NS_AREA;
np->index = -1;
np->range = *range;
np->read = ef_read;
np->flags = ef_flags(type);
xysize_range(&np->range);
ef_zapcache(type);
}
void
snxtitem_dist(register struct nstr_item *np, int type, int cx, int cy,
int dist)
{
struct range range;
memset(np, 0, sizeof(*np));
xydist_range(cx, cy, dist, &range);
np->cur = -1;
np->type = type;
np->sel = NS_DIST;
np->cx = cx;
np->cy = cy;
np->index = -1;
np->range = range;
np->dist = dist;
np->read = ef_read;
np->flags = ef_flags(type);
#if 0
/* This is no longer proper. */
/* It did the wrong thing for small, hitech worlds. */
xysize_range(&np->range);
#endif
ef_zapcache(type);
}
void
snxtitem_xy(register struct nstr_item *np, int type, coord x, coord y)
{
memset(np, 0, sizeof(*np));
np->cur = -1;
np->type = type;
np->sel = NS_XY;
np->cx = xnorm(x);
np->cy = ynorm(y);
np->index = -1;
np->dist = 0;
np->read = ef_read;
np->flags = ef_flags(type);
ef_zapcache(type);
}
void
snxtitem_all(register struct nstr_item *np, int type)
{
memset(np, 0, sizeof(*np));
np->cur = -1;
np->sel = NS_ALL;
np->type = type;
np->index = -1;
np->read = ef_read;
np->flags = ef_flags(type);
xysize_range(&np->range);
ef_zapcache(type);
}
void
snxtitem_group(register struct nstr_item *np, int type, s_char group)
{
if (group == '~')
group = ' ';
memset(np, 0, sizeof(*np));
np->cur = -1;
np->sel = NS_GROUP;
np->group = group;
np->type = type;
np->index = -1;
np->read = ef_read;
np->flags = ef_flags(type);
xysize_range(&np->range);
ef_zapcache(type);
}
void
snxtitem_rewind(struct nstr_item *np)
{
np->cur = -1;
np->index = -1;
ef_zapcache(np->type);
}
int
snxtitem_list(register struct nstr_item *np, int type, int *list, int len)
{
int i;
memset(np, 0, sizeof(*np));
np->cur = -1;
np->type = type;
np->sel = NS_LIST;
np->index = -1;
np->read = ef_read;
np->flags = ef_flags(type);
if (len <= 0 || len > NS_LSIZE)
return 0;
for (i = 0; i < len; i++)
np->list[i] = list[i];
np->size = len;
ef_zapcache(type);
return 1;
}