ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/apply.C
(Generate patch)

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.242 by root, Mon Apr 5 22:00:15 2010 UTC vs.
Revision 1.243 by root, Mon Apr 5 23:05:45 2010 UTC

2856 who->statusmsg (format ("I don't know how to apply the %s.", query_name (op))); 2856 who->statusmsg (format ("I don't know how to apply the %s.", query_name (op)));
2857 return 0; 2857 return 0;
2858 } 2858 }
2859} 2859}
2860 2860
2861/*
2862 * Same return value as apply() function.
2863 */
2864bool
2865player_apply (object *pl, object *op, int aflag)
2866{
2867 if (!op->env && (pl->move_type & MOVE_FLYING))
2868 {
2869 /* player is flying and applying object not in inventory */
2870 if (!QUERY_FLAG (pl, FLAG_WIZ) && !(op->move_type & MOVE_FLYING))
2871 {
2872 pl->failmsg ("But you are floating high above the ground! "
2873 "H<You have to stop levitating first, if you can, either by using your levitation skill, "
2874 "or waiting till the levitation effect wears off.>");
2875 return 0;
2876 }
2877 }
2878
2879 pl->contr->last_used = op;
2880
2881 return pl->apply (op, aflag);
2882}
2883
2884/** 2861/**
2885 * player_apply_below attempts to apply the object 'below' the player. 2862 * player_apply_below attempts to apply the object 'below' the player.
2886 * If the player has an open container, we use that for below, otherwise 2863 * If the player has an open container, we use that for below, otherwise
2887 * we use the ground. 2864 * we use the ground.
2888 */ 2865 */
2908 if (tmp->type == SPELL_EFFECT || tmp->invisible) 2885 if (tmp->type == SPELL_EFFECT || tmp->invisible)
2909 continue; 2886 continue;
2910 2887
2911 /* If it is visible, player can apply it. 2888 /* If it is visible, player can apply it.
2912 */ 2889 */
2913 if (player_apply (pl, tmp, 0)) 2890 if (pl->apply (tmp))
2914 break; 2891 break;
2915 } 2892 }
2916} 2893}
2917 2894
2918/** 2895/**
3258bool 3235bool
3259object::apply (object *ob, int aflags) 3236object::apply (object *ob, int aflags)
3260{ 3237{
3261 if (!ob) // simplifies a lot of callers 3238 if (!ob) // simplifies a lot of callers
3262 return true; 3239 return true;
3240
3241 if (contr)
3242 {
3243 if (!ob->env && (move_type & MOVE_FLYING))
3244 {
3245 /* player is flying and applying object not in inventory */
3246 if (!flag [FLAG_WIZ] && !(ob->move_type & MOVE_FLYING))
3247 {
3248 failmsg ("But you are floating high above the ground! "
3249 "H<You have to stop levitating first, if you can, either by using your levitation skill, "
3250 "or waiting till the levitation effect wears off.>");
3251 return 0;
3252 }
3253 }
3254
3255 contr->last_used = ob;
3256 }
3263 3257
3264 bool want_apply = 3258 bool want_apply =
3265 aflags & AP_APPLY ? true 3259 aflags & AP_APPLY ? true
3266 : aflags & AP_UNAPPLY ? false 3260 : aflags & AP_UNAPPLY ? false
3267 : !ob->flag [FLAG_APPLIED]; // AP_TOGGLE 3261 : !ob->flag [FLAG_APPLIED]; // AP_TOGGLE
3562 3556
3563 return 1; 3557 return 1;
3564 } 3558 }
3565 3559
3566 if (who->contr) 3560 if (who->contr)
3567 who->statusmsg (format ( 3561 if (op->invisible)
3568 op->invisible ? "You can now use the %s skill." : "You ready %s.", 3562 who->statusmsg (format ("You can now use the %s skill.", &op->skill));
3569 query_name (op),
3570 &op->skill
3571 )); 3563 else
3564 who->statusmsg (format ("You ready %s.", query_name (op)));
3572 } 3565 }
3573 3566
3574 SET_FLAG (who, FLAG_READY_SKILL); 3567 SET_FLAG (who, FLAG_READY_SKILL);
3575 SET_FLAG (op, FLAG_APPLIED); 3568 SET_FLAG (op, FLAG_APPLIED);
3576 change_abil (who, op); 3569 change_abil (who, op);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines