diff --git a/src/display.c b/src/display.c index 1369fbfb3..399bb1842 100644 --- a/src/display.c +++ b/src/display.c @@ -900,6 +900,7 @@ tmp_at(x, y) break; default: /* do it */ + if (!isok(x,y)) break; if (tglyph->style == DISP_BEAM || tglyph->style == DISP_ALL) { if (tglyph->style != DISP_ALL && !cansee(x,y)) break; if (tglyph->sidx >= TMP_AT_MAX_GLYPHS) break; /* too many locations */ diff --git a/src/hacklib.c b/src/hacklib.c index e0806027f..4788f2d08 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -783,6 +783,7 @@ time_t date; Sprintf(datestr, "%04ld%02d%02d%02d%02d%02d", datenum, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec); + debugpline1("yyyymmddhhmmss() produced date string %s", datestr); return(datestr); } @@ -791,6 +792,7 @@ time_from_yyyymmddhhmmss(buf) char *buf; { int k; + time_t timeresult; struct tm t, *lt; char *g, *p, y[5],mo[3],md[3],h[3],mi[3],s[3]; if (buf && strlen(buf) == 14) { @@ -828,8 +830,13 @@ char *buf; t.tm_hour = atoi(h); t.tm_min = atoi(mi); t.tm_sec = atoi(s); - return mktime(&t); + timeresult = mktime(&t); } + if ((int)timeresult == -1) + debugpline1("time_from_yyyymmddhhmmss(%s) would have returned -1", + buf ? buf : ""); + else + return timeresult; } return (time_t)0; } diff --git a/src/lock.c b/src/lock.c index c29be8549..26abde26a 100644 --- a/src/lock.c +++ b/src/lock.c @@ -692,6 +692,8 @@ doclose() /* try to close a door */ return(1); } + if (!isok(x,y)) goto nodoor; + if ((mtmp = m_at(x,y)) && mtmp->m_ap_type == M_AP_FURNITURE && (mtmp->mappearance == S_hcdoor || @@ -723,8 +725,10 @@ doclose() /* try to close a door */ pline_The("drawbridge is already closed."); else if (portcullis || door->typ == DRAWBRIDGE_DOWN) There("is no obvious way to close the drawbridge."); - else + else { +nodoor: You("%s no door there.", Blind ? "feel" : "see"); + } return res; } diff --git a/src/mthrowu.c b/src/mthrowu.c index e61814321..1ff6cddc3 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -440,7 +440,7 @@ struct obj *obj; /* missile (or stack providing it) */ tmp_at(bhitpos.x, bhitpos.y); delay_output(); } - tmp_at(bhitpos.x, bhitpos.y); + if (isok(bhitpos.x, bhitpos.y)) tmp_at(bhitpos.x, bhitpos.y); delay_output(); tmp_at(DISP_END, 0); diff --git a/src/pickup.c b/src/pickup.c index dda7d3a1f..b99df91b3 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -707,7 +707,7 @@ menu_item **pick_list; /* return list of items picked */ int how; /* type of query */ boolean FDECL((*allow), (OBJ_P));/* allow function */ { - int i, n; + int i, n, actualn; winid win; struct obj *curr, *last, fake_hero_object; struct obj **oarray; @@ -726,7 +726,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */ last = curr; n++; } - + actualn = n; if (engulfer) { ++n; /* don't autoselect swallowed hero if it's the only choice */ @@ -743,7 +743,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */ return 1; } - oarray = objarr_init(n); + oarray = objarr_init(actualn); /* Add objects to the array */ i = 0; for (curr = olist; curr; curr = FOLLOW(curr, qflags)) { @@ -766,7 +766,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */ pack = flags.inv_order; do { printed_type_name = FALSE; - for (i = 0; i < n; i++) { + for (i = 0; i < actualn; i++) { curr = oarray[i]; if ((qflags & FEEL_COCKATRICE) && curr->otyp == CORPSE && will_feel_cockatrice(curr, FALSE)) { diff --git a/src/polyself.c b/src/polyself.c index 023b1f44a..df78a3bc4 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -300,7 +300,7 @@ newman() enmax = rounddiv((long)enmax * (long)rn1(4, 8), 10); for (i = 0; (u.ulevel = i) < newlvl; i++) enmax += newpw(); if (enmax < u.ulevel) enmax = u.ulevel; - u.uen = rounddiv((long)u.uen * (long)enmax, u.uenmax); + u.uen = rounddiv((long)u.uen * (long)enmax, ((u.uenmax < 1) ? 1 : u.uenmax)); u.uenmax = enmax; /* [should alignment record be tweaked too?] */ diff --git a/src/trap.c b/src/trap.c index 6f894ce5a..aec6256bc 100644 --- a/src/trap.c +++ b/src/trap.c @@ -3469,7 +3469,7 @@ drown() } u.uinwater = 1; You("drown."); - for (;;) { + for (i = 0; i < 5; i++) { /* arbitrary number of loops */ /* killer format and name are reconstructed every iteration because lifesaving resets them */ pool_of_water = waterbody_name(u.ux, u.uy);