version 1.46 | | version 1.47 |
---|
| | |
/* | | /* |
* static char *rcsid_plugins_c = | | * static char *rcsid_plugins_c = |
* "$Id: plugins.c,v 1.46 2005/10/19 19:42:34 gros Exp $"; | | * "$Id: plugins.c,v 1.47 2005/10/28 19:08:53 akirschbaum Exp $"; |
*/ | | */ |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
int fid; | | int fid; |
f_plug_api rv; | | f_plug_api rv; |
int i; | | int i; |
*type = CFAPI_NONE; | | |
| | |
va_start(args,type); | | va_start(args,type); |
request_type = va_arg(args, int); | | request_type = va_arg(args, int); |
| | |
else /* by name */ | | else /* by name */ |
{ | | { |
buf = va_arg(args, char*); | | buf = va_arg(args, char*); |
| | rv = NULL; |
for(i=0; i<NR_OF_HOOKS; i++) | | for(i=0; i<NR_OF_HOOKS; i++) |
{ | | { |
if (!strcmp(buf, plug_hooks[i].fname)) | | if (!strcmp(buf, plug_hooks[i].fname)) |
{ | | { |
rv = plug_hooks[i].func; | | rv = plug_hooks[i].func; |
*type = CFAPI_FUNC; | | *type = CFAPI_FUNC; |
| | break; |
| | } |
} | | } |
| | if (rv == NULL) |
| | { |
| | *type = CFAPI_NONE; |
} | | } |
} | | } |
va_end(args); | | va_end(args); |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
void plugins_display_list(object *op) | | void plugins_display_list(object *op) |
{ | | { |
char buf[MAX_BUF]; | | |
int i; | | |
crossfire_plugin* cp; | | crossfire_plugin* cp; |
| | |
new_draw_info (NDI_UNIQUE, 0, op, "List of loaded plugins:"); | | new_draw_info (NDI_UNIQUE, 0, op, "List of loaded plugins:"); |
| | |
cp->gevent[eventcode] = NULL; | | cp->gevent[eventcode] = NULL; |
| | |
va_end(args); | | va_end(args); |
| | return NULL; |
} | | } |
| | |
void* cfapi_system_add_string(int *type, ...) | | void* cfapi_system_add_string(int *type, ...) |
| | |
{ | | { |
va_list args; | | va_list args; |
char* rv; | | char* rv; |
char* name; | | |
int prepend_dir; | | |
const char* str; | | const char* str; |
const char* regexp; | | const char* regexp; |
| | |
| | |
void* cfapi_system_directory(int* type, ...) | | void* cfapi_system_directory(int* type, ...) |
{ | | { |
va_list args; | | va_list args; |
char* rv; | | |
int dirtype; | | int dirtype; |
| | |
va_start(args,type); | | va_start(args,type); |
| | |
return settings.datadir; | | return settings.datadir; |
break; | | break; |
} | | } |
| | |
| | *type = CFAPI_NONE; |
| | return 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; |
| | default: |
| | *type = CFAPI_NONE; |
| | va_end(args); |
| | return NULL; |
| | break; |
} | | } |
va_end(args); | | va_end(args); |
*type = CFAPI_PMAP; | | *type = CFAPI_PMAP; |
| | |
/*case 2: | | /*case 2: |
rv = create_items_path(str); | | rv = create_items_path(str); |
break;*/ | | break;*/ |
| | default: |
| | rv = NULL; |
| | *type = CFAPI_NONE; |
| | break; |
} | | } |
va_end(args); | | va_end(args); |
return rv; | | return rv; |
| | |
object* op; | | object* op; |
va_start(args,type); | | va_start(args,type); |
| | |
| | *type = CFAPI_POBJECT; |
ftype = va_arg(args, int); | | ftype = va_arg(args, int); |
switch (ftype) | | switch (ftype) |
{ | | { |
| | |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
rv = is_player_inv(op); | | rv = is_player_inv(op); |
break; | | break; |
| | default: |
| | rv = NULL; |
| | *type = CFAPI_NONE; |
| | break; |
} | | } |
| | |
va_end(args); | | va_end(args); |
| | |
*type = CFAPI_POBJECT; | | |
return rv; | | return rv; |
} | | } |
void* cfapi_object_create(int* type, ...) | | void* cfapi_object_create(int* type, ...) |
| | |
return op; | | return op; |
} | | } |
break; | | break; |
| | |
| | default: |
| | *type = CFAPI_NONE; |
| | va_end(args); |
| | return NULL; |
| | break; |
} | | } |
} | | } |
void* cfapi_object_insert(int* type, ...) | | void* cfapi_object_insert(int* type, ...) |
| | |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
return &rv; | | return &rv; |
break; | | break; |
| | |
| | default: |
| | *type = CFAPI_NONE; |
| | return NULL; |
| | break; |
} | | } |
} | | } |
| | |
| | |
va_list args; | | va_list args; |
object* rv; | | object* rv; |
| | |
| | *type = CFAPI_POBJECT; |
va_start(args, type); | | va_start(args, type); |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
critera = va_arg(args, int); | | critera = va_arg(args, int); |
| | |
} | | } |
break; | | break; |
default: | | default: |
| | rv = NULL; |
break; | | break; |
} | | } |
va_end(args); | | va_end(args); |
| | |
*type = CFAPI_POBJECT; | | if (rv == NULL) |
| | { |
| | *type = CFAPI_NONE; |
| | } |
return rv; | | return rv; |
} | | } |
| | |
| | |
} | | } |
void* cfapi_object_speak(int* type,...) | | void* cfapi_object_speak(int* type,...) |
{ | | { |
static int rv; | | |
object* op; | | object* op; |
char* msg; | | char* msg; |
va_list args; | | va_list args; |
| | |
{ | | { |
struct dirent *currentfile; | | struct dirent *currentfile; |
DIR *plugdir; | | DIR *plugdir; |
int l; | | size_t l; |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
char buf2[MAX_BUF]; | | char buf2[MAX_BUF]; |
int result; | | int result; |