explore_map(s_char *what, coord curx, coord cury, s_char *arg)
{
struct nstr_sect ns;
- struct natstr *np;
struct sctstr sect;
- coord rel_x, rel_y;
- s_char range[128];
- s_char view[7];
+ char view[7];
int i;
int changed = 0;
- np = getnatp(player->cnum);
- rel_x = xrel(np, curx);
- rel_y = yrel(np, cury);
- sprintf(range, "%d:%d,%d:%d", rel_x - 2, rel_x + 2, rel_y - 1,
- rel_y + 1);
- if (!snxtsct(&ns, range))
- return RET_FAIL;
+ snxtsct_dist(&ns, curx, cury, 1);
i = 0;
while (i < 7 && nxtsct(&ns, §)) {
+ /* Nasty: this relies on the iteration order */
view[i] = dchr[sect.sct_type].d_mnem;
switch (sect.sct_type) {
case SCT_WATER:
return RET_SYN;
shp_sel(&ni_ship, &ship_list);
shp_nav(&ship_list, &minmob, &maxmob, &together, player->cnum);
- player->condarg = 0; /* conditions don't apply to nav_map() */
if (QEMPTY(&ship_list)) {
pr("No ships\n");
return RET_FAIL;
int
nav_map(int x, int y, int show_designations)
{
- s_char *ptr;
+ char *ptr;
struct nstr_sect ns;
struct natstr *np;
struct sctstr sect;
/* Note this is not re-entrant anyway, so we keep the buffers
around */
static unsigned char *bitmap = NULL;
- static s_char *wmapbuf = NULL;
- static s_char **wmap = NULL;
- s_char what[64];
+ static char *wmapbuf = NULL;
+ static char **wmap = NULL;
int changed = 0;
- np = getnatp(player->cnum);
- sprintf(what, "%d:%d,%d:%d", xrel(np, x - 2), xrel(np, x + 2),
- yrel(np, y - 1), yrel(np, y + 1));
- if (!snxtsct(&ns, what))
- return RET_FAIL;
if (!wmapbuf)
wmapbuf = malloc(WORLD_Y * MAPWIDTH(1));
if (!wmap) {
- wmap = malloc(WORLD_Y * sizeof(s_char *));
+ wmap = malloc(WORLD_Y * sizeof(*wmap));
if (wmap && wmapbuf) {
for (i = 0; i < WORLD_Y; i++)
wmap[i] = &wmapbuf[MAPWIDTH(1) * i];
return RET_FAIL;
}
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
- /* zap any conditionals */
- ns.ncond = 0;
+ snxtsct_dist(&ns, x, y, 1);
+ np = getnatp(player->cnum);
xyrelrange(np, &ns.range, &range);
- blankfill((s_char *)wmapbuf, &ns.range, 1);
+ blankfill(wmapbuf, &ns.range, 1);
while (nxtsct(&ns, §)) {
ptr = &wmap[ns.dy][ns.dx];
*ptr = dchr[sect.sct_type].d_mnem;
move_map(s_char *what, coord curx, coord cury, s_char *arg)
{
struct nstr_sect ns;
- struct natstr *np;
struct sctstr sect;
- coord rel_x, rel_y;
- s_char range[128];
- s_char view[7];
+ char view[7];
int i;
int changed = 0;
- np = getnatp(player->cnum);
- rel_x = xrel(np, curx);
- rel_y = yrel(np, cury);
- sprintf(range, "%d:%d,%d:%d", rel_x - 2, rel_x + 2, rel_y - 1,
- rel_y + 1);
- player->condarg = 0;
- /* This is necessary, otherwise move_map would attempt to pay */
- /* attention to the conditional arguments left behind by such */
- /* a command as "tran p -1,-1 ?eff=100".. It'd then only see */
- /* 100% efficienct sects, and get all screwed up --ts */
- if (!snxtsct(&ns, range))
- return RET_FAIL;
+ snxtsct_dist(&ns, curx, cury, 1);
i = 0;
while (i < 7 && nxtsct(&ns, §)) {
+ /* Nasty: this relies on the iteration order */
view[i] = dchr[sect.sct_type].d_mnem;
switch (sect.sct_type) {
case SCT_WATER:
fly_map(coord curx, coord cury)
{
struct nstr_sect ns;
- struct natstr *np;
struct sctstr sect;
- coord rel_x, rel_y;
- s_char view[7];
+ char view[7];
int i;
- s_char range[128];
-
- np = getnatp(player->cnum);
- rel_x = xrel(np, curx);
- rel_y = yrel(np, cury);
- sprintf(range, "%d:%d,%d:%d", rel_x - 2, rel_x + 2, rel_y - 1,
- rel_y + 1);
- player->condarg = 0;
- /* This is necessary, otherwise move_map would attempt to pay */
- /* attention to the conditional arguments left behind by such */
- /* a command as "tran p -1,-1 ?eff=100".. It'd then only see */
- /* 100% efficienct sects, and get all screwed up --ts */
- if (!snxtsct(&ns, range))
- return RET_FAIL;
+ snxtsct_dist(&ns, curx, cury, 1);
i = 0;
while (i < 7 && nxtsct(&ns, §)) {
+ /* Nasty: this relies on the iteration order */
if (!(view[i] = player->bmap[sctoff(ns.x, ns.y)]))
view[i] = ' ';
i++;