Changeset 1445
- Timestamp:
- 06/20/09 21:20:53 (15 months ago)
- Location:
- trunk/src
- Files:
-
- 3 modified
-
cmd-obj.c (modified) (2 diffs)
-
object/obj-util.c (modified) (3 diffs)
-
object/object.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cmd-obj.c
r1431 r1445 473 473 if (obj_is_rod(o_ptr)) 474 474 { 475 if (!obj_can_zap(o_ptr)) 476 { 477 msg_print("The rod is not yet recharged."); 478 return; 479 } 480 475 481 use = USE_TIMEOUT; 476 482 snd = MSG_ZAP_ROD; … … 511 517 items_allowed = USE_INVEN | USE_FLOOR; 512 518 } 513 else if (obj_can_activate(o_ptr)) 514 { 519 else if (obj_is_activatable(o_ptr)) 520 { 521 if (!obj_can_activate(o_ptr)) 522 { 523 msg_print("The item is not ready to activate"); 524 return; 525 } 526 515 527 use = USE_TIMEOUT; 516 528 snd = MSG_ACT_ARTIFACT; 517 529 items_allowed = USE_EQUIP; 530 } 531 else 532 { 533 msg_print("The item cannot be used at the moment"); 518 534 } 519 535 -
trunk/src/object/obj-util.c
r1443 r1445 3574 3574 3575 3575 /* Determine if an object is activatable */ 3576 bool obj_ can_activate(const object_type *o_ptr)3576 bool obj_is_activatable(const object_type *o_ptr) 3577 3577 { 3578 3578 u32b f[OBJ_FLAG_N]; … … 3581 3581 if (!object_known_p(o_ptr)) return (FALSE); 3582 3582 3583 /* Check the recharge */3584 if (o_ptr->timeout) return (FALSE);3585 3586 3583 /* Extract the flags */ 3587 3584 object_flags(o_ptr, f); … … 3589 3586 /* Check activation flag */ 3590 3587 return (f[2] & TR2_ACTIVATE) ? TRUE : FALSE; 3588 } 3589 3590 /* Determine if an object can be activated now */ 3591 bool obj_can_activate(const object_type *o_ptr) 3592 { 3593 if (obj_is_activatable(o_ptr)) 3594 { 3595 /* Check the recharge */ 3596 if (!o_ptr->timeout) return TRUE; 3597 } 3598 3599 return FALSE; 3591 3600 } 3592 3601 -
trunk/src/object/object.h
r1435 r1445 162 162 bool obj_is_food(const object_type *o_ptr); 163 163 bool obj_can_zap(const object_type *o_ptr); 164 bool obj_is_activatable(const object_type *o_ptr); 164 165 bool obj_can_activate(const object_type *o_ptr); 165 166 bool obj_can_refill(const object_type *o_ptr);
