1 | /*****************************************************************************/ |
1 | /*****************************************************************************/ |
2 | /* That code is placed under the GNU General Public Licence (GPL) */ |
|
|
3 | /* (C)2001-2005 by Chachkoff Yann (Feel free to deliver your complaints) */ |
|
|
4 | /*****************************************************************************/ |
|
|
5 | /* CrossFire, A Multiplayer game for X-windows */ |
2 | /* CrossFire, A Multiplayer game for the X Window System */ |
6 | /* */ |
|
|
7 | /* Copyright (C) 2000 Mark Wedel */ |
|
|
8 | /* Copyright (C) 1992 Frank Tore Johansen */ |
|
|
9 | /* Copyright (C) 2006 perl plugin by Marc Lehmann <cf@schmorpd.e> */ |
|
|
10 | /* */ |
|
|
11 | /* This program is free software; you can redistribute it and/or modify */ |
|
|
12 | /* it under the terms of the GNU General Public License as published by */ |
|
|
13 | /* the Free Software Foundation; either version 2 of the License, or */ |
|
|
14 | /* (at your option) any later version. */ |
|
|
15 | /* */ |
|
|
16 | /* This program is distributed in the hope that it will be useful, */ |
|
|
17 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
|
|
18 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
|
|
19 | /* GNU General Public License for more details. */ |
|
|
20 | /* */ |
|
|
21 | /* You should have received a copy of the GNU General Public License */ |
|
|
22 | /* along with this program; if not, write to the Free Software */ |
|
|
23 | /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
|
|
24 | /* */ |
3 | /* */ |
25 | /*****************************************************************************/ |
4 | /*****************************************************************************/ |
|
|
5 | |
|
|
6 | /* |
|
|
7 | * This code is placed under the GNU General Public Licence (GPL) |
|
|
8 | * |
|
|
9 | * Copyright (C) 2001-2005 by Chachkoff Yann |
|
|
10 | * Copyright (C) 2006 by Marc Lehmann <cf@schmorpd.e> |
|
|
11 | * |
|
|
12 | * This program is free software; you can redistribute it and/or modify |
|
|
13 | * it under the terms of the GNU General Public License as published by |
|
|
14 | * the Free Software Foundation; either version 2 of the License, or |
|
|
15 | * (at your option) any later version. |
|
|
16 | * |
|
|
17 | * This program is distributed in the hope that it will be useful, |
|
|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
20 | * GNU General Public License for more details. |
|
|
21 | * |
|
|
22 | * You should have received a copy of the GNU General Public License |
|
|
23 | * along with this program; if not, write to the Free Software |
|
|
24 | * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
|
25 | */ |
26 | |
26 | |
27 | #include <EXTERN.h> |
27 | #include <EXTERN.h> |
28 | #include <perl.h> |
28 | #include <perl.h> |
29 | #include <XSUB.h> |
29 | #include <XSUB.h> |
30 | |
30 | |
… | |
… | |
51 | |
51 | |
52 | static f_plug_api gethook; |
52 | static f_plug_api gethook; |
53 | static f_plug_api registerGlobalEvent; |
53 | static f_plug_api registerGlobalEvent; |
54 | static f_plug_api unregisterGlobalEvent; |
54 | static f_plug_api unregisterGlobalEvent; |
55 | static f_plug_api systemDirectory; |
55 | static f_plug_api systemDirectory; |
56 | static f_plug_api reCmp; |
|
|
57 | |
56 | |
58 | typedef struct |
57 | typedef struct |
59 | { |
58 | { |
60 | object* who; |
59 | object* who; |
61 | object* activator; |
60 | object* activator; |
… | |
… | |
129 | case CFAPI_DOUBLE: |
128 | case CFAPI_DOUBLE: |
130 | sv = newSViv (*va_arg (args, double *)); |
129 | sv = newSViv (*va_arg (args, double *)); |
131 | break; |
130 | break; |
132 | |
131 | |
133 | case CFAPI_STRING: |
132 | case CFAPI_STRING: |
134 | sv = newSVpv (va_arg (args, char *), 0); |
133 | { |
|
|
134 | char *str = va_arg (args, char *); |
|
|
135 | sv = str ? newSVpv (str, 0) : &PL_sv_undef; |
|
|
136 | } |
135 | break; |
137 | break; |
136 | |
138 | |
137 | case CFAPI_POBJECT: |
139 | case CFAPI_POBJECT: |
138 | { |
140 | { |
139 | object *obj = va_arg (args, object *); |
141 | object *obj = va_arg (args, object *); |
… | |
… | |
157 | } |
159 | } |
158 | } |
160 | } |
159 | break; |
161 | break; |
160 | |
162 | |
161 | case CFAPI_PMAP: |
163 | case CFAPI_PMAP: |
162 | sv = newSVptr (va_arg (args, object *), "cf::map"); |
164 | sv = newSVptr (va_arg (args, mapstruct *), "cf::map"); |
163 | break; |
165 | break; |
164 | |
166 | |
165 | case CFAPI_PPLAYER: |
167 | case CFAPI_PPLAYER: |
166 | sv = newSVptr (va_arg (args, object *), "cf::player"); |
168 | sv = newSVptr (va_arg (args, player *), "cf::player"); |
167 | break; |
169 | break; |
168 | |
170 | |
169 | case CFAPI_PARCH: |
171 | case CFAPI_PARCH: |
170 | sv = newSVptr (va_arg (args, object *), "cf::arch"); |
172 | sv = newSVptr (va_arg (args, archetype *), "cf::arch"); |
171 | break; |
173 | break; |
172 | |
174 | |
173 | case CFAPI_PPARTY: |
175 | case CFAPI_PPARTY: |
174 | sv = newSVptr (va_arg (args, object *), "cf::party"); |
176 | sv = newSVptr (va_arg (args, partylist *), "cf::party"); |
175 | break; |
177 | break; |
176 | |
178 | |
177 | case CFAPI_PREGION: |
179 | case CFAPI_PREGION: |
178 | sv = newSVptr (va_arg (args, object *), "cf::region"); |
180 | sv = newSVptr (va_arg (args, region *), "cf::region"); |
179 | break; |
181 | break; |
180 | |
182 | |
181 | default: |
183 | default: |
182 | assert (("unhandled type in newSVcfapi", 0)); |
184 | assert (("unhandled type in newSVcfapi", 0)); |
183 | } |
185 | } |
… | |
… | |
216 | |
218 | |
217 | PUTBACK; |
219 | PUTBACK; |
218 | int count = call_pv ("cf::inject_event", G_SCALAR | G_EVAL); |
220 | int count = call_pv ("cf::inject_event", G_SCALAR | G_EVAL); |
219 | SPAGAIN; |
221 | SPAGAIN; |
220 | |
222 | |
|
|
223 | if (SvTRUE (ERRSV)) |
|
|
224 | LOG (llevError, "event '%d' callback evaluation error: %s", context->event_code, SvPV_nolen (ERRSV)); |
|
|
225 | |
221 | context->returnvalue = count > 0 ? POPi : 0; |
226 | context->returnvalue = count > 0 ? POPi : 0; |
222 | |
227 | |
223 | PUTBACK; |
228 | PUTBACK; |
224 | FREETMPS; |
229 | FREETMPS; |
225 | LEAVE; |
230 | LEAVE; |
226 | |
|
|
227 | if (SvTRUE (ERRSV)) |
|
|
228 | LOG (llevError, "event '%d' callback evaluation error: %s", context->event_code, SvPV_nolen (ERRSV)); |
|
|
229 | } |
231 | } |
230 | |
232 | |
231 | ///////////////////////////////////////////////////////////////////////////// |
233 | ///////////////////////////////////////////////////////////////////////////// |
232 | |
234 | |
233 | int |
235 | int |
… | |
… | |
260 | |
262 | |
261 | PUTBACK; |
263 | PUTBACK; |
262 | int count = call_pv ("cf::inject_command", G_SCALAR | G_EVAL); |
264 | int count = call_pv ("cf::inject_command", G_SCALAR | G_EVAL); |
263 | SPAGAIN; |
265 | SPAGAIN; |
264 | |
266 | |
|
|
267 | if (SvTRUE (ERRSV)) |
|
|
268 | LOG (llevError, "command '%s' callback evaluation error: %s", rtn_cmd.name, SvPV_nolen (ERRSV)); |
|
|
269 | |
265 | int returnvalue = count > 0 ? POPi : -1; |
270 | int returnvalue = count > 0 ? POPi : -1; |
266 | |
271 | |
267 | PUTBACK; |
272 | PUTBACK; |
268 | FREETMPS; |
273 | FREETMPS; |
269 | LEAVE; |
274 | LEAVE; |
270 | |
|
|
271 | if (SvTRUE (ERRSV)) |
|
|
272 | LOG (llevError, "command '%s' callback evaluation error: %s", rtn_cmd.name, SvPV_nolen (ERRSV)); |
|
|
273 | |
275 | |
274 | return returnvalue; |
276 | return returnvalue; |
275 | } |
277 | } |
276 | |
278 | |
277 | void * |
279 | void * |
… | |
… | |
281 | char *propname; |
283 | char *propname; |
282 | int i; |
284 | int i; |
283 | va_start (args, type); |
285 | va_start (args, type); |
284 | propname = va_arg (args, char *); |
286 | propname = va_arg (args, char *); |
285 | //printf ("Property name: %s\n", propname); |
287 | //printf ("Property name: %s\n", propname); |
286 | |
288 | |
287 | if (!strcmp (propname, "command?")) |
289 | if (!strcmp (propname, "command?")) |
288 | { |
290 | { |
|
|
291 | if (!perl) |
|
|
292 | return NULL; |
|
|
293 | |
289 | const char *cmdname = va_arg (args, const char *); |
294 | const char *cmdname = va_arg (args, const char *); |
290 | HV *hv = get_hv ("cf::COMMAND", 1); |
295 | HV *hv = get_hv ("cf::COMMAND", 1); |
291 | SV **svp = hv_fetch (hv, cmdname, strlen (cmdname) + 1, 0); |
296 | SV **svp = hv_fetch (hv, cmdname, strlen (cmdname) + 1, 0); |
292 | |
297 | |
293 | va_end (args); |
298 | va_end (args); |
… | |
… | |
329 | printf (PLUGIN_VERSION " post init\n"); |
334 | printf (PLUGIN_VERSION " post init\n"); |
330 | |
335 | |
331 | registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); |
336 | registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); |
332 | unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); |
337 | unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); |
333 | systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); |
338 | systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); |
334 | reCmp = gethook (&rtype, hooktype, "cfapi_system_re_cmp"); |
|
|
335 | cf_init_plugin (gethook); |
339 | cf_init_plugin (gethook); |
336 | |
340 | |
337 | /* Pick the global events you want to monitor from this plugin */ |
341 | /* Pick the global events you want to monitor from this plugin */ |
338 | registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); |
342 | registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); |
339 | registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); |
343 | registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); |
… | |
… | |
354 | char *argv[] = { |
358 | char *argv[] = { |
355 | "", |
359 | "", |
356 | "-e" |
360 | "-e" |
357 | "BEGIN {" |
361 | "BEGIN {" |
358 | " cf->bootstrap;" |
362 | " cf->bootstrap;" |
359 | " unshift @INC, cf::maps_directory ('perl');" |
363 | " unshift @INC, cf::datadir ();" |
360 | "}" |
364 | "}" |
361 | "" |
365 | "" |
362 | "use cf;" |
366 | "use cf;" |
363 | }; |
367 | }; |
364 | |
368 | |
365 | perl = perl_alloc (); |
369 | perl = perl_alloc (); |
366 | perl_construct (perl); |
370 | perl_construct (perl); |
367 | |
371 | |
368 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) |
372 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
369 | || perl_run (perl)) |
|
|
370 | { |
373 | { |
371 | printf ("unable to initialize perl-interpreter, continuing without.\n"); |
374 | printf ("unable to initialize perl-interpreter, continuing without.\n"); |
372 | |
375 | |
373 | perl_destruct (perl); |
376 | perl_destruct (perl); |
374 | perl_free (perl); |
377 | perl_free (perl); |
… | |
… | |
540 | |
543 | |
541 | BOOT: |
544 | BOOT: |
542 | { |
545 | { |
543 | HV *stash = gv_stashpv ("cf", 1); |
546 | HV *stash = gv_stashpv ("cf", 1); |
544 | |
547 | |
545 | const struct { |
548 | static const struct { |
546 | const char *name; |
549 | const char *name; |
547 | IV iv; |
550 | IV iv; |
548 | } *civ, const_iv[] = { |
551 | } *civ, const_iv[] = { |
549 | # define const_iv(name) { # name, (IV)name }, |
552 | # define const_iv(name) { # name, (IV)name }, |
550 | const_iv (llevError) |
553 | const_iv (llevError) |
… | |
… | |
801 | const_iv (FLAG_IS_WATER) |
804 | const_iv (FLAG_IS_WATER) |
802 | const_iv (FLAG_CONTENT_ON_GEN) |
805 | const_iv (FLAG_CONTENT_ON_GEN) |
803 | const_iv (FLAG_IS_A_TEMPLATE) |
806 | const_iv (FLAG_IS_A_TEMPLATE) |
804 | const_iv (FLAG_IS_BUILDABLE) |
807 | const_iv (FLAG_IS_BUILDABLE) |
805 | const_iv (FLAG_AFK) |
808 | const_iv (FLAG_AFK) |
|
|
809 | |
|
|
810 | const_iv (NDI_BLACK) |
|
|
811 | const_iv (NDI_WHITE) |
|
|
812 | const_iv (NDI_NAVY) |
|
|
813 | const_iv (NDI_RED) |
|
|
814 | const_iv (NDI_ORANGE) |
|
|
815 | const_iv (NDI_BLUE) |
|
|
816 | const_iv (NDI_DK_ORANGE) |
|
|
817 | const_iv (NDI_GREEN) |
|
|
818 | const_iv (NDI_LT_GREEN) |
|
|
819 | const_iv (NDI_GREY) |
|
|
820 | const_iv (NDI_BROWN) |
|
|
821 | const_iv (NDI_GOLD) |
|
|
822 | const_iv (NDI_TAN) |
|
|
823 | const_iv (NDI_MAX_COLOR) |
|
|
824 | const_iv (NDI_COLOR_MASK) |
|
|
825 | const_iv (NDI_UNIQUE) |
|
|
826 | const_iv (NDI_ALL) |
|
|
827 | |
|
|
828 | const_iv (F_APPLIED) |
|
|
829 | const_iv (F_LOCATION) |
|
|
830 | const_iv (F_UNPAID) |
|
|
831 | const_iv (F_MAGIC) |
|
|
832 | const_iv (F_CURSED) |
|
|
833 | const_iv (F_DAMNED) |
|
|
834 | const_iv (F_OPEN) |
|
|
835 | const_iv (F_NOPICK) |
|
|
836 | const_iv (F_LOCKED) |
806 | }; |
837 | }; |
807 | |
838 | |
808 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
839 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
809 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
840 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
810 | |
841 | |
811 | const struct { |
842 | static const struct { |
812 | const char *name; |
843 | const char *name; |
813 | IV iv; |
844 | IV iv; |
814 | } *event, event_list[] = { |
845 | } *event, event_list[] = { |
815 | # define const_event(name) { # name, (IV)EVENT_ ## name }, |
846 | # define const_event(name) { # name, (IV)EVENT_ ## name }, |
816 | const_event (NONE) |
847 | const_event (NONE) |
… | |
… | |
847 | AV *av = get_av ("cf::EVENT", 1); |
878 | AV *av = get_av ("cf::EVENT", 1); |
848 | |
879 | |
849 | for (event = event_list + sizeof (event_list) / sizeof (event_list [0]); event-- > event_list; ) |
880 | for (event = event_list + sizeof (event_list) / sizeof (event_list [0]); event-- > event_list; ) |
850 | av_store (av, event->iv, newSVpv ((char *)event->name, 0)); |
881 | av_store (av, event->iv, newSVpv ((char *)event->name, 0)); |
851 | |
882 | |
852 | const struct { |
883 | static const struct { |
853 | int dtype; |
884 | int dtype; |
854 | const char *name; |
885 | const char *name; |
855 | IV idx; |
886 | IV idx; |
856 | } *cprop, prop_table[] = { |
887 | } *cprop, prop_table[] = { |
857 | # define prop(type, name) { type, # name, (IV) CFAPI_ ## name }, |
888 | # define prop(type, name) { type, # name, (IV) CFAPI_ ## name }, |
… | |
… | |
973 | prop (CFAPI_INT, OBJECT_PROP_DAM) |
1004 | prop (CFAPI_INT, OBJECT_PROP_DAM) |
974 | prop (CFAPI_STRING, OBJECT_PROP_GOD) |
1005 | prop (CFAPI_STRING, OBJECT_PROP_GOD) |
975 | prop (CFAPI_STRING, OBJECT_PROP_ARCH_NAME) |
1006 | prop (CFAPI_STRING, OBJECT_PROP_ARCH_NAME) |
976 | prop (CFAPI_INT, OBJECT_PROP_INVISIBLE) |
1007 | prop (CFAPI_INT, OBJECT_PROP_INVISIBLE) |
977 | prop (CFAPI_INT, OBJECT_PROP_FACE) |
1008 | prop (CFAPI_INT, OBJECT_PROP_FACE) |
978 | prop (CFAPI_STRING, PLAYER_PROP_IP) |
|
|
979 | prop (CFAPI_POBJECT, PLAYER_PROP_MARKED_ITEM) |
|
|
980 | prop (CFAPI_PPARTY, PLAYER_PROP_PARTY) |
|
|
981 | }; |
1009 | }; |
982 | |
1010 | |
983 | HV *prop_type = get_hv ("cf::PROP_TYPE", 1); |
1011 | HV *prop_type = get_hv ("cf::PROP_TYPE", 1); |
984 | HV *prop_idx = get_hv ("cf::PROP_IDX", 1); |
1012 | HV *prop_idx = get_hv ("cf::PROP_IDX", 1); |
985 | |
1013 | |
… | |
… | |
990 | } |
1018 | } |
991 | } |
1019 | } |
992 | |
1020 | |
993 | void |
1021 | void |
994 | LOG (int level, char *msg) |
1022 | LOG (int level, char *msg) |
|
|
1023 | PROTOTYPE: $$ |
995 | C_ARGS: level, "%s", msg |
1024 | C_ARGS: level, "%s", msg |
996 | |
1025 | |
997 | char * |
1026 | char * |
998 | cf_get_maps_directory (char *path) |
1027 | cf_get_maps_directory (char *path) |
|
|
1028 | PROTOTYPE: $ |
999 | ALIAS: maps_directory = 0 |
1029 | ALIAS: maps_directory = 0 |
1000 | |
1030 | |
|
|
1031 | char * |
|
|
1032 | mapdir () |
|
|
1033 | PROTOTYPE: |
|
|
1034 | ALIAS: |
|
|
1035 | mapdir = 0 |
|
|
1036 | uniquedir = 1 |
|
|
1037 | tmpdir = 2 |
|
|
1038 | confdir = 3 |
|
|
1039 | localdir = 4 |
|
|
1040 | playerdir = 5 |
|
|
1041 | datadir = 6 |
|
|
1042 | CODE: |
|
|
1043 | { |
|
|
1044 | int unused_type; |
|
|
1045 | RETVAL = (char *)systemDirectory (&unused_type, ix); |
|
|
1046 | } |
|
|
1047 | OUTPUT: RETVAL |
|
|
1048 | |
|
|
1049 | int |
|
|
1050 | cf_find_animation (char *text) |
|
|
1051 | PROTOTYPE: $ |
|
|
1052 | |
1001 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1053 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1002 | |
1054 | |
1003 | PROTOTYPES: DISABLE |
|
|
1004 | |
|
|
1005 | SV * |
1055 | SV * |
1006 | cf_object_get_property (object *obj, int type, int idx) |
1056 | get_property (object *obj, int type, int idx) |
1007 | CODE: |
1057 | CODE: |
1008 | RETVAL = newSVcfapi (type, cf_object_get_property (obj, idx)); |
1058 | RETVAL = newSVcfapi (type, cf_object_get_property (obj, idx)); |
1009 | OUTPUT: |
1059 | OUTPUT: RETVAL |
1010 | RETVAL |
1060 | |
|
|
1061 | SV * |
|
|
1062 | set_property (object *obj, int type, int idx, SV *newval) |
|
|
1063 | CODE: |
|
|
1064 | switch (type) |
|
|
1065 | { |
|
|
1066 | case CFAPI_INT: |
|
|
1067 | cf_object_set_int_property (obj, idx, SvIV (newval)); |
|
|
1068 | break; |
|
|
1069 | case CFAPI_LONG: |
|
|
1070 | cf_object_set_long_property (obj, idx, SvNV (newval)); |
|
|
1071 | break; |
|
|
1072 | case CFAPI_STRING: |
|
|
1073 | cf_object_set_string_property (obj, idx, SvPV_nolen (newval)); |
|
|
1074 | break; |
|
|
1075 | default: |
|
|
1076 | croak ("unhandled type '%d' in set_property '%d'", type, idx); |
|
|
1077 | } |
1011 | |
1078 | |
1012 | int cf_object_get_resistance (object *op, int rtype) |
1079 | int cf_object_get_resistance (object *op, int rtype) |
1013 | ALIAS: resistance = 0 |
1080 | ALIAS: resistance = 0 |
1014 | |
1081 | |
1015 | int cf_object_get_flag (object *op, int flag) |
1082 | int cf_object_get_flag (object *op, int flag) |
… | |
… | |
1089 | |
1156 | |
1090 | char * |
1157 | char * |
1091 | base_name (object *ob, int plural) |
1158 | base_name (object *ob, int plural) |
1092 | CODE: |
1159 | CODE: |
1093 | RETVAL = cf_query_base_name (ob, plural); |
1160 | RETVAL = cf_query_base_name (ob, plural); |
|
|
1161 | OUTPUT: RETVAL |
|
|
1162 | |
|
|
1163 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
|
|
1164 | |
|
|
1165 | object *cf_create_object_by_name (const char *name = 0) |
|
|
1166 | PROTOTYPE: ;$ |
|
|
1167 | ALIAS: |
|
|
1168 | create_object = 0 |
|
|
1169 | new = 0 |
|
|
1170 | CODE: |
|
|
1171 | RETVAL = name ? cf_create_object_by_name (name) : cf_create_object (); |
1094 | OUTPUT: |
1172 | OUTPUT: |
1095 | RETVAL |
1173 | RETVAL |
1096 | |
|
|
1097 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
|
|
1098 | |
|
|
1099 | object *cf_create_object () |
|
|
1100 | ALIAS: new = 0 |
|
|
1101 | |
|
|
1102 | object *cf_create_object_by_name (const char *name) |
|
|
1103 | ALIAS: new_from_name = 0 |
|
|
1104 | |
|
|
1105 | void cf_free_object (object *ob) |
|
|
1106 | |
1174 | |
1107 | void cf_fix_object (object *pl) |
1175 | void cf_fix_object (object *pl) |
|
|
1176 | ALIAS: fix = 0 |
1108 | |
1177 | |
1109 | object *cf_insert_ob_in_ob (object *ob, object *where) |
1178 | object *cf_insert_ob_in_ob (object *ob, object *where) |
1110 | |
1179 | |
1111 | |
1180 | |
1112 | MODULE = cf PACKAGE = cf::object::player PREFIX = cf_player_ |
1181 | MODULE = cf PACKAGE = cf::object::player PREFIX = cf_player_ |
1113 | |
1182 | |
1114 | player *player (object *op) |
1183 | player *player (object *op) |
1115 | CODE: |
1184 | CODE: |
1116 | RETVAL = cf_player_find (cf_query_name (op)); |
1185 | RETVAL = cf_player_find (cf_query_name (op)); |
1117 | OUTPUT: |
1186 | OUTPUT: RETVAL |
1118 | RETVAL |
|
|
1119 | |
1187 | |
1120 | void cf_player_message (object *obj, char *txt, int flags = 0) |
1188 | void cf_player_message (object *obj, char *txt, int flags = NDI_ORANGE | NDI_UNIQUE) |
1121 | |
1189 | |
1122 | object *cf_player_send_inventory (object *op) |
1190 | object *cf_player_send_inventory (object *op) |
1123 | |
1191 | |
|
|
1192 | char *cf_player_get_ip (object *op) |
|
|
1193 | ALIAS: ip = 0 |
|
|
1194 | |
|
|
1195 | object *cf_player_get_marked_item (object *op) |
|
|
1196 | ALIAS: marked_item = 0 |
|
|
1197 | |
|
|
1198 | void cf_player_set_marked_item (object *op, object *ob) |
|
|
1199 | |
|
|
1200 | partylist *cf_player_get_party (object *op) |
|
|
1201 | ALIAS: party = 0 |
|
|
1202 | |
|
|
1203 | void cf_player_set_party (object *op, partylist *party) |
|
|
1204 | |
1124 | |
1205 | |
1125 | MODULE = cf PACKAGE = cf::object::map PREFIX = cf_ |
1206 | MODULE = cf PACKAGE = cf::object::map PREFIX = cf_ |
1126 | |
1207 | |
1127 | mapstruct *cf_map_get_map (char *name) |
|
|
1128 | ALIAS: map = 0 |
|
|
1129 | |
|
|
1130 | mapstruct *cf_map_get_first () |
|
|
1131 | ALIAS: first = 0 |
|
|
1132 | |
|
|
1133 | object *cf_map_insert_object_there (mapstruct *where, object *op, object *originator, int flags) |
|
|
1134 | |
|
|
1135 | object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) |
|
|
1136 | |
|
|
1137 | object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
|
|
1138 | C_ARGS: str, map, nx, ny |
|
|
1139 | |
|
|
1140 | #int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny) |
|
|
1141 | |
|
|
1142 | |
|
|
1143 | MODULE = cf PACKAGE = cf::player PREFIX = cf_ |
1208 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
1144 | |
1209 | |
1145 | player *cf_player_find (char *name) |
1210 | player *cf_player_find (char *name) |
|
|
1211 | PROTOTYPE: $ |
1146 | |
1212 | |
1147 | void cf_player_move (player *pl, int dir) |
1213 | void cf_player_move (player *pl, int dir) |
1148 | |
1214 | |
|
|
1215 | # nonstandard |
|
|
1216 | object *ob (player *pl) |
|
|
1217 | CODE: |
|
|
1218 | RETVAL = pl->ob; |
|
|
1219 | OUTPUT: RETVAL |
1149 | |
1220 | |
|
|
1221 | |
1150 | MODULE = cf PACKAGE = cf::map PREFIX = cf_ |
1222 | MODULE = cf PACKAGE = cf::map PREFIX = cf_map_ |
1151 | |
1223 | |
1152 | SV * |
1224 | SV * |
1153 | get_property (mapstruct *obj, int type, int idx) |
1225 | get_property (mapstruct *obj, int type, int idx) |
1154 | CODE: |
1226 | CODE: |
1155 | RETVAL = newSVcfapi (type, cf_map_get_property (obj, idx)); |
1227 | RETVAL = newSVcfapi (type, cf_map_get_property (obj, idx)); |
1156 | OUTPUT: |
1228 | OUTPUT: RETVAL |
1157 | RETVAL |
1229 | |
|
|
1230 | SV * |
|
|
1231 | set_property (mapstruct *obj, int type, int idx, SV *newval) |
|
|
1232 | CODE: |
|
|
1233 | switch (type) |
|
|
1234 | { |
|
|
1235 | case CFAPI_INT: |
|
|
1236 | cf_map_set_int_property (obj, idx, SvIV (newval)); |
|
|
1237 | break; |
|
|
1238 | default: |
|
|
1239 | croak ("unhandled type '%d' in set_property '%d'", type, idx); |
|
|
1240 | } |
|
|
1241 | |
|
|
1242 | mapstruct *cf_map_get_map (char *name) |
|
|
1243 | PROTOTYPE: $ |
|
|
1244 | ALIAS: map = 0 |
|
|
1245 | |
|
|
1246 | mapstruct *cf_map_get_first () |
|
|
1247 | PROTOTYPE: |
|
|
1248 | ALIAS: first = 0 |
|
|
1249 | |
|
|
1250 | object *cf_map_insert_object_there (mapstruct *where, object *op, object *originator, int flags) |
|
|
1251 | |
|
|
1252 | object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) |
|
|
1253 | |
|
|
1254 | object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
|
|
1255 | C_ARGS: str, map, nx, ny |
|
|
1256 | |
|
|
1257 | #int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny) |
|
|
1258 | |
1158 | |
1259 | |
1159 | |
1260 | |
1160 | MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_ |
1261 | MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_ |
1161 | |
1262 | |
1162 | archetype*cf_archetype_get_first() |
1263 | archetype*cf_archetype_get_first() |
|
|
1264 | PROTOTYPE: |
1163 | ALIAS: first = 0 |
1265 | ALIAS: first = 0 |
1164 | |
1266 | |
1165 | archetype *cf_archetype_get_next (archetype *arch) |
1267 | archetype *cf_archetype_get_next (archetype *arch) |
1166 | ALIAS: next = 0 |
1268 | ALIAS: next = 0 |
1167 | |
1269 | |
… | |
… | |
1174 | const char *cf_archetype_get_name (archetype *arch) |
1276 | const char *cf_archetype_get_name (archetype *arch) |
1175 | ALIAS: name = 0 |
1277 | ALIAS: name = 0 |
1176 | |
1278 | |
1177 | MODULE = cf PACKAGE = cf::party PREFIX = cf_party_ |
1279 | MODULE = cf PACKAGE = cf::party PREFIX = cf_party_ |
1178 | |
1280 | |
1179 | const char *cf_party_get_name (partylist *party) |
|
|
1180 | |
|
|
1181 | partylist *cf_party_get_first () |
1281 | partylist *cf_party_get_first () |
|
|
1282 | PROTOTYPE: |
1182 | ALIAS: first = 0 |
1283 | ALIAS: first = 0 |
1183 | |
1284 | |
1184 | partylist *cf_party_get_next (partylist *party) |
1285 | partylist *cf_party_get_next (partylist *party) |
1185 | ALIAS: next = 0 |
1286 | ALIAS: next = 0 |
1186 | |
1287 | |
|
|
1288 | const char *cf_party_get_name (partylist *party) |
|
|
1289 | |
1187 | const char *cf_party_get_password (partylist *party) |
1290 | const char *cf_party_get_password (partylist *party) |
1188 | ALIAS: password = 0 |
1291 | ALIAS: password = 0 |
1189 | |
1292 | |
1190 | player *cf_party_get_first_player (partylist *party) |
1293 | player *cf_party_get_first_player (partylist *party) |
1191 | ALIAS: first_player = 0 |
1294 | ALIAS: first_player = 0 |
… | |
… | |
1195 | |
1298 | |
1196 | |
1299 | |
1197 | MODULE = cf PACKAGE = cf::region PREFIX = cf_region_ |
1300 | MODULE = cf PACKAGE = cf::region PREFIX = cf_region_ |
1198 | |
1301 | |
1199 | region *cf_region_get_first () |
1302 | region *cf_region_get_first () |
|
|
1303 | PROTOTYPE: |
1200 | ALIAS: first = 0 |
1304 | ALIAS: first = 0 |
1201 | |
1305 | |
1202 | const char *cf_region_get_name (region *reg) |
1306 | const char *cf_region_get_name (region *reg) |
1203 | ALIAS: name = 0 |
1307 | ALIAS: name = 0 |
1204 | |
1308 | |