ComputerScienceHouse / bingehack

A fork of nethack with semi-multiplayer features and other customizations. (An in-heavy-development fork version is at https://github.com/computersciencehouse/bingehack4 )
http://nethack.csh.rit.edu
23 stars 4 forks source link

Successful Knock Spell Pointed Down Incorrectly Assumes Bear Trap #129

Open clockfort opened 11 years ago

clockfort commented 11 years ago

Knocking open a chest downward produces the message "The bear trap opens. Klick!". This is not at all indicative, as one might think, of a hitherto undiscovered beartrap that you happen to be standing on, but it is instead a bug, as zapupdown in src/zap.c indicates:

        case SPE_KNOCK:
            /* up or down, but at closed portcullis only */
            if (is_db_wall(x,y) && find_drawbridge(&xx, &yy)) {
                open_drawbridge(xx, yy);
                disclose = TRUE;
            } else if (u.dz > 0 && (x == xdnstair && y == ydnstair) &&
                        /* can't use the stairs down to quest level 2 until
                           leader "unlocks" them; give feedback if you try */
                        on_level(&u.uz, &qstart_level) && !ok_to_quest()) {
                pline_The("stairs seem to ripple momentarily.");
                disclose = TRUE;
            } else if (u.utraptype == TT_BEARTRAP) {
                pline_The("bear trap opens.");
                u.utrap = 0;
            }

However, TT_BEARTRAP happens to be 0, which apparently what u.utraptype is set to /even if you're not in a trap/.

... this does not appear to be a problem in NetHack 4, where libnethack/zap.c's zapupdown covers this case as:

    case SPE_KNOCK:
        /* up or down, but at closed portcullis only */
        if (is_db_wall(x, y) && find_drawbridge(&xx, &yy)) {
            open_drawbridge(xx, yy);
            disclose = TRUE;
        } else if (dz > 0 && (x == level->dnstair.sx && y == level->dnstair.sy)
                   &&
                   /* can't use the stairs down to quest level 2 until leader
                      "unlocks" them; give feedback if you try */
                   on_level(&u.uz, &qstart_level) && !ok_to_quest()) {
            pline("The stairs seem to ripple momentarily.");
            disclose = TRUE;
        }