Factor snxtsct_use_condarg() out of snxtsct()
This commit is contained in:
parent
84072cff5d
commit
7de511fb66
2 changed files with 19 additions and 8 deletions
|
@ -312,6 +312,7 @@ extern void snxtsct_area(struct nstr_sect *, struct range *);
|
||||||
extern void snxtsct_all(struct nstr_sect *);
|
extern void snxtsct_all(struct nstr_sect *);
|
||||||
extern void snxtsct_rewind(struct nstr_sect *);
|
extern void snxtsct_rewind(struct nstr_sect *);
|
||||||
extern void snxtsct_dist(struct nstr_sect *, coord, coord, int);
|
extern void snxtsct_dist(struct nstr_sect *, coord, coord, int);
|
||||||
|
extern int snxtsct_use_condarg(struct nstr_sect *);
|
||||||
/* src/lib/subs/nstr.c */
|
/* src/lib/subs/nstr.c */
|
||||||
extern int nstr_comp(struct nscstr *np, int len, int type, char *str);
|
extern int nstr_comp(struct nscstr *np, int len, int type, char *str);
|
||||||
extern char *nstr_comp_val(char *, struct valstr *, int);
|
extern char *nstr_comp_val(char *, struct valstr *, int);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Dave Pare, 1989
|
* Dave Pare, 1989
|
||||||
* Markus Armbruster, 2006-2009
|
* Markus Armbruster, 2006-2011
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -57,7 +57,7 @@ snxtsct(struct nstr_sect *np, char *str)
|
||||||
struct range range;
|
struct range range;
|
||||||
struct natstr *natp;
|
struct natstr *natp;
|
||||||
coord cx, cy;
|
coord cx, cy;
|
||||||
int dist, n;
|
int dist;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
if (!str || !*str) {
|
if (!str || !*str) {
|
||||||
|
@ -91,12 +91,7 @@ snxtsct(struct nstr_sect *np, char *str)
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!player->condarg)
|
return snxtsct_use_condarg(np);
|
||||||
return 1;
|
|
||||||
n = nstr_comp(np->cond, sizeof(np->cond) / sizeof(*np->cond),
|
|
||||||
EF_SECTOR, player->condarg);
|
|
||||||
np->ncond = n >= 0 ? n : 0;
|
|
||||||
return n >= 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -125,6 +120,21 @@ snxtsct_area(struct nstr_sect *np, struct range *range)
|
||||||
np->dy = 0;
|
np->dy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
snxtsct_use_condarg(struct nstr_sect *np)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
|
if (!player->condarg)
|
||||||
|
return 1;
|
||||||
|
n = nstr_comp(np->cond, sizeof(np->cond) / sizeof(*np->cond),
|
||||||
|
EF_SECTOR, player->condarg);
|
||||||
|
if (n < 0)
|
||||||
|
return 0;
|
||||||
|
np->ncond = n;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
snxtsct_rewind(struct nstr_sect *np)
|
snxtsct_rewind(struct nstr_sect *np)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue