(map, rout, sct, surv): Remove special case for sects argument `*',
snxtsct() handles it just fine.
This commit is contained in:
parent
f99bc9298a
commit
523936cfef
4 changed files with 5 additions and 65 deletions
|
@ -52,12 +52,9 @@ map(void)
|
||||||
register s_char *b;
|
register s_char *b;
|
||||||
int unit_type = 0;
|
int unit_type = 0;
|
||||||
int bmap = 0;
|
int bmap = 0;
|
||||||
struct natstr *np;
|
|
||||||
s_char *str;
|
|
||||||
struct nstr_sect ns;
|
struct nstr_sect ns;
|
||||||
s_char origin = '\0';
|
s_char origin = '\0';
|
||||||
int map_flags = 0;
|
int map_flags = 0;
|
||||||
s_char what[64];
|
|
||||||
s_char buf[1024];
|
s_char buf[1024];
|
||||||
|
|
||||||
if (**player->argp != 'm') {
|
if (**player->argp != 'm') {
|
||||||
|
@ -81,22 +78,8 @@ map(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->argp[1] == NULL) {
|
if (!snxtsct(&ns, player->argp[1])) {
|
||||||
if ((str = getstring("(sects)? ", buf)) == 0)
|
if (unit_map(unit_type, atoi(player->argp[1]), &ns, &origin))
|
||||||
return RET_SYN;
|
|
||||||
} else {
|
|
||||||
str = player->argp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
np = getnatp(player->cnum);
|
|
||||||
if (*str == '*') {
|
|
||||||
sprintf(what, "%d:%d,%d:%d",
|
|
||||||
-WORLD_X / 2, WORLD_X / 2 - 1,
|
|
||||||
-WORLD_Y / 2, WORLD_Y / 2 - 1);
|
|
||||||
if (!snxtsct(&ns, what))
|
|
||||||
return RET_FAIL;
|
|
||||||
} else if (!snxtsct(&ns, str)) {
|
|
||||||
if (unit_map(unit_type, atoi(str), &ns, &origin))
|
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
for (b = player->argp[2]; b && *b; b++) {
|
for (b = player->argp[2]; b && *b; b++) {
|
||||||
|
|
|
@ -62,8 +62,6 @@ rout(void)
|
||||||
i_type i_del;
|
i_type i_del;
|
||||||
int dir;
|
int dir;
|
||||||
s_char *p;
|
s_char *p;
|
||||||
s_char what[64];
|
|
||||||
s_char *str;
|
|
||||||
s_char buf1[1024];
|
s_char buf1[1024];
|
||||||
/* Note this is not re-entrant anyway, so we keep the buffers
|
/* Note this is not re-entrant anyway, so we keep the buffers
|
||||||
around */
|
around */
|
||||||
|
@ -75,19 +73,7 @@ rout(void)
|
||||||
if ((ip = whatitem(player->argp[1], "What item? ")) == 0)
|
if ((ip = whatitem(player->argp[1], "What item? ")) == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
i_del = ip->i_uid;;
|
i_del = ip->i_uid;;
|
||||||
if (player->argp[2] == NULL) {
|
if (!snxtsct(&ns, player->argp[2]))
|
||||||
if ((str = getstring("(sects)? ", buf1)) == 0)
|
|
||||||
return RET_SYN;
|
|
||||||
} else {
|
|
||||||
str = player->argp[2];
|
|
||||||
}
|
|
||||||
if (*str == '*') {
|
|
||||||
sprintf(what, "%d:%d,%d:%d",
|
|
||||||
-WORLD_X / 2, WORLD_X / 2 - 1,
|
|
||||||
-WORLD_Y / 2, WORLD_Y / 2 - 1);
|
|
||||||
if (!snxtsct(&ns, what))
|
|
||||||
return RET_FAIL;
|
|
||||||
} else if (!snxtsct(&ns, str))
|
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (!mapbuf)
|
if (!mapbuf)
|
||||||
mapbuf = malloc(WORLD_Y * MAPWIDTH(3));
|
mapbuf = malloc(WORLD_Y * MAPWIDTH(3));
|
||||||
|
|
|
@ -57,8 +57,6 @@ sct(void)
|
||||||
s_char *ptr;
|
s_char *ptr;
|
||||||
coord y, yval;
|
coord y, yval;
|
||||||
int i;
|
int i;
|
||||||
s_char what[64];
|
|
||||||
s_char *str;
|
|
||||||
s_char buf[1024];
|
s_char buf[1024];
|
||||||
/* Note this is not re-entrant anyway, so we keep the buffers
|
/* Note this is not re-entrant anyway, so we keep the buffers
|
||||||
around */
|
around */
|
||||||
|
@ -66,20 +64,7 @@ sct(void)
|
||||||
static s_char **map = NULL;
|
static s_char **map = NULL;
|
||||||
|
|
||||||
nsect = 0;
|
nsect = 0;
|
||||||
if (player->argp[1] == NULL) {
|
if (!snxtsct(&ns, player->argp[1]))
|
||||||
if ((str = getstring("(sects)? ", buf)) == 0)
|
|
||||||
return RET_SYN;
|
|
||||||
} else {
|
|
||||||
str = player->argp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*str == '*') {
|
|
||||||
sprintf(what, "%d:%d,%d:%d",
|
|
||||||
-WORLD_X / 2, WORLD_X / 2 - 1,
|
|
||||||
-WORLD_Y / 2, WORLD_Y / 2 - 1);
|
|
||||||
if (!snxtsct(&ns, what))
|
|
||||||
return RET_FAIL;
|
|
||||||
} else if (!snxtsct(&ns, str))
|
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!mapbuf)
|
if (!mapbuf)
|
||||||
mapbuf = malloc(WORLD_Y * MAPWIDTH(1));
|
mapbuf = malloc(WORLD_Y * MAPWIDTH(1));
|
||||||
|
|
|
@ -65,9 +65,7 @@ surv(void)
|
||||||
struct nscstr cond[NS_NCOND];
|
struct nscstr cond[NS_NCOND];
|
||||||
int ncond;
|
int ncond;
|
||||||
int i;
|
int i;
|
||||||
s_char what[64];
|
|
||||||
s_char buf[1024];
|
s_char buf[1024];
|
||||||
s_char *str;
|
|
||||||
/* Note this is not re-entrant anyway, so we keep the buffers
|
/* Note this is not re-entrant anyway, so we keep the buffers
|
||||||
around */
|
around */
|
||||||
static s_char *mapbuf = NULL;
|
static s_char *mapbuf = NULL;
|
||||||
|
@ -86,19 +84,7 @@ surv(void)
|
||||||
for (; isspace(*ptr); ++ptr) ;
|
for (; isspace(*ptr); ++ptr) ;
|
||||||
if (*ptr)
|
if (*ptr)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (player->argp[2] == NULL) {
|
if (!snxtsct(&nstr, player->argp[2]))
|
||||||
if ((str = getstring("(sects)? ", buf)) == 0)
|
|
||||||
return RET_SYN;
|
|
||||||
} else {
|
|
||||||
str = player->argp[2];
|
|
||||||
}
|
|
||||||
if (*str == '*') {
|
|
||||||
sprintf(what, "%d:%d,%d:%d",
|
|
||||||
-WORLD_X / 2, WORLD_X / 2 - 1,
|
|
||||||
-WORLD_Y / 2, WORLD_Y / 2 - 1);
|
|
||||||
if (!snxtsct(&nstr, what))
|
|
||||||
return RET_FAIL;
|
|
||||||
} else if (!snxtsct(&nstr, str))
|
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!mapbuf)
|
if (!mapbuf)
|
||||||
mapbuf = malloc(WORLD_Y * MAPWIDTH(1));
|
mapbuf = malloc(WORLD_Y * MAPWIDTH(1));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue