Schrödinger's bug

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nick
    Vanilla maintainer
    • Apr 2007
    • 9647

    Schrödinger's bug

    So (fingers crossed) I am now back to some sort of regular development work, and my first task is to try and finish tracking down this bug:

    Originally posted by Ingwe Ingweron
    Bug: Items previously found and ignored being redisplayed as unknown objects after another treasure detection within their range. Note the two red asterisks to @'s left. These were previously ignored objects, but now show again after use of treasure detection.
    I have identified that the problem is player knowledge of objects being wiped on closing and reopening the game. So I thought I would track down where the loss of information was happening by running in gdb and watching the appropriate known object. Result? The object I was watching remained known, but all others still disappeared.

    While I'm slightly flattered by how important the game obviously considers me, it doesn't help fix the bug. Any suggestions? I think optimisation is already set to 0 (unless something is overriding what's in src/Makefile).
    One for the Dark Lord on his dark throne
    In the Land of Mordor where the Shadows lie.
  • debo
    Veteran
    • Oct 2011
    • 2402

    #2
    Originally posted by Nick
    Any suggestions?
    Remove the ID game and monster knowledge and have everything known to the player from when they start the game?
    Glaurung, Father of the Dragons says, 'You cannot avoid the ballyhack.'

    Comment

    • Nick
      Vanilla maintainer
      • Apr 2007
      • 9647

      #3
      Originally posted by debo
      Remove the ID game and monster knowledge and have everything known to the player from when they start the game?
      Wouldn't help - this is whether the player remembers that individual found items on the current level even exist.

      Your attempt to help is noted.
      One for the Dark Lord on his dark throne
      In the Land of Mordor where the Shadows lie.

      Comment

      • Derakon
        Prophet
        • Dec 2009
        • 9022

        #4
        Does it consistently work like that, that the item you keep an eye on remains known while others vanish?

        Since you're closing and re-opening the game, I kind of assume you don't have a "reading memory that has been freed" type of situation here. What are the repro steps?

        Comment

        • Pete Mack
          Prophet
          • Apr 2007
          • 6883

          #5
          There's another problem. After detecting once, detecting a second time does not remove items picked up by monsters

          Comment

          • t4nk
            Swordsman
            • May 2016
            • 336

            #6
            Originally posted by Nick
            I have identified that the problem is player knowledge of objects being wiped on closing and reopening the game. So I thought I would track down where the loss of information was happening by running in gdb and watching the appropriate known object. Result? The object I was watching remained known, but all others still disappeared.

            While I'm slightly flattered by how important the game obviously considers me, it doesn't help fix the bug. Any suggestions? I think optimisation is already set to 0 (unless something is overriding what's in src/Makefile).
            Well, here's one bug: use item with effect_handler_SENSE_OBJECT (e.g., scroll of treasure detection), detect some objects and close the game. Load it again and the red '*' are no longer there. As far as I can tell, that's because object_sense() in obj-knowledge.c creates new object without tval and sval (that is, with tval and sval 0, since it's mem_zalloc'ed). What is needed is tval 0 ("none") and sval 2 ("unknown item") (map_info() looks for that, specifically for obj->kind == unknown_item_kind). Objects with tval and sval 0 cannot be loaded (load.c, rd_item()):
            Code:
            	obj->kind = lookup_kind(obj->tval, obj->sval);
            
            	/* Check we have a kind */
            	if ((!obj->tval && !obj->sval) || !obj->kind) {
            		object_delete(&obj);
            		return NULL;
            	}

            Comment

            • Nick
              Vanilla maintainer
              • Apr 2007
              • 9647

              #7
              Originally posted by t4nk
              Well, here's one bug: use item with effect_handler_SENSE_OBJECT (e.g., scroll of treasure detection), detect some objects and close the game. Load it again and the red '*' are no longer there. As far as I can tell, that's because object_sense() in obj-knowledge.c creates new object without tval and sval (that is, with tval and sval 0, since it's mem_zalloc'ed). What is needed is tval 0 ("none") and sval 2 ("unknown item") (map_info() looks for that, specifically for obj->kind == unknown_item_kind).
              Awesome, problem solved
              One for the Dark Lord on his dark throne
              In the Land of Mordor where the Shadows lie.

              Comment

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