From: cohrs Date: Wed, 16 Oct 2002 06:30:36 +0000 (+0000) Subject: B14001 - Stinking clouds in bonesfiles X-Git-Tag: MOVE2GIT~2365 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cb38d0882d71702439dcecd81f97838f39be4a96;p=nethack B14001 - Stinking clouds in bonesfiles Incorporate a fix from that resets the timestamp on stinking clouds left in bones files. This does allow the cloud's ttl to restart. Extended it to reset the player_inside flag. Then noticed that the only placed that called in_out_region was domove(). Added calls when changing levels (which causes player_inside to be set correctly if the cloud covers the location where the player starts on the bones level), teleporting, and inside hurtle_step. There are still other places that fail to call in_out_region, which others may choose to tackle. I split out the remaining stinking cloud bug reported in the same e-mail into a separate betabug. That one probably cannot be addressed without changing the level file format to track the creator. --- diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 12e960f40..972840fb6 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -281,6 +281,8 @@ destroy traps that are buried by boulders dropped in water renamed debug commands: light sources -> lightsources, monpoly_control -> monpolycontrol detect attempt to swap places with big pet through narrow opening +stinking clouds in bones files do not get their ttl set reasonably +stinking clouds in bones files may incorrectly set player_inside Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 29eb49356..21f519b0e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1638,7 +1638,7 @@ E void FDECL(update_monster_region, (struct monst *)); E NhRegion *FDECL(visible_region_at, (XCHAR_P,XCHAR_P)); E void FDECL(show_region, (NhRegion*, XCHAR_P, XCHAR_P)); E void FDECL(save_regions, (int,int)); -E void FDECL(rest_regions, (int)); +E void FDECL(rest_regions, (int,BOOLEAN_P)); E NhRegion* FDECL(create_gas_cloud, (XCHAR_P, XCHAR_P, int, int)); /* ### restore.c ### */ diff --git a/src/do.c b/src/do.c index 95fc8d5ce..72a14043e 100644 --- a/src/do.c +++ b/src/do.c @@ -1317,6 +1317,8 @@ boolean at_stairs, falling, portal; save_currentstate(); #endif + /* assume this will always return TRUE when changing level */ + (void) in_out_region(u.ux, u.uy); (void) pickup(1); } diff --git a/src/dothrow.c b/src/dothrow.c index 391e606cb..755e0f794 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -437,6 +437,8 @@ hurtle_step(arg, x, y) if (!isok(x,y)) { You_feel("the spirits holding you back."); return FALSE; + } else if (!in_out_region(x, y)) { + return FALSE; } if (!Passes_walls || !(may_pass = may_passwall(x, y))) { diff --git a/src/region.c b/src/region.c index 3e0d63fe9..f1a95e1a1 100644 --- a/src/region.c +++ b/src/region.c @@ -657,8 +657,9 @@ skip_lots: } void -rest_regions(fd) +rest_regions(fd, ghostly) int fd; +boolean ghostly; /* If a bones file restore */ { int i, j; unsigned n; @@ -667,7 +668,8 @@ int fd; clear_regions(); /* Just for security */ mread(fd, (genericptr_t) &tmstamp, sizeof (tmstamp)); - tmstamp = (moves - tmstamp); + if (ghostly) tmstamp = 0; + else tmstamp = (moves - tmstamp); mread(fd, (genericptr_t) &n_regions, sizeof (n_regions)); max_regions = n_regions; if (n_regions > 0) @@ -715,6 +717,7 @@ int fd; mread(fd, (genericptr_t) ®ions[i]->leave_f, sizeof (short)); mread(fd, (genericptr_t) ®ions[i]->inside_f, sizeof (short)); mread(fd, (genericptr_t) ®ions[i]->player_inside, sizeof (boolean)); + if (ghostly) regions[i]->player_inside = FALSE; /* old player */ mread(fd, (genericptr_t) ®ions[i]->n_monst, sizeof (short)); if (regions[i]->n_monst > 0) regions[i]->monsters = diff --git a/src/restore.c b/src/restore.c index e044f0bee..ea7096612 100644 --- a/src/restore.c +++ b/src/restore.c @@ -839,7 +839,7 @@ boolean ghostly; } restdamage(fd, ghostly); - rest_regions(fd); + rest_regions(fd, ghostly); if (ghostly) { /* Now get rid of all the temp fruits... */ freefruitchn(oldfruit), oldfruit = 0; diff --git a/src/teleport.c b/src/teleport.c index 4b48ae7fa..af1dc7aec 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -207,6 +207,7 @@ boolean trapok; if (!trapok && t_at(x, y)) return FALSE; if (!goodpos(x, y, &youmonst)) return FALSE; if (!tele_jump_ok(u.ux, u.uy, x, y)) return FALSE; + if (!in_out_region(x, y)) return FALSE; return TRUE; }