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

Comparing deliantra/server/plugins/cfperl/cfperl.xs (file contents):
Revision 1.5 by root, Fri Feb 3 19:49:32 2006 UTC vs.
Revision 1.11 by root, Tue Feb 7 00:56:00 2006 UTC

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
52static f_plug_api gethook; 52static f_plug_api gethook;
53static f_plug_api registerGlobalEvent; 53static f_plug_api registerGlobalEvent;
54static f_plug_api unregisterGlobalEvent; 54static f_plug_api unregisterGlobalEvent;
55static f_plug_api systemDirectory; 55static f_plug_api systemDirectory;
56static f_plug_api object_set_property;
57static f_plug_api map_get_map;
56 58
57typedef struct 59typedef struct
58{ 60{
59 object* who; 61 object* who;
60 object* activator; 62 object* activator;
128 case CFAPI_DOUBLE: 130 case CFAPI_DOUBLE:
129 sv = newSViv (*va_arg (args, double *)); 131 sv = newSViv (*va_arg (args, double *));
130 break; 132 break;
131 133
132 case CFAPI_STRING: 134 case CFAPI_STRING:
133 sv = newSVpv (va_arg (args, char *), 0); 135 {
136 char *str = va_arg (args, char *);
137 sv = str ? newSVpv (str, 0) : &PL_sv_undef;
138 }
134 break; 139 break;
135 140
136 case CFAPI_POBJECT: 141 case CFAPI_POBJECT:
137 { 142 {
138 object *obj = va_arg (args, object *); 143 object *obj = va_arg (args, object *);
156 } 161 }
157 } 162 }
158 break; 163 break;
159 164
160 case CFAPI_PMAP: 165 case CFAPI_PMAP:
161 sv = newSVptr (va_arg (args, object *), "cf::map"); 166 sv = newSVptr (va_arg (args, mapstruct *), "cf::map");
162 break; 167 break;
163 168
164 case CFAPI_PPLAYER: 169 case CFAPI_PPLAYER:
165 sv = newSVptr (va_arg (args, object *), "cf::player"); 170 sv = newSVptr (va_arg (args, player *), "cf::player");
166 break; 171 break;
167 172
168 case CFAPI_PARCH: 173 case CFAPI_PARCH:
169 sv = newSVptr (va_arg (args, object *), "cf::arch"); 174 sv = newSVptr (va_arg (args, archetype *), "cf::arch");
170 break; 175 break;
171 176
172 case CFAPI_PPARTY: 177 case CFAPI_PPARTY:
173 sv = newSVptr (va_arg (args, object *), "cf::party"); 178 sv = newSVptr (va_arg (args, partylist *), "cf::party");
174 break; 179 break;
175 180
176 case CFAPI_PREGION: 181 case CFAPI_PREGION:
177 sv = newSVptr (va_arg (args, object *), "cf::region"); 182 sv = newSVptr (va_arg (args, region *), "cf::region");
178 break; 183 break;
179 184
180 default: 185 default:
181 assert (("unhandled type in newSVcfapi", 0)); 186 assert (("unhandled type in newSVcfapi", 0));
182 } 187 }
215 220
216 PUTBACK; 221 PUTBACK;
217 int count = call_pv ("cf::inject_event", G_SCALAR | G_EVAL); 222 int count = call_pv ("cf::inject_event", G_SCALAR | G_EVAL);
218 SPAGAIN; 223 SPAGAIN;
219 224
225 if (SvTRUE (ERRSV))
226 LOG (llevError, "event '%d' callback evaluation error: %s", context->event_code, SvPV_nolen (ERRSV));
227
220 context->returnvalue = count > 0 ? POPi : 0; 228 context->returnvalue = count > 0 ? POPi : 0;
221 229
222 PUTBACK; 230 PUTBACK;
223 FREETMPS; 231 FREETMPS;
224 LEAVE; 232 LEAVE;
225
226 if (SvTRUE (ERRSV))
227 LOG (llevError, "event '%d' callback evaluation error: %s", context->event_code, SvPV_nolen (ERRSV));
228} 233}
229 234
230///////////////////////////////////////////////////////////////////////////// 235/////////////////////////////////////////////////////////////////////////////
231 236
232int 237int
259 264
260 PUTBACK; 265 PUTBACK;
261 int count = call_pv ("cf::inject_command", G_SCALAR | G_EVAL); 266 int count = call_pv ("cf::inject_command", G_SCALAR | G_EVAL);
262 SPAGAIN; 267 SPAGAIN;
263 268
269 if (SvTRUE (ERRSV))
270 LOG (llevError, "command '%s' callback evaluation error: %s", rtn_cmd.name, SvPV_nolen (ERRSV));
271
264 int returnvalue = count > 0 ? POPi : -1; 272 int returnvalue = count > 0 ? POPi : -1;
265 273
266 PUTBACK; 274 PUTBACK;
267 FREETMPS; 275 FREETMPS;
268 LEAVE; 276 LEAVE;
269
270 if (SvTRUE (ERRSV))
271 LOG (llevError, "command '%s' callback evaluation error: %s", rtn_cmd.name, SvPV_nolen (ERRSV));
272 277
273 return returnvalue; 278 return returnvalue;
274} 279}
275 280
276void * 281void *
331 printf (PLUGIN_VERSION " post init\n"); 336 printf (PLUGIN_VERSION " post init\n");
332 337
333 registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); 338 registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event");
334 unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); 339 unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event");
335 systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); 340 systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory");
341 object_set_property = gethook (&rtype, hooktype, "cfapi_object_set_property");
342 map_get_map = gethook (&rtype, hooktype, "cfapi_map_get_map");
343
336 cf_init_plugin (gethook); 344 cf_init_plugin (gethook);
337 345
338 /* Pick the global events you want to monitor from this plugin */ 346 /* Pick the global events you want to monitor from this plugin */
339 registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); 347 registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener);
340 registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); 348 registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener);
540 548
541BOOT: 549BOOT:
542{ 550{
543 HV *stash = gv_stashpv ("cf", 1); 551 HV *stash = gv_stashpv ("cf", 1);
544 552
545 const struct { 553 static const struct {
546 const char *name; 554 const char *name;
547 IV iv; 555 IV iv;
548 } *civ, const_iv[] = { 556 } *civ, const_iv[] = {
549# define const_iv(name) { # name, (IV)name }, 557# define const_iv(name) { # name, (IV)name },
550 const_iv (llevError) 558 const_iv (llevError)
801 const_iv (FLAG_IS_WATER) 809 const_iv (FLAG_IS_WATER)
802 const_iv (FLAG_CONTENT_ON_GEN) 810 const_iv (FLAG_CONTENT_ON_GEN)
803 const_iv (FLAG_IS_A_TEMPLATE) 811 const_iv (FLAG_IS_A_TEMPLATE)
804 const_iv (FLAG_IS_BUILDABLE) 812 const_iv (FLAG_IS_BUILDABLE)
805 const_iv (FLAG_AFK) 813 const_iv (FLAG_AFK)
814
815 const_iv (NDI_BLACK)
816 const_iv (NDI_WHITE)
817 const_iv (NDI_NAVY)
818 const_iv (NDI_RED)
819 const_iv (NDI_ORANGE)
820 const_iv (NDI_BLUE)
821 const_iv (NDI_DK_ORANGE)
822 const_iv (NDI_GREEN)
823 const_iv (NDI_LT_GREEN)
824 const_iv (NDI_GREY)
825 const_iv (NDI_BROWN)
826 const_iv (NDI_GOLD)
827 const_iv (NDI_TAN)
828 const_iv (NDI_MAX_COLOR)
829 const_iv (NDI_COLOR_MASK)
830 const_iv (NDI_UNIQUE)
831 const_iv (NDI_ALL)
832
833 const_iv (F_APPLIED)
834 const_iv (F_LOCATION)
835 const_iv (F_UNPAID)
836 const_iv (F_MAGIC)
837 const_iv (F_CURSED)
838 const_iv (F_DAMNED)
839 const_iv (F_OPEN)
840 const_iv (F_NOPICK)
841 const_iv (F_LOCKED)
842
843 const_iv (P_BLOCKSVIEW)
844 const_iv (P_NO_MAGIC)
845 const_iv (P_IS_ALIVE)
846 const_iv (P_NO_CLERIC)
847 const_iv (P_NEED_UPDATE)
848 const_iv (P_NO_ERROR)
849 const_iv (P_OUT_OF_MAP)
850 const_iv (P_NEW_MAP)
806 }; 851 };
807 852
808 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 853 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
809 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 854 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
810 855
811 const struct { 856 static const struct {
812 const char *name; 857 const char *name;
813 IV iv; 858 IV iv;
814 } *event, event_list[] = { 859 } *event, event_list[] = {
815# define const_event(name) { # name, (IV)EVENT_ ## name }, 860# define const_event(name) { # name, (IV)EVENT_ ## name },
816 const_event (NONE) 861 const_event (NONE)
847 AV *av = get_av ("cf::EVENT", 1); 892 AV *av = get_av ("cf::EVENT", 1);
848 893
849 for (event = event_list + sizeof (event_list) / sizeof (event_list [0]); event-- > event_list; ) 894 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)); 895 av_store (av, event->iv, newSVpv ((char *)event->name, 0));
851 896
852 const struct { 897 static const struct {
853 int dtype; 898 int dtype;
854 const char *name; 899 const char *name;
855 IV idx; 900 IV idx;
856 } *cprop, prop_table[] = { 901 } *cprop, prop_table[] = {
857# define prop(type, name) { type, # name, (IV) CFAPI_ ## name }, 902# define prop(type, name) { type, # name, (IV) CFAPI_ ## name },
973 prop (CFAPI_INT, OBJECT_PROP_DAM) 1018 prop (CFAPI_INT, OBJECT_PROP_DAM)
974 prop (CFAPI_STRING, OBJECT_PROP_GOD) 1019 prop (CFAPI_STRING, OBJECT_PROP_GOD)
975 prop (CFAPI_STRING, OBJECT_PROP_ARCH_NAME) 1020 prop (CFAPI_STRING, OBJECT_PROP_ARCH_NAME)
976 prop (CFAPI_INT, OBJECT_PROP_INVISIBLE) 1021 prop (CFAPI_INT, OBJECT_PROP_INVISIBLE)
977 prop (CFAPI_INT, OBJECT_PROP_FACE) 1022 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 }; 1023 };
982 1024
983 HV *prop_type = get_hv ("cf::PROP_TYPE", 1); 1025 HV *prop_type = get_hv ("cf::PROP_TYPE", 1);
984 HV *prop_idx = get_hv ("cf::PROP_IDX", 1); 1026 HV *prop_idx = get_hv ("cf::PROP_IDX", 1);
985 1027
990 } 1032 }
991} 1033}
992 1034
993void 1035void
994LOG (int level, char *msg) 1036LOG (int level, char *msg)
1037 PROTOTYPE: $$
995 C_ARGS: level, "%s", msg 1038 C_ARGS: level, "%s", msg
996 1039
997char * 1040char *
998cf_get_maps_directory (char *path) 1041cf_get_maps_directory (char *path)
1042 PROTOTYPE: $
999 ALIAS: maps_directory = 0 1043 ALIAS: maps_directory = 0
1000 1044
1001char * 1045char *
1002mapdir () 1046mapdir ()
1047 PROTOTYPE:
1003 ALIAS: 1048 ALIAS:
1004 mapdir = 0 1049 mapdir = 0
1005 uniquedir = 1 1050 uniquedir = 1
1006 tmpdir = 2 1051 tmpdir = 2
1007 confdir = 3 1052 confdir = 3
1011 CODE: 1056 CODE:
1012{ 1057{
1013 int unused_type; 1058 int unused_type;
1014 RETVAL = (char *)systemDirectory (&unused_type, ix); 1059 RETVAL = (char *)systemDirectory (&unused_type, ix);
1015} 1060}
1016 OUTPUT: 1061 OUTPUT: RETVAL
1017 RETVAL
1018 1062
1019int 1063int
1020cf_find_animation (char *text) 1064cf_find_animation (char *text)
1065 PROTOTYPE: $
1021 1066
1022MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ 1067MODULE = cf PACKAGE = cf::object PREFIX = cf_object_
1023
1024PROTOTYPES: DISABLE
1025 1068
1026SV * 1069SV *
1027get_property (object *obj, int type, int idx) 1070get_property (object *obj, int type, int idx)
1028 CODE: 1071 CODE:
1029 RETVAL = newSVcfapi (type, cf_object_get_property (obj, idx)); 1072 RETVAL = newSVcfapi (type, cf_object_get_property (obj, idx));
1030 OUTPUT: 1073 OUTPUT: RETVAL
1031 RETVAL
1032 1074
1033SV * 1075SV *
1034set_property (object *obj, int type, int idx, SV *newval) 1076set_property (object *obj, int type, int idx, SV *newval)
1035 CODE: 1077 CODE:
1036 switch (type) 1078 switch (type)
1039 cf_object_set_int_property (obj, idx, SvIV (newval)); 1081 cf_object_set_int_property (obj, idx, SvIV (newval));
1040 break; 1082 break;
1041 case CFAPI_LONG: 1083 case CFAPI_LONG:
1042 cf_object_set_long_property (obj, idx, SvNV (newval)); 1084 cf_object_set_long_property (obj, idx, SvNV (newval));
1043 break; 1085 break;
1086 case CFAPI_DOUBLE:
1087 {
1088 int unused_type;
1089 object_set_property (&unused_type, obj, idx, (double)SvNV (newval));
1090 }
1091 break;
1044 case CFAPI_STRING: 1092 case CFAPI_STRING:
1045 cf_object_set_string_property (obj, idx, SvPV_nolen (newval)); 1093 cf_object_set_string_property (obj, idx, SvPV_nolen (newval));
1046 break; 1094 break;
1047 default: 1095 default:
1048 croak ("unhandled type '%d' in set_property '%d'", type, idx); 1096 croak ("unhandled type '%d' in set_property '%d'", type, idx);
1128 1176
1129char * 1177char *
1130base_name (object *ob, int plural) 1178base_name (object *ob, int plural)
1131 CODE: 1179 CODE:
1132 RETVAL = cf_query_base_name (ob, plural); 1180 RETVAL = cf_query_base_name (ob, plural);
1181 OUTPUT: RETVAL
1182
1183MODULE = cf PACKAGE = cf::object PREFIX = cf_object_
1184
1185object *cf_create_object_by_name (const char *name = 0)
1186 PROTOTYPE: ;$
1187 ALIAS:
1188 create_object = 0
1189 new = 0
1190 CODE:
1191 RETVAL = name ? cf_create_object_by_name (name) : cf_create_object ();
1133 OUTPUT: 1192 OUTPUT:
1134 RETVAL 1193 RETVAL
1135
1136MODULE = cf PACKAGE = cf::object PREFIX = cf_object_
1137
1138object *cf_create_object ()
1139 ALIAS: new = 0
1140
1141object *cf_create_object_by_name (const char *name)
1142 ALIAS: new_from_name = 0
1143
1144void cf_free_object (object *ob)
1145 1194
1146void cf_fix_object (object *pl) 1195void cf_fix_object (object *pl)
1196 ALIAS: fix = 0
1147 1197
1148object *cf_insert_ob_in_ob (object *ob, object *where) 1198object *cf_insert_ob_in_ob (object *ob, object *where)
1149 1199
1150 1200
1151MODULE = cf PACKAGE = cf::object::player PREFIX = cf_player_ 1201MODULE = cf PACKAGE = cf::object::player PREFIX = cf_player_
1152 1202
1153player *player (object *op) 1203player *player (object *op)
1154 CODE: 1204 CODE:
1155 RETVAL = cf_player_find (cf_query_name (op)); 1205 RETVAL = cf_player_find (cf_query_name (op));
1156 OUTPUT: 1206 OUTPUT: RETVAL
1157 RETVAL
1158 1207
1159void cf_player_message (object *obj, char *txt, int flags = 0) 1208void cf_player_message (object *obj, char *txt, int flags = NDI_ORANGE | NDI_UNIQUE)
1160 1209
1161object *cf_player_send_inventory (object *op) 1210object *cf_player_send_inventory (object *op)
1162 1211
1212char *cf_player_get_ip (object *op)
1213 ALIAS: ip = 0
1214
1215object *cf_player_get_marked_item (object *op)
1216 ALIAS: marked_item = 0
1217
1163void cf_player_set_marked_item(object *op, object *ob) 1218void cf_player_set_marked_item (object *op, object *ob)
1164 1219
1220partylist *cf_player_get_party (object *op)
1221 ALIAS: party = 0
1222
1165void cf_player_set_party(object *op, partylist *party) 1223void cf_player_set_party (object *op, partylist *party)
1166 1224
1167 1225
1168MODULE = cf PACKAGE = cf::object::map PREFIX = cf_ 1226MODULE = cf PACKAGE = cf::object::map PREFIX = cf_
1169 1227
1170MODULE = cf PACKAGE = cf::player PREFIX = cf_ 1228MODULE = cf PACKAGE = cf::player PREFIX = cf_player_
1171 1229
1172player *cf_player_find (char *name) 1230player *cf_player_find (char *name)
1231 PROTOTYPE: $
1173 1232
1174void cf_player_move (player *pl, int dir) 1233void cf_player_move (player *pl, int dir)
1175 1234
1235# nonstandard
1236object *ob (player *pl)
1237 CODE:
1238 RETVAL = pl->ob;
1239 OUTPUT: RETVAL
1176 1240
1241
1177MODULE = cf PACKAGE = cf::map PREFIX = cf_ 1242MODULE = cf PACKAGE = cf::map PREFIX = cf_map_
1178 1243
1179SV * 1244SV *
1180get_property (mapstruct *obj, int type, int idx) 1245get_property (mapstruct *obj, int type, int idx)
1181 CODE: 1246 CODE:
1182 RETVAL = newSVcfapi (type, cf_map_get_property (obj, idx)); 1247 RETVAL = newSVcfapi (type, cf_map_get_property (obj, idx));
1183 OUTPUT: 1248 OUTPUT: RETVAL
1184 RETVAL
1185 1249
1186SV * 1250SV *
1187set_property (mapstruct *obj, int type, int idx, SV *newval) 1251set_property (mapstruct *obj, int type, int idx, SV *newval)
1188 CODE: 1252 CODE:
1189 switch (type) 1253 switch (type)
1193 break; 1257 break;
1194 default: 1258 default:
1195 croak ("unhandled type '%d' in set_property '%d'", type, idx); 1259 croak ("unhandled type '%d' in set_property '%d'", type, idx);
1196 } 1260 }
1197 1261
1262mapstruct *new (int width, int height)
1263 PROTOTYPE:
1264 CODE:
1265{
1266 int unused_type;
1267 RETVAL = map_get_map (&unused_type, 0, width, height);
1268}
1269 OUTPUT:
1270 RETVAL
1271
1198mapstruct *cf_map_get_map (char *name) 1272mapstruct *cf_map_get_map (char *name)
1273 PROTOTYPE: $
1199 ALIAS: map = 0 1274 ALIAS: map = 0
1200 1275
1201mapstruct *cf_map_get_first () 1276mapstruct *cf_map_get_first ()
1277 PROTOTYPE:
1202 ALIAS: first = 0 1278 ALIAS: first = 0
1203 1279
1204object *cf_map_insert_object_there (mapstruct *where, object *op, object *originator, int flags) 1280object *cf_map_insert_object_there (mapstruct *where, object *op, object *originator, int flags)
1205 1281
1206object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) 1282object *cf_map_insert_object (mapstruct *where, object* op, int x, int y)
1208object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) 1284object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny)
1209 C_ARGS: str, map, nx, ny 1285 C_ARGS: str, map, nx, ny
1210 1286
1211#int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny) 1287#int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny)
1212 1288
1289SV *at (mapstruct *obj, unsigned int x, unsigned int y)
1290 PROTOTYPE: $$$
1291 INIT:
1292 if (x >= MAP_WIDTH (obj) || y >= MAP_HEIGHT (obj)) XSRETURN_UNDEF;
1293 PPCODE:
1294{
1295 object *o;
1296 for (o = GET_MAP_OB (obj, x, y); o; o = o->above)
1297 XPUSHs (newSVcfapi (CFAPI_POBJECT, o));
1298}
1299
1300SV *bot_at (mapstruct *obj, unsigned int x, unsigned int y)
1301 PROTOTYPE: $$$
1302 ALIAS:
1303 top_at = 1
1304 flags_at = 2
1305 light_at = 3
1306 move_block_at = 4
1307 move_slow_at = 5
1308 move_on_at = 6
1309 move_off_at = 7
1310 INIT:
1311 if (x >= MAP_WIDTH (obj) || y >= MAP_HEIGHT (obj)) XSRETURN_UNDEF;
1312 CODE:
1313 switch (ix)
1314 {
1315 case 0: RETVAL = newSVcfapi (CFAPI_POBJECT, GET_MAP_OB (obj, x, y)); break;
1316 case 1: RETVAL = newSVcfapi (CFAPI_POBJECT, GET_MAP_TOP (obj, x, y)); break;
1317 case 2: RETVAL = newSVuv ( GET_MAP_FLAGS (obj, x, y)); break;
1318 case 3: RETVAL = newSViv ( GET_MAP_LIGHT (obj, x, y)); break;
1319 case 4: RETVAL = newSVuv ( GET_MAP_MOVE_BLOCK (obj, x, y)); break;
1320 case 5: RETVAL = newSVuv ( GET_MAP_MOVE_SLOW (obj, x, y)); break;
1321 case 6: RETVAL = newSVuv ( GET_MAP_MOVE_ON (obj, x, y)); break;
1322 case 7: RETVAL = newSVuv ( GET_MAP_MOVE_OFF (obj, x, y)); break;
1323 }
1324 OUTPUT:
1325 RETVAL
1213 1326
1214 1327
1215MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_ 1328MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_
1216 1329
1217archetype*cf_archetype_get_first() 1330archetype*cf_archetype_get_first()
1331 PROTOTYPE:
1218 ALIAS: first = 0 1332 ALIAS: first = 0
1219 1333
1220archetype *cf_archetype_get_next (archetype *arch) 1334archetype *cf_archetype_get_next (archetype *arch)
1221 ALIAS: next = 0 1335 ALIAS: next = 0
1222 1336
1229const char *cf_archetype_get_name (archetype *arch) 1343const char *cf_archetype_get_name (archetype *arch)
1230 ALIAS: name = 0 1344 ALIAS: name = 0
1231 1345
1232MODULE = cf PACKAGE = cf::party PREFIX = cf_party_ 1346MODULE = cf PACKAGE = cf::party PREFIX = cf_party_
1233 1347
1234const char *cf_party_get_name (partylist *party)
1235
1236partylist *cf_party_get_first () 1348partylist *cf_party_get_first ()
1349 PROTOTYPE:
1237 ALIAS: first = 0 1350 ALIAS: first = 0
1238 1351
1239partylist *cf_party_get_next (partylist *party) 1352partylist *cf_party_get_next (partylist *party)
1240 ALIAS: next = 0 1353 ALIAS: next = 0
1241 1354
1355const char *cf_party_get_name (partylist *party)
1356
1242const char *cf_party_get_password (partylist *party) 1357const char *cf_party_get_password (partylist *party)
1243 ALIAS: password = 0 1358 ALIAS: password = 0
1244 1359
1245player *cf_party_get_first_player (partylist *party) 1360player *cf_party_get_first_player (partylist *party)
1246 ALIAS: first_player = 0 1361 ALIAS: first_player = 0
1250 1365
1251 1366
1252MODULE = cf PACKAGE = cf::region PREFIX = cf_region_ 1367MODULE = cf PACKAGE = cf::region PREFIX = cf_region_
1253 1368
1254region *cf_region_get_first () 1369region *cf_region_get_first ()
1370 PROTOTYPE:
1255 ALIAS: first = 0 1371 ALIAS: first = 0
1256 1372
1257const char *cf_region_get_name (region *reg) 1373const char *cf_region_get_name (region *reg)
1258 ALIAS: name = 0 1374 ALIAS: name = 0
1259 1375

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines