fix recent gold pickup fix

A recent change to delete the floor object sooner when picking up
gold resulted in accessing that object after it had been freed.
This commit is contained in:
nethack.rankin
2007-11-30 07:10:49 +00:00
parent e2eba2ae9a
commit c06c7bbf5e
+6 -1
View File
@@ -1282,7 +1282,10 @@ boolean telekinesis; /* not picking it up directly by hand */
} else { } else {
u.ugold += count; u.ugold += count;
if (count == obj->quan) if (count == obj->quan)
delobj(obj); /* costly_gold() can trigger --More-- prompt, so
take gold off map before messages in order to
prevent hangup save there from duplicating it */
obj_extract_self(obj); /* remove from floor */
else else
obj->quan -= count; obj->quan -= count;
if ((nearload = near_capacity()) != 0) if ((nearload = near_capacity()) != 0)
@@ -1293,6 +1296,8 @@ boolean telekinesis; /* not picking it up directly by hand */
else else
prinv((char *) 0, obj, count); prinv((char *) 0, obj, count);
costly_gold(obj->ox, obj->oy, count); costly_gold(obj->ox, obj->oy, count);
if (obj->where == OBJ_FREE)
delobj(obj);
} }
context.botl = 1; context.botl = 1;
if (context.run) nomul(0); if (context.run) nomul(0);