Quote:
Originally Posted by Spacebux
Fixed. This fixes crashes from eating a stack of food off the floor, quaffing potions off the floor, and reading scrolls off the floor when pressing 'n' or CTRL-V when the item count reaches 0.
In cmd-obj.c, insert:
void do_cmd_use(cmd_code code, cmd_arg args[])
{
int item = args[0].item;
object_type *o_ptr = object_from_item_idx(item);
int effect;
if (!item_is_available(item, NULL, (USE_INVEN | USE_FLOOR | USE_EQUIP))) { msg("That item is not within your reach.");
return; }
bool ident = FALSE, used = FALSE;
bool was_aware = object_flavor_is_aware(o_ptr);
int dir = 5;
Maybe that is not the best place for it, but that check prevents the code from going further, generating segmentation faults and worse.
-SBux-
|
Update:
My artifacts were no longer
activatable...
I modified my code above to included the
USE_EQUIP flag check. My items are activatable again.
-SBux-