diff options
author | Asheraf <acheraf1998@gmail.com> | 2020-01-01 16:31:52 +0100 |
---|---|---|
committer | Asheraf <acheraf1998@gmail.com> | 2020-01-01 16:32:58 +0100 |
commit | 486b1f1558d8bd87eb3260ec4eb0a573e509a28c (patch) | |
tree | 89a5e74efae3d393b184806a341cc719fb7c6dba /src/map | |
parent | bf99547843038bc15dc1948748d969950e866465 (diff) | |
download | hercules-486b1f1558d8bd87eb3260ec4eb0a573e509a28c.tar.gz hercules-486b1f1558d8bd87eb3260ec4eb0a573e509a28c.tar.bz2 hercules-486b1f1558d8bd87eb3260ec4eb0a573e509a28c.tar.xz hercules-486b1f1558d8bd87eb3260ec4eb0a573e509a28c.zip |
Fix pc_have_item_chain should get the chain id from cache
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/pc.c | 12 | ||||
-rw-r--r-- | src/map/pc.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 179a4b78a..3b3cd58e1 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -12162,15 +12162,15 @@ static int pc_have_magnifier(struct map_session_data *sd) /** * checks if player have any item that listed in item chain * @param sd map_session_data of Player - * @param chain_id unsigned short of item chain id + * @param chain_cache_id cache id of item chain * @return index of inventory, INDEX_NOT_FOUND if it is not found */ -static int pc_have_item_chain(struct map_session_data *sd, unsigned short chain_id) +static int pc_have_item_chain(struct map_session_data *sd, enum e_chain_cache chain_cache_id) { - if (chain_id >= itemdb->chain_count) { - ShowError("itemdb_chain_item: unknown chain id %d\n", chain_id); - return INDEX_NOT_FOUND; - } + nullpo_retr(INDEX_NOT_FOUND, sd); + Assert_retr(INDEX_NOT_FOUND, chain_cache_id >= ECC_ORE && chain_cache_id < ECC_MAX); + + int chain_id = itemdb->chain_cache[chain_cache_id]; for (int n = 0; n < itemdb->chains[chain_id].qty; n++) { struct item_chain_entry *entry = &itemdb->chains[chain_id].items[n]; diff --git a/src/map/pc.h b/src/map/pc.h index 7a42be5be..6ae52c84b 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1186,7 +1186,7 @@ END_ZEROED_BLOCK; /* End */ void (*update_idle_time) (struct map_session_data* sd, enum e_battle_config_idletime type); int (*have_magnifier) (struct map_session_data *sd); - int (*have_item_chain) (struct map_session_data *sd, unsigned short chain_id); + int (*have_item_chain) (struct map_session_data *sd, enum e_chain_cache chain_cache_id); bool (*process_chat_message) (struct map_session_data *sd, const char *message); int (*wis_message_to_gm) (const char *sender_name, int permission, const char *message); |