View Single Post
Old May 23, 2011, 16:43   #85
Join Date: Apr 2009
Posts: 231
Spacebux is on a distinguished road
Originally Posted by Spacebux View Post
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.");

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.

My artifacts were no longer activatable...

I modified my code above to included the USE_EQUIP flag check. My items are activatable again.


Last edited by Spacebux; May 23, 2011 at 16:52.
Spacebux is offline   Reply With Quote