version 1.158 | | version 1.159 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.158 2006/01/15 16:50:32 ryo_saeba Exp $"; | | * "$Id: apply.c,v 1.159 2006/02/05 05:51:11 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
* | | * |
* Return value: | | * Return value: |
* 0: player or monster can't apply objects of that type | | * 0: player or monster can't apply objects of that type |
* 2: objects of that type can't be applied if not in inventory | | |
* 1: has been applied, or there was an error applying the object | | * 1: has been applied, or there was an error applying the object |
| | * 2: objects of that type can't be applied if not in inventory |
* | | * |
* op is the object that is causing object to be applied, tmp is the object | | * op is the object that is causing object to be applied, tmp is the object |
* being applied. | | * being applied. |
| | |
} | | } |
} | | } |
| | |
/* monsters mustn't apply random chests, nor magic_mouths with a counter */ | | |
if (op->type != PLAYER && tmp->type == TREASURE) | | |
return 0; | | |
| | |
/* Lauwenmark: Handle for plugin apply event */ | | /* Lauwenmark: Handle for plugin apply event */ |
if (execute_event(tmp, EVENT_APPLY,op,NULL,NULL,SCRIPT_FIX_ALL)!=0) | | if (execute_event(tmp, EVENT_APPLY,op,NULL,NULL,SCRIPT_FIX_ALL)!=0) |
return 1; | | return 1; |
switch (tmp->type) | | |
{ | | switch (tmp->type) { |
| | |
case CF_HANDLE: | | case CF_HANDLE: |
new_draw_info(NDI_UNIQUE, 0,op,"You turn the handle."); | | new_draw_info(NDI_UNIQUE, 0,op,"You turn the handle."); |
play_sound_map(op->map, op->x, op->y, SOUND_TURN_HANDLE); | | play_sound_map(op->map, op->x, op->y, SOUND_TURN_HANDLE); |
| | |
return 1; | | return 1; |
| | |
case TREASURE: | | case TREASURE: |
| | if (op->type == PLAYER) { |
apply_treasure (op, tmp); | | apply_treasure (op, tmp); |
return 1; | | return 1; |
| | } else { |
| | return 0; |
| | } |
| | |
case WEAPON: | | case WEAPON: |
case ARMOUR: | | case ARMOUR: |
| | |
case ITEM_TRANSFORMER: | | case ITEM_TRANSFORMER: |
apply_item_transformer( op, tmp ); | | apply_item_transformer( op, tmp ); |
return 1; | | return 1; |
| | |
default: | | default: |
return 0; | | return 0; |
} | | } |