version 1.60 | | version 1.61 |
---|
| | |
/* | | /* |
* static char *rcsid_plugins_c = | | * static char *rcsid_plugins_c = |
* "$Id: plugins.c,v 1.60 2005/12/17 19:42:52 ryo_saeba Exp $"; | | * "$Id: plugins.c,v 1.61 2006/01/07 17:41:32 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
#include <sproto.h> | | #include <sproto.h> |
#endif | | #endif |
| | |
#define NR_OF_HOOKS 73 | | #define NR_OF_HOOKS 74 |
| | |
static const hook_entry plug_hooks[NR_OF_HOOKS] = | | static const hook_entry plug_hooks[NR_OF_HOOKS] = |
{ | | { |
| | |
{cfapi_archetype_get_first, 70, "cfapi_archetype_get_first"}, | | {cfapi_archetype_get_first, 70, "cfapi_archetype_get_first"}, |
{cfapi_archetype_get_property, 71, "cfapi_archetype_get_property"}, | | {cfapi_archetype_get_property, 71, "cfapi_archetype_get_property"}, |
{cfapi_party_get_property, 72, "cfapi_party_get_property"}, | | {cfapi_party_get_property, 72, "cfapi_party_get_property"}, |
| | {cfapi_region_get_property, 73, "cfapi_region_get_property"}, |
}; | | }; |
int plugin_number = 0; | | int plugin_number = 0; |
crossfire_plugin* plugins_list = NULL; | | crossfire_plugin* plugins_list = NULL; |
| | |
*type = CFAPI_PMAP; | | *type = CFAPI_PMAP; |
va_end(args); | | va_end(args); |
return map->next; | | return map->next; |
| | case CFAPI_MAP_PROP_REGION: |
| | map = va_arg(args, mapstruct*); |
| | *type = CFAPI_PREGION; |
| | va_end(args); |
| | return get_region_by_map(map); |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
va_end(args); | | va_end(args); |
| | |
return rv; | | return rv; |
} | | } |
| | |
| | /* Regions-related functions */ |
| | void* cfapi_region_get_property(int* type, ...) |
| | { |
| | region* reg; |
| | int prop; |
| | va_list args; |
| | void* rv; |
| | |
| | va_start(args, type); |
| | reg = va_arg(args, region*); |
| | prop = va_arg(args, int); |
| | switch (prop) |
| | { |
| | case CFAPI_REGION_PROP_NAME: |
| | *type = CFAPI_STRING; |
| | rv = (void*)reg->name; |
| | break; |
| | case CFAPI_REGION_PROP_NEXT: |
| | *type = CFAPI_PREGION; |
| | rv = (reg?reg->next:first_region); |
| | break; |
| | case CFAPI_REGION_PROP_PARENT: |
| | *type = CFAPI_PREGION; |
| | rv = (void*)reg->parent; |
| | break; |
| | case CFAPI_REGION_PROP_LONGNAME: |
| | *type = CFAPI_STRING; |
| | rv = (void*)reg->longname; |
| | break; |
| | case CFAPI_REGION_PROP_MESSAGE: |
| | *type = CFAPI_STRING; |
| | rv = (void*)reg->msg; |
| | break; |
| | default: |
| | *type = CFAPI_NONE; |
| | rv = NULL; |
| | break; |
| | } |
| | va_end(args); |
| | return rv; |
| | } |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
/* NEW PLUGIN STUFF ENDS HERE */ | | /* NEW PLUGIN STUFF ENDS HERE */ |
/*****************************************************************************/ | | /*****************************************************************************/ |