From a8f85f757435bc6f409d78612b53e4c3c531abb9 Mon Sep 17 00:00:00 2001 From: Ibrahim Zidan Date: Sat, 13 Apr 2019 21:17:11 +0200 Subject: Fix variables shadowing refine interface variable map-server source Signed-off-by: Ibrahim Zidan --- src/map/atcommand.c | 28 ++++++++++++++-------------- src/map/log.c | 4 ++-- src/map/log.h | 2 +- src/map/searchstore.c | 4 ++-- src/map/searchstore.h | 2 +- src/map/status.c | 12 ++++++------ 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/map/atcommand.c b/src/map/atcommand.c index e2ba88e64..e97822e69 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1271,20 +1271,20 @@ ACMD(item2) struct item_data *item_data; char item_name[100]; int item_id, number = 0, bound = 0; - int identify = 0, refine = 0, attr = 0; + int identify = 0, refine_level = 0, attr = 0; int c1 = 0, c2 = 0, c3 = 0, c4 = 0; memset(item_name, '\0', sizeof(item_name)); if (!strcmpi(info->command,"itembound2") && (!*message || ( - sscanf(message, "\"%99[^\"]\" %12d %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, &bound) < 10 && - sscanf(message, "%99s %12d %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, &bound) < 10 ))) { + sscanf(message, "\"%99[^\"]\" %12d %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine_level, &attr, &c1, &c2, &c3, &c4, &bound) < 10 && + sscanf(message, "%99s %12d %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine_level, &attr, &c1, &c2, &c3, &c4, &bound) < 10 ))) { clif->message(fd, msg_fd(fd,296)); // Please enter all parameters (usage: @itembound2 clif->message(fd, msg_fd(fd,297)); // ). return false; } else if (!*message - || ( sscanf(message, "\"%99[^\"]\" %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 - && sscanf(message, "%99s %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 + || ( sscanf(message, "\"%99[^\"]\" %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine_level, &attr, &c1, &c2, &c3, &c4) < 9 + && sscanf(message, "%99s %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine_level, &attr, &c1, &c2, &c3, &c4) < 9 )) { clif->message(fd, msg_fd(fd,984)); // Please enter all parameters (usage: @item2 clif->message(fd, msg_fd(fd,985)); // ). @@ -1320,20 +1320,20 @@ ACMD(item2) get_count = 1; if (item_data->type == IT_PETEGG) { identify = 1; - refine = 0; + refine_level = 0; } if (item_data->type == IT_PETARMOR) - refine = 0; + refine_level = 0; } else { identify = 1; - refine = attr = 0; + refine_level = attr = 0; } - refine = cap_value(refine, 0, MAX_REFINE); + refine_level = cap_value(refine_level, 0, MAX_REFINE); for (i = 0; i < loop; i++) { memset(&item_tmp, 0, sizeof(item_tmp)); item_tmp.nameid = item_id; item_tmp.identify = identify; - item_tmp.refine = refine; + item_tmp.refine = refine_level; item_tmp.attribute = attr; item_tmp.bound = (unsigned char)bound; item_tmp.card[0] = c1; @@ -2216,12 +2216,12 @@ ACMD(killmonster) *------------------------------------------*/ ACMD(refine) { - int j, position = 0, refine = 0, current_position, final_refine; + int j, position = 0, refine_level = 0, current_position, final_refine; int count; memset(atcmd_output, '\0', sizeof(atcmd_output)); - if (!*message || sscanf(message, "%12d %12d", &position, &refine) < 2) { + if (!*message || sscanf(message, "%12d %12d", &position, &refine_level) < 2) { clif->message(fd, msg_fd(fd,996)); // Please enter a position and an amount (usage: @refine <+/- amount>). safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,997), EQP_HEAD_LOW); // %d: Lower Headgear clif->message(fd, atcmd_output); @@ -2246,7 +2246,7 @@ ACMD(refine) return false; } - refine = cap_value(refine, -MAX_REFINE, MAX_REFINE); + refine_level = cap_value(refine_level, -MAX_REFINE, MAX_REFINE); count = 0; for (j = 0; j < EQI_MAX; j++) { @@ -2264,7 +2264,7 @@ ACMD(refine) if(position && !(sd->status.inventory[idx].equip & position)) continue; - final_refine = cap_value(sd->status.inventory[idx].refine + refine, 0, MAX_REFINE); + final_refine = cap_value(sd->status.inventory[idx].refine + refine_level, 0, MAX_REFINE); if (sd->status.inventory[idx].refine != final_refine) { sd->status.inventory[idx].refine = final_refine; current_position = sd->status.inventory[idx].equip; diff --git a/src/map/log.c b/src/map/log.c index efb7fefbc..5bbca02a9 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -106,7 +106,7 @@ static char log_chattype2char(e_log_chat_type type) } /// check if this item should be logged according the settings -static bool should_log_item(int nameid, int amount, int refine, struct item_data *id) +static bool should_log_item(int nameid, int amount, int refine_level, struct item_data *id) { int filter = logs->config.filter; @@ -123,7 +123,7 @@ static bool should_log_item(int nameid, int amount, int refine, struct item_data ( filter&LOG_FILTER_PETITEM && ( id->type == IT_PETEGG || id->type == IT_PETARMOR ) ) || ( filter&LOG_FILTER_PRICE && id->value_buy >= logs->config.price_items_log ) || ( filter&LOG_FILTER_AMOUNT && abs(amount) >= logs->config.amount_items_log ) || - ( filter&LOG_FILTER_REFINE && refine >= logs->config.refine_items_log ) || + ( filter&LOG_FILTER_REFINE && refine_level >= logs->config.refine_items_log ) || ( filter&LOG_FILTER_CHANCE && ( ( id->maxchance != -1 && id->maxchance <= logs->config.rare_items_log ) || id->nameid == ITEMID_EMPERIUM ) ) ) return true; diff --git a/src/map/log.h b/src/map/log.h index db802575d..116d99bfd 100644 --- a/src/map/log.h +++ b/src/map/log.h @@ -155,7 +155,7 @@ struct log_interface { char (*picktype2char) (e_log_pick_type type); char (*chattype2char) (e_log_chat_type type); - bool (*should_log_item) (int nameid, int amount, int refine, struct item_data *id); + bool (*should_log_item) (int nameid, int amount, int refine_level, struct item_data *id); }; #ifdef HERCULES_CORE diff --git a/src/map/searchstore.c b/src/map/searchstore.c index 0c6fa3555..c991e38c4 100644 --- a/src/map/searchstore.c +++ b/src/map/searchstore.c @@ -345,7 +345,7 @@ static void searchstore_clearremote(struct map_session_data *sd) } /// receives results from a store-specific callback -static bool searchstore_result(struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine, const struct item_option *option) +static bool searchstore_result(struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine_level, const struct item_option *option) { struct s_search_store_info_item* ssitem; @@ -364,7 +364,7 @@ static bool searchstore_result(struct map_session_data *sd, unsigned int store_i ssitem->amount = amount; ssitem->price = price; memcpy(ssitem->card, card, sizeof(ssitem->card)); - ssitem->refine = refine; + ssitem->refine = refine_level; memcpy(ssitem->option, option, sizeof(ssitem->option)); return true; diff --git a/src/map/searchstore.h b/src/map/searchstore.h index e5ccfd300..71d562679 100644 --- a/src/map/searchstore.h +++ b/src/map/searchstore.h @@ -109,7 +109,7 @@ struct searchstore_interface { void (*click) (struct map_session_data* sd, int account_id, int store_id, int nameid); bool (*queryremote) (struct map_session_data* sd, int account_id); void (*clearremote) (struct map_session_data* sd); - bool (*result) (struct map_session_data* sd, unsigned int store_id, int account_id, const char* store_name, int nameid, unsigned short amount, unsigned int price, const int* card, unsigned char refine, const struct item_option *option); + bool (*result) (struct map_session_data* sd, unsigned int store_id, int account_id, const char* store_name, int nameid, unsigned short amount, unsigned int price, const int* card, unsigned char refine_level, const struct item_option *option); }; #ifdef HERCULES_CORE diff --git a/src/map/status.c b/src/map/status.c index 085e951b6..8c61d18f6 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -12509,10 +12509,10 @@ static int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, if ( bl->type == BL_PC && !(flag & 2) ) { const struct map_session_data *sd = BL_UCCAST(BL_PC, bl); - short index = sd->equip_index[EQI_HAND_R], refine; + short index = sd->equip_index[EQI_HAND_R], refine_level; if ( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON - && (refine = sd->status.inventory[index].refine) < 16 && refine ) { - int r = status->dbs->refine_info[watk->wlv].randombonus_max[refine + (4 - watk->wlv)] / 100; + && (refine_level = sd->status.inventory[index].refine) < 16 && refine_level) { + int r = refine->dbs->refine_info[watk->wlv].randombonus_max[refine_level + (4 - watk->wlv)] / 100; if ( r ) max += (rnd() % 100) % r + 1; } @@ -12624,10 +12624,10 @@ static void status_get_matk_sub(struct block_list *bl, int flag, unsigned short #ifdef RENEWAL if ( sd && !(flag & 2) ) { - short index = sd->equip_index[EQI_HAND_R], refine; + short index = sd->equip_index[EQI_HAND_R], refine_level; if ( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON - && (refine = sd->status.inventory[index].refine) < 16 && refine ) { - int r = status->dbs->refine_info[sd->inventory_data[index]->wlv].randombonus_max[refine + (4 - sd->inventory_data[index]->wlv)] / 100; + && (refine_level = sd->status.inventory[index].refine) < 16 && refine_level) { + int r = refine->dbs->refine_info[sd->inventory_data[index]->wlv].randombonus_max[refine_level + (4 - sd->inventory_data[index]->wlv)] / 100; if ( r ) *matk_max += (rnd() % 100) % r + 1; } -- cgit v1.2.3-60-g2f50