diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-07-16 22:01:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-07-19 21:53:39 +0300 |
commit | 0bafc4b2f9d9cd01596f28862e6c105af666ec30 (patch) | |
tree | 42a84306edd8a38b12380bd97d36165af25cd556 /src | |
parent | 0c2cf7579324ade56287b9a15f1fc7c0a8dffffd (diff) | |
download | hercules-0bafc4b2f9d9cd01596f28862e6c105af666ec30.tar.gz hercules-0bafc4b2f9d9cd01596f28862e6c105af666ec30.tar.bz2 hercules-0bafc4b2f9d9cd01596f28862e6c105af666ec30.tar.xz hercules-0bafc4b2f9d9cd01596f28862e6c105af666ec30.zip |
Replace item id shorts to int in map server.
Diffstat (limited to 'src')
-rw-r--r-- | src/char/inter.c | 2 | ||||
-rw-r--r-- | src/char/mapif.c | 13 | ||||
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/buyingstore.c | 32 | ||||
-rw-r--r-- | src/map/buyingstore.h | 4 | ||||
-rw-r--r-- | src/map/chrif.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 19 | ||||
-rw-r--r-- | src/map/clif.h | 22 | ||||
-rw-r--r-- | src/map/intif.c | 32 | ||||
-rw-r--r-- | src/map/intif.h | 4 | ||||
-rw-r--r-- | src/map/itemdb.c | 23 | ||||
-rw-r--r-- | src/map/itemdb.h | 14 | ||||
-rw-r--r-- | src/map/map.c | 2 | ||||
-rw-r--r-- | src/map/map.h | 6 | ||||
-rw-r--r-- | src/map/npc.h | 4 | ||||
-rw-r--r-- | src/map/pc.c | 6 | ||||
-rw-r--r-- | src/map/pc.h | 20 | ||||
-rw-r--r-- | src/map/pet.c | 15 | ||||
-rw-r--r-- | src/map/pet.h | 10 | ||||
-rw-r--r-- | src/map/script.c | 56 | ||||
-rw-r--r-- | src/map/script.h | 2 | ||||
-rw-r--r-- | src/map/searchstore.c | 6 | ||||
-rw-r--r-- | src/map/searchstore.h | 10 | ||||
-rw-r--r-- | src/map/skill.c | 4 | ||||
-rw-r--r-- | src/map/skill.h | 2 | ||||
-rw-r--r-- | src/map/unit.h | 6 | ||||
-rw-r--r-- | src/map/vending.c | 6 | ||||
-rw-r--r-- | src/map/vending.h | 2 | ||||
-rw-r--r-- | src/plugins/db2sql.c | 2 |
29 files changed, 175 insertions, 153 deletions
diff --git a/src/char/inter.c b/src/char/inter.c index 718dfd60d..7269009a7 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -77,7 +77,7 @@ static int inter_recv_packet_length[] = { -1,-1,10,10, 0,-1,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3050- Auction System [Zephyrus], Item Bound [Mhalicot] 6,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3060- Quest system [Kevin] [Inkfish] -1,10, 6,-1, 0, 0, 0, 0, 0, 0, 0, 0, -1,10, 6,-1, // 3070- Mercenary packets [Zephyrus], Elemental packets [pakpil] - 48,14,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3080- + 52,14,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3080- -1,10,-1, 6, 0, 20,10,11, -1,6 + NAME_LENGTH, 0, 0, 0, 0, 0, 0, // 3090- Homunculus packets [albator], RoDEX packets }; diff --git a/src/char/mapif.c b/src/char/mapif.c index 6acf803e2..30f8c1178 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -1518,8 +1518,17 @@ static int mapif_parse_CreatePet(int fd) RFIFOHEAD(fd); account_id = RFIFOL(fd, 2); - pet = inter_pet->create(account_id, RFIFOL(fd, 6), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOW(fd, 14), - RFIFOW(fd, 16), RFIFOW(fd, 18), RFIFOW(fd, 20), RFIFOB(fd, 22), RFIFOB(fd, 23), RFIFOP(fd, 24)); + pet = inter_pet->create(account_id, + RFIFOL(fd, 6), + RFIFOW(fd, 10), + RFIFOW(fd, 12), + RFIFOL(fd, 14), + RFIFOL(fd, 18), + RFIFOW(fd, 22), + RFIFOW(fd, 24), + RFIFOB(fd, 26), + RFIFOB(fd, 27), + RFIFOP(fd, 28)); if (pet != NULL) mapif->pet_created(fd, account_id, pet); diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 2d17f7ae7..79bd92213 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -2665,7 +2665,7 @@ ACMD(makeegg) intif->create_pet( sd->status.account_id, sd->status.char_id, (short)pet->db[pet_id].class_, (short)mob->db(pet->db[pet_id].class_)->lv, - (short)pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, + pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, 100, 0, 1, pet->db[pet_id].jname); } else { clif->message(fd, msg_fd(fd,180)); // The monster/egg name/id doesn't exist. diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index 4b853bf75..df622e4ab 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -128,7 +128,8 @@ static void buyingstore_create(struct map_session_data *sd, int zenylimit, unsig // check item list for (i = 0; i < count; i++) { // itemlist: <name id>.W <amount>.W <price>.L - unsigned short nameid, amount; + int nameid; + unsigned short amount; int price, idx; struct item_data* id; @@ -162,7 +163,8 @@ static void buyingstore_create(struct map_session_data *sd, int zenylimit, unsig ARR_FIND( 0, i, listidx, sd->buyingstore.items[listidx].nameid == nameid ); if( listidx != i ) {// duplicate - ShowWarning("buyingstore_create: Found duplicate item on buying list (nameid=%hu, amount=%hu, account_id=%d, char_id=%d).\n", nameid, amount, sd->status.account_id, sd->status.char_id); + ShowWarning("buyingstore_create: Found duplicate item on buying list (nameid=%d, amount=%hu, account_id=%d, char_id=%d).\n", + nameid, amount, sd->status.account_id, sd->status.char_id); break; } } @@ -289,20 +291,21 @@ static void buyingstore_trade(struct map_session_data* sd, int account_id, unsig // check item list for( i = 0; i < count; i++ ) {// itemlist: <index>.W <name id>.W <amount>.W - unsigned short nameid, amount; + int nameid; + unsigned short amount; int index; index = itemlist[i].index - 2; nameid = itemlist[i].itemId; amount = itemlist[i].amount; - if( i ) + if (i) {// duplicate check. as the client does this too, only malicious intent should be caught here - ARR_FIND( 0, i, k, RBUFW(itemlist,k*6+0)-2 == index ); - if( k != i ) + ARR_FIND(0, i, k, itemlist[k].index - 2 == index); + if (k != i) {// duplicate - ShowWarning("buyingstore_trade: Found duplicate item on selling list (prevnameid=%hu, prevamount=%hu, nameid=%hu, amount=%hu, account_id=%d, char_id=%d).\n", - RBUFW(itemlist,k*6+2), RBUFW(itemlist,k*6+4), nameid, amount, sd->status.account_id, sd->status.char_id); + ShowWarning("buyingstore_trade: Found duplicate item on selling list (prevnameid=%d, prevamount=%d, nameid=%d, amount=%hu, account_id=%d, char_id=%d).\n", + (int)itemlist[k].itemId, (int)itemlist[k].amount, nameid, amount, sd->status.account_id, sd->status.char_id); clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, nameid); return; } @@ -361,14 +364,15 @@ static void buyingstore_trade(struct map_session_data* sd, int account_id, unsig // process item list for( i = 0; i < count; i++ ) {// itemlist: <index>.W <name id>.W <amount>.W - unsigned short nameid, amount; + int nameid; + unsigned short amount; int index; - index = RBUFW(itemlist,i*6+0)-2; - nameid = RBUFW(itemlist,i*6+2); - amount = RBUFW(itemlist,i*6+4); + index = itemlist[i].index - 2; + nameid = itemlist[i].itemId; + amount = itemlist[i].amount; - ARR_FIND( 0, pl_sd->buyingstore.slots, listidx, pl_sd->buyingstore.items[listidx].nameid == nameid ); + ARR_FIND(0, pl_sd->buyingstore.slots, listidx, pl_sd->buyingstore.items[listidx].nameid == nameid ); zeny = amount*pl_sd->buyingstore.items[listidx].price; // move item @@ -416,7 +420,7 @@ static void buyingstore_trade(struct map_session_data* sd, int account_id, unsig } /// Checks if an item is being bought in given player's buying store. -static bool buyingstore_search(struct map_session_data *sd, unsigned short nameid) +static bool buyingstore_search(struct map_session_data *sd, int nameid) { unsigned int i; diff --git a/src/map/buyingstore.h b/src/map/buyingstore.h index 60fd047f7..63762f321 100644 --- a/src/map/buyingstore.h +++ b/src/map/buyingstore.h @@ -63,7 +63,7 @@ enum e_buyingstore_failure { struct s_buyingstore_item { int price; unsigned short amount; - unsigned short nameid; + int nameid; }; struct s_buyingstore { @@ -85,7 +85,7 @@ struct buyingstore_interface { void (*close) (struct map_session_data* sd); void (*open) (struct map_session_data* sd, int account_id); void (*trade) (struct map_session_data* sd, int account_id, unsigned int buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, unsigned int count); - bool (*search) (struct map_session_data* sd, unsigned short nameid); + bool (*search) (struct map_session_data* sd, int nameid); bool (*searchall) (struct map_session_data* sd, const struct s_search_store_search* s); unsigned int (*getuid) (void); }; diff --git a/src/map/chrif.c b/src/map/chrif.c index 2aa76ca2d..cd24c5fea 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1419,7 +1419,7 @@ static void chrif_skillid2idx(int fd) WFIFOW(fd,0) = 0x2b0b; for (i = 0; i < MAX_SKILL_DB; i++) { if (skill->dbs->db[i].nameid != 0) { - WFIFOW(fd, 4 + (count*4)) = skill->dbs->db[i].nameid; + WFIFOW(fd, 4 + (count*4)) = skill->dbs->db[i].nameid; // really skill id WFIFOW(fd, 6 + (count*4)) = i; count++; } diff --git a/src/map/clif.c b/src/map/clif.c index c4a401fa7..527c41fda 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -939,7 +939,7 @@ static void clif_clearunit_delayed(struct block_list *bl, clr_type type, int64 t } /// Gets weapon view info from sd's inventory_data and points (*rhand,*lhand) -static void clif_get_weapon_view(struct map_session_data *sd, unsigned short *rhand, unsigned short *lhand) +static void clif_get_weapon_view(struct map_session_data *sd, int *rhand, int *lhand) { nullpo_retv(sd); nullpo_retv(rhand); @@ -14022,7 +14022,7 @@ static void clif_parse_pet_evolution(int fd, struct map_session_data *sd) intif->create_pet( sd->status.account_id, sd->status.char_id, (short)pet->db[pet_id].class_, (short)mob->db(pet->db[pet_id].class_)->lv, - (short)pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, + pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, 100, 0, 1, pet->db[pet_id].jname); clif->petEvolutionResult(fd, PET_EVOL_SUCCESS); } else { @@ -17862,7 +17862,7 @@ static void clif_buyingstore_trade_failed_buyer(struct map_session_data *sd, sho /// Updates the zeny limit and an item in the buying store item list (ZC_UPDATE_ITEM_FROM_BUYING_STORE). /// 081b <name id>.W <amount>.W <limit zeny>.L -static void clif_buyingstore_update_item(struct map_session_data *sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny) +static void clif_buyingstore_update_item(struct map_session_data *sd, int nameid, unsigned short amount, uint32 char_id, int zeny) { int fd; struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE p; @@ -17913,7 +17913,7 @@ static void clif_buyingstore_delete_item(struct map_session_data *sd, short inde /// 6 = "The trade failed, because the entered amount of item %s is higher, than the buyer is willing to buy." (0x6d3, MSI_BUYINGSTORE_TRADE_OVERCOUNT) /// 7 = "The trade failed, because the buyer is lacking required balance." (0x6d1, MSI_BUYINGSTORE_TRADE_LACKBUYERZENY) /// ? = nothing -static void clif_buyingstore_trade_failed_seller(struct map_session_data *sd, short result, unsigned short nameid) +static void clif_buyingstore_trade_failed_seller(struct map_session_data *sd, short result, int nameid) { #if PACKETVER >= 20100420 int fd; @@ -19038,7 +19038,7 @@ static void clif_scriptclear(struct map_session_data *sd, int npcid) } /* Made Possible Thanks to Yommy! */ -static void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) +static void clif_package_item_announce(struct map_session_data *sd, int nameid, int containerid) { struct packet_package_item_announce p; @@ -19056,7 +19056,7 @@ static void clif_package_item_announce(struct map_session_data *sd, unsigned sho } /* Made Possible Thanks to Yommy! */ -static void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) +static void clif_item_drop_announce(struct map_session_data *sd, int nameid, char *monsterName) { struct packet_item_drop_announce p; @@ -19757,7 +19757,7 @@ static bool clif_parse_roulette_db(void) /** * **/ -static void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) +static void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID) { #if PACKETVER >= 20140612 struct packet_roulette_generate_ack p; @@ -19843,7 +19843,8 @@ static void clif_ackmergeitems(int fd, struct map_session_data *sd) { #if PACKETVER > 20120228 int i = 0, n = 0, length = 0, count = 0; - int16 nameid = 0, indexes[MAX_INVENTORY] = {0}, amounts[MAX_INVENTORY] = {0}; + int nameid = 0; + int16 indexes[MAX_INVENTORY] = {0}, amounts[MAX_INVENTORY] = {0}; struct item item_data; nullpo_retv(sd); @@ -21246,7 +21247,7 @@ static bool clif_style_change_validate_requirements(struct map_session_data *sd, } return false; } -static void clif_stylist_send_rodexitem(struct map_session_data *sd, int16 itemid) +static void clif_stylist_send_rodexitem(struct map_session_data *sd, int itemid) { struct rodex_message msg = { 0 }; diff --git a/src/map/clif.h b/src/map/clif.h index 53a97f484..47b2c8f46 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -618,7 +618,7 @@ struct s_packet_db { }; struct hCSData { - unsigned short id; + int id; unsigned int price; }; @@ -629,7 +629,7 @@ struct cdelayed_damage { struct merge_item { int16 position; - int16 nameid; + int nameid; }; /* attendance data */ @@ -642,8 +642,8 @@ struct attendance_entry { struct stylist_data_entry { int16 id; int32 zeny; - int16 itemid; - int16 boxid; + int itemid; + int boxid; }; VECTOR_DECL(struct stylist_data_entry) stylist_data[MAX_STYLIST_TYPE]; @@ -729,8 +729,8 @@ struct clif_interface { void (*cart_additem_ack) (struct map_session_data *sd, int flag); void (*cashshop_load) (void); void (*cashShopSchedule) (int fd, struct map_session_data *sd); - void (*package_announce) (struct map_session_data *sd, unsigned short nameid, unsigned short containerid); - void (*item_drop_announce) (struct map_session_data *sd, unsigned short nameid, char *monsterName); + void (*package_announce) (struct map_session_data *sd, int nameid, int containerid); + void (*item_drop_announce) (struct map_session_data *sd, int nameid, char *monsterName); /* unit-related */ void (*clearunit_single) (int id, clr_type type, int fd); void (*clearunit_area) (struct block_list* bl, clr_type type); @@ -843,7 +843,7 @@ struct clif_interface { void (*hpmeter_single) (int fd, int id, unsigned int hp, unsigned int maxhp); int (*hpmeter_sub) (struct block_list *bl, va_list ap); void (*upgrademessage) (int fd, int result, int item_id); - void (*get_weapon_view) (struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand); + void (*get_weapon_view) (struct map_session_data* sd, int *rhand, int *lhand); void (*gospel_info) (struct map_session_data *sd, int type); void (*feel_req) (int fd, struct map_session_data *sd, uint16 skill_lv); void (*starskill) (struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result); @@ -1141,9 +1141,9 @@ struct clif_interface { void (*buyingstore_disappear_entry_single) (struct map_session_data* sd, struct map_session_data* pl_sd); void (*buyingstore_itemlist) (struct map_session_data* sd, struct map_session_data* pl_sd); void (*buyingstore_trade_failed_buyer) (struct map_session_data* sd, short result); - void (*buyingstore_update_item) (struct map_session_data* sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny); + void (*buyingstore_update_item) (struct map_session_data* sd, int nameid, unsigned short amount, uint32 char_id, int zeny); void (*buyingstore_delete_item) (struct map_session_data* sd, short index, unsigned short amount, int price); - void (*buyingstore_trade_failed_seller) (struct map_session_data* sd, short result, unsigned short nameid); + void (*buyingstore_trade_failed_seller) (struct map_session_data* sd, short result, int nameid); /* search store-related */ void (*search_store_info_ack) (struct map_session_data* sd); void (*search_store_info_failed) (struct map_session_data* sd, unsigned char reason); @@ -1186,7 +1186,7 @@ struct clif_interface { void (*npc_market_purchase_ack) (struct map_session_data *sd, const struct itemlist *item_list, unsigned char response); /* */ bool (*parse_roulette_db) (void); - void (*roulette_generate_ack) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID); + void (*roulette_generate_ack) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID); /* Merge Items */ void (*openmergeitem) (int fd, struct map_session_data *sd); void (*cancelmergeitem) (int fd, struct map_session_data *sd); @@ -1500,7 +1500,7 @@ struct clif_interface { bool (*stylist_read_db_libconfig) (void); bool (*stylist_read_db_libconfig_sub) (struct config_setting_t *it, int idx, const char *source); bool (*style_change_validate_requirements) (struct map_session_data *sd, int type, int16 idx); - void (*stylist_send_rodexitem) (struct map_session_data *sd, int16 itemid); + void (*stylist_send_rodexitem) (struct map_session_data *sd, int itemid); void (*pReqStyleChange) (int fd, struct map_session_data *sd); void (*cz_req_style_change_sub) (struct map_session_data *sd, int type, int16 idx, bool isitem); void (*style_change_response) (struct map_session_data *sd, enum stylist_shop flag); diff --git a/src/map/intif.c b/src/map/intif.c index 6dc4b3a0a..393058a8a 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -69,26 +69,26 @@ static int CheckForCharServer(void) } // pet -static int intif_create_pet(int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, - short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name) +static int intif_create_pet(int account_id, int char_id, short pet_class, short pet_lv, int pet_egg_id, + int pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name) { if (intif->CheckForCharServer()) return 0; nullpo_ret(pet_name); - WFIFOHEAD(inter_fd, 24 + NAME_LENGTH); - WFIFOW(inter_fd,0) = 0x3080; - WFIFOL(inter_fd,2) = account_id; - WFIFOL(inter_fd,6) = char_id; - WFIFOW(inter_fd,10) = pet_class; - WFIFOW(inter_fd,12) = pet_lv; - WFIFOW(inter_fd,14) = pet_egg_id; - WFIFOW(inter_fd,16) = pet_equip; - WFIFOW(inter_fd,18) = intimate; - WFIFOW(inter_fd,20) = hungry; - WFIFOB(inter_fd,22) = rename_flag; - WFIFOB(inter_fd,23) = incubate; - memcpy(WFIFOP(inter_fd,24),pet_name,NAME_LENGTH); - WFIFOSET(inter_fd,24+NAME_LENGTH); + WFIFOHEAD(inter_fd, 28 + NAME_LENGTH); + WFIFOW(inter_fd, 0) = 0x3080; + WFIFOL(inter_fd, 2) = account_id; + WFIFOL(inter_fd, 6) = char_id; + WFIFOW(inter_fd, 10) = pet_class; + WFIFOW(inter_fd, 12) = pet_lv; + WFIFOL(inter_fd, 14) = pet_egg_id; + WFIFOL(inter_fd, 18) = pet_equip; + WFIFOW(inter_fd, 22) = intimate; + WFIFOW(inter_fd, 24) = hungry; + WFIFOB(inter_fd, 26) = rename_flag; + WFIFOB(inter_fd, 27) = incubate; + memcpy(WFIFOP(inter_fd, 28), pet_name, NAME_LENGTH); + WFIFOSET(inter_fd, 28 + NAME_LENGTH); return 0; } diff --git a/src/map/intif.h b/src/map/intif.h index 4973768d7..c75b93201 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -58,8 +58,8 @@ struct intif_interface { int packet_len_table[INTIF_PACKET_LEN_TABLE_SIZE]; /* funcs */ int (*parse) (int fd); - int (*create_pet)(int account_id, int char_id, short pet_type, short pet_lv, short pet_egg_id, - short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); + int (*create_pet)(int account_id, int char_id, short pet_type, short pet_lv, int pet_egg_id, + int pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); int (*broadcast) (const char *mes, int len, int type); int (*broadcast2) (const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY); int (*main_message) (struct map_session_data* sd, const char* message); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index cee38b973..c04639693 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -863,7 +863,7 @@ static void itemdb_read_groups(void) itemdb->groups[count].id = data->nameid; itemdb->groups[count].qty = gsize[ count ]; - CREATE(itemdb->groups[count].nameid, unsigned short, gsize[ count ] + 1); + CREATE(itemdb->groups[count].nameid, int, gsize[count] + 1); c = 0; while( (it = libconfig->setting_get_elem(itg,c++)) ) { int repeat = 1; @@ -913,7 +913,8 @@ static void itemdb_write_cached_packages(const char *config_filename) hwrite(&pcount,sizeof(pcount),1,file); for(i = 0; i < pcount; i++) { - unsigned short id = itemdb->packages[i].id, random_qty = itemdb->packages[i].random_qty, must_qty = itemdb->packages[i].must_qty; + int id = itemdb->packages[i].id; + unsigned short random_qty = itemdb->packages[i].random_qty, must_qty = itemdb->packages[i].must_qty; unsigned short c; //into a package, first 2 bytes = id. hwrite(&id,sizeof(id),1,file); @@ -970,6 +971,7 @@ static void itemdb_write_cached_packages(const char *config_filename) return; } + static bool itemdb_read_cached_packages(const char *config_filename) { FILE *file; @@ -988,12 +990,13 @@ static bool itemdb_read_cached_packages(const char *config_filename) itemdb->package_count = pcount; for( i = 0; i < pcount; i++ ) { - unsigned short id = 0, random_qty = 0, must_qty = 0; + int id = 0; + unsigned short random_qty = 0, must_qty = 0; struct item_data *pdata; struct item_package *package = &itemdb->packages[i]; unsigned short c; - //into a package, first 2 bytes = id. + //into a package, first 4 bytes = id. hread(&id,sizeof(id),1,file); //next 2 bytes = must count hread(&must_qty,sizeof(must_qty),1,file); @@ -1016,10 +1019,11 @@ static bool itemdb_read_cached_packages(const char *config_filename) //now we loop into must for(c = 0; c < package->must_qty; c++) { struct item_package_must_entry *entry = &itemdb->packages[i].must_items[c]; - unsigned short mid = 0, qty = 0, hours = 0; + int mid = 0; + unsigned short qty = 0, hours = 0; unsigned char announce = 0, named = 0, force_serial = 0; struct item_data *data; - //first 2 byte = item id + //first 4 byte = item id hread(&mid,sizeof(mid),1,file); //next 2 byte = qty hread(&qty,sizeof(qty),1,file); @@ -1059,7 +1063,8 @@ static bool itemdb_read_cached_packages(const char *config_filename) //now we loop into the group's list for(h = 0; h < group_qty; h++) { struct item_package_rand_entry *entry = &itemdb->packages[i].random_groups[c].random_list[h]; - unsigned short mid = 0, qty = 0, hours = 0, rate = 0; + int mid = 0; + unsigned short qty = 0, hours = 0, rate = 0; unsigned char announce = 0, named = 0, force_serial = 0; struct item_data *data; @@ -1982,7 +1987,7 @@ static int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const ShowWarning("itemdb_readdb_libconfig_sub: Invalid or missing id in \"%s\", entry #%d, skipping.\n", source, n); return 0; } - id.nameid = (uint16)i32; + id.nameid = i32; if( (t = libconfig->setting_get_member(it, "Inherit")) && (inherit = libconfig->setting_get_bool(t)) ) { if( !itemdb->exists(id.nameid) ) { @@ -2431,7 +2436,7 @@ static void itemdb_read(bool minimal) /** * retrieves item_combo data by combo id **/ -static struct item_combo *itemdb_id2combo(unsigned short id) +static struct item_combo *itemdb_id2combo(int id) { if( id > itemdb->combo_count ) return NULL; diff --git a/src/map/itemdb.h b/src/map/itemdb.h index efe3d0a3a..3b7ce4655 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -393,14 +393,14 @@ VECTOR_STRUCT_DECL(itemlist, struct itemlist_entry); struct item_combo { struct script_code *script; - unsigned short nameid[MAX_ITEMS_PER_COMBO];/* nameid array */ + int nameid[MAX_ITEMS_PER_COMBO];/* nameid array */ unsigned char count; - unsigned short id;/* id of this combo */ + int id; /* id of this combo */ }; struct item_group { unsigned short id; - unsigned short *nameid; + int *nameid; unsigned short qty; }; @@ -427,7 +427,7 @@ struct item_package_rand_entry { }; struct item_package_must_entry { - unsigned short id; + int id; unsigned short qty; unsigned short hours; unsigned int announce : 1; @@ -441,7 +441,7 @@ struct item_package_rand_group { }; struct item_package { - unsigned short id; + int id; struct item_package_rand_group *random_groups; struct item_package_must_entry *must_items; unsigned short random_qty; @@ -454,7 +454,7 @@ struct itemdb_option { }; struct item_data { - uint16 nameid; + int nameid; char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH]; int value_buy; @@ -651,7 +651,7 @@ struct itemdb_interface { int (*final_sub) (union DBKey key, struct DBData *data, va_list ap); int (*options_final_sub) (union DBKey key, struct DBData *data, va_list ap); void (*clear) (bool total); - struct item_combo * (*id2combo) (unsigned short id); + struct item_combo * (*id2combo) (int id); bool (*is_item_usable) (struct item_data *item); bool (*lookup_const) (const struct config_setting_t *it, const char *name, int *value); bool (*lookup_const_mask) (const struct config_setting_t *it, const char *name, int *value); diff --git a/src/map/map.c b/src/map/map.c index 40261ebbc..3979ea90e 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5455,7 +5455,7 @@ static void map_zone_init(void) } } -static unsigned short map_zone_str2itemid(const char *name) +static int map_zone_str2itemid(const char *name) { struct item_data *data; diff --git a/src/map/map.h b/src/map/map.h index 494f93cfe..e346e72ba 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -714,7 +714,7 @@ enum map_zone_skill_subtype { }; struct map_zone_disabled_skill_entry { - unsigned short nameid; + int nameid; enum bl_type type; enum map_zone_skill_subtype subtype; }; @@ -724,7 +724,7 @@ struct map_zone_disabled_command_entry { }; struct map_zone_skill_damage_cap_entry { - unsigned short nameid; + int nameid; unsigned int cap; enum bl_type type; enum map_zone_skill_subtype subtype; @@ -1342,7 +1342,7 @@ END_ZEROED_BLOCK; int (*sql_init) (void); int (*sql_close) (void); bool (*zone_mf_cache) (int m, char *flag, char *params); - unsigned short (*zone_str2itemid) (const char *name); + int (*zone_str2itemid) (const char *name); unsigned short (*zone_str2skillid) (const char *name); enum bl_type (*zone_bl_type) (const char *entry, enum map_zone_skill_subtype *subtype); void (*read_zone_db) (void); diff --git a/src/map/npc.h b/src/map/npc.h index fa8b12be5..eff4ed4ec 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -57,14 +57,14 @@ struct npc_label_list { int pos; }; struct npc_item_list { - unsigned short nameid; + int nameid; unsigned int value; unsigned int qty; }; struct npc_shop_data { unsigned char type;/* what am i */ struct npc_item_list *item;/* list */ - unsigned short items;/* total */ + unsigned int items;/* total */ }; struct npc_parse; struct npc_data { diff --git a/src/map/pc.c b/src/map/pc.c index cd49a6dbf..d9e41fde2 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -565,7 +565,7 @@ static int pc_inventory_rental_clear(struct map_session_data *sd) /* assumes i is valid (from default areas where it is called, it is) */ static void pc_rental_expire(struct map_session_data *sd, int i) { - short nameid; + int nameid; nullpo_retv(sd); Assert_retv(i >= 0 && i < MAX_INVENTORY); @@ -2082,7 +2082,7 @@ static int pc_disguise(struct map_session_data *sd, int class) return 1; } -static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id) +static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, int card_id) { int i; @@ -2120,7 +2120,7 @@ static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, shor return 1; } -static int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id) +static int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, int card_id) { int i; diff --git a/src/map/pc.h b/src/map/pc.h index f998c799d..622dcf3f7 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -132,7 +132,8 @@ BEGIN_ZEROED_BLOCK; // all the variables within this block get zero'ed in each c END_ZEROED_BLOCK; }; struct s_autospell { - short id, lv, rate, card_id, flag; + short id, lv, rate, flag; + int card_id; bool lock; // bAutoSpellOnSkill: blocks autospell from triggering again, while being executed }; /// AddEff bonus data @@ -150,7 +151,8 @@ struct s_addeffectonskill { unsigned char target; }; struct s_add_drop { - short id, group; + int id; + short group; int race, rate; }; struct s_autobonus { @@ -168,7 +170,7 @@ enum npc_timeout_type { struct pc_combos { struct script_code *bonus;/* the script of the combo */ - unsigned short id;/* this combo id */ + int id; /* this combo id */ }; struct map_session_data { @@ -218,7 +220,7 @@ struct map_session_data { unsigned int callshop : 1; // flag to indicate that a script used callshop; on a shop short pmap; // Previous map on Map Change unsigned short autoloot; - unsigned short autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus] + int autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus] unsigned short autoloottype; unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish] @@ -303,7 +305,7 @@ struct map_session_data { int64 cansendmail_tick; /// Mail System Flood Protection int64 ks_floodprotect_tick; /// [Kill Steal Protection] struct { - short nameid; + int nameid; int64 tick; } item_delay[MAX_ITEMDELAYS]; // [Paradox924X] bool has_shield; ///< Whether the character is wearing a shield. @@ -496,7 +498,7 @@ END_ZEROED_BLOCK; // Mail System [Zephyrus] struct { - short nameid; + int nameid; int index, amount, zeny; struct mail_data inbox; bool changed; // if true, should sync with charserver on next mailbox request @@ -795,7 +797,7 @@ enum { ADDITEM_EXIST , ADDITEM_NEW , ADDITEM_OVERAMOUNT }; **/ struct item_cd { int64 tick[MAX_ITEMDELAYS];//tick - short nameid[MAX_ITEMDELAYS];//skill id + int nameid[MAX_ITEMDELAYS];//skill id }; enum e_pc_autotrade_update_action { @@ -1113,8 +1115,8 @@ END_ZEROED_BLOCK; /* End */ int (*check_banding) ( struct block_list *bl, va_list ap ); int (*inventory_rental_end) (int tid, int64 tick, int id, intptr_t data); void (*check_skilltree) (struct map_session_data *sd, int skill_id); - int (*bonus_autospell) (struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id); - int (*bonus_autospell_onskill) (struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id); + int (*bonus_autospell) (struct s_autospell *spell, int max, short id, short lv, short rate, short flag, int card_id); + int (*bonus_autospell_onskill) (struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, int card_id); int (*bonus_addeff) (struct s_addeffect* effect, int max, enum sc_type id, int16 rate, int16 arrow_rate, uint8 flag, uint16 duration); int (*bonus_addeff_onskill) (struct s_addeffectonskill* effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target); int (*bonus_item_drop) (struct s_add_drop *drop, const short max, short id, short group, int race, int rate); diff --git a/src/map/pet.c b/src/map/pet.c index f4ba4e31b..e544905c0 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -112,7 +112,7 @@ static int pet_create_egg(struct map_session_data *sd, int item_id) intif->create_pet(sd->status.account_id, sd->status.char_id, (short)pet->db[pet_id].class_, (short)mob->db(pet->db[pet_id].class_)->lv, - (short)pet->db[pet_id].EggID, 0, + pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, 100, 0, 1, pet->db[pet_id].jname); return 1; @@ -516,7 +516,7 @@ static int pet_recv_petdata(int account_id, struct s_pet *p, int flag) return 0; } -static int pet_select_egg(struct map_session_data *sd, short egg_index) +static int pet_select_egg(struct map_session_data *sd, int egg_index) { nullpo_ret(sd); @@ -555,7 +555,8 @@ static int pet_catch_process2(struct map_session_data *sd, int target_id) // Invalid inputs/state, abort capture. clif->pet_roulette(sd,0); sd->catch_target_class = -1; - sd->itemid = sd->itemindex = -1; + sd->itemid = -1; + sd->itemindex = -1; return 1; } @@ -1334,7 +1335,7 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc if (!(data = itemdb->name2id(str))) { ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); } else { - pet->db[n].itemID = (uint16)data->nameid; + pet->db[n].itemID = data->nameid; } } @@ -1342,7 +1343,7 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc if (!(data = itemdb->name2id(str))) { ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); } else { - pet->db[n].EggID = (uint16)data->nameid; + pet->db[n].EggID = data->nameid; } } @@ -1350,7 +1351,7 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc if (!(data = itemdb->name2id(str))) { ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); } else { - pet->db[n].AcceID = (uint16)data->nameid; + pet->db[n].AcceID = data->nameid; } } @@ -1358,7 +1359,7 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc if (!(data = itemdb->name2id(str))) { ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); } else { - pet->db[n].FoodID = (uint16)data->nameid; + pet->db[n].FoodID = data->nameid; } } diff --git a/src/map/pet.h b/src/map/pet.h index b3a16c5d7..049816804 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -39,10 +39,10 @@ struct pet_evolve_data { struct s_pet_db { short class_; char name[NAME_LENGTH],jname[NAME_LENGTH]; - short itemID; - short EggID; - short AcceID; - short FoodID; + int itemID; + int EggID; + int AcceID; + int FoodID; int fullness; int hungry_delay; int r_hungry; @@ -157,7 +157,7 @@ struct pet_interface { int (*data_init) (struct map_session_data *sd, struct s_pet *petinfo); int (*birth_process) (struct map_session_data *sd, struct s_pet *petinfo); int (*recv_petdata) (int account_id, struct s_pet *p, int flag); - int (*select_egg) (struct map_session_data *sd, short egg_index); + int (*select_egg) (struct map_session_data *sd, int egg_index); int (*catch_process1) (struct map_session_data *sd, int target_class); int (*catch_process2) (struct map_session_data *sd, int target_id); bool (*get_egg) (int account_id, short pet_class, int pet_id ); diff --git a/src/map/script.c b/src/map/script.c index 9adf6b44d..e678a7738 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7701,10 +7701,10 @@ static BUILDIN(countitem2) iden = script_getnum(st,3); ref = script_getnum(st,4); attr = script_getnum(st,5); - c1 = (short)script_getnum(st,6); - c2 = (short)script_getnum(st,7); - c3 = (short)script_getnum(st,8); - c4 = (short)script_getnum(st,9); + c1 = script_getnum(st,6); + c2 = script_getnum(st,7); + c3 = script_getnum(st,8); + c4 = script_getnum(st,9); for(i = 0; i < MAX_INVENTORY; i++) if (sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] != NULL && @@ -8037,10 +8037,10 @@ static BUILDIN(getitem2) iden=script_getnum(st,4); ref=script_getnum(st,5); attr=script_getnum(st,6); - c1=(short)script_getnum(st,7); - c2=(short)script_getnum(st,8); - c3=(short)script_getnum(st,9); - c4=(short)script_getnum(st,10); + c1 = script_getnum(st,7); + c2 = script_getnum(st,8); + c3 = script_getnum(st,9); + c4 = script_getnum(st,10); if (bound && (itemdb_type(nameid) == IT_PETEGG || itemdb_type(nameid) == IT_PETARMOR)) { ShowError("script_getitembound2: can't bind a pet egg/armor! Type=%d\n",bound); @@ -8079,10 +8079,10 @@ static BUILDIN(getitem2) item_tmp.refine=ref; item_tmp.attribute=attr; item_tmp.bound=(unsigned char)bound; - item_tmp.card[0]=(short)c1; - item_tmp.card[1]=(short)c2; - item_tmp.card[2]=(short)c3; - item_tmp.card[3]=(short)c4; + item_tmp.card[0] = c1; + item_tmp.card[1] = c2; + item_tmp.card[2] = c3; + item_tmp.card[3] = c4; //Check if it's stackable. if (!itemdb->isstackable(nameid)) @@ -8371,10 +8371,10 @@ static BUILDIN(makeitem2) item_tmp.identify = script_getnum(st, 4); item_tmp.refine = cap_value(script_getnum(st, 5), 0, MAX_REFINE); item_tmp.attribute = script_getnum(st, 6); - item_tmp.card[0] = (short)script_getnum(st, 7); - item_tmp.card[1] = (short)script_getnum(st, 8); - item_tmp.card[2] = (short)script_getnum(st, 9); - item_tmp.card[3] = (short)script_getnum(st, 10); + item_tmp.card[0] = script_getnum(st, 7); + item_tmp.card[1] = script_getnum(st, 8); + item_tmp.card[2] = script_getnum(st, 9); + item_tmp.card[3] = script_getnum(st, 10); map->addflooritem(NULL, &item_tmp, amount, m, x, y, 0, 0, 0, 0, false); @@ -8619,10 +8619,10 @@ static BUILDIN(delitem2) it.identify=script_getnum(st,4); it.refine=script_getnum(st,5); it.attribute=script_getnum(st,6); - it.card[0]=(short)script_getnum(st,7); - it.card[1]=(short)script_getnum(st,8); - it.card[2]=(short)script_getnum(st,9); - it.card[3]=(short)script_getnum(st,10); + it.card[0] = script_getnum(st, 7); + it.card[1] = script_getnum(st, 8); + it.card[2] = script_getnum(st, 9); + it.card[3] = script_getnum(st, 10); if( it.amount <= 0 ) return true;// nothing to do @@ -10728,7 +10728,7 @@ static BUILDIN(makepet) sd->catch_target_class = pet->db[pet_id].class_; intif->create_pet(sd->status.account_id, sd->status.char_id, (short)pet->db[pet_id].class_, (short)mob->db(pet->db[pet_id].class_)->lv, - (short)pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, + pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, 100, 0, 1, pet->db[pet_id].jname); } @@ -16457,7 +16457,7 @@ static BUILDIN(equip) nameid=script_getnum(st,2); if((item_data = itemdb->exists(nameid)) == NULL) { - ShowError("wrong item ID : equipitem(%i)\n",nameid); + ShowError("wrong item ID : equipitem(%d)\n",nameid); return false; } ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == nameid && sd->status.inventory[i].equip == 0 ); @@ -16513,12 +16513,12 @@ static BUILDIN(equip2) return false; } - ref = script_getnum(st,3); - attr = script_getnum(st,4); - c0 = (short)script_getnum(st,5); - c1 = (short)script_getnum(st,6); - c2 = (short)script_getnum(st,7); - c3 = (short)script_getnum(st,8); + ref = script_getnum(st, 3); + attr = script_getnum(st, 4); + c0 = script_getnum(st, 5); + c1 = script_getnum(st, 6); + c2 = script_getnum(st, 7); + c3 = script_getnum(st, 8); ARR_FIND( 0, MAX_INVENTORY, i,( sd->status.inventory[i].equip == 0 && sd->status.inventory[i].nameid == nameid && diff --git a/src/map/script.h b/src/map/script.h index a0cfb7692..4ad9531b7 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -708,7 +708,7 @@ struct script_interface { int string_list_size; int string_list_pos; /* */ - unsigned short current_item_id; + int current_item_id; /* */ struct script_label_entry *labels; int label_count; diff --git a/src/map/searchstore.c b/src/map/searchstore.c index 1cf254e52..0c6fa3555 100644 --- a/src/map/searchstore.c +++ b/src/map/searchstore.c @@ -263,7 +263,7 @@ static void searchstore_close(struct map_session_data *sd) } } -static void searchstore_click(struct map_session_data *sd, int account_id, int store_id, unsigned short nameid) +static void searchstore_click(struct map_session_data *sd, int account_id, int store_id, int nameid) { unsigned int i; struct map_session_data* pl_sd; @@ -278,7 +278,7 @@ static void searchstore_click(struct map_session_data *sd, int account_id, int s ARR_FIND( 0, sd->searchstore.count, i, sd->searchstore.items[i].store_id == store_id && sd->searchstore.items[i].account_id == account_id && sd->searchstore.items[i].nameid == nameid ); if( i == sd->searchstore.count ) {// no such result, crafted - ShowWarning("searchstore_click: Received request with item %hu of account %d, which is not part of current result set (account_id=%d, char_id=%d).\n", nameid, account_id, sd->bl.id, sd->status.char_id); + ShowWarning("searchstore_click: Received request with item %d of account %d, which is not part of current result set (account_id=%d, char_id=%d).\n", nameid, account_id, sd->bl.id, sd->status.char_id); clif->search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE); return; } @@ -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, unsigned short 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, const struct item_option *option) { struct s_search_store_info_item* ssitem; diff --git a/src/map/searchstore.h b/src/map/searchstore.h index 3d4a3f36a..e5ccfd300 100644 --- a/src/map/searchstore.h +++ b/src/map/searchstore.h @@ -72,10 +72,10 @@ struct s_search_store_info_item { unsigned int store_id; int account_id; char store_name[MESSAGE_SIZE]; - unsigned short nameid; + int nameid; unsigned short amount; unsigned int price; - short card[MAX_SLOTS]; + int card[MAX_SLOTS]; unsigned char refine; struct item_option option[MAX_ITEM_OPTIONS]; }; @@ -93,7 +93,7 @@ struct s_search_store_info { }; /// type for shop search function -typedef bool (*searchstore_search_t)(struct map_session_data* sd, unsigned short nameid); +typedef bool (*searchstore_search_t)(struct map_session_data* sd, int nameid); typedef bool (*searchstore_searchall_t)(struct map_session_data* sd, const struct s_search_store_search* s); /** @@ -106,10 +106,10 @@ struct searchstore_interface { void (*next) (struct map_session_data* sd); void (*clear) (struct map_session_data* sd); void (*close) (struct map_session_data* sd); - void (*click) (struct map_session_data* sd, int account_id, int store_id, unsigned short nameid); + 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, unsigned short 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, const struct item_option *option); }; #ifdef HERCULES_CORE diff --git a/src/map/skill.c b/src/map/skill.c index 64b04e7b4..ed69b8c0f 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -10246,7 +10246,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * case GN_SLINGITEM: if( sd ) { - short ammo_id; + int ammo_id; int equip_idx = sd->equip_index[EQI_AMMO]; if( equip_idx <= 0 ) break; // No ammo. @@ -19917,7 +19917,7 @@ static bool skill_parse_row_abradb(char *split[], int columns, int current) static bool skill_parse_row_changematerialdb(char *split[], int columns, int current) { // ProductID,BaseRate,MakeAmount1,MakeAmountRate1...,MakeAmount5,MakeAmountRate5 - uint16 skill_id; + int skill_id; short j; int x,y; diff --git a/src/map/skill.h b/src/map/skill.h index bd1dc3344..736417649 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -1726,7 +1726,7 @@ struct skill_condition { // Database skills struct s_skill_db { - unsigned short nameid; + int nameid; char name[MAX_SKILL_NAME_LENGTH]; char desc[40]; int range[MAX_SKILL_LEVEL],hit,inf,element[MAX_SKILL_LEVEL],nk,splash[MAX_SKILL_LEVEL],max; diff --git a/src/map/unit.h b/src/map/unit.h index 761b3a0b6..0c1c2405c 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -81,16 +81,16 @@ struct unit_data { struct view_data { int16 class; - uint16 weapon, + int weapon, shield, //Or left-hand weapon. robe, head_top, head_mid, head_bottom, hair_style, - hair_color, - cloth_color, body_style; + uint16 hair_color, + cloth_color; char sex; unsigned dead_sit : 2; }; diff --git a/src/map/vending.c b/src/map/vending.c index 9bd06c758..692f5f378 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -315,7 +315,7 @@ static void vending_openvending(struct map_session_data *sd, const char *message /// Checks if an item is being sold in given player's vending. -static bool vending_search(struct map_session_data *sd, unsigned short nameid) +static bool vending_search(struct map_session_data *sd, int nameid) { int i; @@ -324,7 +324,7 @@ static bool vending_search(struct map_session_data *sd, unsigned short nameid) return false; } - ARR_FIND( 0, sd->vend_num, i, sd->status.cart[sd->vending[i].index].nameid == (short)nameid ); + ARR_FIND(0, sd->vend_num, i, sd->status.cart[sd->vending[i].index].nameid == nameid); if( i == sd->vend_num ) { // not found return false; } @@ -347,7 +347,7 @@ static bool vending_searchall(struct map_session_data *sd, const struct s_search return true; for( idx = 0; idx < s->item_count; idx++ ) { - ARR_FIND( 0, sd->vend_num, i, sd->status.cart[sd->vending[i].index].nameid == (short)s->itemlist[idx] ); + ARR_FIND(0, sd->vend_num, i, sd->status.cart[sd->vending[i].index].nameid == s->itemlist[idx]); if( i == sd->vend_num ) {// not found continue; } diff --git a/src/map/vending.h b/src/map/vending.h index 831e122e7..c994aad3a 100644 --- a/src/map/vending.h +++ b/src/map/vending.h @@ -45,7 +45,7 @@ struct vending_interface { void (*open) (struct map_session_data* sd, const char* message, const uint8* data, int count); void (*list) (struct map_session_data* sd, unsigned int id); void (*purchase) (struct map_session_data* sd, int aid, unsigned int uid, const uint8* data, int count); - bool (*search) (struct map_session_data* sd, unsigned short nameid); + bool (*search) (struct map_session_data* sd, int nameid); bool (*searchall) (struct map_session_data* sd, const struct s_search_store_search* s); }; diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c index 38e5ead5d..feb27f834 100644 --- a/src/plugins/db2sql.c +++ b/src/plugins/db2sql.c @@ -242,7 +242,7 @@ int itemdb2sql_sub(struct config_setting_t *entry, int n, const char *source) StrBuf->Init(&buf); // id - StrBuf->Printf(&buf, "'%u',", it->nameid); + StrBuf->Printf(&buf, "'%u',", (uint32)it->nameid); // name_english SQL->EscapeString(NULL, e_name, it->name); |