summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/buyingstore.c32
-rw-r--r--src/map/buyingstore.h6
-rw-r--r--src/map/chrif.c2
-rw-r--r--src/map/clif.c31
-rw-r--r--src/map/clif.h22
-rw-r--r--src/map/intif.c32
-rw-r--r--src/map/intif.h4
-rw-r--r--src/map/itemdb.c63
-rw-r--r--src/map/itemdb.h50
-rw-r--r--src/map/map.c6
-rw-r--r--src/map/map.h6
-rw-r--r--src/map/mob.c75
-rw-r--r--src/map/mob.h8
-rw-r--r--src/map/npc.h4
-rw-r--r--src/map/packets_struct.h82
-rw-r--r--src/map/pc.c6
-rw-r--r--src/map/pc.h20
-rw-r--r--src/map/pet.c15
-rw-r--r--src/map/pet.h10
-rw-r--r--src/map/script.c56
-rw-r--r--src/map/script.h2
-rw-r--r--src/map/searchstore.c6
-rw-r--r--src/map/searchstore.h10
-rw-r--r--src/map/skill.c4
-rw-r--r--src/map/skill.h2
-rw-r--r--src/map/unit.h6
-rw-r--r--src/map/vending.c6
-rw-r--r--src/map/vending.h2
29 files changed, 344 insertions, 226 deletions
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 e96cc832d..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 {
@@ -77,7 +77,7 @@ struct s_buyingstore {
**/
struct buyingstore_interface {
unsigned int nextid;
- short blankslots[MAX_SLOTS]; // used when checking whether or not an item's card slots are blank
+ int blankslots[MAX_SLOTS]; // used when checking whether or not an item's card slots are blank
struct item_option blankoptions[MAX_ITEM_OPTIONS]; // used for search result temporary.
/* */
bool (*setup) (struct map_session_data* sd, unsigned char slots);
@@ -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..e15a65902 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;
@@ -18509,7 +18509,7 @@ static void clif_cashshop_db(void)
continue;
}
- if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) {
+ if (name[0] == 'I' && name[1] == 'D' && strlen(name) <= 12) {
if( !( data = itemdb->exists(atoi(name+2))) ) {
ShowWarning("cashshop_db: unknown item id '%s' in category '%s'\n", name+2, entry_name);
continue;
@@ -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;
@@ -19700,7 +19700,7 @@ static bool clif_parse_roulette_db(void)
continue;
}
- if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) {
+ if (name[0] == 'I' && name[1] == 'D' && strlen(name) <= 12) {
if( !( data = itemdb->exists(atoi(name+2))) ) {
ShowWarning("roulette_db: unknown item id '%s' in category '%s'\n", name+2, entry_name);
continue;
@@ -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);
@@ -20642,12 +20643,14 @@ static void clif_rodex_read_mail(struct map_session_data *sd, int8 opentype, str
size += body_len;
for (i = 0; i < RODEX_MAX_ITEM; ++i) {
struct item *it = &msg->items[i].item;
- struct item_data* data = itemdb->search(it->nameid);
+ struct item_data *data;
int j, k;
- if (it->nameid == 0 || data == NULL) {
+ if (it->nameid == 0)
+ continue;
+ data = itemdb->search(it->nameid);
+ if (data == NULL)
continue;
- }
item = WFIFOP(fd, size);
memset(item, 0x0, sizeof(*item));
@@ -21246,7 +21249,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..5e447d4c0 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;
@@ -873,7 +873,7 @@ static void itemdb_read_groups(void)
} else
itname = libconfig->setting_get_string_elem(itg,c - 1);
- if( itname[0] == 'I' && itname[1] == 'D' && strlen(itname) < 8 ) {
+ if (itname[0] == 'I' && itname[1] == 'D' && strlen(itname) <= 12) {
if( !( data = itemdb->exists(atoi(itname+2)) ) )
ShowWarning("itemdb_read_groups: unknown item ID '%d' in group '%s'!\n",atoi(itname+2),config_setting_name(itg));
} else if( !( data = itemdb->name2id(itname) ) )
@@ -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;
@@ -1235,7 +1240,7 @@ static void itemdb_read_packages(void)
itname = config_setting_name(it);
- if( itname[0] == 'I' && itname[1] == 'D' && strlen(itname) < 8 ) {
+ if (itname[0] == 'I' && itname[1] == 'D' && strlen(itname) <= 12) {
if( !( data = itemdb->exists(atoi(itname+2)) ) )
ShowWarning("itemdb_read_packages: unknown item ID '%d' in package '%s'!\n",atoi(itname+2),config_setting_name(itg));
} else if( !( data = itemdb->name2id(itname) ) )
@@ -1486,7 +1491,7 @@ static void itemdb_read_chains(void)
while( (entry = libconfig->setting_get_elem(itc,c++)) ) {
const char *itname = config_setting_name(entry);
- if( itname[0] == 'I' && itname[1] == 'D' && strlen(itname) < 8 ) {
+ if (itname[0] == 'I' && itname[1] == 'D' && strlen(itname) <= 12) {
if( !( data = itemdb->exists(atoi(itname+2)) ) )
ShowWarning("itemdb_read_chains: unknown item ID '%d' in chain '%s'!\n",atoi(itname+2),name);
} else if( !( data = itemdb->name2id(itname) ) )
@@ -1695,9 +1700,9 @@ static int itemdb_validate_entry(struct item_data *entry, int n, const char *sou
nullpo_ret(entry);
nullpo_ret(source);
- if( entry->nameid <= 0 || entry->nameid >= MAX_ITEMDB ) {
- ShowWarning("itemdb_validate_entry: Invalid item ID %d in entry %d of '%s', allowed values 0 < ID < %d (MAX_ITEMDB), skipping.\n",
- entry->nameid, n, source, MAX_ITEMDB);
+ if (entry->nameid <= 0 || entry->nameid > MAX_ITEM_ID) {
+ ShowWarning("itemdb_validate_entry: Invalid item ID %d in entry %d of '%s', allowed values 0 < ID < %d (MAX_ITEM_ID), skipping.\n",
+ entry->nameid, n, source, MAX_ITEM_ID);
if (entry->script) {
script->free_code(entry->script);
entry->script = NULL;
@@ -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) ) {
@@ -2341,6 +2346,7 @@ static bool itemdb_lookup_const_mask(const struct config_setting_t *it, const ch
static int itemdb_readdb_libconfig(const char *filename)
{
bool duplicate[MAX_ITEMDB];
+ struct DBMap *duplicate_db;
struct config_t item_db_conf;
struct config_setting_t *itdb, *it;
char filepath[256];
@@ -2357,26 +2363,38 @@ static int itemdb_readdb_libconfig(const char *filename)
return 0;
}
+ // TODO add duplicates check for itemdb->other
memset(&duplicate,0,sizeof(duplicate));
+ duplicate_db = idb_alloc(DB_OPT_BASE);
while( (it = libconfig->setting_get_elem(itdb,i++)) ) {
int nameid = itemdb->readdb_libconfig_sub(it, i-1, filename);
- if (nameid <= 0 || nameid >= MAX_ITEMDB)
+ if (nameid <= 0 || nameid > MAX_ITEM_ID)
continue;
itemdb->readdb_additional_fields(nameid, it, i - 1, filename);
count++;
- if( duplicate[nameid] ) {
- ShowWarning("itemdb_readdb:%s: duplicate entry of ID #%d (%s/%s)\n",
- filename, nameid, itemdb_name(nameid), itemdb_jname(nameid));
- } else
- duplicate[nameid] = true;
+ if (nameid < MAX_ITEMDB) {
+ if (duplicate[nameid]) {
+ ShowWarning("itemdb_readdb:%s: duplicate entry of ID #%d (%s/%s)\n",
+ filename, nameid, itemdb_name(nameid), itemdb_jname(nameid));
+ } else {
+ duplicate[nameid] = true;
+ }
+ } else {
+ if (idb_exists(duplicate_db, nameid)) {
+ ShowWarning("itemdb_readdb:%s: duplicate entry of ID #%d (%s/%s)\n",
+ filename, nameid, itemdb_name(nameid), itemdb_jname(nameid));
+ } else {
+ idb_iput(duplicate_db, nameid, true);
+ }
+ }
}
+ db_destroy(duplicate_db);
libconfig->destroy(&item_db_conf);
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filename);
-
return count;
}
@@ -2406,6 +2424,7 @@ static void itemdb_read(bool minimal)
for (i = 0; i < ARRAYLENGTH(filename); i++)
itemdb->readdb_libconfig(filename[i]);
+ // TODO check duplicate names also in itemdb->other
for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i ) {
if( itemdb->array[i] ) {
if( itemdb->names->put(itemdb->names,DB->str2key(itemdb->array[i]->name),DB->ptr2data(itemdb->array[i]),&prev) ) {
@@ -2431,7 +2450,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..d92940445 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -33,10 +33,29 @@ struct hplugin_data_store;
/**
* Defines
**/
-#define MAX_ITEMDB 0x8000 // 32k array entries in array (the rest goes to the db)
+#ifndef MAX_ITEMDB
+#define MAX_ITEMDB 0xFFFF
+#endif
+
+#ifndef MAX_ITEM_ID
+#if PACKETVER_RE_NUM >= 20180704
+#define MAX_ITEM_ID 0x20000
+#else
+#define MAX_ITEM_ID 0xFFFF
+#endif
+#endif
+
+#ifndef MAX_ITEMDELAYS
#define MAX_ITEMDELAYS 10 // The maximum number of item delays
+#endif
+
+#ifndef MAX_SEARCH
#define MAX_SEARCH 5 //Designed for search functions, species max number of matches to display.
+#endif
+
+#ifndef MAX_ITEMS_PER_COMBO
#define MAX_ITEMS_PER_COMBO 6 /* maximum amount of items a combo may require */
+#endif
#define CARD0_FORGE 0x00FF
#define CARD0_CREATE 0x00FE
@@ -45,8 +64,17 @@ struct hplugin_data_store;
//Marks if the card0 given is "special" (non-item id used to mark pets/created items. [Skotlex]
#define itemdb_isspecial(i) ((i) == CARD0_FORGE || (i) == CARD0_CREATE || (i) == CARD0_PET)
+#ifndef UNKNOWN_ITEM_ID
//Use apple for unknown items.
#define UNKNOWN_ITEM_ID 512
+#endif
+
+#if MAX_ITEM_ID < MAX_ITEMDB
+#error "MAX_ITEM_ID must be bigger or same with MAX_ITEMDB"
+#endif
+#if MAX_ITEM_ID > 0xFFFF && PACKETVER_RE_NUM < 20180704
+#error "For clients before 20180704 RE, MAX_ITEM_ID must be smaller than 0x10000"
+#endif
enum item_itemid {
ITEMID_RED_POTION = 501,
@@ -393,19 +421,19 @@ 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 id;
+ int *nameid;
unsigned short qty;
};
struct item_chain_entry {
- unsigned short id;
+ int id;
unsigned short rate;
struct item_chain_entry *next;
};
@@ -416,7 +444,7 @@ struct item_chain {
};
struct item_package_rand_entry {
- unsigned short id;
+ int id;
unsigned short qty;
unsigned short rate;
unsigned short hours;
@@ -427,7 +455,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 +469,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 +482,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 +679,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..8ea059700 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -5455,13 +5455,13 @@ 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;
if( !name )
return 0;
- if( name[0] == 'I' && name[1] == 'D' && strlen(name) < 8 ) {
+ if (name[0] == 'I' && name[1] == 'D' && strlen(name) <= 12) {
if( !( data = itemdb->exists(atoi(name+2))) ) {
return 0;
}
@@ -5479,7 +5479,7 @@ static unsigned short map_zone_str2skillid(const char *name)
if( !name )
return 0;
- if( name[0] == 'I' && name[1] == 'D' && strlen(name) < 8 ) {
+ if (name[0] == 'I' && name[1] == 'D' && strlen(name) <= 12) {
if( !skill->get_index((nameid = atoi(name+2))) )
return 0;
} else {
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/mob.c b/src/map/mob.c
index 403e3a2f2..0dbff9211 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -88,6 +88,7 @@ struct item_drop_ratio {
int mob_id[MAX_ITEMRATIO_MOBS];
};
static struct item_drop_ratio *item_drop_ratio_db[MAX_ITEMDB];
+static struct DBMap *item_drop_ratio_other_db = NULL;
static struct eri *item_drop_ers; //For loot drops delay structures.
static struct eri *item_drop_list_ers;
@@ -3791,6 +3792,28 @@ static unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned shor
return (unsigned int)cap_value(rate,rate_min,rate_max);
}
+static struct item_drop_ratio *mob_get_item_drop_ratio(int nameid)
+{
+ Assert_retr(NULL, nameid > 0);
+ if (nameid < ARRAYLENGTH(item_drop_ratio_db)) {
+ return item_drop_ratio_db[nameid];
+ } else {
+ return (struct item_drop_ratio *)idb_get(item_drop_ratio_other_db, nameid);
+ }
+}
+
+static void mob_set_item_drop_ratio(int nameid, struct item_drop_ratio *ratio)
+{
+ Assert_retv(nameid > 0);
+ if (nameid < ARRAYLENGTH(item_drop_ratio_db)) {
+ Assert_retv(item_drop_ratio_db[nameid] == NULL);
+ item_drop_ratio_db[nameid] = ratio;
+ } else {
+ Assert_retv(idb_get(item_drop_ratio_other_db, nameid) == NULL);
+ idb_put(item_drop_ratio_other_db, nameid, ratio);
+ }
+}
+
/**
* Check if global item drop rate is overridden for given item
* in db/mob_item_ratio.txt
@@ -3800,16 +3823,19 @@ static unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned shor
*/
static void item_dropratio_adjust(int nameid, int mob_id, int *rate_adjust)
{
+ struct item_drop_ratio *dropRatio;
nullpo_retv(rate_adjust);
- if( item_drop_ratio_db[nameid] ) {
- if( item_drop_ratio_db[nameid]->mob_id[0] ) { // only for listed mobs
+
+ dropRatio = mob->get_item_drop_ratio(nameid);
+ if (dropRatio) {
+ if (dropRatio->mob_id[0] ) { // only for listed mobs
int i;
- ARR_FIND(0, MAX_ITEMRATIO_MOBS, i, item_drop_ratio_db[nameid]->mob_id[i] == mob_id);
- if(i < MAX_ITEMRATIO_MOBS) // found
- *rate_adjust = item_drop_ratio_db[nameid]->drop_ratio;
+ ARR_FIND(0, MAX_ITEMRATIO_MOBS, i, dropRatio->mob_id[i] == mob_id);
+ if (i < MAX_ITEMRATIO_MOBS) // found
+ *rate_adjust = dropRatio->drop_ratio;
}
else // for all mobs
- *rate_adjust = item_drop_ratio_db[nameid]->drop_ratio;
+ *rate_adjust = dropRatio->drop_ratio;
}
}
@@ -5142,6 +5168,7 @@ static bool mob_readdb_race2(char *fields[], int columns, int current)
static bool mob_readdb_itemratio(char *str[], int columns, int current)
{
int nameid, ratio, i;
+ struct item_drop_ratio *dropRatio;
nullpo_retr(false, str);
nameid = atoi(str[0]);
@@ -5154,12 +5181,15 @@ static bool mob_readdb_itemratio(char *str[], int columns, int current)
ratio = atoi(str[1]);
- if(item_drop_ratio_db[nameid] == NULL)
- item_drop_ratio_db[nameid] = (struct item_drop_ratio*)aCalloc(1, sizeof(struct item_drop_ratio));
+ dropRatio = mob->get_item_drop_ratio(nameid);
+ if (dropRatio == NULL) {
+ dropRatio = (struct item_drop_ratio*)aCalloc(1, sizeof(struct item_drop_ratio));
+ mob->set_item_drop_ratio(nameid, dropRatio);
+ }
- item_drop_ratio_db[nameid]->drop_ratio = ratio;
- for(i = 0; i < columns-2; i++)
- item_drop_ratio_db[nameid]->mob_id[i] = atoi(str[i+2]);
+ dropRatio->drop_ratio = ratio;
+ for (i = 0; i < columns - 2; i++)
+ dropRatio->mob_id[i] = atoi(str[i + 2]);
return true;
}
@@ -5183,6 +5213,19 @@ static void mob_load(bool minimal)
sv->readdb(map->db_path, DBPATH"mob_race2_db.txt", ',', 2, 20, -1, mob->readdb_race2);
}
+/**
+ * @see DBApply
+ */
+static int mob_final_ratio_sub(union DBKey key, struct DBData *data, va_list ap)
+{
+ struct item_drop_ratio *ratio = DB->data2ptr(data);
+
+ if (ratio)
+ aFree(ratio);
+
+ return 0;
+}
+
static void mob_reload(void)
{
int i;
@@ -5201,6 +5244,7 @@ static void mob_reload(void)
item_drop_ratio_db[i] = NULL;
}
}
+ mob->item_drop_ratio_other_db->clear(mob->item_drop_ratio_other_db, mob->final_ratio_sub);
mob->load(false);
}
@@ -5291,6 +5335,8 @@ static int do_final_mob(void)
item_drop_ratio_db[i] = NULL;
}
}
+ mob->item_drop_ratio_other_db->clear(mob->item_drop_ratio_other_db, mob->final_ratio_sub);
+ db_destroy(mob->item_drop_ratio_other_db);
ers_destroy(item_drop_ers);
ers_destroy(item_drop_list_ers);
return 0;
@@ -5334,6 +5380,10 @@ void mob_defaults(void)
memcpy(mob->splendide, mob_splendide, sizeof(mob->splendide));
memcpy(mob->mora, mob_mora, sizeof(mob->mora));
+ item_drop_ratio_other_db = idb_alloc(DB_OPT_BASE);
+ mob->item_drop_ratio_db = item_drop_ratio_db;
+ mob->item_drop_ratio_other_db = item_drop_ratio_other_db;
+
/* */
mob->reload = mob_reload;
mob->init = do_init_mob;
@@ -5438,6 +5488,9 @@ void mob_defaults(void)
mob->readdb_race2 = mob_readdb_race2;
mob->readdb_itemratio = mob_readdb_itemratio;
mob->load = mob_load;
+ mob->get_item_drop_ratio = mob_get_item_drop_ratio;
+ mob->set_item_drop_ratio = mob_set_item_drop_ratio;
+ mob->final_ratio_sub = mob_final_ratio_sub;
mob->clear_spawninfo = mob_clear_spawninfo;
mob->destroy_mob_db = mob_destroy_mob_db;
mob->skill_db_libconfig = mob_skill_db_libconfig;
diff --git a/src/map/mob.h b/src/map/mob.h
index 3ff3f213b..4cb3877ed 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -25,6 +25,7 @@
#include "map/status.h" // struct status_data, struct status_change
#include "map/unit.h" // struct unit_data, view_data
#include "common/hercules.h"
+#include "common/db.h"
#include "common/mmo.h" // struct item
struct hplugin_data_store;
@@ -72,6 +73,8 @@ struct hplugin_data_store;
// Disable this to make monsters not do any path search when looking for a target (old behavior).
#define ACTIVEPATHSEARCH
+struct item_drop_ratio;
+
enum e_bosstype {
BTYPE_NONE = 0,
BTYPE_BOSS = 1,
@@ -437,6 +440,8 @@ struct mob_interface {
int manuk[8];
int splendide[5];
int mora[5];
+ struct item_drop_ratio **item_drop_ratio_db;
+ struct DBMap *item_drop_ratio_other_db;
/* */
int (*init) (bool mimimal);
int (*final) (void);
@@ -543,6 +548,9 @@ struct mob_interface {
bool (*readdb_itemratio) (char *str[], int columns, int current);
void (*load) (bool minimal);
void (*clear_spawninfo) (void);
+ struct item_drop_ratio *(*get_item_drop_ratio) (int nameid);
+ void (*set_item_drop_ratio) (int nameid, struct item_drop_ratio *ratio);
+ int (*final_ratio_sub) (union DBKey key, struct DBData *data, va_list ap);
void (*destroy_mob_db) (int index);
bool (*skill_db_libconfig) (const char *filename, bool ignore_missing);
bool (*skill_db_libconfig_sub) (struct config_setting_t *it, int n);
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/packets_struct.h b/src/map/packets_struct.h
index 27c099a9e..d9160ed3f 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -600,12 +600,12 @@ struct packet_idle_unit2 {
int16 healthState;
int16 effectState;
int16 job;
- int16 head;
- int16 weapon;
- int16 accessory;
- int16 shield;
- int16 accessory2;
- int16 accessory3;
+ uint16 head;
+ uint16 weapon;
+ uint16 accessory;
+ uint16 shield;
+ uint16 accessory2;
+ uint16 accessory3;
int16 headpalette;
int16 bodypalette;
int16 headDir;
@@ -636,13 +636,13 @@ struct packet_spawn_unit2 {
int16 bodyState;
int16 healthState;
int16 effectState;
- int16 head;
- int16 weapon;
- int16 accessory;
+ uint16 head;
+ uint16 weapon;
+ uint16 accessory;
int16 job;
- int16 shield;
- int16 accessory2;
- int16 accessory3;
+ uint16 shield;
+ uint16 accessory2;
+ uint16 accessory3;
int16 headpalette;
int16 bodypalette;
int16 headDir;
@@ -675,26 +675,26 @@ struct packet_spawn_unit {
int32 effectState;
#endif
int16 job;
- int16 head;
+ uint16 head;
#if PACKETVER < 7
- int16 weapon;
+ uint16 weapon;
#else
- int32 weapon;
+ uint32 weapon;
#endif
#if PACKETVER_RE_NUM >= 20180704
- int32 shield;
+ uint32 shield;
#endif
- int16 accessory;
+ uint16 accessory;
#if PACKETVER < 7
- int16 shield;
+ uint16 shield;
#endif
- int16 accessory2;
- int16 accessory3;
+ uint16 accessory2;
+ uint16 accessory3;
int16 headpalette;
int16 bodypalette;
int16 headDir;
#if PACKETVER >= 20101124
- int16 robe;
+ uint16 robe;
#endif
uint32 GUID;
int16 GEmblemVer;
@@ -748,27 +748,27 @@ struct packet_unit_walking {
int32 effectState;
#endif
int16 job;
- int16 head;
+ uint16 head;
#if PACKETVER < 7
- int16 weapon;
+ uint16 weapon;
#else
- int32 weapon;
+ uint32 weapon;
#endif
#if PACKETVER_RE_NUM >= 20180704
- int32 shield;
+ uint32 shield;
#endif
- int16 accessory;
+ uint16 accessory;
uint32 moveStartTime;
#if PACKETVER < 7
- int16 shield;
+ uint16 shield;
#endif
- int16 accessory2;
- int16 accessory3;
+ uint16 accessory2;
+ uint16 accessory3;
int16 headpalette;
int16 bodypalette;
int16 headDir;
#if PACKETVER >= 20101124
- int16 robe;
+ uint16 robe;
#endif
uint32 GUID;
int16 GEmblemVer;
@@ -793,7 +793,7 @@ struct packet_unit_walking {
uint8 isBoss;
#endif
#if PACKETVER >= 20150513
- int16 body;
+ uint16 body;
#endif
/* Might be earlier, this is when the named item bug began */
#if PACKETVER >= 20131223
@@ -820,26 +820,26 @@ struct packet_idle_unit {
int32 effectState;
#endif
int16 job;
- int16 head;
+ uint16 head;
#if PACKETVER < 7
- int16 weapon;
+ uint16 weapon;
#else
- int32 weapon;
+ uint32 weapon;
#endif
#if PACKETVER_RE_NUM >= 20180704
- int32 shield;
+ uint32 shield;
#endif
- int16 accessory;
+ uint16 accessory;
#if PACKETVER < 7
- int16 shield;
+ uint16 shield;
#endif
- int16 accessory2;
- int16 accessory3;
+ uint16 accessory2;
+ uint16 accessory3;
int16 headpalette;
int16 bodypalette;
int16 headDir;
#if PACKETVER >= 20101124
- int16 robe;
+ uint16 robe;
#endif
uint32 GUID;
int16 GEmblemVer;
@@ -865,7 +865,7 @@ struct packet_idle_unit {
uint8 isBoss;
#endif
#if PACKETVER >= 20150513
- int16 body;
+ uint16 body;
#endif
/* Might be earlier, this is when the named item bug began */
#if PACKETVER >= 20131223
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 6b847eb92..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 short *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 03924c29a..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 short* 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);
};