Unofficial Oangband release

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Spacebux
    Adept
    • Apr 2009
    • 231

    #91
    Picking up gold while blinded or with the lights off.

    Okay - I think I have tracked this down, but due to lack of ability on the poster's part to recompile 110u (bunch of unknown reference errors in the linker section), I cannot verify 100% that this is the fix to the problem of picking up $ while blinded or having the lights out.

    I confirmed this bug by taking a warrior and finding a good magma vein with * in it. Turn off the lights so you are fulfilling the blind booling value in cmd1.c's py_pickup{} function.

    The bug comes when the code enters the first for loop---to collect all treasure in a given floor square, prior to sorting the remaining items in the object list (*o_list).

    /* Pick up all the ordinary gold objects */
    for (this_o_idx = cave_o_idx[py][px]; this_o_idx; this_o_idx = next_o_idx)
    {
    /* Get the object */
    o_ptr = &o_list[this_o_idx];

    /* Get the next object */
    next_o_idx = o_ptr->next_o_idx;

    /* Ignore all hidden objects */
    if (!o_ptr->marked) continue;


    /* Ignore if not ordinary treasure */
    if ((o_ptr->tval != TV_GOLD) ||
    (o_ptr->sval >= MONEY_TYPES)) continue;

    /* Note that we have this kind of treasure */
    treasure[o_ptr->sval]++;

    /* Increment total value */
    total_gold += (s32b)o_ptr->pval;

    /* Delete the gold */
    delete_object_idx(this_o_idx);
    }


    I keep thinking this check to see if an object in the floor space is "marked" or not is irrelevent when collecting treasure in the first phase of parsing the object list of a floor space. Treasure is treasure - no need to check to see if it is marked. Indeed, since the player is "blinded" when attempting to pick up the treasure, the treasure passes the "marked" test and "continues" the for loop, not placing the $ treasure item into the total_gold integer. This causes the bug when the pickup command continues on later, and attempts to place the $ in a player's inventory.

    My suggestion, my theory is to remove the check from the for loop. Treasure needs to be found by this for loop regardless of whether it's hidden from site by the o_ptr->marked flag.

    Now - could someone recompile and test it out for me??

    --Spacebux--

    Comment

    • Spacebux
      Adept
      • Apr 2009
      • 231

      #92
      Test checked, bug squashed, verified.

      Tested---yes, it does work.

      Comment out that check, and the bug is fixed.

      In cmd1.c, in the function byte py_pickup(int pickup)
      {


      comment out the line

      " if (!o_ptr->marked) continue;"

      in the first for loop.

      Recompile, enjoy the safety of being blinded and earning money at the same time.



      (Thanks to my buddy for helping me get out of the compiler errors.)


      --Spacebux--

      Comment

      • BlackKnight
        Rookie
        • Apr 2009
        • 2

        #93
        Follow up on TV_GOLD items in inventory bug

        I think in addition to the solution proposed by Spacebux above, the following line in a later for block should be uncommented as well:

        /* Ignore all hidden objects */
        //if (squelch_hide_item(o_ptr) || !o_ptr->marked) continue;
        if (squelch_hide_item(o_ptr)) continue;

        It looks as though these conditions were split. The marked check was moved up to the earlier processing pass which processes money objects and introduces the bug while squelched objects are handled in this later pass.

        If the intention is to prevent picking up unmarked objects, the combined check should be reenabled here instead -- ignoring both squelched and unmarked items after processing and removing money objects.

        Comment

        • Nick
          Vanilla maintainer
          • Apr 2007
          • 9634

          #94
          Nice work guys - I love it when people actually find the bugs. I'll add that fix when I next do an update for 110u.
          One for the Dark Lord on his dark throne
          In the Land of Mordor where the Shadows lie.

          Comment

          • Spacebux
            Adept
            • Apr 2009
            • 231

            #95
            Additional discussion..

            I'm not quite sure why the code was there originally. It also seems part of the older 110 code, circa 2006... has this been a bug for that long, or has the auto-pickup routine evolved over time?

            It seems like flawed logic in the for loop to check whether treasure is "hidden" (i.e., o_ptr->marked == FALSE) or not at that point. The flow of the pickup command needs to make sure all treasure is removed from a given floor space before it proceeds to the other sections of the pickup function.

            The whole reason you see the bug now is because the item gold, copper, sapphires, whatever treasure the player is attempting to pickup while blinded or in_the_dark, has its object attribute "marked" set to FALSE. The for-loop that is supposed to filter out treasure items from the remaining pickup procedures has not been doing so. The subsequent procedures are not checking to see if "hidden" items are treasure, making the assumption that remaining *o_list object list items are all non-treasure items that can be either wielded or put into inventory.

            And, that's when the bug comes up, and places copper or emeralds into a user's inventory... beginning with slot (a) because the pickup code does not know how to better handle it.

            I'm not sure what the original intent was, but simply taking out the check to see whether treasure is hidden or not solves the bug, completely, easily.


            As a player, when one digs a vein in the dark -
            "You have found something!" - is the message when something is discovered.
            "You feel copper." - the code, in cave.c I believe, describes what is felt to the character when s/he steps onto a dark / blind square. In it's current state, the code does not tell the user "You feel something."
            To me, this seems as though the code & player know there is a treasure type item sitting there in the dark. If so, it seems reasonable to just permit the player to put said treasure item into the total AU column and be done with it.

            If the discovery of the actual item is meant to be hidden, on purpose, then the remaining py_pickup {} procedures need to test an item's flags for treasure types prior to attempting to place them into inventory or wielded slots. So, that would be the other, lengthier solution to this bug.

            "You have copper (a)." ... Doh!

            --Spacebux--

            Comment

            • Nick
              Vanilla maintainer
              • Apr 2007
              • 9634

              #96
              Originally posted by Spacebux
              I'm not quite sure why the code was there originally. It also seems part of the older 110 code, circa 2006... has this been a bug for that long, or has the auto-pickup routine evolved over time?
              110 was the last official release of O. It included changes to the way treasure was handled; I didn't touch those in the unofficial release, because I was chiefly adding
              • UI updates and
              • bugfixes for bugs I'd found in FA, which forked from O at 070.
              One for the Dark Lord on his dark throne
              In the Land of Mordor where the Shadows lie.

              Comment

              • Fly
                Rookie
                • May 2009
                • 2

                #97
                So, I've come back to angband after a few years of hiatus.

                I decided to try oangband again, so I downloaded and installed the latest version.

                But what the hell is this?



                I am the bottom @. If I look at the top @, it says "you are on an open floor"

                There was another @ on the town, but I ignored it.

                What the hell are those things?

                heeeelp

                Comment

                • Nick
                  Vanilla maintainer
                  • Apr 2007
                  • 9634

                  #98
                  Originally posted by Fly
                  I am the bottom @. If I look at the top @, it says "you are on an open floor"

                  There was another @ on the town, but I ignored it.
                  It is probably caused by the player being placed twice (I've had a bug like that before in FA), although I can't see why that would be happening. Quitting and reopening the game should fix it.
                  One for the Dark Lord on his dark throne
                  In the Land of Mordor where the Shadows lie.

                  Comment

                  • Fly
                    Rookie
                    • May 2009
                    • 2

                    #99
                    Oh. Thanks.

                    Comment

                    • skein
                      Rookie
                      • Mar 2009
                      • 4

                      found another bug

                      Was wearing an unidentified set of leather gloves of agility and it decreased my mana pool. Unless that is an intentional change? as far as i remember free action and anything that adds to dx is supposed to not restrict mana identified or not.

                      Slightly annoying since I sold it to the store and wore it just to check to see if it was a good one first :P

                      Comment

                      • Nick
                        Vanilla maintainer
                        • Apr 2007
                        • 9634

                        Originally posted by skein
                        Was wearing an unidentified set of leather gloves of agility and it decreased my mana pool. Unless that is an intentional change? as far as i remember free action and anything that adds to dx is supposed to not restrict mana identified or not.
                        That's the case in V, but it's different in O. Gloves of Free Action or Magic Mastery are wearable by INT-based casters without penalty, but others (including Agility) aren't.
                        One for the Dark Lord on his dark throne
                        In the Land of Mordor where the Shadows lie.

                        Comment

                        • latro
                          Rookie
                          • Jan 2009
                          • 4

                          re: blindness bug

                          Just wanted to say a big thanks to spacebux & co. for sorting this bug out. This motivated me to finally figure out how to compile (had to adjust os version in the makefile to fix linking issues.) Never had so much fun being blind before!

                          Comment

                          Working...
                          😀
                          😂
                          🥰
                          😘
                          🤢
                          😎
                          😞
                          😡
                          👍
                          👎