version 1.83 | | version 1.84 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.83 2003/06/19 06:52:49 mwedel Exp $"; | | * "$Id: apply.c,v 1.84 2003/06/26 11:27:43 gros Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
| | |
int esrv_apply_container (object *op, object *sack) | | int esrv_apply_container (object *op, object *sack) |
{ | | { |
| | event *evt; |
object *tmp=op->container; | | object *tmp=op->container; |
| | |
if(op->type!=PLAYER) | | if(op->type!=PLAYER) |
| | |
CLEAR_FLAG (op->container, FLAG_FLY_OFF); | | CLEAR_FLAG (op->container, FLAG_FLY_OFF); |
} | | } |
/* GROS: Handle for plugin close event */ | | /* GROS: Handle for plugin close event */ |
if(tmp->event_hook[EVENT_CLOSE] != NULL) | | if ((evt = find_event(tmp, EVENT_CLOSE)) != NULL) |
{ | | { |
CFParm CFP; | | CFParm CFP; |
CFParm* CFR; | | CFParm* CFR; |
| | |
CFP.Value[6] = &m; | | CFP.Value[6] = &m; |
CFP.Value[7] = &m; | | CFP.Value[7] = &m; |
CFP.Value[8] = &l; | | CFP.Value[8] = &l; |
CFP.Value[9] = tmp->event_hook[k]; | | CFP.Value[9] = evt->hook; |
CFP.Value[10]= tmp->event_options[k]; | | CFP.Value[10]= evt->options; |
if (findPlugin(tmp->event_plugin[k])>=0) | | if (findPlugin(evt->plugin)>=0) |
{ | | { |
CFR = (PlugList[findPlugin(tmp->event_plugin[k])].eventfunc) (&CFP); | | CFR = (PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP); |
rtn_script = *(int *)(CFR->Value[0]); | | rtn_script = *(int *)(CFR->Value[0]); |
if (rtn_script!=0) return 1; | | if (rtn_script!=0) return 1; |
} | | } |
| | |
void move_apply (object *trap, object *victim, object *originator) | | void move_apply (object *trap, object *victim, object *originator) |
{ | | { |
static int recursion_depth = 0; | | static int recursion_depth = 0; |
| | event *evt; |
| | |
/* move_apply() is the most likely candidate for causing unwanted and | | /* move_apply() is the most likely candidate for causing unwanted and |
* possibly unlimited recursion. */ | | * possibly unlimited recursion. */ |
| | |
recursion_depth++; | | recursion_depth++; |
if (trap->head) trap=trap->head; | | if (trap->head) trap=trap->head; |
/* GROS: Handle for plugin close event */ | | /* GROS: Handle for plugin close event */ |
if(trap->event_hook[EVENT_TRIGGER] != NULL) | | if ((evt = find_event(trap, EVENT_TRIGGER))!=NULL) |
{ | | { |
CFParm CFP; | | CFParm CFP; |
CFParm* CFR; | | CFParm* CFR; |
| | |
CFP.Value[6] = &m; | | CFP.Value[6] = &m; |
CFP.Value[7] = &m; | | CFP.Value[7] = &m; |
CFP.Value[8] = &l; | | CFP.Value[8] = &l; |
CFP.Value[9] = trap->event_hook[k]; | | CFP.Value[9] = evt->hook; |
CFP.Value[10]= trap->event_options[k]; | | CFP.Value[10]= evt->options; |
if (findPlugin(trap->event_plugin[k])>=0) | | if (findPlugin(evt->plugin)>=0) |
{ | | { |
CFR = (PlugList[findPlugin(trap->event_plugin[k])].eventfunc) (&CFP); | | CFR = (PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP); |
rtn_script = *(int *)(CFR->Value[0]); | | rtn_script = *(int *)(CFR->Value[0]); |
if (rtn_script!=0) return; | | if (rtn_script!=0) return; |
} | | } |
| | |
static void apply_book (object *op, object *tmp) | | static void apply_book (object *op, object *tmp) |
{ | | { |
int lev_diff; | | int lev_diff; |
| | event *evt; |
| | |
if(QUERY_FLAG(op, FLAG_BLIND)&&!QUERY_FLAG(op,FLAG_WIZ)) { | | if(QUERY_FLAG(op, FLAG_BLIND)&&!QUERY_FLAG(op,FLAG_WIZ)) { |
new_draw_info(NDI_UNIQUE, 0,op,"You are unable to read while blind."); | | new_draw_info(NDI_UNIQUE, 0,op,"You are unable to read while blind."); |
| | |
new_draw_info_format (NDI_UNIQUE, 0, op, | | new_draw_info_format (NDI_UNIQUE, 0, op, |
"You open the %s and start reading.", tmp->name); | | "You open the %s and start reading.", tmp->name); |
/* GROS: Handle for plugin trigger event */ | | /* GROS: Handle for plugin trigger event */ |
if(tmp->event_hook[EVENT_APPLY] != NULL) | | if ((evt = find_event(tmp, EVENT_APPLY)) != NULL) |
{ | | { |
CFParm CFP; | | CFParm CFP; |
int k, l, m; | | int k, l, m; |
| | |
CFP.Value[6] = &m; | | CFP.Value[6] = &m; |
CFP.Value[7] = &m; | | CFP.Value[7] = &m; |
CFP.Value[8] = &l; | | CFP.Value[8] = &l; |
CFP.Value[9] = tmp->event_hook[k]; | | CFP.Value[9] = evt->hook; |
CFP.Value[10]= tmp->event_options[k]; | | CFP.Value[10]= evt->options; |
if (findPlugin(tmp->event_plugin[k])>=0) | | if (findPlugin(evt->plugin)>=0) |
((PlugList[findPlugin(tmp->event_plugin[k])].eventfunc) (&CFP)); | | ((PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP)); |
} | | } |
else | | else |
new_draw_info(NDI_UNIQUE | NDI_NAVY, 0, op, tmp->msg); | | new_draw_info(NDI_UNIQUE | NDI_NAVY, 0, op, tmp->msg); |
| | |
int manual_apply (object *op, object *tmp, int aflag) | | int manual_apply (object *op, object *tmp, int aflag) |
{ | | { |
int rtn_script; | | int rtn_script; |
| | event *evt; |
| | |
if (tmp->head) tmp=tmp->head; | | if (tmp->head) tmp=tmp->head; |
| | |
if (QUERY_FLAG (tmp, FLAG_UNPAID) && ! QUERY_FLAG (tmp, FLAG_APPLIED)) { | | if (QUERY_FLAG (tmp, FLAG_UNPAID) && ! QUERY_FLAG (tmp, FLAG_APPLIED)) { |
| | |
return 0; | | return 0; |
| | |
/* GROS: Handle for plugin trigger event */ | | /* GROS: Handle for plugin trigger event */ |
if(tmp->event_hook[EVENT_APPLY] != NULL) | | if ((evt = find_event(tmp, EVENT_APPLY)) != NULL) |
{ | | { |
CFParm CFP; | | CFParm CFP; |
CFParm* CFR; | | CFParm* CFR; |
| | |
CFP.Value[6] = &m; | | CFP.Value[6] = &m; |
CFP.Value[7] = &m; | | CFP.Value[7] = &m; |
CFP.Value[8] = &l; | | CFP.Value[8] = &l; |
CFP.Value[9] = tmp->event_hook[k]; | | CFP.Value[9] = evt->hook; |
CFP.Value[10]= tmp->event_options[k]; | | CFP.Value[10]= evt->options; |
if (findPlugin(tmp->event_plugin[k])>=0) | | if (findPlugin(evt->plugin)>=0) |
{ | | { |
CFR = (PlugList[findPlugin(tmp->event_plugin[k])].eventfunc) (&CFP); | | CFR = (PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP); |
rtn_script = *(int *)(CFR->Value[0]); | | rtn_script = *(int *)(CFR->Value[0]); |
if (rtn_script!=0) return 1; | | if (rtn_script!=0) return 1; |
} | | } |
| | |
{ | | { |
int basic_flag = aflags & AP_BASIC_FLAGS; | | int basic_flag = aflags & AP_BASIC_FLAGS; |
object *tmp, *tmp2; | | object *tmp, *tmp2; |
| | event *evt; |
int i; | | int i; |
| | |
if(who==NULL) { | | if(who==NULL) { |
| | |
| | |
(void) change_abil (who,op); | | (void) change_abil (who,op); |
/* GROS: update the current_weapon_script field (used with EVENT_ATTACK for weapons) */ | | /* GROS: update the current_weapon_script field (used with EVENT_ATTACK for weapons) */ |
if (op->event_hook[EVENT_ATTACK] != NULL) { | | if ((evt = find_event(op, EVENT_ATTACK)) != NULL) { |
LOG(llevDebug, "Scripting Weapon wielded\n"); | | LOG(llevDebug, "Scripting Weapon wielded\n"); |
if (who->current_weapon_script) free_string(who->current_weapon_script); | | if (who->current_weapon_script) free_string(who->current_weapon_script); |
who->current_weapon_script=add_string(query_name(op)); | | who->current_weapon_script=add_string(query_name(op)); |