--- deliantra/server/plugins/cfperl/cfperl.xs 2006/02/03 07:25:25 1.1 +++ deliantra/server/plugins/cfperl/cfperl.xs 2006/02/03 17:19:13 1.4 @@ -283,9 +283,12 @@ va_start (args, type); propname = va_arg (args, char *); //printf ("Property name: %s\n", propname); - + if (!strcmp (propname, "command?")) { + if (!perl) + return NULL; + const char *cmdname = va_arg (args, const char *); HV *hv = get_hv ("cf::COMMAND", 1); SV **svp = hv_fetch (hv, cmdname, strlen (cmdname) + 1, 0); @@ -356,7 +359,7 @@ "-e" "BEGIN {" " cf->bootstrap;" - " unshift @INC, cf::get_maps_directory ('perl');" + " unshift @INC, cf::maps_directory ('perl');" "}" "" "use cf;" @@ -996,19 +999,42 @@ char * cf_get_maps_directory (char *path) + ALIAS: maps_directory = 0 + +int +cf_find_animation (char *text) MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ PROTOTYPES: DISABLE SV * -cf_object_get_property (object *obj, int type, int idx) +get_property (object *obj, int type, int idx) CODE: RETVAL = newSVcfapi (type, cf_object_get_property (obj, idx)); OUTPUT: RETVAL +SV * +set_property (object *obj, int type, int idx, SV *newval) + CODE: + switch (type) + { + case CFAPI_INT: + cf_object_set_int_property (obj, idx, SvIV (newval)); + break; + case CFAPI_LONG: + cf_object_set_long_property (obj, idx, SvNV (newval)); + break; + case CFAPI_STRING: + cf_object_set_string_property (obj, idx, SvPV_nolen (newval)); + break; + default: + croak ("unhandled type '%d' in set_property '%d'", type, idx); + } + int cf_object_get_resistance (object *op, int rtype) + ALIAS: resistance = 0 int cf_object_get_flag (object *op, int flag) ALIAS: flag = 0 @@ -1048,8 +1074,10 @@ object *cf_object_check_for_spell (object *op, char *spellname) int cf_object_query_money (object *op) + ALIAS: money = 0 int cf_object_query_cost (object *op, object *who, int flags) + ALIAS: cost = 0 void cf_object_activate_rune (object *op , object *victim) @@ -1068,6 +1096,7 @@ object *cf_object_insert_object (object *op, object *container) const char *cf_object_get_msg (object *ob) + ALIAS: msg = 0 object *cf_object_insert_in_ob (object *ob, object *where) @@ -1078,6 +1107,7 @@ void cf_object_pickup (object *op, object *what) char *cf_object_get_key (object *op, char *keyname) + ALIAS: key = 0 void cf_object_set_key (object *op, char *keyname, char *value) @@ -1091,8 +1121,10 @@ MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ object *cf_create_object () + ALIAS: new = 0 object *cf_create_object_by_name (const char *name) + ALIAS: new_from_name = 0 void cf_free_object (object *ob) @@ -1113,22 +1145,12 @@ object *cf_player_send_inventory (object *op) +void cf_player_set_marked_item(object *op, object *ob) -MODULE = cf PACKAGE = cf::object::map PREFIX = cf_ - -mapstruct *cf_map_get_map (char *name) - -mapstruct *cf_map_get_first () - -object *cf_map_insert_object_there (mapstruct *where, object *op, object *originator, int flags) +void cf_player_set_party(object *op, partylist *party) -object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) - -object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) - C_ARGS: str, map, nx, ny - -#int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny) +MODULE = cf PACKAGE = cf::object::map PREFIX = cf_ MODULE = cf PACKAGE = cf::player PREFIX = cf_ @@ -1146,18 +1168,51 @@ OUTPUT: RETVAL +SV * +set_property (mapstruct *obj, int type, int idx, SV *newval) + CODE: + switch (type) + { + case CFAPI_INT: + cf_map_set_int_property (obj, idx, SvIV (newval)); + break; + default: + croak ("unhandled type '%d' in set_property '%d'", type, idx); + } + +mapstruct *cf_map_get_map (char *name) + ALIAS: map = 0 + +mapstruct *cf_map_get_first () + ALIAS: first = 0 + +object *cf_map_insert_object_there (mapstruct *where, object *op, object *originator, int flags) + +object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) + +object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) + C_ARGS: str, map, nx, ny + +#int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny) + + MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_ archetype*cf_archetype_get_first() - -const char *cf_archetype_get_name (archetype *arch) + ALIAS: first = 0 archetype *cf_archetype_get_next (archetype *arch) + ALIAS: next = 0 + +archetype *cf_archetype_get_head (archetype *arch) + ALIAS: head = 0 archetype *cf_archetype_get_more (archetype *arch) + ALIAS: more = 0 -archetype *cf_archetype_get_head (archetype *arch) +const char *cf_archetype_get_name (archetype *arch) + ALIAS: name = 0 MODULE = cf PACKAGE = cf::party PREFIX = cf_party_