diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-07 22:39:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-10 23:06:08 +0300 |
commit | 7614415c83f2a091302f62806e16adca1feea6bf (patch) | |
tree | 7839620990292d97fe23dc40215b1fc1545a4cd3 /src | |
parent | 2f488d98cacccc17d1702230488e15f7f9bc25e7 (diff) | |
download | hercules-7614415c83f2a091302f62806e16adca1feea6bf.tar.gz hercules-7614415c83f2a091302f62806e16adca1feea6bf.tar.bz2 hercules-7614415c83f2a091302f62806e16adca1feea6bf.tar.xz hercules-7614415c83f2a091302f62806e16adca1feea6bf.zip |
Move unequip item script function call into function script_run_item_unequip_script.
Diffstat (limited to 'src')
-rw-r--r-- | src/map/pc.c | 8 | ||||
-rw-r--r-- | src/map/script.c | 17 | ||||
-rw-r--r-- | src/map/script.h | 1 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index d6b377b9b..ec74e2da8 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9815,10 +9815,10 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) if ( battle_config.unequip_restricted_equipment & 1 ) { ARR_FIND(0, map->list[sd->bl.m].zone->disabled_items_count, i, map->list[sd->bl.m].zone->disabled_items[i] == sd->status.inventory[n].nameid); if ( i == map->list[sd->bl.m].zone->disabled_items_count ) - script->run(sd->inventory_data[n]->unequip_script,0,sd->bl.id,npc->fake_nd->bl.id); + script->run_item_unequip_script(sd, sd->inventory_data[n], npc->fake_nd->bl.id); } else - script->run(sd->inventory_data[n]->unequip_script,0,sd->bl.id,npc->fake_nd->bl.id); + script->run_item_unequip_script(sd, sd->inventory_data[n], npc->fake_nd->bl.id); } if(itemdb_isspecial(sd->status.inventory[n].card[0])) ; //No cards @@ -9834,10 +9834,10 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) int j; ARR_FIND(0, map->list[sd->bl.m].zone->disabled_items_count, j, map->list[sd->bl.m].zone->disabled_items[j] == sd->status.inventory[n].card[i]); if ( j == map->list[sd->bl.m].zone->disabled_items_count ) - script->run(data->unequip_script,0,sd->bl.id,npc->fake_nd->bl.id); + script->run_item_unequip_script(sd, data, npc->fake_nd->bl.id); } else - script->run(data->unequip_script,0,sd->bl.id,npc->fake_nd->bl.id); + script->run_item_unequip_script(sd, data, npc->fake_nd->bl.id); } } diff --git a/src/map/script.c b/src/map/script.c index 190a942fb..1cad581b3 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -19866,6 +19866,22 @@ void script_run_item_equip_script(struct map_session_data *sd, struct item_data script->current_item_id = 0; } +void script_run_item_unequip_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull (1, 2))); + +/** + * Run item unequip script for item. + * + * @param sd player session data. Must be correct and checked before. + * @param data unequipped item data. Must be correct and checked before. + * @param oid npc id. Can be also 0 or fake npc id. + */ +void script_run_item_unequip_script(struct map_session_data *sd, struct item_data *data, int oid) +{ + script->current_item_id = data->nameid; + script->run(data->unequip_script, 0, sd->bl.id, oid); + script->current_item_id = 0; +} + #define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args, false } #define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args, false } #define BUILDIN_DEF_DEPRECATED(x,args) { buildin_ ## x , #x , args, true } @@ -20813,4 +20829,5 @@ void script_defaults(void) { script->run_use_script = script_run_use_script; script->run_item_equip_script = script_run_item_equip_script; + script->run_item_unequip_script = script_run_item_unequip_script; } diff --git a/src/map/script.h b/src/map/script.h index d8b008d78..20aa7b3c2 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -768,6 +768,7 @@ struct script_interface { void (*parser_clean_leftovers) (void); void (*run_use_script) (struct map_session_data *sd, struct item_data *data, int oid); void (*run_item_equip_script) (struct map_session_data *sd, struct item_data *data, int oid); + void (*run_item_unequip_script) (struct map_session_data *sd, struct item_data *data, int oid); }; struct script_interface *script; |