diff --git a/src/do_name.c b/src/do_name.c index df4eabcf2..f6fe69d57 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -114,8 +114,7 @@ const char *goal; cc.x = cx; cc.y = cy; if (do_screen_description(cc, TRUE, sym, tmpbuf, &firstmatch)) { - /* there may be an encoded glyph */ - putmixed(WIN_MESSAGE, 0, tmpbuf); + pline1(firstmatch); curs(WIN_MAP, cx, cy); flush_screen(0); } diff --git a/src/end.c b/src/end.c index 75726beb8..b4a68f85b 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 end.c $NHDT-Date: 1425319883 2015/03/02 18:11:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.81 $ */ +/* NetHack 3.5 end.c $NHDT-Date: 1429953061 2015/04/25 09:11:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.93 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1604,10 +1604,11 @@ wordcount(p) char *p; { int words = 0; - while(*p){ - while(*p && isspace(*p))p++; - if(*p) words++; - while(*p && !isspace(*p))p++; + + while (*p) { + while (*p && isspace((uchar)*p)) p++; + if (*p) words++; + while (*p && !isspace((uchar)*p)) p++; } return words; } @@ -1619,8 +1620,8 @@ bel_copy1(inp, out) char *in = *inp; out += strlen(out); /* eos() */ - while(*in && isspace(*in)) in++; - while(*in && !isspace(*in)) *out++ = *in++; + while (*in && isspace((uchar)*in)) in++; + while (*in && !isspace((uchar)*in)) *out++ = *in++; *out = '\0'; *inp = in; } diff --git a/src/engrave.c b/src/engrave.c index 5a8aa38f3..a29221549 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -1,11 +1,10 @@ -/* NetHack 3.5 engrave.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 engrave.c $NHDT-Date: 1429953062 2015/04/25 09:11:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.47 $ */ /* NetHack 3.5 engrave.c $Date: 2012/12/20 01:48:36 $ $Revision: 1.39 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" #include "lev.h" -#include STATIC_VAR NEARDATA struct engr *head_engr; @@ -973,10 +972,13 @@ doengrave() /* Prompt for engraving! */ Sprintf(qbuf,"What do you want to %s the %s here?", everb, eloc); getlin(qbuf, ebuf); + /* convert tabs to spaces and condense consecutive spaces to one */ + mungspaces(ebuf); /* Count the actual # of chars engraved not including spaces */ len = strlen(ebuf); - for (sp = ebuf; *sp; sp++) if (isspace(*sp)) len -= 1; + for (sp = ebuf; *sp; sp++) + if (*sp == ' ') len -= 1; if (len == 0 || index(ebuf, '\033')) { if (zapwand) { @@ -997,7 +999,7 @@ doengrave() /* Mix up engraving if surface or state of mind is unsound. Note: this won't add or remove any spaces. */ for (sp = ebuf; *sp; sp++) { - if (isspace(*sp)) continue; + if (*sp == ' ') continue; if (((type == DUST || type == ENGR_BLOOD) && !rn2(25)) || (Blind && !rn2(11)) || (Confusion && !rn2(7)) || (Stunned && !rn2(4)) || (Hallucination && !rn2(2))) @@ -1081,7 +1083,7 @@ doengrave() /* Chop engraving down to size if necessary */ if (len > maxelen) { for (sp = ebuf; (maxelen && *sp); sp++) - if (!isspace(*sp)) maxelen--; + if (*sp == ' ') maxelen--; if (!maxelen && *sp) { *sp = (char)0; if (multi) nomovemsg = "You cannot write any more."; diff --git a/src/files.c b/src/files.c index c3aacb9af..f5457db19 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 files.c $NHDT-Date: 1429675565 2015/04/22 04:06:05 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.169 $ */ +/* NetHack 3.5 files.c $NHDT-Date: 1429953063 2015/04/25 09:11:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.166 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -10,8 +10,6 @@ #include "wintty.h" /* more() */ #endif -#include - #if (!defined(MAC) && !defined(O_WRONLY) && !defined(AZTEC_C)) || defined(USE_FCNTL) #include #endif @@ -2060,9 +2058,9 @@ int prefixid; #define match_varname(INP,NAM,LEN) match_optname(INP, NAM, LEN, TRUE) int -parse_config_line(fp, buf, src) +parse_config_line(fp, origbuf, src) FILE *fp; -char *buf; +char *origbuf; int src; { #if defined(MICRO) && !defined(NOCWD_ASSUMPTIONS) @@ -2071,37 +2069,39 @@ int src; #ifdef SYSCF int n; #endif - char *bufp, *altp; + char *bufp, *altp, buf[BUFSZ]; uchar translate[MAXPCHARS]; int len; - /* lines beginning with '#' are comments */ - if (*buf == '#') - return 1; - /* remove trailing whitespace */ - bufp = eos(buf); - while (--bufp > buf && isspace(*bufp)) - continue; - - if (bufp <= buf) - return 1; /* skip all-blank lines */ - else - *(bufp + 1) = '\0'; /* terminate line */ + /* convert any tab to space, condense consecutive spaces into one, + remove leading and trailing spaces (exception: if there is nothing + but spaces, one of them will be kept even though it leads/trails) */ + mungspaces(strcpy(buf, origbuf)); + /* lines beginning with '#' are comments; accept empty lines too */ + if (!*buf || *buf == '#' || !strcmp(buf, " ")) return 1; /* find the '=' or ':' */ bufp = index(buf, '='); altp = index(buf, ':'); if (!bufp || (altp && altp < bufp)) bufp = altp; if (!bufp) return 0; - - /* skip whitespace between '=' and value */ - do { ++bufp; } while (isspace(*bufp)); + /* skip past '=', then space between it and value, if any */ + ++bufp; + if (*bufp == ' ') ++bufp; /* Go through possible variables */ /* some of these (at least LEVELS and SAVE) should now set the * appropriate fqn_prefix[] rather than specialized variables */ if (match_varname(buf, "OPTIONS", 4)) { + /* hack: un-mungspaces to allow consecutive spaces in + general options until we verify that this is unnecessary; + '=' or ':' is guaranteed to be present */ + bufp = index(origbuf, '='); + altp = index(origbuf, ':'); + if (!bufp || (altp && altp < bufp)) bufp = altp; + ++bufp; /* skip '='; parseoptions() handles spaces */ + parseoptions(bufp, TRUE, TRUE); if (plname[0]) /* If a name was given */ plnamesuffix(); /* set the character class */ @@ -2190,16 +2190,17 @@ int src; } else if (src == SET_IN_SYS && match_varname(buf, "SHELLERS", 8)) { if (sysopt.shellers) free(sysopt.shellers); sysopt.shellers = dupstr(bufp); - } else if (src == SET_IN_SYS && match_varname(buf, "EXPLORERS", 7)) { - if (sysopt.explorers) free(sysopt.explorers); + } else if (src == SET_IN_SYS && match_varname(buf, "EXPLORERS", 7)) { + if (sysopt.explorers) free(sysopt.explorers); sysopt.explorers = dupstr(bufp); } else if (src == SET_IN_SYS && match_varname(buf, "DEBUGFILES", 5)) { - if (sysopt.debugfiles) free(sysopt.debugfiles); /* if showdebug() has already been called (perhaps we've added some debugpline() calls to option processing) and has found a value for getenv("DEBUGFILES"), don't override that */ - if (sysopt.env_dbgfl == 0) - sysopt.debugfiles = dupstr(bufp); + if (sysopt.env_dbgfl == 0) { + if (sysopt.debugfiles) free(sysopt.debugfiles); + sysopt.debugfiles = dupstr(bufp); + } } else if (src == SET_IN_SYS && match_varname(buf, "SUPPORT", 7)) { if (sysopt.support) free(sysopt.support); sysopt.support = dupstr(bufp); @@ -2308,33 +2309,29 @@ int src; } else if (match_varname(buf, "SYMBOLS", 4)) { char *op, symbuf[BUFSZ]; boolean morelines; + do { - morelines = FALSE; - - /* strip leading and trailing white space */ - while (isspace(*bufp)) bufp++; - op = eos(bufp); - while (--op >= bufp && isspace(*op)) *op = '\0'; - /* check for line continuation (trailing '\') */ op = eos(bufp); - if (--op >= bufp && *op == '\\') { + morelines = (--op >= bufp && *op == '\\'); + if (morelines) { *op = '\0'; - morelines = TRUE; /* strip trailing space now that '\' is gone */ - while (--op >= bufp && isspace(*op)) *op = '\0'; + if (--op >= bufp && *op == ' ') *op = '\0'; } /* parse here */ parsesymbols(bufp); - if (morelines) - do { - *symbuf = '\0'; - if (!fgets(symbuf, BUFSZ, fp)) { - morelines = FALSE; - break; - } - bufp = symbuf; - } while (*bufp == '#'); + if (morelines) { + do { + *symbuf = '\0'; + if (!fgets(symbuf, BUFSZ, fp)) { + morelines = FALSE; + break; + } + mungspaces(symbuf); + bufp = symbuf; + } while (*bufp == '#'); + } } while (morelines); switch_symbols(TRUE); } else if (match_varname(buf, "WIZKIT", 6)) { @@ -2355,7 +2352,7 @@ int src; extern int amii_numcolors; int val = atoi( bufp ); amii_numcolors = 1L << min( DEPTH, val ); -#if defined(SYSFLAGS) +# ifdef SYSFLAGS } else if (match_varname(buf, "DRIPENS", 7)) { int i, val; char *t; @@ -2364,7 +2361,7 @@ int src; sscanf(t, "%d", &val ); sysflags.amii_dripens[i] = val; } -#endif +# endif } else if (match_varname(buf, "SCREENMODE", 10 )) { extern long amii_scrnmode; if (!stricmp(bufp,"req")) @@ -2450,7 +2447,7 @@ int src; { sscanf(t, "%d", &backg[i]); } -#endif +#endif /*AMIGA*/ #ifdef USER_SOUNDS } else if (match_varname(buf, "SOUNDDIR", 8)) { sounddir = dupstr(bufp); @@ -2717,46 +2714,36 @@ int which_set; struct symparse *symp = (struct symparse *)0; char *bufp, *commentp, *altp; - if (*buf == '#') + /* convert each instance of whitespace (tabs, consecutive spaces) + into a single space; leading and trailing spaces are stripped */ + mungspaces(buf); + if (!*buf || *buf == '#' || !strcmp(buf, " ")) return 1; - - /* remove trailing comment(s) */ - commentp = eos(buf); - while (--commentp > buf) { - if (*commentp != '#') continue; + /* remove trailing comment, if any */ + if ((commentp = rindex(buf, '#')) != 0) { *commentp = '\0'; + /* remove space preceding the stripped comment, if any; + we know 'commentp > buf' because *buf=='#' was caught above */ + if (commentp[-1] == ' ') *--commentp = '\0'; } - /* remove trailing whitespace */ - bufp = eos(buf); - while (--bufp > buf && isspace(*bufp)) - continue; - - if (bufp <= buf) - return 1; /* skip all-blank lines */ - else - *(bufp + 1) = '\0'; /* terminate line */ - - /* skip leading whitespace on option name */ - while (isspace(*buf)) ++buf; - /* find the '=' or ':' */ bufp = index(buf, '='); altp = index(buf, ':'); if (!bufp || (altp && altp < bufp)) bufp = altp; if (!bufp) { if (strncmpi(buf, "finish", 6) == 0) { - /* end current graphics set */ - if (chosen_symset_start) - chosen_symset_end = TRUE; - chosen_symset_start = FALSE; - return 1; + /* end current graphics set */ + if (chosen_symset_start) + chosen_symset_end = TRUE; + chosen_symset_start = FALSE; + return 1; } return 0; } - - /* skip whitespace between '=' and value */ - do { ++bufp; } while (isspace(*bufp)); + /* skip '=' and space which follows, if any */ + ++bufp; + if (*bufp == ' ') ++bufp; symp = match_sym(buf); if (!symp) @@ -2829,17 +2816,19 @@ int which_set; case 0: /* start of symset */ if (!strcmpi(bufp, symset[which_set].name)) { - /* matches desired one */ - chosen_symset_start = TRUE; - /* these init_*() functions clear symset fields too */ - if (which_set == ROGUESET) init_r_symbols(); - else if (which_set == PRIMARY) init_l_symbols(); + /* matches desired one */ + chosen_symset_start = TRUE; + /* these init_*() functions clear symset fields too */ + if (which_set == ROGUESET) + init_r_symbols(); + else if (which_set == PRIMARY) + init_l_symbols(); } break; case 1: /* finish symset */ if (chosen_symset_start) - chosen_symset_end = TRUE; + chosen_symset_end = TRUE; chosen_symset_start = FALSE; break; case 2: @@ -2851,14 +2840,14 @@ int which_set; case 4: /* color:off */ if (chosen_symset_start) { if (bufp) { - if (!strcmpi(bufp, "true") || - !strcmpi(bufp, "yes") || - !strcmpi(bufp, "on")) - symset[which_set].nocolor = 0; + if (!strcmpi(bufp, "true") || + !strcmpi(bufp, "yes") || + !strcmpi(bufp, "on")) + symset[which_set].nocolor = 0; else if (!strcmpi(bufp, "false") || - !strcmpi(bufp, "no") || - !strcmpi(bufp, "off")) - symset[which_set].nocolor = 1; + !strcmpi(bufp, "no") || + !strcmpi(bufp, "off")) + symset[which_set].nocolor = 1; } } break; @@ -2866,17 +2855,17 @@ int which_set; if (chosen_symset_start) { int n = 0; while (known_restrictions[n]) { - if (!strcmpi(known_restrictions[n], bufp)) { - switch(n) { - case 0: symset[which_set].primary = 1; - break; - case 1: symset[which_set].rogue = 1; - break; - } - break; /* while loop */ - } - n++; - } + if (!strcmpi(known_restrictions[n], bufp)) { + switch(n) { + case 0: symset[which_set].primary = 1; + break; + case 1: symset[which_set].rogue = 1; + break; + } + break; /* while loop */ + } + n++; + } } break; } diff --git a/src/hacklib.c b/src/hacklib.c index 6f10e5bf7..93eab1f93 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 hacklib.c $NHDT-Date: 1428806394 2015/04/12 02:39:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */ +/* NetHack 3.5 hacklib.c $NHDT-Date: 1429953063 2015/04/25 09:11:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */ /* NetHack 3.5 hacklib.c $Date: 2009/05/06 10:46:32 $ $Revision: 1.23 $ */ /* SCCS Id: @(#)hacklib.c 3.5 2007/04/30 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ @@ -135,6 +135,7 @@ char *bp; boolean was_space = TRUE; for (p = p2 = bp; (c = *p) != '\0'; p++) { + if (c == '\n') break; /* treat newline the same as end-of-string */ if (c == '\t') c = ' '; if (c != ' ' || !was_space) *p2++ = c; was_space = (c == ' '); diff --git a/src/mklev.c b/src/mklev.c index b7cfc8e90..94fc94baa 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -342,18 +342,30 @@ register struct mkroom *aroom; { register struct mkroom *broom; register int tmp; + int i; + + if (aroom->doorct == 0) + aroom->fdoor = doorindex; aroom->doorct++; - broom = aroom+1; - if(broom->hx < 0) - tmp = doorindex; - else - for(tmp = doorindex; tmp > broom->fdoor; tmp--) - doors[tmp] = doors[tmp-1]; + + for (tmp = doorindex; tmp > aroom->fdoor; tmp--) + doors[tmp] = doors[tmp - 1]; + + for (i = 0; i < nroom; i++) { + broom = &rooms[i]; + if (broom != aroom && broom->doorct && broom->fdoor >= aroom->fdoor) + broom->fdoor++; + } + for (i = 0; i < nsubroom; i++) { + broom = &subrooms[i]; + if (broom != aroom && broom->doorct && broom->fdoor >= aroom->fdoor) + broom->fdoor++; + } + doorindex++; - doors[tmp].x = x; - doors[tmp].y = y; - for( ; broom->hx >= 0; broom++) broom->fdoor++; + doors[aroom->fdoor].x = x; + doors[aroom->fdoor].y = y; } STATIC_OVL void diff --git a/src/options.c b/src/options.c index 1b5c6bca0..ccf0f9e17 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 options.c $NHDT-Date: 1429675568 2015/04/22 04:06:08 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.187 $ */ +/* NetHack 3.5 options.c $NHDT-Date: 1429953065 2015/04/25 09:11:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.186 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -543,7 +543,7 @@ boolean val_allowed; *q = index(user_string, '='); if (!p || (q && q < p)) p = q; - while(p && p > user_string && isspace(*(p-1))) p--; + while (p && p > user_string && isspace((uchar)*(p-1))) p--; if (p) len = (int)(p - user_string); } @@ -1175,7 +1175,7 @@ char *str; tmps = cs; tmps++; - while (*tmps && isspace(*tmps)) tmps++; + while (*tmps && isspace((uchar)*tmps)) tmps++; for (i = 0; i < SIZE(colornames); i++) if (strstri(tmps, colornames[i].name) == tmps) { @@ -1190,7 +1190,7 @@ char *str; tmps = strchr(str, '&'); if (tmps) { tmps++; - while (*tmps && isspace(*tmps)) tmps++; + while (*tmps && isspace((uchar)*tmps)) tmps++; for (i = 0; i < SIZE(attrnames); i++) if (strstri(tmps, attrnames[i].name) == tmps) { a = attrnames[i].attr; @@ -1204,7 +1204,7 @@ char *str; tmps = str; if ((*tmps == '"') || (*tmps == '\'')) { cs--; - while (isspace(*cs)) cs--; + while (isspace((uchar)*cs)) cs--; if (*cs == *tmps) { *cs = '\0'; tmps++; @@ -1280,9 +1280,9 @@ boolean tinitial, tfrom_file; } /* strip leading and trailing white space */ - while (isspace(*opts)) opts++; + while (isspace((uchar)*opts)) opts++; op = eos(opts); - while (--op >= opts && isspace(*op)) *op = '\0'; + while (--op >= opts && isspace((uchar)*op)) *op = '\0'; if (!*opts) return; negated = FALSE; @@ -4114,8 +4114,7 @@ const char *mapping; ape->pattern = (char *) alloc(textsize+1); Strcpy(ape->pattern, text2); ape->grab = grab; - if (!*apehead) ape->next = (struct autopickup_exception *)0; - else ape->next = *apehead; + ape->next = *apehead; *apehead = ape; } else { raw_print("syntax error in AUTOPICKUP_EXCEPTION"); @@ -4206,7 +4205,7 @@ parsesymbols(opts) register char *opts; { int val; - char *op, *symname, *strval, *p; + char *op, *symname, *strval; struct symparse *symp; if ((op = index(opts, ',')) != 0) { @@ -4217,18 +4216,13 @@ register char *opts; /* S_sample:string */ symname = opts; strval = index(opts, ':'); - if (!symname || !strval) return; - *strval++ = 0; + if (!strval) strval = index(opts, '='); + if (!strval) return; + *strval++ = '\0'; - /* strip leading and trailing white space from symname */ - while (isspace(*symname)) symname++; - p = eos(symname); - while (--p >= symname && isspace(*p)) *p = '\0'; - - /* strip leading and trailing white space from strval */ - while (isspace(*strval)) strval++; - p = eos(strval); - while (--p >= strval && isspace(*p)) *p = '\0'; + /* strip leading and trailing white space from symname and strval */ + mungspaces(symname); + mungspaces(strval); symp = match_sym(symname); if (!symp) return; @@ -4249,8 +4243,12 @@ char *buf; struct symparse *sp = loadsyms; if (!p || (q && q < p)) p = q; - while(p && p > buf && isspace(*(p-1))) p--; - if (p) len = (int)(p - buf); + if (p) { + /* note: there will be at most one space before the '=' + because caller has condensed buf[] with mungspaces() */ + if (p > buf && p[-1] == ' ') p--; + len = (int)(p - buf); + } while(sp->range) { if ((len >= strlen(sp->name)) && !strncmpi(buf, sp->name, len)) return sp; @@ -4423,7 +4421,7 @@ struct fruit *replace_fruit; for(c = pl_fruit; *c >= '0' && *c <= '9'; c++) ; - if (isspace(*c) || *c == 0) numeric = TRUE; + if (isspace((uchar)*c) || *c == 0) numeric = TRUE; } if (found || numeric || !strncmp(str, "cursed ", 7) || @@ -4846,34 +4844,34 @@ char *op; wn = tfg = tbg = (char *)0; /* until first non-space in case there's leading spaces - before colorname*/ - while(*newop && isspace(*newop)) newop++; + if (*newop == ' ') newop++; if (*newop) wn = newop; else return 0; /* until first space - colorname*/ - while(*newop && !isspace(*newop)) newop++; + while (*newop && *newop != ' ') newop++; if (*newop) *newop = '\0'; else return 0; newop++; /* until first non-space - before foreground*/ - while(*newop && isspace(*newop)) newop++; + if (*newop == ' ') newop++; if (*newop) tfg = newop; else return 0; /* until slash - foreground */ - while(*newop && *newop != '/') newop++; + while (*newop && *newop != '/') newop++; if (*newop) *newop = '\0'; else return 0; newop++; /* until first non-space (in case there's leading space after slash) - before background */ - while(*newop && isspace(*newop)) newop++; + if (*newop == ' ') newop++; if (*newop) tbg = newop; else return 0; /* until first space - background */ - while(*newop && !isspace(*newop)) newop++; + while (*newop && *newop != ' ') newop++; if (*newop) *newop++ = '\0'; for (j = 0; j < 4; ++j) { diff --git a/src/shk.c b/src/shk.c index 7d9e2d97b..b4cb0be65 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1348,6 +1348,7 @@ proceed: /* now check items on bill */ if (eshkp->billct) { register boolean itemize; + int iprompt; umoney = money_cnt(invent); if (!umoney && !eshkp->credit) { You("%shave no money or credit%s.", @@ -1365,7 +1366,9 @@ proceed: /* this isn't quite right; it itemizes without asking if the * single item on the bill is partly used up and partly unpaid */ - itemize = (eshkp->billct > 1 ? yn("Itemized billing?") == 'y' : 1); + iprompt = (eshkp->billct > 1 ? ynq("Itemized billing?") : 'y'); + itemize = (iprompt == 'y'); + if (iprompt == 'q') goto thanks; for (pass = 0; pass <= 1; pass++) { tmp = 0; diff --git a/src/zap.c b/src/zap.c index 309c6cef6..a2a238dc4 100644 --- a/src/zap.c +++ b/src/zap.c @@ -3748,7 +3748,7 @@ register int dx,dy; unmap_object(sx, sy); newsym(sx, sy); } - if(ZAP_POS(lev->typ) || cansee(lsx,lsy)) + if(ZAP_POS(lev->typ) || (isok(lsx,lsy) && cansee(lsx,lsy))) tmp_at(sx,sy); delay_output(); /* wait a little */ }