version 1.55 | | version 1.56 |
---|
| | |
/* | | /* |
* static char *rcsid_plugins_c = | | * static char *rcsid_plugins_c = |
* "$Id: plugins.c,v 1.55 2005/11/16 08:16:09 mwedel Exp $"; | | * "$Id: plugins.c,v 1.56 2005/11/20 15:08:39 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
#include <sproto.h> | | #include <sproto.h> |
#endif | | #endif |
| | |
#define NR_OF_HOOKS 70 | | #define NR_OF_HOOKS 73 |
| | |
static const hook_entry plug_hooks[NR_OF_HOOKS] = | | static const hook_entry plug_hooks[NR_OF_HOOKS] = |
{ | | { |
| | |
{cfapi_object_speak, 66, "cfapi_object_speak"}, | | {cfapi_object_speak, 66, "cfapi_object_speak"}, |
{cfapi_object_pickup, 67, "cfapi_object_pickup"}, | | {cfapi_object_pickup, 67, "cfapi_object_pickup"}, |
{cfapi_object_move, 68, "cfapi_object_move"}, | | {cfapi_object_move, 68, "cfapi_object_move"}, |
{cfapi_object_apply_below, 69, "cfapi_object_apply_below"} | | {cfapi_object_apply_below, 69, "cfapi_object_apply_below"}, |
| | {cfapi_archetype_get_first, 70, "cfapi_archetype_get_first"}, |
| | {cfapi_archetype_get_property, 71, "cfapi_archetype_get_property"}, |
}; | | }; |
int plugin_number = 0; | | int plugin_number = 0; |
crossfire_plugin* plugins_list = NULL; | | crossfire_plugin* plugins_list = NULL; |
| | |
ny = va_arg(args, int); | | ny = va_arg(args, int); |
rv = get_map_from_coord(m, &nx,&ny); | | rv = get_map_from_coord(m, &nx,&ny); |
break; | | break; |
| | case 3: |
| | rv = first_map; |
| | break; |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
va_end(args); | | va_end(args); |
| | |
va_end(args); | | va_end(args); |
return buf; | | return buf; |
break; | | break; |
| | case CFAPI_MAP_PROP_NEXT: |
| | map = va_arg(args, mapstruct*); |
| | *type = CFAPI_PMAP; |
| | va_end(args); |
| | return map->next; |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
va_end(args); | | va_end(args); |
| | |
property = va_arg(args, int); | | property = va_arg(args, int); |
rv = NULL; | | rv = NULL; |
| | |
if (op != NULL) | | if (op != NULL && (!op->arch || (op != &op->arch->clone))) |
switch (property) | | switch (property) |
{ | | { |
case CFAPI_OBJECT_PROP_NAME : | | case CFAPI_OBJECT_PROP_NAME : |
| | |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
return NULL; | | return NULL; |
} | | } |
| | |
| | /* Archetype-related functions */ |
| | void* cfapi_archetype_get_first(int* type, ...) |
| | { |
| | va_list args; |
| | va_start(args, type); |
| | va_end(args); |
| | *type = CFAPI_PARCH; |
| | return first_archetype; |
| | } |
| | |
| | void* cfapi_archetype_get_property(int* type, ...) |
| | { |
| | archetype* arch; |
| | int prop; |
| | va_list args; |
| | void* rv; |
| | |
| | va_start(args, type); |
| | arch = va_arg(args, archetype*); |
| | prop = va_arg(args, int); |
| | switch (prop) |
| | { |
| | case CFAPI_ARCH_PROP_NAME: |
| | *type = CFAPI_STRING; |
| | rv = (void*)arch->name; |
| | break; |
| | case CFAPI_ARCH_PROP_NEXT: |
| | *type = CFAPI_PARCH; |
| | rv = arch->next; |
| | break; |
| | case CFAPI_ARCH_PROP_HEAD: |
| | *type = CFAPI_PARCH; |
| | rv = arch->head; |
| | break; |
| | case CFAPI_ARCH_PROP_MORE: |
| | *type = CFAPI_PARCH; |
| | rv = arch->more; |
| | break; |
| | case CFAPI_ARCH_PROP_CLONE: |
| | *type = CFAPI_POBJECT; |
| | rv = &arch->clone; |
| | break; |
| | default: |
| | *type = CFAPI_NONE; |
| | rv = NULL; |
| | break; |
| | } |
| | va_end(args); |
| | return rv; |
| | } |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
/* NEW PLUGIN STUFF ENDS HERE */ | | /* NEW PLUGIN STUFF ENDS HERE */ |
/*****************************************************************************/ | | /*****************************************************************************/ |