Feature Discussion -- Death and keys

New ideas, features you wish were in the game.
Berendol
Evil Iggy
Posts: 868
Joined: Mon 11.11.2002, 19:13
Location: Loot Pile
Contact:

Re: Death and keys

Post by Berendol » Thu 10.05.2007, 15:53

Handle them with a higher priority than artifacts. That should do the trick.
By appreciation, we make excellence in others our own property. (Voltaire)

Billsey
King Vampire
Posts: 272
Joined: Sun 12.02.2006, 14:36
Location: Oregon, USA
Contact:

Re: Death and keys

Post by Billsey » Thu 10.05.2007, 21:31

I think I've got a better idea... Use the num_keys variable to place them in specific slots. The first key found would go to slot 0, the second to slot 1, etc. This could be done as they are found while walking through the list of items, since the first item dropped would free slot 0 up and so on. After copying the key to the proper slot, you just destroy the old one. Referring back to my post that started this thread:

Code: Select all

   if (p_ptr->inventory[i].tval == TV_KEY)
  {
   num_keys++;
   continue;
  }
Changes to something like:

Code: Select all

            if (p_ptr->inventory[i].tval == TV_KEY)
            {
                  p_ptr->inventory[num_keys] = p_ptr->inventory[i];
                  p_ptr->inventory[i].iy = p_ptr->inventory[i].ix = p_ptr->inventory[i].dun_depth = 0;
                  num_keys++;
                  continue;
            }
If someone could verify my logic, and that I have handled the removal of the old key correctly, I'd really appreciate it.
Mangband Project Team Member

Post Reply