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.261 by root, Wed Apr 28 19:59:06 2010 UTC vs.
Revision 1.262 by root, Sun May 2 11:23:52 2010 UTC

731 op->close_container (); 731 op->close_container ();
732 return 1; 732 return 1;
733 } 733 }
734 else if (!sack->env) 734 else if (!sack->env)
735 { 735 {
736 // active, but not ours: some other player has opened it 736 // active on floor, but not ours: some other player has opened it
737 // normally this only happens to dms standing on the same space.
738 // but it doesn't hurt to handle it.
737 op->failmsgf ("Somebody else is using the %s already.", query_name (sack)); 739 op->failmsgf ("Somebody else is using the %s already.", query_name (sack));
738 return 1; 740 return 1;
739 } 741 }
742 }
740 743
741 // fall through to opening it (active in inv) 744 // it's locked?
745 if (sack->slaying)
742 } 746 {
743 else if (sack->env) 747 if (object *tmp = find_key (op, op, sack))
748 {
749 op->statusmsg (format ("You unlock %s with %s.", query_name (sack), query_name (tmp)));
750 }
751 else
752 {
753 sack->flag [FLAG_APPLIED] = false; // might be applied in inv, let the user close it
754 esrv_update_item (UPD_FLAGS, op, sack);
755 op->statusmsg (format ("You don't have the key to unlock %s.", query_name (sack)));
756 return 1;
757 }
758 }
759
760 if (sack->env && !sack->flag [FLAG_APPLIED])
744 { 761 {
745 // it is in our env, so activate it, do not open yet 762 // it is in our env, so activate it, do not open yet
746 op->close_container (); 763 op->close_container ();
747 sack->flag [FLAG_APPLIED] = 1; 764 sack->flag [FLAG_APPLIED] = true;
748 esrv_update_item (UPD_FLAGS, op, sack); 765 esrv_update_item (UPD_FLAGS, op, sack);
749 op->statusmsg (format ("You ready %s.", query_name (sack))); 766 op->statusmsg (format ("You ready %s.", query_name (sack)));
750 return 1;
751 }
752
753 // it's locked?
754 if (sack->slaying)
755 { 767 }
756 if (object *tmp = find_key (op, op, sack))
757 op->statusmsg (format ("You unlock %s with %s.", query_name (sack), query_name (tmp)));
758 else 768 else
759 {
760 op->statusmsg (format ("You don't have the key to unlock %s.", query_name (sack)));
761 return 1;
762 }
763 }
764
765 op->open_container (sack); 769 op->open_container (sack);
766 770
767 return 1; 771 return 1;
768} 772}
769 773
770/** 774/**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines