]> granicus.if.org Git - nethack/commitdiff
B14001 - Stinking clouds in bonesfiles
authorcohrs <cohrs>
Wed, 16 Oct 2002 06:30:36 +0000 (06:30 +0000)
committercohrs <cohrs>
Wed, 16 Oct 2002 06:30:36 +0000 (06:30 +0000)
Incorporate a fix from <Someone> 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.

doc/fixes34.1
include/extern.h
src/do.c
src/dothrow.c
src/region.c
src/restore.c
src/teleport.c

index 12e960f40fffda79c5977f08649748f45047d642..972840fb69640fac8af503b5166788ee296895ee 100644 (file)
@@ -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
index 29eb493568df2805e564d3ad9820cf9aea0bdb76..21f519b0e9e955626921399143f8fd5a77143f9f 100644 (file)
@@ -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 ### */
index 95fc8d5ce1248e6c66cd208296f570dfb5d47cda..72a14043ead906813a2762ab089a0ee6146c0e17 100644 (file)
--- 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);
 }
 
index 391e606cb5caeb0590da7347dd754b205af152e8..755e0f79430e53617bbebdabdd6b4e678b676a85 100644 (file)
@@ -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))) {
index 3e0d63fe9d25f139bf722a68ce674bd07254aa54..f1a95e1a173a3a22ed30fa2437209c3053d702f2 100644 (file)
@@ -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) &regions[i]->leave_f, sizeof (short));
        mread(fd, (genericptr_t) &regions[i]->inside_f, sizeof (short));
        mread(fd, (genericptr_t) &regions[i]->player_inside, sizeof (boolean));
+       if (ghostly) regions[i]->player_inside = FALSE; /* old player */
        mread(fd, (genericptr_t) &regions[i]->n_monst, sizeof (short));
        if (regions[i]->n_monst > 0)
            regions[i]->monsters =
index e044f0bee44d2bd4ea592fdf7661114550d92048..ea709661264abb048af9146ffa0d1003f4ea6e21 100644 (file)
@@ -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;
index 4b48ae7fa5f0f08d52d62916b2f6dde480bba735..af1dc7aec28224c9bb1daedbab3c825237fa6ad8 100644 (file)
@@ -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;
 }