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.10 by root, Sat Feb 4 20:38:29 2006 UTC vs.
Revision 1.12 by root, Tue Feb 7 03:01:29 2006 UTC

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; 56static f_plug_api object_set_property;
57static f_plug_api map_get_map;
57 58
58typedef struct 59typedef struct
59{ 60{
60 object* who; 61 object* who;
61 object* activator; 62 object* activator;
336 337
337 registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); 338 registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event");
338 unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); 339 unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event");
339 systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); 340 systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory");
340 object_set_property = gethook (&rtype, hooktype, "cfapi_object_set_property"); 341 object_set_property = gethook (&rtype, hooktype, "cfapi_object_set_property");
342 map_get_map = gethook (&rtype, hooktype, "cfapi_map_get_map");
343
341 cf_init_plugin (gethook); 344 cf_init_plugin (gethook);
342 345
343 /* Pick the global events you want to monitor from this plugin */ 346 /* Pick the global events you want to monitor from this plugin */
344 registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); 347 registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener);
345 registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); 348 registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener);
834 const_iv (F_CURSED) 837 const_iv (F_CURSED)
835 const_iv (F_DAMNED) 838 const_iv (F_DAMNED)
836 const_iv (F_OPEN) 839 const_iv (F_OPEN)
837 const_iv (F_NOPICK) 840 const_iv (F_NOPICK)
838 const_iv (F_LOCKED) 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)
839 }; 851 };
840 852
841 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; )
842 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 854 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
843 855
1082 break; 1094 break;
1083 default: 1095 default:
1084 croak ("unhandled type '%d' in set_property '%d'", type, idx); 1096 croak ("unhandled type '%d' in set_property '%d'", type, idx);
1085 } 1097 }
1086 1098
1099SV *
1100inv (object *obj)
1101 PROTOTYPE: $
1102 PPCODE:
1103{
1104 object *o;
1105 for (o = obj->inv; o; o = o->below)
1106 XPUSHs (newSVcfapi (CFAPI_POBJECT, o));
1107}
1108
1087int cf_object_get_resistance (object *op, int rtype) 1109int cf_object_get_resistance (object *op, int rtype)
1088 ALIAS: resistance = 0 1110 ALIAS: resistance = 0
1089 1111
1090int cf_object_get_flag (object *op, int flag) 1112int cf_object_get_flag (object *op, int flag)
1091 ALIAS: flag = 0 1113 ALIAS: flag = 0
1245 break; 1267 break;
1246 default: 1268 default:
1247 croak ("unhandled type '%d' in set_property '%d'", type, idx); 1269 croak ("unhandled type '%d' in set_property '%d'", type, idx);
1248 } 1270 }
1249 1271
1272mapstruct *new (int width, int height)
1273 PROTOTYPE:
1274 CODE:
1275{
1276 int unused_type;
1277 RETVAL = map_get_map (&unused_type, 0, width, height);
1278}
1279 OUTPUT:
1280 RETVAL
1281
1250mapstruct *cf_map_get_map (char *name) 1282mapstruct *cf_map_get_map (char *name)
1251 PROTOTYPE: $ 1283 PROTOTYPE: $
1252 ALIAS: map = 0 1284 ALIAS: map = 0
1253 1285
1254mapstruct *cf_map_get_first () 1286mapstruct *cf_map_get_first ()
1262object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) 1294object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny)
1263 C_ARGS: str, map, nx, ny 1295 C_ARGS: str, map, nx, ny
1264 1296
1265#int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny) 1297#int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny)
1266 1298
1299SV *
1300at (mapstruct *obj, unsigned int x, unsigned int y)
1301 PROTOTYPE: $$$
1302 INIT:
1303 if (x >= MAP_WIDTH (obj) || y >= MAP_HEIGHT (obj)) XSRETURN_UNDEF;
1304 PPCODE:
1305{
1306 object *o;
1307 for (o = GET_MAP_OB (obj, x, y); o; o = o->above)
1308 XPUSHs (newSVcfapi (CFAPI_POBJECT, o));
1309}
1310
1311SV *
1312bot_at (mapstruct *obj, unsigned int x, unsigned int y)
1313 PROTOTYPE: $$$
1314 ALIAS:
1315 top_at = 1
1316 flags_at = 2
1317 light_at = 3
1318 move_block_at = 4
1319 move_slow_at = 5
1320 move_on_at = 6
1321 move_off_at = 7
1322 INIT:
1323 if (x >= MAP_WIDTH (obj) || y >= MAP_HEIGHT (obj)) XSRETURN_UNDEF;
1324 CODE:
1325 switch (ix)
1326 {
1327 case 0: RETVAL = newSVcfapi (CFAPI_POBJECT, GET_MAP_OB (obj, x, y)); break;
1328 case 1: RETVAL = newSVcfapi (CFAPI_POBJECT, GET_MAP_TOP (obj, x, y)); break;
1329 case 2: RETVAL = newSVuv ( GET_MAP_FLAGS (obj, x, y)); break;
1330 case 3: RETVAL = newSViv ( GET_MAP_LIGHT (obj, x, y)); break;
1331 case 4: RETVAL = newSVuv ( GET_MAP_MOVE_BLOCK (obj, x, y)); break;
1332 case 5: RETVAL = newSVuv ( GET_MAP_MOVE_SLOW (obj, x, y)); break;
1333 case 6: RETVAL = newSVuv ( GET_MAP_MOVE_ON (obj, x, y)); break;
1334 case 7: RETVAL = newSVuv ( GET_MAP_MOVE_OFF (obj, x, y)); break;
1335 }
1336 OUTPUT:
1337 RETVAL
1267 1338
1268 1339
1269MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_ 1340MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_
1270 1341
1271archetype*cf_archetype_get_first() 1342archetype *cf_archetype_get_first()
1272 PROTOTYPE: 1343 PROTOTYPE:
1273 ALIAS: first = 0 1344 ALIAS: first = 0
1274 1345
1275archetype *cf_archetype_get_next (archetype *arch) 1346archetype *cf_archetype_get_next (archetype *arch)
1276 ALIAS: next = 0 1347 ALIAS: next = 0

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines