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

Comparing deliantra/server/common/button.C (file contents):
Revision 1.7 by root, Sun Sep 10 16:00:23 2006 UTC vs.
Revision 1.8 by root, Mon Sep 11 20:28:37 2006 UTC

1 1
2/* 2/*
3 * static char *rcsid_button_c = 3 * static char *rcsid_button_c =
4 * "$Id: button.C,v 1.7 2006/09/10 16:00:23 root Exp $"; 4 * "$Id: button.C,v 1.8 2006/09/11 20:28:37 root Exp $";
5 */ 5 */
6 6
7/* 7/*
8 CrossFire, A Multiplayer game for X-windows 8 CrossFire, A Multiplayer game for X-windows
9 9
758 if (!tmp || tmp->type == PLAYER) 758 if (!tmp || tmp->type == PLAYER)
759 return; 759 return;
760 760
761 switch (op->last_sp) 761 switch (op->last_sp)
762 { 762 {
763 case 0: /* furious--make all monsters mad */ 763 case 0: /* furious--make all monsters mad */
764 if (QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE)) 764 if (QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE))
765 CLEAR_FLAG (tmp, FLAG_UNAGGRESSIVE); 765 CLEAR_FLAG (tmp, FLAG_UNAGGRESSIVE);
766 if (QUERY_FLAG (tmp, FLAG_FRIENDLY)) 766 if (QUERY_FLAG (tmp, FLAG_FRIENDLY))
767 { 767 {
768 CLEAR_FLAG (tmp, FLAG_FRIENDLY); 768 CLEAR_FLAG (tmp, FLAG_FRIENDLY);
769 remove_friendly_object (tmp); 769 remove_friendly_object (tmp);
770 tmp->attack_movement = 0; 770 tmp->attack_movement = 0;
771 /* lots of checks here, but want to make sure we don't 771 /* lots of checks here, but want to make sure we don't
772 * dereference a null value 772 * dereference a null value
773 */ 773 */
774 if (tmp->type == GOLEM && tmp->owner && tmp->owner->type == PLAYER && tmp->owner->contr->ranges[range_golem] == tmp) 774 if (tmp->type == GOLEM && tmp->owner && tmp->owner->type == PLAYER && tmp->owner->contr->ranges[range_golem] == tmp)
775 { 775 {
776 tmp->owner->contr->ranges[range_golem] = NULL; 776 tmp->owner->contr->ranges[range_golem] = NULL;
777 tmp->owner->contr->golem_count = 0; 777 tmp->owner->contr->golem_count = 0;
778 } 778 }
779 tmp->owner = 0; 779 tmp->owner = 0;
780 } 780 }
781 break;
782 case 1: /* angry -- get neutral monsters mad */
783 if (QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE) && !QUERY_FLAG (tmp, FLAG_FRIENDLY))
784 CLEAR_FLAG (tmp, FLAG_UNAGGRESSIVE);
785 break;
786 case 2: /* calm -- pacify unfriendly monsters */
787 if (!QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE))
788 SET_FLAG (tmp, FLAG_UNAGGRESSIVE);
789 break;
790 case 3: /* make all monsters fall asleep */
791 if (!QUERY_FLAG (tmp, FLAG_SLEEP))
792 SET_FLAG (tmp, FLAG_SLEEP);
793 break;
794 case 4: /* charm all monsters */
795 if (op == source)
796 break; /* only if 'connected' */
797
798 for (tmp2 = get_map_ob (source->map, source->x, source->y); /* finding an owner */
799 tmp2->type != PLAYER; tmp2 = tmp2->above)
800 if (tmp2->above == NULL)
801 break;
802
803 if (tmp2->type != PLAYER)
781 break; 804 break;
782 case 1: /* angry -- get neutral monsters mad */
783 if (QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE) && !QUERY_FLAG (tmp, FLAG_FRIENDLY))
784 CLEAR_FLAG (tmp, FLAG_UNAGGRESSIVE);
785 break;
786 case 2: /* calm -- pacify unfriendly monsters */
787 if (!QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE))
788 SET_FLAG (tmp, FLAG_UNAGGRESSIVE);
789 break;
790 case 3: /* make all monsters fall asleep */
791 if (!QUERY_FLAG (tmp, FLAG_SLEEP))
792 SET_FLAG (tmp, FLAG_SLEEP);
793 break;
794 case 4: /* charm all monsters */
795 if (op == source)
796 break; /* only if 'connected' */
797
798 for (tmp2 = get_map_ob (source->map, source->x, source->y); /* finding an owner */
799 tmp2->type != PLAYER; tmp2 = tmp2->above)
800 if (tmp2->above == NULL)
801 break;
802
803 if (tmp2->type != PLAYER)
804 break;
805 set_owner (tmp, tmp2); 805 set_owner (tmp, tmp2);
806 SET_FLAG (tmp, FLAG_MONSTER); 806 SET_FLAG (tmp, FLAG_MONSTER);
807 tmp->stats.exp = 0; 807 tmp->stats.exp = 0;
808 SET_FLAG (tmp, FLAG_FRIENDLY); 808 SET_FLAG (tmp, FLAG_FRIENDLY);
809 add_friendly_object (tmp); 809 add_friendly_object (tmp);
810 tmp->attack_movement = PETMOVE; 810 tmp->attack_movement = PETMOVE;
811 break; 811 break;
812 812
813 default: 813 default:
814 break; 814 break;
815
816 } 815 }
817} 816}
818 817
819/* this function returns the object it matches, or NULL if non. 818/* this function returns the object it matches, or NULL if non.
820 * It will descend through containers to find the object. 819 * It will descend through containers to find the object.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines