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

Comparing deliantra/server/server/plugins.C (file contents):
Revision 1.21 by root, Tue Dec 12 21:39:57 2006 UTC vs.
Revision 1.39 by pippijn, Tue Jan 2 23:39:22 2007 UTC

43static const hook_entry plug_hooks[NR_OF_HOOKS] = { 43static const hook_entry plug_hooks[NR_OF_HOOKS] = {
44 {cfapi_system_register_global_event, 1, "cfapi_system_register_global_event"}, 44 {cfapi_system_register_global_event, 1, "cfapi_system_register_global_event"},
45 {cfapi_system_unregister_global_event, 3, "cfapi_system_unregister_global_event"}, 45 {cfapi_system_unregister_global_event, 3, "cfapi_system_unregister_global_event"},
46 {cfapi_system_check_path, 4, "cfapi_system_check_path"}, 46 {cfapi_system_check_path, 4, "cfapi_system_check_path"},
47 {NULL, 5, "cfapi_system_re_cmp"}, 47 {NULL, 5, "cfapi_system_re_cmp"},
48 {cfapi_system_strdup_local, 6, "cfapi_system_strdup_local"}, 48 {cfapi_system_strdup, 6, "cfapi_system_strdup"},
49 {cfapi_system_directory, 7, "cfapi_system_directory"}, 49 {cfapi_system_directory, 7, "cfapi_system_directory"},
50 {cfapi_system_find_animation, 8, "cfapi_system_find_animation"}, 50 {cfapi_system_find_animation, 8, "cfapi_system_find_animation"},
51 {cfapi_object_clean_object, 9, "cfapi_object_clean_object"}, 51 {cfapi_object_clean_object, 9, "cfapi_object_clean_object"},
52 {cfapi_object_on_same_map, 10, "cfapi_object_on_same_map"}, 52 {cfapi_object_on_same_map, 10, "cfapi_object_on_same_map"},
53 {cfapi_object_get_key, 11, "cfapi_object_get_key"}, 53 {cfapi_object_get_key, 11, "cfapi_object_get_key"},
130 */ 130 */
131static void 131static void
132send_changed_object (object *op) 132send_changed_object (object *op)
133{ 133{
134 object *tmp; 134 object *tmp;
135 player *pl;
136 135
137 if (op->env != NULL) 136 if (op->env)
138 { 137 {
139 tmp = is_player_inv (op->env); 138 tmp = op->in_player ();
139
140 if (!tmp) 140 if (!tmp)
141 { 141 {
142 for (pl = first_player; pl; pl = pl->next) 142 for_all_players (pl)
143 if (pl->ob->container == op->env) 143 if (pl->ob->container == op->env)
144 {
145 tmp = pl->ob;
144 break; 146 break;
145 if (pl) 147 }
146 tmp = pl->ob;
147 else
148 tmp = NULL;
149 } 148 }
149
150 if (tmp) 150 if (tmp)
151 esrv_send_item (tmp, op); 151 esrv_send_item (tmp, op);
152 } 152 }
153 else 153 else
154 { 154 {
166 */ 166 */
167static void 167static void
168send_removed_object (object *op) 168send_removed_object (object *op)
169{ 169{
170 object *tmp; 170 object *tmp;
171 player *pl;
172 171
173 if (op->env == NULL) 172 if (op->env == NULL)
174 { 173 {
175 /* no action necessary: remove_ob() notifies the client */ 174 /* no action necessary: remove_ob() notifies the client */
176 return; 175 return;
177 } 176 }
178 177
179 tmp = is_player_inv (op->env); 178 tmp = op->in_player ();
180 if (!tmp) 179 if (!tmp)
181 { 180 {
182 for (pl = first_player; pl; pl = pl->next) 181 for_all_players (pl)
183 if (pl->ob->container == op->env) 182 if (pl->ob->container == op->env)
183 {
184 tmp = pl->ob;
184 break; 185 break;
185 if (pl) 186 }
186 tmp = pl->ob;
187 else
188 tmp = NULL;
189 } 187 }
188
190 if (tmp) 189 if (tmp)
191 esrv_del_item (tmp->contr, op->count); 190 esrv_del_item (tmp->contr, op->count);
192} 191}
193 192
194extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr); 193extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr);
482 *type = CFAPI_INT; 481 *type = CFAPI_INT;
483 return &rv; 482 return &rv;
484} 483}
485 484
486void * 485void *
487cfapi_system_strdup_local (int *type, ...) 486cfapi_system_strdup (int *type, ...)
488{ 487{
489 va_list args; 488 va_list args;
490 char *txt; 489 char *txt;
491 490
492 va_start (args, type); 491 va_start (args, type);
493 txt = va_arg (args, char *); 492 txt = va_arg (args, char *);
494 493
495 va_end (args); 494 va_end (args);
496 *type = CFAPI_STRING; 495 *type = CFAPI_STRING;
497 return strdup_local (txt); 496 return strdup (txt);
498} 497}
499 498
500void * 499void *
501cfapi_system_register_global_event (int *type, ...) 500cfapi_system_register_global_event (int *type, ...)
502{ 501{
610/* MAP RELATED HOOKS */ 609/* MAP RELATED HOOKS */
611 610
612void * 611void *
613cfapi_map_get_map (int *type, ...) 612cfapi_map_get_map (int *type, ...)
614{ 613{
615 va_list args; 614 abort ();
616 maptile *rv;
617 int ctype;
618 int x, y;
619 sint16 nx, ny;
620 char *name;
621 maptile *m;
622
623 va_start (args, type);
624
625 ctype = va_arg (args, int);
626
627 switch (ctype)
628 {
629 case 0:
630 x = va_arg (args, int);
631 y = va_arg (args, int);
632
633 rv = get_empty_map (x, y);
634 break;
635
636 case 1:
637 name = va_arg (args, char *);
638 x = va_arg (args, int);
639
640 rv = ready_map_name (name, x);
641 break;
642
643 case 2:
644 m = va_arg (args, maptile *);
645 nx = va_arg (args, int);
646 ny = va_arg (args, int);
647
648 rv = get_map_from_coord (m, &nx, &ny);
649 break;
650
651 case 3:
652 rv = first_map;
653 break;
654
655 default:
656 *type = CFAPI_NONE;
657 va_end (args);
658 return NULL;
659 break;
660 }
661 va_end (args);
662 *type = CFAPI_PMAP;
663 return rv;
664} 615}
665 616
666void * 617void *
667cfapi_map_has_been_loaded (int *type, ...) 618cfapi_map_has_been_loaded (int *type, ...)
668{ 619{
669 va_list args; 620 abort ();
670 maptile *map;
671 char *string;
672
673 va_start (args, type);
674 string = va_arg (args, char *);
675
676 map = has_been_loaded (string);
677 va_end (args);
678 *type = CFAPI_PMAP;
679 return map;
680} 621}
681 622
682void * 623void *
683cfapi_map_create_path (int *type, ...) 624cfapi_map_create_path (int *type, ...)
684{ 625{
685 va_list args; 626 abort ();
686 int ctype;
687 const char *str;
688 char *rv;
689
690 va_start (args, type);
691
692 ctype = va_arg (args, int);
693 str = va_arg (args, char *);
694
695 *type = CFAPI_STRING;
696
697 switch (ctype)
698 {
699 case 0:
700 rv = (char *) create_pathname (str);
701 break;
702
703 case 1:
704 rv = (char *) create_overlay_pathname (str);
705 break;
706
707 /*case 2:
708 rv = create_items_path(str);
709 break; */
710
711 default:
712 rv = NULL;
713 *type = CFAPI_NONE;
714 break;
715 }
716 va_end (args);
717 return rv;
718} 627}
719 628
720void * 629void *
721cfapi_map_get_map_property (int *type, ...) 630cfapi_map_get_map_property (int *type, ...)
722{ 631{
723 va_list args; 632 abort ();
724 int x, y;
725 sint16 nx, ny;
726 maptile *map;
727 maptile *newmap;
728 static int rv;
729 int property;
730 char *buf;
731
732 va_start (args, type);
733
734 property = va_arg (args, int);
735
736 switch (property)
737 {
738 case CFAPI_MAP_PROP_FLAGS:
739 map = va_arg (args, maptile *);
740 newmap = va_arg (args, maptile *);
741 x = va_arg (args, int);
742 y = va_arg (args, int);
743 nx = va_arg (args, int);
744 ny = va_arg (args, int);
745
746 rv = get_map_flags (map, &newmap, x, y, &nx, &ny);
747 va_end (args);
748 *type = CFAPI_INT;
749 return &rv;
750 break;
751
752 case CFAPI_MAP_PROP_DIFFICULTY:
753 map = va_arg (args, maptile *);
754
755 rv = calculate_difficulty (map);
756 va_end (args);
757 *type = CFAPI_INT;
758 return &rv;
759 break;
760
761 case CFAPI_MAP_PROP_PATH:
762 map = va_arg (args, maptile *);
763
764 buf = map->path;
765 *type = CFAPI_STRING;
766 va_end (args);
767 return buf;
768 break;
769
770 case CFAPI_MAP_PROP_TMPNAME:
771 map = va_arg (args, maptile *);
772
773 buf = map->tmpname;
774 *type = CFAPI_STRING;
775 va_end (args);
776 return buf;
777 break;
778
779 case CFAPI_MAP_PROP_NAME:
780 map = va_arg (args, maptile *);
781
782 buf = map->name;
783 *type = CFAPI_STRING;
784 va_end (args);
785 return buf;
786 break;
787
788 case CFAPI_MAP_PROP_RESET_TIME:
789 map = va_arg (args, maptile *);
790
791 rv = map->reset_time;
792 *type = CFAPI_INT;
793 va_end (args);
794 return &rv;
795 break;
796
797 case CFAPI_MAP_PROP_RESET_TIMEOUT:
798 map = va_arg (args, maptile *);
799
800 rv = map->reset_timeout;
801 *type = CFAPI_INT;
802 va_end (args);
803 return &rv;
804 break;
805
806 case CFAPI_MAP_PROP_PLAYERS:
807 map = va_arg (args, maptile *);
808
809 rv = map->players;
810 *type = CFAPI_INT;
811 va_end (args);
812 return &rv;
813 break;
814
815 case CFAPI_MAP_PROP_DARKNESS:
816 map = va_arg (args, maptile *);
817
818 rv = map->darkness;
819 *type = CFAPI_INT;
820 va_end (args);
821 return &rv;
822 break;
823
824 case CFAPI_MAP_PROP_WIDTH:
825 map = va_arg (args, maptile *);
826
827 rv = map->width;
828 *type = CFAPI_INT;
829 va_end (args);
830 return &rv;
831 break;
832
833 case CFAPI_MAP_PROP_HEIGHT:
834 map = va_arg (args, maptile *);
835
836 rv = map->height;
837 *type = CFAPI_INT;
838 va_end (args);
839 return &rv;
840 break;
841
842 case CFAPI_MAP_PROP_ENTER_X:
843 map = va_arg (args, maptile *);
844
845 rv = map->enter_x;
846 *type = CFAPI_INT;
847 va_end (args);
848 return &rv;
849 break;
850
851 case CFAPI_MAP_PROP_ENTER_Y:
852 map = va_arg (args, maptile *);
853
854 rv = map->enter_y;
855 *type = CFAPI_INT;
856 va_end (args);
857 return &rv;
858 break;
859
860 case CFAPI_MAP_PROP_TEMPERATURE:
861 map = va_arg (args, maptile *);
862
863 rv = map->temp;
864 *type = CFAPI_INT;
865 va_end (args);
866 return &rv;
867 break;
868
869 case CFAPI_MAP_PROP_PRESSURE:
870 map = va_arg (args, maptile *);
871
872 rv = map->pressure;
873 *type = CFAPI_INT;
874 va_end (args);
875 return &rv;
876 break;
877
878 case CFAPI_MAP_PROP_HUMIDITY:
879 map = va_arg (args, maptile *);
880
881 rv = map->humid;
882 *type = CFAPI_INT;
883 va_end (args);
884 return &rv;
885 break;
886
887 case CFAPI_MAP_PROP_WINDSPEED:
888 map = va_arg (args, maptile *);
889
890 rv = map->windspeed;
891 *type = CFAPI_INT;
892 va_end (args);
893 return &rv;
894 break;
895
896 case CFAPI_MAP_PROP_WINDDIR:
897 map = va_arg (args, maptile *);
898
899 rv = map->winddir;
900 *type = CFAPI_INT;
901 va_end (args);
902 return &rv;
903 break;
904
905 case CFAPI_MAP_PROP_SKY:
906 map = va_arg (args, maptile *);
907
908 rv = map->sky;
909 *type = CFAPI_INT;
910 va_end (args);
911 return &rv;
912 break;
913
914 case CFAPI_MAP_PROP_WPARTX:
915 map = va_arg (args, maptile *);
916
917 rv = map->wpartx;
918 *type = CFAPI_INT;
919 va_end (args);
920 return &rv;
921 break;
922
923 case CFAPI_MAP_PROP_WPARTY:
924 map = va_arg (args, maptile *);
925
926 rv = map->wparty;
927 *type = CFAPI_INT;
928 va_end (args);
929 return &rv;
930 break;
931
932 case CFAPI_MAP_PROP_MESSAGE:
933 map = va_arg (args, maptile *);
934
935 buf = map->msg;
936 *type = CFAPI_STRING;
937 va_end (args);
938 return buf;
939 break;
940
941 case CFAPI_MAP_PROP_NEXT:
942 map = va_arg (args, maptile *);
943
944 *type = CFAPI_PMAP;
945 va_end (args);
946 return map->next;
947 break;
948
949 case CFAPI_MAP_PROP_REGION:
950 map = va_arg (args, maptile *);
951
952 *type = CFAPI_PREGION;
953 va_end (args);
954 return get_region_by_map (map);
955 break;
956
957 default:
958 *type = CFAPI_NONE;
959 va_end (args);
960 return NULL;
961 break;
962 }
963} 633}
964 634
965void * 635void *
966cfapi_map_set_map_property (int *type, ...) 636cfapi_map_set_map_property (int *type, ...)
967{ 637{
968 va_list args; 638 abort ();
969 static int rv;
970 maptile *map;
971 int val;
972 int property;
973
974 va_start (args, type);
975
976 property = va_arg (args, int);
977
978 switch (property)
979 {
980 case CFAPI_MAP_PROP_LIGHT:
981 map = va_arg (args, maptile *);
982 val = va_arg (args, int);
983
984 rv = change_map_light (map, val);
985 *type = CFAPI_INT;
986 va_end (args);
987 return &rv;
988 break;
989
990 case CFAPI_MAP_PROP_RESET_TIME:
991 map = va_arg (args, maptile *);
992
993 *type = CFAPI_NONE;
994 va_end (args);
995 return NULL;
996 break;
997
998 default:
999 *type = CFAPI_NONE;
1000 va_end (args);
1001 return NULL;
1002 break;
1003 }
1004} 639}
640
1005void * 641void *
1006cfapi_map_out_of_map (int *type, ...) 642cfapi_map_out_of_map (int *type, ...)
1007{ 643{
644 abort ();
645}
646
647void *
648cfapi_map_update_position (int *type, ...)
649{
1008 va_list args; 650 va_list args;
1009 static int rv;
1010 maptile *map; 651 maptile *map;
1011 int x, y; 652 int x, y;
1012 653
1013 va_start (args, type); 654 va_start (args, type);
655
1014 map = va_arg (args, maptile *); 656 map = va_arg (args, maptile *);
1015 x = va_arg (args, int); 657 x = va_arg (args, int);
1016 y = va_arg (args, int); 658 y = va_arg (args, int);
1017 659
1018 rv = out_of_map (map, x, y); 660 map->at (x, y).flags_ &= ~P_UPTODATE;
661
1019 va_end (args); 662 va_end (args);
1020 *type = CFAPI_INT; 663 *type = CFAPI_NONE;
1021 return &rv; 664 return NULL;
1022} 665}
1023 666
1024void * 667void *
1025cfapi_map_update_position (int *type, ...) 668cfapi_map_delete_map (int *type, ...)
669{
670 abort ();
671}
672
673void *
674cfapi_map_message (int *type, ...)
675{
676 va_list args;
677 maptile *map;
678 char *string;
679 int color;
680
681 va_start (args, type);
682 map = va_arg (args, maptile *);
683 string = va_arg (args, char *);
684 color = va_arg (args, int);
685
686 va_end (args);
687
688 new_info_map (color, map, string);
689 *type = CFAPI_NONE;
690 return NULL;
691}
692
693void *
694cfapi_map_get_object_at (int *type, ...)
1026{ 695{
1027 va_list args; 696 va_list args;
1028 maptile *map; 697 maptile *map;
1029 int x, y; 698 int x, y;
699 object *rv;
1030 700
1031 va_start (args, type); 701 va_start (args, type);
1032
1033 map = va_arg (args, maptile *); 702 map = va_arg (args, maptile *);
1034 x = va_arg (args, int); 703 x = va_arg (args, int);
1035 y = va_arg (args, int); 704 y = va_arg (args, int);
1036 705
1037 update_position (map, x, y);
1038 va_end (args); 706 va_end (args);
1039 *type = CFAPI_NONE;
1040 return NULL;
1041}
1042 707
1043void * 708 rv = GET_MAP_OB (map, x, y);
1044cfapi_map_delete_map (int *type, ...)
1045{
1046 va_list args;
1047 maptile *map;
1048
1049 va_start (args, type);
1050
1051 map = va_arg (args, maptile *);
1052
1053 delete_map (map);
1054
1055 va_end (args);
1056 *type = CFAPI_NONE;
1057 return NULL;
1058}
1059
1060void *
1061cfapi_map_message (int *type, ...)
1062{
1063 va_list args;
1064 maptile *map;
1065 char *string;
1066 int color;
1067
1068 va_start (args, type);
1069 map = va_arg (args, maptile *);
1070 string = va_arg (args, char *);
1071 color = va_arg (args, int);
1072
1073 va_end (args);
1074
1075 new_info_map (color, map, string);
1076 *type = CFAPI_NONE;
1077 return NULL;
1078}
1079
1080void *
1081cfapi_map_get_object_at (int *type, ...)
1082{
1083 va_list args;
1084 maptile *map;
1085 int x, y;
1086 object *rv;
1087
1088 va_start (args, type);
1089 map = va_arg (args, maptile *);
1090 x = va_arg (args, int);
1091 y = va_arg (args, int);
1092
1093 va_end (args);
1094
1095 rv = get_map_ob (map, x, y);
1096 *type = CFAPI_POBJECT; 709 *type = CFAPI_POBJECT;
1097 return rv; 710 return rv;
1098} 711}
1099 712
1100void * 713void *
1637 rv = &op->stats.exp; 1250 rv = &op->stats.exp;
1638 *type = CFAPI_LONG; 1251 *type = CFAPI_LONG;
1639 break; 1252 break;
1640 1253
1641 case CFAPI_OBJECT_PROP_OWNER: 1254 case CFAPI_OBJECT_PROP_OWNER:
1642 rv = get_owner (op); 1255 rv = op->owner;
1643 *type = CFAPI_POBJECT; 1256 *type = CFAPI_POBJECT;
1644 break; 1257 break;
1645 1258
1646 case CFAPI_OBJECT_PROP_PRESENT: 1259 case CFAPI_OBJECT_PROP_PRESENT:
1647 { 1260 {
1689 case CFAPI_OBJECT_PROP_MERGEABLE: 1302 case CFAPI_OBJECT_PROP_MERGEABLE:
1690 { 1303 {
1691 object *op2; 1304 object *op2;
1692 op2 = va_arg (args, object *); 1305 op2 = va_arg (args, object *);
1693 1306
1694 ri = CAN_MERGE (op, op2); 1307 ri = object::can_merge_slow (op, op2);
1695 rv = &ri; 1308 rv = &ri;
1696 } 1309 }
1697 *type = CFAPI_INT; 1310 *type = CFAPI_INT;
1698 break; 1311 break;
1699 1312
1846 rv = &ri; 1459 rv = &ri;
1847 *type = CFAPI_INT; 1460 *type = CFAPI_INT;
1848 break; 1461 break;
1849 1462
1850 case CFAPI_PLAYER_PROP_IP: 1463 case CFAPI_PLAYER_PROP_IP:
1851 rv = op->contr->socket.host; 1464 rv = op->contr->ns->host;
1852 *type = CFAPI_STRING; 1465 *type = CFAPI_STRING;
1853 break; 1466 break;
1854 1467
1855 case CFAPI_PLAYER_PROP_MARKED_ITEM: 1468 case CFAPI_PLAYER_PROP_MARKED_ITEM:
1856 rv = find_marked_object (op); 1469 rv = find_marked_object (op);
1966 if (op->nrof > (uint32) iarg) 1579 if (op->nrof > (uint32) iarg)
1967 decrease_ob_nr (op, op->nrof - iarg); 1580 decrease_ob_nr (op, op->nrof - iarg);
1968 else if (op->nrof < (uint32) iarg) 1581 else if (op->nrof < (uint32) iarg)
1969 { 1582 {
1970 object *tmp; 1583 object *tmp;
1971 player *pl;
1972 1584
1973 op->nrof = iarg; 1585 op->nrof = iarg;
1974 if (op->env != NULL) 1586 if (op->env != NULL)
1975 { 1587 {
1976 tmp = is_player_inv (op->env); 1588 tmp = op->in_player ();
1977 if (!tmp) 1589 if (!tmp)
1978 { 1590 {
1979 for (pl = first_player; pl; pl = pl->next) 1591 for_all_players (pl)
1980 if (pl->ob->container == op->env) 1592 if (pl->ob->container == op->env)
1593 {
1594 tmp = pl->ob;
1981 break; 1595 break;
1982 if (pl)
1983 tmp = pl->ob;
1984 else 1596 }
1985 tmp = NULL;
1986 } 1597 }
1987 else 1598 else
1988 { 1599 {
1989 sum_weight (tmp); 1600 sum_weight (tmp);
1990 fix_player (tmp); 1601 tmp->update_stats ();
1991 } 1602 }
1992 if (tmp) 1603 if (tmp)
1993 esrv_send_item (tmp, op); 1604 esrv_send_item (tmp, op);
1994 } 1605 }
1995 else 1606 else
2127 iarg = va_arg (args, int); 1738 iarg = va_arg (args, int);
2128 1739
2129 if (op->weight != iarg) 1740 if (op->weight != iarg)
2130 { 1741 {
2131 object *tmp; 1742 object *tmp;
2132 player *pl;
2133 1743
2134 op->weight = iarg; 1744 op->weight = iarg;
2135 if (op->env != NULL) 1745 if (op->env != NULL)
2136 { 1746 {
2137 tmp = is_player_inv (op->env); 1747 tmp = op->in_player ();
2138 if (!tmp) 1748 if (!tmp)
2139 { 1749 {
2140 for (pl = first_player; pl; pl = pl->next) 1750 for_all_players (pl)
2141 if (pl->ob->container == op->env) 1751 if (pl->ob->container == op->env)
1752 {
1753 tmp = pl->ob;
2142 break; 1754 break;
2143 if (pl)
2144 tmp = pl->ob;
2145 else 1755 }
2146 tmp = NULL;
2147 } 1756 }
2148 else 1757 else
2149 { 1758 {
2150 sum_weight (tmp); 1759 sum_weight (tmp);
2151 fix_player (tmp); 1760 tmp->update_stats ();
2152 } 1761 }
2153 if (tmp) 1762 if (tmp)
2154 esrv_send_item (tmp, op); 1763 esrv_send_item (tmp, op);
2155 } 1764 }
2156 else 1765 else
2271 break; 1880 break;
2272 1881
2273 case CFAPI_OBJECT_PROP_OWNER: 1882 case CFAPI_OBJECT_PROP_OWNER:
2274 oparg = va_arg (args, object *); 1883 oparg = va_arg (args, object *);
2275 1884
2276 set_owner (op, oparg); 1885 op->set_owner (oparg);
2277 break; 1886 break;
2278 1887
2279 case CFAPI_OBJECT_PROP_CHEATER: 1888 case CFAPI_OBJECT_PROP_CHEATER:
2280 set_cheat (op); 1889 set_cheat (op);
2281 break; 1890 break;
2516} 2125}
2517 2126
2518void * 2127void *
2519cfapi_object_drain (int *type, ...) 2128cfapi_object_drain (int *type, ...)
2520{ 2129{
2521 va_list args; 2130 abort ();
2131}
2522 2132
2133void *
2134cfapi_object_fix (int *type, ...)
2135{
2136 va_list args;
2523 object *op; 2137 object *op;
2524 int ds;
2525 2138
2526 va_start (args, type); 2139 va_start (args, type);
2527 2140
2528 op = va_arg (args, object *); 2141 op = va_arg (args, object *);
2529 ds = va_arg (args, int);
2530 2142
2531 va_end (args); 2143 va_end (args);
2532 2144
2533 drain_specific_stat (op, ds); 2145 op->update_stats ();
2534
2535 *type = CFAPI_NONE;
2536 return NULL;
2537}
2538
2539void *
2540cfapi_object_fix (int *type, ...)
2541{
2542 va_list args;
2543 object *op;
2544
2545 va_start (args, type);
2546
2547 op = va_arg (args, object *);
2548
2549 va_end (args);
2550
2551 fix_player (op);
2552 2146
2553 *type = CFAPI_NONE; 2147 *type = CFAPI_NONE;
2554 return NULL; 2148 return NULL;
2555} 2149}
2556 2150
2648 *type = CFAPI_POBJECT; 2242 *type = CFAPI_POBJECT;
2649 return object_create_clone (op); 2243 return object_create_clone (op);
2650 } 2244 }
2651 else 2245 else
2652 { 2246 {
2653 object *tmp; 2247 object *tmp = op->clone ();
2654
2655 tmp = object::create ();
2656 op->copy_to (tmp);
2657 *type = CFAPI_POBJECT; 2248 *type = CFAPI_POBJECT;
2658 return tmp; 2249 return tmp;
2659 } 2250 }
2660} 2251}
2661void * 2252void *
2697 break; 2288 break;
2698 2289
2699 case 3: 2290 case 3:
2700 op = va_arg (args, object *); 2291 op = va_arg (args, object *);
2701 2292
2702 rv = is_player_inv (op); 2293 rv = op->in_player ();
2703 break; 2294 break;
2704 2295
2705 default: 2296 default:
2706 rv = NULL; 2297 rv = NULL;
2707 *type = CFAPI_NONE; 2298 *type = CFAPI_NONE;
2903} 2494}
2904 2495
2905void * 2496void *
2906cfapi_object_clear (int *type, ...) 2497cfapi_object_clear (int *type, ...)
2907{ 2498{
2908 va_list args; 2499 abort ();
2909 object *op;
2910
2911 va_start (args, type);
2912
2913 op = va_arg (args, object *);
2914
2915 va_end (args);
2916
2917 clear_object (op);
2918 *type = CFAPI_NONE;
2919 return NULL;
2920} 2500}
2921 2501
2922void * 2502void *
2923cfapi_object_reset (int *type, ...) 2503cfapi_object_reset (int *type, ...)
2924{ 2504{
2957} 2537}
2958 2538
2959void * 2539void *
2960cfapi_object_clean_object (int *type, ...) 2540cfapi_object_clean_object (int *type, ...)
2961{ 2541{
2962 va_list args; 2542 abort ();
2963 object *op;
2964
2965 va_start (args, type);
2966 op = va_arg (args, object *);
2967
2968 clean_object (op);
2969 va_end (args);
2970 *type = CFAPI_NONE;
2971 return NULL;
2972} 2543}
2973 2544
2974void * 2545void *
2975cfapi_object_on_same_map (int *type, ...) 2546cfapi_object_on_same_map (int *type, ...)
2976{ 2547{
3313 drop (author, op); 2884 drop (author, op);
3314 2885
3315 if (author->type == PLAYER) 2886 if (author->type == PLAYER)
3316 { 2887 {
3317 author->contr->count = 0; 2888 author->contr->count = 0;
3318 author->contr->socket.update_look = 1; 2889 author->contr->ns->floorbox_update ();
3319 } 2890 }
3320 2891
3321 *type = CFAPI_NONE; 2892 *type = CFAPI_NONE;
3322 return NULL; 2893 return NULL;
3323} 2894}
3556 3127
3557 case CFAPI_PARTY_PROP_PLAYER: 3128 case CFAPI_PARTY_PROP_PLAYER:
3558 *type = CFAPI_PPLAYER; 3129 *type = CFAPI_PPLAYER;
3559 obarg = va_arg (args, object *); 3130 obarg = va_arg (args, object *);
3560 3131
3561 pl = (obarg ? obarg->contr : first_player); 3132 pl = (obarg ? (player *)obarg->contr : first_player);
3562 rv = NULL; 3133 rv = NULL;
3563 for (; pl != NULL; pl = pl->next) 3134 for (; pl != NULL; pl = pl->next)
3564 if (pl->ob->contr->party == party) 3135 if (pl->ob->contr->party == party)
3565 { 3136 {
3566 rv = (void *) pl; 3137 rv = (void *) pl;
3661 return NULL; 3232 return NULL;
3662} 3233}
3663 3234
3664/*****************************************************************************/ 3235/*****************************************************************************/
3665 3236
3666/* Plugins initialization. Browses the plugins directory and call */ 3237/* Plugins initialisation. Browses the plugins directory and call */
3667 3238
3668/* initOnePlugin for each file found. */ 3239/* initOnePlugin for each file found. */
3669 3240
3670/* Returns 0 if at least one plugin was successfully loaded, -1 if not */ 3241/* Returns 0 if at least one plugin was successfully loaded, -1 if not */
3671 3242
3678 size_t l; 3249 size_t l;
3679 char buf[MAX_BUF]; 3250 char buf[MAX_BUF];
3680 char buf2[MAX_BUF]; 3251 char buf2[MAX_BUF];
3681 int result; 3252 int result;
3682 3253
3683 LOG (llevInfo, "Initializing plugins\n"); 3254 LOG (llevInfo, "Initialising plugins\n");
3684 strcpy (buf, LIBDIR); 3255 strcpy (buf, LIBDIR);
3685 strcat (buf, "/plugins/"); 3256 strcat (buf, "/plugins/");
3686 LOG (llevInfo, "Plugins directory is %s\n", buf); 3257 LOG (llevInfo, "Plugins directory is %s\n", buf);
3687 3258
3688 plugins_init_perl (); 3259 plugins_init_perl ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines