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--
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