]> granicus.if.org Git - nethack/commitdiff
Prevent infinite loop
authorPasi Kallinen <paxed@alt.org>
Wed, 15 Apr 2015 17:06:38 +0000 (20:06 +0300)
committerPasi Kallinen <paxed@alt.org>
Wed, 15 Apr 2015 17:13:30 +0000 (20:13 +0300)
...if the map is filled with monsters, and for some reason
the drowning just won't kill you.

Infinite looping cannot currently happen, because no-one who
can drown can keep surviving the drowning once their amulet
of life saving is used up.

src/trap.c

index aff2b971954d47f3da2a06364a79696e18dfff0d..037c7325577cc63d45fcbe9c86130f7570870817 100644 (file)
@@ -3470,7 +3470,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);