version 1.61 | | version 1.62 |
---|
| | |
/* | | /* |
* static char *rcsid_plugins_c = | | * static char *rcsid_plugins_c = |
* "$Id: plugins.c,v 1.61 2006/01/07 17:41:32 ryo_saeba Exp $"; | | * "$Id: plugins.c,v 1.62 2006/01/08 14:35:00 akirschbaum Exp $"; |
*/ | | */ |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
object* tmp; | | object* tmp; |
player *pl; | | player *pl; |
| | |
if (op->env != NULL) | | if (op->env != NULL) { |
{ | | |
tmp = is_player_inv(op->env); | | tmp = is_player_inv(op->env); |
if (!tmp) | | if (!tmp) { |
{ | | |
for (pl = first_player; pl; pl = pl->next) | | for (pl = first_player; pl; pl = pl->next) |
if (pl->ob->container == op->env) | | if (pl->ob->container == op->env) |
break; | | break; |
| | |
} | | } |
if (tmp) | | if (tmp) |
esrv_send_item(tmp, op); | | esrv_send_item(tmp, op); |
} | | } else { |
else | | |
{ | | |
for (tmp = op->above; tmp != NULL; tmp = tmp->above) | | for (tmp = op->above; tmp != NULL; tmp = tmp->above) |
if (tmp->type == PLAYER) | | if (tmp->type == PLAYER) |
esrv_send_item(tmp, op); | | esrv_send_item(tmp, op); |
| | |
object* tmp; | | object* tmp; |
player *pl; | | player *pl; |
| | |
if (op->env == NULL) | | if (op->env == NULL) { |
{ | | |
/* no action necessary: remove_ob() notifies the client */ | | /* no action necessary: remove_ob() notifies the client */ |
return; | | return; |
} | | } |
| | |
tmp = is_player_inv(op->env); | | tmp = is_player_inv(op->env); |
if (!tmp) | | if (!tmp) { |
{ | | |
for (pl = first_player; pl; pl = pl->next) | | for (pl = first_player; pl; pl = pl->next) |
if (pl->ob->container == op->env) | | if (pl->ob->container == op->env) |
break; | | break; |
| | |
object *tmp, *next; | | object *tmp, *next; |
crossfire_plugin* plugin; | | crossfire_plugin* plugin; |
int rv = 0; | | int rv = 0; |
for (tmp = op->inv; tmp != NULL; tmp=next) | | for (tmp = op->inv; tmp != NULL; tmp = next) { |
{ | | |
next = tmp->below; | | next = tmp->below; |
if ((tmp->type == EVENT_CONNECTOR)&&(tmp->subtype==eventcode)) | | if (tmp->type == EVENT_CONNECTOR && tmp->subtype == eventcode) { |
{ | | |
LOG(llevDebug, "********** EVENT HANDLER **********\n"); | | LOG(llevDebug, "********** EVENT HANDLER **********\n"); |
LOG(llevDebug, " - Who am I :%s\n",op->name); | | LOG(llevDebug, " - Who am I :%s\n",op->name); |
if (activator != NULL) | | if (activator != NULL) |
| | |
if (tmp->name != NULL) | | if (tmp->name != NULL) |
LOG(llevDebug, " - Event options :%s\n", tmp->name); | | LOG(llevDebug, " - Event options :%s\n", tmp->name); |
| | |
if (tmp->title == NULL) | | if (tmp->title == NULL) { |
{ | | |
object *env = object_get_env_recursive(tmp); | | object *env = object_get_env_recursive(tmp); |
LOG(llevError, "Event object without title at %d/%d in map %s\n", env->x, env->y, env->map->name); | | LOG(llevError, "Event object without title at %d/%d in map %s\n", env->x, env->y, env->map->name); |
send_removed_object(tmp); | | send_removed_object(tmp); |
remove_ob(tmp); | | remove_ob(tmp); |
free_object(tmp); | | free_object(tmp); |
} | | } else if (tmp->slaying == NULL) { |
else if (tmp->slaying == NULL) | | |
{ | | |
object *env = object_get_env_recursive(tmp); | | object *env = object_get_env_recursive(tmp); |
LOG(llevError, "Event object without slaying at %d/%d in map %s\n", env->x, env->y, env->map->name); | | LOG(llevError, "Event object without slaying at %d/%d in map %s\n", env->x, env->y, env->map->name); |
send_removed_object(tmp); | | send_removed_object(tmp); |
remove_ob(tmp); | | remove_ob(tmp); |
free_object(tmp); | | free_object(tmp); |
} | | } else { |
else | | |
{ | | |
plugin = plugins_find_plugin(tmp->title); | | plugin = plugins_find_plugin(tmp->title); |
if (plugin == NULL) | | if (plugin == NULL) { |
{ | | |
object *env = object_get_env_recursive(tmp); | | object *env = object_get_env_recursive(tmp); |
LOG(llevError, "The requested plugin doesn't exit: %s at %d/%d in map %s\n", tmp->title, env->x, env->y, env->map->name); | | LOG(llevError, "The requested plugin doesn't exit: %s at %d/%d in map %s\n", tmp->title, env->x, env->y, env->map->name); |
send_removed_object(tmp); | | send_removed_object(tmp); |
remove_ob(tmp); | | remove_ob(tmp); |
free_object(tmp); | | free_object(tmp); |
} | | } else { |
else | | |
{ | | |
int rvt = 0; | | int rvt = 0; |
int *rv; | | int *rv; |
| | |
| | |
| | |
va_start(args,eventcode); | | va_start(args,eventcode); |
| | |
switch (eventcode) | | switch (eventcode) { |
{ | | |
case EVENT_BORN: | | case EVENT_BORN: |
/*BORN: op*/ | | /*BORN: op*/ |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,op); | | cp->gevent[eventcode](&rt,eventcode,op); |
} | | } |
break; | | break; |
| | |
case EVENT_CLOCK: | | case EVENT_CLOCK: |
/*CLOCK: -*/ | | /*CLOCK: -*/ |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode); | | cp->gevent[eventcode](&rt,eventcode); |
} | | } |
break; | | break; |
| | |
case EVENT_CRASH: | | case EVENT_CRASH: |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode); | | cp->gevent[eventcode](&rt,eventcode); |
} | | } |
break; | | break; |
| | |
case EVENT_PLAYER_DEATH: | | case EVENT_PLAYER_DEATH: |
/*PLAYER_DEATH: op*/ | | /*PLAYER_DEATH: op*/ |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,op); | | cp->gevent[eventcode](&rt,eventcode,op); |
} | | } |
break; | | break; |
| | |
case EVENT_GKILL: | | case EVENT_GKILL: |
/*GKILL: op, hitter*/ | | /*GKILL: op, hitter*/ |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
op2 = va_arg(args, object*); | | op2 = va_arg(args, object*); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,op,op2); | | cp->gevent[eventcode](&rt,eventcode,op,op2); |
} | | } |
break; | | break; |
| | |
case EVENT_LOGIN: | | case EVENT_LOGIN: |
/*LOGIN: pl, pl->socket.host*/ | | /*LOGIN: pl, pl->socket.host*/ |
pl = va_arg(args, player*); | | pl = va_arg(args, player*); |
buf = va_arg(args, char*); | | buf = va_arg(args, char*); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,pl,buf); | | cp->gevent[eventcode](&rt,eventcode,pl,buf); |
} | | } |
break; | | break; |
| | |
case EVENT_LOGOUT: | | case EVENT_LOGOUT: |
/*LOGOUT: pl, pl->socket.host*/ | | /*LOGOUT: pl, pl->socket.host*/ |
pl = va_arg(args, player*); | | pl = va_arg(args, player*); |
buf = va_arg(args, char*); | | buf = va_arg(args, char*); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,pl,buf); | | cp->gevent[eventcode](&rt,eventcode,pl,buf); |
} | | } |
break; | | break; |
| | |
case EVENT_MAPENTER: | | case EVENT_MAPENTER: |
/*MAPENTER: op*/ | | /*MAPENTER: op*/ |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,op); | | cp->gevent[eventcode](&rt,eventcode,op); |
} | | } |
break; | | break; |
| | |
case EVENT_MAPLEAVE: | | case EVENT_MAPLEAVE: |
/*MAPLEAVE: op*/ | | /*MAPLEAVE: op*/ |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,op); | | cp->gevent[eventcode](&rt,eventcode,op); |
} | | } |
break; | | break; |
| | |
case EVENT_MAPRESET: | | case EVENT_MAPRESET: |
/*MAPRESET: map->path*/ | | /*MAPRESET: map->path*/ |
buf = va_arg(args, char*); | | buf = va_arg(args, char*); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,buf); | | cp->gevent[eventcode](&rt,eventcode,buf); |
} | | } |
break; | | break; |
| | |
case EVENT_REMOVE: | | case EVENT_REMOVE: |
/*REMOVE: op*/ | | /*REMOVE: op*/ |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,op); | | cp->gevent[eventcode](&rt,eventcode,op); |
} | | } |
break; | | break; |
| | |
case EVENT_SHOUT: | | case EVENT_SHOUT: |
/*SHOUT: op, parms, priority*/ | | /*SHOUT: op, parms, priority*/ |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
buf = va_arg(args, char*); | | buf = va_arg(args, char*); |
i = va_arg(args, int); | | i = va_arg(args, int); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,op,buf,i); | | cp->gevent[eventcode](&rt,eventcode,op,buf,i); |
} | | } |
break; | | break; |
| | |
case EVENT_TELL: | | case EVENT_TELL: |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode); | | cp->gevent[eventcode](&rt,eventcode); |
} | | } |
break; | | break; |
| | |
case EVENT_MUZZLE: | | case EVENT_MUZZLE: |
/*MUZZLE: op, parms*/ | | /*MUZZLE: op, parms*/ |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
buf = va_arg(args, char*); | | buf = va_arg(args, char*); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,op,buf); | | cp->gevent[eventcode](&rt,eventcode,op,buf); |
} | | } |
break; | | break; |
| | |
case EVENT_KICK: | | case EVENT_KICK: |
/*KICK: op, parms*/ | | /*KICK: op, parms*/ |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
buf = va_arg(args, char*); | | buf = va_arg(args, char*); |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
if (cp->gevent[eventcode]!=NULL) | | if (cp->gevent[eventcode]!=NULL) |
cp->gevent[eventcode](&rt,eventcode,op,buf); | | cp->gevent[eventcode](&rt,eventcode,op,buf); |
} | | } |
| | |
| | |
/* Open the plugin lib and load the required functions */ | | /* Open the plugin lib and load the required functions */ |
ptr = plugins_dlopen(libfile); | | ptr = plugins_dlopen(libfile); |
if (ptr == NULL) | | if (ptr == NULL) { |
{ | | |
LOG(llevError, "Error trying to load %s: %s\n", libfile, plugins_dlerror()); | | LOG(llevError, "Error trying to load %s: %s\n", libfile, plugins_dlerror()); |
return -1; | | return -1; |
} | | } |
initfunc = (f_plug_init) plugins_dlsym(ptr, "initPlugin"); | | initfunc = (f_plug_init) plugins_dlsym(ptr, "initPlugin"); |
if (initfunc == NULL) | | if (initfunc == NULL) { |
{ | | |
LOG(llevError, "Plugin error while requesting %s.initPlugin: %s\n", | | LOG(llevError, "Plugin error while requesting %s.initPlugin: %s\n", |
libfile, plugins_dlerror()); | | libfile, plugins_dlerror()); |
plugins_dlclose(ptr); | | plugins_dlclose(ptr); |
return -1; | | return -1; |
} | | } |
propfunc = (f_plug_api) plugins_dlsym(ptr, "getPluginProperty"); | | propfunc = (f_plug_api) plugins_dlsym(ptr, "getPluginProperty"); |
if (propfunc == NULL) | | if (propfunc == NULL) { |
{ | | |
LOG(llevError, "Plugin error while requesting %s.getPluginProperty: %s\n", | | LOG(llevError, "Plugin error while requesting %s.getPluginProperty: %s\n", |
libfile, plugins_dlerror()); | | libfile, plugins_dlerror()); |
plugins_dlclose(ptr); | | plugins_dlclose(ptr); |
return -1; | | return -1; |
} | | } |
eventfunc = (f_plug_api) plugins_dlsym(ptr, "eventListener"); | | eventfunc = (f_plug_api) plugins_dlsym(ptr, "eventListener"); |
if (eventfunc == NULL) | | if (eventfunc == NULL) { |
{ | | |
LOG(llevError, "Plugin error while requesting %s.eventListener: %s\n", | | LOG(llevError, "Plugin error while requesting %s.eventListener: %s\n", |
libfile, plugins_dlerror()); | | libfile, plugins_dlerror()); |
plugins_dlclose(ptr); | | plugins_dlclose(ptr); |
return -1; | | return -1; |
} | | } |
postfunc = (f_plug_postinit) plugins_dlsym(ptr, "postInitPlugin"); | | postfunc = (f_plug_postinit) plugins_dlsym(ptr, "postInitPlugin"); |
if (postfunc == NULL) | | if (postfunc == NULL) { |
{ | | |
LOG(llevError, "Plugin error while requesting %s.postInitPlugin: %s\n", | | LOG(llevError, "Plugin error while requesting %s.postInitPlugin: %s\n", |
libfile, plugins_dlerror()); | | libfile, plugins_dlerror()); |
plugins_dlclose(ptr); | | plugins_dlclose(ptr); |
return -1; | | return -1; |
} | | } |
closefunc = (f_plug_postinit) plugins_dlsym(ptr, "closePlugin"); | | closefunc = (f_plug_postinit) plugins_dlsym(ptr, "closePlugin"); |
if (postfunc == NULL) | | if (postfunc == NULL) { |
{ | | |
LOG(llevError, "Plugin error while requesting %s.closePlugin: %s\n", | | LOG(llevError, "Plugin error while requesting %s.closePlugin: %s\n", |
libfile, plugins_dlerror()); | | libfile, plugins_dlerror()); |
plugins_dlclose(ptr); | | plugins_dlclose(ptr); |
return -1; | | return -1; |
} | | } |
if (postfunc == NULL) | | if (postfunc == NULL) { |
{ | | |
LOG(llevError, "Plugin error while requesting %s.closePlugin: %s\n", | | LOG(llevError, "Plugin error while requesting %s.closePlugin: %s\n", |
libfile, plugins_dlerror()); | | libfile, plugins_dlerror()); |
plugins_dlclose(ptr); | | plugins_dlclose(ptr); |
| | |
strcpy(cp->fullname,propfunc(&i, "FullName")); | | strcpy(cp->fullname,propfunc(&i, "FullName")); |
cp->next = NULL; | | cp->next = NULL; |
cp->prev = NULL; | | cp->prev = NULL; |
if (plugins_list == NULL) | | if (plugins_list == NULL) { |
{ | | |
plugins_list = cp; | | plugins_list = cp; |
} | | } else { |
else | | for (ccp = plugins_list; ccp->next != NULL; ccp = ccp->next) |
{ | | ; |
for(ccp=plugins_list; ccp->next!=NULL; ccp=ccp->next); | | |
ccp->next = cp; | | ccp->next = cp; |
cp->prev = ccp; | | cp->prev = ccp; |
} | | } |
| | |
| | |
va_start(args,type); | | va_start(args,type); |
request_type = va_arg(args, int); | | request_type = va_arg(args, int); |
if (request_type == 0) /* By nr */ | | if (request_type == 0) { /* By nr */ |
{ | | |
fid = va_arg(args, int); | | fid = va_arg(args, int); |
if ((fid < 0)||(fid >= NR_OF_HOOKS)) | | if (fid < 0 || fid >= NR_OF_HOOKS) { |
{ | | |
rv = NULL; | | rv = NULL; |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
} | | } else { |
else | | |
{ | | |
rv = plug_hooks[fid].func; | | rv = plug_hooks[fid].func; |
*type = CFAPI_FUNC; | | *type = CFAPI_FUNC; |
} | | } |
} | | } else { /* by name */ |
else /* by name */ | | |
{ | | |
buf = va_arg(args, char*); | | buf = va_arg(args, char*); |
rv = NULL; | | 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; | | break; |
} | | } |
} | | } |
if (rv == NULL) | | if (rv == NULL) { |
{ | | |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
} | | } |
} | | } |
| | |
if (plugins_list == NULL) | | if (plugins_list == NULL) |
return -1; | | return -1; |
| | |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | if (!strcmp(id, cp->id)) { |
if(!strcmp(id,cp->id)) | | |
{ | | |
crossfire_plugin* n; | | crossfire_plugin* n; |
crossfire_plugin* p; | | crossfire_plugin* p; |
n = cp->next; | | n = cp->next; |
p = cp->prev; | | p = cp->prev; |
plugins_dlclose(cp->libptr); | | plugins_dlclose(cp->libptr); |
if (n != NULL) | | if (n != NULL) { |
{ | | if (p != NULL) { |
if (p != NULL) | | |
{ | | |
n->prev = p; | | n->prev = p; |
p->next = n; | | p->next = n; |
} | | } else { |
else | | |
{ | | |
n->prev = NULL; | | n->prev = NULL; |
plugins_list = n; | | plugins_list = n; |
} | | } |
} | | } else { |
else | | |
{ | | |
if (p != NULL) | | if (p != NULL) |
p->next = NULL; | | p->next = NULL; |
else | | else |
| | |
if (plugins_list == NULL) | | if (plugins_list == NULL) |
return NULL; | | return NULL; |
| | |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | if (!strcmp(id, cp->id)) { |
if(!strcmp(id,cp->id)) | | |
{ | | |
return cp; | | return cp; |
} | | } |
} | | } |
| | |
if (plugins_list == NULL) | | if (plugins_list == NULL) |
return; | | return; |
| | |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
new_draw_info_format (NDI_UNIQUE, 0, op, "%s, %s", cp->id, cp->fullname); | | new_draw_info_format (NDI_UNIQUE, 0, op, "%s, %s", cp->id, cp->fullname); |
} | | } |
} | | } |
| | |
case 0: | | case 0: |
return settings.mapdir; | | return settings.mapdir; |
break; | | break; |
| | |
case 1: | | case 1: |
return settings.uniquedir; | | return settings.uniquedir; |
break; | | break; |
| | |
case 2: | | case 2: |
return settings.tmpdir; | | return settings.tmpdir; |
break; | | break; |
| | |
case 3: | | case 3: |
return settings.confdir; | | return settings.confdir; |
break; | | break; |
| | |
case 4: | | case 4: |
return settings.localdir; | | return settings.localdir; |
break; | | break; |
| | |
case 5: | | case 5: |
return settings.playerdir; | | return settings.playerdir; |
break; | | break; |
| | |
case 6: | | case 6: |
return settings.datadir; | | return settings.datadir; |
break; | | break; |
| | |
y = va_arg(args, int); | | y = va_arg(args, int); |
rv = get_empty_map(x,y); | | rv = get_empty_map(x,y); |
break; | | break; |
| | |
case 1: | | case 1: |
name = va_arg(args, char*); | | name = va_arg(args, char*); |
x = va_arg(args, int); | | x = va_arg(args, int); |
rv = ready_map_name(name, x); | | rv = ready_map_name(name, x); |
break; | | break; |
| | |
case 2: | | case 2: |
m = va_arg(args, mapstruct*); | | m = va_arg(args, mapstruct*); |
nx = va_arg(args, int); | | nx = va_arg(args, int); |
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: | | case 3: |
rv = first_map; | | rv = first_map; |
break; | | break; |
| | |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
va_end(args); | | va_end(args); |
| | |
case 0: | | case 0: |
rv = (char*)create_pathname(str); | | rv = (char*)create_pathname(str); |
break; | | break; |
| | |
case 1: | | case 1: |
rv = (char*)create_overlay_pathname(str); | | rv = (char*)create_overlay_pathname(str); |
break; | | break; |
| | |
/*case 2: | | /*case 2: |
rv = create_items_path(str); | | rv = create_items_path(str); |
break;*/ | | break;*/ |
| | |
default: | | default: |
rv = NULL; | | rv = NULL; |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
| | |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_DIFFICULTY: | | case CFAPI_MAP_PROP_DIFFICULTY: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = calculate_difficulty(map); | | rv = calculate_difficulty(map); |
| | |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_PATH: | | case CFAPI_MAP_PROP_PATH: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
buf = map->path; | | buf = map->path; |
| | |
va_end(args); | | va_end(args); |
return buf; | | return buf; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_TMPNAME: | | case CFAPI_MAP_PROP_TMPNAME: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
buf = map->tmpname; | | buf = map->tmpname; |
| | |
va_end(args); | | va_end(args); |
return buf; | | return buf; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_NAME: | | case CFAPI_MAP_PROP_NAME: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
buf = map->name; | | buf = map->name; |
| | |
va_end(args); | | va_end(args); |
return buf; | | return buf; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_RESET_TIME: | | case CFAPI_MAP_PROP_RESET_TIME: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->reset_time; | | rv = map->reset_time; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_RESET_TIMEOUT: | | case CFAPI_MAP_PROP_RESET_TIMEOUT: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->reset_timeout; | | rv = map->reset_timeout; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_PLAYERS: | | case CFAPI_MAP_PROP_PLAYERS: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->players; | | rv = map->players; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_DARKNESS: | | case CFAPI_MAP_PROP_DARKNESS: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->darkness; | | rv = map->darkness; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_WIDTH: | | case CFAPI_MAP_PROP_WIDTH: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->width; | | rv = map->width; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_HEIGHT: | | case CFAPI_MAP_PROP_HEIGHT: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->height; | | rv = map->height; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_ENTER_X: | | case CFAPI_MAP_PROP_ENTER_X: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->enter_x; | | rv = map->enter_x; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_ENTER_Y: | | case CFAPI_MAP_PROP_ENTER_Y: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->enter_y; | | rv = map->enter_y; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_TEMPERATURE: | | case CFAPI_MAP_PROP_TEMPERATURE: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->temp; | | rv = map->temp; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_PRESSURE: | | case CFAPI_MAP_PROP_PRESSURE: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->pressure; | | rv = map->pressure; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_HUMIDITY: | | case CFAPI_MAP_PROP_HUMIDITY: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->humid; | | rv = map->humid; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_WINDSPEED: | | case CFAPI_MAP_PROP_WINDSPEED: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->windspeed; | | rv = map->windspeed; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_WINDDIR: | | case CFAPI_MAP_PROP_WINDDIR: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->winddir; | | rv = map->winddir; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_SKY: | | case CFAPI_MAP_PROP_SKY: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->sky; | | rv = map->sky; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_WPARTX: | | case CFAPI_MAP_PROP_WPARTX: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->wpartx; | | rv = map->wpartx; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_WPARTY: | | case CFAPI_MAP_PROP_WPARTY: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
rv = map->wparty; | | rv = map->wparty; |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_MESSAGE: | | case CFAPI_MAP_PROP_MESSAGE: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
buf = map->msg; | | buf = map->msg; |
| | |
va_end(args); | | va_end(args); |
return buf; | | return buf; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_NEXT: | | case CFAPI_MAP_PROP_NEXT: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
*type = CFAPI_PMAP; | | *type = CFAPI_PMAP; |
va_end(args); | | va_end(args); |
return map->next; | | return map->next; |
| | break; |
| | |
case CFAPI_MAP_PROP_REGION: | | case CFAPI_MAP_PROP_REGION: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
*type = CFAPI_PREGION; | | *type = CFAPI_PREGION; |
va_end(args); | | va_end(args); |
return get_region_by_map(map); | | return get_region_by_map(map); |
| | break; |
| | |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
va_end(args); | | va_end(args); |
return NULL; | | return NULL; |
| | break; |
} | | } |
} | | } |
| | |
| | |
va_end(args); | | va_end(args); |
return &rv; | | return &rv; |
break; | | break; |
| | |
case CFAPI_MAP_PROP_RESET_TIME: | | case CFAPI_MAP_PROP_RESET_TIME: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
va_end(args); | | va_end(args); |
return NULL; | | return NULL; |
break; | | break; |
| | |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
va_end(args); | | va_end(args); |
return NULL; | | return NULL; |
| | break; |
} | | } |
} | | } |
void* cfapi_map_out_of_map(int* type, ...) | | void* cfapi_map_out_of_map(int* type, ...) |
| | |
va_end(args); | | va_end(args); |
rv = move_ob(op,direction,activator); | | rv = move_ob(op,direction,activator); |
break; | | break; |
| | |
case 1: | | case 1: |
pl = va_arg(args, player*); | | pl = va_arg(args, player*); |
direction = va_arg(args, int); | | direction = va_arg(args, int); |
| | |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
property = va_arg(args, int); | | property = va_arg(args, int); |
rv = NULL; | | rv = NULL; |
if (op != NULL) | | if (op != NULL) { |
switch (property) | | switch (property) |
{ | | { |
case CFAPI_OBJECT_PROP_OB_ABOVE : | | case CFAPI_OBJECT_PROP_OB_ABOVE : |
rv = op->above; | | rv = op->above; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_OB_BELOW : | | case CFAPI_OBJECT_PROP_OB_BELOW : |
rv = op->below; | | rv = op->below; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_NEXT_ACTIVE_OB : | | case CFAPI_OBJECT_PROP_NEXT_ACTIVE_OB : |
rv = op->active_next; | | rv = op->active_next; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PREV_ACTIVE_OB : | | case CFAPI_OBJECT_PROP_PREV_ACTIVE_OB : |
rv = op->active_prev; | | rv = op->active_prev; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_INVENTORY : | | case CFAPI_OBJECT_PROP_INVENTORY : |
rv = op->inv; | | rv = op->inv; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ENVIRONMENT : | | case CFAPI_OBJECT_PROP_ENVIRONMENT : |
rv = op->env; | | rv = op->env; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_HEAD : | | case CFAPI_OBJECT_PROP_HEAD : |
rv = op->head; | | rv = op->head; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CONTAINER : | | case CFAPI_OBJECT_PROP_CONTAINER : |
rv = op->container; | | rv = op->container; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MAP : | | case CFAPI_OBJECT_PROP_MAP : |
rv = op->map; | | rv = op->map; |
*type = CFAPI_PMAP; | | *type = CFAPI_PMAP; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_COUNT : | | case CFAPI_OBJECT_PROP_COUNT : |
rv = &op->count; | | rv = &op->count; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_REFCOUNT : | | case CFAPI_OBJECT_PROP_REFCOUNT : |
rv = &op->refcount; | | rv = &op->refcount; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_NAME : | | case CFAPI_OBJECT_PROP_NAME : |
rv = query_name(op); | | rv = query_name(op); |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_NAME_PLURAL : | | case CFAPI_OBJECT_PROP_NAME_PLURAL : |
rv = (char*)op->name_pl; | | rv = (char*)op->name_pl; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_TITLE : | | case CFAPI_OBJECT_PROP_TITLE : |
rv = (char*)op->title; | | rv = (char*)op->title; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_RACE : | | case CFAPI_OBJECT_PROP_RACE : |
rv = (char*)op->race; | | rv = (char*)op->race; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SLAYING : | | case CFAPI_OBJECT_PROP_SLAYING : |
rv = (char*)op->slaying; | | rv = (char*)op->slaying; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SKILL : | | case CFAPI_OBJECT_PROP_SKILL : |
rv = (char*)op->skill; | | rv = (char*)op->skill; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MESSAGE : | | case CFAPI_OBJECT_PROP_MESSAGE : |
rv = (char*)op->msg; | | rv = (char*)op->msg; |
if (rv == NULL) | | if (rv == NULL) |
rv = ""; | | rv = ""; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LORE : | | case CFAPI_OBJECT_PROP_LORE : |
rv = (char*)op->lore; | | rv = (char*)op->lore; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_X : | | case CFAPI_OBJECT_PROP_X : |
ri = op->x; | | ri = op->x; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_Y : | | case CFAPI_OBJECT_PROP_Y : |
ri = op->y; | | ri = op->y; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SPEED : | | case CFAPI_OBJECT_PROP_SPEED : |
rv = &op->speed; | | rv = &op->speed; |
*type = CFAPI_DOUBLE; | | *type = CFAPI_DOUBLE; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SPEED_LEFT : | | case CFAPI_OBJECT_PROP_SPEED_LEFT : |
rv = &op->speed_left; | | rv = &op->speed_left; |
*type = CFAPI_DOUBLE; | | *type = CFAPI_DOUBLE; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_NROF : | | case CFAPI_OBJECT_PROP_NROF : |
rv = &op->nrof; | | rv = &op->nrof; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_DIRECTION : | | case CFAPI_OBJECT_PROP_DIRECTION : |
rv = &op->direction; | | rv = &op->direction; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_FACING : | | case CFAPI_OBJECT_PROP_FACING : |
rv = &op->facing; | | rv = &op->facing; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_TYPE : | | case CFAPI_OBJECT_PROP_TYPE : |
rv = &op->type; | | rv = &op->type; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SUBTYPE : | | case CFAPI_OBJECT_PROP_SUBTYPE : |
rv = &op->subtype; | | rv = &op->subtype; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CLIENT_TYPE : | | case CFAPI_OBJECT_PROP_CLIENT_TYPE : |
rv = &op->client_type; | | rv = &op->client_type; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_RESIST : | | case CFAPI_OBJECT_PROP_RESIST : |
{ | | { |
int idx; | | int idx; |
| | |
} | | } |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ATTACK_TYPE : | | case CFAPI_OBJECT_PROP_ATTACK_TYPE : |
rv = &op->attacktype; | | rv = &op->attacktype; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PATH_ATTUNED : | | case CFAPI_OBJECT_PROP_PATH_ATTUNED : |
rv = &op->path_attuned; | | rv = &op->path_attuned; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PATH_REPELLED : | | case CFAPI_OBJECT_PROP_PATH_REPELLED : |
rv = &op->path_repelled; | | rv = &op->path_repelled; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PATH_DENIED : | | case CFAPI_OBJECT_PROP_PATH_DENIED : |
rv = &op->path_denied; | | rv = &op->path_denied; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MATERIAL : | | case CFAPI_OBJECT_PROP_MATERIAL : |
rv = &op->material; | | rv = &op->material; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MATERIAL_NAME : | | case CFAPI_OBJECT_PROP_MATERIAL_NAME : |
rv = (char*)op->materialname; | | rv = (char*)op->materialname; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MAGIC : | | case CFAPI_OBJECT_PROP_MAGIC : |
rv = &op->magic; | | rv = &op->magic; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_VALUE : | | case CFAPI_OBJECT_PROP_VALUE : |
rv = &op->value; | | rv = &op->value; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LEVEL : | | case CFAPI_OBJECT_PROP_LEVEL : |
rv = &op->level; | | rv = &op->level; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LAST_HEAL : | | case CFAPI_OBJECT_PROP_LAST_HEAL : |
rv = &op->last_heal; | | rv = &op->last_heal; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LAST_SP : | | case CFAPI_OBJECT_PROP_LAST_SP : |
rv = &op->last_sp; | | rv = &op->last_sp; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LAST_GRACE : | | case CFAPI_OBJECT_PROP_LAST_GRACE : |
rv = &op->last_grace; | | rv = &op->last_grace; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LAST_EAT : | | case CFAPI_OBJECT_PROP_LAST_EAT : |
rv = &op->last_eat; | | rv = &op->last_eat; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_INVISIBLE_TIME : | | case CFAPI_OBJECT_PROP_INVISIBLE_TIME : |
rv = &op->invisible; | | rv = &op->invisible; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PICK_UP : | | case CFAPI_OBJECT_PROP_PICK_UP : |
rv = &op->pick_up; | | rv = &op->pick_up; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ITEM_POWER : | | case CFAPI_OBJECT_PROP_ITEM_POWER : |
rv = &op->item_power; | | rv = &op->item_power; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_GEN_SP_ARMOUR : | | case CFAPI_OBJECT_PROP_GEN_SP_ARMOUR : |
rv = &op->gen_sp_armour; | | rv = &op->gen_sp_armour; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_WEIGHT : | | case CFAPI_OBJECT_PROP_WEIGHT : |
rv = &op->weight; | | rv = &op->weight; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_WEIGHT_LIMIT : | | case CFAPI_OBJECT_PROP_WEIGHT_LIMIT : |
rv = &op->weight_limit; | | rv = &op->weight_limit; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CARRYING : | | case CFAPI_OBJECT_PROP_CARRYING : |
rv = &op->carrying; | | rv = &op->carrying; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_GLOW_RADIUS : | | case CFAPI_OBJECT_PROP_GLOW_RADIUS : |
rv = &op->glow_radius; | | rv = &op->glow_radius; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PERM_EXP : | | case CFAPI_OBJECT_PROP_PERM_EXP : |
rv = &op->perm_exp; | | rv = &op->perm_exp; |
*type = CFAPI_LONG; | | *type = CFAPI_LONG; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CURRENT_WEAPON : | | case CFAPI_OBJECT_PROP_CURRENT_WEAPON : |
rv = op->current_weapon; | | rv = op->current_weapon; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ENEMY : | | case CFAPI_OBJECT_PROP_ENEMY : |
rv = op->enemy; | | rv = op->enemy; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ATTACKED_BY : | | case CFAPI_OBJECT_PROP_ATTACKED_BY : |
rv = op->attacked_by; | | rv = op->attacked_by; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_RUN_AWAY : | | case CFAPI_OBJECT_PROP_RUN_AWAY : |
rv = &op->run_away; | | rv = &op->run_away; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CHOSEN_SKILL : | | case CFAPI_OBJECT_PROP_CHOSEN_SKILL : |
rv = op->chosen_skill; | | rv = op->chosen_skill; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_HIDDEN : | | case CFAPI_OBJECT_PROP_HIDDEN : |
rv = &op->hide; | | rv = &op->hide; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MOVE_STATUS : | | case CFAPI_OBJECT_PROP_MOVE_STATUS : |
rv = &op->move_status; | | rv = &op->move_status; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MOVE_TYPE : | | case CFAPI_OBJECT_PROP_MOVE_TYPE : |
rv = &op->attack_movement; | | rv = &op->attack_movement; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SPELL_ITEM : | | case CFAPI_OBJECT_PROP_SPELL_ITEM : |
rv = op->spellitem; | | rv = op->spellitem; |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_EXP_MULTIPLIER : | | case CFAPI_OBJECT_PROP_EXP_MULTIPLIER : |
rv = &op->expmul; | | rv = &op->expmul; |
*type = CFAPI_DOUBLE; | | *type = CFAPI_DOUBLE; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ARCHETYPE : | | case CFAPI_OBJECT_PROP_ARCHETYPE : |
rv = op->arch; | | rv = op->arch; |
*type = CFAPI_PARCH; | | *type = CFAPI_PARCH; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_OTHER_ARCH : | | case CFAPI_OBJECT_PROP_OTHER_ARCH : |
rv = op->other_arch; | | rv = op->other_arch; |
*type = CFAPI_PARCH; | | *type = CFAPI_PARCH; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CUSTOM_NAME : | | case CFAPI_OBJECT_PROP_CUSTOM_NAME : |
rv = (char*)op->custom_name; | | rv = (char*)op->custom_name; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ANIM_SPEED : | | case CFAPI_OBJECT_PROP_ANIM_SPEED : |
rv = &op->anim_speed; | | rv = &op->anim_speed; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_FRIENDLY : | | case CFAPI_OBJECT_PROP_FRIENDLY : |
ri = is_friendly(op); | | ri = is_friendly(op); |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SHORT_NAME : | | case CFAPI_OBJECT_PROP_SHORT_NAME : |
rv = (char*)query_short_name(op); | | rv = (char*)query_short_name(op); |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_BASE_NAME : | | case CFAPI_OBJECT_PROP_BASE_NAME : |
{ | | { |
int i; | | int i; |
| | |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
} | | } |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MAGICAL : | | case CFAPI_OBJECT_PROP_MAGICAL : |
ri = is_magical(op); | | ri = is_magical(op); |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LUCK : | | case CFAPI_OBJECT_PROP_LUCK : |
rv = &op->stats.luck; | | rv = &op->stats.luck; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_EXP : | | case CFAPI_OBJECT_PROP_EXP : |
rv = &op->stats.exp; | | rv = &op->stats.exp; |
*type = CFAPI_LONG; | | *type = CFAPI_LONG; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_OWNER : | | case CFAPI_OBJECT_PROP_OWNER : |
rv = get_owner(op); | | rv = get_owner(op); |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PRESENT : | | case CFAPI_OBJECT_PROP_PRESENT : |
{ | | { |
int stype; | | int stype; |
rv = 0; | | rv = 0; |
stype = va_arg(args, int); | | stype = va_arg(args, int); |
switch (stype) | | switch (stype) { |
{ | | |
unsigned char ptype; | | unsigned char ptype; |
char* buf; | | char* buf; |
archetype* at; | | archetype* at; |
| | |
case 0: /* present_in_ob */ | | case 0: /* present_in_ob */ |
ptype = (unsigned char)(va_arg(args, int)); | | ptype = (unsigned char)(va_arg(args, int)); |
rv = present_in_ob(ptype, op); | | rv = present_in_ob(ptype, op); |
break; | | break; |
| | |
case 1: /* present_in_ob_by_name */ | | case 1: /* present_in_ob_by_name */ |
ptype = (unsigned char)(va_arg(args, int)); | | ptype = (unsigned char)(va_arg(args, int)); |
buf = va_arg(args, char*); | | buf = va_arg(args, char*); |
rv = present_in_ob_by_name(ptype, buf, op); | | rv = present_in_ob_by_name(ptype, buf, op); |
break; | | break; |
| | |
case 2: /* present_arch_in_ob */ | | case 2: /* present_arch_in_ob */ |
at = va_arg(args, archetype*); | | at = va_arg(args, archetype*); |
rv = present_arch_in_ob(at, op); | | rv = present_arch_in_ob(at, op); |
| | |
} | | } |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CHEATER : | | case CFAPI_OBJECT_PROP_CHEATER : |
ri = (QUERY_FLAG(op, FLAG_WAS_WIZ)); | | ri = (QUERY_FLAG(op, FLAG_WAS_WIZ)); |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MERGEABLE : | | case CFAPI_OBJECT_PROP_MERGEABLE : |
{ | | { |
object* op2; | | object* op2; |
| | |
} | | } |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PICKABLE : | | case CFAPI_OBJECT_PROP_PICKABLE : |
{ | | { |
object* op2; | | object* op2; |
| | |
} | | } |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_FLAGS : | | case CFAPI_OBJECT_PROP_FLAGS : |
{ | | { |
int fl; | | int fl; |
| | |
} | | } |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_STR: | | case CFAPI_OBJECT_PROP_STR: |
ri = op->stats.Str; | | ri = op->stats.Str; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_DEX: | | case CFAPI_OBJECT_PROP_DEX: |
ri = op->stats.Dex; | | ri = op->stats.Dex; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CON: | | case CFAPI_OBJECT_PROP_CON: |
ri = op->stats.Con; | | ri = op->stats.Con; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_WIS: | | case CFAPI_OBJECT_PROP_WIS: |
ri = op->stats.Wis; | | ri = op->stats.Wis; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_INT: | | case CFAPI_OBJECT_PROP_INT: |
ri = op->stats.Int; | | ri = op->stats.Int; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_POW: | | case CFAPI_OBJECT_PROP_POW: |
ri = op->stats.Pow; | | ri = op->stats.Pow; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CHA: | | case CFAPI_OBJECT_PROP_CHA: |
ri = op->stats.Cha; | | ri = op->stats.Cha; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_WC: | | case CFAPI_OBJECT_PROP_WC: |
ri = op->stats.wc; | | ri = op->stats.wc; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_AC: | | case CFAPI_OBJECT_PROP_AC: |
ri = op->stats.ac; | | ri = op->stats.ac; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_HP: | | case CFAPI_OBJECT_PROP_HP: |
ri = op->stats.hp; | | ri = op->stats.hp; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SP: | | case CFAPI_OBJECT_PROP_SP: |
ri = op->stats.sp; | | ri = op->stats.sp; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_GP: | | case CFAPI_OBJECT_PROP_GP: |
ri = op->stats.grace; | | ri = op->stats.grace; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_FP: | | case CFAPI_OBJECT_PROP_FP: |
ri = op->stats.food; | | ri = op->stats.food; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MAXHP: | | case CFAPI_OBJECT_PROP_MAXHP: |
ri = op->stats.maxhp; | | ri = op->stats.maxhp; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MAXSP: | | case CFAPI_OBJECT_PROP_MAXSP: |
ri = op->stats.maxsp; | | ri = op->stats.maxsp; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MAXGP: | | case CFAPI_OBJECT_PROP_MAXGP: |
ri = op->stats.maxgrace; | | ri = op->stats.maxgrace; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_DAM: | | case CFAPI_OBJECT_PROP_DAM: |
ri = op->stats.dam; | | ri = op->stats.dam; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_GOD: | | case CFAPI_OBJECT_PROP_GOD: |
rv = (char*)determine_god(op); | | rv = (char*)determine_god(op); |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ARCH_NAME: | | case CFAPI_OBJECT_PROP_ARCH_NAME: |
rv = (char*)op->arch->name; | | rv = (char*)op->arch->name; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_INVISIBLE: | | case CFAPI_OBJECT_PROP_INVISIBLE: |
ri = op->invisible; | | ri = op->invisible; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_FACE : | | case CFAPI_OBJECT_PROP_FACE : |
ri = op->animation_id; | | ri = op->animation_id; |
rv = &ri; | | rv = &ri; |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
break; | | break; |
| | |
case CFAPI_PLAYER_PROP_IP : | | case CFAPI_PLAYER_PROP_IP : |
rv = op->contr->socket.host; | | rv = op->contr->socket.host; |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
break; | | break; |
| | |
case CFAPI_PLAYER_PROP_MARKED_ITEM: | | case CFAPI_PLAYER_PROP_MARKED_ITEM: |
rv = find_marked_object(op); | | rv = find_marked_object(op); |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case CFAPI_PLAYER_PROP_PARTY: | | case CFAPI_PLAYER_PROP_PARTY: |
rv = (op->contr ? op->contr->party : NULL); | | rv = (op->contr ? op->contr->party : NULL); |
*type = CFAPI_PPARTY; | | *type = CFAPI_PPARTY; |
| | |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
break; | | break; |
} | | } |
| | } |
va_end(args); | | va_end(args); |
return rv; | | return rv; |
} | | } |
| | |
property = va_arg(args, int); | | property = va_arg(args, int); |
rv = NULL; | | rv = NULL; |
| | |
if (op != NULL && (!op->arch || (op != &op->arch->clone))) | | if (op != NULL && (!op->arch || (op != &op->arch->clone))) { |
switch (property) | | switch (property) |
{ | | { |
case CFAPI_OBJECT_PROP_NAME : | | case CFAPI_OBJECT_PROP_NAME : |
| | |
FREE_AND_COPY(op->name, sarg); | | FREE_AND_COPY(op->name, sarg); |
send_changed_object(op); | | send_changed_object(op); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_NAME_PLURAL : | | case CFAPI_OBJECT_PROP_NAME_PLURAL : |
sarg = va_arg(args, char*); | | sarg = va_arg(args, char*); |
FREE_AND_COPY(op->name_pl, sarg); | | FREE_AND_COPY(op->name_pl, sarg); |
send_changed_object(op); | | send_changed_object(op); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_TITLE : | | case CFAPI_OBJECT_PROP_TITLE : |
sarg = va_arg(args, char*); | | sarg = va_arg(args, char*); |
FREE_AND_COPY(op->title, sarg); | | FREE_AND_COPY(op->title, sarg); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_RACE : | | case CFAPI_OBJECT_PROP_RACE : |
sarg = va_arg(args, char*); | | sarg = va_arg(args, char*); |
FREE_AND_COPY(op->race, sarg); | | FREE_AND_COPY(op->race, sarg); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SLAYING : | | case CFAPI_OBJECT_PROP_SLAYING : |
sarg = va_arg(args, char*); | | sarg = va_arg(args, char*); |
FREE_AND_COPY(op->slaying, sarg); | | FREE_AND_COPY(op->slaying, sarg); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SKILL : | | case CFAPI_OBJECT_PROP_SKILL : |
sarg = va_arg(args, char*); | | sarg = va_arg(args, char*); |
FREE_AND_COPY(op->skill, sarg); | | FREE_AND_COPY(op->skill, sarg); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MESSAGE : | | case CFAPI_OBJECT_PROP_MESSAGE : |
sarg = va_arg(args, char*); | | sarg = va_arg(args, char*); |
FREE_AND_COPY(op->msg, sarg); | | FREE_AND_COPY(op->msg, sarg); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LORE : | | case CFAPI_OBJECT_PROP_LORE : |
sarg = va_arg(args, char*); | | sarg = va_arg(args, char*); |
FREE_AND_COPY(op->lore, sarg); | | FREE_AND_COPY(op->lore, sarg); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SPEED : | | case CFAPI_OBJECT_PROP_SPEED : |
darg = va_arg(args, double); | | darg = va_arg(args, double); |
op->speed = darg; | | op->speed = darg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SPEED_LEFT : | | case CFAPI_OBJECT_PROP_SPEED_LEFT : |
darg = va_arg(args, double); | | darg = va_arg(args, double); |
op->speed_left = darg; | | op->speed_left = darg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_NROF : | | case CFAPI_OBJECT_PROP_NROF : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
if (iarg < 0) | | if (iarg < 0) |
iarg = 0; | | iarg = 0; |
if (op->nrof > (uint32)iarg) | | if (op->nrof > (uint32)iarg) |
decrease_ob_nr(op,op->nrof-iarg); | | decrease_ob_nr(op,op->nrof-iarg); |
else if (op->nrof < (uint32)iarg) | | else if (op->nrof < (uint32)iarg) { |
{ | | |
object* tmp; | | object* tmp; |
player *pl; | | player *pl; |
op->nrof = iarg; | | op->nrof = iarg; |
if (op->env != NULL) | | if (op->env != NULL) { |
{ | | |
tmp = is_player_inv(op->env); | | tmp = is_player_inv(op->env); |
if (!tmp) | | if (!tmp) { |
{ | | |
for (pl=first_player; pl; pl=pl->next) | | for (pl=first_player; pl; pl=pl->next) |
if (pl->ob->container == op->env) break; | | if (pl->ob->container == op->env) |
if (pl) tmp=pl->ob; | | break; |
else tmp=NULL; | | if (pl) |
| | tmp = pl->ob; |
| | else |
| | tmp = NULL; |
} | | } |
else { | | else { |
sum_weight(tmp); | | sum_weight(tmp); |
| | |
} | | } |
} | | } |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_DIRECTION : | | case CFAPI_OBJECT_PROP_DIRECTION : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->direction = iarg; | | op->direction = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_FACING : | | case CFAPI_OBJECT_PROP_FACING : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->facing = iarg; | | op->facing = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_RESIST : | | case CFAPI_OBJECT_PROP_RESIST : |
{ | | { |
int iargbis = va_arg(args, int); | | int iargbis = va_arg(args, int); |
| | |
op->resist[iargbis] = iarg; | | op->resist[iargbis] = iarg; |
} | | } |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ATTACK_TYPE : | | case CFAPI_OBJECT_PROP_ATTACK_TYPE : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->attacktype = iarg; | | op->attacktype = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PATH_ATTUNED : | | case CFAPI_OBJECT_PROP_PATH_ATTUNED : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->path_attuned = iarg; | | op->path_attuned = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PATH_REPELLED : | | case CFAPI_OBJECT_PROP_PATH_REPELLED : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->path_repelled = iarg; | | op->path_repelled = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PATH_DENIED : | | case CFAPI_OBJECT_PROP_PATH_DENIED : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->path_denied = iarg; | | op->path_denied = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MATERIAL : | | case CFAPI_OBJECT_PROP_MATERIAL : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->material = iarg; | | op->material = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MATERIAL_NAME : | | case CFAPI_OBJECT_PROP_MATERIAL_NAME : |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MAGIC : | | case CFAPI_OBJECT_PROP_MAGIC : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->magic = iarg; | | op->magic = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_VALUE : | | case CFAPI_OBJECT_PROP_VALUE : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->value = iarg; | | op->value = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LEVEL : | | case CFAPI_OBJECT_PROP_LEVEL : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->level = iarg; | | op->level = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LAST_HEAL : | | case CFAPI_OBJECT_PROP_LAST_HEAL : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->last_heal = iarg; | | op->last_heal = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LAST_SP : | | case CFAPI_OBJECT_PROP_LAST_SP : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->last_sp = iarg; | | op->last_sp = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LAST_GRACE : | | case CFAPI_OBJECT_PROP_LAST_GRACE : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->last_grace = iarg; | | op->last_grace = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LAST_EAT : | | case CFAPI_OBJECT_PROP_LAST_EAT : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->last_eat = iarg; | | op->last_eat = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_INVISIBLE_TIME : | | case CFAPI_OBJECT_PROP_INVISIBLE_TIME : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->invisible = iarg; | | op->invisible = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PICK_UP : | | case CFAPI_OBJECT_PROP_PICK_UP : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->pick_up = iarg; | | op->pick_up = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ITEM_POWER : | | case CFAPI_OBJECT_PROP_ITEM_POWER : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->item_power = iarg; | | op->item_power = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_GEN_SP_ARMOUR : | | case CFAPI_OBJECT_PROP_GEN_SP_ARMOUR : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->gen_sp_armour = iarg; | | op->gen_sp_armour = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_WEIGHT : | | case CFAPI_OBJECT_PROP_WEIGHT : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
if (op->weight != iarg) { | | if (op->weight != iarg) { |
object* tmp; | | object* tmp; |
player *pl; | | player *pl; |
op->weight = iarg; | | op->weight = iarg; |
if (op->env != NULL) | | if (op->env != NULL) { |
{ | | |
tmp = is_player_inv(op->env); | | tmp = is_player_inv(op->env); |
if (!tmp) | | if (!tmp) { |
{ | | |
for (pl=first_player; pl; pl=pl->next) | | for (pl=first_player; pl; pl=pl->next) |
if (pl->ob->container == op->env) break; | | if (pl->ob->container == op->env) |
if (pl) tmp=pl->ob; | | break; |
else tmp=NULL; | | if (pl) |
} | | tmp = pl->ob; |
else { | | else |
| | tmp = NULL; |
| | } else { |
sum_weight(tmp); | | sum_weight(tmp); |
fix_player(tmp); | | fix_player(tmp); |
} | | } |
| | |
} | | } |
} | | } |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_WEIGHT_LIMIT : | | case CFAPI_OBJECT_PROP_WEIGHT_LIMIT : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->weight_limit = iarg; | | op->weight_limit = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_GLOW_RADIUS : | | case CFAPI_OBJECT_PROP_GLOW_RADIUS : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->glow_radius = iarg; | | op->glow_radius = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_PERM_EXP : | | case CFAPI_OBJECT_PROP_PERM_EXP : |
larg = va_arg(args, long); | | larg = va_arg(args, long); |
op->perm_exp = larg; | | op->perm_exp = larg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ENEMY : | | case CFAPI_OBJECT_PROP_ENEMY : |
oparg = va_arg(args, object*); | | oparg = va_arg(args, object*); |
op->enemy = oparg; | | op->enemy = oparg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_RUN_AWAY : | | case CFAPI_OBJECT_PROP_RUN_AWAY : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->run_away = iarg; | | op->run_away = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CHOSEN_SKILL : | | case CFAPI_OBJECT_PROP_CHOSEN_SKILL : |
oparg = va_arg(args, object*); | | oparg = va_arg(args, object*); |
op->chosen_skill = oparg; | | op->chosen_skill = oparg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_HIDDEN : | | case CFAPI_OBJECT_PROP_HIDDEN : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->hide = iarg; | | op->hide = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MOVE_STATUS : | | case CFAPI_OBJECT_PROP_MOVE_STATUS : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->move_status = iarg; | | op->move_status = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MOVE_TYPE : | | case CFAPI_OBJECT_PROP_MOVE_TYPE : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->attack_movement = iarg; | | op->attack_movement = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SPELL_ITEM : | | case CFAPI_OBJECT_PROP_SPELL_ITEM : |
oparg = va_arg(args, object*); | | oparg = va_arg(args, object*); |
op->spellitem = oparg; | | op->spellitem = oparg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_EXP_MULTIPLIER : | | case CFAPI_OBJECT_PROP_EXP_MULTIPLIER : |
darg = va_arg(args, double); | | darg = va_arg(args, double); |
op->expmul = darg; | | op->expmul = darg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CUSTOM_NAME : | | case CFAPI_OBJECT_PROP_CUSTOM_NAME : |
sarg = va_arg(args, char*); | | sarg = va_arg(args, char*); |
FREE_AND_COPY(op->custom_name, sarg); | | FREE_AND_COPY(op->custom_name, sarg); |
send_changed_object(op); | | send_changed_object(op); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_ANIM_SPEED : | | case CFAPI_OBJECT_PROP_ANIM_SPEED : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->anim_speed = iarg; | | op->anim_speed = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_FRIENDLY : | | case CFAPI_OBJECT_PROP_FRIENDLY : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
if ((iarg == 1) && (is_friendly(op) == 0)) | | if (iarg == 1 && is_friendly(op) == 0) |
add_friendly_object(op); | | add_friendly_object(op); |
else if ((iarg == 0) && (is_friendly(op) == 1)) | | else if (iarg == 0 && is_friendly(op) == 1) |
remove_friendly_object(op); | | remove_friendly_object(op); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_LUCK : | | case CFAPI_OBJECT_PROP_LUCK : |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.luck = iarg; | | op->stats.luck = iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_EXP : | | case CFAPI_OBJECT_PROP_EXP : |
{ | | { |
char* skillname; | | char* skillname; |
| | |
change_exp(op, larg, skillname, iarg); | | change_exp(op, larg, skillname, iarg); |
} | | } |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_OWNER : | | case CFAPI_OBJECT_PROP_OWNER : |
oparg = va_arg(args, object*); | | oparg = va_arg(args, object*); |
set_owner(op, oparg); | | set_owner(op, oparg); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CHEATER : | | case CFAPI_OBJECT_PROP_CHEATER : |
set_cheat(op); | | set_cheat(op); |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_FLAGS : | | case CFAPI_OBJECT_PROP_FLAGS : |
{ | | { |
int iargbis; | | int iargbis; |
| | |
CLEAR_FLAG(op, iarg); | | CLEAR_FLAG(op, iarg); |
} | | } |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_STR: | | case CFAPI_OBJECT_PROP_STR: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.Str=iarg; | | op->stats.Str=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_DEX: | | case CFAPI_OBJECT_PROP_DEX: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.Dex=iarg; | | op->stats.Dex=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CON: | | case CFAPI_OBJECT_PROP_CON: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.Con=iarg; | | op->stats.Con=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_WIS: | | case CFAPI_OBJECT_PROP_WIS: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.Wis=iarg; | | op->stats.Wis=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_INT: | | case CFAPI_OBJECT_PROP_INT: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.Int=iarg; | | op->stats.Int=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_POW: | | case CFAPI_OBJECT_PROP_POW: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.Pow=iarg; | | op->stats.Pow=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_CHA: | | case CFAPI_OBJECT_PROP_CHA: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.Cha=iarg; | | op->stats.Cha=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_WC: | | case CFAPI_OBJECT_PROP_WC: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.wc=iarg; | | op->stats.wc=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_AC: | | case CFAPI_OBJECT_PROP_AC: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.ac=iarg; | | op->stats.ac=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_HP: | | case CFAPI_OBJECT_PROP_HP: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.hp=iarg; | | op->stats.hp=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_SP: | | case CFAPI_OBJECT_PROP_SP: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.sp=iarg; | | op->stats.sp=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_GP: | | case CFAPI_OBJECT_PROP_GP: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.grace=iarg; | | op->stats.grace=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_FP: | | case CFAPI_OBJECT_PROP_FP: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.food=iarg; | | op->stats.food=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MAXHP: | | case CFAPI_OBJECT_PROP_MAXHP: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.maxhp=iarg; | | op->stats.maxhp=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MAXSP: | | case CFAPI_OBJECT_PROP_MAXSP: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.maxsp=iarg; | | op->stats.maxsp=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_MAXGP: | | case CFAPI_OBJECT_PROP_MAXGP: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.maxgrace=iarg; | | op->stats.maxgrace=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_DAM: | | case CFAPI_OBJECT_PROP_DAM: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->stats.dam=iarg; | | op->stats.dam=iarg; |
break; | | break; |
| | |
case CFAPI_OBJECT_PROP_FACE: | | case CFAPI_OBJECT_PROP_FACE: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
op->animation_id = iarg; | | op->animation_id = iarg; |
update_object(op, UP_OBJ_FACE); | | update_object(op, UP_OBJ_FACE); |
break; | | break; |
| | |
case CFAPI_OBJECT_ANIMATION: | | case CFAPI_OBJECT_ANIMATION: |
iarg = va_arg(args, int); | | iarg = va_arg(args, int); |
if (iarg!=-1) | | if (iarg != -1) { |
{ | | |
SET_ANIMATION(op,iarg); | | SET_ANIMATION(op,iarg); |
} | | } |
update_object(op, UP_OBJ_FACE); | | update_object(op, UP_OBJ_FACE); |
break; | | break; |
| | |
case CFAPI_PLAYER_PROP_MARKED_ITEM: | | case CFAPI_PLAYER_PROP_MARKED_ITEM: |
if (op->contr) | | if (op->contr) { |
{ | | |
oparg = va_arg(args, object*); | | oparg = va_arg(args, object*); |
op->contr->mark = oparg; | | op->contr->mark = oparg; |
if (oparg) | | if (oparg) |
op->contr->mark_count = oparg->count; | | op->contr->mark_count = oparg->count; |
} | | } |
break; | | break; |
| | |
case CFAPI_PLAYER_PROP_PARTY: | | case CFAPI_PLAYER_PROP_PARTY: |
if (op->contr) | | if (op->contr) { |
{ | | |
partyarg = va_arg(args, partylist*); | | partyarg = va_arg(args, partylist*); |
op->contr->party = partyarg; | | op->contr->party = partyarg; |
} | | } |
break; | | break; |
| | |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
break; | | break; |
} | | } |
| | } |
va_end(args); | | va_end(args); |
| | |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
| | |
| | |
va_end(args); | | va_end(args); |
| | |
if (kind == 0) | | if (kind == 0) { |
{ | | |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
return object_create_clone(op); | | return object_create_clone(op); |
} | | } else { |
else | | |
{ | | |
object* tmp; | | object* tmp; |
tmp = get_object(); | | tmp = get_object(); |
copy_object(op,tmp); | | copy_object(op,tmp); |
| | |
ival = va_arg(args, int); | | ival = va_arg(args, int); |
rv = find_object(ival); | | rv = find_object(ival); |
break; | | break; |
| | |
case 1: | | case 1: |
sval = va_arg(args, char*); | | sval = va_arg(args, char*); |
rv = find_object_name(sval); | | rv = find_object_name(sval); |
break; | | break; |
| | |
case 2: | | case 2: |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
ival = va_arg(args, int); | | ival = va_arg(args, int); |
ival2 = va_arg(args, int); | | ival2 = va_arg(args, int); |
rv = find_obj_by_type_subtype(op, ival, ival2); | | rv = find_obj_by_type_subtype(op, ival, ival2); |
break; | | break; |
| | |
case 3: | | case 3: |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
rv = is_player_inv(op); | | rv = is_player_inv(op); |
break; | | break; |
| | |
default: | | default: |
rv = NULL; | | rv = NULL; |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
| | |
va_end(args); | | va_end(args); |
return get_object(); | | return get_object(); |
break; | | break; |
| | |
case 1: /* Named object. Nearly the old plugin behavior, but we don't add artifact suffixes */ | | case 1: /* Named object. Nearly the old plugin behavior, but we don't add artifact suffixes */ |
{ | | { |
char* sval; | | char* sval; |
| | |
| | |
op = get_archetype_by_object_name(sval); | | op = get_archetype_by_object_name(sval); |
| | |
if (strncmp(query_name(op),ARCH_SINGULARITY, ARCH_SINGULARITY_LEN)==0) | | if (strncmp(query_name(op), ARCH_SINGULARITY, ARCH_SINGULARITY_LEN) == 0) { |
{ | | |
free_object(op); | | free_object(op); |
/* Try with archetype names... */ | | /* Try with archetype names... */ |
op = get_archetype(sval); | | op = get_archetype(sval); |
if (strncmp(query_name(op),ARCH_SINGULARITY, ARCH_SINGULARITY_LEN)==0) | | if (strncmp(query_name(op), ARCH_SINGULARITY, ARCH_SINGULARITY_LEN) == 0) { |
{ | | |
free_object(op); | | free_object(op); |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
va_end(args); | | va_end(args); |
| | |
op = va_arg(args, object*); | | op = va_arg(args, object*); |
itype = va_arg(args, int); | | itype = va_arg(args, int); |
| | |
switch (itype) | | switch (itype) { |
{ | | |
case 0: | | case 0: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
orig = va_arg(args, object*); | | orig = va_arg(args, object*); |
| | |
rv = insert_ob_in_map_at(op, map, orig, flag,x,y); | | rv = insert_ob_in_map_at(op, map, orig, flag,x,y); |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case 1: | | case 1: |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
orig = va_arg(args, object*); | | orig = va_arg(args, object*); |
| | |
rv = insert_ob_in_map(op, map, orig, flag); | | rv = insert_ob_in_map(op, map, orig, flag); |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
break; | | break; |
| | |
case 2: | | case 2: |
arch_string = va_arg(args, char*); | | arch_string = va_arg(args, char*); |
replace_insert_ob_in_map(arch_string, op); | | replace_insert_ob_in_map(arch_string, op); |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
break; | | break; |
| | |
case 3: | | case 3: |
orig = va_arg(args, object*); | | orig = va_arg(args, object*); |
rv = insert_ob_in_ob(op, orig); | | rv = insert_ob_in_ob(op, orig); |
if (orig->type == PLAYER) | | if (orig->type == PLAYER) { |
{ | | |
esrv_send_item(orig,op); | | esrv_send_item(orig,op); |
} | | } |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
| | |
op2 = va_arg(args, object*); | | op2 = va_arg(args, object*); |
checktype = va_arg(args, int); | | checktype = va_arg(args, int); |
| | |
if (checktype == 0) | | if (checktype == 0) { |
{ | | |
check_inv(op,op2); | | check_inv(op,op2); |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
} | | } else { |
else | | |
{ | | |
ret = check_inv_recursive(op,op2); | | ret = check_inv_recursive(op,op2); |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
} | | } |
| | |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
return &rv; | | return &rv; |
break; | | break; |
| | |
case 1: | | case 1: |
x = va_arg(args, int); | | x = va_arg(args, int); |
y = va_arg(args, int); | | y = va_arg(args, int); |
map = va_arg(args, mapstruct*); | | map = va_arg(args, mapstruct*); |
va_end(args); | | va_end(args); |
if ((x<0)||(y<0)) | | if (x < 0 || y < 0) { |
{ | | |
x = map->enter_x; | | x = map->enter_x; |
y = map->enter_y; | | y = map->enter_y; |
} | | } |
/* originator = get_object(); | | /* |
| | originator = get_object(); |
EXIT_PATH(originator)=add_string(map->path); | | EXIT_PATH(originator)=add_string(map->path); |
EXIT_X(originator)=x; | | EXIT_X(originator)=x; |
EXIT_Y(originator)=y; | | EXIT_Y(originator)=y; |
| | |
/*enter_exit(op,originator);*/ | | /*enter_exit(op,originator);*/ |
insert_ob_in_map_at(op, map, NULL, 0, x, y); | | insert_ob_in_map_at(op, map, NULL, 0, x, y); |
/*printf("A Transfer: X=%d, Y=%d, MAP=%s\n",x,y,op->map->name); | | /*printf("A Transfer: X=%d, Y=%d, MAP=%s\n",x,y,op->map->name); |
free_object(originator);*/ | | free_object(originator); |
| | */ |
*type = CFAPI_INT; | | *type = CFAPI_INT; |
return &rv; | | return &rv; |
break; | | break; |
| | |
case 0: /* By name, either exact or from query_name */ | | case 0: /* By name, either exact or from query_name */ |
str = va_arg(args, char*); | | str = va_arg(args, char*); |
rv = present_arch_in_ob(find_archetype(str),op); | | rv = present_arch_in_ob(find_archetype(str),op); |
if (rv == NULL) | | if (rv == NULL) { |
{ | | |
object* tmp; | | object* tmp; |
/* Search by query_name instead */ | | /* Search by query_name instead */ |
for(tmp = op->inv; tmp; tmp = tmp->below) | | for (tmp = op->inv; tmp; tmp = tmp->below) { |
{ | | |
if (!strncmp(query_name(tmp),str,strlen(str))) | | if (!strncmp(query_name(tmp),str,strlen(str))) |
rv = tmp; | | rv = tmp; |
if (!strncmp(tmp->name,str,strlen(str))) | | if (!strncmp(tmp->name,str,strlen(str))) |
rv = tmp; | | rv = tmp; |
if (rv != NULL) break; | | if (rv != NULL) |
| | break; |
} | | } |
} | | } |
break; | | break; |
| | |
default: | | default: |
rv = NULL; | | rv = NULL; |
break; | | break; |
} | | } |
va_end(args); | | va_end(args); |
| | |
if (rv == NULL) | | if (rv == NULL) { |
{ | | |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
} | | } |
return rv; | | return rv; |
| | |
author = va_arg(args, object*); | | author = va_arg(args, object*); |
va_end(args); | | va_end(args); |
| | |
if (QUERY_FLAG(op, FLAG_NO_DROP)) return NULL; | | if (QUERY_FLAG(op, FLAG_NO_DROP)) |
| | return NULL; |
drop(author,op); | | drop(author,op); |
| | |
if (author->type==PLAYER) | | if (author->type == PLAYER) { |
{ | | |
author->contr->count=0; | | author->contr->count=0; |
author->contr->socket.update_look=1; | | author->contr->socket.update_look=1; |
} | | } |
| | |
msg = va_arg(args, char*); | | msg = va_arg(args, char*); |
va_end(args); | | va_end(args); |
| | |
if ((!op) || (!msg)) | | if (!op || !msg) |
return NULL; | | return NULL; |
sprintf(buf, "%s says: ",op->name); | | sprintf(buf, "%s says: ",op->name); |
strncat(buf, msg, MAX_BUF - strlen(buf)-1); | | strncat(buf, msg, MAX_BUF - strlen(buf)-1); |
| | |
x = va_arg(args,int); | | x = va_arg(args,int); |
y = va_arg(args,int); | | y = va_arg(args,int); |
| | |
if (!out_of_map( map,x,y )) | | if (!out_of_map(map, x, y)) { |
{ | | |
int k; | | int k; |
object *tmp; | | object *tmp; |
k = find_first_free_spot(who,map,x,y); | | k = find_first_free_spot(who,map,x,y); |
if (k==-1) | | if (k == -1) { |
{ | | |
result = 1; | | result = 1; |
return &result; | | return &result; |
} | | } |
| | |
va_start(args, type); | | va_start(args, type); |
arch = va_arg(args, archetype*); | | arch = va_arg(args, archetype*); |
prop = va_arg(args, int); | | prop = va_arg(args, int); |
switch (prop) | | switch (prop) { |
{ | | |
case CFAPI_ARCH_PROP_NAME: | | case CFAPI_ARCH_PROP_NAME: |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
rv = (void*)arch->name; | | rv = (void*)arch->name; |
break; | | break; |
| | |
case CFAPI_ARCH_PROP_NEXT: | | case CFAPI_ARCH_PROP_NEXT: |
*type = CFAPI_PARCH; | | *type = CFAPI_PARCH; |
rv = arch->next; | | rv = arch->next; |
break; | | break; |
| | |
case CFAPI_ARCH_PROP_HEAD: | | case CFAPI_ARCH_PROP_HEAD: |
*type = CFAPI_PARCH; | | *type = CFAPI_PARCH; |
rv = arch->head; | | rv = arch->head; |
break; | | break; |
| | |
case CFAPI_ARCH_PROP_MORE: | | case CFAPI_ARCH_PROP_MORE: |
*type = CFAPI_PARCH; | | *type = CFAPI_PARCH; |
rv = arch->more; | | rv = arch->more; |
break; | | break; |
| | |
case CFAPI_ARCH_PROP_CLONE: | | case CFAPI_ARCH_PROP_CLONE: |
*type = CFAPI_POBJECT; | | *type = CFAPI_POBJECT; |
rv = &arch->clone; | | rv = &arch->clone; |
break; | | break; |
| | |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
rv = NULL; | | rv = NULL; |
| | |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
rv = (void*)party->partyname; | | rv = (void*)party->partyname; |
break; | | break; |
| | |
case CFAPI_PARTY_PROP_NEXT: | | case CFAPI_PARTY_PROP_NEXT: |
*type = CFAPI_PPARTY; | | *type = CFAPI_PPARTY; |
rv = (party?party->next:get_firstparty()); | | rv = (party?party->next:get_firstparty()); |
break; | | break; |
| | |
case CFAPI_PARTY_PROP_PASSWORD: | | case CFAPI_PARTY_PROP_PASSWORD: |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
rv = (void*)party->passwd; | | rv = (void*)party->passwd; |
break; | | break; |
| | |
case CFAPI_PARTY_PROP_PLAYER: | | case CFAPI_PARTY_PROP_PLAYER: |
*type = CFAPI_PPLAYER; | | *type = CFAPI_PPLAYER; |
obarg = va_arg(args, object*); | | obarg = va_arg(args, object*); |
pl = ( obarg ? obarg->contr : first_player ); | | pl = ( obarg ? obarg->contr : first_player ); |
rv = NULL; | | rv = NULL; |
for (; pl != NULL; pl = pl->next) | | for (; pl != NULL; pl = pl->next) |
if (pl->ob->contr->party == party) | | if (pl->ob->contr->party == party) { |
{ | | |
rv = (void*)pl; | | rv = (void*)pl; |
break; | | break; |
} | | } |
break; | | break; |
| | |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
rv = NULL; | | rv = NULL; |
| | |
va_start(args, type); | | va_start(args, type); |
reg = va_arg(args, region*); | | reg = va_arg(args, region*); |
prop = va_arg(args, int); | | prop = va_arg(args, int); |
switch (prop) | | switch (prop) { |
{ | | |
case CFAPI_REGION_PROP_NAME: | | case CFAPI_REGION_PROP_NAME: |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
rv = (void*)reg->name; | | rv = (void*)reg->name; |
break; | | break; |
| | |
case CFAPI_REGION_PROP_NEXT: | | case CFAPI_REGION_PROP_NEXT: |
*type = CFAPI_PREGION; | | *type = CFAPI_PREGION; |
rv = (reg?reg->next:first_region); | | rv = (reg?reg->next:first_region); |
break; | | break; |
| | |
case CFAPI_REGION_PROP_PARENT: | | case CFAPI_REGION_PROP_PARENT: |
*type = CFAPI_PREGION; | | *type = CFAPI_PREGION; |
rv = (void*)reg->parent; | | rv = (void*)reg->parent; |
break; | | break; |
| | |
case CFAPI_REGION_PROP_LONGNAME: | | case CFAPI_REGION_PROP_LONGNAME: |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
rv = (void*)reg->longname; | | rv = (void*)reg->longname; |
break; | | break; |
| | |
case CFAPI_REGION_PROP_MESSAGE: | | case CFAPI_REGION_PROP_MESSAGE: |
*type = CFAPI_STRING; | | *type = CFAPI_STRING; |
rv = (void*)reg->msg; | | rv = (void*)reg->msg; |
break; | | break; |
| | |
default: | | default: |
*type = CFAPI_NONE; | | *type = CFAPI_NONE; |
rv = NULL; | | rv = NULL; |
| | |
if (plugins_list == NULL) | | if (plugins_list == NULL) |
return NULL; | | return NULL; |
| | |
for(cp=plugins_list; cp != NULL; cp=cp->next) | | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
{ | | |
rtn_cmd = cp->propfunc(&i, "command?"); | | rtn_cmd = cp->propfunc(&i, "command?"); |
return rtn_cmd; | | return rtn_cmd; |
} | | } |
| | |
return -1; | | return -1; |
| | |
result = -1; | | result = -1; |
while((currentfile = readdir(plugdir)) != NULL) | | while ((currentfile = readdir(plugdir)) != NULL) { |
{ | | |
l = strlen(currentfile->d_name); | | l = strlen(currentfile->d_name); |
if (l > strlen(PLUGIN_SUFFIX)) | | if (l > strlen(PLUGIN_SUFFIX)) { |
{ | | if (strcmp(currentfile->d_name+l-strlen(PLUGIN_SUFFIX), PLUGIN_SUFFIX) == 0) { |
if (strcmp(currentfile->d_name+l-strlen(PLUGIN_SUFFIX), PLUGIN_SUFFIX) == 0) | | |
{ | | |
strcpy(buf2,buf); | | strcpy(buf2,buf); |
strcat(buf2,currentfile->d_name); | | strcat(buf2,currentfile->d_name); |
LOG(llevInfo," -> Loading plugin : %s\n",currentfile->d_name); | | LOG(llevInfo," -> Loading plugin : %s\n",currentfile->d_name); |