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.11 by root, Tue Feb 7 00:56:00 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
1245 break; 1257 break;
1246 default: 1258 default:
1247 croak ("unhandled type '%d' in set_property '%d'", type, idx); 1259 croak ("unhandled type '%d' in set_property '%d'", type, idx);
1248 } 1260 }
1249 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
1250mapstruct *cf_map_get_map (char *name) 1272mapstruct *cf_map_get_map (char *name)
1251 PROTOTYPE: $ 1273 PROTOTYPE: $
1252 ALIAS: map = 0 1274 ALIAS: map = 0
1253 1275
1254mapstruct *cf_map_get_first () 1276mapstruct *cf_map_get_first ()
1262object* 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)
1263 C_ARGS: str, map, nx, ny 1285 C_ARGS: str, map, nx, ny
1264 1286
1265#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)
1266 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
1267 1326
1268 1327
1269MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_ 1328MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_
1270 1329
1271archetype*cf_archetype_get_first() 1330archetype*cf_archetype_get_first()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines