Browse Source

Changed all short to int16 (#8962)

Lemongrass3110 3 tháng trước cách đây
mục cha
commit
f870478cef
62 tập tin đã thay đổi với 642 bổ sung642 xóa
  1. 2 2
      src/char/char.cpp
  2. 3 3
      src/char/char.hpp
  3. 3 3
      src/char/char_clif.cpp
  4. 1 1
      src/char/char_clif.hpp
  5. 3 3
      src/char/int_auction.cpp
  6. 8 8
      src/char/int_guild.cpp
  7. 1 1
      src/char/int_guild.hpp
  8. 1 1
      src/char/int_mail.cpp
  9. 1 1
      src/char/int_pet.cpp
  10. 3 3
      src/char/inter.cpp
  11. 1 1
      src/common/malloc.cpp
  12. 32 32
      src/common/mmo.hpp
  13. 1 1
      src/common/showmsg.cpp
  14. 1 1
      src/common/strlib.cpp
  15. 1 1
      src/config/const.hpp
  16. 16 16
      src/map/atcommand.cpp
  17. 42 42
      src/map/battle.cpp
  18. 1 1
      src/map/battle.hpp
  19. 1 1
      src/map/battleground.cpp
  20. 1 1
      src/map/battleground.hpp
  21. 1 1
      src/map/chrif.cpp
  22. 50 50
      src/map/clif.cpp
  23. 14 14
      src/map/clif.hpp
  24. 1 1
      src/map/elemental.cpp
  25. 1 1
      src/map/elemental.hpp
  26. 5 5
      src/map/guild.cpp
  27. 1 1
      src/map/guild.hpp
  28. 6 6
      src/map/homunculus.cpp
  29. 3 3
      src/map/homunculus.hpp
  30. 1 1
      src/map/instance.cpp
  31. 1 1
      src/map/instance.hpp
  32. 7 7
      src/map/intif.cpp
  33. 3 3
      src/map/intif.hpp
  34. 1 1
      src/map/itemdb.hpp
  35. 2 2
      src/map/mail.cpp
  36. 2 2
      src/map/mail.hpp
  37. 10 10
      src/map/map.cpp
  38. 3 3
      src/map/map.hpp
  39. 4 4
      src/map/mob.cpp
  40. 8 8
      src/map/mob.hpp
  41. 5 5
      src/map/navi.cpp
  42. 10 10
      src/map/npc.cpp
  43. 6 6
      src/map/npc.hpp
  44. 3 3
      src/map/party.cpp
  45. 6 6
      src/map/party.hpp
  46. 6 6
      src/map/path.cpp
  47. 39 39
      src/map/pc.cpp
  48. 59 59
      src/map/pc.hpp
  49. 4 4
      src/map/pet.cpp
  50. 2 2
      src/map/pet.hpp
  51. 98 98
      src/map/script.cpp
  52. 44 44
      src/map/skill.cpp
  53. 6 6
      src/map/skill.hpp
  54. 62 62
      src/map/status.cpp
  55. 6 6
      src/map/status.hpp
  56. 1 1
      src/map/storage.cpp
  57. 2 2
      src/map/trade.cpp
  58. 1 1
      src/map/trade.hpp
  59. 15 15
      src/map/unit.cpp
  60. 12 12
      src/map/unit.hpp
  61. 6 6
      src/map/vending.cpp
  62. 2 2
      src/map/vending.hpp

+ 2 - 2
src/char/char.cpp

@@ -1381,7 +1381,7 @@ int32 char_check_char_name(char * name, char * esc_name)
 //-----------------------------------
 //-----------------------------------
 // Function to create a new character
 // Function to create a new character
 //-----------------------------------
 //-----------------------------------
-int32 char_make_new_char( struct char_session_data* sd, char* name_, int32 str, int32 agi, int32 vit, int32 int_, int32 dex, int32 luk, int32 slot, int32 hair_color, int32 hair_style, short start_job, int32 sex ){
+int32 char_make_new_char( struct char_session_data* sd, char* name_, int32 str, int32 agi, int32 vit, int32 int_, int32 dex, int32 luk, int32 slot, int32 hair_color, int32 hair_style, int16 start_job, int32 sex ){
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 	char esc_name[NAME_LENGTH*2+1];
 	char esc_name[NAME_LENGTH*2+1];
 	struct s_point_str tmp_start_point[MAX_STARTPOINT];
 	struct s_point_str tmp_start_point[MAX_STARTPOINT];
@@ -2819,7 +2819,7 @@ void char_set_defaults(){
  * @param start: Start point reference
  * @param start: Start point reference
  * @param count: Start point count reference
  * @param count: Start point count reference
  */
  */
-void char_config_split_startpoint( char* w1_value, char* w2_value, struct s_point_str start_point[MAX_STARTPOINT], short* count ){
+void char_config_split_startpoint( char* w1_value, char* w2_value, struct s_point_str start_point[MAX_STARTPOINT], int16* count ){
 	char *lineitem, **fields;
 	char *lineitem, **fields;
 	int32 i = 0;
 	int32 i = 0;
 	size_t fields_length = 3 + 1;
 	size_t fields_length = 3 + 1;

+ 3 - 3
src/char/char.hpp

@@ -190,7 +190,7 @@ struct CharServ_Config {
 	int32 char_check_db;	///cheking sql-table at begining ?
 	int32 char_check_db;	///cheking sql-table at begining ?
 
 
 	struct s_point_str start_point[MAX_STARTPOINT], start_point_doram[MAX_STARTPOINT]; // Initial position the player will spawn on the server
 	struct s_point_str start_point[MAX_STARTPOINT], start_point_doram[MAX_STARTPOINT]; // Initial position the player will spawn on the server
-	short start_point_count, start_point_count_doram; // Number of positions read
+	int16 start_point_count, start_point_count_doram; // Number of positions read
 	struct startitem start_items[MAX_STARTITEM], start_items_doram[MAX_STARTITEM]; // Initial items the player with spawn with on the server
 	struct startitem start_items[MAX_STARTITEM], start_items_doram[MAX_STARTITEM]; // Initial items the player with spawn with on the server
 	uint32 start_status_points;
 	uint32 start_status_points;
 	int32 console;
 	int32 console;
@@ -242,7 +242,7 @@ struct online_char_data {
 	uint32 char_id;
 	uint32 char_id;
 	int32 fd;
 	int32 fd;
 	int32 waiting_disconnect;
 	int32 waiting_disconnect;
-	short server; // -2: unknown server, -1: not connected, 0+: id of server
+	int16 server; // -2: unknown server, -1: not connected, 0+: id of server
 	bool pincode_success;
 	bool pincode_success;
 
 
 public: 
 public: 
@@ -328,7 +328,7 @@ void char_auth_ok(int32 fd, struct char_session_data *sd);
 void char_set_charselect(uint32 account_id);
 void char_set_charselect(uint32 account_id);
 void char_read_fame_list(void);
 void char_read_fame_list(void);
 
 
-int32 char_make_new_char( struct char_session_data* sd, char* name_, int32 str, int32 agi, int32 vit, int32 int_, int32 dex, int32 luk, int32 slot, int32 hair_color, int32 hair_style, short start_job, int32 sex );
+int32 char_make_new_char( struct char_session_data* sd, char* name_, int32 str, int32 agi, int32 vit, int32 int_, int32 dex, int32 luk, int32 slot, int32 hair_color, int32 hair_style, int16 start_job, int32 sex );
 
 
 void char_set_session_flag_(int32 account_id, int32 val, bool set);
 void char_set_session_flag_(int32 account_id, int32 val, bool set);
 #define char_set_session_flag(account_id, val)   ( char_set_session_flag_((account_id), (val), true)  )
 #define char_set_session_flag(account_id, val)   ( char_set_session_flag_((account_id), (val), true)  )

+ 3 - 3
src/char/char_clif.cpp

@@ -54,7 +54,7 @@ bool pincode_allowed( char* pincode );
 // reason
 // reason
 // 0: success
 // 0: success
 // 1: failed
 // 1: failed
-void chclif_moveCharSlotReply( int32 fd, struct char_session_data* sd, uint16 index, short reason ){
+void chclif_moveCharSlotReply( int32 fd, struct char_session_data* sd, uint16 index, int16 reason ){
 	WFIFOHEAD(fd,8);
 	WFIFOHEAD(fd,8);
 	WFIFOW(fd,0) = HEADER_HC_ACK_CHANGE_CHARACTER_SLOT;
 	WFIFOW(fd,0) = HEADER_HC_ACK_CHANGE_CHARACTER_SLOT;
 	WFIFOW(fd,2) = 8;
 	WFIFOW(fd,2) = 8;
@@ -813,7 +813,7 @@ int32 chclif_parse_reqtoconnect(int32 fd, struct char_session_data* sd,uint32 ip
 	return 1;
 	return 1;
 }
 }
 
 
-//struct PACKET_CH_CHARLIST_REQ { 0x0 short PacketType}
+//struct PACKET_CH_CHARLIST_REQ { 0x0 int16 PacketType}
 int32 chclif_parse_req_charlist(int32 fd, struct char_session_data* sd){
 int32 chclif_parse_req_charlist(int32 fd, struct char_session_data* sd){
 	FIFOSD_CHECK(2);
 	FIFOSD_CHECK(2);
 	RFIFOSKIP(fd,2);
 	RFIFOSKIP(fd,2);
@@ -1163,7 +1163,7 @@ int32 chclif_parse_createnewchar(int32 fd, struct char_session_data* sd,int32 cm
 		int32 slot;
 		int32 slot;
 		int32 hair_color;
 		int32 hair_color;
 		int32 hair_style;
 		int32 hair_style;
-		short start_job;
+		int16 start_job;
 		int32 sex;
 		int32 sex;
 
 
 #if PACKETVER >= 20151001
 #if PACKETVER >= 20151001

+ 1 - 1
src/char/char_clif.hpp

@@ -10,7 +10,7 @@
 struct char_session_data;
 struct char_session_data;
 enum pincode_state : uint8;
 enum pincode_state : uint8;
 
 
-void chclif_moveCharSlotReply( int32 fd, struct char_session_data* sd, uint16 index, short reason );
+void chclif_moveCharSlotReply( int32 fd, struct char_session_data* sd, uint16 index, int16 reason );
 int32 chclif_parse_moveCharSlot( int32 fd, struct char_session_data* sd);
 int32 chclif_parse_moveCharSlot( int32 fd, struct char_session_data* sd);
 #if PACKETVER_SUPPORTS_PINCODE
 #if PACKETVER_SUPPORTS_PINCODE
 void chclif_pincode_sendstate( int32 fd, struct char_session_data* sd, enum pincode_state state );
 void chclif_pincode_sendstate( int32 fd, struct char_session_data* sd, enum pincode_state state );

+ 3 - 3
src/char/int_auction.cpp

@@ -263,7 +263,7 @@ void inter_auctions_fromsql(void)
 	Sql_FreeResult(sql_handle);
 	Sql_FreeResult(sql_handle);
 }
 }
 
 
-void mapif_Auction_sendlist(int32 fd, uint32 char_id, short count, short pages, unsigned char *buf)
+void mapif_Auction_sendlist(int32 fd, uint32 char_id, int16 count, int16 pages, unsigned char *buf)
 {
 {
 	int32 len = (sizeof(struct auction_data) * count) + 12;
 	int32 len = (sizeof(struct auction_data) * count) + 12;
 
 
@@ -282,9 +282,9 @@ void mapif_parse_Auction_requestlist(int32 fd)
 	char searchtext[NAME_LENGTH];
 	char searchtext[NAME_LENGTH];
 	uint32 char_id = RFIFOL(fd,4), len = sizeof(struct auction_data);
 	uint32 char_id = RFIFOL(fd,4), len = sizeof(struct auction_data);
 	int32 price = RFIFOL(fd,10);
 	int32 price = RFIFOL(fd,10);
-	short type = RFIFOW(fd,8), page = max(1,RFIFOW(fd,14));
+	int16 type = RFIFOW(fd,8), page = max(1,RFIFOW(fd,14));
 	unsigned char buf[5 * sizeof(struct auction_data)];
 	unsigned char buf[5 * sizeof(struct auction_data)];
-	short i = 0, j = 0, pages = 1;
+	int16 i = 0, j = 0, pages = 1;
 
 
 	memcpy(searchtext, RFIFOP(fd,16), NAME_LENGTH);
 	memcpy(searchtext, RFIFOP(fd,16), NAME_LENGTH);
 
 

+ 8 - 8
src/char/int_guild.cpp

@@ -1485,7 +1485,7 @@ int32 mapif_parse_GuildBasicInfoChange(int32 fd,int32 guild_id,int32 type,const
 		return 0;
 		return 0;
 	}
 	}
 
 
-	short data_value = *((short *)data);
+	int16 data_value = *((int16 *)data);
 
 
 	switch(type) {
 	switch(type) {
 		case GBI_GUILDLV:
 		case GBI_GUILDLV:
@@ -1545,7 +1545,7 @@ int32 mapif_parse_GuildMemberInfoChange(int32 fd,int32 guild_id,uint32 account_i
 	{
 	{
 		case GMI_POSITION:
 		case GMI_POSITION:
 		  {
 		  {
-			g->guild.member[i].position=*((short *)data);
+			g->guild.member[i].position=*((int16 *)data);
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			g->save_flag |= GS_MEMBER;
 			g->save_flag |= GS_MEMBER;
@@ -1577,7 +1577,7 @@ int32 mapif_parse_GuildMemberInfoChange(int32 fd,int32 guild_id,uint32 account_i
 		}
 		}
 		case GMI_HAIR:
 		case GMI_HAIR:
 		{
 		{
-			g->guild.member[i].hair=*((short *)data);
+			g->guild.member[i].hair=*((int16 *)data);
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			g->save_flag |= GS_MEMBER; //Save new data.
 			g->save_flag |= GS_MEMBER; //Save new data.
@@ -1585,7 +1585,7 @@ int32 mapif_parse_GuildMemberInfoChange(int32 fd,int32 guild_id,uint32 account_i
 		}
 		}
 		case GMI_HAIR_COLOR:
 		case GMI_HAIR_COLOR:
 		{
 		{
-			g->guild.member[i].hair_color=*((short *)data);
+			g->guild.member[i].hair_color=*((int16 *)data);
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			g->save_flag |= GS_MEMBER; //Save new data.
 			g->save_flag |= GS_MEMBER; //Save new data.
@@ -1593,7 +1593,7 @@ int32 mapif_parse_GuildMemberInfoChange(int32 fd,int32 guild_id,uint32 account_i
 		}
 		}
 		case GMI_GENDER:
 		case GMI_GENDER:
 		{
 		{
-			g->guild.member[i].gender=*((short *)data);
+			g->guild.member[i].gender=*((int16 *)data);
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			g->save_flag |= GS_MEMBER; //Save new data.
 			g->save_flag |= GS_MEMBER; //Save new data.
@@ -1601,7 +1601,7 @@ int32 mapif_parse_GuildMemberInfoChange(int32 fd,int32 guild_id,uint32 account_i
 		}
 		}
 		case GMI_CLASS:
 		case GMI_CLASS:
 		{
 		{
-			g->guild.member[i].class_=*((short *)data);
+			g->guild.member[i].class_=*((int16 *)data);
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			g->save_flag |= GS_MEMBER; //Save new data.
 			g->save_flag |= GS_MEMBER; //Save new data.
@@ -1609,7 +1609,7 @@ int32 mapif_parse_GuildMemberInfoChange(int32 fd,int32 guild_id,uint32 account_i
 		}
 		}
 		case GMI_LEVEL:
 		case GMI_LEVEL:
 		{
 		{
-			g->guild.member[i].lv=*((short *)data);
+			g->guild.member[i].lv=*((int16 *)data);
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			g->guild.member[i].modified = GS_MEMBER_MODIFIED;
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
 			g->save_flag |= GS_MEMBER; //Save new data.
 			g->save_flag |= GS_MEMBER; //Save new data.
@@ -1622,7 +1622,7 @@ int32 mapif_parse_GuildMemberInfoChange(int32 fd,int32 guild_id,uint32 account_i
 	return 0;
 	return 0;
 }
 }
 
 
-int32 inter_guild_sex_changed(int32 guild_id,uint32 account_id,uint32 char_id, short gender)
+int32 inter_guild_sex_changed(int32 guild_id,uint32 account_id,uint32 char_id, int16 gender)
 {
 {
 	return mapif_parse_GuildMemberInfoChange(0, guild_id, account_id, char_id, GMI_GENDER, (const char*)&gender, sizeof(gender));
 	return mapif_parse_GuildMemberInfoChange(0, guild_id, account_id, char_id, GMI_GENDER, (const char*)&gender, sizeof(gender));
 }
 }

+ 1 - 1
src/char/int_guild.hpp

@@ -60,7 +60,7 @@ void inter_guild_sql_final(void);
 int32 inter_guild_leave(int32 guild_id,uint32 account_id,uint32 char_id);
 int32 inter_guild_leave(int32 guild_id,uint32 account_id,uint32 char_id);
 int32 mapif_parse_BreakGuild(int32 fd,int32 guild_id);
 int32 mapif_parse_BreakGuild(int32 fd,int32 guild_id);
 int32 inter_guild_broken(int32 guild_id);
 int32 inter_guild_broken(int32 guild_id);
-int32 inter_guild_sex_changed(int32 guild_id,uint32 account_id,uint32 char_id, short gender);
+int32 inter_guild_sex_changed(int32 guild_id,uint32 account_id,uint32 char_id, int16 gender);
 int32 inter_guild_charname_changed(int32 guild_id,uint32 account_id, uint32 char_id, char *name);
 int32 inter_guild_charname_changed(int32 guild_id,uint32 account_id, uint32 char_id, char *name);
 int32 inter_guild_CharOnline(uint32 char_id, int32 guild_id);
 int32 inter_guild_CharOnline(uint32 char_id, int32 guild_id);
 int32 inter_guild_CharOffline(uint32 char_id, int32 guild_id);
 int32 inter_guild_CharOffline(uint32 char_id, int32 guild_id);

+ 1 - 1
src/char/int_mail.cpp

@@ -222,7 +222,7 @@ bool mail_loadmessage(int32 mail_id, struct mail_message* msg)
 	memset(msg->item, 0, sizeof(struct item) * MAIL_MAX_ITEM);
 	memset(msg->item, 0, sizeof(struct item) * MAIL_MAX_ITEM);
 
 
 	for( i = 0; i < MAIL_MAX_ITEM && SQL_SUCCESS == Sql_NextRow(sql_handle); i++ ){
 	for( i = 0; i < MAIL_MAX_ITEM && SQL_SUCCESS == Sql_NextRow(sql_handle); i++ ){
-		Sql_GetData(sql_handle,0, &data, nullptr); msg->item[i].amount = (short)atoi(data);
+		Sql_GetData(sql_handle,0, &data, nullptr); msg->item[i].amount = (int16)atoi(data);
 		Sql_GetData(sql_handle,1, &data, nullptr); msg->item[i].nameid = strtoul(data, nullptr, 10);
 		Sql_GetData(sql_handle,1, &data, nullptr); msg->item[i].nameid = strtoul(data, nullptr, 10);
 		Sql_GetData(sql_handle,2, &data, nullptr); msg->item[i].refine = atoi(data);
 		Sql_GetData(sql_handle,2, &data, nullptr); msg->item[i].refine = atoi(data);
 		Sql_GetData(sql_handle,3, &data, nullptr); msg->item[i].attribute = atoi(data);
 		Sql_GetData(sql_handle,3, &data, nullptr); msg->item[i].attribute = atoi(data);

+ 1 - 1
src/char/int_pet.cpp

@@ -184,7 +184,7 @@ int32 mapif_delete_pet_ack(int32 fd, int32 flag){
 	return 0;
 	return 0;
 }
 }
 
 
-int32 mapif_create_pet(int32 fd, uint32 account_id, uint32 char_id, short pet_class, short pet_lv, t_itemid pet_egg_id, t_itemid pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name)
+int32 mapif_create_pet(int32 fd, uint32 account_id, uint32 char_id, int16 pet_class, int16 pet_lv, t_itemid pet_egg_id, t_itemid pet_equip, int16 intimate, int16 hungry, char rename_flag, char incubate, char *pet_name)
 {
 {
 	memset(pet_pt, 0, sizeof(struct s_pet));
 	memset(pet_pt, 0, sizeof(struct s_pet));
 	safestrncpy(pet_pt->name, pet_name, NAME_LENGTH);
 	safestrncpy(pet_pt->name, pet_name, NAME_LENGTH);

+ 3 - 3
src/char/inter.cpp

@@ -517,7 +517,7 @@ void mapif_parse_accinfo(int32 fd) {
 				inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(214),(int32)Sql_NumRows(sql_handle)); // Your query returned the following %d results, please be more specific...
 				inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(214),(int32)Sql_NumRows(sql_handle)); // Your query returned the following %d results, please be more specific...
 				while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
 				while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
 					int32 class_;
 					int32 class_;
-					short base_level, job_level, online;
+					int16 base_level, job_level, online;
 					char name[NAME_LENGTH];
 					char name[NAME_LENGTH];
 
 
 					Sql_GetData(sql_handle, 0, &data, nullptr); account_id = atoi(data);
 					Sql_GetData(sql_handle, 0, &data, nullptr); account_id = atoi(data);
@@ -574,7 +574,7 @@ void mapif_accinfo_ack( bool success, int32 map_fd, int32 u_fd, int32 u_aid, int
 	} else {
 	} else {
 		while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
 		while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
 			uint32 char_id, class_;
 			uint32 char_id, class_;
-			short char_num, base_level, job_level, online;
+			int16 char_num, base_level, job_level, online;
 			char name[NAME_LENGTH];
 			char name[NAME_LENGTH];
 			char *data;
 			char *data;
 
 
@@ -1055,7 +1055,7 @@ int32 inter_mapif_init(int32 fd)
 //--------------------------------------------------------
 //--------------------------------------------------------
 
 
 // broadcast sending
 // broadcast sending
-int32 mapif_broadcast(unsigned char *mes, int32 len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, int32 sfd)
+int32 mapif_broadcast(unsigned char *mes, int32 len, unsigned long fontColor, int16 fontType, int16 fontSize, int16 fontAlign, int16 fontY, int32 sfd)
 {
 {
 	unsigned char *buf = (unsigned char*)aMalloc((len)*sizeof(unsigned char));
 	unsigned char *buf = (unsigned char*)aMalloc((len)*sizeof(unsigned char));
 
 

+ 1 - 1
src/common/malloc.cpp

@@ -228,7 +228,7 @@ static size_t hash2size( uint16 hash )
 void* _mmalloc(size_t size, const char *file, int32 line, const char *func )
 void* _mmalloc(size_t size, const char *file, int32 line, const char *func )
 {
 {
 	struct block *block;
 	struct block *block;
-	short size_hash = size2hash( size );
+	int16 size_hash = size2hash( size );
 	struct unit_head *head;
 	struct unit_head *head;
 
 
 	if( static_cast<long>( size ) < 0 || size == 0 ){
 	if( static_cast<long>( size ) < 0 || size == 0 ){

+ 32 - 32
src/common/mmo.hpp

@@ -305,15 +305,15 @@ struct achievement {
 #endif
 #endif
 
 
 struct s_item_randomoption {
 struct s_item_randomoption {
-	short id;
-	short value;
+	int16 id;
+	int16 value;
 	char param;
 	char param;
 } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct item {
 struct item {
 	int32 id;
 	int32 id;
 	t_itemid nameid;
 	t_itemid nameid;
-	short amount;
+	int16 amount;
 	uint32 equip; // location(s) where item is equipped (using enum equip_pos for bitmasking)
 	uint32 equip; // location(s) where item is equipped (using enum equip_pos for bitmasking)
 	char identify;
 	char identify;
 	char refine;
 	char refine;
@@ -479,12 +479,12 @@ struct s_pet {
 	uint32 account_id;
 	uint32 account_id;
 	uint32 char_id;
 	uint32 char_id;
 	int32 pet_id;
 	int32 pet_id;
-	short class_;
-	short level;
+	int16 class_;
+	int16 level;
 	t_itemid egg_id;//pet egg id
 	t_itemid egg_id;//pet egg id
 	t_itemid equip;//pet equip name_id
 	t_itemid equip;//pet equip name_id
-	short intimate;//pet friendly
-	short hungry;//pet hungry
+	int16 intimate;//pet friendly
+	int16 hungry;//pet hungry
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 	char rename_flag;
 	char rename_flag;
 	char incubate;
 	char incubate;
@@ -495,18 +495,18 @@ struct s_homunculus {	//[orn]
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 	int32 hom_id;
 	int32 hom_id;
 	uint32 char_id;
 	uint32 char_id;
-	short class_;
-	short prev_class;
+	int16 class_;
+	int16 prev_class;
 	uint32 hp,max_hp,sp,max_sp;
 	uint32 hp,max_hp,sp,max_sp;
 	uint32 intimacy;	//[orn]
 	uint32 intimacy;	//[orn]
-	short hunger;
+	int16 hunger;
 	struct s_skill hskill[MAX_HOMUNSKILL]; //albator
 	struct s_skill hskill[MAX_HOMUNSKILL]; //albator
 	s_skill_cooldown_data scd[MAX_SKILLCOOLDOWN];
 	s_skill_cooldown_data scd[MAX_SKILLCOOLDOWN];
-	short skillpts;
-	short level;
+	int16 skillpts;
+	int16 level;
 	t_exp exp;
 	t_exp exp;
-	short rename_flag;
-	short vaporize; //albator
+	int16 rename_flag;
+	int16 vaporize; //albator
 	int32 str;
 	int32 str;
 	int32 agi;
 	int32 agi;
 	int32 vit;
 	int32 vit;
@@ -528,7 +528,7 @@ struct s_homunculus {	//[orn]
 struct s_mercenary {
 struct s_mercenary {
 	int32 mercenary_id;
 	int32 mercenary_id;
 	uint32 char_id;
 	uint32 char_id;
-	short class_;
+	int16 class_;
 	int32 hp, sp;
 	int32 hp, sp;
 	uint32 kill_count;
 	uint32 kill_count;
 	t_tick life_time;
 	t_tick life_time;
@@ -538,10 +538,10 @@ struct s_mercenary {
 struct s_elemental {
 struct s_elemental {
 	int32 elemental_id;
 	int32 elemental_id;
 	uint32 char_id;
 	uint32 char_id;
-	short class_;
+	int16 class_;
 	int32 mode;
 	int32 mode;
 	int32 hp, sp, max_hp, max_sp, matk, atk, atk2;
 	int32 hp, sp, max_hp, max_sp, matk, atk, atk2;
-	short hit, flee, amotion, def, mdef;
+	int16 hit, flee, amotion, def, mdef;
 	t_tick life_time;
 	t_tick life_time;
 };
 };
 
 
@@ -570,13 +570,13 @@ struct mmo_charstatus {
 	t_exp base_exp,job_exp;
 	t_exp base_exp,job_exp;
 	int32 zeny;
 	int32 zeny;
 
 
-	short class_; ///< Player's JobID
+	int16 class_; ///< Player's JobID
 	uint32 status_point,skill_point,trait_point;
 	uint32 status_point,skill_point,trait_point;
 	int32 hp,max_hp,sp,max_sp,ap,max_ap;
 	int32 hp,max_hp,sp,max_sp,ap,max_ap;
 	uint32 option;
 	uint32 option;
-	short manner; // Defines how many minutes a char will be muted, each negative point is equivalent to a minute.
+	int16 manner; // Defines how many minutes a char will be muted, each negative point is equivalent to a minute.
 	unsigned char karma;
 	unsigned char karma;
-	short hair,hair_color,clothes_color,body;
+	int16 hair,hair_color,clothes_color,body;
 	int32 party_id,guild_id,pet_id,hom_id,mer_id,ele_id,clan_id;
 	int32 party_id,guild_id,pet_id,hom_id,mer_id,ele_id,clan_id;
 	int32 fame;
 	int32 fame;
 
 
@@ -585,10 +585,10 @@ struct mmo_charstatus {
 	int32 spear_faith, spear_calls;
 	int32 spear_faith, spear_calls;
 	int32 sword_faith, sword_calls;
 	int32 sword_faith, sword_calls;
 
 
-	short weapon; // enum weapon_type
-	short shield; // view-id
-	short head_top,head_mid,head_bottom;
-	short robe;
+	int16 weapon; // enum weapon_type
+	int16 shield; // view-id
+	int16 head_top,head_mid,head_bottom;
+	int16 robe;
 	uint8 body_direction;
 	uint8 body_direction;
 
 
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
@@ -612,7 +612,7 @@ struct mmo_charstatus {
 #endif
 #endif
 	bool show_equip, disable_call;
 	bool show_equip, disable_call;
 	bool disable_partyinvite;
 	bool disable_partyinvite;
-	short rename;
+	int16 rename;
 
 
 	time_t delete_date;
 	time_t delete_date;
 	time_t unban_time;
 	time_t unban_time;
@@ -670,9 +670,9 @@ struct mail_message {
 };
 };
 
 
 struct mail_data {
 struct mail_data {
-	short amount;
+	int16 amount;
 	bool full;
 	bool full;
-	short unchecked, unread;
+	int16 unchecked, unread;
 	struct mail_message msg[MAIL_MAX_INBOX];
 	struct mail_message msg[MAIL_MAX_INBOX];
 };
 };
 
 
@@ -686,7 +686,7 @@ struct auction_data {
 	struct item item;
 	struct item item;
 	// This data is required for searching, as itemdb is not read by char server
 	// This data is required for searching, as itemdb is not read by char server
 	char item_name[ITEM_NAME_LENGTH];
 	char item_name[ITEM_NAME_LENGTH];
-	short type;
+	int16 type;
 
 
 	uint16 hours;
 	uint16 hours;
 	int32 price, buynow;
 	int32 price, buynow;
@@ -717,9 +717,9 @@ struct party {
 class map_session_data;
 class map_session_data;
 struct guild_member {
 struct guild_member {
 	uint32 account_id, char_id;
 	uint32 account_id, char_id;
-	short hair,hair_color,gender,class_,lv;
+	int16 hair,hair_color,gender,class_,lv;
 	t_exp exp;
 	t_exp exp;
-	short online,position;
+	int16 online,position;
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 	map_session_data *sd;
 	map_session_data *sd;
 	unsigned char modified;
 	unsigned char modified;
@@ -753,7 +753,7 @@ struct guild_skill {
 struct Channel;
 struct Channel;
 struct mmo_guild {
 struct mmo_guild {
 	int32 guild_id;
 	int32 guild_id;
-	short guild_lv, connect_member, max_member, average_lv;
+	int16 guild_lv, connect_member, max_member, average_lv;
 	t_exp exp;
 	t_exp exp;
 	t_exp next_exp;
 	t_exp next_exp;
 	int32 skill_point;
 	int32 skill_point;
@@ -1149,7 +1149,7 @@ struct clan{
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 	char master[NAME_LENGTH];
 	char master[NAME_LENGTH];
 	char map[MAP_NAME_LENGTH_EXT];
 	char map[MAP_NAME_LENGTH_EXT];
-	short max_member, connect_member;
+	int16 max_member, connect_member;
 	map_session_data *members[MAX_CLAN];
 	map_session_data *members[MAX_CLAN];
 	struct clan_alliance alliance[MAX_CLANALLIANCE];
 	struct clan_alliance alliance[MAX_CLANALLIANCE];
 	uint16 instance_id;
 	uint16 instance_id;

+ 1 - 1
src/common/showmsg.cpp

@@ -377,7 +377,7 @@ int32	VFPRINTF(HANDLE handle, const char *fmt, va_list argptr)
 
 
 					uint8 num = (numbers[numpoint]>>4)*10+(numbers[numpoint]&0x0F);
 					uint8 num = (numbers[numpoint]>>4)*10+(numbers[numpoint]&0x0F);
 					COORD origin = {0,info.dwCursorPosition.Y}; //warning C4204
 					COORD origin = {0,info.dwCursorPosition.Y}; //warning C4204
-					SHORT cnt;
+					int16 cnt;
 					DWORD tmp;
 					DWORD tmp;
 					if(num==1)
 					if(num==1)
 					{
 					{

+ 1 - 1
src/common/strlib.cpp

@@ -890,7 +890,7 @@ bool sv_readdb( const char* directory, const char* filename, char delim, size_t
 	size_t entries = 0;
 	size_t entries = 0;
 	char** fields; // buffer for fields ([0] is reserved)
 	char** fields; // buffer for fields ([0] is reserved)
 	char path[1024], *line;
 	char path[1024], *line;
-	const short colsize=512;
+	const int16 colsize=512;
 
 
 	snprintf(path, sizeof(path), "%s/%s", directory, filename);
 	snprintf(path, sizeof(path), "%s/%s", directory, filename);
 
 

+ 1 - 1
src/config/const.hpp

@@ -46,7 +46,7 @@
  * DefType
  * DefType
  **/
  **/
 #ifdef RENEWAL
 #ifdef RENEWAL
-	typedef short defType;
+	typedef int16 defType;
 	#define DEFTYPE_MIN SHRT_MIN
 	#define DEFTYPE_MIN SHRT_MIN
 	#define DEFTYPE_MAX SHRT_MAX
 	#define DEFTYPE_MAX SHRT_MAX
 #else
 #else

+ 16 - 16
src/map/atcommand.cpp

@@ -582,7 +582,7 @@ ACMD_FUNC(mapmove)
 {
 {
 	char map_name[MAP_NAME_LENGTH_EXT];
 	char map_name[MAP_NAME_LENGTH_EXT];
 	uint16 mapindex;
 	uint16 mapindex;
-	short x = 0, y = 0;
+	int16 x = 0, y = 0;
 	int16 m = -1;
 	int16 m = -1;
 
 
 	nullpo_retr(-1, sd);
 	nullpo_retr(-1, sd);
@@ -714,7 +714,7 @@ ACMD_FUNC(jumpto)
  *------------------------------------------*/
  *------------------------------------------*/
 ACMD_FUNC(jump)
 ACMD_FUNC(jump)
 {
 {
-	short x = 0, y = 0;
+	int16 x = 0, y = 0;
 
 
 	nullpo_retr(-1, sd);
 	nullpo_retr(-1, sd);
 
 
@@ -988,7 +988,7 @@ ACMD_FUNC(load){
  *------------------------------------------*/
  *------------------------------------------*/
 ACMD_FUNC(speed)
 ACMD_FUNC(speed)
 {
 {
-	short speed;
+	int16 speed;
 
 
 	nullpo_retr(-1, sd);
 	nullpo_retr(-1, sd);
 
 
@@ -2280,7 +2280,7 @@ ACMD_FUNC(monster)
 	int32 number = 0;
 	int32 number = 0;
 	int32 count;
 	int32 count;
 	int32 i, range;
 	int32 i, range;
-	short mx, my;
+	int16 mx, my;
 	uint32 size;
 	uint32 size;
 	nullpo_retr(-1, sd);
 	nullpo_retr(-1, sd);
 
 
@@ -3015,7 +3015,7 @@ ACMD_FUNC(stat_all)
 	
 	
 	count = 0;
 	count = 0;
 	for (i = PARAM_STR; i < PARAM_POW; i++) {
 	for (i = PARAM_STR; i < PARAM_POW; i++) {
-		short new_value;
+		int16 new_value;
 
 
 		if (value > 0 && status[i] + value >= max_status[i])
 		if (value > 0 && status[i] + value >= max_status[i])
 			new_value = max_status[i];
 			new_value = max_status[i];
@@ -3089,7 +3089,7 @@ ACMD_FUNC(trait_all) {
 	uint8 count = 0;
 	uint8 count = 0;
 
 
 	for (i = PARAM_POW; i < PARAM_MAX; i++) {
 	for (i = PARAM_POW; i < PARAM_MAX; i++) {
-		short new_value;
+		int16 new_value;
 
 
 		if (value > 0 && status[i] + value >= max_status[i])
 		if (value > 0 && status[i] + value >= max_status[i])
 			new_value = max_status[i];
 			new_value = max_status[i];
@@ -3127,7 +3127,7 @@ ACMD_FUNC(trait_all) {
  *------------------------------------------*/
  *------------------------------------------*/
 ACMD_FUNC(guildlevelup) {
 ACMD_FUNC(guildlevelup) {
 	int32 level = 0;
 	int32 level = 0;
-	short added_level;
+	int16 added_level;
 	nullpo_retr(-1, sd);
 	nullpo_retr(-1, sd);
 
 
 	if (!message || !*message || sscanf(message, "%11d", &level) < 1 || level == 0) {
 	if (!message || !*message || sscanf(message, "%11d", &level) < 1 || level == 0) {
@@ -3146,9 +3146,9 @@ ACMD_FUNC(guildlevelup) {
 	//	return -1;
 	//	return -1;
 	//}
 	//}
 
 
-	added_level = (short)level;
-	if (level > 0 && (level > MAX_GUILDLEVEL || added_level > ((short)MAX_GUILDLEVEL - guild_info->guild.guild_lv))) // fix positive overflow
-		added_level = (short)MAX_GUILDLEVEL - guild_info->guild.guild_lv;
+	added_level = (int16)level;
+	if (level > 0 && (level > MAX_GUILDLEVEL || added_level > ((int16)MAX_GUILDLEVEL - guild_info->guild.guild_lv))) // fix positive overflow
+		added_level = (int16)MAX_GUILDLEVEL - guild_info->guild.guild_lv;
 	else if (level < 0 && (level < -MAX_GUILDLEVEL || added_level < (1 - guild_info->guild.guild_lv))) // fix negative overflow
 	else if (level < 0 && (level < -MAX_GUILDLEVEL || added_level < (1 - guild_info->guild.guild_lv))) // fix negative overflow
 		added_level = 1 - guild_info->guild.guild_lv;
 		added_level = 1 - guild_info->guild.guild_lv;
 
 
@@ -5971,7 +5971,7 @@ ACMD_FUNC(skilloff)
  *------------------------------------------*/
  *------------------------------------------*/
 ACMD_FUNC(npcmove)
 ACMD_FUNC(npcmove)
 {
 {
-	short x = 0, y = 0;
+	int16 x = 0, y = 0;
 	struct npc_data *nd = 0;
 	struct npc_data *nd = 0;
 	char npc_name[NPC_NAME_LENGTH];
 	char npc_name[NPC_NAME_LENGTH];
 
 
@@ -6006,7 +6006,7 @@ ACMD_FUNC(npcmove)
 ACMD_FUNC(addwarp)
 ACMD_FUNC(addwarp)
 {
 {
 	char mapname[MAP_NAME_LENGTH_EXT], warpname[NPC_NAME_LENGTH];
 	char mapname[MAP_NAME_LENGTH_EXT], warpname[NPC_NAME_LENGTH];
-	short x,y;
+	int16 x,y;
 	uint16 m;
 	uint16 m;
 	struct npc_data* nd;
 	struct npc_data* nd;
 
 
@@ -7352,7 +7352,7 @@ ACMD_FUNC(cleanmap)
 
 
 ACMD_FUNC(cleanarea)
 ACMD_FUNC(cleanarea)
 {
 {
-	short x0 = 0, y0 = 0, x1 = 0, y1 = 0;
+	int16 x0 = 0, y0 = 0, x1 = 0, y1 = 0;
 
 
 	if (!message || !*message || sscanf(message, "%6hd %6hd %6hd %6hd", &x0, &y0, &x1, &y1) < 1) {
 	if (!message || !*message || sscanf(message, "%6hd %6hd %6hd %6hd", &x0, &y0, &x1, &y1) < 1) {
 		map_foreachinallarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - (AREA_SIZE * 2), sd->bl.y - (AREA_SIZE * 2), sd->bl.x + (AREA_SIZE * 2), sd->bl.y + (AREA_SIZE * 2), BL_ITEM);
 		map_foreachinallarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - (AREA_SIZE * 2), sd->bl.y - (AREA_SIZE * 2), sd->bl.x + (AREA_SIZE * 2), sd->bl.y + (AREA_SIZE * 2), BL_ITEM);
@@ -8928,7 +8928,7 @@ ACMD_FUNC(fakename)
  *------------------------------------------*/
  *------------------------------------------*/
 ACMD_FUNC(mapflag) {
 ACMD_FUNC(mapflag) {
 	char flag_name[50];
 	char flag_name[50];
-	short flag = 0, i, j;
+	int16 flag = 0, i, j;
 	std::string buf;
 	std::string buf;
 
 
 	nullpo_retr(-1, sd);
 	nullpo_retr(-1, sd);
@@ -10714,7 +10714,7 @@ ACMD_FUNC(cloneequip) {
 	else {
 	else {
 		int8 i;
 		int8 i;
 		for (i = 0; i < EQI_MAX; i++) {
 		for (i = 0; i < EQI_MAX; i++) {
-			short idx;
+			int16 idx;
 			char flag = 0;
 			char flag = 0;
 			struct item tmp_item;
 			struct item tmp_item;
 			if ((idx = pl_sd->equip_index[i]) < 0)
 			if ((idx = pl_sd->equip_index[i]) < 0)
@@ -10786,7 +10786,7 @@ ACMD_FUNC(clonestat) {
 	}
 	}
 	else {
 	else {
 		uint8 i;
 		uint8 i;
-		short max_status[PARAM_MAX] = {};
+		int16 max_status[PARAM_MAX] = {};
 
 
 		pc_resetstate(sd);
 		pc_resetstate(sd);
 		if (pc_has_permission(sd, PC_PERM_BYPASS_STAT_ONCLONE)) {
 		if (pc_has_permission(sd, PC_PERM_BYPASS_STAT_ONCLONE)) {

+ 42 - 42
src/map/battle.cpp

@@ -40,7 +40,7 @@ struct Battle_Config battle_config;
 static struct eri *delay_damage_ers; //For battle delay damage structures.
 static struct eri *delay_damage_ers; //For battle delay damage structures.
 
 
 // Early declaration
 // Early declaration
-int32 battle_get_weapon_element(struct Damage *wd, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, short weapon_position, bool calc_for_damage_only);
+int32 battle_get_weapon_element(struct Damage *wd, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int16 weapon_position, bool calc_for_damage_only);
 int32 battle_get_magic_element(struct block_list* src, struct block_list* target, uint16 skill_id, uint16 skill_lv, int32 mflag);
 int32 battle_get_magic_element(struct block_list* src, struct block_list* target, uint16 skill_id, uint16 skill_lv, int32 mflag);
 int32 battle_get_misc_element(struct block_list* src, struct block_list* target, uint16 skill_id, uint16 skill_lv, int32 mflag);
 int32 battle_get_misc_element(struct block_list* src, struct block_list* target, uint16 skill_id, uint16 skill_lv, int32 mflag);
 static void battle_calc_defense_reduction(struct Damage* wd, struct block_list* src, struct block_list* target, uint16 skill_id, uint16 skill_lv);
 static void battle_calc_defense_reduction(struct Damage* wd, struct block_list* src, struct block_list* target, uint16 skill_id, uint16 skill_lv);
@@ -880,7 +880,7 @@ int32 battle_calc_cardfix(int32 attack_type, struct block_list *src, struct bloc
 		case BF_WEAPON:
 		case BF_WEAPON:
 			// Affected by attacker ATK bonuses
 			// Affected by attacker ATK bonuses
 			if( sd && !nk[NK_IGNOREATKCARD] && (left&2) ) {
 			if( sd && !nk[NK_IGNOREATKCARD] && (left&2) ) {
-				short cardfix_ = 1000;
+				int16 cardfix_ = 1000;
 
 
 				if( sd->state.arrow_atk ) { // Ranged attack
 				if( sd->state.arrow_atk ) { // Ranged attack
 					cardfix = cardfix * (100 + sd->right_weapon.addrace[tstatus->race] + sd->indexed_bonus.arrow_addrace[tstatus->race] +
 					cardfix = cardfix * (100 + sd->right_weapon.addrace[tstatus->race] + sd->indexed_bonus.arrow_addrace[tstatus->race] +
@@ -2358,7 +2358,7 @@ static void battle_add_weapon_damage(map_session_data *sd, int64 *damage, int32
 }
 }
 
 
 #ifdef RENEWAL
 #ifdef RENEWAL
-static int32 battle_calc_sizefix(int64 damage, map_session_data *sd, unsigned char t_size, unsigned char weapon_type, short flag)
+static int32 battle_calc_sizefix(int64 damage, map_session_data *sd, unsigned char t_size, unsigned char weapon_type, int16 flag)
 {
 {
 	if (sd && !sd->special_state.no_sizefix && !flag) // Size fix only for players
 	if (sd && !sd->special_state.no_sizefix && !flag) // Size fix only for players
 		damage = damage * (weapon_type == EQI_HAND_L ? sd->left_weapon.atkmods[t_size] : sd->right_weapon.atkmods[t_size]) / 100;
 		damage = damage * (weapon_type == EQI_HAND_L ? sd->left_weapon.atkmods[t_size] : sd->right_weapon.atkmods[t_size]) / 100;
@@ -2385,7 +2385,7 @@ static int32 battle_calc_base_weapon_attack(struct block_list *src, struct statu
 	status_change *sc = status_get_sc(src);
 	status_change *sc = status_get_sc(src);
 
 
 	if (sd && sd->equip_index[type] >= 0 && sd->inventory_data[sd->equip_index[type]]) {
 	if (sd && sd->equip_index[type] >= 0 && sd->inventory_data[sd->equip_index[type]]) {
-		short base_stat;
+		int16 base_stat;
 
 
 		switch (sd->status.weapon) {
 		switch (sd->status.weapon) {
 			case W_BOW:
 			case W_BOW:
@@ -2449,7 +2449,7 @@ static int32 battle_calc_base_weapon_attack(struct block_list *src, struct statu
 static int64 battle_calc_base_damage(struct block_list *src, struct status_data *status, struct weapon_atk *wa, status_change *sc, uint16 t_size, int32 flag)
 static int64 battle_calc_base_damage(struct block_list *src, struct status_data *status, struct weapon_atk *wa, status_change *sc, uint16 t_size, int32 flag)
 {
 {
 	uint32 atkmin = 0, atkmax = 0;
 	uint32 atkmin = 0, atkmax = 0;
-	short type = 0;
+	int16 type = 0;
 	int64 damage = 0;
 	int64 damage = 0;
 	map_session_data *sd = nullptr;
 	map_session_data *sd = nullptr;
 
 
@@ -2601,14 +2601,14 @@ void battle_consume_ammo(map_session_data*sd, int32 skill, int32 lv)
 
 
 static int32 battle_range_type(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv)
 static int32 battle_range_type(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv)
 {
 {
-	// [Akinari] , [Xynvaroth]: Traps are always short range.
+	// [Akinari] , [Xynvaroth]: Traps are always int16 range.
 	if (skill_get_inf2(skill_id, INF2_ISTRAP))
 	if (skill_get_inf2(skill_id, INF2_ISTRAP))
 		return BF_SHORT;
 		return BF_SHORT;
 
 
 	switch (skill_id) {
 	switch (skill_id) {
 		case AC_SHOWER:
 		case AC_SHOWER:
 		case AM_DEMONSTRATION:
 		case AM_DEMONSTRATION:
-			// When monsters use Arrow Shower or Bomb, it is always short range
+			// When monsters use Arrow Shower or Bomb, it is always int16 range
 			if (src->type == BL_MOB)
 			if (src->type == BL_MOB)
 				return BF_SHORT;
 				return BF_SHORT;
 			break;
 			break;
@@ -2946,7 +2946,7 @@ static bool is_attack_critical(struct Damage* wd, struct block_list *src, struct
 		status_change *sc = status_get_sc(src);
 		status_change *sc = status_get_sc(src);
 		status_change *tsc = status_get_sc(target);
 		status_change *tsc = status_get_sc(target);
 		map_session_data *tsd = BL_CAST(BL_PC, target);
 		map_session_data *tsd = BL_CAST(BL_PC, target);
-		short cri = sstatus->cri;
+		int16 cri = sstatus->cri;
 
 
 		if (sd) {
 		if (sd) {
 			cri += sd->indexed_bonus.critaddrace[tstatus->race] + sd->indexed_bonus.critaddrace[RC_ALL];
 			cri += sd->indexed_bonus.critaddrace[tstatus->race] + sd->indexed_bonus.critaddrace[RC_ALL];
@@ -3060,7 +3060,7 @@ static bool is_attack_critical(struct Damage* wd, struct block_list *src, struct
  *	Initial refactoring by Baalberith
  *	Initial refactoring by Baalberith
  *	Refined and optimized by helvetica
  *	Refined and optimized by helvetica
  */
  */
-static int32 is_attack_piercing(struct Damage* wd, struct block_list *src, struct block_list *target, int32 skill_id, int32 skill_lv, short weapon_position)
+static int32 is_attack_piercing(struct Damage* wd, struct block_list *src, struct block_list *target, int32 skill_id, int32 skill_lv, int16 weapon_position)
 {
 {
 	if (skill_id == MO_INVESTIGATE || skill_id == RL_MASS_SPIRAL)
 	if (skill_id == MO_INVESTIGATE || skill_id == RL_MASS_SPIRAL)
 		return 2;
 		return 2;
@@ -3131,7 +3131,7 @@ static bool is_attack_hitting(struct Damage* wd, struct block_list *src, struct
 	status_change *tsc = status_get_sc(target);
 	status_change *tsc = status_get_sc(target);
 	map_session_data *sd = BL_CAST(BL_PC, src);
 	map_session_data *sd = BL_CAST(BL_PC, src);
 	std::bitset<NK_MAX> nk = battle_skill_get_damage_properties(skill_id, wd->miscflag);
 	std::bitset<NK_MAX> nk = battle_skill_get_damage_properties(skill_id, wd->miscflag);
-	short flee, hitrate;
+	int16 flee, hitrate;
 
 
 	if (!first_call)
 	if (!first_call)
 		return (wd->dmg_lv != ATK_FLEE);
 		return (wd->dmg_lv != ATK_FLEE);
@@ -3310,7 +3310,7 @@ static bool is_attack_hitting(struct Damage* wd, struct block_list *src, struct
  *	Initial refactoring by Baalberith
  *	Initial refactoring by Baalberith
  *	Refined and optimized by helvetica
  *	Refined and optimized by helvetica
  */
  */
-static bool attack_ignores_def(struct Damage* wd, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, short weapon_position)
+static bool attack_ignores_def(struct Damage* wd, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int16 weapon_position)
 {
 {
 	status_data* tstatus = status_get_status_data(*target);
 	status_data* tstatus = status_get_status_data(*target);
 	status_change *sc = status_get_sc(src);
 	status_change *sc = status_get_sc(src);
@@ -3442,7 +3442,7 @@ static int32 battle_calc_equip_attack(struct block_list *src, int32 skill_id)
  *	Initial refactoring by Baalberith
  *	Initial refactoring by Baalberith
  *	Refined and optimized by helvetica
  *	Refined and optimized by helvetica
  */
  */
-int32 battle_get_weapon_element(struct Damage* wd, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, short weapon_position, bool calc_for_damage_only)
+int32 battle_get_weapon_element(struct Damage* wd, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int16 weapon_position, bool calc_for_damage_only)
 {
 {
 	map_session_data *sd = BL_CAST(BL_PC, src);
 	map_session_data *sd = BL_CAST(BL_PC, src);
 	status_change *sc = status_get_sc(src);
 	status_change *sc = status_get_sc(src);
@@ -4095,7 +4095,7 @@ static void battle_calc_skill_base_damage(struct Damage* wd, struct block_list *
 				ATK_RATE(wd->weaponAtk, wd->weaponAtk2, 0);
 				ATK_RATE(wd->weaponAtk, wd->weaponAtk2, 0);
 
 
 				// Add weight
 				// Add weight
-				short index = sd->equip_index[EQI_HAND_R];
+				int16 index = sd->equip_index[EQI_HAND_R];
 				if (index >= 0 &&
 				if (index >= 0 &&
 					sd->inventory_data[index] &&
 					sd->inventory_data[index] &&
 					sd->inventory_data[index]->type == IT_WEAPON)
 					sd->inventory_data[index]->type == IT_WEAPON)
@@ -4125,7 +4125,7 @@ static void battle_calc_skill_base_damage(struct Damage* wd, struct block_list *
 		case LK_SPIRALPIERCE:
 		case LK_SPIRALPIERCE:
 		case ML_SPIRALPIERCE:
 		case ML_SPIRALPIERCE:
 			if (sd) {
 			if (sd) {
-				short index = sd->equip_index[EQI_HAND_R];
+				int16 index = sd->equip_index[EQI_HAND_R];
 
 
 				if (index >= 0 &&
 				if (index >= 0 &&
 					sd->inventory_data[index] &&
 					sd->inventory_data[index] &&
@@ -4155,7 +4155,7 @@ static void battle_calc_skill_base_damage(struct Damage* wd, struct block_list *
 		case PA_SHIELDCHAIN:
 		case PA_SHIELDCHAIN:
 			wd->damage = sstatus->batk;
 			wd->damage = sstatus->batk;
 			if (sd) {
 			if (sd) {
-				short index = sd->equip_index[EQI_HAND_L];
+				int16 index = sd->equip_index[EQI_HAND_L];
 
 
 				//Base damage of shield skills is [batk + 4*refine + weight]
 				//Base damage of shield skills is [batk + 4*refine + weight]
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR) {
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR) {
@@ -4209,7 +4209,7 @@ static void battle_calc_skill_base_damage(struct Damage* wd, struct block_list *
 			break;
 			break;
 		case KO_HAPPOKUNAI:
 		case KO_HAPPOKUNAI:
 			if(sd) {
 			if(sd) {
-				short index = sd->equip_index[EQI_AMMO];
+				int16 index = sd->equip_index[EQI_AMMO];
 				int32 damagevalue = 3 * (
 				int32 damagevalue = 3 * (
 #ifdef RENEWAL
 #ifdef RENEWAL
 					2 *
 					2 *
@@ -4361,7 +4361,7 @@ static void battle_calc_multi_attack(struct Damage* wd, struct block_list *src,s
 	status_data* tstatus = status_get_status_data(*target);
 	status_data* tstatus = status_get_status_data(*target);
 
 
 	if( sd && !skill_id ) {	// if no skill_id passed, check for double attack [helvetica]
 	if( sd && !skill_id ) {	// if no skill_id passed, check for double attack [helvetica]
-		short i;
+		int16 i;
 		if(sc && sc->getSCE(SC_FEARBREEZE) && sd->weapontype1==W_BOW
 		if(sc && sc->getSCE(SC_FEARBREEZE) && sd->weapontype1==W_BOW
 			&& (i = sd->equip_index[EQI_AMMO]) >= 0 && sd->inventory_data[i] && sd->inventory.u.items_inventory[i].amount > 1)
 			&& (i = sd->equip_index[EQI_AMMO]) >= 0 && sd->inventory_data[i] && sd->inventory.u.items_inventory[i].amount > 1)
 		{
 		{
@@ -4579,7 +4579,7 @@ static int32 battle_calc_attack_skill_ratio(struct Damage* wd, struct block_list
 		if (!skill_id || skill_id == KN_AUTOCOUNTER) {
 		if (!skill_id || skill_id == KN_AUTOCOUNTER) {
 			if (sc->getSCE(SC_CRUSHSTRIKE)) {
 			if (sc->getSCE(SC_CRUSHSTRIKE)) {
 				if (sd) { //ATK [{Weapon Level * (Weapon Upgrade Level + 6) * 100} + (Weapon ATK) + (Weapon Weight)]%
 				if (sd) { //ATK [{Weapon Level * (Weapon Upgrade Level + 6) * 100} + (Weapon ATK) + (Weapon Weight)]%
-					short index = sd->equip_index[EQI_HAND_R];
+					int16 index = sd->equip_index[EQI_HAND_R];
 
 
 					if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON)
 					if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON)
 						skillratio += -100 + sd->inventory_data[index]->weight / 10 + sd->inventory_data[index]->atk +
 						skillratio += -100 + sd->inventory_data[index]->weight / 10 + sd->inventory_data[index]->atk +
@@ -5280,7 +5280,7 @@ static int32 battle_calc_attack_skill_ratio(struct Damage* wd, struct block_list
 		case NC_AXEBOOMERANG:
 		case NC_AXEBOOMERANG:
 			skillratio += 150 + 50 * skill_lv;
 			skillratio += 150 + 50 * skill_lv;
 			if (sd) {
 			if (sd) {
-				short index = sd->equip_index[EQI_HAND_R];
+				int16 index = sd->equip_index[EQI_HAND_R];
 
 
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON)
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON)
 					skillratio += sd->inventory_data[index]->weight / 10;// Weight is divided by 10 since 10 weight in coding make 1 whole actual weight. [Rytech]
 					skillratio += sd->inventory_data[index]->weight / 10;// Weight is divided by 10 since 10 weight in coding make 1 whole actual weight. [Rytech]
@@ -5351,7 +5351,7 @@ static int32 battle_calc_attack_skill_ratio(struct Damage* wd, struct block_list
 					skillratio += skill_lv * 15 * pc_checkskill( sd, IG_SHIELD_MASTERY );
 					skillratio += skill_lv * 15 * pc_checkskill( sd, IG_SHIELD_MASTERY );
 				}
 				}
 
 
-				short index = sd->equip_index[EQI_HAND_L];
+				int16 index = sd->equip_index[EQI_HAND_L];
 
 
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR)
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR)
 					skillratio += sd->inventory_data[index]->weight / 10;
 					skillratio += sd->inventory_data[index]->weight / 10;
@@ -5911,7 +5911,7 @@ static int32 battle_calc_attack_skill_ratio(struct Damage* wd, struct block_list
 			skillratio += 10 * sstatus->pow;
 			skillratio += 10 * sstatus->pow;
 			skillratio += skill_lv * 150 * pc_checkskill( sd, IG_SHIELD_MASTERY );
 			skillratio += skill_lv * 150 * pc_checkskill( sd, IG_SHIELD_MASTERY );
 			if (sd) { // Damage affected by the shield's weight and refine. Need official formula. [Rytech]
 			if (sd) { // Damage affected by the shield's weight and refine. Need official formula. [Rytech]
-				short index = sd->equip_index[EQI_HAND_L];
+				int16 index = sd->equip_index[EQI_HAND_L];
 
 
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR) {
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR) {
 					skillratio += (sd->inventory_data[index]->weight * 7 / 6) / 10;
 					skillratio += (sd->inventory_data[index]->weight * 7 / 6) / 10;
@@ -6500,7 +6500,7 @@ static int64 battle_calc_skill_constant_addition(struct Damage* wd, struct block
 			break;
 			break;
 		case PA_SHIELDCHAIN:
 		case PA_SHIELDCHAIN:
 			if (sd) {
 			if (sd) {
-				short index = sd->equip_index[EQI_HAND_L];
+				int16 index = sd->equip_index[EQI_HAND_L];
 				// Bonus damage: [max(100, Random(100, 0.7*weight + pow(skill level + refine)))]
 				// Bonus damage: [max(100, Random(100, 0.7*weight + pow(skill level + refine)))]
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR) {
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR) {
 					// First calculate the random part of the bonus
 					// First calculate the random part of the bonus
@@ -6563,7 +6563,7 @@ static void battle_attack_sc_bonus(struct Damage* wd, struct block_list *src, st
 		if (sc->getSCE(SC_MADNESSCANCEL))
 		if (sc->getSCE(SC_MADNESSCANCEL))
 			ATK_ADD(wd->equipAtk, wd->equipAtk2, 100);
 			ATK_ADD(wd->equipAtk, wd->equipAtk2, 100);
 		if (sc->getSCE(SC_MAGICALBULLET)) {
 		if (sc->getSCE(SC_MAGICALBULLET)) {
-			short tmdef = tstatus->mdef + tstatus->mdef2;
+			int16 tmdef = tstatus->mdef + tstatus->mdef2;
 
 
 			if (sstatus->matk_min > tmdef && sstatus->matk_max > sstatus->matk_min) {
 			if (sstatus->matk_min > tmdef && sstatus->matk_max > sstatus->matk_min) {
 				ATK_ADD(wd->weaponAtk, wd->weaponAtk2, i64max((sstatus->matk_min + rnd() % (sstatus->matk_max - sstatus->matk_min)) - tmdef, 0));
 				ATK_ADD(wd->weaponAtk, wd->weaponAtk2, i64max((sstatus->matk_min + rnd() % (sstatus->matk_max - sstatus->matk_min)) - tmdef, 0));
@@ -6732,9 +6732,9 @@ static void battle_calc_defense_reduction(struct Damage* wd, struct block_list *
 	status_data* tstatus = status_get_status_data(*target);
 	status_data* tstatus = status_get_status_data(*target);
 
 
 	//Defense reduction
 	//Defense reduction
-	short vit_def;
+	int16 vit_def;
 	defType def1 = status_get_def(target); //Don't use tstatus->def1 due to skill timer reductions.
 	defType def1 = status_get_def(target); //Don't use tstatus->def1 due to skill timer reductions.
-	short def2 = tstatus->def2;
+	int16 def2 = tstatus->def2;
 
 
 	if (sd) {
 	if (sd) {
 		int32 i = sd->indexed_bonus.ignore_def_by_race[tstatus->race] + sd->indexed_bonus.ignore_def_by_race[RC_ALL];
 		int32 i = sd->indexed_bonus.ignore_def_by_race[tstatus->race] + sd->indexed_bonus.ignore_def_by_race[RC_ALL];
@@ -6747,13 +6747,13 @@ static void battle_calc_defense_reduction(struct Damage* wd, struct block_list *
 
 
 		//Kagerou/Oboro Earth Charm effect +10% eDEF
 		//Kagerou/Oboro Earth Charm effect +10% eDEF
 		if(sd->spiritcharm_type == CHARM_TYPE_LAND && sd->spiritcharm > 0) {
 		if(sd->spiritcharm_type == CHARM_TYPE_LAND && sd->spiritcharm > 0) {
-			short si = 10 * sd->spiritcharm;
+			int16 si = 10 * sd->spiritcharm;
 			def1 = (def1 * (100 + si)) / 100;
 			def1 = (def1 * (100 + si)) / 100;
 		}
 		}
 	}
 	}
 
 
 	if (sc && sc->getSCE(SC_EXPIATIO)) {
 	if (sc && sc->getSCE(SC_EXPIATIO)) {
-		short i = 5 * sc->getSCE(SC_EXPIATIO)->val1; // 5% per level
+		int16 i = 5 * sc->getSCE(SC_EXPIATIO)->val1; // 5% per level
 
 
 		i = min(i,100); //cap it to 100 for 0 def min
 		i = min(i,100); //cap it to 100 for 0 def min
 		def1 = (def1*(100-i))/100;
 		def1 = (def1*(100-i))/100;
@@ -6762,13 +6762,13 @@ static void battle_calc_defense_reduction(struct Damage* wd, struct block_list *
 
 
 	if (tsc) {
 	if (tsc) {
 		if (tsc->getSCE(SC_FORCEOFVANGUARD)) {
 		if (tsc->getSCE(SC_FORCEOFVANGUARD)) {
-			short i = 2 * tsc->getSCE(SC_FORCEOFVANGUARD)->val1;
+			int16 i = 2 * tsc->getSCE(SC_FORCEOFVANGUARD)->val1;
 
 
 			def1 = (def1 * (100 + i)) / 100;
 			def1 = (def1 * (100 + i)) / 100;
 		}
 		}
 
 
 		if( tsc->getSCE(SC_CAMOUFLAGE) ){
 		if( tsc->getSCE(SC_CAMOUFLAGE) ){
-			short i = 5 * tsc->getSCE(SC_CAMOUFLAGE)->val3; //5% per second
+			int16 i = 5 * tsc->getSCE(SC_CAMOUFLAGE)->val3; //5% per second
 
 
 			i = min(i,100); //cap it to 100 for 0 def min
 			i = min(i,100); //cap it to 100 for 0 def min
 			def1 = (def1*(100-i))/100;
 			def1 = (def1*(100-i))/100;
@@ -7478,7 +7478,7 @@ void battle_do_reflect(int32 attack_type, struct Damage *wd, struct block_list*
 		auto * sce = tsc->getSCE(SC_MAXPAIN);
 		auto * sce = tsc->getSCE(SC_MAXPAIN);
 		if (sce) {
 		if (sce) {
 			sce->val2 = (int32)damage;
 			sce->val2 = (int32)damage;
-			if (!tsc->getSCE(SC_KYOMU) && !(tsc->getSCE(SC_DARKCROW) && (wd->flag&BF_SHORT))) //SC_KYOMU invalidates reflecting ability. SC_DARKCROW also does, but only for short weapon attack.
+			if (!tsc->getSCE(SC_KYOMU) && !(tsc->getSCE(SC_DARKCROW) && (wd->flag&BF_SHORT))) //SC_KYOMU invalidates reflecting ability. SC_DARKCROW also does, but only for int16 weapon attack.
 				skill_castend_damage_id(target, src, NPC_MAXPAIN_ATK, sce->val1, tick, ((wd->flag & 1) ? wd->flag - 1 : wd->flag));
 				skill_castend_damage_id(target, src, NPC_MAXPAIN_ATK, sce->val1, tick, ((wd->flag & 1) ? wd->flag - 1 : wd->flag));
 		}
 		}
 		
 		
@@ -7703,8 +7703,8 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
 		// All skills that use the simple defense formula (damage substracted by DEF+DEF2) ignore Res
 		// All skills that use the simple defense formula (damage substracted by DEF+DEF2) ignore Res
 		// TODO: Res formula probably should be: (2000+x)/(2000+5x), but with the reduction rounded down
 		// TODO: Res formula probably should be: (2000+x)/(2000+5x), but with the reduction rounded down
 		if ((wd.damage + wd.damage2) && tstatus->res > 0 && !nk[NK_SIMPLEDEFENSE]) {
 		if ((wd.damage + wd.damage2) && tstatus->res > 0 && !nk[NK_SIMPLEDEFENSE]) {
-			short res = tstatus->res;
-			short ignore_res = 0;// Value used as a percentage.
+			int16 res = tstatus->res;
+			int16 ignore_res = 0;// Value used as a percentage.
 
 
 			if (sd)
 			if (sd)
 				ignore_res += sd->indexed_bonus.ignore_res_by_race[tstatus->race] + sd->indexed_bonus.ignore_res_by_race[RC_ALL];
 				ignore_res += sd->indexed_bonus.ignore_res_by_race[tstatus->race] + sd->indexed_bonus.ignore_res_by_race[RC_ALL];
@@ -7785,7 +7785,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
 		case LG_SHIELDPRESS:
 		case LG_SHIELDPRESS:
 			if (sd) {
 			if (sd) {
 				int32 damagevalue = 0;
 				int32 damagevalue = 0;
-				short index = sd->equip_index[EQI_HAND_L];
+				int16 index = sd->equip_index[EQI_HAND_L];
 
 
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR)
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR)
 					damagevalue = sstatus->vit * sd->inventory.u.items_inventory[index].refine;
 					damagevalue = sstatus->vit * sd->inventory.u.items_inventory[index].refine;
@@ -7919,7 +7919,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
 struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int32 mflag)
 struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int32 mflag)
 {
 {
 	int32 i, skill_damage = 0;
 	int32 i, skill_damage = 0;
-	short s_ele = 0;
+	int16 s_ele = 0;
 
 
 	TBL_PC *sd;
 	TBL_PC *sd;
 	TBL_PC *tsd;
 	TBL_PC *tsd;
@@ -9121,8 +9121,8 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 		// is calculated before MDEF and other reductions.
 		// is calculated before MDEF and other reductions.
 		// TODO: MRes formula probably should be: (2000+x)/(2000+5x), but with the reduction rounded down
 		// TODO: MRes formula probably should be: (2000+x)/(2000+5x), but with the reduction rounded down
 		if (ad.damage && tstatus->mres > 0) {
 		if (ad.damage && tstatus->mres > 0) {
-			short mres = tstatus->mres;
-			short ignore_mres = 0;// Value used as percentage.
+			int16 mres = tstatus->mres;
+			int16 ignore_mres = 0;// Value used as percentage.
 
 
 			if (sd)
 			if (sd)
 				ignore_mres += sd->indexed_bonus.ignore_mres_by_race[tstatus->race] + sd->indexed_bonus.ignore_mres_by_race[RC_ALL];
 				ignore_mres += sd->indexed_bonus.ignore_mres_by_race[tstatus->race] + sd->indexed_bonus.ignore_mres_by_race[RC_ALL];
@@ -9363,7 +9363,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int32 mflag)
 struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int32 mflag)
 {
 {
 	int32 skill_damage = 0;
 	int32 skill_damage = 0;
-	short i, s_ele;
+	int16 i, s_ele;
 
 
 	map_session_data *sd, *tsd;
 	map_session_data *sd, *tsd;
 	struct Damage md; //DO NOT CONFUSE with md of mob_data!
 	struct Damage md; //DO NOT CONFUSE with md of mob_data!
@@ -9576,7 +9576,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
 			// final damage = base damage + ((mirror image count + 1) / 5 * base damage) - (edef + sdef)
 			// final damage = base damage + ((mirror image count + 1) / 5 * base damage) - (edef + sdef)
 			// modified def formula
 			// modified def formula
 			{
 			{
-				short totaldef;
+				int16 totaldef;
 				struct Damage atk = battle_calc_weapon_attack(src, target, skill_id, skill_lv, 0);
 				struct Damage atk = battle_calc_weapon_attack(src, target, skill_id, skill_lv, 0);
 				status_change *sc = status_get_sc(src);
 				status_change *sc = status_get_sc(src);
 
 
@@ -9587,7 +9587,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
 					md.damage += (md.damage * (((i + 1) * 10) / 5)) / 10;
 					md.damage += (md.damage * (((i + 1) * 10) / 5)) / 10;
 				}
 				}
 				// modified def reduction, final damage = base damage - (edef + sdef)
 				// modified def reduction, final damage = base damage - (edef + sdef)
-				totaldef = tstatus->def2 + (short)status_get_def(target);
+				totaldef = tstatus->def2 + (int16)status_get_def(target);
 				md.damage -= totaldef;
 				md.damage -= totaldef;
 				md.flag |= BF_WEAPON;
 				md.flag |= BF_WEAPON;
 			}
 			}
@@ -9666,7 +9666,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
 		if(sc && sc->opt1 && sc->opt1 != OPT1_STONEWAIT && sc->opt1 != OPT1_BURNING)
 		if(sc && sc->opt1 && sc->opt1 != OPT1_STONEWAIT && sc->opt1 != OPT1_BURNING)
 			i = 1;
 			i = 1;
 		else {
 		else {
-			short
+			int16
 				flee = tstatus->flee,
 				flee = tstatus->flee,
 #ifdef RENEWAL
 #ifdef RENEWAL
 				hitrate = 0; //Default hitrate
 				hitrate = 0; //Default hitrate
@@ -10228,7 +10228,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
 		sd->state.arrow_atk = (sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE));
 		sd->state.arrow_atk = (sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE));
 		if (sd->state.arrow_atk)
 		if (sd->state.arrow_atk)
 		{
 		{
-			short index = sd->equip_index[EQI_AMMO];
+			int16 index = sd->equip_index[EQI_AMMO];
 			if (index < 0) {
 			if (index < 0) {
 				if (sd->weapontype1 > W_KATAR && sd->weapontype1 < W_HUUMA)
 				if (sd->weapontype1 > W_KATAR && sd->weapontype1 < W_HUUMA)
 					clif_skill_fail( *sd, 0, USESKILL_FAIL_NEED_MORE_BULLET );
 					clif_skill_fail( *sd, 0, USESKILL_FAIL_NEED_MORE_BULLET );
@@ -10424,7 +10424,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
 		}
 		}
 
 
 		if( sd && battle_config.arrow_decrement && sc->getSCE(SC_FEARBREEZE) && sc->getSCE(SC_FEARBREEZE)->val4 > 0) {
 		if( sd && battle_config.arrow_decrement && sc->getSCE(SC_FEARBREEZE) && sc->getSCE(SC_FEARBREEZE)->val4 > 0) {
-			short idx = sd->equip_index[EQI_AMMO];
+			int16 idx = sd->equip_index[EQI_AMMO];
 			if (idx >= 0 && sd->inventory.u.items_inventory[idx].amount >= sc->getSCE(SC_FEARBREEZE)->val4) {
 			if (idx >= 0 && sd->inventory.u.items_inventory[idx].amount >= sc->getSCE(SC_FEARBREEZE)->val4) {
 				pc_delitem(sd,idx,sc->getSCE(SC_FEARBREEZE)->val4,0,1,LOG_TYPE_CONSUME);
 				pc_delitem(sd,idx,sc->getSCE(SC_FEARBREEZE)->val4,0,1,LOG_TYPE_CONSUME);
 				sc->getSCE(SC_FEARBREEZE)->val4 = 0;
 				sc->getSCE(SC_FEARBREEZE)->val4 = 0;

+ 1 - 1
src/map/battle.hpp

@@ -95,7 +95,7 @@ struct Damage {
 	int64 damage, /// Right hand damage
 	int64 damage, /// Right hand damage
 		damage2; /// Left hand damage
 		damage2; /// Left hand damage
 	enum e_damage_type type; /// Check clif_damage for type
 	enum e_damage_type type; /// Check clif_damage for type
-	short div_; /// Number of hit
+	int16 div_; /// Number of hit
 	int32 amotion,
 	int32 amotion,
 		dmotion;
 		dmotion;
 	int32 blewcount; /// Number of knockback
 	int32 blewcount; /// Number of knockback

+ 1 - 1
src/map/battleground.cpp

@@ -482,7 +482,7 @@ bool bg_team_delete(int32 bg_id)
  * @param y: Y coordinate
  * @param y: Y coordinate
  * @return True on success or false otherwise
  * @return True on success or false otherwise
  */
  */
-bool bg_team_warp(int32 bg_id, uint16 mapindex, short x, short y)
+bool bg_team_warp(int32 bg_id, uint16 mapindex, int16 x, int16 y)
 {
 {
 	std::shared_ptr<s_battleground_data> bgteam = util::umap_find(bg_team_db, bg_id);
 	std::shared_ptr<s_battleground_data> bgteam = util::umap_find(bg_team_db, bg_id);
 
 

+ 1 - 1
src/map/battleground.hpp

@@ -140,7 +140,7 @@ int32 bg_create(uint16 mapindex, s_battleground_team* team);
 bool bg_team_join(int32 bg_id, map_session_data *sd, bool is_queue);
 bool bg_team_join(int32 bg_id, map_session_data *sd, bool is_queue);
 bool bg_team_delete(int32 bg_id);
 bool bg_team_delete(int32 bg_id);
 int32 bg_team_leave(map_session_data *sd, bool quit, bool deserter);
 int32 bg_team_leave(map_session_data *sd, bool quit, bool deserter);
-bool bg_team_warp(int32 bg_id, uint16 mapindex, short x, short y);
+bool bg_team_warp(int32 bg_id, uint16 mapindex, int16 x, int16 y);
 bool bg_player_is_in_bg_map(map_session_data *sd);
 bool bg_player_is_in_bg_map(map_session_data *sd);
 bool bg_queue_check_joinable(std::shared_ptr<s_battleground_type> bg, map_session_data *sd, const char *name);
 bool bg_queue_check_joinable(std::shared_ptr<s_battleground_type> bg, map_session_data *sd, const char *name);
 void bg_queue_join_solo(const char *name, map_session_data *sd);
 void bg_queue_join_solo(const char *name, map_session_data *sd);

+ 1 - 1
src/map/chrif.cpp

@@ -452,7 +452,7 @@ int32 chrif_changemapserver(map_session_data* sd, uint32 ip, uint16 port) {
 
 
 /// map-server change (mapserv) request acknowledgement (positive or negative)
 /// map-server change (mapserv) request acknowledgement (positive or negative)
 /// R 2b06 <account_id>.L <login_id1>.L <login_id2>.L <char_id>.L <map>.16B <x>.W <y>.W <ip>.L <port>.W
 /// R 2b06 <account_id>.L <login_id1>.L <login_id2>.L <char_id>.L <map>.16B <x>.W <y>.W <ip>.L <port>.W
-int32 chrif_changemapserverack(uint32 account_id, int32 login_id1, int32 login_id2, uint32 char_id, const char* map, short x, short y, uint32 ip, uint16 port) {
+int32 chrif_changemapserverack(uint32 account_id, int32 login_id1, int32 login_id2, uint32 char_id, const char* map, int16 x, int16 y, uint32 ip, uint16 port) {
 	struct auth_node *node;
 	struct auth_node *node;
 
 
 	if ( !( node = chrif_auth_check(account_id, char_id, ST_MAPCHANGE) ) )
 	if ( !( node = chrif_auth_check(account_id, char_id, ST_MAPCHANGE) ) )

+ 50 - 50
src/map/clif.cpp

@@ -170,7 +170,7 @@ static inline uint16 client_nameid( t_itemid server_nameid ){
 }
 }
 #endif
 #endif
 
 
-static inline void WBUFPOS(uint8* p, uint16 pos, short x, short y, unsigned char dir) {
+static inline void WBUFPOS(uint8* p, uint16 pos, int16 x, int16 y, unsigned char dir) {
 	p += pos;
 	p += pos;
 	p[0] = (uint8)(x>>2);
 	p[0] = (uint8)(x>>2);
 	p[1] = (uint8)((x<<6) | ((y>>4)&0x3f));
 	p[1] = (uint8)((x<<6) | ((y>>4)&0x3f));
@@ -179,7 +179,7 @@ static inline void WBUFPOS(uint8* p, uint16 pos, short x, short y, unsigned char
 
 
 
 
 // client-side: x0+=sx0*0.0625-0.5 and y0+=sy0*0.0625-0.5
 // client-side: x0+=sx0*0.0625-0.5 and y0+=sy0*0.0625-0.5
-static inline void WBUFPOS2(uint8* p, uint16 pos, short x0, short y0, short x1, short y1, uint8 sx0, uint8 sy0) {
+static inline void WBUFPOS2(uint8* p, uint16 pos, int16 x0, int16 y0, int16 x1, int16 y1, uint8 sx0, uint8 sy0) {
 	p += pos;
 	p += pos;
 	p[0] = (uint8)(x0>>2);
 	p[0] = (uint8)(x0>>2);
 	p[1] = (uint8)((x0<<6) | ((y0>>4)&0x3f));
 	p[1] = (uint8)((x0<<6) | ((y0>>4)&0x3f));
@@ -190,11 +190,11 @@ static inline void WBUFPOS2(uint8* p, uint16 pos, short x0, short y0, short x1,
 }
 }
 
 
 
 
-static inline void WFIFOPOS(int32 fd, uint16 pos, short x, short y, unsigned char dir) {
+static inline void WFIFOPOS(int32 fd, uint16 pos, int16 x, int16 y, unsigned char dir) {
 	WBUFPOS(WFIFOP(fd,pos), 0, x, y, dir);
 	WBUFPOS(WFIFOP(fd,pos), 0, x, y, dir);
 }
 }
 
 
-static inline void RBUFPOS(const uint8* p, uint16 pos, short* x, short* y, unsigned char* dir) {
+static inline void RBUFPOS(const uint8* p, uint16 pos, int16* x, int16* y, unsigned char* dir) {
 	p += pos;
 	p += pos;
 
 
 	if( x ) {
 	if( x ) {
@@ -211,7 +211,7 @@ static inline void RBUFPOS(const uint8* p, uint16 pos, short* x, short* y, unsig
 }
 }
 
 
 
 
-static inline void RBUFPOS2(const uint8* p, uint16 pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) {
+static inline void RBUFPOS2(const uint8* p, uint16 pos, int16* x0, int16* y0, int16* x1, int16* y1, unsigned char* sx0, unsigned char* sy0) {
 	p += pos;
 	p += pos;
 
 
 	if( x0 ) {
 	if( x0 ) {
@@ -240,12 +240,12 @@ static inline void RBUFPOS2(const uint8* p, uint16 pos, short* x0, short* y0, sh
 }
 }
 
 
 
 
-static inline void RFIFOPOS(int32 fd, uint16 pos, short* x, short* y, unsigned char* dir) {
+static inline void RFIFOPOS(int32 fd, uint16 pos, int16* x, int16* y, unsigned char* dir) {
 	RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir);
 	RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir);
 }
 }
 
 
 
 
-static inline void RFIFOPOS2(int32 fd, uint16 pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) {
+static inline void RFIFOPOS2(int32 fd, uint16 pos, int16* x0, int16* y0, int16* x1, int16* y1, unsigned char* sx0, unsigned char* sy0) {
 	RBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0);
 	RBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0);
 }
 }
 
 
@@ -1975,7 +1975,7 @@ void clif_homskillinfoblock( homun_data& hd ){
 
 
 		if (id != 0) {
 		if (id != 0) {
 			int32 combo = (hd.homunculus.hskill[i].flag)&SKILL_FLAG_TMP_COMBO;
 			int32 combo = (hd.homunculus.hskill[i].flag)&SKILL_FLAG_TMP_COMBO;
-			short idx = hom_skill_get_index(id);
+			int16 idx = hom_skill_get_index(id);
 			if (idx == -1)
 			if (idx == -1)
 				continue;
 				continue;
 			packet->skills[count].id = id;
 			packet->skills[count].id = id;
@@ -1997,7 +1997,7 @@ void clif_homskillinfoblock( homun_data& hd ){
 
 
 void clif_homskillup( homun_data& hd, uint16 skill_id ){
 void clif_homskillup( homun_data& hd, uint16 skill_id ){
 #if PACKETVER >= 20050531
 #if PACKETVER >= 20050531
-	short idx = hom_skill_get_index( skill_id );
+	int16 idx = hom_skill_get_index( skill_id );
 
 
 	if( idx == -1 ){
 	if( idx == -1 ){
 		return;
 		return;
@@ -2146,7 +2146,7 @@ void clif_quitsave(int32 fd,map_session_data *sd) {
 
 
 /// Notifies the client of a position change to coordinates on given map (ZC_NPCACK_MAPMOVE).
 /// Notifies the client of a position change to coordinates on given map (ZC_NPCACK_MAPMOVE).
 /// 0091 <map name>.16B <x>.W <y>.W
 /// 0091 <map name>.16B <x>.W <y>.W
-void clif_changemap( map_session_data& sd, short m, uint16 x, uint16 y ){
+void clif_changemap( map_session_data& sd, int16 m, uint16 x, uint16 y ){
 	PACKET_ZC_NPCACK_MAPMOVE packet{};
 	PACKET_ZC_NPCACK_MAPMOVE packet{};
 
 
 	packet.packetType = HEADER_ZC_NPCACK_MAPMOVE;
 	packet.packetType = HEADER_ZC_NPCACK_MAPMOVE;
@@ -2908,7 +2908,7 @@ void clif_dropitem( map_session_data& sd, int32 index, int32 amount ){
 ///     5 = Moved to cart
 ///     5 = Moved to cart
 ///     6 = Item sold
 ///     6 = Item sold
 ///     7 = Consumed by Four Spirit Analysis (SO_EL_ANALYSIS) skill
 ///     7 = Consumed by Four Spirit Analysis (SO_EL_ANALYSIS) skill
-void clif_delitem( map_session_data& sd, int32 index, int32 amount, short reason ){
+void clif_delitem( map_session_data& sd, int32 index, int32 amount, int16 reason ){
 #if PACKETVER >= 20091117
 #if PACKETVER >= 20091117
 	PACKET_ZC_DELETE_ITEM_FROM_BODY packet{};
 	PACKET_ZC_DELETE_ITEM_FROM_BODY packet{};
 
 
@@ -2923,7 +2923,7 @@ void clif_delitem( map_session_data& sd, int32 index, int32 amount, short reason
 #endif
 #endif
 }
 }
 
 
-static void clif_item_equip( short idx, struct EQUIPITEM_INFO *p, struct item *it, struct item_data *id, int32 eqp_pos ){
+static void clif_item_equip( int16 idx, struct EQUIPITEM_INFO *p, struct item *it, struct item_data *id, int32 eqp_pos ){
 	nullpo_retv( p );
 	nullpo_retv( p );
 	nullpo_retv( it );
 	nullpo_retv( it );
 	nullpo_retv( id );
 	nullpo_retv( id );
@@ -2978,7 +2978,7 @@ static void clif_item_equip( short idx, struct EQUIPITEM_INFO *p, struct item *i
 #endif
 #endif
 }
 }
 
 
-static void clif_item_normal( short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id ){
+static void clif_item_normal( int16 idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id ){
 	nullpo_retv(p);
 	nullpo_retv(p);
 	nullpo_retv(i);
 	nullpo_retv(i);
 	nullpo_retv(id);
 	nullpo_retv(id);
@@ -5475,7 +5475,7 @@ void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *unit,
 }
 }
 
 
 /// 09ca <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.L <range>.B <visible>.B <skill level>.B (ZC_SKILL_ENTRY5)
 /// 09ca <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.L <range>.B <visible>.B <skill level>.B (ZC_SKILL_ENTRY5)
-void clif_skill_unit_test(struct block_list *bl, short x, short y, int32 unit_id, short range, short skill_lv) {
+void clif_skill_unit_test(struct block_list *bl, int16 x, int16 y, int32 unit_id, int16 range, int16 skill_lv) {
 	unsigned char buf[128];
 	unsigned char buf[128];
 
 
 	nullpo_retv(bl);
 	nullpo_retv(bl);
@@ -6730,7 +6730,7 @@ void clif_GlobalMessage( block_list& bl, const char* message, enum send_target t
 
 
 /// Send broadcast message with font formatting.
 /// Send broadcast message with font formatting.
 /// 01c3 <packet len>.W <fontColor>.L <fontType>.W <fontSize>.W <fontAlign>.W <fontY>.W <message>.?B (ZC_BROADCAST2)
 /// 01c3 <packet len>.W <fontColor>.L <fontType>.W <fontSize>.W <fontAlign>.W <fontY>.W <message>.?B (ZC_BROADCAST2)
-void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target)
+void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned long fontColor, int16 fontType, int16 fontSize, int16 fontAlign, int16 fontY, enum send_target target)
 {
 {
 	nullpo_retv(mes);
 	nullpo_retv(mes);
 	if (len < 2)
 	if (len < 2)
@@ -6826,10 +6826,10 @@ void clif_resurrection( block_list& bl ){
 void clif_map_property(struct block_list *bl, enum map_property property, enum send_target t)
 void clif_map_property(struct block_list *bl, enum map_property property, enum send_target t)
 {
 {
 #if PACKETVER >= 20121010
 #if PACKETVER >= 20121010
-	short cmd = 0x99b;
+	int16 cmd = 0x99b;
 	unsigned char buf[8];
 	unsigned char buf[8];
 #else
 #else
-	short cmd = 0x199;
+	int16 cmd = 0x199;
 	unsigned char buf[4];
 	unsigned char buf[4];
 #endif
 #endif
 	
 	
@@ -9875,7 +9875,7 @@ void clif_refresh(map_session_data *sd)
 	clif_loadConfirm( sd );
 	clif_loadConfirm( sd );
 
 
 	if( disguised(&sd->bl) ) {/* refresh-da */
 	if( disguised(&sd->bl) ) {/* refresh-da */
-		short disguise = sd->disguise;
+		int16 disguise = sd->disguise;
 		pc_disguise(sd, 0);
 		pc_disguise(sd, 0);
 		pc_disguise(sd, disguise);
 		pc_disguise(sd, disguise);
 	}
 	}
@@ -11315,7 +11315,7 @@ void clif_progressbar_npc( struct npc_data *nd, map_session_data* sd ){
 /// There are various variants of this packet, some of them have padding between fields.
 /// There are various variants of this packet, some of them have padding between fields.
 void clif_parse_WalkToXY(int32 fd, map_session_data *sd)
 void clif_parse_WalkToXY(int32 fd, map_session_data *sd)
 {
 {
-	short x, y;
+	int16 x, y;
 
 
 	if (pc_isdead(sd)) {
 	if (pc_isdead(sd)) {
 		clif_clearunit_area( sd->bl, CLR_DEAD );
 		clif_clearunit_area( sd->bl, CLR_DEAD );
@@ -11369,7 +11369,7 @@ void clif_parse_WalkToXY(int32 fd, map_session_data *sd)
 ///     0 = disconnect (quit)
 ///     0 = disconnect (quit)
 ///     1 = cannot disconnect (wait 10 seconds)
 ///     1 = cannot disconnect (wait 10 seconds)
 ///     ? = ignored
 ///     ? = ignored
-void clif_disconnect_ack(map_session_data* sd, short result)
+void clif_disconnect_ack(map_session_data* sd, int16 result)
 {
 {
 	int32 fd = sd->fd;
 	int32 fd = sd->fd;
 
 
@@ -12720,7 +12720,7 @@ static void clif_parse_UseSkillToId_homun(struct homun_data *hd, map_session_dat
 		unit_skilluse_id(&hd->bl, target_id, skill_id, skill_lv);
 		unit_skilluse_id(&hd->bl, target_id, skill_id, skill_lv);
 }
 }
 
 
-static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, map_session_data *sd, t_tick tick, uint16 skill_id, uint16 skill_lv, short x, short y, int32 skillmoreinfo)
+static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, map_session_data *sd, t_tick tick, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int32 skillmoreinfo)
 {
 {
 	int32 lv;
 	int32 lv;
 	if( !hd )
 	if( !hd )
@@ -12775,7 +12775,7 @@ static void clif_parse_UseSkillToId_mercenary(s_mercenary_data *md, map_session_
 		unit_skilluse_id(&md->bl, target_id, skill_id, skill_lv);
 		unit_skilluse_id(&md->bl, target_id, skill_id, skill_lv);
 }
 }
 
 
-static void clif_parse_UseSkillToPos_mercenary(s_mercenary_data *md, map_session_data *sd, t_tick tick, uint16 skill_id, uint16 skill_lv, short x, short y, int32 skillmoreinfo)
+static void clif_parse_UseSkillToPos_mercenary(s_mercenary_data *md, map_session_data *sd, t_tick tick, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int32 skillmoreinfo)
 {
 {
 	int32 lv;
 	int32 lv;
 	if( !md )
 	if( !md )
@@ -12937,7 +12937,7 @@ void clif_parse_UseSkillToId( int32 fd, map_session_data *sd ){
 /*==========================================
 /*==========================================
  * Client tells server he'd like to use AoE skill id 'skill_id' of level 'skill_lv' on 'x','y' location
  * Client tells server he'd like to use AoE skill id 'skill_id' of level 'skill_lv' on 'x','y' location
  *------------------------------------------*/
  *------------------------------------------*/
-static void clif_parse_UseSkillToPosSub( int32 fd, map_session_data& sd, uint16 skill_lv, uint16 skill_id, short x, short y, int32 skillmoreinfo ){
+static void clif_parse_UseSkillToPosSub( int32 fd, map_session_data& sd, uint16 skill_lv, uint16 skill_id, int16 x, int16 y, int32 skillmoreinfo ){
 	t_tick tick = gettick();
 	t_tick tick = gettick();
 
 
 	if( !(skill_get_inf(skill_id)&INF_GROUND_SKILL) )
 	if( !(skill_get_inf(skill_id)&INF_GROUND_SKILL) )
@@ -13180,7 +13180,7 @@ void clif_parse_Cooking(int32 fd,map_session_data *sd) {
 	const PACKET_CZ_REQ_MAKINGITEM* p = reinterpret_cast<PACKET_CZ_REQ_MAKINGITEM*>( RFIFOP( fd, 0 ) );
 	const PACKET_CZ_REQ_MAKINGITEM* p = reinterpret_cast<PACKET_CZ_REQ_MAKINGITEM*>( RFIFOP( fd, 0 ) );
 
 
 	int32 amount = sd->menuskill_val2 ? sd->menuskill_val2 : 1;
 	int32 amount = sd->menuskill_val2 ? sd->menuskill_val2 : 1;
-	short food_idx = -1;
+	int16 food_idx = -1;
 
 
 	if( p->type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY )
 	if( p->type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY )
 		return;
 		return;
@@ -13354,7 +13354,7 @@ void clif_parse_NpcCloseClicked(int32 fd,map_session_data *sd)
 /// index:
 /// index:
 ///     -1 = cancel
 ///     -1 = cancel
 void clif_parse_ItemIdentify(int32 fd,map_session_data *sd) {
 void clif_parse_ItemIdentify(int32 fd,map_session_data *sd) {
-	short idx = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]) - 2;
+	int16 idx = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]) - 2;
 
 
 	if (sd->menuskill_id != MC_IDENTIFY)
 	if (sd->menuskill_id != MC_IDENTIFY)
 		return;
 		return;
@@ -13625,7 +13625,7 @@ void clif_parse_CloseKafra(int32 fd, map_session_data *sd)
 ///     8 = too many wrong passwords
 ///     8 = too many wrong passwords
 ///     ? = ignored
 ///     ? = ignored
 /// NOTE: This packet is only available on certain non-kRO clients.
 /// NOTE: This packet is only available on certain non-kRO clients.
-void clif_storagepassword(map_session_data* sd, short info)
+void clif_storagepassword(map_session_data* sd, int16 info)
 {
 {
 	int32 fd = sd->fd;
 	int32 fd = sd->fd;
 
 
@@ -13663,7 +13663,7 @@ void clif_parse_StoragePassword(int32 fd, map_session_data *sd){ //@TODO
 ///     8 = too many wrong passwords
 ///     8 = too many wrong passwords
 ///     ? = ignored
 ///     ? = ignored
 /// NOTE: This packet is only available on certain non-kRO clients.
 /// NOTE: This packet is only available on certain non-kRO clients.
-void clif_storagepassword_result(map_session_data* sd, short result, short error_count)
+void clif_storagepassword_result(map_session_data* sd, int16 result, int16 error_count)
 {
 {
 	int32 fd = sd->fd;
 	int32 fd = sd->fd;
 
 
@@ -13873,10 +13873,10 @@ void clif_parse_PartyChangeLeader(int32 fd, map_session_data* sd){
 void clif_parse_PartyBookingRegisterReq(int32 fd, map_session_data* sd){
 void clif_parse_PartyBookingRegisterReq(int32 fd, map_session_data* sd){
 	// TODO: shuffle packet
 	// TODO: shuffle packet
 	struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
 	struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
-	short level = RFIFOW(fd,info->pos[0]);
-	short mapid = RFIFOW(fd,info->pos[1]);
+	int16 level = RFIFOW(fd,info->pos[0]);
+	int16 mapid = RFIFOW(fd,info->pos[1]);
 	int32 idxpbj = info->pos[2];
 	int32 idxpbj = info->pos[2];
-	short job[MAX_PARTY_BOOKING_JOBS];
+	int16 job[MAX_PARTY_BOOKING_JOBS];
 	int32 i;
 	int32 i;
 
 
 	for(i=0; i<MAX_PARTY_BOOKING_JOBS; i++)
 	for(i=0; i<MAX_PARTY_BOOKING_JOBS; i++)
@@ -13907,11 +13907,11 @@ void clif_PartyBookingRegisterAck(map_session_data *sd, int32 flag)
 /// 0804 <level>.W <map id>.W <job>.W <last index>.L <result count>.W
 /// 0804 <level>.W <map id>.W <job>.W <last index>.L <result count>.W
 void clif_parse_PartyBookingSearchReq(int32 fd, map_session_data* sd){
 void clif_parse_PartyBookingSearchReq(int32 fd, map_session_data* sd){
 	struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
 	struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
-	short level = RFIFOW(fd,info->pos[0]);
-	short mapid = RFIFOW(fd,info->pos[1]);
-	short job = RFIFOW(fd,info->pos[2]);
+	int16 level = RFIFOW(fd,info->pos[0]);
+	int16 mapid = RFIFOW(fd,info->pos[1]);
+	int16 job = RFIFOW(fd,info->pos[2]);
 	unsigned long lastindex = RFIFOL(fd,info->pos[3]);
 	unsigned long lastindex = RFIFOL(fd,info->pos[3]);
-	short resultcount = RFIFOW(fd,info->pos[4]);
+	int16 resultcount = RFIFOW(fd,info->pos[4]);
 
 
 	party_booking_search(sd, level, mapid, job, lastindex, resultcount);
 	party_booking_search(sd, level, mapid, job, lastindex, resultcount);
 }
 }
@@ -13977,7 +13977,7 @@ void clif_PartyBookingDeleteAck(map_session_data* sd, int32 flag)
 /// 0808 { <job>.W }*6
 /// 0808 { <job>.W }*6
 void clif_parse_PartyBookingUpdateReq(int32 fd, map_session_data* sd)
 void clif_parse_PartyBookingUpdateReq(int32 fd, map_session_data* sd)
 {
 {
-	short job[MAX_PARTY_BOOKING_JOBS];
+	int16 job[MAX_PARTY_BOOKING_JOBS];
 	int32 i;
 	int32 i;
 	int32 idxpbu = packet_db[RFIFOW(fd,0)].pos[0];
 	int32 idxpbu = packet_db[RFIFOW(fd,0)].pos[0];
 
 
@@ -14098,7 +14098,7 @@ void clif_parse_OpenVending(int32 fd, map_session_data* sd){
 
 
 	int32 cmd = RFIFOW(fd,0);
 	int32 cmd = RFIFOW(fd,0);
 	struct s_packet_db* info = &packet_db[cmd];
 	struct s_packet_db* info = &packet_db[cmd];
-	short len = (short)RFIFOW(fd,info->pos[0]);
+	int16 len = (int16)RFIFOW(fd,info->pos[0]);
 	const char* message = RFIFOCP(fd,info->pos[1]);
 	const char* message = RFIFOCP(fd,info->pos[1]);
 	const uint8* data = (uint8*)RFIFOP(fd,info->pos[3]);
 	const uint8* data = (uint8*)RFIFOP(fd,info->pos[3]);
 
 
@@ -15582,7 +15582,7 @@ void clif_parse_HomMoveTo(int32 fd, map_session_data *sd){
 #if PACKETVER >= 20050425
 #if PACKETVER >= 20050425
 	const PACKET_CZ_REQUEST_MOVENPC* p = reinterpret_cast<const PACKET_CZ_REQUEST_MOVENPC*>( RFIFOP( fd, 0 ) );
 	const PACKET_CZ_REQUEST_MOVENPC* p = reinterpret_cast<const PACKET_CZ_REQUEST_MOVENPC*>( RFIFOP( fd, 0 ) );
 	struct block_list *bl = nullptr;
 	struct block_list *bl = nullptr;
-	short x, y;
+	int16 x, y;
 
 
 	RBUFPOS( p->PosDir, 0, &x, &y, nullptr );
 	RBUFPOS( p->PosDir, 0, &x, &y, nullptr );
 
 
@@ -15876,7 +15876,7 @@ void clif_mail_delete( map_session_data* sd, struct mail_message *msg, bool succ
 /// result:
 /// result:
 ///     0 = success
 ///     0 = success
 ///     1 = failure
 ///     1 = failure
-void clif_Mail_return(int32 fd, int32 mail_id, short fail)
+void clif_Mail_return(int32 fd, int32 mail_id, int16 fail)
 {
 {
 	WFIFOHEAD(fd,packet_len(0x274));
 	WFIFOHEAD(fd,packet_len(0x274));
 	WFIFOW(fd,0) = 0x274;
 	WFIFOW(fd,0) = 0x274;
@@ -16364,7 +16364,7 @@ void clif_parse_Mail_cancelwrite( int32 fd, map_session_data *sd ){
 /// Give the client information about the recipient, if available
 /// Give the client information about the recipient, if available
 /// 0a14 <char id>.L <class>.W <base level>.W (ZC_CHECK_RECEIVE_CHARACTER_NAME)
 /// 0a14 <char id>.L <class>.W <base level>.W (ZC_CHECK_RECEIVE_CHARACTER_NAME)
 /// 0a51 <char id>.L <class>.W <base level>.W <name>.24B (ZC_CHECK_RECEIVE_CHARACTER_NAME2)
 /// 0a51 <char id>.L <class>.W <base level>.W <name>.24B (ZC_CHECK_RECEIVE_CHARACTER_NAME2)
-void clif_Mail_Receiver_Ack( map_session_data* sd, uint32 char_id, short class_, uint32 level, const char* name ){
+void clif_Mail_Receiver_Ack( map_session_data* sd, uint32 char_id, int16 class_, uint32 level, const char* name ){
 #if PACKETVER >= 20141119
 #if PACKETVER >= 20141119
 	PACKET_ZC_CHECKNAME p = { 0 };
 	PACKET_ZC_CHECKNAME p = { 0 };
 
 
@@ -16765,7 +16765,7 @@ void clif_Auction_openwindow(map_session_data *sd)
 
 
 /// Returns auction item search results (ZC_AUCTION_ITEM_REQ_SEARCH).
 /// Returns auction item search results (ZC_AUCTION_ITEM_REQ_SEARCH).
 /// 0252 <packet len>.W <pages>.L <count>.L { <auction id>.L <seller name>.24B <name id>.W <type>.L <amount>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <now price>.L <max price>.L <buyer name>.24B <delete time>.L }*
 /// 0252 <packet len>.W <pages>.L <count>.L { <auction id>.L <seller name>.24B <name id>.W <type>.L <amount>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <now price>.L <max price>.L <buyer name>.24B <delete time>.L }*
-void clif_Auction_results(map_session_data *sd, short count, short pages, uint8 *buf)
+void clif_Auction_results(map_session_data *sd, int16 count, int16 pages, uint8 *buf)
 {
 {
 	int32 i, fd = sd->fd, len = sizeof(struct auction_data);
 	int32 i, fd = sd->fd, len = sizeof(struct auction_data);
 	struct auction_data auction;
 	struct auction_data auction;
@@ -17079,7 +17079,7 @@ void clif_parse_Auction_search(int32 fd, map_session_data* sd){
 ///     1 = buy (own bids)
 ///     1 = buy (own bids)
 void clif_parse_Auction_buysell(int32 fd, map_session_data* sd)
 void clif_parse_Auction_buysell(int32 fd, map_session_data* sd)
 {
 {
-	short type = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]) + 6;
+	int16 type = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]) + 6;
 
 
 	if( !battle_config.feature_auction )
 	if( !battle_config.feature_auction )
 		return;
 		return;
@@ -18432,7 +18432,7 @@ void clif_parse_bg_queue_apply_request(int32 fd, map_session_data *sd)
 
 
 	nullpo_retv(sd);
 	nullpo_retv(sd);
 
 
-	short type = RFIFOW(fd,2);
+	int16 type = RFIFOW(fd,2);
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 
 
 	safestrncpy(name, RFIFOCP(fd, 4), NAME_LENGTH);
 	safestrncpy(name, RFIFOCP(fd, 4), NAME_LENGTH);
@@ -19207,7 +19207,7 @@ static void clif_parse_ReqTradeBuyingStore( int32 fd, map_session_data* sd ){
 ///     3 = "All items within the buy limit were purchased." (0x6cf, MSI_BUYINGSTORE_TRADE_OVERLIMITZENY)
 ///     3 = "All items within the buy limit were purchased." (0x6cf, MSI_BUYINGSTORE_TRADE_OVERLIMITZENY)
 ///     4 = "All items were purchased." (0x6d0, MSI_BUYINGSTORE_TRADE_BUYCOMPLETE)
 ///     4 = "All items were purchased." (0x6d0, MSI_BUYINGSTORE_TRADE_BUYCOMPLETE)
 ///     ? = nothing
 ///     ? = nothing
-void clif_buyingstore_trade_failed_buyer(map_session_data* sd, short result)
+void clif_buyingstore_trade_failed_buyer(map_session_data* sd, int16 result)
 {
 {
 	int32 fd = sd->fd;
 	int32 fd = sd->fd;
 
 
@@ -19244,7 +19244,7 @@ void clif_buyingstore_update_item( map_session_data* sd, t_itemid nameid, uint16
 ///     "%s (%d) were sold at %dz." (0x6d2, MSI_BUYINGSTORE_TRADE_SELLCOMPLETE)
 ///     "%s (%d) were sold at %dz." (0x6d2, MSI_BUYINGSTORE_TRADE_SELLCOMPLETE)
 ///
 ///
 /// NOTE:   This function has to be called _instead_ of clif_delitem/clif_dropitem.
 /// NOTE:   This function has to be called _instead_ of clif_delitem/clif_dropitem.
-void clif_buyingstore_delete_item(map_session_data* sd, short index, uint16 amount, int32 price)
+void clif_buyingstore_delete_item(map_session_data* sd, int16 index, uint16 amount, int32 price)
 {
 {
 	int32 fd = sd->fd;
 	int32 fd = sd->fd;
 
 
@@ -19264,7 +19264,7 @@ void clif_buyingstore_delete_item(map_session_data* sd, short index, uint16 amou
 ///     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)
 ///     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)
 ///     7 = "The trade failed, because the buyer is lacking required balance." (0x6d1, MSI_BUYINGSTORE_TRADE_LACKBUYERZENY)
 ///     ? = nothing
 ///     ? = nothing
-void clif_buyingstore_trade_failed_seller( map_session_data* sd, short result, t_itemid nameid ){
+void clif_buyingstore_trade_failed_seller( map_session_data* sd, int16 result, t_itemid nameid ){
 	PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER p = {};
 	PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER p = {};
 
 
 	p.packetType = HEADER_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER;
 	p.packetType = HEADER_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER;
@@ -19567,7 +19567,7 @@ void clif_millenniumshield( block_list& bl, int16 shields ){
 /*==========================================
 /*==========================================
  * Magic Decoy Material List
  * Magic Decoy Material List
  *------------------------------------------*/
  *------------------------------------------*/
-void clif_magicdecoy_list( map_session_data& sd, uint16 skill_lv, short x, short y ){
+void clif_magicdecoy_list( map_session_data& sd, uint16 skill_lv, int16 x, int16 y ){
 	PACKET_ZC_MAKINGARROW_LIST* p = reinterpret_cast<PACKET_ZC_MAKINGARROW_LIST*>( packet_buffer );
 	PACKET_ZC_MAKINGARROW_LIST* p = reinterpret_cast<PACKET_ZC_MAKINGARROW_LIST*>( packet_buffer );
 
 
 	p->packetType = HEADER_ZC_MAKINGARROW_LIST;
 	p->packetType = HEADER_ZC_MAKINGARROW_LIST;
@@ -19779,7 +19779,7 @@ static void clif_favorite_item( map_session_data& sd, uint16 index ){
 
 
 
 
 /// 08d2 <id>.L <Pos X>.W <Pos Y>.W (ZC_FASTMOVE).
 /// 08d2 <id>.L <Pos X>.W <Pos Y>.W (ZC_FASTMOVE).
-void clif_snap( struct block_list *bl, short x, short y ) {
+void clif_snap( struct block_list *bl, int16 x, int16 y ) {
 	unsigned char buf[10];
 	unsigned char buf[10];
 
 
 	WBUFW(buf,0) = 0x8d2;
 	WBUFW(buf,0) = 0x8d2;
@@ -20856,7 +20856,7 @@ static uint8 clif_roulette_getitem(map_session_data *sd) {
 
 
 /// Update Roulette window with current stats
 /// Update Roulette window with current stats
 /// 0A20 <result>.B <stage>.W <price index>.W <bonus item>.W <gold>.L <silver>.L <bronze>.L (ZC_ACK_GENERATE_ROULETTE)
 /// 0A20 <result>.B <stage>.W <price index>.W <bonus item>.W <gold>.L <silver>.L <bronze>.L (ZC_ACK_GENERATE_ROULETTE)
-void clif_roulette_generate( map_session_data *sd, unsigned char result, short stage, short prizeIdx, t_itemid bonusItemID ){
+void clif_roulette_generate( map_session_data *sd, unsigned char result, int16 stage, int16 prizeIdx, t_itemid bonusItemID ){
 	nullpo_retv( sd );
 	nullpo_retv( sd );
 
 
 	struct packet_roulette_generate_ack p;
 	struct packet_roulette_generate_ack p;
@@ -21278,7 +21278,7 @@ void clif_dressing_room( map_session_data& sd ){
 /// 0A35 <result>.W
 /// 0A35 <result>.W
 void clif_parse_Oneclick_Itemidentify(int32 fd, map_session_data *sd) {
 void clif_parse_Oneclick_Itemidentify(int32 fd, map_session_data *sd) {
 #if PACKETVER >= 20150513
 #if PACKETVER >= 20150513
-	short idx = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]) - 2, magnifier_idx;
+	int16 idx = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]) - 2, magnifier_idx;
 
 
 	// Ignore the request
 	// Ignore the request
 	// - Invalid item index
 	// - Invalid item index
@@ -22087,7 +22087,7 @@ void clif_equipswitch_list( map_session_data* sd ){
 
 
 	WFIFOW(fd, 0) = 0xa9b;
 	WFIFOW(fd, 0) = 0xa9b;
 	for( i = 0, offset = 4, position = 0; i < EQI_MAX; i++ ){
 	for( i = 0, offset = 4, position = 0; i < EQI_MAX; i++ ){
-		short index = sd->equip_switch_index[i];
+		int16 index = sd->equip_switch_index[i];
 
 
 		if( index >= 0 && !( position & equip_bitmask[i] ) ){
 		if( index >= 0 && !( position & equip_bitmask[i] ) ){
 			WFIFOW(fd, offset) = index + 2;
 			WFIFOW(fd, offset) = index + 2;

+ 14 - 14
src/map/clif.hpp

@@ -63,9 +63,9 @@ enum e_PacketDBVersion { // packet DB
 };
 };
 
 
 struct s_packet_db {
 struct s_packet_db {
-	short len;
+	int16 len;
 	void (*func)(int32, map_session_data *);
 	void (*func)(int32, map_session_data *);
-	short pos[MAX_PACKET_POS];
+	int16 pos[MAX_PACKET_POS];
 };
 };
 
 
 #ifdef PACKET_OBFUSCATION
 #ifdef PACKET_OBFUSCATION
@@ -877,7 +877,7 @@ void clif_clearunit_delayed(struct block_list* bl, clr_type type, t_tick tick);
 int32 clif_spawn(struct block_list *bl, bool walking = false);	//area
 int32 clif_spawn(struct block_list *bl, bool walking = false);	//area
 void clif_walkok( map_session_data& sd );
 void clif_walkok( map_session_data& sd );
 void clif_move( struct unit_data& ud ); //area
 void clif_move( struct unit_data& ud ); //area
-void clif_changemap( map_session_data& sd, short m, uint16 x, uint16 y );
+void clif_changemap( map_session_data& sd, int16 m, uint16 x, uint16 y );
 void clif_changemapserver( map_session_data& sd, const char* map, uint16 x, uint16 y, uint32 ip, uint16 port );
 void clif_changemapserver( map_session_data& sd, const char* map, uint16 x, uint16 y, uint32 ip, uint16 port );
 void clif_blown(struct block_list *bl); // area
 void clif_blown(struct block_list *bl); // area
 void clif_slide(block_list& bl, int32 x, int32 y); // area
 void clif_slide(block_list& bl, int32 x, int32 y); // area
@@ -899,7 +899,7 @@ void clif_cutin( map_session_data& sd, const char* image, int32 type );
 void clif_viewpoint( map_session_data& sd, uint32 npc_id, int32 type, uint16 x, uint16 y, int32 id, uint32 color );
 void clif_viewpoint( map_session_data& sd, uint32 npc_id, int32 type, uint16 x, uint16 y, int32 id, uint32 color );
 void clif_additem(map_session_data *sd, int32 n, int32 amount, unsigned char fail); // self
 void clif_additem(map_session_data *sd, int32 n, int32 amount, unsigned char fail); // self
 void clif_dropitem( map_session_data& sd, int32 index, int32 amount );
 void clif_dropitem( map_session_data& sd, int32 index, int32 amount );
-void clif_delitem( map_session_data& sd, int32 index, int32 amount, short reason );
+void clif_delitem( map_session_data& sd, int32 index, int32 amount, int16 reason );
 void clif_update_hp(map_session_data &sd);
 void clif_update_hp(map_session_data &sd);
 void clif_updatestatus( map_session_data& sd, _sp type );
 void clif_updatestatus( map_session_data& sd, _sp type );
 void clif_changemanner( map_session_data& sd );
 void clif_changemanner( map_session_data& sd );
@@ -995,7 +995,7 @@ void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *unit,
 void clif_skill_delunit( skill_unit& unit );
 void clif_skill_delunit( skill_unit& unit );
 void clif_skillunit_update( block_list& bl);
 void clif_skillunit_update( block_list& bl);
 
 
-void clif_skill_unit_test(struct block_list *bl, short x, short y, int32 unit_id, short range, short skill_lv);
+void clif_skill_unit_test(struct block_list *bl, int16 x, int16 y, int32 unit_id, int16 range, int16 skill_lv);
 
 
 void clif_autospell( map_session_data& sd, uint16 skill_lv );
 void clif_autospell( map_session_data& sd, uint16 skill_lv );
 void clif_devotion(struct block_list *src, map_session_data *tsd);
 void clif_devotion(struct block_list *src, map_session_data *tsd);
@@ -1141,7 +1141,7 @@ void clif_font(map_session_data *sd);
 void clif_displaymessage(const int32 fd, const char* mes);
 void clif_displaymessage(const int32 fd, const char* mes);
 void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target);
 void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target);
 void clif_broadcast(struct block_list* bl, const char* mes, size_t len, int32 type, enum send_target target);
 void clif_broadcast(struct block_list* bl, const char* mes, size_t len, int32 type, enum send_target target);
-void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target);
+void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned long fontColor, int16 fontType, int16 fontSize, int16 fontAlign, int16 fontY, enum send_target target);
 void clif_heal( map_session_data& sd, int32 type, uint32 val );
 void clif_heal( map_session_data& sd, int32 type, uint32 val );
 void clif_resurrection( block_list& bl );
 void clif_resurrection( block_list& bl );
 void clif_map_property(struct block_list *bl, enum map_property property, enum send_target t);
 void clif_map_property(struct block_list *bl, enum map_property property, enum send_target t);
@@ -1236,16 +1236,16 @@ enum mail_send_result : uint8_t {
 void clif_Mail_window(int32 fd, int32 flag);
 void clif_Mail_window(int32 fd, int32 flag);
 void clif_Mail_read(map_session_data *sd, int32 mail_id);
 void clif_Mail_read(map_session_data *sd, int32 mail_id);
 void clif_mail_delete(map_session_data* sd, struct mail_message *msg, bool success);
 void clif_mail_delete(map_session_data* sd, struct mail_message *msg, bool success);
-void clif_Mail_return(int32 fd, int32 mail_id, short fail);
+void clif_Mail_return(int32 fd, int32 mail_id, int16 fail);
 void clif_Mail_send(map_session_data* sd, enum mail_send_result result);
 void clif_Mail_send(map_session_data* sd, enum mail_send_result result);
 void clif_Mail_new(map_session_data* sd, int32 mail_id, const char *sender, const char *title);
 void clif_Mail_new(map_session_data* sd, int32 mail_id, const char *sender, const char *title);
 void clif_Mail_refreshinbox(map_session_data *sd,enum mail_inbox_type type,int64 mailID);
 void clif_Mail_refreshinbox(map_session_data *sd,enum mail_inbox_type type,int64 mailID);
 void clif_mail_getattachment(map_session_data* sd, struct mail_message *msg, uint8 result, enum mail_attachment_type type);
 void clif_mail_getattachment(map_session_data* sd, struct mail_message *msg, uint8 result, enum mail_attachment_type type);
-void clif_Mail_Receiver_Ack(map_session_data* sd, uint32 char_id, short class_, uint32 level, const char* name);
+void clif_Mail_Receiver_Ack(map_session_data* sd, uint32 char_id, int16 class_, uint32 level, const char* name);
 void clif_mail_removeitem(map_session_data* sd, bool success, int32 index, int32 amount);
 void clif_mail_removeitem(map_session_data* sd, bool success, int32 index, int32 amount);
 // AUCTION SYSTEM
 // AUCTION SYSTEM
 void clif_Auction_openwindow(map_session_data *sd);
 void clif_Auction_openwindow(map_session_data *sd);
-void clif_Auction_results(map_session_data *sd, short count, short pages, uint8 *buf);
+void clif_Auction_results(map_session_data *sd, int16 count, int16 pages, uint8 *buf);
 void clif_Auction_message(int32 fd, unsigned char flag);
 void clif_Auction_message(int32 fd, unsigned char flag);
 void clif_Auction_close(int32 fd, unsigned char flag);
 void clif_Auction_close(int32 fd, unsigned char flag);
 void clif_parse_Auction_cancelreg(int32 fd, map_session_data *sd);
 void clif_parse_Auction_cancelreg(int32 fd, map_session_data *sd);
@@ -1301,10 +1301,10 @@ void clif_buyingstore_myitemlist( map_session_data& sd );
 void clif_buyingstore_entry( map_session_data& sd, struct block_list* tbl = nullptr );
 void clif_buyingstore_entry( map_session_data& sd, struct block_list* tbl = nullptr );
 void clif_buyingstore_disappear_entry( map_session_data& sd, struct block_list* tbl = nullptr );
 void clif_buyingstore_disappear_entry( map_session_data& sd, struct block_list* tbl = nullptr );
 void clif_buyingstore_itemlist( map_session_data& sd, map_session_data& pl_sd );
 void clif_buyingstore_itemlist( map_session_data& sd, map_session_data& pl_sd );
-void clif_buyingstore_trade_failed_buyer(map_session_data* sd, short result);
+void clif_buyingstore_trade_failed_buyer(map_session_data* sd, int16 result);
 void clif_buyingstore_update_item(map_session_data* sd, t_itemid nameid, uint16 amount, uint32 char_id, int32 zeny);
 void clif_buyingstore_update_item(map_session_data* sd, t_itemid nameid, uint16 amount, uint32 char_id, int32 zeny);
-void clif_buyingstore_delete_item(map_session_data* sd, short index, uint16 amount, int32 price);
-void clif_buyingstore_trade_failed_seller(map_session_data* sd, short result, t_itemid nameid);
+void clif_buyingstore_delete_item(map_session_data* sd, int16 index, uint16 amount, int32 price);
+void clif_buyingstore_trade_failed_seller(map_session_data* sd, int16 result, t_itemid nameid);
 
 
 /// Search Store System
 /// Search Store System
 void clif_search_store_info_ack( map_session_data& sd );
 void clif_search_store_info_ack( map_session_data& sd );
@@ -1330,7 +1330,7 @@ void clif_elementalconverter_list( map_session_data& sd );
 
 
 void clif_millenniumshield( block_list& bl, int16 shields );
 void clif_millenniumshield( block_list& bl, int16 shields );
 
 
-void clif_magicdecoy_list( map_session_data& sd, uint16 skill_lv, short x, short y );
+void clif_magicdecoy_list( map_session_data& sd, uint16 skill_lv, int16 x, int16 y );
 
 
 void clif_poison_list( map_session_data& sd, uint16 skill_lv );
 void clif_poison_list( map_session_data& sd, uint16 skill_lv );
 
 
@@ -1342,7 +1342,7 @@ void clif_elemental_updatestatus(map_session_data& sd, _sp type);
 
 
 void clif_spiritcharm( map_session_data& sd );
 void clif_spiritcharm( map_session_data& sd );
 
 
-void clif_snap( struct block_list *bl, short x, short y );
+void clif_snap( struct block_list *bl, int16 x, int16 y );
 void clif_monster_hp_bar( struct mob_data* md, int32 fd );
 void clif_monster_hp_bar( struct mob_data* md, int32 fd );
 
 
 // Clan System
 // Clan System

+ 1 - 1
src/map/elemental.cpp

@@ -600,7 +600,7 @@ static int32 elemental_ai_sub_timer(s_elemental_data *ed, map_session_data *sd,
 		clif_elemental_updatestatus(*sd, SP_SP);
 		clif_elemental_updatestatus(*sd, SP_SP);
 		return 0;
 		return 0;
 	} else if( master_dist > MAX_ELEDISTANCE ) {	// Master too far, chase.
 	} else if( master_dist > MAX_ELEDISTANCE ) {	// Master too far, chase.
-		short x = sd->bl.x, y = sd->bl.y;
+		int16 x = sd->bl.x, y = sd->bl.y;
 		if( ed->target_id )
 		if( ed->target_id )
 			elemental_unlocktarget(ed);
 			elemental_unlocktarget(ed);
 		if( ed->ud.walktimer != INVALID_TIMER && ed->ud.target == sd->bl.id )
 		if( ed->ud.walktimer != INVALID_TIMER && ed->ud.target == sd->bl.id )

+ 1 - 1
src/map/elemental.hpp

@@ -89,7 +89,7 @@ struct s_elemental_data {
 	int32 skill_timer;
 	int32 skill_timer;
 
 
 	t_tick last_thinktime, last_linktime, last_spdrain_time;
 	t_tick last_thinktime, last_linktime, last_spdrain_time;
-	short min_chase;
+	int16 min_chase;
 	int32 target_id, attacked_id;
 	int32 target_id, attacked_id;
 };
 };
 
 

+ 5 - 5
src/map/guild.cpp

@@ -204,7 +204,7 @@ uint16 guild_flags_count;
  * @param skill_id
  * @param skill_id
  * @return Index in skill_tree or -1
  * @return Index in skill_tree or -1
  **/
  **/
-static short guild_skill_get_index(uint16 skill_id) {
+static int16 guild_skill_get_index(uint16 skill_id) {
 	if (!SKILL_CHK_GUILD(skill_id))
 	if (!SKILL_CHK_GUILD(skill_id))
 		return -1;
 		return -1;
 	skill_id -= GD_SKILLBASE;
 	skill_id -= GD_SKILLBASE;
@@ -1487,7 +1487,7 @@ int32 guild_recv_message( int32 guild_id, uint32 account_id, const char *mes, si
 /*====================================================
 /*====================================================
  * Member changing position in guild
  * Member changing position in guild
  *---------------------------------------------------*/
  *---------------------------------------------------*/
-int32 guild_change_memberposition(int32 guild_id,uint32 account_id,uint32 char_id,short idx) {
+int32 guild_change_memberposition(int32 guild_id,uint32 account_id,uint32 char_id,int16 idx) {
 	return intif_guild_change_memberinfo(guild_id,account_id,char_id,GMI_POSITION,&idx,sizeof(idx));
 	return intif_guild_change_memberinfo(guild_id,account_id,char_id,GMI_POSITION,&idx,sizeof(idx));
 }
 }
 
 
@@ -1726,8 +1726,8 @@ t_exp guild_getexp(map_session_data *sd,t_exp exp) {
  * Ask to increase guildskill skill_id
  * Ask to increase guildskill skill_id
  *---------------------------------------------------*/
  *---------------------------------------------------*/
 void guild_skillup(map_session_data* sd, uint16 skill_id) {
 void guild_skillup(map_session_data* sd, uint16 skill_id) {
-	short idx = guild_skill_get_index(skill_id);
-	short max = 0;
+	int16 idx = guild_skill_get_index(skill_id);
+	int16 max = 0;
 
 
 	nullpo_retv(sd);
 	nullpo_retv(sd);
 
 
@@ -1755,7 +1755,7 @@ int32 guild_skillupack(int32 guild_id,uint16 skill_id,uint32 account_id) {
 	map_session_data *sd = map_id2sd(account_id);
 	map_session_data *sd = map_id2sd(account_id);
 	auto g = guild_search(guild_id);
 	auto g = guild_search(guild_id);
 	int32 i;
 	int32 i;
-	short idx = guild_skill_get_index(skill_id);
+	int16 idx = guild_skill_get_index(skill_id);
 
 
 	if (g == nullptr || idx == -1)
 	if (g == nullptr || idx == -1)
 		return 0;
 		return 0;

+ 1 - 1
src/map/guild.hpp

@@ -80,7 +80,7 @@ int32 guild_check_alliance(int32 guild_id1, int32 guild_id2, int32 flag);
 
 
 int32 guild_send_memberinfoshort(map_session_data *sd,int32 online);
 int32 guild_send_memberinfoshort(map_session_data *sd,int32 online);
 int32 guild_recv_memberinfoshort(int32 guild_id,uint32 account_id,uint32 char_id,int32 online,int32 lv,int32 class_);
 int32 guild_recv_memberinfoshort(int32 guild_id,uint32 account_id,uint32 char_id,int32 online,int32 lv,int32 class_);
-int32 guild_change_memberposition(int32 guild_id,uint32 account_id,uint32 char_id,short idx);
+int32 guild_change_memberposition(int32 guild_id,uint32 account_id,uint32 char_id,int16 idx);
 int32 guild_memberposition_changed(struct mmo_guild &g,int32 idx,int32 pos);
 int32 guild_memberposition_changed(struct mmo_guild &g,int32 idx,int32 pos);
 int32 guild_change_position(int32 guild_id,int32 idx,int32 mode,int32 exp_mode,const char *name);
 int32 guild_change_position(int32 guild_id,int32 idx,int32 mode,int32 exp_mode,const char *name);
 int32 guild_position_changed(int32 guild_id,int32 idx,struct guild_position *p);
 int32 guild_position_changed(int32 guild_id,int32 idx,struct guild_position *p);

+ 6 - 6
src/map/homunculus.cpp

@@ -112,7 +112,7 @@ t_exp HomExpDatabase::get_nextexp(uint16 level) {
 * @param skill_id
 * @param skill_id
 * @return -1 if invalid skill or skill index for homunculus skill in s_homunculus::hskill
 * @return -1 if invalid skill or skill index for homunculus skill in s_homunculus::hskill
 */
 */
-short hom_skill_get_index(uint16 skill_id) {
+int16 hom_skill_get_index(uint16 skill_id) {
 	if (!SKILL_CHK_HOMUN(skill_id))
 	if (!SKILL_CHK_HOMUN(skill_id))
 		return -1;
 		return -1;
 	skill_id -= HM_SKILLBASE;
 	skill_id -= HM_SKILLBASE;
@@ -324,7 +324,7 @@ void hom_calc_skilltree_sub(homun_data &hd, std::vector<s_homun_skill_tree_entry
 
 
 	for (const auto &skit : skill_tree) {
 	for (const auto &skit : skill_tree) {
 		uint16 skill_id = skit.id;
 		uint16 skill_id = skit.id;
-		short idx = hom_skill_get_index(skill_id);
+		int16 idx = hom_skill_get_index(skill_id);
 
 
 		if (skill_id == 0 || idx == -1)
 		if (skill_id == 0 || idx == -1)
 			continue;
 			continue;
@@ -385,9 +385,9 @@ void hom_calc_skilltree(homun_data *hd) {
 * @param skill_id
 * @param skill_id
 * @return Skill Level or 0 if invalid or unlearned skill
 * @return Skill Level or 0 if invalid or unlearned skill
 */
 */
-short hom_checkskill(struct homun_data *hd,uint16 skill_id)
+int16 hom_checkskill(struct homun_data *hd,uint16 skill_id)
 {
 {
-	short idx = hom_skill_get_index(skill_id);
+	int16 idx = hom_skill_get_index(skill_id);
 	if (idx < 0) // Invalid skill
 	if (idx < 0) // Invalid skill
 		return 0;
 		return 0;
 
 
@@ -447,7 +447,7 @@ uint16 hom_skill_get_min_level(int32 class_, uint16 skill_id) {
  */
  */
 void hom_skillup(struct homun_data *hd, uint16 skill_id)
 void hom_skillup(struct homun_data *hd, uint16 skill_id)
 {
 {
-	short idx = 0;
+	int16 idx = 0;
 	nullpo_retv(hd);
 	nullpo_retv(hd);
 
 
 	if (hd->homunculus.vaporize)
 	if (hd->homunculus.vaporize)
@@ -1286,7 +1286,7 @@ bool hom_create_request(map_session_data *sd, int32 class_)
  * @param y : Y map coordinate
  * @param y : Y map coordinate
  * @return 0:failure, 1:success
  * @return 0:failure, 1:success
  */
  */
-int32 hom_ressurect(map_session_data* sd, unsigned char per, short x, short y)
+int32 hom_ressurect(map_session_data* sd, unsigned char per, int16 x, int16 y)
 {
 {
 	struct homun_data* hd;
 	struct homun_data* hd;
 	nullpo_ret(sd);
 	nullpo_ret(sd);

+ 3 - 3
src/map/homunculus.hpp

@@ -210,7 +210,7 @@ enum homun_type hom_class2type(int32 class_);
 int32 hom_dead(struct homun_data *hd);
 int32 hom_dead(struct homun_data *hd);
 void hom_skillup(struct homun_data *hd,uint16 skill_id);
 void hom_skillup(struct homun_data *hd,uint16 skill_id);
 void hom_calc_skilltree(homun_data *hd);
 void hom_calc_skilltree(homun_data *hd);
-short hom_checkskill(struct homun_data *hd,uint16 skill_id);
+int16 hom_checkskill(struct homun_data *hd,uint16 skill_id);
 uint16 hom_skill_get_min_level(int32 class_, uint16 skill_id);
 uint16 hom_skill_get_min_level(int32 class_, uint16 skill_id);
 void hom_gainexp(struct homun_data *hd,t_exp exp);
 void hom_gainexp(struct homun_data *hd,t_exp exp);
 int32 hom_levelup(struct homun_data *hd);
 int32 hom_levelup(struct homun_data *hd);
@@ -218,7 +218,7 @@ int32 hom_evolution(struct homun_data *hd);
 int32 hom_mutate(struct homun_data *hd,int32 homun_id);
 int32 hom_mutate(struct homun_data *hd,int32 homun_id);
 void hom_heal(homun_data& hd, bool hp, bool sp);
 void hom_heal(homun_data& hd, bool hp, bool sp);
 int32 hom_vaporize(map_session_data *sd, int32 flag);
 int32 hom_vaporize(map_session_data *sd, int32 flag);
-int32 hom_ressurect(map_session_data *sd, unsigned char per, short x, short y);
+int32 hom_ressurect(map_session_data *sd, unsigned char per, int16 x, int16 y);
 void hom_revive(struct homun_data *hd, uint32 hp, uint32 sp);
 void hom_revive(struct homun_data *hd, uint32 hp, uint32 sp);
 void hom_reset_stats(struct homun_data *hd);
 void hom_reset_stats(struct homun_data *hd);
 int32 hom_shuffle(struct homun_data *hd); // [Zephyrus]
 int32 hom_shuffle(struct homun_data *hd); // [Zephyrus]
@@ -243,7 +243,7 @@ uint8 hom_get_intimacy_grade(struct homun_data *hd);
 uint32 hom_intimacy_grade2intimacy(enum e_homun_grade grade);
 uint32 hom_intimacy_grade2intimacy(enum e_homun_grade grade);
 enum e_homun_grade hom_intimacy_intimacy2grade(uint32 intimacy);
 enum e_homun_grade hom_intimacy_intimacy2grade(uint32 intimacy);
 
 
-short hom_skill_get_index(uint16 skill_id);
+int16 hom_skill_get_index(uint16 skill_id);
 
 
 void do_final_homunculus(void);
 void do_final_homunculus(void);
 void do_init_homunculus(void);
 void do_init_homunculus(void);

+ 1 - 1
src/map/instance.cpp

@@ -1048,7 +1048,7 @@ bool instance_destroy(int32 instance_id)
  * @param y: Y coordinate
  * @param y: Y coordinate
  * @return e_instance_enter value
  * @return e_instance_enter value
  */
  */
-e_instance_enter instance_enter(map_session_data *sd, int32 instance_id, const char *name, short x, short y)
+e_instance_enter instance_enter(map_session_data *sd, int32 instance_id, const char *name, int16 x, int16 y)
 {
 {
 	nullpo_retr(IE_OTHER, sd);
 	nullpo_retr(IE_OTHER, sd);
 	
 	

+ 1 - 1
src/map/instance.hpp

@@ -122,7 +122,7 @@ void instance_getsd(int32 instance_id, map_session_data *&sd, enum send_target *
 int32 instance_create(int32 owner_id, const char *name, e_instance_mode mode);
 int32 instance_create(int32 owner_id, const char *name, e_instance_mode mode);
 bool instance_destroy(int32 instance_id);
 bool instance_destroy(int32 instance_id);
 void instance_destroy_command(map_session_data *sd);
 void instance_destroy_command(map_session_data *sd);
-e_instance_enter instance_enter(map_session_data *sd, int32 instance_id, const char *name, short x, short y);
+e_instance_enter instance_enter(map_session_data *sd, int32 instance_id, const char *name, int16 x, int16 y);
 bool instance_reqinfo(map_session_data *sd, int32 instance_id);
 bool instance_reqinfo(map_session_data *sd, int32 instance_id);
 bool instance_addusers(int32 instance_id);
 bool instance_addusers(int32 instance_id);
 bool instance_delusers(int32 instance_id);
 bool instance_delusers(int32 instance_id);

+ 7 - 7
src/map/intif.cpp

@@ -95,7 +95,7 @@ map_session_data *inter_search_sd(uint32 account_id, uint32 char_id)
  * @param pet_name
  * @param pet_name
  * @return 
  * @return 
  */
  */
-int32 intif_create_pet(uint32 account_id,uint32 char_id,short pet_class,short pet_lv, t_itemid pet_egg_id, t_itemid pet_equip,short intimate,short hungry,char rename_flag,char incubate,const char *pet_name)
+int32 intif_create_pet(uint32 account_id,uint32 char_id,int16 pet_class,int16 pet_lv, t_itemid pet_egg_id, t_itemid pet_equip,int16 intimate,int16 hungry,char rename_flag,char incubate,const char *pet_name)
 {
 {
 	if (CheckForCharServer())
 	if (CheckForCharServer())
 		return 0;
 		return 0;
@@ -248,7 +248,7 @@ int32 intif_broadcast( const char* mes, size_t len, int32 type ){
  * @param fontY :
  * @param fontY :
  * @return 0=not send to char-serv, 1=send to char-serv
  * @return 0=not send to char-serv, 1=send to char-serv
  */
  */
-int32 intif_broadcast2( const char* mes, size_t len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY ){
+int32 intif_broadcast2( const char* mes, size_t len, unsigned long fontColor, int16 fontType, int16 fontSize, int16 fontAlign, int16 fontY ){
 	nullpo_ret(mes);
 	nullpo_ret(mes);
 	if (len < 2)
 	if (len < 2)
 		return 0;
 		return 0;
@@ -2539,7 +2539,7 @@ int32 intif_parse_Mail_return(int32 fd)
 {
 {
 	map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
 	map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
 	int32 mail_id = RFIFOL(fd,6);
 	int32 mail_id = RFIFOL(fd,6);
-	short fail = RFIFOB(fd,10);
+	int16 fail = RFIFOB(fd,10);
 
 
 	if( sd == nullptr )
 	if( sd == nullptr )
 	{
 	{
@@ -2700,7 +2700,7 @@ bool intif_mail_checkreceiver( map_session_data* sd, char* name ){
  * @param page : in case of huge result list display 5 entry per page, (kinda suck that we redo the request atm)
  * @param page : in case of huge result list display 5 entry per page, (kinda suck that we redo the request atm)
  * @return 0=error, 1=msg sent
  * @return 0=error, 1=msg sent
  */
  */
-int32 intif_Auction_requestlist(uint32 char_id, short type, int32 price, const char* searchtext, short page)
+int32 intif_Auction_requestlist(uint32 char_id, int16 type, int32 price, const char* searchtext, int16 page)
 {
 {
 	int32 len = NAME_LENGTH + 16;
 	int32 len = NAME_LENGTH + 16;
 
 
@@ -2727,8 +2727,8 @@ int32 intif_Auction_requestlist(uint32 char_id, short type, int32 price, const c
 static void intif_parse_Auction_results(int32 fd)
 static void intif_parse_Auction_results(int32 fd)
 {
 {
 	map_session_data *sd = map_charid2sd(RFIFOL(fd,4));
 	map_session_data *sd = map_charid2sd(RFIFOL(fd,4));
-	short count = RFIFOW(fd,8);
-	short pages = RFIFOW(fd,10);
+	int16 count = RFIFOW(fd,8);
+	int16 pages = RFIFOW(fd,10);
 	uint8* data = RFIFOP(fd,12);
 	uint8* data = RFIFOP(fd,12);
 
 
 	if( sd == nullptr )
 	if( sd == nullptr )
@@ -3395,7 +3395,7 @@ void intif_parse_itembound_ack(int32 fd) {
  */
  */
 void intif_parse_itembound_store2gstorage(int32 fd) {
 void intif_parse_itembound_store2gstorage(int32 fd) {
 	uint16 i, failed = 0;
 	uint16 i, failed = 0;
-	short count = RFIFOW(fd, 4), guild_id = RFIFOW(fd, 6);
+	int16 count = RFIFOW(fd, 4), guild_id = RFIFOW(fd, 6);
 	struct s_storage *gstor = guild2storage(guild_id);
 	struct s_storage *gstor = guild2storage(guild_id);
 
 
 	if (!gstor) {
 	if (!gstor) {

+ 3 - 3
src/map/intif.hpp

@@ -24,7 +24,7 @@ class map_session_data;
 int32 intif_parse(int32 fd);
 int32 intif_parse(int32 fd);
 
 
 int32 intif_broadcast( const char* mes, size_t len, int32 type );
 int32 intif_broadcast( const char* mes, size_t len, int32 type );
-int32 intif_broadcast2( const char* mes, size_t len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY );
+int32 intif_broadcast2( const char* mes, size_t len, unsigned long fontColor, int16 fontType, int16 fontSize, int16 fontAlign, int16 fontY );
 int32 intif_broadcast_obtain_special_item(map_session_data *sd, t_itemid nameid, uint32 sourceid, unsigned char type);
 int32 intif_broadcast_obtain_special_item(map_session_data *sd, t_itemid nameid, uint32 sourceid, unsigned char type);
 int32 intif_broadcast_obtain_special_item_npc(map_session_data *sd, t_itemid nameid);
 int32 intif_broadcast_obtain_special_item_npc(map_session_data *sd, t_itemid nameid);
 int32 intif_main_message(map_session_data* sd, const char* message);
 int32 intif_main_message(map_session_data* sd, const char* message);
@@ -72,7 +72,7 @@ int32 intif_guild_castle_datasave(int32 castle_id, int32 index, int32 value);
 void intif_itembound_guild_retrieve(uint32 char_id, uint32 account_id, int32 guild_id);
 void intif_itembound_guild_retrieve(uint32 char_id, uint32 account_id, int32 guild_id);
 #endif
 #endif
 
 
-int32 intif_create_pet(uint32 account_id, uint32 char_id, short pet_type, short pet_lv, t_itemid pet_egg_id, t_itemid pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name);
+int32 intif_create_pet(uint32 account_id, uint32 char_id, int16 pet_type, int16 pet_lv, t_itemid pet_egg_id, t_itemid pet_equip, int16 intimate, int16 hungry, char rename_flag, char incubate, const char *pet_name);
 int32 intif_request_petdata(uint32 account_id, uint32 char_id, int32 pet_id);
 int32 intif_request_petdata(uint32 account_id, uint32 char_id, int32 pet_id);
 int32 intif_save_petdata(uint32 account_id, struct s_pet *p);
 int32 intif_save_petdata(uint32 account_id, struct s_pet *p);
 int32 intif_delete_petdata(int32 pet_id);
 int32 intif_delete_petdata(int32 pet_id);
@@ -104,7 +104,7 @@ int32 intif_Mail_return(uint32 char_id, int32 mail_id);
 int32 intif_Mail_send(uint32 account_id, struct mail_message *msg);
 int32 intif_Mail_send(uint32 account_id, struct mail_message *msg);
 bool intif_mail_checkreceiver(map_session_data* sd, char* name);
 bool intif_mail_checkreceiver(map_session_data* sd, char* name);
 // AUCTION SYSTEM
 // AUCTION SYSTEM
-int32 intif_Auction_requestlist(uint32 char_id, short type, int32 price, const char* searchtext, short page);
+int32 intif_Auction_requestlist(uint32 char_id, int16 type, int32 price, const char* searchtext, int16 page);
 int32 intif_Auction_register(struct auction_data *auction);
 int32 intif_Auction_register(struct auction_data *auction);
 int32 intif_Auction_cancel(uint32 char_id, uint32 auction_id);
 int32 intif_Auction_cancel(uint32 char_id, uint32 auction_id);
 int32 intif_Auction_close(uint32 char_id, uint32 auction_id);
 int32 intif_Auction_close(uint32 char_id, uint32 auction_id);

+ 1 - 1
src/map/itemdb.hpp

@@ -3245,7 +3245,7 @@ struct item_data
 		uint16 override;
 		uint16 override;
 		bool sitting;
 		bool sitting;
 	} item_usage;
 	} item_usage;
-	short gm_lv_trade_override;	//GM-level to override trade_restriction
+	int16 gm_lv_trade_override;	//GM-level to override trade_restriction
 	std::vector<std::shared_ptr<s_item_combo>> combos;
 	std::vector<std::shared_ptr<s_item_combo>> combos;
 	struct {
 	struct {
 		uint32 duration;
 		uint32 duration;

+ 2 - 2
src/map/mail.cpp

@@ -36,7 +36,7 @@ void mail_clear(map_session_data *sd)
 	return;
 	return;
 }
 }
 
 
-int32 mail_removeitem(map_session_data *sd, short flag, int32 idx, int32 amount)
+int32 mail_removeitem(map_session_data *sd, int16 flag, int32 idx, int32 amount)
 {
 {
 	int32 i;
 	int32 i;
 
 
@@ -159,7 +159,7 @@ bool mail_removezeny( map_session_data *sd, bool flag ){
 * @param amount : amout of zeny or number of item
 * @param amount : amout of zeny or number of item
 * @return see enum mail_attach_result in mail.hpp
 * @return see enum mail_attach_result in mail.hpp
 */
 */
-enum mail_attach_result mail_setitem(map_session_data *sd, short idx, uint32 amount) {
+enum mail_attach_result mail_setitem(map_session_data *sd, int16 idx, uint32 amount) {
 	if( pc_istrading(sd) )
 	if( pc_istrading(sd) )
 		return MAIL_ATTACH_ERROR;
 		return MAIL_ATTACH_ERROR;
 
 

+ 2 - 2
src/map/mail.hpp

@@ -25,9 +25,9 @@ enum mail_attach_result {
 };
 };
 
 
 void mail_clear(map_session_data *sd);
 void mail_clear(map_session_data *sd);
-int32 mail_removeitem(map_session_data *sd, short flag, int32 idx, int32 amount);
+int32 mail_removeitem(map_session_data *sd, int16 flag, int32 idx, int32 amount);
 bool mail_removezeny(map_session_data *sd, bool flag);
 bool mail_removezeny(map_session_data *sd, bool flag);
-enum mail_attach_result mail_setitem(map_session_data *sd, short idx, uint32 amount);
+enum mail_attach_result mail_setitem(map_session_data *sd, int16 idx, uint32 amount);
 bool mail_setattachment(map_session_data *sd, struct mail_message *msg);
 bool mail_setattachment(map_session_data *sd, struct mail_message *msg);
 void mail_getattachment(map_session_data* sd, struct mail_message* msg, int32 zeny, struct item* item);
 void mail_getattachment(map_session_data* sd, struct mail_message* msg, int32 zeny, struct item* item);
 int32 mail_openmail(map_session_data *sd);
 int32 mail_openmail(map_session_data *sd);

+ 10 - 10
src/map/map.cpp

@@ -1386,8 +1386,8 @@ int32 map_foreachindir(int32 (*func)(struct block_list*, va_list), int16 m, int1
 	int32 bx, by;
 	int32 bx, by;
 	int32 mx0, mx1, my0, my1, rx, ry;
 	int32 mx0, mx1, my0, my1, rx, ry;
 	uint8 dir = map_calc_dir_xy( x0, y0, x1, y1, DIR_EAST );
 	uint8 dir = map_calc_dir_xy( x0, y0, x1, y1, DIR_EAST );
-	short dx = dirx[dir];
-	short dy = diry[dir];
+	int16 dx = dirx[dir];
+	int16 dy = diry[dir];
 	va_list ap;
 	va_list ap;
 
 
 	if (m < 0)
 	if (m < 0)
@@ -1818,8 +1818,8 @@ bool map_closest_freecell(int16 m, int16 *x, int16 *y, int32 type, int32 flag)
 
 
 	//Algorithm only works up to costrange of 34
 	//Algorithm only works up to costrange of 34
 	while(costrange <= 34) {
 	while(costrange <= 34) {
-		short dx = dirx[dir];
-		short dy = diry[dir];
+		int16 dx = dirx[dir];
+		int16 dy = diry[dir];
 
 
 		//Linear search
 		//Linear search
 		if( !direction_diagonal( (directions)dir ) && costrange % MOVE_COST == 0 ){
 		if( !direction_diagonal( (directions)dir ) && costrange % MOVE_COST == 0 ){
@@ -3127,19 +3127,19 @@ uint8 map_calc_dir_xy(int16 srcx, int16 srcy, int16 x, int16 y, uint8 srcdir) {
  *------------------------------------------*/
  *------------------------------------------*/
 int32 map_random_dir(struct block_list *bl, int16 *x, int16 *y)
 int32 map_random_dir(struct block_list *bl, int16 *x, int16 *y)
 {
 {
-	short xi = *x-bl->x;
-	short yi = *y-bl->y;
-	short i=0;
+	int16 xi = *x-bl->x;
+	int16 yi = *y-bl->y;
+	int16 i=0;
 	int32 dist2 = xi*xi + yi*yi;
 	int32 dist2 = xi*xi + yi*yi;
-	short dist = (short)sqrt((float)dist2);
+	int16 dist = (int16)sqrt((float)dist2);
 
 
 	if (dist < 1) dist =1;
 	if (dist < 1) dist =1;
 
 
 	do {
 	do {
 		directions j = static_cast<directions>(1 + 2 * rnd_value(0, 3)); //Pick a random diagonal direction
 		directions j = static_cast<directions>(1 + 2 * rnd_value(0, 3)); //Pick a random diagonal direction
-		short segment = rnd_value((short)1, dist); //Pick a random interval from the whole vector in that direction
+		int16 segment = rnd_value((int16)1, dist); //Pick a random interval from the whole vector in that direction
 		xi = bl->x + segment*dirx[j];
 		xi = bl->x + segment*dirx[j];
-		segment = (short)sqrt((float)(dist2 - segment*segment)); //The complement of the previously picked segment
+		segment = (int16)sqrt((float)(dist2 - segment*segment)); //The complement of the previously picked segment
 		yi = bl->y + segment*diry[j];
 		yi = bl->y + segment*diry[j];
 	} while (
 	} while (
 		(map_getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path_search(nullptr,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH))
 		(map_getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path_search(nullptr,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH))

+ 3 - 3
src/map/map.hpp

@@ -459,9 +459,9 @@ struct block_list {
 // Mob List Held in memory for Dynamic Mobs [Wizputer]
 // Mob List Held in memory for Dynamic Mobs [Wizputer]
 // Expanded to specify all mob-related spawn data by [Skotlex]
 // Expanded to specify all mob-related spawn data by [Skotlex]
 struct spawn_data {
 struct spawn_data {
-	short id; //ID, used because a mob can change it's class
+	int16 id; //ID, used because a mob can change it's class
 	uint16 m, x, y;	//Spawn information (map, point, spawn-area around point)
 	uint16 m, x, y;	//Spawn information (map, point, spawn-area around point)
-	signed short xs, ys;
+	int16 xs, ys;
 	uint16 num; //Number of mobs using this structure
 	uint16 num; //Number of mobs using this structure
 	uint16 active;//Number of mobs that are already spawned (for mob_remove_damaged: no)
 	uint16 active;//Number of mobs that are already spawned (for mob_remove_damaged: no)
 	uint32 delay1, delay2; //Spawn delay (fixed base + random variance)
 	uint32 delay1, delay2; //Spawn delay (fixed base + random variance)
@@ -798,7 +798,7 @@ struct mapcell
 
 
 struct iwall_data {
 struct iwall_data {
 	char wall_name[50];
 	char wall_name[50];
-	short m, x, y, size;
+	int16 m, x, y, size;
 	int8 dir;
 	int8 dir;
 	bool shootable;
 	bool shootable;
 };
 };

+ 4 - 4
src/map/mob.cpp

@@ -3591,7 +3591,7 @@ int32 mob_warpslave_sub(struct block_list *bl,va_list ap)
 {
 {
 	struct mob_data *md=(struct mob_data *)bl;
 	struct mob_data *md=(struct mob_data *)bl;
 	struct block_list *master;
 	struct block_list *master;
-	short x,y,range=0;
+	int16 x,y,range=0;
 	master = va_arg(ap, struct block_list*);
 	master = va_arg(ap, struct block_list*);
 	range = va_arg(ap, int32);
 	range = va_arg(ap, int32);
 
 
@@ -3705,7 +3705,7 @@ int32 mob_summonslave(struct mob_data *md2,int32 *value,int32 amount,uint16 skil
 		hp_rate = get_percentage(md2->status.hp, md2->status.max_hp);
 		hp_rate = get_percentage(md2->status.hp, md2->status.max_hp);
 
 
 	for(;k<amount;k++) {
 	for(;k<amount;k++) {
-		short x,y;
+		int16 x,y;
 		data.id = value[k%count]; //Summon slaves in round-robin fashion. [Skotlex]
 		data.id = value[k%count]; //Summon slaves in round-robin fashion. [Skotlex]
 		if (mobdb_checkid(data.id) == 0)
 		if (mobdb_checkid(data.id) == 0)
 			continue;
 			continue;
@@ -3920,7 +3920,7 @@ int32 mobskill_use(struct mob_data *md, t_tick tick, int32 event, int64 damage)
 	struct block_list *bl;
 	struct block_list *bl;
 	struct mob_data *fmd = nullptr;
 	struct mob_data *fmd = nullptr;
 	int32 i,j,n;
 	int32 i,j,n;
-	short skill_target;
+	int16 skill_target;
 
 
 	nullpo_ret(md);
 	nullpo_ret(md);
 
 
@@ -4029,7 +4029,7 @@ int32 mobskill_use(struct mob_data *md, t_tick tick, int32 event, int64 damage)
 		skill_target = status_has_mode(&md->db->status,MD_RANDOMTARGET) ? MST_RANDOM : ms[i]->target;
 		skill_target = status_has_mode(&md->db->status,MD_RANDOMTARGET) ? MST_RANDOM : ms[i]->target;
 		if (skill_get_casttype(ms[i]->skill_id) == CAST_GROUND)
 		if (skill_get_casttype(ms[i]->skill_id) == CAST_GROUND)
 		{	//Ground skill.
 		{	//Ground skill.
-			short x, y;
+			int16 x, y;
 			switch (skill_target) {
 			switch (skill_target) {
 				case MST_RANDOM: //Pick a random enemy within skill range.
 				case MST_RANDOM: //Pick a random enemy within skill range.
 					bl = battle_getenemy(&md->bl, DEFAULT_ENEMY_TYPE(md),
 					bl = battle_getenemy(&md->bl, DEFAULT_ENEMY_TYPE(md),

+ 8 - 8
src/map/mob.hpp

@@ -192,14 +192,14 @@ enum e_aegis_monsterclass : int8 {
 struct s_mob_skill {
 struct s_mob_skill {
 	enum MobSkillState state;
 	enum MobSkillState state;
 	uint16 skill_id,skill_lv;
 	uint16 skill_id,skill_lv;
-	short permillage;
+	int16 permillage;
 	int32 casttime,delay;
 	int32 casttime,delay;
-	short cancel;
-	short cond1;
+	int16 cancel;
+	int16 cond1;
 	int64 cond2;
 	int64 cond2;
-	short target;
+	int16 target;
 	int32 val[5];
 	int32 val[5];
-	short emotion;
+	int16 emotion;
 	uint16 msg_id;
 	uint16 msg_id;
 };
 };
 
 
@@ -359,15 +359,15 @@ struct mob_data {
 	int32 spawn_timer; //Required for Convex Mirror
 	int32 spawn_timer; //Required for Convex Mirror
 	int16 centerX, centerY; // Spawn center of this individual monster
 	int16 centerX, centerY; // Spawn center of this individual monster
 	struct s_mob_lootitem *lootitems;
 	struct s_mob_lootitem *lootitems;
-	short mob_id;
+	int16 mob_id;
 	int32 level;
 	int32 level;
 	int32 target_id,attacked_id,norm_attacked_id;
 	int32 target_id,attacked_id,norm_attacked_id;
 	int32 areanpc_id; //Required in OnTouchNPC (to avoid multiple area touchs)
 	int32 areanpc_id; //Required in OnTouchNPC (to avoid multiple area touchs)
 	int32 bg_id; // BattleGround System
 	int32 bg_id; // BattleGround System
 
 
 	t_tick next_walktime,last_thinktime,last_linktime,last_pcneartime,dmgtick,last_canmove,last_skillcheck;
 	t_tick next_walktime,last_thinktime,last_linktime,last_pcneartime,dmgtick,last_canmove,last_skillcheck;
-	short move_fail_count;
-	short lootitem_count;
+	int16 move_fail_count;
+	int16 lootitem_count;
 	unsigned char walktoxy_fail_count; //Pathfinding succeeds but the actual walking failed (e.g. Icewall lock)
 	unsigned char walktoxy_fail_count; //Pathfinding succeeds but the actual walking failed (e.g. Icewall lock)
 
 
 	int32 deletetimer;
 	int32 deletetimer;

+ 5 - 5
src/map/navi.cpp

@@ -41,11 +41,11 @@ std::string filePrefix = "generated/clientside/data/luafiles514/lua files/naviga
 // Path node
 // Path node
 struct path_node {
 struct path_node {
 	struct path_node *parent; // pointer to parent
 	struct path_node *parent; // pointer to parent
-	short x; // x coord
-	short y; // y coord
-	short g_cost; // Actual cost from start to this node
-	short f_cost; // g_cost + heuristic(this, goal)
-	short flag; // SET_OPEN / SET_CLOSED
+	int16 x; // x coord
+	int16 y; // y coord
+	int16 g_cost; // Actual cost from start to this node
+	int16 f_cost; // g_cost + heuristic(this, goal)
+	int16 flag; // SET_OPEN / SET_CLOSED
 };
 };
 
 
 /// Binary heap of path nodes
 /// Binary heap of path nodes

+ 10 - 10
src/map/npc.cpp

@@ -3798,7 +3798,7 @@ struct npc_data *npc_create_npc(int16 m, int16 x, int16 y){
  * @param to_y : y coordinate to warp to
  * @param to_y : y coordinate to warp to
  * @return nullptr:failed creation, npc_data* new warp
  * @return nullptr:failed creation, npc_data* new warp
  */
  */
-struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, uint16 to_mapindex, short to_x, short to_y)
+struct npc_data* npc_add_warp(char* name, int16 from_mapid, int16 from_x, int16 from_y, int16 xs, int16 ys, uint16 to_mapindex, int16 to_x, int16 to_y)
 {
 {
 	int32 i, flag = 0;
 	int32 i, flag = 0;
 	struct npc_data *nd;
 	struct npc_data *nd;
@@ -3859,7 +3859,7 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short
  */
  */
 static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 {
 {
-	short x, y, xs, ys, to_x, to_y;
+	int16 x, y, xs, ys, to_x, to_y;
 	char mapname[MAP_NAME_LENGTH_EXT], to_mapname[MAP_NAME_LENGTH_EXT];
 	char mapname[MAP_NAME_LENGTH_EXT], to_mapname[MAP_NAME_LENGTH_EXT];
 
 
 	// w1=<from map name>,<fromX>,<fromY>,<facing>
 	// w1=<from map name>,<fromX>,<fromY>,<facing>
@@ -3971,7 +3971,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 	char *p, point_str[32];
 	char *p, point_str[32];
 	int32 m, is_discount = 0;
 	int32 m, is_discount = 0;
 	uint16 dir;
 	uint16 dir;
-	short x, y;
+	int16 x, y;
 	t_itemid nameid = 0;
 	t_itemid nameid = 0;
 	struct npc_data *nd;
 	struct npc_data *nd;
 	enum npc_subtype type;
 	enum npc_subtype type;
@@ -4348,7 +4348,7 @@ static const char* npc_skip_script(const char* start, const char* buffer, const
  */
  */
 static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath) {
 static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath) {
 	int16 dir = 0;
 	int16 dir = 0;
-	short m, x, y, xs = 0, ys = 0; // [Valaris] thanks to fov
+	int16 m, x, y, xs = 0, ys = 0; // [Valaris] thanks to fov
 	struct script_code *script;
 	struct script_code *script;
 	int32 i;
 	int32 i;
 	const char* end;
 	const char* end;
@@ -4492,7 +4492,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
 /// npc: -%TAB%duplicate(<name of target>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
 /// npc: -%TAB%duplicate(<name of target>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
 /// npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<name of target>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
 /// npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<name of target>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
 const char* npc_parse_duplicate( char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, map_session_data* owner = nullptr ){
 const char* npc_parse_duplicate( char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, map_session_data* owner = nullptr ){
-	short x, y, m, xs = -1, ys = -1;
+	int16 x, y, m, xs = -1, ys = -1;
 	int16 dir;
 	int16 dir;
 	char srcname[128];
 	char srcname[128];
 	int32 i;
 	int32 i;
@@ -5048,7 +5048,7 @@ void npc_setdisplayname(struct npc_data* nd, const char* newname)
 ///
 ///
 /// @param nd Target npc
 /// @param nd Target npc
 /// @param class_ New display class
 /// @param class_ New display class
-void npc_setclass(struct npc_data* nd, short class_)
+void npc_setclass(struct npc_data* nd, int16 class_)
 {
 {
 	nullpo_retv(nd);
 	nullpo_retv(nd);
 
 
@@ -5189,7 +5189,7 @@ void npc_parse_mob2(struct spawn_data* mob)
 static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 {
 {
 	int32 num, mob_id, mob_lv = -1, delay = 5000, size = -1, w1count, w4count;
 	int32 num, mob_id, mob_lv = -1, delay = 5000, size = -1, w1count, w4count;
-	short m, x = 0, y = 0, xs = 0, ys = 0;
+	int16 m, x = 0, y = 0, xs = 0, ys = 0;
 	char mapname[MAP_NAME_LENGTH_EXT], mobname[NAME_LENGTH], sprite[NAME_LENGTH];
 	char mapname[MAP_NAME_LENGTH_EXT], mobname[NAME_LENGTH], sprite[NAME_LENGTH];
 	struct spawn_data mob, *data;
 	struct spawn_data mob, *data;
 	int32 ai = AI_NONE; // mob_ai
 	int32 ai = AI_NONE; // mob_ai
@@ -5277,11 +5277,11 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c
 
 
 	mob.num = (uint16)num;
 	mob.num = (uint16)num;
 	mob.active = 0;
 	mob.active = 0;
-	mob.id = (short) mob_id;
+	mob.id = (int16) mob_id;
 	mob.x = (uint16)x;
 	mob.x = (uint16)x;
 	mob.y = (uint16)y;
 	mob.y = (uint16)y;
-	mob.xs = (signed short)xs;
-	mob.ys = (signed short)ys;
+	mob.xs = (int16)xs;
+	mob.ys = (int16)ys;
 	if (mob_lv > 0 && mob_lv <= MAX_LEVEL)
 	if (mob_lv > 0 && mob_lv <= MAX_LEVEL)
 		mob.level = mob_lv;
 		mob.level = mob_lv;
 	if (size > SZ_SMALL && size <= SZ_BIG)
 	if (size > SZ_SMALL && size <= SZ_BIG)

+ 6 - 6
src/map/npc.hpp

@@ -160,7 +160,7 @@ struct npc_data {
 	struct view_data vd;
 	struct view_data vd;
 	status_change sc; //They can't have status changes, but.. they want the visual opt values.
 	status_change sc; //They can't have status changes, but.. they want the visual opt values.
 	struct npc_data *master_nd;
 	struct npc_data *master_nd;
-	short class_,speed;
+	int16 class_,speed;
 	char name[NPC_NAME_LENGTH+1];// display name
 	char name[NPC_NAME_LENGTH+1];// display name
 	char exname[NPC_NAME_LENGTH+1];// unique npc name
 	char exname[NPC_NAME_LENGTH+1];// unique npc name
 	int32 chat_id,touching_id;
 	int32 chat_id,touching_id;
@@ -184,7 +184,7 @@ struct npc_data {
 	union {
 	union {
 		struct {
 		struct {
 			struct script_code *script;
 			struct script_code *script;
-			short xs,ys; // OnTouch area radius
+			int16 xs,ys; // OnTouch area radius
 			int32 guild_id;
 			int32 guild_id;
 			t_tick timer;
 			t_tick timer;
 			int32 timerid,timeramount,rid;
 			int32 timerid,timeramount,rid;
@@ -201,8 +201,8 @@ struct npc_data {
 			bool discount;
 			bool discount;
 		} shop;
 		} shop;
 		struct {
 		struct {
-			short xs,ys; // OnTouch area radius
-			short x,y; // destination coords
+			int16 xs,ys; // OnTouch area radius
+			int16 x,y; // destination coords
 			uint16 mapindex; // destination map
 			uint16 mapindex; // destination map
 		} warp;
 		} warp;
 		struct {
 		struct {
@@ -1591,7 +1591,7 @@ static int32 npc_buylist_sub(map_session_data* sd, std::vector<s_npc_buy_list>&
 uint8 npc_selllist(map_session_data* sd, int32 list_length, const PACKET_CZ_PC_SELL_ITEMLIST_sub* item_list);
 uint8 npc_selllist(map_session_data* sd, int32 list_length, const PACKET_CZ_PC_SELL_ITEMLIST_sub* item_list);
 e_purchase_result npc_barter_purchase( map_session_data& sd, std::shared_ptr<s_npc_barter> barter, std::vector<s_barter_purchase>& purchases );
 e_purchase_result npc_barter_purchase( map_session_data& sd, std::shared_ptr<s_npc_barter> barter, std::vector<s_barter_purchase>& purchases );
 void npc_parse_mob2(struct spawn_data* mob);
 void npc_parse_mob2(struct spawn_data* mob);
-struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, uint16 to_mapindex, short to_x, short to_y);
+struct npc_data* npc_add_warp(char* name, int16 from_mapid, int16 from_x, int16 from_y, int16 xs, int16 ys, uint16 to_mapindex, int16 to_x, int16 to_y);
 int32 npc_globalmessage(const char* name,const char* mes);
 int32 npc_globalmessage(const char* name,const char* mes);
 const char *npc_get_script_event_name(int32 npce_index);
 const char *npc_get_script_event_name(int32 npce_index);
 npc_data* npc_duplicate_npc( npc_data& nd, char name[NPC_NAME_LENGTH + 1], int16 mapid, int16 x, int16 y, int32 class_, uint8 dir, int16 xs, int16 ys, map_session_data* owner = nullptr );
 npc_data* npc_duplicate_npc( npc_data& nd, char name[NPC_NAME_LENGTH + 1], int16 mapid, int16 x, int16 y, int32 class_, uint8 dir, int16 xs, int16 ys, map_session_data* owner = nullptr );
@@ -1605,7 +1605,7 @@ bool npc_is_hidden_dynamicnpc( struct npc_data& nd, map_session_data& tsd );
 bool npc_enable_target(npc_data& nd, uint32 char_id, e_npcv_status flag);
 bool npc_enable_target(npc_data& nd, uint32 char_id, e_npcv_status flag);
 #define npc_enable(nd, flag) npc_enable_target(nd, 0, flag)
 #define npc_enable(nd, flag) npc_enable_target(nd, 0, flag)
 void npc_setdisplayname(struct npc_data* nd, const char* newname);
 void npc_setdisplayname(struct npc_data* nd, const char* newname);
-void npc_setclass(struct npc_data* nd, short class_);
+void npc_setclass(struct npc_data* nd, int16 class_);
 struct npc_data* npc_name2id(const char* name);
 struct npc_data* npc_name2id(const char* name);
 int32 npc_isnear_sub(struct block_list* bl, va_list args);
 int32 npc_isnear_sub(struct block_list* bl, va_list args);
 bool npc_isnear(struct block_list * bl);
 bool npc_isnear(struct block_list * bl);

+ 3 - 3
src/map/party.cpp

@@ -1474,7 +1474,7 @@ static struct party_booking_ad_info* create_party_booking_data(void)
 	return pb_ad;
 	return pb_ad;
 }
 }
 
 
-void party_booking_register(map_session_data *sd, short level, short mapid, short* job)
+void party_booking_register(map_session_data *sd, int16 level, int16 mapid, int16* job)
 {
 {
 	struct party_booking_ad_info *pb_ad;
 	struct party_booking_ad_info *pb_ad;
 	int32 i;
 	int32 i;
@@ -1503,7 +1503,7 @@ void party_booking_register(map_session_data *sd, short level, short mapid, shor
 	clif_PartyBookingInsertNotify(sd, pb_ad); // Notice
 	clif_PartyBookingInsertNotify(sd, pb_ad); // Notice
 }
 }
 
 
-void party_booking_update(map_session_data *sd, short* job)
+void party_booking_update(map_session_data *sd, int16* job)
 {
 {
 	int32 i;
 	int32 i;
 	struct party_booking_ad_info *pb_ad;
 	struct party_booking_ad_info *pb_ad;
@@ -1524,7 +1524,7 @@ void party_booking_update(map_session_data *sd, short* job)
 	clif_PartyBookingUpdateNotify(sd, pb_ad);
 	clif_PartyBookingUpdateNotify(sd, pb_ad);
 }
 }
 
 
-void party_booking_search(map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount)
+void party_booking_search(map_session_data *sd, int16 level, int16 mapid, int16 job, unsigned long lastindex, int16 resultcount)
 {
 {
 	struct party_booking_ad_info *pb_ad;
 	struct party_booking_ad_info *pb_ad;
 	int32 i, count=0;
 	int32 i, count=0;

+ 6 - 6
src/map/party.hpp

@@ -36,9 +36,9 @@ struct party_data {
 };
 };
 
 
 struct party_booking_detail {
 struct party_booking_detail {
-	short level;
-    short mapid;
-    short job[MAX_PARTY_BOOKING_JOBS];
+	int16 level;
+	int16 mapid;
+	int16 job[MAX_PARTY_BOOKING_JOBS];
 };
 };
 
 
 struct party_booking_ad_info {
 struct party_booking_ad_info {
@@ -102,9 +102,9 @@ int32 party_foreachsamemap(int32 (*func)(struct block_list *,va_list),map_sessio
 /*==========================================
 /*==========================================
  * Party Booking in KRO [Spiria]
  * Party Booking in KRO [Spiria]
  *------------------------------------------*/
  *------------------------------------------*/
-void party_booking_register(map_session_data *sd, short level, short mapid, short* job);
-void party_booking_update(map_session_data *sd, short* job);
-void party_booking_search(map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount);
+void party_booking_register(map_session_data *sd, int16 level, int16 mapid, int16* job);
+void party_booking_update(map_session_data *sd, int16* job);
+void party_booking_search(map_session_data *sd, int16 level, int16 mapid, int16 job, unsigned long lastindex, int16 resultcount);
 bool party_booking_delete(map_session_data *sd);
 bool party_booking_delete(map_session_data *sd);
 
 
 #endif /* PARTY_HPP */
 #endif /* PARTY_HPP */

+ 6 - 6
src/map/path.cpp

@@ -32,11 +32,11 @@
 /// Path node
 /// Path node
 struct path_node {
 struct path_node {
 	struct path_node *parent; ///< pointer to parent (for path reconstruction)
 	struct path_node *parent; ///< pointer to parent (for path reconstruction)
-	short x; ///< X-coordinate
-	short y; ///< Y-coordinate
-	short g_cost; ///< Actual cost from start to this node
-	short f_cost; ///< g_cost + heuristic(this, goal)
-	short flag; ///< SET_OPEN / SET_CLOSED
+	int16 x; ///< X-coordinate
+	int16 y; ///< Y-coordinate
+	int16 g_cost; ///< Actual cost from start to this node
+	int16 f_cost; ///< g_cost + heuristic(this, goal)
+	int16 flag; ///< SET_OPEN / SET_CLOSED
 };
 };
 
 
 /// Binary heap of path nodes
 /// Binary heap of path nodes
@@ -324,7 +324,7 @@ bool path_search(struct walkpath_data *wpd, int16 m, int16 x0, int16 y0, int16 x
 
 
 		return false; // easy path unsuccessful
 		return false; // easy path unsuccessful
 	} else { // !(flag&1)
 	} else { // !(flag&1)
-		// FIXME: This array is too small to ensure all paths shorter than MAX_WALKPATH
+		// FIXME: This array is too small to ensure all paths int16er than MAX_WALKPATH
 		// can be found without node collision: calc_index(node1) = calc_index(node2).
 		// can be found without node collision: calc_index(node1) = calc_index(node2).
 		// Figure out more proper size or another way to keep track of known nodes.
 		// Figure out more proper size or another way to keep track of known nodes.
 		struct path_node tp[MAX_WALKPATH * MAX_WALKPATH];
 		struct path_node tp[MAX_WALKPATH * MAX_WALKPATH];

+ 39 - 39
src/map/pc.cpp

@@ -1567,7 +1567,7 @@ bool pc_isequipped(map_session_data *sd, t_itemid nameid)
 
 
 	for( i = 0; i < EQI_MAX; i++ )
 	for( i = 0; i < EQI_MAX; i++ )
 	{
 	{
-		short index = sd->equip_index[i], j;
+		int16 index = sd->equip_index[i], j;
 		if( index < 0 )
 		if( index < 0 )
 			continue;
 			continue;
 		if( pc_is_same_equip_index((enum equip_index)i, sd->equip_index, index) )
 		if( pc_is_same_equip_index((enum equip_index)i, sd->equip_index, index) )
@@ -2304,11 +2304,11 @@ void pc_reg_received(map_session_data *sd)
 	sd->kafraPoints = static_cast<int32>(pc_readaccountreg(sd, add_str(KAFRAPOINT_VAR)));
 	sd->kafraPoints = static_cast<int32>(pc_readaccountreg(sd, add_str(KAFRAPOINT_VAR)));
 
 
 	// Cooking Exp
 	// Cooking Exp
-	sd->cook_mastery = static_cast<short>(pc_readglobalreg(sd, add_str(COOKMASTERY_VAR)));
+	sd->cook_mastery = static_cast<int16>(pc_readglobalreg(sd, add_str(COOKMASTERY_VAR)));
 
 
 	if( (sd->class_&MAPID_BASEMASK) == MAPID_TAEKWON )
 	if( (sd->class_&MAPID_BASEMASK) == MAPID_TAEKWON )
 	{ // Better check for class rather than skill to prevent "skill resets" from unsetting this
 	{ // Better check for class rather than skill to prevent "skill resets" from unsetting this
-		sd->mission_mobid = static_cast<short>(pc_readglobalreg(sd, add_str(TKMISSIONID_VAR)));
+		sd->mission_mobid = static_cast<int16>(pc_readglobalreg(sd, add_str(TKMISSIONID_VAR)));
 		sd->mission_count = static_cast<unsigned char>(pc_readglobalreg(sd, add_str(TKMISSIONCOUNT_VAR)));
 		sd->mission_count = static_cast<unsigned char>(pc_readglobalreg(sd, add_str(TKMISSIONCOUNT_VAR)));
 	}
 	}
 
 
@@ -2333,7 +2333,7 @@ void pc_reg_received(map_session_data *sd)
 			sd->feel_map[i].index = 0;
 			sd->feel_map[i].index = 0;
 			sd->feel_map[i].m = -1;
 			sd->feel_map[i].m = -1;
 		}
 		}
-		sd->hate_mob[i] = static_cast<short>(pc_readglobalreg(sd, add_str(sg_info[i].hate_var)))-1;
+		sd->hate_mob[i] = static_cast<int16>(pc_readglobalreg(sd, add_str(sg_info[i].hate_var)))-1;
 	}
 	}
 
 
 	if ((i = pc_checkskill(sd,RG_PLAGIARISM)) > 0) {
 	if ((i = pc_checkskill(sd,RG_PLAGIARISM)) > 0) {
@@ -2767,7 +2767,7 @@ static void pc_check_skilltree(map_session_data *sd)
 					uint16 sk_need_idx = skill_get_index(sk_need_id);
 					uint16 sk_need_idx = skill_get_index(sk_need_id);
 
 
 					if (sk_need_id > 0) {
 					if (sk_need_id > 0) {
-						short sk_need = sk_need_id;
+						int16 sk_need = sk_need_id;
 
 
 						if (sd->status.skill[sk_need_idx].id == 0 || sd->status.skill[sk_need_idx].flag == SKILL_FLAG_TEMPORARY || sd->status.skill[sk_need_idx].flag == SKILL_FLAG_PLAGIARIZED)
 						if (sd->status.skill[sk_need_idx].id == 0 || sd->status.skill[sk_need_idx].flag == SKILL_FLAG_TEMPORARY || sd->status.skill[sk_need_idx].flag == SKILL_FLAG_PLAGIARIZED)
 							sk_need = 0; //Not learned.
 							sk_need = 0; //Not learned.
@@ -3054,7 +3054,7 @@ int32 pc_disguise(map_session_data *sd, int32 class_)
  *              &1: forces the skill to be casted on target, rather than self
  *              &1: forces the skill to be casted on target, rather than self
  *              &2: random skill level in [1..lv] is chosen
  *              &2: random skill level in [1..lv] is chosen
  */
  */
-static void pc_bonus_autospell(std::vector<s_autospell> &spell, uint16 id, uint16 lv, short rate, short battle_flag, t_itemid card_id, uint8 flag)
+static void pc_bonus_autospell(std::vector<s_autospell> &spell, uint16 id, uint16 lv, int16 rate, int16 battle_flag, t_itemid card_id, uint8 flag)
 {
 {
 	if (spell.size() == MAX_PC_BONUS) {
 	if (spell.size() == MAX_PC_BONUS) {
 		ShowWarning("pc_bonus_autospell: Reached max (%d) number of autospells per character!\n", MAX_PC_BONUS);
 		ShowWarning("pc_bonus_autospell: Reached max (%d) number of autospells per character!\n", MAX_PC_BONUS);
@@ -3079,7 +3079,7 @@ static void pc_bonus_autospell(std::vector<s_autospell> &spell, uint16 id, uint1
 		if ((it.card_id == card_id || it.rate < 0 || rate < 0) && it.id == id && it.lv == lv && it.battle_flag == battle_flag && it.flag == flag) {
 		if ((it.card_id == card_id || it.rate < 0 || rate < 0) && it.id == id && it.lv == lv && it.battle_flag == battle_flag && it.flag == flag) {
 			if (!battle_config.autospell_stacking && it.rate > 0 && rate > 0) // Stacking disabled
 			if (!battle_config.autospell_stacking && it.rate > 0 && rate > 0) // Stacking disabled
 				return;
 				return;
-			it.rate = util::safe_addition_cap(it.rate, rate, (short)1000);
+			it.rate = util::safe_addition_cap(it.rate, rate, (int16)1000);
 			return;
 			return;
 		}
 		}
 	}
 	}
@@ -3108,7 +3108,7 @@ static void pc_bonus_autospell(std::vector<s_autospell> &spell, uint16 id, uint1
  *              &1: forces the skill to be casted on self, rather than on the target of skill
  *              &1: forces the skill to be casted on self, rather than on the target of skill
  *              &2: random skill level in [1..lv] is chosen
  *              &2: random skill level in [1..lv] is chosen
  */
  */
-static void pc_bonus_autospell_onskill(std::vector<s_autospell> &spell, uint16 src_skill, uint16 id, uint16 lv, short rate, t_itemid card_id, uint8 flag)
+static void pc_bonus_autospell_onskill(std::vector<s_autospell> &spell, uint16 src_skill, uint16 id, uint16 lv, int16 rate, t_itemid card_id, uint8 flag)
 {
 {
 	if (spell.size() == MAX_PC_BONUS) {
 	if (spell.size() == MAX_PC_BONUS) {
 		ShowWarning("pc_bonus_autospell_onskill: Reached max (%d) number of autospells per character!\n", MAX_PC_BONUS);
 		ShowWarning("pc_bonus_autospell_onskill: Reached max (%d) number of autospells per character!\n", MAX_PC_BONUS);
@@ -3139,7 +3139,7 @@ static void pc_bonus_autospell_onskill(std::vector<s_autospell> &spell, uint16 s
  * @param flag: Target flag
  * @param flag: Target flag
  * @param duration: Duration. If 0 use default duration lookup for associated skill with level 7
  * @param duration: Duration. If 0 use default duration lookup for associated skill with level 7
  */
  */
-static void pc_bonus_addeff(std::vector<s_addeffect> &effect, enum sc_type sc, int32 rate, short arrow_rate, unsigned char flag, uint32 duration)
+static void pc_bonus_addeff(std::vector<s_addeffect> &effect, enum sc_type sc, int32 rate, int16 arrow_rate, unsigned char flag, uint32 duration)
 {
 {
 	if (effect.size() == MAX_PC_BONUS) {
 	if (effect.size() == MAX_PC_BONUS) {
 		ShowWarning("pc_bonus_addeff: Reached max (%d) number of add effects per character!\n", MAX_PC_BONUS);
 		ShowWarning("pc_bonus_addeff: Reached max (%d) number of add effects per character!\n", MAX_PC_BONUS);
@@ -3159,7 +3159,7 @@ static void pc_bonus_addeff(std::vector<s_addeffect> &effect, enum sc_type sc, i
 	for (auto &it : effect) {
 	for (auto &it : effect) {
 		if (it.sc == sc && it.flag == flag) {
 		if (it.sc == sc && it.flag == flag) {
 			it.rate = util::safe_addition_cap(it.rate, rate, INT_MAX);
 			it.rate = util::safe_addition_cap(it.rate, rate, INT_MAX);
-			it.arrow_rate = util::safe_addition_cap(it.arrow_rate, arrow_rate, (short)SHRT_MAX);
+			it.arrow_rate = util::safe_addition_cap(it.arrow_rate, arrow_rate, (int16)SHRT_MAX);
 			it.duration = umax(it.duration, duration);
 			it.duration = umax(it.duration, duration);
 			return;
 			return;
 		}
 		}
@@ -3185,7 +3185,7 @@ static void pc_bonus_addeff(std::vector<s_addeffect> &effect, enum sc_type sc, i
  * @param target: Target type
  * @param target: Target type
  * @param duration: Duration. If 0 use default duration lookup for associated skill with level 7
  * @param duration: Duration. If 0 use default duration lookup for associated skill with level 7
  */
  */
-static void pc_bonus_addeff_onskill(std::vector<s_addeffectonskill> &effect, enum sc_type sc, int32 rate, short skill_id, unsigned char target, uint32 duration)
+static void pc_bonus_addeff_onskill(std::vector<s_addeffectonskill> &effect, enum sc_type sc, int32 rate, int16 skill_id, unsigned char target, uint32 duration)
 {
 {
 	if (effect.size() == MAX_PC_BONUS) {
 	if (effect.size() == MAX_PC_BONUS) {
 		ShowWarning("pc_bonus_addeff_onskill: Reached max (%d) number of add effects per character!\n", MAX_PC_BONUS);
 		ShowWarning("pc_bonus_addeff_onskill: Reached max (%d) number of add effects per character!\n", MAX_PC_BONUS);
@@ -3223,7 +3223,7 @@ static void pc_bonus_addeff_onskill(std::vector<s_addeffectonskill> &effect, enu
  * @param race: target race. if < 0, means monster_id
  * @param race: target race. if < 0, means monster_id
  * @param rate: rate value: 1 ~ 10000. If < 0, it will be multiplied with mob level/10
  * @param rate: rate value: 1 ~ 10000. If < 0, it will be multiplied with mob level/10
  */
  */
-static void pc_bonus_item_drop(std::vector<s_add_drop> &drop, t_itemid nameid, uint16 group, int32 class_, short race, int32 rate)
+static void pc_bonus_item_drop(std::vector<s_add_drop> &drop, t_itemid nameid, uint16 group, int32 class_, int16 race, int32 rate)
 {
 {
 	if (!nameid && !group) {
 	if (!nameid && !group) {
 		ShowWarning("pc_bonus_item_drop: No Item ID nor Item Group ID specified.\n");
 		ShowWarning("pc_bonus_item_drop: No Item ID nor Item Group ID specified.\n");
@@ -3306,7 +3306,7 @@ s_autobonus::~s_autobonus(){
  * @param onskill: Skill used to trigger autobonus
  * @param onskill: Skill used to trigger autobonus
  * @return True on success or false otherwise
  * @return True on success or false otherwise
  */
  */
-bool pc_addautobonus(std::vector<std::shared_ptr<s_autobonus>> &bonus, const char *script, short rate, uint32 dur, uint16 flag, const char *other_script, uint32 pos, bool onskill){
+bool pc_addautobonus(std::vector<std::shared_ptr<s_autobonus>> &bonus, const char *script, int16 rate, uint32 dur, uint16 flag, const char *other_script, uint32 pos, bool onskill){
 	// Check if the same bonus already exists
 	// Check if the same bonus already exists
 	for( std::shared_ptr<s_autobonus> autobonus : bonus ){
 	for( std::shared_ptr<s_autobonus> autobonus : bonus ){
 		// Compare based on position and bonus script
 		// Compare based on position and bonus script
@@ -3444,7 +3444,7 @@ TIMER_FUNC(pc_endautobonus){
  * @param rate: Success chance
  * @param rate: Success chance
  * @param flag: Battle flag
  * @param flag: Battle flag
  */
  */
-static void pc_bonus_addele(map_session_data* sd, unsigned char ele, short rate, short flag)
+static void pc_bonus_addele(map_session_data* sd, unsigned char ele, int16 rate, int16 flag)
 {
 {
 	nullpo_retv(sd);
 	nullpo_retv(sd);
 
 
@@ -3468,7 +3468,7 @@ static void pc_bonus_addele(map_session_data* sd, unsigned char ele, short rate,
 
 
 	for (auto &it : wd->addele2) {
 	for (auto &it : wd->addele2) {
 		if (it.ele == ele && it.flag == flag) {
 		if (it.ele == ele && it.flag == flag) {
-			it.rate = util::safe_addition_cap(it.rate, rate, (short)10000);
+			it.rate = util::safe_addition_cap(it.rate, rate, (int16)10000);
 			return;
 			return;
 		}
 		}
 	}
 	}
@@ -3489,7 +3489,7 @@ static void pc_bonus_addele(map_session_data* sd, unsigned char ele, short rate,
  * @param rate: Success chance
  * @param rate: Success chance
  * @param flag: Battle flag
  * @param flag: Battle flag
  */
  */
-static void pc_bonus_subele(map_session_data* sd, unsigned char ele, short rate, short flag)
+static void pc_bonus_subele(map_session_data* sd, unsigned char ele, int16 rate, int16 flag)
 {
 {
 	nullpo_retv(sd);
 	nullpo_retv(sd);
 
 
@@ -3511,7 +3511,7 @@ static void pc_bonus_subele(map_session_data* sd, unsigned char ele, short rate,
 
 
 	for (auto &it : sd->subele2) {
 	for (auto &it : sd->subele2) {
 		if (it.ele == ele && it.flag == flag) {
 		if (it.ele == ele && it.flag == flag) {
-			it.rate = util::safe_addition_cap(it.rate, rate, (short)10000);
+			it.rate = util::safe_addition_cap(it.rate, rate, (int16)10000);
 			return;
 			return;
 		}
 		}
 	}
 	}
@@ -3532,7 +3532,7 @@ static void pc_bonus_subele(map_session_data* sd, unsigned char ele, short rate,
  * @param rate: Success chance
  * @param rate: Success chance
  * @param flag: Battle flag
  * @param flag: Battle flag
 */
 */
-static void pc_bonus_subrace(map_session_data* sd, unsigned char race, short rate, short flag)
+static void pc_bonus_subrace(map_session_data* sd, unsigned char race, int16 rate, int16 flag)
 {
 {
 	if (sd->subrace3.size() == MAX_PC_BONUS) {
 	if (sd->subrace3.size() == MAX_PC_BONUS) {
 		ShowWarning("pc_bonus_subrace: Reached max (%d) number of resist race damage bonuses per character!\n", MAX_PC_BONUS);
 		ShowWarning("pc_bonus_subrace: Reached max (%d) number of resist race damage bonuses per character!\n", MAX_PC_BONUS);
@@ -3552,7 +3552,7 @@ static void pc_bonus_subrace(map_session_data* sd, unsigned char race, short rat
 
 
 	for (auto &it : sd->subrace3) {
 	for (auto &it : sd->subrace3) {
 		if (it.race == race && it.flag == flag) {
 		if (it.race == race && it.flag == flag) {
-			it.rate = util::safe_addition_cap(it.rate, rate, (short)10000);
+			it.rate = util::safe_addition_cap(it.rate, rate, (int16)10000);
 			return;
 			return;
 		}
 		}
 	}
 	}
@@ -5848,8 +5848,8 @@ int32 pc_getcash(map_session_data *sd, int32 cash, int32 points, e_log_pick_type
  * @param nameid Find this Item!
  * @param nameid Find this Item!
  * @return Stored index in inventory, or -1 if not found.
  * @return Stored index in inventory, or -1 if not found.
  **/
  **/
-short pc_search_inventory(map_session_data *sd, t_itemid nameid) {
-	short i;
+int16 pc_search_inventory(map_session_data *sd, t_itemid nameid) {
+	int16 i;
 	nullpo_retr(-1, sd);
 	nullpo_retr(-1, sd);
 
 
 	ARR_FIND( 0, MAX_INVENTORY, i, sd->inventory.u.items_inventory[i].nameid == nameid && (sd->inventory.u.items_inventory[i].amount > 0 || nameid == 0) );
 	ARR_FIND( 0, MAX_INVENTORY, i, sd->inventory.u.items_inventory[i].nameid == nameid && (sd->inventory.u.items_inventory[i].amount > 0 || nameid == 0) );
@@ -5984,7 +5984,7 @@ enum e_additem_result pc_additem(map_session_data *sd,struct item *item,int32 am
  * @param log_type e_log_pick_type
  * @param log_type e_log_pick_type
  * @return 1 - invalid itemid or negative amount; 0 - Success
  * @return 1 - invalid itemid or negative amount; 0 - Success
  *------------------------------------------*/
  *------------------------------------------*/
-char pc_delitem(map_session_data *sd,int32 n,int32 amount,int32 type, short reason, e_log_pick_type log_type)
+char pc_delitem(map_session_data *sd,int32 n,int32 amount,int32 type, int16 reason, e_log_pick_type log_type)
 {
 {
 	nullpo_retr(1, sd);
 	nullpo_retr(1, sd);
 
 
@@ -6932,7 +6932,7 @@ enum e_setpos pc_setpos(map_session_data* sd, uint16 mapindex, int32 x, int32 y,
 		sd->bl.y=y;
 		sd->bl.y=y;
 		pc_clean_skilltree(sd);
 		pc_clean_skilltree(sd);
 		chrif_save(sd, CSAVE_CHANGE_MAPSERV|CSAVE_INVENTORY|CSAVE_CART);
 		chrif_save(sd, CSAVE_CHANGE_MAPSERV|CSAVE_INVENTORY|CSAVE_CART);
-		chrif_changemapserver(sd, ip, (short)port);
+		chrif_changemapserver(sd, ip, (int16)port);
 
 
 		//Free session data from this map server [Kevin]
 		//Free session data from this map server [Kevin]
 		unit_free_pc(sd);
 		unit_free_pc(sd);
@@ -7272,7 +7272,7 @@ uint8 pc_checkskill_summoner(map_session_data *sd, e_summoner_power_type type) {
  *		Flag&1 = IG_SHIELD_MASTERY
  *		Flag&1 = IG_SHIELD_MASTERY
  *		Flag&2 = IG_SPEAR_SWORD_M
  *		Flag&2 = IG_SPEAR_SWORD_M
  */
  */
-uint8 pc_checkskill_imperial_guard(map_session_data *sd, short flag)
+uint8 pc_checkskill_imperial_guard(map_session_data *sd, int16 flag)
 {
 {
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
 
 
@@ -7328,7 +7328,7 @@ static void pc_checkallowskill(map_session_data *sd)
  * -1 : Nothing equipped
  * -1 : Nothing equipped
  * idx : (this index could be used in inventory to found item_data)
  * idx : (this index could be used in inventory to found item_data)
  *------------------------------------------*/
  *------------------------------------------*/
-short pc_checkequip(map_session_data *sd,int32 pos, bool checkall)
+int16 pc_checkequip(map_session_data *sd,int32 pos, bool checkall)
 {
 {
 	uint8 i;
 	uint8 i;
 
 
@@ -9899,7 +9899,7 @@ int32 pc_dead(map_session_data *sd,struct block_list *src)
 			job_penalty = 0;
 			job_penalty = 0;
 
 
 		if (base_penalty || job_penalty) {
 		if (base_penalty || job_penalty) {
-			short insurance_idx = pc_search_inventory(sd, ITEMID_NEW_INSURANCE);
+			int16 insurance_idx = pc_search_inventory(sd, ITEMID_NEW_INSURANCE);
 			if (insurance_idx < 0 || pc_delitem(sd, insurance_idx, 1, 0, 1, LOG_TYPE_CONSUME) != 0)
 			if (insurance_idx < 0 || pc_delitem(sd, insurance_idx, 1, 0, 1, LOG_TYPE_CONSUME) != 0)
 				pc_lostexp(sd, base_penalty, job_penalty);
 				pc_lostexp(sd, base_penalty, job_penalty);
 		}
 		}
@@ -11690,7 +11690,7 @@ static int32 pc_checkcombo(map_session_data *sd, item_data *data) {
 			bool found = false;
 			bool found = false;
 
 
 			for (int16 k = 0; k < EQI_MAX; k++) {
 			for (int16 k = 0; k < EQI_MAX; k++) {
-				short index = sd->equip_index[k];
+				int16 index = sd->equip_index[k];
 
 
 				if (index < 0)
 				if (index < 0)
 					continue;
 					continue;
@@ -11834,7 +11834,7 @@ int32 pc_load_combo(map_session_data *sd) {
 
 
 	for (int16 i = 0; i < EQI_MAX; i++) {
 	for (int16 i = 0; i < EQI_MAX; i++) {
 		item_data *id;
 		item_data *id;
-		short idx = sd->equip_index[i];
+		int16 idx = sd->equip_index[i];
 
 
 		if (idx < 0 || !(id = sd->inventory_data[idx]))
 		if (idx < 0 || !(id = sd->inventory_data[idx]))
 			continue;
 			continue;
@@ -11864,11 +11864,11 @@ int32 pc_load_combo(map_session_data *sd) {
  * Equip item on player sd at req_pos from inventory index n
  * Equip item on player sd at req_pos from inventory index n
  * return: false - fail; true - success
  * return: false - fail; true - success
  *------------------------------------------*/
  *------------------------------------------*/
-bool pc_equipitem(map_session_data *sd,short n,int32 req_pos,bool equipswitch)
+bool pc_equipitem(map_session_data *sd,int16 n,int32 req_pos,bool equipswitch)
 {
 {
 	int32 i, pos, flag = 0, iflag;
 	int32 i, pos, flag = 0, iflag;
 	struct item_data *id;
 	struct item_data *id;
-	short* equip_index;
+	int16* equip_index;
 
 
 	nullpo_retr(false,sd);
 	nullpo_retr(false,sd);
 
 
@@ -12051,7 +12051,7 @@ bool pc_equipitem(map_session_data *sd,short n,int32 req_pos,bool equipswitch)
 		clif_changelook(&sd->bl,LOOK_SHOES,0);
 		clif_changelook(&sd->bl,LOOK_SHOES,0);
 
 
 	if (battle_config.ammo_unequip && (pos&EQP_ARMS) && id->type == IT_WEAPON) {
 	if (battle_config.ammo_unequip && (pos&EQP_ARMS) && id->type == IT_WEAPON) {
-		short idx = sd->equip_index[EQI_AMMO];
+		int16 idx = sd->equip_index[EQI_AMMO];
 
 
 		if (idx >= 0) {
 		if (idx >= 0) {
 			switch (sd->inventory_data[idx]->subtype) {
 			switch (sd->inventory_data[idx]->subtype) {
@@ -12321,7 +12321,7 @@ bool pc_unequipitem(map_session_data *sd, int32 n, int32 flag) {
 				case W_GATLING:
 				case W_GATLING:
 				case W_SHOTGUN:
 				case W_SHOTGUN:
 				case W_GRENADE: {
 				case W_GRENADE: {
-					short idx = sd->equip_index[EQI_AMMO];
+					int16 idx = sd->equip_index[EQI_AMMO];
 
 
 					if (idx >= 0) {
 					if (idx >= 0) {
 						sd->equip_index[EQI_AMMO] = -1;
 						sd->equip_index[EQI_AMMO] = -1;
@@ -12361,7 +12361,7 @@ int32 pc_equipswitch( map_session_data* sd, int32 index ){
 	int32 position = sd->inventory.u.items_inventory[index].equipSwitch;
 	int32 position = sd->inventory.u.items_inventory[index].equipSwitch;
 
 
 	// Get the currently equipped item
 	// Get the currently equipped item
-	short equippedItem = pc_checkequip( sd, position, true );
+	int16 equippedItem = pc_checkequip( sd, position, true );
 
 
 	// No item equipped at the target
 	// No item equipped at the target
 	if( equippedItem == -1 ){
 	if( equippedItem == -1 ){
@@ -12846,7 +12846,7 @@ void pc_regen (map_session_data *sd, t_tick diff_tick)
 /*==========================================
 /*==========================================
  * Memo player sd savepoint. (map,x,y)
  * Memo player sd savepoint. (map,x,y)
  *------------------------------------------*/
  *------------------------------------------*/
-void pc_setsavepoint(map_session_data *sd, short mapindex,int32 x,int32 y)
+void pc_setsavepoint(map_session_data *sd, int16 mapindex,int32 x,int32 y)
 {
 {
 	nullpo_retv(sd);
 	nullpo_retv(sd);
 
 
@@ -14959,7 +14959,7 @@ uint16 pc_maxparameter(map_session_data *sd, e_params param) {
 * @param sd Player
 * @param sd Player
 * @return ASPD
 * @return ASPD
 */
 */
-short pc_maxaspd(map_session_data *sd) {
+int16 pc_maxaspd(map_session_data *sd) {
 	nullpo_ret(sd);
 	nullpo_ret(sd);
 
 
 	return (( sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : (
 	return (( sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : (
@@ -14974,11 +14974,11 @@ short pc_maxaspd(map_session_data *sd) {
 * @param nameid Item ID
 * @param nameid Item ID
 * @return Heal rate
 * @return Heal rate
 **/
 **/
-short pc_get_itemgroup_bonus(map_session_data* sd, t_itemid nameid, std::vector<s_item_bonus>& bonuses) {
+int16 pc_get_itemgroup_bonus(map_session_data* sd, t_itemid nameid, std::vector<s_item_bonus>& bonuses) {
 	if (bonuses.empty())
 	if (bonuses.empty())
 		return 0;
 		return 0;
 
 
-	short bonus = 0;
+	int16 bonus = 0;
 
 
 	for (const auto &it : bonuses) {
 	for (const auto &it : bonuses) {
 		uint16 group_id = it.id;
 		uint16 group_id = it.id;
@@ -14997,7 +14997,7 @@ short pc_get_itemgroup_bonus(map_session_data* sd, t_itemid nameid, std::vector<
 * @param group_id Item Group ID
 * @param group_id Item Group ID
 * @return Heal rate
 * @return Heal rate
 **/
 **/
-short pc_get_itemgroup_bonus_group(map_session_data* sd, uint16 group_id, std::vector<s_item_bonus>& bonuses) {
+int16 pc_get_itemgroup_bonus_group(map_session_data* sd, uint16 group_id, std::vector<s_item_bonus>& bonuses) {
 	if (bonuses.empty())
 	if (bonuses.empty())
 		return 0;
 		return 0;
 
 
@@ -15016,7 +15016,7 @@ short pc_get_itemgroup_bonus_group(map_session_data* sd, uint16 group_id, std::v
 * @param index Known index item in inventory from sd->equip_index[] to compare with specified EQI in *equip_index
 * @param index Known index item in inventory from sd->equip_index[] to compare with specified EQI in *equip_index
 * @return True if item in same inventory index, False if doesn't
 * @return True if item in same inventory index, False if doesn't
 */
 */
-bool pc_is_same_equip_index(enum equip_index eqi, short *equip_index, short index) {
+bool pc_is_same_equip_index(enum equip_index eqi, int16 *equip_index, int16 index) {
 	if (index < 0 || index >= MAX_INVENTORY)
 	if (index < 0 || index >= MAX_INVENTORY)
 		return true;
 		return true;
 	// Dual weapon checks
 	// Dual weapon checks

+ 59 - 59
src/map/pc.hpp

@@ -240,13 +240,13 @@ struct s_item_bonus {
 
 
 /// AddEle bonus struct
 /// AddEle bonus struct
 struct s_addele2 {
 struct s_addele2 {
-	short flag, rate;
+	int16 flag, rate;
 	unsigned char ele;
 	unsigned char ele;
 };
 };
 
 
 /// AddRace bonus struct
 /// AddRace bonus struct
 struct s_addrace2 {
 struct s_addrace2 {
-	short flag, rate;
+	int16 flag, rate;
 	unsigned char race;
 	unsigned char race;
 };
 };
 
 
@@ -268,14 +268,14 @@ struct weapon_data {
 	int32 addclass[CLASS_MAX];
 	int32 addclass[CLASS_MAX];
 	int32 addrace2[RC2_MAX];
 	int32 addrace2[RC2_MAX];
 	int32 addsize[SZ_MAX];
 	int32 addsize[SZ_MAX];
-	short hp_drain_race[RC_MAX];
-	short sp_drain_race[RC_MAX];
-	short hp_drain_class[CLASS_MAX];
-	short sp_drain_class[CLASS_MAX];
+	int16 hp_drain_race[RC_MAX];
+	int16 sp_drain_race[RC_MAX];
+	int16 hp_drain_class[CLASS_MAX];
+	int16 sp_drain_class[CLASS_MAX];
 
 
 	struct drain_data {
 	struct drain_data {
-		short rate; ///< Success rate 10000 = 100%
-		short per;  ///< Drain value/rate per attack
+		int16 rate; ///< Success rate 10000 = 100%
+		int16 per;  ///< Drain value/rate per attack
 	} hp_drain_rate, sp_drain_rate;
 	} hp_drain_rate, sp_drain_rate;
 
 
 	std::vector<s_item_bonus> add_dmg;
 	std::vector<s_item_bonus> add_dmg;
@@ -293,7 +293,7 @@ enum e_autospell_flags{
 /// AutoSpell bonus struct
 /// AutoSpell bonus struct
 struct s_autospell {
 struct s_autospell {
 	uint16 id, lv, trigger_skill;
 	uint16 id, lv, trigger_skill;
-	short rate, battle_flag;
+	int16 rate, battle_flag;
 	t_itemid card_id;
 	t_itemid card_id;
 	uint8 flag;
 	uint8 flag;
 	bool lock;  // bAutoSpellOnSkill: blocks autospell from triggering again, while being executed
 	bool lock;  // bAutoSpellOnSkill: blocks autospell from triggering again, while being executed
@@ -303,7 +303,7 @@ struct s_autospell {
 struct s_addeffect {
 struct s_addeffect {
 	enum sc_type sc; /// SC type/effect
 	enum sc_type sc; /// SC type/effect
 	int32 rate; /// Rate
 	int32 rate; /// Rate
-	short arrow_rate; /// Arrow rate
+	int16 arrow_rate; /// Arrow rate
 	unsigned char flag; /// Flag
 	unsigned char flag; /// Flag
 	uint32 duration; /// Duration the effect applied
 	uint32 duration; /// Duration the effect applied
 };
 };
@@ -312,7 +312,7 @@ struct s_addeffect {
 struct s_addeffectonskill {
 struct s_addeffectonskill {
 	enum sc_type sc; /// SC type/effect
 	enum sc_type sc; /// SC type/effect
 	int32 rate; /// Rate
 	int32 rate; /// Rate
-	short skill_id; /// Skill ID
+	int16 skill_id; /// Skill ID
 	unsigned char target; /// Target
 	unsigned char target; /// Target
 	uint32 duration; /// Duration the effect applied
 	uint32 duration; /// Duration the effect applied
 };
 };
@@ -322,7 +322,7 @@ struct s_add_drop {
 	t_itemid nameid; ///Item ID
 	t_itemid nameid; ///Item ID
 	uint16 group; ///Group ID
 	uint16 group; ///Group ID
 	int32 rate; ///Rate, 1 ~ 10000, -1 ~ -100000
 	int32 rate; ///Rate, 1 ~ 10000, -1 ~ -100000
-	short race; ///Target Race, bitwise value of 1<<x. if < 0 means Monster ID
+	int16 race; ///Target Race, bitwise value of 1<<x. if < 0 means Monster ID
 	uint16 class_; ///Target Class, bitwise value of 1<<x
 	uint16 class_; ///Target Class, bitwise value of 1<<x
 };
 };
 
 
@@ -334,7 +334,7 @@ struct s_vanish_bonus {
 
 
 /// AutoBonus bonus struct
 /// AutoBonus bonus struct
 struct s_autobonus {
 struct s_autobonus {
-	short rate;
+	int16 rate;
 	uint16 atk_type;
 	uint16 atk_type;
 	uint32 duration;
 	uint32 duration;
 	char *bonus_script, *other_script;
 	char *bonus_script, *other_script;
@@ -357,7 +357,7 @@ struct s_bonus_script_entry {
 
 
 /// HP/SP bonus struct
 /// HP/SP bonus struct
 struct s_regen {
 struct s_regen {
-	short value;
+	int16 value;
 	int32 rate;
 	int32 rate;
 	int32 tick;
 	int32 tick;
 };
 };
@@ -421,7 +421,7 @@ public:
 		uint32 noks : 3; // [Zeph Kill Steal Protection]
 		uint32 noks : 3; // [Zeph Kill Steal Protection]
 		uint32 changemap : 1;
 		uint32 changemap : 1;
 		uint32 callshop : 1; // flag to indicate that a script used callshop; on a shop
 		uint32 callshop : 1; // flag to indicate that a script used callshop; on a shop
-		short pmap; // Previous map on Map Change
+		int16 pmap; // Previous map on Map Change
 		uint16 autoloot;
 		uint16 autoloot;
 		t_itemid autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus]
 		t_itemid autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus]
 		uint16 autoloottype;
 		uint16 autoloottype;
@@ -488,8 +488,8 @@ public:
 	struct s_storage cart;
 	struct s_storage cart;
 
 
 	struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups)
 	struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups)
-	short equip_index[EQI_MAX];
-	short equip_switch_index[EQI_MAX];
+	int16 equip_index[EQI_MAX];
+	int16 equip_switch_index[EQI_MAX];
 	uint32 weight,max_weight,add_max_weight;
 	uint32 weight,max_weight,add_max_weight;
 	int32 cart_weight,cart_num,cart_weight_max;
 	int32 cart_weight,cart_num,cart_weight_max;
 	int32 fd;
 	int32 fd;
@@ -524,12 +524,12 @@ public:
 
 
 	time_t emotionlasttime; // to limit flood with emotion packets
 	time_t emotionlasttime; // to limit flood with emotion packets
 
 
-	short skillitem,skillitemlv;
+	int16 skillitem,skillitemlv;
 	bool skillitem_keep_requirement;
 	bool skillitem_keep_requirement;
 	uint16 skill_id_old,skill_lv_old;
 	uint16 skill_id_old,skill_lv_old;
 	uint16 skill_id_dance,skill_lv_dance;
 	uint16 skill_id_dance,skill_lv_dance;
 	uint16 skill_id_song, skill_lv_song;
 	uint16 skill_id_song, skill_lv_song;
-	short cook_mastery; // range: [0,1999] [Inkfish]
+	int16 cook_mastery; // range: [0,1999] [Inkfish]
 	std::unordered_map<uint16, int32> scd; // Skill Cooldown
 	std::unordered_map<uint16, int32> scd; // Skill Cooldown
 	uint16 cloneskill_idx, ///Stores index of copied skill by Intimidate/Plagiarism
 	uint16 cloneskill_idx, ///Stores index of copied skill by Intimidate/Plagiarism
 		reproduceskill_idx; ///Stores index of copied skill by Reproduce
 		reproduceskill_idx; ///Stores index of copied skill by Reproduce
@@ -551,8 +551,8 @@ public:
 		t_tick tick;
 		t_tick tick;
 	} item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
 	} item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
 
 
-	short weapontype1,weapontype2;
-	short disguise; // [Valaris]
+	int16 weapontype1,weapontype2;
+	int16 disguise; // [Valaris]
 
 
 	struct weapon_data right_weapon, left_weapon;
 	struct weapon_data right_weapon, left_weapon;
 
 
@@ -566,11 +566,11 @@ public:
 		int32 subclass[CLASS_MAX];
 		int32 subclass[CLASS_MAX];
 		int32 subrace2[RC2_MAX];
 		int32 subrace2[RC2_MAX];
 		int32 subsize[SZ_MAX];
 		int32 subsize[SZ_MAX];
-		short coma_class[CLASS_MAX];
-		short coma_race[RC_MAX];
-		short weapon_coma_ele[ELE_MAX];
-		short weapon_coma_race[RC_MAX];
-		short weapon_coma_class[CLASS_MAX];
+		int16 coma_class[CLASS_MAX];
+		int16 coma_race[RC_MAX];
+		int16 weapon_coma_ele[ELE_MAX];
+		int16 weapon_coma_race[RC_MAX];
+		int16 weapon_coma_class[CLASS_MAX];
 		int32 weapon_atk[16];
 		int32 weapon_atk[16];
 		int32 weapon_damage_rate[16];
 		int32 weapon_damage_rate[16];
 		int32 arrow_addele[ELE_MAX];
 		int32 arrow_addele[ELE_MAX];
@@ -592,7 +592,7 @@ public:
 		int32 ignore_mdef_by_class[CLASS_MAX];
 		int32 ignore_mdef_by_class[CLASS_MAX];
 		int32 ignore_def_by_race[RC_MAX];
 		int32 ignore_def_by_race[RC_MAX];
 		int32 ignore_def_by_class[CLASS_MAX];
 		int32 ignore_def_by_class[CLASS_MAX];
-		short sp_gain_race[RC_MAX];
+		int16 sp_gain_race[RC_MAX];
 		int32 magic_addrace2[RC2_MAX];
 		int32 magic_addrace2[RC2_MAX];
 		int32 ignore_mdef_by_race2[RC2_MAX];
 		int32 ignore_mdef_by_race2[RC2_MAX];
 		int32 dropaddrace[RC_MAX];
 		int32 dropaddrace[RC_MAX];
@@ -616,16 +616,16 @@ public:
 
 
 	// zeroed structures start here
 	// zeroed structures start here
 	struct s_regen {
 	struct s_regen {
-		short value;
+		int16 value;
 		int32 rate;
 		int32 rate;
 		t_tick tick;
 		t_tick tick;
 	} hp_loss, sp_loss, hp_regen, sp_regen, percent_hp_regen, percent_sp_regen;
 	} hp_loss, sp_loss, hp_regen, sp_regen, percent_hp_regen, percent_sp_regen;
 	struct {
 	struct {
-		short value;
+		int16 value;
 		int32 rate, tick;
 		int32 rate, tick;
 	} def_set_race[RC_MAX], mdef_set_race[RC_MAX], norecover_state_race[RC_MAX];
 	} def_set_race[RC_MAX], mdef_set_race[RC_MAX], norecover_state_race[RC_MAX];
 	struct s_bonus_vanish_gain {
 	struct s_bonus_vanish_gain {
-		short rate,	///< Success rate 0 - 1000 (100%)
+		int16 rate,	///< Success rate 0 - 1000 (100%)
 			per;	///< % HP/SP vanished/gained
 			per;	///< % HP/SP vanished/gained
 	} hp_vanish_race[RC_MAX], sp_vanish_race[RC_MAX];
 	} hp_vanish_race[RC_MAX], sp_vanish_race[RC_MAX];
 	// zeroed structures end here
 	// zeroed structures end here
@@ -660,8 +660,8 @@ public:
 		int32 shieldmdef;//royal guard's
 		int32 shieldmdef;//royal guard's
 		uint32 setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int32 ranges. [Skotlex]
 		uint32 setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int32 ranges. [Skotlex]
 
 
-		short splash_range, splash_add_range;
-		short add_steal_rate;
+		int16 splash_range, splash_add_range;
+		int16 add_steal_rate;
 		int32 add_heal_rate, add_heal2_rate;
 		int32 add_heal_rate, add_heal2_rate;
 		int32 sp_gain_value, hp_gain_value, magic_sp_gain_value, magic_hp_gain_value, long_sp_gain_value, long_hp_gain_value;
 		int32 sp_gain_value, hp_gain_value, magic_sp_gain_value, magic_hp_gain_value, long_sp_gain_value, long_hp_gain_value;
 		uint16 unbreakable;	// chance to prevent ANY equipment breaking [celest]
 		uint16 unbreakable;	// chance to prevent ANY equipment breaking [celest]
@@ -673,8 +673,8 @@ public:
 		int32 eatk; // atk bonus from equipment
 		int32 eatk; // atk bonus from equipment
 		uint8 absorb_dmg_maxhp; // [Cydh]
 		uint8 absorb_dmg_maxhp; // [Cydh]
 		uint8 absorb_dmg_maxhp2;
 		uint8 absorb_dmg_maxhp2;
-		short critical_rangeatk;
-		short weapon_atk_rate, weapon_matk_rate;
+		int16 critical_rangeatk;
+		int16 weapon_atk_rate, weapon_matk_rate;
 	} bonus;
 	} bonus;
 	// zeroed vars end here.
 	// zeroed vars end here.
 
 
@@ -685,11 +685,11 @@ public:
 	int32 patk_rate,smatk_rate,res_rate,mres_rate,hplus_rate,crate_rate;
 	int32 patk_rate,smatk_rate,res_rate,mres_rate,hplus_rate,crate_rate;
 
 
 	t_itemid itemid;
 	t_itemid itemid;
-	short itemindex;	//Used item's index in sd->inventory [Skotlex]
+	int16 itemindex;	//Used item's index in sd->inventory [Skotlex]
 
 
 	int8 spiritball, spiritball_old;
 	int8 spiritball, spiritball_old;
 	int32 spirit_timer[MAX_SPIRITBALL];
 	int32 spirit_timer[MAX_SPIRITBALL];
-	short spiritcharm; //No. of spirit
+	int16 spiritcharm; //No. of spirit
 	int32 spiritcharm_type; //Spirit type
 	int32 spiritcharm_type; //Spirit type
 	int32 spiritcharm_timer[MAX_SPIRITCHARM];
 	int32 spiritcharm_timer[MAX_SPIRITCHARM];
 	int8 soulball, soulball_old;
 	int8 soulball, soulball_old;
@@ -698,7 +698,7 @@ public:
 
 
 	unsigned char potion_success_counter; //Potion successes in row counter
 	unsigned char potion_success_counter; //Potion successes in row counter
 	unsigned char mission_count; //Stores the bounty kill count for TK_MISSION
 	unsigned char mission_count; //Stores the bounty kill count for TK_MISSION
-	short mission_mobid; //Stores the target mob_id for TK_MISSION
+	int16 mission_mobid; //Stores the target mob_id for TK_MISSION
 	int32 die_counter; //Total number of times you've died
 	int32 die_counter; //Total number of times you've died
 	int32 devotion[MAX_DEVOTION]; //Stores the account IDs of chars devoted to.
 	int32 devotion[MAX_DEVOTION]; //Stores the account IDs of chars devoted to.
 	int32 stellar_mark[MAX_STELLAR_MARKS]; // Stores the account ID's of character's with a stellar mark.
 	int32 stellar_mark[MAX_STELLAR_MARKS]; // Stores the account ID's of character's with a stellar mark.
@@ -712,7 +712,7 @@ public:
 
 
 	struct s_deal {
 	struct s_deal {
 		struct s_item {
 		struct s_item {
-			short index, amount;
+			int16 index, amount;
 		} item[10];
 		} item[10];
 		int32 zeny, weight;
 		int32 zeny, weight;
 	} deal;
 	} deal;
@@ -725,7 +725,7 @@ public:
 	std::shared_ptr<MapGuild> guild; // [Ind] speed everything up
 	std::shared_ptr<MapGuild> guild; // [Ind] speed everything up
 	int32 guild_invite,guild_invite_account;
 	int32 guild_invite,guild_invite_account;
 	int32 guild_emblem_id,guild_alliance,guild_alliance_account;
 	int32 guild_emblem_id,guild_alliance,guild_alliance_account;
-	short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo]
+	int16 guild_x,guild_y; // For guildmate position display. [Skotlex]
 	int32 guildspy; // [Syrus22]
 	int32 guildspy; // [Syrus22]
 	int32 partyspy; // [Syrus22]
 	int32 partyspy; // [Syrus22]
 	int32 clanspy;
 	int32 clanspy;
@@ -753,10 +753,10 @@ public:
 		int32  m; //-1 - none, other: map index corresponding to map name.
 		int32  m; //-1 - none, other: map index corresponding to map name.
 		uint16 index; //map index
 		uint16 index; //map index
 	} feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars
 	} feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars
-	short hate_mob[3];
+	int16 hate_mob[3];
 
 
 	int32 pvp_timer;
 	int32 pvp_timer;
-	short pvp_point;
+	int16 pvp_point;
 	uint16 pvp_rank, pvp_lastusers;
 	uint16 pvp_rank, pvp_lastusers;
 	uint16 pvp_won, pvp_lost;
 	uint16 pvp_won, pvp_lost;
 
 
@@ -897,7 +897,7 @@ public:
 	int32 expiration_tid;
 	int32 expiration_tid;
 	time_t expiration_time;
 	time_t expiration_time;
 
 
-	short last_addeditem_index; /// Index of latest item added
+	int16 last_addeditem_index; /// Index of latest item added
 	int32 autotrade_tid;
 	int32 autotrade_tid;
 	int32 respawn_tid;
 	int32 respawn_tid;
 	int32 bank_vault; ///< Bank Vault
 	int32 bank_vault; ///< Bank Vault
@@ -911,10 +911,10 @@ public:
 	} roulette_point;
 	} roulette_point;
 
 
 	struct {
 	struct {
-		short stage;
+		int16 stage;
 		int8 prizeIdx;
 		int8 prizeIdx;
 		t_itemid bonusItemID;
 		t_itemid bonusItemID;
-		short prizeStage;
+		int16 prizeStage;
 		bool claimPrize;
 		bool claimPrize;
 		t_tick tick;
 		t_tick tick;
 	} roulette;
 	} roulette;
@@ -922,7 +922,7 @@ public:
 	int32 instance_id;
 	int32 instance_id;
 	e_instance_mode instance_mode; ///< Mode of instance player last leaves from (used for instance destruction button)
 	e_instance_mode instance_mode; ///< Mode of instance player last leaves from (used for instance destruction button)
 
 
-	short setlook_head_top, setlook_head_mid, setlook_head_bottom, setlook_robe; ///< Stores 'setlook' script command values.
+	int16 setlook_head_top, setlook_head_mid, setlook_head_bottom, setlook_robe; ///< Stores 'setlook' script command values.
 
 
 #if PACKETVER_MAIN_NUM >= 20150507 || PACKETVER_RE_NUM >= 20150429 || defined(PACKETVER_ZERO)
 #if PACKETVER_MAIN_NUM >= 20150507 || PACKETVER_RE_NUM >= 20150429 || defined(PACKETVER_ZERO)
 	std::vector<int16> hatEffects;
 	std::vector<int16> hatEffects;
@@ -1180,7 +1180,7 @@ static inline bool pc_hasprogress(map_session_data *sd, enum e_wip_block progres
 }
 }
 
 
 uint16 pc_maxparameter(map_session_data *sd, e_params param);
 uint16 pc_maxparameter(map_session_data *sd, e_params param);
-short pc_maxaspd(map_session_data *sd);
+int16 pc_maxaspd(map_session_data *sd);
 
 
 /**
 /**
  * Ranger
  * Ranger
@@ -1394,8 +1394,8 @@ int32 pc_get_skillcooldown(map_session_data *sd, uint16 skill_id, uint16 skill_l
 uint8 pc_checkskill(map_session_data *sd,uint16 skill_id);
 uint8 pc_checkskill(map_session_data *sd,uint16 skill_id);
 e_skill_flag pc_checkskill_flag(map_session_data &sd, uint16 skill_id);
 e_skill_flag pc_checkskill_flag(map_session_data &sd, uint16 skill_id);
 uint8 pc_checkskill_summoner(map_session_data *sd, e_summoner_power_type type);
 uint8 pc_checkskill_summoner(map_session_data *sd, e_summoner_power_type type);
-uint8 pc_checkskill_imperial_guard(map_session_data *sd, short flag);
-short pc_checkequip(map_session_data *sd,int32 pos,bool checkall=false);
+uint8 pc_checkskill_imperial_guard(map_session_data *sd, int16 flag);
+int16 pc_checkequip(map_session_data *sd,int32 pos,bool checkall=false);
 bool pc_checkequip2(map_session_data *sd, t_itemid nameid, int32 min, int32 max);
 bool pc_checkequip2(map_session_data *sd, t_itemid nameid, int32 min, int32 max);
 
 
 void pc_scdata_received(map_session_data *sd);
 void pc_scdata_received(map_session_data *sd);
@@ -1420,17 +1420,17 @@ enum e_setpos{
 
 
 enum e_setpos pc_setpos(map_session_data* sd, uint16 mapindex, int32 x, int32 y, clr_type clrtype);
 enum e_setpos pc_setpos(map_session_data* sd, uint16 mapindex, int32 x, int32 y, clr_type clrtype);
 enum e_setpos pc_setpos_savepoint( map_session_data& sd, clr_type clrtype = CLR_TELEPORT );
 enum e_setpos pc_setpos_savepoint( map_session_data& sd, clr_type clrtype = CLR_TELEPORT );
-void pc_setsavepoint(map_session_data *sd, short mapindex,int32 x,int32 y);
+void pc_setsavepoint(map_session_data *sd, int16 mapindex,int32 x,int32 y);
 char pc_randomwarp(map_session_data *sd,clr_type type,bool ignore_mapflag = false);
 char pc_randomwarp(map_session_data *sd,clr_type type,bool ignore_mapflag = false);
 bool pc_memo(map_session_data* sd, int32 pos);
 bool pc_memo(map_session_data* sd, int32 pos);
 
 
 char pc_checkadditem(map_session_data *sd, t_itemid nameid, int32 amount);
 char pc_checkadditem(map_session_data *sd, t_itemid nameid, int32 amount);
 uint8 pc_inventoryblank(map_session_data *sd);
 uint8 pc_inventoryblank(map_session_data *sd);
-short pc_search_inventory(map_session_data *sd, t_itemid nameid);
+int16 pc_search_inventory(map_session_data *sd, t_itemid nameid);
 char pc_payzeny(map_session_data *sd, int32 zeny, enum e_log_pick_type type, uint32 log_charid = 0);
 char pc_payzeny(map_session_data *sd, int32 zeny, enum e_log_pick_type type, uint32 log_charid = 0);
 enum e_additem_result pc_additem(map_session_data *sd, struct item *item, int32 amount, e_log_pick_type log_type);
 enum e_additem_result pc_additem(map_session_data *sd, struct item *item, int32 amount, e_log_pick_type log_type);
 char pc_getzeny(map_session_data *sd, int32 zeny, enum e_log_pick_type type, uint32 log_charid = 0);
 char pc_getzeny(map_session_data *sd, int32 zeny, enum e_log_pick_type type, uint32 log_charid = 0);
-char pc_delitem(map_session_data *sd, int32 n, int32 amount, int32 type, short reason, e_log_pick_type log_type);
+char pc_delitem(map_session_data *sd, int32 n, int32 amount, int32 type, int16 reason, e_log_pick_type log_type);
 
 
 uint64 pc_generate_unique_id(map_session_data *sd);
 uint64 pc_generate_unique_id(map_session_data *sd);
 
 
@@ -1456,7 +1456,7 @@ bool pc_adoption(map_session_data *p1_sd, map_session_data *p2_sd, map_session_d
 
 
 void pc_updateweightstatus(map_session_data *sd);
 void pc_updateweightstatus(map_session_data *sd);
 
 
-bool pc_addautobonus(std::vector<std::shared_ptr<s_autobonus>> &bonus, const char *script, short rate, uint32 dur, uint16 atk_type, const char *o_script, uint32 pos, bool onskill);
+bool pc_addautobonus(std::vector<std::shared_ptr<s_autobonus>> &bonus, const char *script, int16 rate, uint32 dur, uint16 atk_type, const char *o_script, uint32 pos, bool onskill);
 void pc_exeautobonus(map_session_data &sd, std::vector<std::shared_ptr<s_autobonus>> *bonus, std::shared_ptr<s_autobonus> autobonus);
 void pc_exeautobonus(map_session_data &sd, std::vector<std::shared_ptr<s_autobonus>> *bonus, std::shared_ptr<s_autobonus> autobonus);
 TIMER_FUNC(pc_endautobonus);
 TIMER_FUNC(pc_endautobonus);
 void pc_delautobonus(map_session_data &sd, std::vector<std::shared_ptr<s_autobonus>> &bonus, bool restore);
 void pc_delautobonus(map_session_data &sd, std::vector<std::shared_ptr<s_autobonus>> &bonus, bool restore);
@@ -1519,7 +1519,7 @@ int32 pc_resetstate(map_session_data*);
 int32 pc_resetskill(map_session_data*, int32);
 int32 pc_resetskill(map_session_data*, int32);
 int32 pc_resetfeel(map_session_data*);
 int32 pc_resetfeel(map_session_data*);
 int32 pc_resethate(map_session_data*);
 int32 pc_resethate(map_session_data*);
-bool pc_equipitem(map_session_data *sd, short n, int32 req_pos, bool equipswitch=false);
+bool pc_equipitem(map_session_data *sd, int16 n, int32 req_pos, bool equipswitch=false);
 bool pc_unequipitem(map_session_data*,int32,int32);
 bool pc_unequipitem(map_session_data*,int32,int32);
 int32 pc_equipswitch( map_session_data* sd, int32 index );
 int32 pc_equipswitch( map_session_data* sd, int32 index );
 void pc_equipswitch_remove( map_session_data* sd, int32 index );
 void pc_equipswitch_remove( map_session_data* sd, int32 index );
@@ -1632,9 +1632,9 @@ public:
 extern SkillTreeDatabase skill_tree_db;
 extern SkillTreeDatabase skill_tree_db;
 
 
 struct sg_data {
 struct sg_data {
-	short anger_id;
-	short bless_id;
-	short comfort_id;
+	int16 anger_id;
+	int16 bless_id;
+	int16 comfort_id;
 	char feel_var[NAME_LENGTH];
 	char feel_var[NAME_LENGTH];
 	char hate_var[NAME_LENGTH];
 	char hate_var[NAME_LENGTH];
 	bool (*day_func)(void);
 	bool (*day_func)(void);
@@ -1712,10 +1712,10 @@ void pc_bonus_script_clear(map_session_data *sd, uint32 flag);
 
 
 void pc_cell_basilica(map_session_data *sd);
 void pc_cell_basilica(map_session_data *sd);
 
 
-short pc_get_itemgroup_bonus(map_session_data* sd, t_itemid nameid, std::vector<s_item_bonus>& bonuses);
-short pc_get_itemgroup_bonus_group(map_session_data* sd, uint16 group_id, std::vector<s_item_bonus>& bonuses);
+int16 pc_get_itemgroup_bonus(map_session_data* sd, t_itemid nameid, std::vector<s_item_bonus>& bonuses);
+int16 pc_get_itemgroup_bonus_group(map_session_data* sd, uint16 group_id, std::vector<s_item_bonus>& bonuses);
 
 
-bool pc_is_same_equip_index(enum equip_index eqi, short *equip_index, short index);
+bool pc_is_same_equip_index(enum equip_index eqi, int16 *equip_index, int16 index);
 /// Check if player is Taekwon Ranker and the level is >= 90 (battle_config.taekwon_ranker_min_lv)
 /// Check if player is Taekwon Ranker and the level is >= 90 (battle_config.taekwon_ranker_min_lv)
 #define pc_is_taekwon_ranker(sd) (((sd)->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && (sd)->status.base_level >= battle_config.taekwon_ranker_min_lv && pc_famerank((sd)->status.char_id,MAPID_TAEKWON))
 #define pc_is_taekwon_ranker(sd) (((sd)->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && (sd)->status.base_level >= battle_config.taekwon_ranker_min_lv && pc_famerank((sd)->status.char_id,MAPID_TAEKWON))
 
 

+ 4 - 4
src/map/pet.cpp

@@ -1182,7 +1182,7 @@ int32 pet_recv_petdata(uint32 account_id,struct s_pet *p,int32 flag)
  * @param egg_index : egg index value in inventory
  * @param egg_index : egg index value in inventory
  * @return 0
  * @return 0
  */
  */
-int32 pet_select_egg(map_session_data *sd,short egg_index)
+int32 pet_select_egg(map_session_data *sd,int16 egg_index)
 {
 {
 	nullpo_ret(sd);
 	nullpo_ret(sd);
 
 
@@ -1365,7 +1365,7 @@ void pet_catch_process_end( map_session_data& sd, int32 target_id ){
  * @param pet_id : pet ID otherwise means failure
  * @param pet_id : pet ID otherwise means failure
  * @return true : success, false : failure
  * @return true : success, false : failure
  **/
  **/
-bool pet_get_egg(uint32 account_id, short pet_class, int32 pet_id ) {
+bool pet_get_egg(uint32 account_id, int16 pet_class, int32 pet_id ) {
 	map_session_data *sd;
 	map_session_data *sd;
 	struct item tmp_item;
 	struct item tmp_item;
 	int32 ret = 0;
 	int32 ret = 0;
@@ -2151,7 +2151,7 @@ TIMER_FUNC(pet_heal_timer){
 TIMER_FUNC(pet_skill_support_timer){
 TIMER_FUNC(pet_skill_support_timer){
 	map_session_data *sd = map_id2sd(id);
 	map_session_data *sd = map_id2sd(id);
 	struct pet_data *pd;
 	struct pet_data *pd;
-	short rate = 100;
+	int16 rate = 100;
 
 
 	if(sd == nullptr || sd->pd == nullptr || sd->pd->s_skill == nullptr)
 	if(sd == nullptr || sd->pd == nullptr || sd->pd->s_skill == nullptr)
 		return 1;
 		return 1;
@@ -2212,7 +2212,7 @@ int32 pet_egg_search(map_session_data* sd, int32 pet_id) {
  * @param pet_id: Pet's database ID
  * @param pet_id: Pet's database ID
  * @return True on success or false otherwise
  * @return True on success or false otherwise
  */
  */
-bool pet_evolution_requirements_check(map_session_data *sd, short pet_id) {
+bool pet_evolution_requirements_check(map_session_data *sd, int16 pet_id) {
 	nullpo_retr(false, sd);
 	nullpo_retr(false, sd);
 
 
 	if (sd->pd == nullptr)
 	if (sd->pd == nullptr)

+ 2 - 2
src/map/pet.hpp

@@ -236,10 +236,10 @@ bool pet_data_init(map_session_data *sd, struct s_pet *pet);
 bool pet_return_egg( map_session_data *sd, struct pet_data *pd );
 bool pet_return_egg( map_session_data *sd, struct pet_data *pd );
 int32 pet_birth_process(map_session_data *sd, struct s_pet *pet);
 int32 pet_birth_process(map_session_data *sd, struct s_pet *pet);
 int32 pet_recv_petdata(uint32 account_id,struct s_pet *p,int32 flag);
 int32 pet_recv_petdata(uint32 account_id,struct s_pet *p,int32 flag);
-int32 pet_select_egg(map_session_data *sd,short egg_index);
+int32 pet_select_egg(map_session_data *sd,int16 egg_index);
 void pet_catch_process_start( map_session_data& sd, t_itemid item_id, e_pet_catch_flag flag );
 void pet_catch_process_start( map_session_data& sd, t_itemid item_id, e_pet_catch_flag flag );
 void pet_catch_process_end( map_session_data& sd, int32 target_id );
 void pet_catch_process_end( map_session_data& sd, int32 target_id );
-bool pet_get_egg(uint32 account_id, short pet_class, int32 pet_id);
+bool pet_get_egg(uint32 account_id, int16 pet_class, int32 pet_id);
 int32 pet_menu(map_session_data *sd,int32 menunum);
 int32 pet_menu(map_session_data *sd,int32 menunum);
 int32 pet_change_name(map_session_data *sd,char *name);
 int32 pet_change_name(map_session_data *sd,char *name);
 int32 pet_change_name_ack(map_session_data *sd, char* name, int32 flag);
 int32 pet_change_name_ack(map_session_data *sd, char* name, int32 flag);

+ 98 - 98
src/map/script.cpp

@@ -358,7 +358,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag);
 const char* parse_syntax(const char* p);
 const char* parse_syntax(const char* p);
 static int32 parse_syntax_for_flag = 0;
 static int32 parse_syntax_for_flag = 0;
 
 
-extern short current_equip_item_index; //for New CARDS Scripts. It contains Inventory Index of the EQUIP_SCRIPT caller item. [Lupus]
+extern int16 current_equip_item_index; //for New CARDS Scripts. It contains Inventory Index of the EQUIP_SCRIPT caller item. [Lupus]
 extern uint32 current_equip_combo_pos;
 extern uint32 current_equip_combo_pos;
 
 
 int32 potion_flag=0; //For use on Alchemist improved potions/Potion Pitcher. [Skotlex]
 int32 potion_flag=0; //For use on Alchemist improved potions/Potion Pitcher. [Skotlex]
@@ -7070,8 +7070,8 @@ static bool script_getitem_randomoption(struct script_state *st, map_session_dat
 	opt_param_idx = reference_getindex(opt_param);
 	opt_param_idx = reference_getindex(opt_param);
 	
 	
 	for (i = 0; i < opt_id_n && i < MAX_ITEM_RDM_OPT; i++) {
 	for (i = 0; i < opt_id_n && i < MAX_ITEM_RDM_OPT; i++) {
-		it->option[i].id = (short)get_val2_num( st, reference_uid( opt_id_id, opt_id_idx + i ), opt_id_ref );
-		it->option[i].value = (short)get_val2_num( st, reference_uid( opt_val_id, opt_val_idx + i ), opt_val_ref );
+		it->option[i].id = (int16)get_val2_num( st, reference_uid( opt_id_id, opt_id_idx + i ), opt_id_ref );
+		it->option[i].value = (int16)get_val2_num( st, reference_uid( opt_val_id, opt_val_idx + i ), opt_val_ref );
 		it->option[i].param = (char)get_val2_num( st, reference_uid( opt_param_id, opt_param_idx + i ), opt_param_ref );
 		it->option[i].param = (char)get_val2_num( st, reference_uid( opt_param_id, opt_param_idx + i ), opt_param_ref );
 	}
 	}
 	return true;
 	return true;
@@ -7515,7 +7515,7 @@ BUILDIN_FUNC(checkweight2)
 {
 {
 	//variable sub checkweight
 	//variable sub checkweight
 	int32 i = 0, slots = 0, weight = 0;
 	int32 i = 0, slots = 0, weight = 0;
-	short fail = 0;
+	int16 fail = 0;
 	uint16 amount2 = 0;
 	uint16 amount2 = 0;
 
 
 	//variable for array parsing
 	//variable for array parsing
@@ -9613,7 +9613,7 @@ BUILDIN_FUNC(getequippercentrefinery)
  * successrefitem <equipment slot>{,<count>{,<char_id>}}
  * successrefitem <equipment slot>{,<count>{,<char_id>}}
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(successrefitem) {
 BUILDIN_FUNC(successrefitem) {
-	short i = -1, up = 1;
+	int16 i = -1, up = 1;
 	int32 pos;
 	int32 pos;
 	TBL_PC *sd;
 	TBL_PC *sd;
 
 
@@ -9687,7 +9687,7 @@ BUILDIN_FUNC(successrefitem) {
  * failedrefitem <equipment slot>{,<char_id>}
  * failedrefitem <equipment slot>{,<char_id>}
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(failedrefitem) {
 BUILDIN_FUNC(failedrefitem) {
-	short i = -1;
+	int16 i = -1;
 	int32 pos;
 	int32 pos;
 	TBL_PC *sd;
 	TBL_PC *sd;
 
 
@@ -9721,7 +9721,7 @@ BUILDIN_FUNC(failedrefitem) {
  * downrefitem <equipment slot>{,<count>{,<char_id>}}
  * downrefitem <equipment slot>{,<count>{,<char_id>}}
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(downrefitem) {
 BUILDIN_FUNC(downrefitem) {
-	short i = -1, down = 1;
+	int16 i = -1, down = 1;
 	int32 pos;
 	int32 pos;
 	TBL_PC *sd;
 	TBL_PC *sd;
 
 
@@ -9770,7 +9770,7 @@ BUILDIN_FUNC(downrefitem) {
  * delequip <equipment slot>{,<char_id>};
  * delequip <equipment slot>{,<char_id>};
  **/
  **/
 BUILDIN_FUNC(delequip) {
 BUILDIN_FUNC(delequip) {
-	short i = -1;
+	int16 i = -1;
 	int32 pos;
 	int32 pos;
 	int8 ret;
 	int8 ret;
 	TBL_PC *sd;
 	TBL_PC *sd;
@@ -9802,7 +9802,7 @@ BUILDIN_FUNC(delequip) {
  * breakequip <equipment slot>{,<char_id>};
  * breakequip <equipment slot>{,<char_id>};
  **/
  **/
 BUILDIN_FUNC(breakequip) {
 BUILDIN_FUNC(breakequip) {
-	short i = -1;
+	int16 i = -1;
 	int32 pos;
 	int32 pos;
 	TBL_PC *sd;
 	TBL_PC *sd;
 
 
@@ -10015,7 +10015,7 @@ BUILDIN_FUNC(bonus)
 BUILDIN_FUNC(autobonus)
 BUILDIN_FUNC(autobonus)
 {
 {
 	uint32 dur, pos;
 	uint32 dur, pos;
-	short rate;
+	int16 rate;
 	uint16 atk_type = 0;
 	uint16 atk_type = 0;
 	TBL_PC* sd;
 	TBL_PC* sd;
 	const char *bonus_script, *other_script = nullptr;
 	const char *bonus_script, *other_script = nullptr;
@@ -10052,7 +10052,7 @@ BUILDIN_FUNC(autobonus)
 BUILDIN_FUNC(autobonus2)
 BUILDIN_FUNC(autobonus2)
 {
 {
 	uint32 dur, pos;
 	uint32 dur, pos;
-	short rate;
+	int16 rate;
 	uint16 atk_type = 0;
 	uint16 atk_type = 0;
 	TBL_PC* sd;
 	TBL_PC* sd;
 	const char *bonus_script, *other_script = nullptr;
 	const char *bonus_script, *other_script = nullptr;
@@ -10089,7 +10089,7 @@ BUILDIN_FUNC(autobonus2)
 BUILDIN_FUNC(autobonus3)
 BUILDIN_FUNC(autobonus3)
 {
 {
 	uint32 dur, pos;
 	uint32 dur, pos;
-	short rate;
+	int16 rate;
 	uint16 skill_id = 0;
 	uint16 skill_id = 0;
 	TBL_PC* sd;
 	TBL_PC* sd;
 	const char *bonus_script, *other_script = nullptr;
 	const char *bonus_script, *other_script = nullptr;
@@ -11904,10 +11904,10 @@ static int32 buildin_announce_sub(struct block_list *bl, va_list ap)
 	int32   len       = va_arg(ap, int32);
 	int32   len       = va_arg(ap, int32);
 	int32   type      = va_arg(ap, int32);
 	int32   type      = va_arg(ap, int32);
 	char *fontColor = va_arg(ap, char *);
 	char *fontColor = va_arg(ap, char *);
-	short fontType  = (short)va_arg(ap, int32);
-	short fontSize  = (short)va_arg(ap, int32);
-	short fontAlign = (short)va_arg(ap, int32);
-	short fontY     = (short)va_arg(ap, int32);
+	int16 fontType  = (int16)va_arg(ap, int32);
+	int16 fontSize  = (int16)va_arg(ap, int32);
+	int16 fontAlign = (int16)va_arg(ap, int32);
+	int16 fontY     = (int16)va_arg(ap, int32);
 	if (fontColor)
 	if (fontColor)
 		clif_broadcast2(bl, mes, len, strtol(fontColor, (char **)nullptr, 0), fontType, fontSize, fontAlign, fontY, SELF);
 		clif_broadcast2(bl, mes, len, strtol(fontColor, (char **)nullptr, 0), fontType, fontSize, fontAlign, fontY, SELF);
 	else
 	else
@@ -12624,7 +12624,7 @@ BUILDIN_FUNC(homunculus_mutate)
 	if( sd->hd->homunculus.vaporize == HOM_ST_MORPH ) {
 	if( sd->hd->homunculus.vaporize == HOM_ST_MORPH ) {
 		int32 m_class = hom_class2mapid(sd->hd->homunculus.class_);
 		int32 m_class = hom_class2mapid(sd->hd->homunculus.class_);
 		int32 m_id = hom_class2mapid(homun_id);
 		int32 m_id = hom_class2mapid(homun_id);
-		short i = pc_search_inventory(sd, ITEMID_STRANGE_EMBRYO);
+		int16 i = pc_search_inventory(sd, ITEMID_STRANGE_EMBRYO);
 
 
 		if ( m_class != -1 && m_id != -1 && m_class&HOM_EVO && m_id&HOM_S && sd->hd->homunculus.level >= 99 && i >= 0 ) {
 		if ( m_class != -1 && m_id != -1 && m_class&HOM_EVO && m_id&HOM_S && sd->hd->homunculus.level >= 99 && i >= 0 ) {
 			sd->hd->homunculus.vaporize = HOM_ST_REST; // Remove morph state.
 			sd->hd->homunculus.vaporize = HOM_ST_REST; // Remove morph state.
@@ -16614,8 +16614,8 @@ BUILDIN_FUNC(isequippedcnt)
 			continue;
 			continue;
 		list.push_back(id);
 		list.push_back(id);
 
 
-		for (short j = 0; j < EQI_MAX; j++) {
-			short index = sd->equip_index[j];
+		for (int16 j = 0; j < EQI_MAX; j++) {
+			int16 index = sd->equip_index[j];
 			if (index < 0)
 			if (index < 0)
 				continue;
 				continue;
 			if (pc_is_same_equip_index((enum equip_index)j, sd->equip_index, index))
 			if (pc_is_same_equip_index((enum equip_index)j, sd->equip_index, index))
@@ -16630,7 +16630,7 @@ BUILDIN_FUNC(isequippedcnt)
 			} else { //Count cards.
 			} else { //Count cards.
 				if (itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0]))
 				if (itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0]))
 					continue; //No cards
 					continue; //No cards
-				for (short k = 0; k < MAX_SLOTS; k++) {
+				for (int16 k = 0; k < MAX_SLOTS; k++) {
 					if (sd->inventory.u.items_inventory[index].card[k] == id)
 					if (sd->inventory.u.items_inventory[index].card[k] == id)
 						ret++; //[Lupus]
 						ret++; //[Lupus]
 				}
 				}
@@ -16665,12 +16665,12 @@ BUILDIN_FUNC(isequipped)
 	setitem_hash2 = sd->bonus.setitem_hash2;
 	setitem_hash2 = sd->bonus.setitem_hash2;
 	for (i=0; id!=0; i++) {
 	for (i=0; id!=0; i++) {
 		int32 flag = 0;
 		int32 flag = 0;
-		short j;
+		int16 j;
 		FETCH (i+2, id) else id = 0;
 		FETCH (i+2, id) else id = 0;
 		if (id <= 0)
 		if (id <= 0)
 			continue;
 			continue;
 		for (j=0; j<EQI_MAX; j++) {
 		for (j=0; j<EQI_MAX; j++) {
-			short index = sd->equip_index[j];
+			int16 index = sd->equip_index[j];
 			if(index < 0)
 			if(index < 0)
 				continue;
 				continue;
 			if (pc_is_same_equip_index((enum equip_index)i, sd->equip_index, index))
 			if (pc_is_same_equip_index((enum equip_index)i, sd->equip_index, index))
@@ -16685,7 +16685,7 @@ BUILDIN_FUNC(isequipped)
 				flag = 1;
 				flag = 1;
 				break;
 				break;
 			} else { //Cards
 			} else { //Cards
-				short k;
+				int16 k;
 				if (itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0]))
 				if (itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0]))
 					continue;
 					continue;
 
 
@@ -16816,7 +16816,7 @@ BUILDIN_FUNC(unequip) {
 
 
 	pos = script_getnum(st,2);
 	pos = script_getnum(st,2);
 	if (equip_index_check(pos)) {
 	if (equip_index_check(pos)) {
-		short i = pc_checkequip(sd,equip_bitmask[pos]);
+		int16 i = pc_checkequip(sd,equip_bitmask[pos]);
 		if (i >= 0) {
 		if (i >= 0) {
 			pc_unequipitem(sd,i,1|2);
 			pc_unequipitem(sd,i,1|2);
 			script_pushint(st, 1);
 			script_pushint(st, 1);
@@ -19285,9 +19285,9 @@ BUILDIN_FUNC(setunitdata)
 			case UMOB_HP: md->base_status->hp = (uint32)value; status_set_hp(bl, (uint32)value, 0); clif_name_area(&md->bl); break;
 			case UMOB_HP: md->base_status->hp = (uint32)value; status_set_hp(bl, (uint32)value, 0); clif_name_area(&md->bl); break;
 			case UMOB_MAXHP: md->base_status->hp = md->base_status->max_hp = (uint32)value; status_set_maxhp(bl, (uint32)value, 0); clif_name_area(&md->bl); break;
 			case UMOB_MAXHP: md->base_status->hp = md->base_status->max_hp = (uint32)value; status_set_maxhp(bl, (uint32)value, 0); clif_name_area(&md->bl); break;
 			case UMOB_MASTERAID: md->master_id = value; break;
 			case UMOB_MASTERAID: md->master_id = value; break;
-			case UMOB_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break;
-			case UMOB_X: if (!unit_walktoxy(bl, (short)value, md->bl.y, 2)) unit_movepos(bl, (short)value, md->bl.y, 0, 0); break;
-			case UMOB_Y: if (!unit_walktoxy(bl, md->bl.x, (short)value, 2)) unit_movepos(bl, md->bl.x, (short)value, 0, 0); break;
+			case UMOB_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (int16)value, 0, 0, CLR_TELEPORT); break;
+			case UMOB_X: if (!unit_walktoxy(bl, (int16)value, md->bl.y, 2)) unit_movepos(bl, (int16)value, md->bl.y, 0, 0); break;
+			case UMOB_Y: if (!unit_walktoxy(bl, md->bl.x, (int16)value, 2)) unit_movepos(bl, md->bl.x, (int16)value, 0, 0); break;
 			case UMOB_SPEED: md->base_status->speed = (uint16)value; status_calc_misc(bl, &md->status, md->level); calc_status = true; break;
 			case UMOB_SPEED: md->base_status->speed = (uint16)value; status_calc_misc(bl, &md->status, md->level); calc_status = true; break;
 			case UMOB_MODE:
 			case UMOB_MODE:
 				md->base_status->mode = (enum e_mode)value;
 				md->base_status->mode = (enum e_mode)value;
@@ -19336,16 +19336,16 @@ BUILDIN_FUNC(setunitdata)
 			case UMOB_MATKMAX: md->base_status->matk_max = (uint16)value; calc_status = true; break;
 			case UMOB_MATKMAX: md->base_status->matk_max = (uint16)value; calc_status = true; break;
 			case UMOB_DEF: md->base_status->def = (defType)value; calc_status = true; break;
 			case UMOB_DEF: md->base_status->def = (defType)value; calc_status = true; break;
 			case UMOB_MDEF: md->base_status->mdef = (defType)value; calc_status = true; break;
 			case UMOB_MDEF: md->base_status->mdef = (defType)value; calc_status = true; break;
-			case UMOB_HIT: md->base_status->hit = (short)value; calc_status = true; break;
-			case UMOB_FLEE: md->base_status->flee = (short)value; calc_status = true; break;
-			case UMOB_PDODGE: md->base_status->flee2 = (short)value; calc_status = true; break;
-			case UMOB_CRIT: md->base_status->cri = (short)value; calc_status = true; break;
+			case UMOB_HIT: md->base_status->hit = (int16)value; calc_status = true; break;
+			case UMOB_FLEE: md->base_status->flee = (int16)value; calc_status = true; break;
+			case UMOB_PDODGE: md->base_status->flee2 = (int16)value; calc_status = true; break;
+			case UMOB_CRIT: md->base_status->cri = (int16)value; calc_status = true; break;
 			case UMOB_RACE: md->status.race = md->base_status->race = (unsigned char)value; break;
 			case UMOB_RACE: md->status.race = md->base_status->race = (unsigned char)value; break;
 			case UMOB_ELETYPE: md->base_status->def_ele = (unsigned char)value; calc_status = true; break;
 			case UMOB_ELETYPE: md->base_status->def_ele = (unsigned char)value; calc_status = true; break;
 			case UMOB_ELELEVEL: md->base_status->ele_lv = (unsigned char)value; calc_status = true; break;
 			case UMOB_ELELEVEL: md->base_status->ele_lv = (unsigned char)value; calc_status = true; break;
-			case UMOB_AMOTION: md->base_status->amotion = (short)value; calc_status = true; break;
-			case UMOB_ADELAY: md->base_status->adelay = (short)value; calc_status = true; break;
-			case UMOB_DMOTION: md->base_status->dmotion = (short)value; calc_status = true; break;
+			case UMOB_AMOTION: md->base_status->amotion = (int16)value; calc_status = true; break;
+			case UMOB_ADELAY: md->base_status->adelay = (int16)value; calc_status = true; break;
+			case UMOB_DMOTION: md->base_status->dmotion = (int16)value; calc_status = true; break;
 			case UMOB_TARGETID: {
 			case UMOB_TARGETID: {
 				if (value==0) {
 				if (value==0) {
 					mob_unlocktarget(md,gettick());
 					mob_unlocktarget(md,gettick());
@@ -19363,8 +19363,8 @@ BUILDIN_FUNC(setunitdata)
 			case UMOB_BODY2: clif_changelook(bl, LOOK_BODY2, (uint16)value); break;
 			case UMOB_BODY2: clif_changelook(bl, LOOK_BODY2, (uint16)value); break;
 			case UMOB_GROUP_ID: md->ud.group_id = value; unit_refresh(bl); break;
 			case UMOB_GROUP_ID: md->ud.group_id = value; unit_refresh(bl); break;
 			case UMOB_IGNORE_CELL_STACK_LIMIT: md->ud.state.ignore_cell_stack_limit = value > 0; break;
 			case UMOB_IGNORE_CELL_STACK_LIMIT: md->ud.state.ignore_cell_stack_limit = value > 0; break;
-			case UMOB_RES: md->base_status->res = (short)value; calc_status = true; break;
-			case UMOB_MRES: md->base_status->mres = (short)value; calc_status = true; break;
+			case UMOB_RES: md->base_status->res = (int16)value; calc_status = true; break;
+			case UMOB_MRES: md->base_status->mres = (int16)value; calc_status = true; break;
 			case UMOB_DAMAGETAKEN: md->damagetaken = (uint16)value; break;
 			case UMOB_DAMAGETAKEN: md->damagetaken = (uint16)value; break;
 			default:
 			default:
 				ShowError("buildin_setunitdata: Unknown data identifier %d for BL_MOB.\n", type);
 				ShowError("buildin_setunitdata: Unknown data identifier %d for BL_MOB.\n", type);
@@ -19385,10 +19385,10 @@ BUILDIN_FUNC(setunitdata)
 			case UHOM_SP: hd->base_status.sp = (uint32)value; status_set_sp(bl, (uint32)value, 0); break;
 			case UHOM_SP: hd->base_status.sp = (uint32)value; status_set_sp(bl, (uint32)value, 0); break;
 			case UHOM_MAXSP: hd->base_status.sp = hd->base_status.max_sp = (uint32)value; status_set_maxsp(bl, (uint32)value, 0); break;
 			case UHOM_MAXSP: hd->base_status.sp = hd->base_status.max_sp = (uint32)value; status_set_maxsp(bl, (uint32)value, 0); break;
 			case UHOM_MASTERCID: hd->homunculus.char_id = (uint32)value; break;
 			case UHOM_MASTERCID: hd->homunculus.char_id = (uint32)value; break;
-			case UHOM_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break;
-			case UHOM_X: if (!unit_walktoxy(bl, (short)value, hd->bl.y, 2)) unit_movepos(bl, (short)value, hd->bl.y, 0, 0); break;
-			case UHOM_Y: if (!unit_walktoxy(bl, hd->bl.x, (short)value, 2)) unit_movepos(bl, hd->bl.x, (short)value, 0, 0); break;
-			case UHOM_HUNGER: hd->homunculus.hunger = (short)value; clif_send_homdata(*hd, SP_HUNGRY); break;
+			case UHOM_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (int16)value, 0, 0, CLR_TELEPORT); break;
+			case UHOM_X: if (!unit_walktoxy(bl, (int16)value, hd->bl.y, 2)) unit_movepos(bl, (int16)value, hd->bl.y, 0, 0); break;
+			case UHOM_Y: if (!unit_walktoxy(bl, hd->bl.x, (int16)value, 2)) unit_movepos(bl, hd->bl.x, (int16)value, 0, 0); break;
+			case UHOM_HUNGER: hd->homunculus.hunger = (int16)value; clif_send_homdata(*hd, SP_HUNGRY); break;
 			case UHOM_INTIMACY: hom_increase_intimacy(hd, (uint32)value); clif_send_homdata(*hd, SP_INTIMATE); break;
 			case UHOM_INTIMACY: hom_increase_intimacy(hd, (uint32)value); clif_send_homdata(*hd, SP_INTIMATE); break;
 			case UHOM_SPEED: hd->base_status.speed = (uint16)value; status_calc_misc(bl, &hd->base_status, hd->homunculus.level); calc_status = true; break;
 			case UHOM_SPEED: hd->base_status.speed = (uint16)value; status_calc_misc(bl, &hd->base_status, hd->homunculus.level); calc_status = true; break;
 			case UHOM_LOOKDIR: unit_setdir(bl, (uint8)value); break;
 			case UHOM_LOOKDIR: unit_setdir(bl, (uint8)value); break;
@@ -19407,16 +19407,16 @@ BUILDIN_FUNC(setunitdata)
 			case UHOM_MATKMAX: hd->base_status.matk_max = (uint16)value; calc_status = true; break;
 			case UHOM_MATKMAX: hd->base_status.matk_max = (uint16)value; calc_status = true; break;
 			case UHOM_DEF: hd->base_status.def = (defType)value; calc_status = true; break;
 			case UHOM_DEF: hd->base_status.def = (defType)value; calc_status = true; break;
 			case UHOM_MDEF: hd->base_status.mdef = (defType)value; calc_status = true; break;
 			case UHOM_MDEF: hd->base_status.mdef = (defType)value; calc_status = true; break;
-			case UHOM_HIT: hd->base_status.hit = (short)value; calc_status = true; break;
-			case UHOM_FLEE: hd->base_status.flee = (short)value; calc_status = true; break;
-			case UHOM_PDODGE: hd->base_status.flee2 = (short)value; calc_status = true; break;
-			case UHOM_CRIT: hd->base_status.cri = (short)value; calc_status = true; break;
+			case UHOM_HIT: hd->base_status.hit = (int16)value; calc_status = true; break;
+			case UHOM_FLEE: hd->base_status.flee = (int16)value; calc_status = true; break;
+			case UHOM_PDODGE: hd->base_status.flee2 = (int16)value; calc_status = true; break;
+			case UHOM_CRIT: hd->base_status.cri = (int16)value; calc_status = true; break;
 			case UHOM_RACE: hd->battle_status.race = hd->base_status.race = (unsigned char)value; break;
 			case UHOM_RACE: hd->battle_status.race = hd->base_status.race = (unsigned char)value; break;
 			case UHOM_ELETYPE: hd->base_status.def_ele = (unsigned char)value; calc_status = true; break;
 			case UHOM_ELETYPE: hd->base_status.def_ele = (unsigned char)value; calc_status = true; break;
 			case UHOM_ELELEVEL: hd->base_status.ele_lv = (unsigned char)value; calc_status = true; break;
 			case UHOM_ELELEVEL: hd->base_status.ele_lv = (unsigned char)value; calc_status = true; break;
-			case UHOM_AMOTION: hd->base_status.amotion = (short)value; calc_status = true; break;
-			case UHOM_ADELAY: hd->base_status.adelay = (short)value; calc_status = true; break;
-			case UHOM_DMOTION: hd->base_status.dmotion = (short)value; calc_status = true; break;
+			case UHOM_AMOTION: hd->base_status.amotion = (int16)value; calc_status = true; break;
+			case UHOM_ADELAY: hd->base_status.adelay = (int16)value; calc_status = true; break;
+			case UHOM_DMOTION: hd->base_status.dmotion = (int16)value; calc_status = true; break;
 			case UHOM_TARGETID: {
 			case UHOM_TARGETID: {
 				if (value==0) {
 				if (value==0) {
 					unit_stop_attack(&hd->bl);
 					unit_stop_attack(&hd->bl);
@@ -19451,10 +19451,10 @@ BUILDIN_FUNC(setunitdata)
 			case UPET_HP: pd->status.hp = pd->status.max_hp = (uint32)value; status_set_hp(bl, (uint32)value, 0); break;
 			case UPET_HP: pd->status.hp = pd->status.max_hp = (uint32)value; status_set_hp(bl, (uint32)value, 0); break;
 			case UPET_MAXHP: pd->status.hp = pd->status.max_hp = (uint32)value; status_set_maxhp(bl, (uint32)value, 0); break;
 			case UPET_MAXHP: pd->status.hp = pd->status.max_hp = (uint32)value; status_set_maxhp(bl, (uint32)value, 0); break;
 			case UPET_MASTERAID: pd->pet.account_id = (uint32)value; break;
 			case UPET_MASTERAID: pd->pet.account_id = (uint32)value; break;
-			case UPET_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break;
-			case UPET_X: if (!unit_walktoxy(bl, (short)value, pd->bl.y, 2)) unit_movepos(bl, (short)value, pd->bl.y, 0, 0); break;
-			case UPET_Y: if (!unit_walktoxy(bl, pd->bl.x, (short)value, 2)) unit_movepos(bl, pd->bl.x, (short)value, 0, 0); break;
-			case UPET_HUNGER: pd->pet.hungry = cap_value((short)value, 0, 100); clif_send_petdata( map_id2sd(pd->pet.account_id), *pd, CHANGESTATEPET_HUNGER ); break;
+			case UPET_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (int16)value, 0, 0, CLR_TELEPORT); break;
+			case UPET_X: if (!unit_walktoxy(bl, (int16)value, pd->bl.y, 2)) unit_movepos(bl, (int16)value, pd->bl.y, 0, 0); break;
+			case UPET_Y: if (!unit_walktoxy(bl, pd->bl.x, (int16)value, 2)) unit_movepos(bl, pd->bl.x, (int16)value, 0, 0); break;
+			case UPET_HUNGER: pd->pet.hungry = cap_value((int16)value, 0, 100); clif_send_petdata( map_id2sd(pd->pet.account_id), *pd, CHANGESTATEPET_HUNGER ); break;
 			case UPET_INTIMACY: pet_set_intimate(pd, (uint32)value); clif_send_petdata( map_id2sd(pd->pet.account_id), *pd, CHANGESTATEPET_INTIMACY ); break;
 			case UPET_INTIMACY: pet_set_intimate(pd, (uint32)value); clif_send_petdata( map_id2sd(pd->pet.account_id), *pd, CHANGESTATEPET_INTIMACY ); break;
 			case UPET_SPEED: pd->status.speed = (uint16)value; status_calc_misc(bl, &pd->status, pd->pet.level); break;
 			case UPET_SPEED: pd->status.speed = (uint16)value; status_calc_misc(bl, &pd->status, pd->pet.level); break;
 			case UPET_LOOKDIR: unit_setdir(bl, (uint8)value); break;
 			case UPET_LOOKDIR: unit_setdir(bl, (uint8)value); break;
@@ -19473,16 +19473,16 @@ BUILDIN_FUNC(setunitdata)
 			case UPET_MATKMAX: pd->status.matk_max = (uint16)value; break;
 			case UPET_MATKMAX: pd->status.matk_max = (uint16)value; break;
 			case UPET_DEF: pd->status.def = (defType)value; break;
 			case UPET_DEF: pd->status.def = (defType)value; break;
 			case UPET_MDEF: pd->status.mdef = (defType)value; break;
 			case UPET_MDEF: pd->status.mdef = (defType)value; break;
-			case UPET_HIT: pd->status.hit = (short)value; break;
-			case UPET_FLEE: pd->status.flee = (short)value; break;
-			case UPET_PDODGE: pd->status.flee2 = (short)value; break;
-			case UPET_CRIT: pd->status.cri = (short)value; break;
+			case UPET_HIT: pd->status.hit = (int16)value; break;
+			case UPET_FLEE: pd->status.flee = (int16)value; break;
+			case UPET_PDODGE: pd->status.flee2 = (int16)value; break;
+			case UPET_CRIT: pd->status.cri = (int16)value; break;
 			case UPET_RACE: pd->status.race = (unsigned char)value; break;
 			case UPET_RACE: pd->status.race = (unsigned char)value; break;
 			case UPET_ELETYPE: pd->status.def_ele = (unsigned char)value; break;
 			case UPET_ELETYPE: pd->status.def_ele = (unsigned char)value; break;
 			case UPET_ELELEVEL: pd->status.ele_lv = (unsigned char)value; break;
 			case UPET_ELELEVEL: pd->status.ele_lv = (unsigned char)value; break;
-			case UPET_AMOTION: pd->status.amotion = (short)value; break;
-			case UPET_ADELAY: pd->status.adelay = (short)value; break;
-			case UPET_DMOTION: pd->status.dmotion = (short)value; break;
+			case UPET_AMOTION: pd->status.amotion = (int16)value; break;
+			case UPET_ADELAY: pd->status.adelay = (int16)value; break;
+			case UPET_DMOTION: pd->status.dmotion = (int16)value; break;
 			case UPET_GROUP_ID: pd->ud.group_id = value; unit_refresh(bl); break;
 			case UPET_GROUP_ID: pd->ud.group_id = value; unit_refresh(bl); break;
 			default:
 			default:
 				ShowError("buildin_setunitdata: Unknown data identifier %d for BL_PET.\n", type);
 				ShowError("buildin_setunitdata: Unknown data identifier %d for BL_PET.\n", type);
@@ -19501,9 +19501,9 @@ BUILDIN_FUNC(setunitdata)
 			case UMER_HP: mc->base_status.hp = (uint32)value; status_set_hp(bl, (uint32)value, 0); break;
 			case UMER_HP: mc->base_status.hp = (uint32)value; status_set_hp(bl, (uint32)value, 0); break;
 			case UMER_MAXHP: mc->base_status.hp = mc->base_status.max_hp = (uint32)value; status_set_maxhp(bl, (uint32)value, 0); break;
 			case UMER_MAXHP: mc->base_status.hp = mc->base_status.max_hp = (uint32)value; status_set_maxhp(bl, (uint32)value, 0); break;
 			case UMER_MASTERCID: mc->mercenary.char_id = (uint32)value; break;
 			case UMER_MASTERCID: mc->mercenary.char_id = (uint32)value; break;
-			case UMER_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break;
-			case UMER_X: if (!unit_walktoxy(bl, (short)value, mc->bl.y, 2)) unit_movepos(bl, (short)value, mc->bl.y, 0, 0); break;
-			case UMER_Y: if (!unit_walktoxy(bl, mc->bl.x, (short)value, 2)) unit_movepos(bl, mc->bl.x, (short)value, 0, 0); break;
+			case UMER_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (int16)value, 0, 0, CLR_TELEPORT); break;
+			case UMER_X: if (!unit_walktoxy(bl, (int16)value, mc->bl.y, 2)) unit_movepos(bl, (int16)value, mc->bl.y, 0, 0); break;
+			case UMER_Y: if (!unit_walktoxy(bl, mc->bl.x, (int16)value, 2)) unit_movepos(bl, mc->bl.x, (int16)value, 0, 0); break;
 			case UMER_KILLCOUNT: mc->mercenary.kill_count = (uint32)value; break;
 			case UMER_KILLCOUNT: mc->mercenary.kill_count = (uint32)value; break;
 			case UMER_LIFETIME: mc->mercenary.life_time = (uint32)value; break;
 			case UMER_LIFETIME: mc->mercenary.life_time = (uint32)value; break;
 			case UMER_SPEED: mc->base_status.speed = (uint16)value; status_calc_misc(bl, &mc->base_status, mc->db->lv); calc_status = true; break;
 			case UMER_SPEED: mc->base_status.speed = (uint16)value; status_calc_misc(bl, &mc->base_status, mc->db->lv); calc_status = true; break;
@@ -19523,16 +19523,16 @@ BUILDIN_FUNC(setunitdata)
 			case UMER_MATKMAX: mc->base_status.matk_max = (uint16)value; calc_status = true; break;
 			case UMER_MATKMAX: mc->base_status.matk_max = (uint16)value; calc_status = true; break;
 			case UMER_DEF: mc->base_status.def = (defType)value; calc_status = true; break;
 			case UMER_DEF: mc->base_status.def = (defType)value; calc_status = true; break;
 			case UMER_MDEF: mc->base_status.mdef = (defType)value; calc_status = true; break;
 			case UMER_MDEF: mc->base_status.mdef = (defType)value; calc_status = true; break;
-			case UMER_HIT: mc->base_status.hit = (short)value; calc_status = true; break;
-			case UMER_FLEE: mc->base_status.flee = (short)value; calc_status = true; break;
-			case UMER_PDODGE: mc->base_status.flee2 = (short)value; calc_status = true; break;
-			case UMER_CRIT: mc->base_status.cri = (short)value; calc_status = true; break;
+			case UMER_HIT: mc->base_status.hit = (int16)value; calc_status = true; break;
+			case UMER_FLEE: mc->base_status.flee = (int16)value; calc_status = true; break;
+			case UMER_PDODGE: mc->base_status.flee2 = (int16)value; calc_status = true; break;
+			case UMER_CRIT: mc->base_status.cri = (int16)value; calc_status = true; break;
 			case UMER_RACE: mc->battle_status.race = mc->base_status.race = (unsigned char)value; break;
 			case UMER_RACE: mc->battle_status.race = mc->base_status.race = (unsigned char)value; break;
 			case UMER_ELETYPE: mc->base_status.def_ele = (unsigned char)value; calc_status = true; break;
 			case UMER_ELETYPE: mc->base_status.def_ele = (unsigned char)value; calc_status = true; break;
 			case UMER_ELELEVEL: mc->base_status.ele_lv = (unsigned char)value; calc_status = true; break;
 			case UMER_ELELEVEL: mc->base_status.ele_lv = (unsigned char)value; calc_status = true; break;
-			case UMER_AMOTION: mc->base_status.amotion = (short)value; calc_status = true; break;
-			case UMER_ADELAY: mc->base_status.adelay = (short)value; calc_status = true; break;
-			case UMER_DMOTION: mc->base_status.dmotion = (short)value; calc_status = true; break;
+			case UMER_AMOTION: mc->base_status.amotion = (int16)value; calc_status = true; break;
+			case UMER_ADELAY: mc->base_status.adelay = (int16)value; calc_status = true; break;
+			case UMER_DMOTION: mc->base_status.dmotion = (int16)value; calc_status = true; break;
 			case UMER_TARGETID: {
 			case UMER_TARGETID: {
 				if (value==0) {
 				if (value==0) {
 					unit_stop_attack(&mc->bl);
 					unit_stop_attack(&mc->bl);
@@ -19571,9 +19571,9 @@ BUILDIN_FUNC(setunitdata)
 			case UELE_SP: ed->base_status.sp = (uint32)value; status_set_sp(bl, (uint32)value, 0); break;
 			case UELE_SP: ed->base_status.sp = (uint32)value; status_set_sp(bl, (uint32)value, 0); break;
 			case UELE_MAXSP: ed->base_status.sp = ed->base_status.max_sp = (uint32)value; status_set_maxsp(bl, (uint32)value, 0); break;
 			case UELE_MAXSP: ed->base_status.sp = ed->base_status.max_sp = (uint32)value; status_set_maxsp(bl, (uint32)value, 0); break;
 			case UELE_MASTERCID: ed->elemental.char_id = (uint32)value; break;
 			case UELE_MASTERCID: ed->elemental.char_id = (uint32)value; break;
-			case UELE_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break;
-			case UELE_X: if (!unit_walktoxy(bl, (short)value, ed->bl.y, 2)) unit_movepos(bl, (short)value, ed->bl.y, 0, 0); break;
-			case UELE_Y: if (!unit_walktoxy(bl, ed->bl.x, (short)value, 2)) unit_movepos(bl, ed->bl.x, (short)value, 0, 0); break;
+			case UELE_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (int16)value, 0, 0, CLR_TELEPORT); break;
+			case UELE_X: if (!unit_walktoxy(bl, (int16)value, ed->bl.y, 2)) unit_movepos(bl, (int16)value, ed->bl.y, 0, 0); break;
+			case UELE_Y: if (!unit_walktoxy(bl, ed->bl.x, (int16)value, 2)) unit_movepos(bl, ed->bl.x, (int16)value, 0, 0); break;
 			case UELE_LIFETIME: ed->elemental.life_time = (uint32)value; break;
 			case UELE_LIFETIME: ed->elemental.life_time = (uint32)value; break;
 			case UELE_MODE: ed->elemental.mode = (enum e_mode)value; calc_status = true; break;
 			case UELE_MODE: ed->elemental.mode = (enum e_mode)value; calc_status = true; break;
 			case UELE_SPEED: ed->base_status.speed = (uint16)value; status_calc_misc(bl, &ed->base_status, ed->db->lv); calc_status = true; break;
 			case UELE_SPEED: ed->base_status.speed = (uint16)value; status_calc_misc(bl, &ed->base_status, ed->db->lv); calc_status = true; break;
@@ -19593,16 +19593,16 @@ BUILDIN_FUNC(setunitdata)
 			case UELE_MATKMAX: ed->base_status.matk_max = (uint16)value; calc_status = true; break;
 			case UELE_MATKMAX: ed->base_status.matk_max = (uint16)value; calc_status = true; break;
 			case UELE_DEF: ed->base_status.def = (defType)value; calc_status = true; break;
 			case UELE_DEF: ed->base_status.def = (defType)value; calc_status = true; break;
 			case UELE_MDEF: ed->base_status.mdef = (defType)value; calc_status = true; break;
 			case UELE_MDEF: ed->base_status.mdef = (defType)value; calc_status = true; break;
-			case UELE_HIT: ed->base_status.hit = (short)value; calc_status = true; break;
-			case UELE_FLEE: ed->base_status.flee = (short)value; calc_status = true; break;
-			case UELE_PDODGE: ed->base_status.flee2 = (short)value; calc_status = true; break;
-			case UELE_CRIT: ed->base_status.cri = (short)value; calc_status = true; break;
+			case UELE_HIT: ed->base_status.hit = (int16)value; calc_status = true; break;
+			case UELE_FLEE: ed->base_status.flee = (int16)value; calc_status = true; break;
+			case UELE_PDODGE: ed->base_status.flee2 = (int16)value; calc_status = true; break;
+			case UELE_CRIT: ed->base_status.cri = (int16)value; calc_status = true; break;
 			case UELE_RACE: ed->battle_status.race = ed->base_status.race = (unsigned char)value; break;
 			case UELE_RACE: ed->battle_status.race = ed->base_status.race = (unsigned char)value; break;
 			case UELE_ELETYPE: ed->base_status.def_ele = (unsigned char)value; calc_status = true; break;
 			case UELE_ELETYPE: ed->base_status.def_ele = (unsigned char)value; calc_status = true; break;
 			case UELE_ELELEVEL: ed->base_status.ele_lv = (unsigned char)value; calc_status = true; break;
 			case UELE_ELELEVEL: ed->base_status.ele_lv = (unsigned char)value; calc_status = true; break;
-			case UELE_AMOTION: ed->base_status.amotion = (short)value; calc_status = true; break;
-			case UELE_ADELAY: ed->base_status.adelay = (short)value; calc_status = true; break;
-			case UELE_DMOTION: ed->base_status.dmotion = (short)value; calc_status = true; break;
+			case UELE_AMOTION: ed->base_status.amotion = (int16)value; calc_status = true; break;
+			case UELE_ADELAY: ed->base_status.adelay = (int16)value; calc_status = true; break;
+			case UELE_DMOTION: ed->base_status.dmotion = (int16)value; calc_status = true; break;
 			case UELE_TARGETID: {
 			case UELE_TARGETID: {
 				if (value==0) {
 				if (value==0) {
 					unit_stop_attack(&ed->bl);
 					unit_stop_attack(&ed->bl);
@@ -19642,9 +19642,9 @@ BUILDIN_FUNC(setunitdata)
 			case UNPC_LEVEL: nd->level = (uint32)value; break;
 			case UNPC_LEVEL: nd->level = (uint32)value; break;
 			case UNPC_HP: nd->status.hp = (uint32)value; status_set_hp(bl, (uint32)value, 0); break;
 			case UNPC_HP: nd->status.hp = (uint32)value; status_set_hp(bl, (uint32)value, 0); break;
 			case UNPC_MAXHP: nd->status.hp = nd->status.max_hp = (uint32)value; status_set_maxhp(bl, (uint32)value, 0); break;
 			case UNPC_MAXHP: nd->status.hp = nd->status.max_hp = (uint32)value; status_set_maxhp(bl, (uint32)value, 0); break;
-			case UNPC_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break;
-			case UNPC_X: if (!unit_walktoxy(bl, (short)value, nd->bl.y, 2)) unit_movepos(bl, (short)value, nd->bl.x, 0, 0); break;
-			case UNPC_Y: if (!unit_walktoxy(bl, nd->bl.x, (short)value, 2)) unit_movepos(bl, nd->bl.x, (short)value, 0, 0); break;
+			case UNPC_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (int16)value, 0, 0, CLR_TELEPORT); break;
+			case UNPC_X: if (!unit_walktoxy(bl, (int16)value, nd->bl.y, 2)) unit_movepos(bl, (int16)value, nd->bl.x, 0, 0); break;
+			case UNPC_Y: if (!unit_walktoxy(bl, nd->bl.x, (int16)value, 2)) unit_movepos(bl, nd->bl.x, (int16)value, 0, 0); break;
 			case UNPC_LOOKDIR: unit_setdir(bl, (uint8)value); break;
 			case UNPC_LOOKDIR: unit_setdir(bl, (uint8)value); break;
 			case UNPC_STR: nd->params.str = (uint16)value; status_calc_misc(bl, &nd->status, nd->level); break;
 			case UNPC_STR: nd->params.str = (uint16)value; status_calc_misc(bl, &nd->status, nd->level); break;
 			case UNPC_AGI: nd->params.agi = (uint16)value; status_calc_misc(bl, &nd->status, nd->level); break;
 			case UNPC_AGI: nd->params.agi = (uint16)value; status_calc_misc(bl, &nd->status, nd->level); break;
@@ -19660,18 +19660,18 @@ BUILDIN_FUNC(setunitdata)
 			case UNPC_MATKMAX: nd->status.matk_max = (uint16)value; break;
 			case UNPC_MATKMAX: nd->status.matk_max = (uint16)value; break;
 			case UNPC_DEF: nd->status.def = (defType)value; break;
 			case UNPC_DEF: nd->status.def = (defType)value; break;
 			case UNPC_MDEF: nd->status.mdef = (defType)value; break;
 			case UNPC_MDEF: nd->status.mdef = (defType)value; break;
-			case UNPC_HIT: nd->status.hit = (short)value; break;
-			case UNPC_FLEE: nd->status.flee = (short)value; break;
-			case UNPC_PDODGE: nd->status.flee2 = (short)value; break;
-			case UNPC_CRIT: nd->status.cri = (short)value; break;
+			case UNPC_HIT: nd->status.hit = (int16)value; break;
+			case UNPC_FLEE: nd->status.flee = (int16)value; break;
+			case UNPC_PDODGE: nd->status.flee2 = (int16)value; break;
+			case UNPC_CRIT: nd->status.cri = (int16)value; break;
 			case UNPC_RACE: nd->status.race = (unsigned char)value; break;
 			case UNPC_RACE: nd->status.race = (unsigned char)value; break;
 			case UNPC_ELETYPE: nd->status.def_ele = (unsigned char)value; break;
 			case UNPC_ELETYPE: nd->status.def_ele = (unsigned char)value; break;
 			case UNPC_ELELEVEL: nd->status.ele_lv = (unsigned char)value; break;
 			case UNPC_ELELEVEL: nd->status.ele_lv = (unsigned char)value; break;
-			case UNPC_AMOTION: nd->status.amotion = (short)value; break;
-			case UNPC_ADELAY: nd->status.adelay = (short)value; break;
-			case UNPC_DMOTION: nd->status.dmotion = (short)value; break;
+			case UNPC_AMOTION: nd->status.amotion = (int16)value; break;
+			case UNPC_ADELAY: nd->status.adelay = (int16)value; break;
+			case UNPC_DMOTION: nd->status.dmotion = (int16)value; break;
 			case UNPC_SEX: nd->vd.sex = (char)value; unit_refresh(bl); break;
 			case UNPC_SEX: nd->vd.sex = (char)value; unit_refresh(bl); break;
-			case UNPC_CLASS: npc_setclass(nd, (short)value); break;
+			case UNPC_CLASS: npc_setclass(nd, (int16)value); break;
 			case UNPC_HAIRSTYLE: clif_changelook(bl, LOOK_HAIR, (uint16)value); break;
 			case UNPC_HAIRSTYLE: clif_changelook(bl, LOOK_HAIR, (uint16)value); break;
 			case UNPC_HAIRCOLOR: clif_changelook(bl, LOOK_HAIR_COLOR, (uint16)value); break;
 			case UNPC_HAIRCOLOR: clif_changelook(bl, LOOK_HAIR_COLOR, (uint16)value); break;
 			case UNPC_HEADBOTTOM: clif_changelook(bl, LOOK_HEAD_BOTTOM, (uint16)value); break;
 			case UNPC_HEADBOTTOM: clif_changelook(bl, LOOK_HEAD_BOTTOM, (uint16)value); break;
@@ -19913,14 +19913,14 @@ BUILDIN_FUNC(unitkill)
 BUILDIN_FUNC(unitwarp)
 BUILDIN_FUNC(unitwarp)
 {
 {
 	int32 map_idx;
 	int32 map_idx;
-	short x;
-	short y;
+	int16 x;
+	int16 y;
 	struct block_list* bl;
 	struct block_list* bl;
 	const char *mapname;
 	const char *mapname;
 
 
 	mapname = script_getstr(st, 3);
 	mapname = script_getstr(st, 3);
-	x = (short)script_getnum(st,4);
-	y = (short)script_getnum(st,5);
+	x = (int16)script_getnum(st,4);
+	y = (int16)script_getnum(st,5);
 
 
 	if(!script_rid2bl(2,bl))
 	if(!script_rid2bl(2,bl))
 	{
 	{
@@ -20397,7 +20397,7 @@ BUILDIN_FUNC(warpportal)
 	group = skill_unitsetting(bl, AL_WARP, 4, spx, spy, 0);
 	group = skill_unitsetting(bl, AL_WARP, 4, spx, spy, 0);
 	if( group == nullptr )
 	if( group == nullptr )
 		return SCRIPT_CMD_FAILURE;// failed
 		return SCRIPT_CMD_FAILURE;// failed
-	group->val1 = (group->val1<<16)|(short)0;
+	group->val1 = (group->val1<<16)|(int16)0;
 	group->val2 = (tpx<<16) | tpy;
 	group->val2 = (tpx<<16) | tpy;
 	group->val3 = mapindex;
 	group->val3 = mapindex;
 
 
@@ -24670,7 +24670,7 @@ BUILDIN_FUNC(getrandomoptinfo) {
 BUILDIN_FUNC(getequiprandomoption) {
 BUILDIN_FUNC(getequiprandomoption) {
 	map_session_data *sd;
 	map_session_data *sd;
 	int32 val;
 	int32 val;
-	short i = -1;
+	int16 i = -1;
 	int32 pos = script_getnum(st, 2);
 	int32 pos = script_getnum(st, 2);
 	int32 index = script_getnum(st, 3);
 	int32 index = script_getnum(st, 3);
 	int32 type = script_getnum(st, 4);
 	int32 type = script_getnum(st, 4);
@@ -26095,7 +26095,7 @@ BUILDIN_FUNC(mail){
 		for( i = 0; i < num_items && start < end; i++, start++ ){
 		for( i = 0; i < num_items && start < end; i++, start++ ){
 			std::shared_ptr<item_data> itm = item_db.find(msg.item[i].nameid);
 			std::shared_ptr<item_data> itm = item_db.find(msg.item[i].nameid);
 
 
-			msg.item[i].amount = (short)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
+			msg.item[i].amount = (int16)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
 
 
 			if( msg.item[i].amount <= 0 ){
 			if( msg.item[i].amount <= 0 ){
 				ShowError( "buildin_mail: amount %d for item %u is invalid.\n", msg.item[i].amount, msg.item[i].nameid );
 				ShowError( "buildin_mail: amount %d for item %u is invalid.\n", msg.item[i].amount, msg.item[i].nameid );
@@ -26207,7 +26207,7 @@ BUILDIN_FUNC(mail){
 			}
 			}
 
 
 			for( k = 0; k < num_items && start < end; k++, start++ ){
 			for( k = 0; k < num_items && start < end; k++, start++ ){
-				msg.item[k].option[i].id = (short)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
+				msg.item[k].option[i].id = (int16)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
 			}
 			}
 
 
 			j++;
 			j++;
@@ -26220,7 +26220,7 @@ BUILDIN_FUNC(mail){
 			}
 			}
 
 
 			for( k = 0; k < num_items && start < end; k++, start++ ){
 			for( k = 0; k < num_items && start < end; k++, start++ ){
-				msg.item[k].option[i].value = (short)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
+				msg.item[k].option[i].value = (int16)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
 			}
 			}
 
 
 			j++;
 			j++;

+ 44 - 44
src/map/skill.cpp

@@ -103,7 +103,7 @@ static int32 skill_check_unit_range2 (struct block_list *bl, int32 x, int32 y, u
 static int32 skill_destroy_trap( struct block_list *bl, va_list ap );
 static int32 skill_destroy_trap( struct block_list *bl, va_list ap );
 static int32 skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap);
 static int32 skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap);
 static bool skill_check_condition_sc_required( map_session_data& sd, uint16 skill_id, s_skill_condition& require );
 static bool skill_check_condition_sc_required( map_session_data& sd, uint16 skill_id, s_skill_condition& require );
-static bool skill_check_unit_movepos(uint8 check_flag, struct block_list *bl, short dst_x, short dst_y, int32 easy, bool checkpath);
+static bool skill_check_unit_movepos(uint8 check_flag, struct block_list *bl, int16 dst_x, int16 dst_y, int32 easy, bool checkpath);
 
 
 // Use this function for splash skills that can't hit icewall when cast by players
 // Use this function for splash skills that can't hit icewall when cast by players
 static inline int32 splash_target(struct block_list* bl) {
 static inline int32 splash_target(struct block_list* bl) {
@@ -2850,7 +2850,7 @@ int32 skill_break_equip(struct block_list *src, struct block_list *bl, uint16 wh
 		return 0;
 		return 0;
 	if (sd) {
 	if (sd) {
 		for (i = 0; i < EQI_MAX; i++) {
 		for (i = 0; i < EQI_MAX; i++) {
-			short j = sd->equip_index[i];
+			int16 j = sd->equip_index[i];
 			if (j < 0 || sd->inventory.u.items_inventory[j].attribute == 1 || !sd->inventory_data[j])
 			if (j < 0 || sd->inventory.u.items_inventory[j].attribute == 1 || !sd->inventory_data[j])
 				continue;
 				continue;
 
 
@@ -3062,7 +3062,7 @@ bool skill_strip_equip(struct block_list *src, struct block_list *target, uint16
 		BLOWN_TARGET_BASILICA - if target is in Basilica area (Pre-Renewal)
 		BLOWN_TARGET_BASILICA - if target is in Basilica area (Pre-Renewal)
  * @return Number of knocked back cells done
  * @return Number of knocked back cells done
  */
  */
-short skill_blown(struct block_list* src, struct block_list* target, char count, int8 dir, enum e_skill_blown flag)
+int16 skill_blown(struct block_list* src, struct block_list* target, char count, int8 dir, enum e_skill_blown flag)
 {
 {
 	int32 dx = 0, dy = 0;
 	int32 dx = 0, dy = 0;
 	uint8 checkflag = 0;
 	uint8 checkflag = 0;
@@ -3207,7 +3207,7 @@ void skill_combo_toggle_inf(struct block_list* bl, uint16 skill_id, int32 inf){
 		case MH_EQC:
 		case MH_EQC:
 			{
 			{
 				int32 skill_id2 = ((skill_id==MH_EQC)?MH_TINDER_BREAKER:MH_SONIC_CRAW);
 				int32 skill_id2 = ((skill_id==MH_EQC)?MH_TINDER_BREAKER:MH_SONIC_CRAW);
-				short idx = hom_skill_get_index(skill_id2);
+				int16 idx = hom_skill_get_index(skill_id2);
 				int32 flag = (inf?SKILL_FLAG_TMP_COMBO:SKILL_FLAG_PERMANENT);
 				int32 flag = (inf?SKILL_FLAG_TMP_COMBO:SKILL_FLAG_PERMANENT);
 				TBL_HOM *hd = BL_CAST(BL_HOM, bl);
 				TBL_HOM *hd = BL_CAST(BL_HOM, bl);
 				if (idx == -1)
 				if (idx == -1)
@@ -3648,7 +3648,7 @@ int64 skill_attack (int32 attack_type, struct block_list* src, struct block_list
 			// regardless of caster's equipment (Aegis 11.1)
 			// regardless of caster's equipment (Aegis 11.1)
 			if( dmg.dmg_lv != ATK_MISS && type == 1 ) { //Wiz SL cancelled and consumed fragment
 			if( dmg.dmg_lv != ATK_MISS && type == 1 ) { //Wiz SL cancelled and consumed fragment
 #endif
 #endif
-				short s_ele = skill_get_ele(skill_id, skill_lv);
+				int16 s_ele = skill_get_ele(skill_id, skill_lv);
 
 
 				if (s_ele == ELE_WEAPON) // the skill takes the weapon's element
 				if (s_ele == ELE_WEAPON) // the skill takes the weapon's element
 					s_ele = sstatus->rhw.ele;
 					s_ele = sstatus->rhw.ele;
@@ -4577,7 +4577,7 @@ static TIMER_FUNC(skill_timerskill){
 					break;
 					break;
 				case RG_INTIMIDATE:
 				case RG_INTIMIDATE:
 					if (unit_warp(src,-1,-1,-1,CLR_TELEPORT) == 0) {
 					if (unit_warp(src,-1,-1,-1,CLR_TELEPORT) == 0) {
-						short x,y;
+						int16 x,y;
 						map_search_freecell(src, 0, &x, &y, 1, 1, 0);
 						map_search_freecell(src, 0, &x, &y, 1, 1, 0);
 						if (target != src && !status_isdead(*target))
 						if (target != src && !status_isdead(*target))
 							unit_warp(target, -1, x, y, CLR_TELEPORT);
 							unit_warp(target, -1, x, y, CLR_TELEPORT);
@@ -4815,7 +4815,7 @@ static TIMER_FUNC(skill_timerskill){
 					break;
 					break;
 				case NW_GRENADES_DROPPING: {
 				case NW_GRENADES_DROPPING: {
 						int32 area = skill_get_splash(skl->skill_id, skl->skill_lv);
 						int32 area = skill_get_splash(skl->skill_id, skl->skill_lv);
-						short tmpx = 0, tmpy = 0;
+						int16 tmpx = 0, tmpy = 0;
 
 
 						tmpx = skl->x - area + rnd() % (area * 2 + 1);
 						tmpx = skl->x - area + rnd() % (area * 2 + 1);
 						tmpy = skl->y - area + rnd() % (area * 2 + 1);
 						tmpy = skl->y - area + rnd() % (area * 2 + 1);
@@ -4825,7 +4825,7 @@ static TIMER_FUNC(skill_timerskill){
 				case NW_MISSION_BOMBARD:  {
 				case NW_MISSION_BOMBARD:  {
 						int32 area = skill_get_unit_range(skl->skill_id, skl->skill_lv);
 						int32 area = skill_get_unit_range(skl->skill_id, skl->skill_lv);
 						int32 range = skill_get_splash(skl->skill_id, skl->skill_lv);
 						int32 range = skill_get_splash(skl->skill_id, skl->skill_lv);
-						short tmpx = 0, tmpy = 0;
+						int16 tmpx = 0, tmpy = 0;
 
 
 						tmpx = skl->x - range + rnd() % (range * 2 + 1);
 						tmpx = skl->x - range + rnd() % (range * 2 + 1);
 						tmpy = skl->y - range + rnd() % (range * 2 + 1);
 						tmpy = skl->y - range + rnd() % (range * 2 + 1);
@@ -5497,7 +5497,7 @@ int32 skill_castend_damage_id (struct block_list* src, struct block_list *bl, ui
 			if (!check_distance_bl(src, bl, 0)) {
 			if (!check_distance_bl(src, bl, 0)) {
 #ifdef RENEWAL
 #ifdef RENEWAL
 				uint8 dir = map_calc_dir(src, bl->x, bl->y);
 				uint8 dir = map_calc_dir(src, bl->x, bl->y);
-				short x, y;
+				int16 x, y;
 
 
 				if (dir > 0 && dir < 4)
 				if (dir > 0 && dir < 4)
 					x = -1;
 					x = -1;
@@ -5553,8 +5553,8 @@ int32 skill_castend_damage_id (struct block_list* src, struct block_list *bl, ui
 	case MO_EXTREMITYFIST:
 	case MO_EXTREMITYFIST:
 		{
 		{
 			struct block_list *mbl = bl; // For NJ_ISSEN
 			struct block_list *mbl = bl; // For NJ_ISSEN
-			short x, y, i = 2; // Move 2 cells (From target)
-			short dir = map_calc_dir(src,bl->x,bl->y);
+			int16 x, y, i = 2; // Move 2 cells (From target)
+			int16 dir = map_calc_dir(src,bl->x,bl->y);
 
 
 #ifdef RENEWAL
 #ifdef RENEWAL
 			if (skill_id == MO_EXTREMITYFIST && sd && sd->spiritball_old > 5)
 			if (skill_id == MO_EXTREMITYFIST && sd && sd->spiritball_old > 5)
@@ -6430,8 +6430,8 @@ int32 skill_castend_damage_id (struct block_list* src, struct block_list *bl, ui
 		break;
 		break;
 #ifdef RENEWAL
 #ifdef RENEWAL
 	case NJ_ISSEN: {
 	case NJ_ISSEN: {
-		short x, y;
-		short dir = map_calc_dir(src, bl->x, bl->y);
+		int16 x, y;
+		int16 dir = map_calc_dir(src, bl->x, bl->y);
 
 
 		// Move 2 cells (From target)
 		// Move 2 cells (From target)
 		if (dir > 0 && dir < 4)
 		if (dir > 0 && dir < 4)
@@ -6515,7 +6515,7 @@ int32 skill_castend_damage_id (struct block_list* src, struct block_list *bl, ui
 	case NJ_KIRIKAGE:
 	case NJ_KIRIKAGE:
 		if( !map_flag_gvg2(src->m) && !map_getmapflag(src->m, MF_BATTLEGROUND) )
 		if( !map_flag_gvg2(src->m) && !map_getmapflag(src->m, MF_BATTLEGROUND) )
 		{	//You don't move on GVG grounds.
 		{	//You don't move on GVG grounds.
-			short x, y;
+			int16 x, y;
 			map_search_freecell(bl, 0, &x, &y, 1, 1, 0);
 			map_search_freecell(bl, 0, &x, &y, 1, 1, 0);
 			if (unit_movepos(src, x, y, 0, 0)) {
 			if (unit_movepos(src, x, y, 0, 0)) {
 				clif_blown(src);
 				clif_blown(src);
@@ -6544,8 +6544,8 @@ int32 skill_castend_damage_id (struct block_list* src, struct block_list *bl, ui
 		break;
 		break;
 	case GC_DARKILLUSION:
 	case GC_DARKILLUSION:
 		{
 		{
-			short x, y;
-			short dir = map_calc_dir(src,bl->x,bl->y);
+			int16 x, y;
+			int16 dir = map_calc_dir(src,bl->x,bl->y);
 
 
 			if( dir > 0 && dir < 4) x = 2;
 			if( dir > 0 && dir < 4) x = 2;
 			else if( dir > 4 ) x = -2;
 			else if( dir > 4 ) x = -2;
@@ -6855,7 +6855,7 @@ int32 skill_castend_damage_id (struct block_list* src, struct block_list *bl, ui
 		if( flag&1 )
 		if( flag&1 )
 			skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag);
 			skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag);
 		else {
 		else {
-			short x, y;
+			int16 x, y;
 			map_search_freecell(src, 0, &x, &y, -1, -1, 0);
 			map_search_freecell(src, 0, &x, &y, -1, -1, 0);
 			// Destination area
 			// Destination area
 			skill_area_temp[4] = x;
 			skill_area_temp[4] = x;
@@ -6946,8 +6946,8 @@ int32 skill_castend_damage_id (struct block_list* src, struct block_list *bl, ui
 		break;
 		break;
 
 
 	case KO_JYUMONJIKIRI: {
 	case KO_JYUMONJIKIRI: {
-			short x, y;
-			short dir = map_calc_dir(src,bl->x,bl->y);
+			int16 x, y;
+			int16 dir = map_calc_dir(src,bl->x,bl->y);
 
 
 			if (dir > 0 && dir < 4)
 			if (dir > 0 && dir < 4)
 				x = 2;
 				x = 2;
@@ -7504,7 +7504,7 @@ int32 skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
 			return skill_castend_damage_id (src, bl, skill_id, skill_lv, tick, flag);
 			return skill_castend_damage_id (src, bl, skill_id, skill_lv, tick, flag);
 		case MH_STEINWAND: {
 		case MH_STEINWAND: {
 			struct block_list *s_src = battle_get_master(src);
 			struct block_list *s_src = battle_get_master(src);
-			short ret = 0;
+			int16 ret = 0;
 			if(!skill_check_unit_range(src, src->x, src->y, skill_id, skill_lv))  //prevent reiteration
 			if(!skill_check_unit_range(src, src->x, src->y, skill_id, skill_lv))  //prevent reiteration
 			    ret = skill_castend_pos2(src,src->x,src->y,skill_id,skill_lv,tick,flag); //cast on homon
 			    ret = skill_castend_pos2(src,src->x,src->y,skill_id,skill_lv,tick,flag); //cast on homon
 			if(s_src && !skill_check_unit_range(s_src, s_src->x, s_src->y, skill_id, skill_lv))
 			if(s_src && !skill_check_unit_range(s_src, s_src->x, s_src->y, skill_id, skill_lv))
@@ -7923,7 +7923,7 @@ int32 skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
 		// 100% success rate at lv4 & 5, but lasts longer at lv5
 		// 100% success rate at lv4 & 5, but lasts longer at lv5
 		if(!clif_skill_nodamage(src,*bl,skill_id,skill_lv, sc_start(src,bl,type,(60+skill_lv*10),skill_lv, skill_get_time(skill_id,skill_lv)))) {
 		if(!clif_skill_nodamage(src,*bl,skill_id,skill_lv, sc_start(src,bl,type,(60+skill_lv*10),skill_lv, skill_get_time(skill_id,skill_lv)))) {
 			if (dstsd){
 			if (dstsd){
-				short index = dstsd->equip_index[EQI_HAND_R];
+				int16 index = dstsd->equip_index[EQI_HAND_R];
 				if (index != -1 && dstsd->inventory_data[index] && dstsd->inventory_data[index]->type == IT_WEAPON)
 				if (index != -1 && dstsd->inventory_data[index] && dstsd->inventory_data[index]->type == IT_WEAPON)
 					pc_unequipitem(dstsd, index, 3); //Must unequip the weapon instead of breaking it [Daegaladh]
 					pc_unequipitem(dstsd, index, 3); //Must unequip the weapon instead of breaking it [Daegaladh]
 			}
 			}
@@ -8370,7 +8370,7 @@ int32 skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
 			int32 bonus = 0;
 			int32 bonus = 0;
 
 
 			if (dstsd) {
 			if (dstsd) {
-				short index = dstsd->equip_index[EQI_HAND_R];
+				int16 index = dstsd->equip_index[EQI_HAND_R];
 
 
 				if (index >= 0 && dstsd->inventory_data[index] && dstsd->inventory_data[index]->type == IT_WEAPON)
 				if (index >= 0 && dstsd->inventory_data[index] && dstsd->inventory_data[index]->type == IT_WEAPON)
 					bonus = (20 * skill_lv) * dstsd->inventory_data[index]->weapon_level;
 					bonus = (20 * skill_lv) * dstsd->inventory_data[index]->weapon_level;
@@ -9820,7 +9820,7 @@ int32 skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
 	case AM_TWILIGHT3:
 	case AM_TWILIGHT3:
 		if (sd) {
 		if (sd) {
 			int32 ebottle = pc_search_inventory(sd,ITEMID_EMPTY_BOTTLE);
 			int32 ebottle = pc_search_inventory(sd,ITEMID_EMPTY_BOTTLE);
-			short alcohol_idx = -1, acid_idx = -1, fire_idx = -1;
+			int16 alcohol_idx = -1, acid_idx = -1, fire_idx = -1;
 			if( ebottle >= 0 )
 			if( ebottle >= 0 )
 				ebottle = sd->inventory.u.items_inventory[ebottle].amount;
 				ebottle = sd->inventory.u.items_inventory[ebottle].amount;
 			//check if you can produce all three, if not, then fail:
 			//check if you can produce all three, if not, then fail:
@@ -9901,7 +9901,7 @@ int32 skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
 
 
 	case TF_BACKSLIDING: //This is the correct implementation as per packet logging information. [Skotlex]
 	case TF_BACKSLIDING: //This is the correct implementation as per packet logging information. [Skotlex]
 		{
 		{
-			short blew_count = skill_blown(src,bl,skill_get_blewcount(skill_id,skill_lv),unit_getdir(bl),(enum e_skill_blown)(BLOWN_IGNORE_NO_KNOCKBACK
+			int16 blew_count = skill_blown(src,bl,skill_get_blewcount(skill_id,skill_lv),unit_getdir(bl),(enum e_skill_blown)(BLOWN_IGNORE_NO_KNOCKBACK
 #ifdef RENEWAL
 #ifdef RENEWAL
 			|BLOWN_DONT_SEND_PACKET
 			|BLOWN_DONT_SEND_PACKET
 #endif
 #endif
@@ -11173,12 +11173,12 @@ int32 skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
 
 
 	case GC_ROLLINGCUTTER:
 	case GC_ROLLINGCUTTER:
 		{
 		{
-			short count = 1;
+			int16 count = 1;
 			skill_area_temp[2] = 0;
 			skill_area_temp[2] = 0;
 			map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|SD_SPLASH|1,skill_castend_damage_id);
 			map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|SD_SPLASH|1,skill_castend_damage_id);
 			if( tsc && tsc->getSCE(SC_ROLLINGCUTTER) )
 			if( tsc && tsc->getSCE(SC_ROLLINGCUTTER) )
 			{ // Every time the skill is casted the status change is reseted adding a counter.
 			{ // Every time the skill is casted the status change is reseted adding a counter.
-				count += (short)tsc->getSCE(SC_ROLLINGCUTTER)->val1;
+				count += (int16)tsc->getSCE(SC_ROLLINGCUTTER)->val1;
 				if( count > 10 )
 				if( count > 10 )
 					count = 10; // Max coounter
 					count = 10; // Max coounter
 				status_change_end(bl, SC_ROLLINGCUTTER);
 				status_change_end(bl, SC_ROLLINGCUTTER);
@@ -11853,7 +11853,7 @@ int32 skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
 
 
 	case SR_RAISINGDRAGON:
 	case SR_RAISINGDRAGON:
 		if( sd ) {
 		if( sd ) {
-			short max = 5 + skill_lv;
+			int16 max = 5 + skill_lv;
 			sc_start(src,bl, SC_EXPLOSIONSPIRITS, 100, skill_lv, skill_get_time(skill_id, skill_lv));
 			sc_start(src,bl, SC_EXPLOSIONSPIRITS, 100, skill_lv, skill_get_time(skill_id, skill_lv));
 			for( i = 0; i < max; i++ ) // Don't call more than max available spheres.
 			for( i = 0; i < max; i++ ) // Don't call more than max available spheres.
 				pc_addspiritball(sd, skill_get_time(skill_id, skill_lv), max);
 				pc_addspiritball(sd, skill_get_time(skill_id, skill_lv), max);
@@ -13997,8 +13997,8 @@ TIMER_FUNC(skill_castend_id){
 		status_change_end(src, SC_EXPLOSIONSPIRITS);
 		status_change_end(src, SC_EXPLOSIONSPIRITS);
 		status_change_end(src, SC_BLADESTOP);
 		status_change_end(src, SC_BLADESTOP);
 		if( target && target->m == src->m ) { //Move character to target anyway.
 		if( target && target->m == src->m ) { //Move character to target anyway.
-			short x, y;
-			short dir = map_calc_dir(src,target->x,target->y);
+			int16 x, y;
+			int16 dir = map_calc_dir(src,target->x,target->y);
 
 
 			//Move 3 cells (From Caster)
 			//Move 3 cells (From Caster)
 			if( dir > 0 && dir < 4 )
 			if( dir > 0 && dir < 4 )
@@ -14532,7 +14532,7 @@ int32 skill_castend_pos2(struct block_list* src, int32 x, int32 y, uint16 skill_
 	case WZ_METEOR:
 	case WZ_METEOR:
 	{
 	{
 		int32 area = skill_get_splash(skill_id, skill_lv);
 		int32 area = skill_get_splash(skill_id, skill_lv);
-		short tmpx = 0, tmpy = 0;
+		int16 tmpx = 0, tmpy = 0;
 
 
 		for (i = 1; i <= skill_get_time(skill_id, skill_lv) / skill_get_unit_interval(skill_id); i++) {
 		for (i = 1; i <= skill_get_time(skill_id, skill_lv) / skill_get_unit_interval(skill_id); i++) {
 			// Creates a random Cell in the Splash Area
 			// Creates a random Cell in the Splash Area
@@ -15135,7 +15135,7 @@ int32 skill_castend_pos2(struct block_list* src, int32 x, int32 y, uint16 skill_
 	case NPC_RAINOFMETEOR:
 	case NPC_RAINOFMETEOR:
 		{
 		{
 			int32 area = skill_get_splash(skill_id, skill_lv);
 			int32 area = skill_get_splash(skill_id, skill_lv);
-			short tmpx = 0, tmpy = 0;
+			int16 tmpx = 0, tmpy = 0;
 
 
 			for (i = 1; i <= (skill_get_time(skill_id, skill_lv)/skill_get_unit_interval(skill_id)); i++) {
 			for (i = 1; i <= (skill_get_time(skill_id, skill_lv)/skill_get_unit_interval(skill_id)); i++) {
 				// Casts a double meteor in the first interval.
 				// Casts a double meteor in the first interval.
@@ -15438,7 +15438,7 @@ int32 skill_castend_map (map_session_data *sd, uint16 skill_id, const char *mapn
 				return 0;
 				return 0;
 			}
 			}
 
 
-			group->val1 = (group->val1<<16)|(short)0;
+			group->val1 = (group->val1<<16)|(int16)0;
 			// record the destination coordinates
 			// record the destination coordinates
 			group->val2 = (x<<16)|y;
 			group->val2 = (x<<16)|y;
 			group->val3 = mapindex;
 			group->val3 = mapindex;
@@ -17316,7 +17316,7 @@ int32 skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, t
 			break;
 			break;
 
 
 		case UNT_ABYSS_SQUARE: {
 		case UNT_ABYSS_SQUARE: {
-				short flag = 0;
+				int16 flag = 0;
 
 
 				// Check to see if the caster is in the AoE.
 				// Check to see if the caster is in the AoE.
 				if (distance_bl(ss, &unit->bl) <= unit->range)
 				if (distance_bl(ss, &unit->bl) <= unit->range)
@@ -19079,7 +19079,7 @@ bool skill_check_condition_castend( map_session_data& sd, uint16 skill_id, uint1
 	struct s_skill_condition require;
 	struct s_skill_condition require;
 	struct status_data *status;
 	struct status_data *status;
 	int32 i;
 	int32 i;
-	short index[MAX_SKILL_ITEM_REQUIRE];
+	int16 index[MAX_SKILL_ITEM_REQUIRE];
 
 
 	if( sd.chatID )
 	if( sd.chatID )
 		return false;
 		return false;
@@ -19343,7 +19343,7 @@ bool skill_check_condition_castend( map_session_data& sd, uint16 skill_id, uint1
  *  type&1: consume the others (before skill was used);
  *  type&1: consume the others (before skill was used);
  *  type&2: consume items (after skill was used)
  *  type&2: consume items (after skill was used)
  */
  */
-void skill_consume_requirement(map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type)
+void skill_consume_requirement(map_session_data *sd, uint16 skill_id, uint16 skill_lv, int16 type)
 {
 {
 	struct s_skill_condition require;
 	struct s_skill_condition require;
 
 
@@ -21654,7 +21654,7 @@ int32 skill_delunitgroup_(std::shared_ptr<s_skill_unit_group> group, const char*
 {
 {
 	struct block_list* src;
 	struct block_list* src;
 	struct unit_data *ud;
 	struct unit_data *ud;
-	short i;
+	int16 i;
 	int32 link_group_id;
 	int32 link_group_id;
 
 
 	if( group == nullptr ) {
 	if( group == nullptr ) {
@@ -22469,14 +22469,14 @@ void skill_unit_move_unit_group(std::shared_ptr<s_skill_unit_group> group, int16
  * @param qty Amount of item will be created
  * @param qty Amount of item will be created
  * @return 0 If failed or Index+1 of item found on skill_produce_db[]
  * @return 0 If failed or Index+1 of item found on skill_produce_db[]
  */
  */
-short skill_can_produce_mix(map_session_data *sd, t_itemid nameid, int32 trigger, int32 qty)
+int16 skill_can_produce_mix(map_session_data *sd, t_itemid nameid, int32 trigger, int32 qty)
 {
 {
 	nullpo_ret(sd);
 	nullpo_ret(sd);
 
 
 	if (!item_db.exists(nameid))
 	if (!item_db.exists(nameid))
 		return 0;
 		return 0;
 
 
-	short i, j;
+	int16 i, j;
 
 
 	for (i = 0; i < MAX_SKILL_PRODUCE_DB; i++) {
 	for (i = 0; i < MAX_SKILL_PRODUCE_DB; i++) {
 		if (skill_produce_db[i].nameid == nameid) {
 		if (skill_produce_db[i].nameid == nameid) {
@@ -22549,7 +22549,7 @@ short skill_can_produce_mix(map_session_data *sd, t_itemid nameid, int32 trigger
  * @param produce_idx Index of produce entry in skill_produce_db[]. (Optional. Assumed the requirements are complete, checked somewhere)
  * @param produce_idx Index of produce entry in skill_produce_db[]. (Optional. Assumed the requirements are complete, checked somewhere)
  * @return True is success, False if failed
  * @return True is success, False if failed
  */
  */
-bool skill_produce_mix(map_session_data *sd, uint16 skill_id, t_itemid nameid, int32 slot1, int32 slot2, int32 slot3, int32 qty, short produce_idx)
+bool skill_produce_mix(map_session_data *sd, uint16 skill_id, t_itemid nameid, int32 slot1, int32 slot2, int32 slot3, int32 qty, int16 produce_idx)
 {
 {
 	int32 slot[3];
 	int32 slot[3];
 	int32 i, sc, ele, idx, equip, wlv, make_per = 0, flag = 0, skill_lv = 0;
 	int32 i, sc, ele, idx, equip, wlv, make_per = 0, flag = 0, skill_lv = 0;
@@ -22585,7 +22585,7 @@ bool skill_produce_mix(map_session_data *sd, uint16 skill_id, t_itemid nameid, i
 	slot[2] = slot3;
 	slot[2] = slot3;
 
 
 	for (i = 0, sc = 0, ele = 0; i < 3; i++) { //Note that qty should always be one if you are using these!
 	for (i = 0, sc = 0, ele = 0; i < 3; i++) { //Note that qty should always be one if you are using these!
-		short j;
+		int16 j;
 		if (slot[i] <= 0)
 		if (slot[i] <= 0)
 			continue;
 			continue;
 		j = pc_search_inventory(sd,slot[i]);
 		j = pc_search_inventory(sd,slot[i]);
@@ -22603,7 +22603,7 @@ bool skill_produce_mix(map_session_data *sd, uint16 skill_id, t_itemid nameid, i
 	}
 	}
 
 
 	for (i = 0; i < MAX_PRODUCE_RESOURCE; i++) {
 	for (i = 0; i < MAX_PRODUCE_RESOURCE; i++) {
-		short x, j;
+		int16 x, j;
 		t_itemid id = skill_produce_db[idx].mat_id[i];
 		t_itemid id = skill_produce_db[idx].mat_id[i];
 
 
 		if (!item_db.exists(id))
 		if (!item_db.exists(id))
@@ -23231,7 +23231,7 @@ bool skill_arrow_create(map_session_data *sd, t_itemid nameid)
 			break;
 			break;
 		}
 		}
 	}
 	}
-	short j;
+	int16 j;
 
 
 	if (arrow == nullptr || (j = pc_search_inventory(sd,nameid)) < 0 || arrow->created.empty())
 	if (arrow == nullptr || (j = pc_search_inventory(sd,nameid)) < 0 || arrow->created.empty())
 		return false;
 		return false;
@@ -24394,7 +24394,7 @@ int32 skill_get_elemental_type( uint16 skill_id , uint16 skill_lv ) {
  * @param check_flag Flags: 1:Check for BG maps, 2:Check for GVG maps on WOE times, 4:Check for GVG maps regardless Agit flags
  * @param check_flag Flags: 1:Check for BG maps, 2:Check for GVG maps on WOE times, 4:Check for GVG maps regardless Agit flags
  * @return True:If unit can be moved, False:If check on flags are met or unit cannot be moved.
  * @return True:If unit can be moved, False:If check on flags are met or unit cannot be moved.
  **/
  **/
-static bool skill_check_unit_movepos(uint8 check_flag, struct block_list *bl, short dst_x, short dst_y, int32 easy, bool checkpath) {
+static bool skill_check_unit_movepos(uint8 check_flag, struct block_list *bl, int16 dst_x, int16 dst_y, int32 easy, bool checkpath) {
 	status_change *sc;
 	status_change *sc;
 
 
 	nullpo_retr(false, bl);
 	nullpo_retr(false, bl);
@@ -25846,7 +25846,7 @@ uint64 AbraDatabase::parseBodyNode(const ryml::NodeRef& node) {
 static bool skill_parse_row_changematerialdb( char* split[], size_t columns, size_t current ){
 static bool skill_parse_row_changematerialdb( char* split[], size_t columns, size_t current ){
 	uint16 id = atoi(split[0]);
 	uint16 id = atoi(split[0]);
 	t_itemid nameid = strtoul(split[1], nullptr, 10);
 	t_itemid nameid = strtoul(split[1], nullptr, 10);
-	short rate = atoi(split[2]);
+	int16 rate = atoi(split[2]);
 	bool found = false;
 	bool found = false;
 	int32 x, y;
 	int32 x, y;
 
 

+ 6 - 6
src/map/skill.hpp

@@ -354,7 +354,7 @@ struct skill_timerskill {
 	int32 src_id;
 	int32 src_id;
 	int32 target_id;
 	int32 target_id;
 	int32 map;
 	int32 map;
-	short x,y;
+	int16 x,y;
 	uint16 skill_id,skill_lv;
 	uint16 skill_id,skill_lv;
 	int32 type; // a BF_ type (NOTE: some places use this as general-purpose storage...)
 	int32 type; // a BF_ type (NOTE: some places use this as general-purpose storage...)
 	int32 flag;
 	int32 flag;
@@ -366,7 +366,7 @@ struct skill_unit {
 	std::shared_ptr<s_skill_unit_group> group; /// Skill group reference
 	std::shared_ptr<s_skill_unit_group> group; /// Skill group reference
 	t_tick limit;
 	t_tick limit;
 	int32 val1, val2;
 	int32 val1, val2;
-	short range;
+	int16 range;
 	bool alive;
 	bool alive;
 	bool hidden;
 	bool hidden;
 };
 };
@@ -561,7 +561,7 @@ int32 skill_addtimerskill(struct block_list *src,t_tick tick,int32 target,int32
 // Results? Added
 // Results? Added
 int32 skill_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int32 attack_type,enum damage_lv dmg_lv,t_tick tick);
 int32 skill_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int32 attack_type,enum damage_lv dmg_lv,t_tick tick);
 int32 skill_counter_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int32 attack_type,t_tick tick);
 int32 skill_counter_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int32 attack_type,t_tick tick);
-short skill_blown(struct block_list* src, struct block_list* target, char count, int8 dir, enum e_skill_blown flag);
+int16 skill_blown(struct block_list* src, struct block_list* target, char count, int8 dir, enum e_skill_blown flag);
 int32 skill_break_equip(struct block_list *src,struct block_list *bl, uint16 where, int32 rate, int32 flag);
 int32 skill_break_equip(struct block_list *src,struct block_list *bl, uint16 where, int32 rate, int32 flag);
 int32 skill_strip_equip(struct block_list *src,struct block_list *bl, uint16 where, int32 rate, int32 lv, int32 time);
 int32 skill_strip_equip(struct block_list *src,struct block_list *bl, uint16 where, int32 rate, int32 lv, int32 time);
 // Skills unit
 // Skills unit
@@ -595,7 +595,7 @@ int32 skill_check_bl_sc(struct block_list *target, va_list ap);
 bool skill_check_condition_castbegin( map_session_data& sd, uint16 skill_id, uint16 skill_lv );
 bool skill_check_condition_castbegin( map_session_data& sd, uint16 skill_id, uint16 skill_lv );
 bool skill_check_condition_castend( map_session_data& sd, uint16 skill_id, uint16 skill_lv );
 bool skill_check_condition_castend( map_session_data& sd, uint16 skill_id, uint16 skill_lv );
 int32 skill_check_condition_char_sub (struct block_list *bl, va_list ap);
 int32 skill_check_condition_char_sub (struct block_list *bl, va_list ap);
-void skill_consume_requirement(map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type);
+void skill_consume_requirement(map_session_data *sd, uint16 skill_id, uint16 skill_lv, int16 type);
 struct s_skill_condition skill_get_requirement(map_session_data *sd, uint16 skill_id, uint16 skill_lv);
 struct s_skill_condition skill_get_requirement(map_session_data *sd, uint16 skill_id, uint16 skill_lv);
 bool skill_disable_check(status_change &sc, uint16 skill_id);
 bool skill_disable_check(status_change &sc, uint16 skill_id);
 bool skill_pos_maxcount_check(struct block_list *src, int16 x, int16 y, uint16 skill_id, uint16 skill_lv, enum bl_type type, bool display_failure);
 bool skill_pos_maxcount_check(struct block_list *src, int16 x, int16 y, uint16 skill_id, uint16 skill_lv, enum bl_type type, bool display_failure);
@@ -624,8 +624,8 @@ bool skill_isNotOk_mercenary( uint16 skill_id, s_mercenary_data& md);
 bool skill_isNotOk_npcRange(struct block_list *src, uint16 skill_id, uint16 skill_lv, int32 pos_x, int32 pos_y);
 bool skill_isNotOk_npcRange(struct block_list *src, uint16 skill_id, uint16 skill_lv, int32 pos_x, int32 pos_y);
 
 
 // Item creation
 // Item creation
-short skill_can_produce_mix( map_session_data *sd, t_itemid nameid, int32 trigger, int32 qty);
-bool skill_produce_mix( map_session_data *sd, uint16 skill_id, t_itemid nameid, int32 slot1, int32 slot2, int32 slot3, int32 qty, short produce_idx );
+int16 skill_can_produce_mix( map_session_data *sd, t_itemid nameid, int32 trigger, int32 qty);
+bool skill_produce_mix( map_session_data *sd, uint16 skill_id, t_itemid nameid, int32 slot1, int32 slot2, int32 slot3, int32 qty, int16 produce_idx );
 
 
 bool skill_arrow_create( map_session_data *sd, t_itemid nameid);
 bool skill_arrow_create( map_session_data *sd, t_itemid nameid);
 
 

+ 62 - 62
src/map/status.cpp

@@ -50,11 +50,11 @@ enum e_regen {
 static struct eri *sc_data_ers; /// For sc_data entries
 static struct eri *sc_data_ers; /// For sc_data entries
 static struct status_data dummy_status;
 static struct status_data dummy_status;
 
 
-short current_equip_item_index; /// Contains inventory index of an equipped item. To pass it into the EQUP_SCRIPT [Lupus]
+int16 current_equip_item_index; /// Contains inventory index of an equipped item. To pass it into the EQUP_SCRIPT [Lupus]
 uint32 current_equip_combo_pos; /// For combo items we need to save the position of all involved items here
 uint32 current_equip_combo_pos; /// For combo items we need to save the position of all involved items here
 int32 current_equip_card_id; /// To prevent card-stacking (from jA) [Skotlex]
 int32 current_equip_card_id; /// To prevent card-stacking (from jA) [Skotlex]
 // We need it for new cards 15 Feb 2005, to check if the combo cards are insrerted into the CURRENT weapon only to avoid cards exploits
 // We need it for new cards 15 Feb 2005, to check if the combo cards are insrerted into the CURRENT weapon only to avoid cards exploits
-short current_equip_opt_index; /// Contains random option index of an equipped item. [Secret]
+int16 current_equip_opt_index; /// Contains random option index of an equipped item. [Secret]
 
 
 uint16 SCDisabled[SC_MAX]; ///< List of disabled SC on map zones. [Cydh]
 uint16 SCDisabled[SC_MAX]; ///< List of disabled SC on map zones. [Cydh]
 
 
@@ -72,27 +72,27 @@ static uint16 status_calc_con(struct block_list *, status_change *, int32);
 static uint16 status_calc_crt(struct block_list *, status_change *, int32);
 static uint16 status_calc_crt(struct block_list *, status_change *, int32);
 static uint16 status_calc_batk(struct block_list *,status_change *,int32);
 static uint16 status_calc_batk(struct block_list *,status_change *,int32);
 static uint16 status_calc_watk(struct block_list *,status_change *,int32);
 static uint16 status_calc_watk(struct block_list *,status_change *,int32);
-static signed short status_calc_hit(struct block_list *,status_change *,int32);
-static signed short status_calc_critical(struct block_list *,status_change *,int32);
-static signed short status_calc_flee(struct block_list *,status_change *,int32);
-static signed short status_calc_flee2(struct block_list *,status_change *,int32);
+static int16 status_calc_hit(struct block_list *,status_change *,int32);
+static int16 status_calc_critical(struct block_list *,status_change *,int32);
+static int16 status_calc_flee(struct block_list *,status_change *,int32);
+static int16 status_calc_flee2(struct block_list *,status_change *,int32);
 static defType status_calc_def(struct block_list *bl, status_change *sc, int32);
 static defType status_calc_def(struct block_list *bl, status_change *sc, int32);
-static signed short status_calc_def2(struct block_list *,status_change *,int32);
+static int16 status_calc_def2(struct block_list *,status_change *,int32);
 static defType status_calc_mdef(struct block_list *bl, status_change *sc, int32);
 static defType status_calc_mdef(struct block_list *bl, status_change *sc, int32);
-static signed short status_calc_mdef2(struct block_list *,status_change *,int32);
+static int16 status_calc_mdef2(struct block_list *,status_change *,int32);
 static uint16 status_calc_speed(struct block_list *,status_change *,int32);
 static uint16 status_calc_speed(struct block_list *,status_change *,int32);
-static short status_calc_aspd_rate(struct block_list *,status_change *,int32);
+static int16 status_calc_aspd_rate(struct block_list *,status_change *,int32);
 static uint16 status_calc_dmotion(struct block_list *bl, status_change *sc, int32 dmotion);
 static uint16 status_calc_dmotion(struct block_list *bl, status_change *sc, int32 dmotion);
 #ifdef RENEWAL_ASPD
 #ifdef RENEWAL_ASPD
-static short status_calc_aspd(struct block_list *bl, status_change *sc, bool fixed);
-#endif
-static short status_calc_fix_aspd(struct block_list *bl, status_change *sc, int32);
-static signed short status_calc_patk(struct block_list *, status_change *, int32);
-static signed short status_calc_smatk(struct block_list *, status_change *, int32);
-static signed short status_calc_res(struct block_list *, status_change *, int32);
-static signed short status_calc_mres(struct block_list *, status_change *, int32);
-static signed short status_calc_hplus(struct block_list *, status_change *, int32);
-static signed short status_calc_crate(struct block_list *, status_change *, int32);
+static int16 status_calc_aspd(struct block_list *bl, status_change *sc, bool fixed);
+#endif
+static int16 status_calc_fix_aspd(struct block_list *bl, status_change *sc, int32);
+static int16 status_calc_patk(struct block_list *, status_change *, int32);
+static int16 status_calc_smatk(struct block_list *, status_change *, int32);
+static int16 status_calc_res(struct block_list *, status_change *, int32);
+static int16 status_calc_mres(struct block_list *, status_change *, int32);
+static int16 status_calc_hplus(struct block_list *, status_change *, int32);
+static int16 status_calc_crate(struct block_list *, status_change *, int32);
 static uint32 status_calc_maxhp(struct block_list *bl, uint64 maxhp);
 static uint32 status_calc_maxhp(struct block_list *bl, uint64 maxhp);
 static uint32 status_calc_maxsp(struct block_list *bl, uint64 maxsp);
 static uint32 status_calc_maxsp(struct block_list *bl, uint64 maxsp);
 static uint32 status_calc_maxap(struct block_list *bl, uint64 maxap);
 static uint32 status_calc_maxap(struct block_list *bl, uint64 maxap);
@@ -3644,7 +3644,7 @@ int32 status_calc_pc_sub(map_session_data* sd, uint8 opt)
 	status_change *sc = &sd->sc;
 	status_change *sc = &sd->sc;
 	struct s_skill b_skill[MAX_SKILL]; ///< Previous skill tree
 	struct s_skill b_skill[MAX_SKILL]; ///< Previous skill tree
 	int32 i, skill, refinedef = 0;
 	int32 i, skill, refinedef = 0;
-	short index = -1;
+	int16 index = -1;
 
 
 	if (++calculating > 10) // Too many recursive calls!
 	if (++calculating > 10) // Too many recursive calls!
 		return -1;
 		return -1;
@@ -4044,7 +4044,7 @@ int32 status_calc_pc_sub(map_session_data* sd, uint8 opt)
 		
 		
 		if (sd->inventory_data[index]) {
 		if (sd->inventory_data[index]) {
 			for (uint8 j = 0; j < MAX_ITEM_RDM_OPT; j++) {
 			for (uint8 j = 0; j < MAX_ITEM_RDM_OPT; j++) {
-				short opt_id = sd->inventory.u.items_inventory[index].option[j].id;
+				int16 opt_id = sd->inventory.u.items_inventory[index].option[j].id;
 
 
 				if (!opt_id)
 				if (!opt_id)
 					continue;
 					continue;
@@ -7051,7 +7051,7 @@ static uint16 status_calc_watk(struct block_list *bl, status_change *sc, int32 w
 			watk += sc->getSCE(SC_NIBELUNGEN)->val2;
 			watk += sc->getSCE(SC_NIBELUNGEN)->val2;
 		else {
 		else {
 			TBL_PC *sd = (TBL_PC*)bl;
 			TBL_PC *sd = (TBL_PC*)bl;
-			short index = sd->equip_index[sd->state.lr_flag != LR_FLAG_NONE ? EQI_HAND_L : EQI_HAND_R];
+			int16 index = sd->equip_index[sd->state.lr_flag != LR_FLAG_NONE ? EQI_HAND_L : EQI_HAND_R];
 
 
 			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON && sd->inventory_data[index]->weapon_level == 4)
 			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON && sd->inventory_data[index]->weapon_level == 4)
 				watk += sc->getSCE(SC_NIBELUNGEN)->val2;
 				watk += sc->getSCE(SC_NIBELUNGEN)->val2;
@@ -7191,7 +7191,7 @@ uint16 status_calc_consumablematk( status_change *sc, int32 matk ){
  * @param critical: Initial critical
  * @param critical: Initial critical
  * @return modified critical with cap_value(critical,10,USHRT_MAX)
  * @return modified critical with cap_value(critical,10,USHRT_MAX)
  */
  */
-static signed short status_calc_critical(struct block_list *bl, status_change *sc, int32 critical)
+static int16 status_calc_critical(struct block_list *bl, status_change *sc, int32 critical)
 {
 {
 	if(sc == nullptr || sc->empty())
 	if(sc == nullptr || sc->empty())
 		return cap_value(critical,10,SHRT_MAX);
 		return cap_value(critical,10,SHRT_MAX);
@@ -7221,7 +7221,7 @@ static signed short status_calc_critical(struct block_list *bl, status_change *s
 	if (sc->getSCE(SC_INTENSIVE_AIM))
 	if (sc->getSCE(SC_INTENSIVE_AIM))
 		critical += 300;
 		critical += 300;
 
 
-	return (short)cap_value(critical,10,SHRT_MAX);
+	return (int16)cap_value(critical,10,SHRT_MAX);
 }
 }
 
 
 /**
 /**
@@ -7231,7 +7231,7 @@ static signed short status_calc_critical(struct block_list *bl, status_change *s
  * @param hit: Initial hit
  * @param hit: Initial hit
  * @return modified hit with cap_value(hit,1,USHRT_MAX)
  * @return modified hit with cap_value(hit,1,USHRT_MAX)
  */
  */
-static signed short status_calc_hit(struct block_list *bl, status_change *sc, int32 hit)
+static int16 status_calc_hit(struct block_list *bl, status_change *sc, int32 hit)
 {
 {
 	if(sc == nullptr || sc->empty())
 	if(sc == nullptr || sc->empty())
 		return cap_value(hit,1,SHRT_MAX);
 		return cap_value(hit,1,SHRT_MAX);
@@ -7289,7 +7289,7 @@ static signed short status_calc_hit(struct block_list *bl, status_change *sc, in
 	if (sc->getSCE(SC_INTENSIVE_AIM))
 	if (sc->getSCE(SC_INTENSIVE_AIM))
 		hit += 250;
 		hit += 250;
 
 
-	return (short)cap_value(hit,1,SHRT_MAX);
+	return (int16)cap_value(hit,1,SHRT_MAX);
 }
 }
 
 
 /**
 /**
@@ -7299,7 +7299,7 @@ static signed short status_calc_hit(struct block_list *bl, status_change *sc, in
  * @param flee: Initial flee
  * @param flee: Initial flee
  * @return modified flee with cap_value(flee,1,USHRT_MAX)
  * @return modified flee with cap_value(flee,1,USHRT_MAX)
  */
  */
-static signed short status_calc_flee(struct block_list *bl, status_change *sc, int32 flee)
+static int16 status_calc_flee(struct block_list *bl, status_change *sc, int32 flee)
 {
 {
 	if( bl->type == BL_PC ) {
 	if( bl->type == BL_PC ) {
 		struct map_data *mapdata = map_getmapdata(bl->m);
 		struct map_data *mapdata = map_getmapdata(bl->m);
@@ -7399,7 +7399,7 @@ static signed short status_calc_flee(struct block_list *bl, status_change *sc, i
 	if (sc->getSCE(SC_GROOMING))
 	if (sc->getSCE(SC_GROOMING))
 		flee += sc->getSCE(SC_GROOMING)->val2;
 		flee += sc->getSCE(SC_GROOMING)->val2;
 
 
-	return (short)cap_value(flee,1,SHRT_MAX);
+	return (int16)cap_value(flee,1,SHRT_MAX);
 }
 }
 
 
 /**
 /**
@@ -7409,7 +7409,7 @@ static signed short status_calc_flee(struct block_list *bl, status_change *sc, i
  * @param flee2: Initial flee2
  * @param flee2: Initial flee2
  * @return modified flee2 with cap_value(flee2,10,USHRT_MAX)
  * @return modified flee2 with cap_value(flee2,10,USHRT_MAX)
  */
  */
-static signed short status_calc_flee2(struct block_list *bl, status_change *sc, int32 flee2)
+static int16 status_calc_flee2(struct block_list *bl, status_change *sc, int32 flee2)
 {
 {
 	if(sc == nullptr || sc->empty())
 	if(sc == nullptr || sc->empty())
 		return cap_value(flee2,10,SHRT_MAX);
 		return cap_value(flee2,10,SHRT_MAX);
@@ -7423,7 +7423,7 @@ static signed short status_calc_flee2(struct block_list *bl, status_change *sc,
 	if (sc->getSCE(SC_DORAM_FLEE2))
 	if (sc->getSCE(SC_DORAM_FLEE2))
 		flee2 += sc->getSCE(SC_DORAM_FLEE2)->val1;
 		flee2 += sc->getSCE(SC_DORAM_FLEE2)->val1;
 
 
-	return (short)cap_value(flee2,10,SHRT_MAX);
+	return (int16)cap_value(flee2,10,SHRT_MAX);
 }
 }
 
 
 /**
 /**
@@ -7544,13 +7544,13 @@ static defType status_calc_def(struct block_list *bl, status_change *sc, int32 d
  * @param def2: Initial def2
  * @param def2: Initial def2
  * @return modified def2 with cap_value(def2,SHRT_MIN,SHRT_MAX)
  * @return modified def2 with cap_value(def2,SHRT_MIN,SHRT_MAX)
  */
  */
-static signed short status_calc_def2(struct block_list *bl, status_change *sc, int32 def2)
+static int16 status_calc_def2(struct block_list *bl, status_change *sc, int32 def2)
 {
 {
 	if(sc == nullptr || sc->empty())
 	if(sc == nullptr || sc->empty())
 #ifdef RENEWAL
 #ifdef RENEWAL
-		return (short)cap_value(def2,SHRT_MIN,SHRT_MAX);
+		return (int16)cap_value(def2,SHRT_MIN,SHRT_MAX);
 #else
 #else
-		return (short)cap_value(def2,1,SHRT_MAX);
+		return (int16)cap_value(def2,1,SHRT_MAX);
 #endif
 #endif
 
 
 	if(sc->getSCE(SC_BERSERK))
 	if(sc->getSCE(SC_BERSERK))
@@ -7597,9 +7597,9 @@ static signed short status_calc_def2(struct block_list *bl, status_change *sc, i
 		def2 -= def2 * 5 * sc->getSCE(SC_CAMOUFLAGE)->val3 / 100;
 		def2 -= def2 * 5 * sc->getSCE(SC_CAMOUFLAGE)->val3 / 100;
 
 
 #ifdef RENEWAL
 #ifdef RENEWAL
-	return (short)cap_value(def2,SHRT_MIN,SHRT_MAX);
+	return (int16)cap_value(def2,SHRT_MIN,SHRT_MAX);
 #else
 #else
-	return (short)cap_value(def2,1,SHRT_MAX);
+	return (int16)cap_value(def2,1,SHRT_MAX);
 #endif
 #endif
 }
 }
 
 
@@ -7670,13 +7670,13 @@ static defType status_calc_mdef(struct block_list *bl, status_change *sc, int32
  * @param mdef2: Initial mdef2
  * @param mdef2: Initial mdef2
  * @return modified mdef2 with cap_value(mdef2,SHRT_MIN,SHRT_MAX)
  * @return modified mdef2 with cap_value(mdef2,SHRT_MIN,SHRT_MAX)
  */
  */
-static signed short status_calc_mdef2(struct block_list *bl, status_change *sc, int32 mdef2)
+static int16 status_calc_mdef2(struct block_list *bl, status_change *sc, int32 mdef2)
 {
 {
 	if(sc == nullptr || sc->empty())
 	if(sc == nullptr || sc->empty())
 #ifdef RENEWAL
 #ifdef RENEWAL
-		return (short)cap_value(mdef2,SHRT_MIN,SHRT_MAX);
+		return (int16)cap_value(mdef2,SHRT_MIN,SHRT_MAX);
 #else
 #else
-		return (short)cap_value(mdef2,1,SHRT_MAX);
+		return (int16)cap_value(mdef2,1,SHRT_MAX);
 #endif
 #endif
 
 
 	if(sc->getSCE(SC_BERSERK))
 	if(sc->getSCE(SC_BERSERK))
@@ -7694,9 +7694,9 @@ static signed short status_calc_mdef2(struct block_list *bl, status_change *sc,
 		mdef2 -= mdef2 * (14 * sc->getSCE(SC_ANALYZE)->val1) / 100;
 		mdef2 -= mdef2 * (14 * sc->getSCE(SC_ANALYZE)->val1) / 100;
 
 
 #ifdef RENEWAL
 #ifdef RENEWAL
-	return (short)cap_value(mdef2,SHRT_MIN,SHRT_MAX);
+	return (int16)cap_value(mdef2,SHRT_MIN,SHRT_MAX);
 #else
 #else
-	return (short)cap_value(mdef2,1,SHRT_MAX);
+	return (int16)cap_value(mdef2,1,SHRT_MAX);
 #endif
 #endif
 }
 }
 
 
@@ -7923,7 +7923,7 @@ static uint16 status_calc_speed(struct block_list *bl, status_change *sc, int32
  *               False - percentage value
  *               False - percentage value
  * @return modified aspd
  * @return modified aspd
  */
  */
-static short status_calc_aspd(struct block_list *bl, status_change *sc, bool fixed)
+static int16 status_calc_aspd(struct block_list *bl, status_change *sc, bool fixed)
 {
 {
 	int32 bonus = 0;
 	int32 bonus = 0;
 
 
@@ -8064,7 +8064,7 @@ static short status_calc_aspd(struct block_list *bl, status_change *sc, bool fix
  * @param aspd: Object's current ASPD
  * @param aspd: Object's current ASPD
  * @return modified aspd
  * @return modified aspd
  */
  */
-static short status_calc_fix_aspd(struct block_list *bl, status_change *sc, int32 aspd)
+static int16 status_calc_fix_aspd(struct block_list *bl, status_change *sc, int32 aspd)
 {
 {
 	if (sc == nullptr || sc->empty())
 	if (sc == nullptr || sc->empty())
 		return cap_value(aspd, 0, 2000);
 		return cap_value(aspd, 0, 2000);
@@ -8094,7 +8094,7 @@ static short status_calc_fix_aspd(struct block_list *bl, status_change *sc, int3
  * @param aspd_rate: Object's current ASPD
  * @param aspd_rate: Object's current ASPD
  * @return modified aspd_rate
  * @return modified aspd_rate
  */
  */
-static short status_calc_aspd_rate(struct block_list *bl, status_change *sc, int32 aspd_rate)
+static int16 status_calc_aspd_rate(struct block_list *bl, status_change *sc, int32 aspd_rate)
 {
 {
 	int32 i;
 	int32 i;
 
 
@@ -8228,7 +8228,7 @@ static short status_calc_aspd_rate(struct block_list *bl, status_change *sc, int
 	if (sc->getSCE(SC_STARSTANCE))
 	if (sc->getSCE(SC_STARSTANCE))
 		aspd_rate -= 10 * sc->getSCE(SC_STARSTANCE)->val2;
 		aspd_rate -= 10 * sc->getSCE(SC_STARSTANCE)->val2;
 
 
-	return (short)cap_value(aspd_rate,0,SHRT_MAX);
+	return (int16)cap_value(aspd_rate,0,SHRT_MAX);
 }
 }
 
 
 /**
 /**
@@ -8266,7 +8266,7 @@ static uint16 status_calc_dmotion(struct block_list *bl, status_change *sc, int3
 * @param patk: Initial patk
 * @param patk: Initial patk
 * @return modified patk with cap_value(patk,0,USHRT_MAX)
 * @return modified patk with cap_value(patk,0,USHRT_MAX)
 */
 */
-static signed short status_calc_patk(struct block_list *bl, status_change *sc, int32 patk)
+static int16 status_calc_patk(struct block_list *bl, status_change *sc, int32 patk)
 {
 {
 	if (sc == nullptr || sc->empty())
 	if (sc == nullptr || sc->empty())
 		return cap_value(patk, 0, SHRT_MAX);
 		return cap_value(patk, 0, SHRT_MAX);
@@ -8293,7 +8293,7 @@ static signed short status_calc_patk(struct block_list *bl, status_change *sc, i
 	if (sc->getSCE(SC_BLESSING_OF_M_CREATURES) != nullptr)
 	if (sc->getSCE(SC_BLESSING_OF_M_CREATURES) != nullptr)
 		patk += sc->getSCE(SC_BLESSING_OF_M_CREATURES)->val2;
 		patk += sc->getSCE(SC_BLESSING_OF_M_CREATURES)->val2;
 
 
-	return (short)cap_value(patk, 0, SHRT_MAX);
+	return (int16)cap_value(patk, 0, SHRT_MAX);
 }
 }
 
 
 /**
 /**
@@ -8303,7 +8303,7 @@ static signed short status_calc_patk(struct block_list *bl, status_change *sc, i
 * @param smatk: Initial smatk
 * @param smatk: Initial smatk
 * @return modified smatk with cap_value(smatk,0,USHRT_MAX)
 * @return modified smatk with cap_value(smatk,0,USHRT_MAX)
 */
 */
-static signed short status_calc_smatk(struct block_list *bl, status_change *sc, int32 smatk)
+static int16 status_calc_smatk(struct block_list *bl, status_change *sc, int32 smatk)
 {
 {
 	if (sc == nullptr || sc->empty())
 	if (sc == nullptr || sc->empty())
 		return cap_value(smatk, 0, SHRT_MAX);
 		return cap_value(smatk, 0, SHRT_MAX);
@@ -8328,7 +8328,7 @@ static signed short status_calc_smatk(struct block_list *bl, status_change *sc,
 	if (sc->getSCE(SC_BLESSING_OF_M_CREATURES) != nullptr)
 	if (sc->getSCE(SC_BLESSING_OF_M_CREATURES) != nullptr)
 		smatk += sc->getSCE(SC_BLESSING_OF_M_CREATURES)->val2;
 		smatk += sc->getSCE(SC_BLESSING_OF_M_CREATURES)->val2;
 
 
-	return (short)cap_value(smatk, 0, SHRT_MAX);
+	return (int16)cap_value(smatk, 0, SHRT_MAX);
 }
 }
 
 
 /**
 /**
@@ -8338,7 +8338,7 @@ static signed short status_calc_smatk(struct block_list *bl, status_change *sc,
 * @param res: Initial res
 * @param res: Initial res
 * @return modified res with cap_value(res,0,USHRT_MAX)
 * @return modified res with cap_value(res,0,USHRT_MAX)
 */
 */
-static signed short status_calc_res(struct block_list *bl, status_change *sc, int32 res)
+static int16 status_calc_res(struct block_list *bl, status_change *sc, int32 res)
 {
 {
 	if (sc == nullptr || sc->empty())
 	if (sc == nullptr || sc->empty())
 		return cap_value(res, 0, SHRT_MAX);
 		return cap_value(res, 0, SHRT_MAX);
@@ -8358,7 +8358,7 @@ static signed short status_calc_res(struct block_list *bl, status_change *sc, in
 	if (sc->getSCE(SC_TOXIN_OF_MANDARA))
 	if (sc->getSCE(SC_TOXIN_OF_MANDARA))
 		res -= sc->getSCE(SC_TOXIN_OF_MANDARA)->val2;
 		res -= sc->getSCE(SC_TOXIN_OF_MANDARA)->val2;
 
 
-	return (short)cap_value(res, 0, SHRT_MAX);
+	return (int16)cap_value(res, 0, SHRT_MAX);
 }
 }
 
 
 /**
 /**
@@ -8368,7 +8368,7 @@ static signed short status_calc_res(struct block_list *bl, status_change *sc, in
 * @param mres: Initial mres
 * @param mres: Initial mres
 * @return modified mres with cap_value(mres,0,USHRT_MAX)
 * @return modified mres with cap_value(mres,0,USHRT_MAX)
 */
 */
-static signed short status_calc_mres(struct block_list *bl, status_change *sc, int32 mres)
+static int16 status_calc_mres(struct block_list *bl, status_change *sc, int32 mres)
 {
 {
 	if (sc == nullptr || sc->empty())
 	if (sc == nullptr || sc->empty())
 		return cap_value(mres, 0, SHRT_MAX);
 		return cap_value(mres, 0, SHRT_MAX);
@@ -8380,7 +8380,7 @@ static signed short status_calc_mres(struct block_list *bl, status_change *sc, i
 	if (sc->getSCE(SC_GEF_NOCTURN))
 	if (sc->getSCE(SC_GEF_NOCTURN))
 		mres -= sc->getSCE(SC_GEF_NOCTURN)->val2;
 		mres -= sc->getSCE(SC_GEF_NOCTURN)->val2;
 
 
-	return (short)cap_value(mres, 0, SHRT_MAX);
+	return (int16)cap_value(mres, 0, SHRT_MAX);
 }
 }
 
 
 /**
 /**
@@ -8390,7 +8390,7 @@ static signed short status_calc_mres(struct block_list *bl, status_change *sc, i
 * @param hplus: Initial hplus
 * @param hplus: Initial hplus
 * @return modified hplus with cap_value(hplus,0,USHRT_MAX)
 * @return modified hplus with cap_value(hplus,0,USHRT_MAX)
 */
 */
-static signed short status_calc_hplus(struct block_list *bl, status_change *sc, int32 hplus)
+static int16 status_calc_hplus(struct block_list *bl, status_change *sc, int32 hplus)
 {
 {
 	if (sc == nullptr || sc->empty())
 	if (sc == nullptr || sc->empty())
 		return cap_value(hplus, 0, SHRT_MAX);
 		return cap_value(hplus, 0, SHRT_MAX);
@@ -8398,7 +8398,7 @@ static signed short status_calc_hplus(struct block_list *bl, status_change *sc,
 	if (sc->getSCE(SC_TEMPORARY_COMMUNION) != nullptr)
 	if (sc->getSCE(SC_TEMPORARY_COMMUNION) != nullptr)
 		hplus += sc->getSCE(SC_TEMPORARY_COMMUNION)->val2;
 		hplus += sc->getSCE(SC_TEMPORARY_COMMUNION)->val2;
 
 
-	return (short)cap_value(hplus, 0, SHRT_MAX);
+	return (int16)cap_value(hplus, 0, SHRT_MAX);
 }
 }
 
 
 /**
 /**
@@ -8408,7 +8408,7 @@ static signed short status_calc_hplus(struct block_list *bl, status_change *sc,
 * @param crate: Initial crate
 * @param crate: Initial crate
 * @return modified crate with cap_value(crate,0,USHRT_MAX)
 * @return modified crate with cap_value(crate,0,USHRT_MAX)
 */
 */
-static signed short status_calc_crate(struct block_list *bl, status_change *sc, int32 crate)
+static int16 status_calc_crate(struct block_list *bl, status_change *sc, int32 crate)
 {
 {
 	if (sc == nullptr || sc->empty())
 	if (sc == nullptr || sc->empty())
 		return cap_value(crate, 0, SHRT_MAX);
 		return cap_value(crate, 0, SHRT_MAX);
@@ -8416,7 +8416,7 @@ static signed short status_calc_crate(struct block_list *bl, status_change *sc,
 	if (sc->getSCE(SC_PRE_ACIES))
 	if (sc->getSCE(SC_PRE_ACIES))
 		crate += sc->getSCE(SC_PRE_ACIES)->val2;
 		crate += sc->getSCE(SC_PRE_ACIES)->val2;
 
 
-	return (short)cap_value(crate, 0, SHRT_MAX);
+	return (int16)cap_value(crate, 0, SHRT_MAX);
 }
 }
 
 
 /**
 /**
@@ -9937,7 +9937,7 @@ int32 status_change_start(struct block_list* src, struct block_list* bl,enum sc_
 			if (val2 == 1)
 			if (val2 == 1)
 				val2 = 0; // Brandish Spear/Bowling Bash effet. Do not take weapon off.
 				val2 = 0; // Brandish Spear/Bowling Bash effet. Do not take weapon off.
 			else if (sd && !(flag&SCSTART_LOADED)) { // Apply sc anyway if loading saved sc_data
 			else if (sd && !(flag&SCSTART_LOADED)) { // Apply sc anyway if loading saved sc_data
-				short i;
+				int16 i;
 				uint8 successFlag = 0;
 				uint8 successFlag = 0;
 				if(sd->bonus.unstripable_equip&EQP_WEAPON)
 				if(sd->bonus.unstripable_equip&EQP_WEAPON)
 					return 0;
 					return 0;
@@ -9960,7 +9960,7 @@ int32 status_change_start(struct block_list* src, struct block_list* bl,enum sc_
 			if( val2 == 1 ) val2 = 0; // GX effect. Do not take shield off..
 			if( val2 == 1 ) val2 = 0; // GX effect. Do not take shield off..
 			else
 			else
 			if (sd && !(flag&SCSTART_LOADED)) {
 			if (sd && !(flag&SCSTART_LOADED)) {
-				short i;
+				int16 i;
 				if(sd->bonus.unstripable_equip&EQP_SHIELD)
 				if(sd->bonus.unstripable_equip&EQP_SHIELD)
 					return 0;
 					return 0;
 				i = sd->equip_index[EQI_HAND_L];
 				i = sd->equip_index[EQI_HAND_L];
@@ -9972,7 +9972,7 @@ int32 status_change_start(struct block_list* src, struct block_list* bl,enum sc_
 			break;
 			break;
 		case SC_STRIPARMOR:
 		case SC_STRIPARMOR:
 			if (sd && !(flag&SCSTART_LOADED)) {
 			if (sd && !(flag&SCSTART_LOADED)) {
-				short i;
+				int16 i;
 				if(sd->bonus.unstripable_equip&EQP_ARMOR)
 				if(sd->bonus.unstripable_equip&EQP_ARMOR)
 					return 0;
 					return 0;
 				i = sd->equip_index[EQI_ARMOR];
 				i = sd->equip_index[EQI_ARMOR];
@@ -9984,7 +9984,7 @@ int32 status_change_start(struct block_list* src, struct block_list* bl,enum sc_
 			break;
 			break;
 		case SC_STRIPHELM:
 		case SC_STRIPHELM:
 			if (sd && !(flag&SCSTART_LOADED)) {
 			if (sd && !(flag&SCSTART_LOADED)) {
-				short i;
+				int16 i;
 				if(sd->bonus.unstripable_equip&EQP_HELM)
 				if(sd->bonus.unstripable_equip&EQP_HELM)
 					return 0;
 					return 0;
 				i = sd->equip_index[EQI_HEAD_TOP];
 				i = sd->equip_index[EQI_HEAD_TOP];
@@ -10078,7 +10078,7 @@ int32 status_change_start(struct block_list* src, struct block_list* bl,enum sc_
 			break;
 			break;
 		case SC__STRIPACCESSORY:
 		case SC__STRIPACCESSORY:
 			if( sd ) {
 			if( sd ) {
-				short i = -1;
+				int16 i = -1;
 				if( !(sd->bonus.unstripable_equip&EQP_ACC_L) ) {
 				if( !(sd->bonus.unstripable_equip&EQP_ACC_L) ) {
 					i = sd->equip_index[EQI_ACC_L];
 					i = sd->equip_index[EQI_ACC_L];
 					if( i >= 0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_ARMOR )
 					if( i >= 0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_ARMOR )
@@ -11695,7 +11695,7 @@ int32 status_change_start(struct block_list* src, struct block_list* bl,enum sc_
 		case SC_EXEEDBREAK:
 		case SC_EXEEDBREAK:
 			val2 = 150 * val1;
 			val2 = 150 * val1;
 			if (sd) { // Players
 			if (sd) { // Players
-				short index = sd->equip_index[EQI_HAND_R];
+				int16 index = sd->equip_index[EQI_HAND_R];
 
 
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON)
 				if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON)
 					val2 += 15 * sd->status.job_level + sd->inventory_data[index]->weight / 10 * sd->inventory_data[index]->weapon_level * status_get_lv(bl) / 100;
 					val2 += 15 * sd->status.job_level + sd->inventory_data[index]->weight / 10 * sd->inventory_data[index]->weapon_level * status_get_lv(bl) / 100;
@@ -11920,7 +11920,7 @@ int32 status_change_start(struct block_list* src, struct block_list* bl,enum sc_
 		case SC_GENSOU:
 		case SC_GENSOU:
 			{
 			{
 				int32 hp = status_get_hp(bl), lv = 5;
 				int32 hp = status_get_hp(bl), lv = 5;
-				short per = 100 / (status_get_max_hp(bl) / hp);
+				int16 per = 100 / (status_get_max_hp(bl) / hp);
 
 
 				if( per <= 15 )
 				if( per <= 15 )
 					lv = 1;
 					lv = 1;

+ 6 - 6
src/map/status.hpp

@@ -1389,7 +1389,7 @@ enum sc_type : int16 {
 };
 };
 
 
 /// Official status change ids, used to display status icons on the client.
 /// Official status change ids, used to display status icons on the client.
-enum efst_type : short{
+enum efst_type : int16{
 /// Do not modify code below this, until the end of the API hook, since it will be automatically generated again
 /// Do not modify code below this, until the end of the API hook, since it will be automatically generated again
 /// @APIHOOK_START(EFST_ENUM)
 /// @APIHOOK_START(EFST_ENUM)
 	EFST_BLANK = -1,
 	EFST_BLANK = -1,
@@ -2878,10 +2878,10 @@ enum e_joint_break : uint8 {
 	BREAK_FLAGS = BREAK_ANKLE | BREAK_WRIST | BREAK_KNEE | BREAK_SHOULDER | BREAK_WAIST | BREAK_NECK,
 	BREAK_FLAGS = BREAK_ANKLE | BREAK_WRIST | BREAK_KNEE | BREAK_SHOULDER | BREAK_WAIST | BREAK_NECK,
 };
 };
 
 
-extern short current_equip_item_index;
+extern int16 current_equip_item_index;
 extern uint32 current_equip_combo_pos;
 extern uint32 current_equip_combo_pos;
 extern int32 current_equip_card_id;
 extern int32 current_equip_card_id;
-extern short current_equip_opt_index;
+extern int16 current_equip_opt_index;
 
 
 //Status change option definitions (options are what makes status changes visible to chars
 //Status change option definitions (options are what makes status changes visible to chars
 //who were not on your field of sight when it happened)
 //who were not on your field of sight when it happened)
@@ -3296,7 +3296,7 @@ struct status_data {
 	uint32 max_hp;
 	uint32 max_hp;
 	uint32 max_sp;
 	uint32 max_sp;
 	uint32 max_ap;
 	uint32 max_ap;
-	short
+	int16
 		str, agi, vit, int_, dex, luk,
 		str, agi, vit, int_, dex, luk,
 		pow, sta, wis, spl, con, crt,
 		pow, sta, wis, spl, con, crt,
 		eatk;
 		eatk;
@@ -3310,7 +3310,7 @@ struct status_data {
 		speed,
 		speed,
 		amotion, clientamotion, adelay, dmotion;
 		amotion, clientamotion, adelay, dmotion;
 	int32 mode;
 	int32 mode;
-	short
+	int16
 		hit, flee, cri, flee2,
 		hit, flee, cri, flee2,
 		def2, mdef2,
 		def2, mdef2,
 #ifdef RENEWAL_ASPD
 #ifdef RENEWAL_ASPD
@@ -3417,7 +3417,7 @@ public:
 		uint8 interact;
 		uint8 interact;
 	} cant;/* status change state flags */
 	} cant;/* status change state flags */
 	//int32 sg_id; //ID of the previous Storm gust that hit you
 	//int32 sg_id; //ID of the previous Storm gust that hit you
-	short comet_x, comet_y; // Point where src casted Comet - required to calculate damage from this point
+	int16 comet_x, comet_y; // Point where src casted Comet - required to calculate damage from this point
 /**
 /**
  * The Storm Gust counter was dropped in renewal
  * The Storm Gust counter was dropped in renewal
  **/
  **/

+ 1 - 1
src/map/storage.cpp

@@ -986,7 +986,7 @@ void storage_guild_storageaddfromcart(map_session_data* sd, int32 index, int32 a
  */
  */
 void storage_guild_storagegettocart(map_session_data* sd, int32 index, int32 amount)
 void storage_guild_storagegettocart(map_session_data* sd, int32 index, int32 amount)
 {
 {
-	short flag;
+	int16 flag;
 	struct s_storage *stor;
 	struct s_storage *stor;
 
 
 	nullpo_retv(sd);
 	nullpo_retv(sd);

+ 2 - 2
src/map/trade.cpp

@@ -263,7 +263,7 @@ int32 trade_check(map_session_data *sd, map_session_data *tsd)
 
 
 	// check free slot in both inventory
 	// check free slot in both inventory
 	for(trade_i = 0; trade_i < 10; trade_i++) {
 	for(trade_i = 0; trade_i < 10; trade_i++) {
-		short amount;
+		int16 amount;
 
 
 		amount = sd->deal.item[trade_i].amount;
 		amount = sd->deal.item[trade_i].amount;
 
 
@@ -348,7 +348,7 @@ int32 trade_check(map_session_data *sd, map_session_data *tsd)
  * @param index : index of item in inventory
  * @param index : index of item in inventory
  * @param amount : amount of item to add from index
  * @param amount : amount of item to add from index
  */
  */
-void trade_tradeadditem(map_session_data *sd, short index, short amount)
+void trade_tradeadditem(map_session_data *sd, int16 index, int16 amount)
 {
 {
 	map_session_data *target_sd;
 	map_session_data *target_sd;
 	struct item *item;
 	struct item *item;

+ 1 - 1
src/map/trade.hpp

@@ -19,7 +19,7 @@ enum e_ack_trade_response : uint8 {
 
 
 void trade_traderequest(map_session_data *sd, map_session_data *target_sd);
 void trade_traderequest(map_session_data *sd, map_session_data *target_sd);
 void trade_tradeack(map_session_data *sd,int32 type);
 void trade_tradeack(map_session_data *sd,int32 type);
-void trade_tradeadditem(map_session_data *sd,short index,short amount);
+void trade_tradeadditem(map_session_data *sd,int16 index,int16 amount);
 void trade_tradeaddzeny(map_session_data *sd,int32 amount);
 void trade_tradeaddzeny(map_session_data *sd,int32 amount);
 void trade_tradeok(map_session_data *sd);
 void trade_tradeok(map_session_data *sd);
 void trade_tradecancel(map_session_data *sd);
 void trade_tradecancel(map_session_data *sd);

+ 15 - 15
src/map/unit.cpp

@@ -49,8 +49,8 @@ using namespace rathena;
 // 2 . 6
 // 2 . 6
 // 3 4 5
 // 3 4 5
 // See also path.cpp walk_choices
 // See also path.cpp walk_choices
-const short dirx[DIR_MAX]={0,-1,-1,-1,0,1,1,1}; ///lookup to know where will move to x according dir
-const short diry[DIR_MAX]={1,1,0,-1,-1,-1,0,1}; ///lookup to know where will move to y according dir
+const int16 dirx[DIR_MAX]={0,-1,-1,-1,0,1,1,1}; ///lookup to know where will move to x according dir
+const int16 diry[DIR_MAX]={1,1,0,-1,-1,-1,0,1}; ///lookup to know where will move to y according dir
 
 
 //early declaration
 //early declaration
 static TIMER_FUNC(unit_attack_timer);
 static TIMER_FUNC(unit_attack_timer);
@@ -747,7 +747,7 @@ TIMER_FUNC(unit_delay_walktoxy_timer){
 	if (!bl || bl->prev == nullptr)
 	if (!bl || bl->prev == nullptr)
 		return 0;
 		return 0;
 
 
-	unit_walktoxy(bl, (short)((data>>16)&0xffff), (short)(data&0xffff), 0);
+	unit_walktoxy(bl, (int16)((data>>16)&0xffff), (int16)(data&0xffff), 0);
 
 
 	return 1;
 	return 1;
 }
 }
@@ -788,7 +788,7 @@ TIMER_FUNC(unit_delay_walktobl_timer){
  *	&8: Search for an unoccupied cell and cancel if none available
  *	&8: Search for an unoccupied cell and cancel if none available
  * @return 1: Success 0: Fail or unit_walktoxy_sub()
  * @return 1: Success 0: Fail or unit_walktoxy_sub()
  */
  */
-int32 unit_walktoxy( struct block_list *bl, short x, short y, unsigned char flag)
+int32 unit_walktoxy( struct block_list *bl, int16 x, int16 y, unsigned char flag)
 {
 {
 	nullpo_ret(bl);
 	nullpo_ret(bl);
 
 
@@ -1010,7 +1010,7 @@ void unit_run_hit(struct block_list *bl, status_change *sc, map_session_data *sd
 bool unit_run(struct block_list *bl, map_session_data *sd, enum sc_type type)
 bool unit_run(struct block_list *bl, map_session_data *sd, enum sc_type type)
 {
 {
 	status_change *sc;
 	status_change *sc;
-	short to_x, to_y, dir_x, dir_y;
+	int16 to_x, to_y, dir_x, dir_y;
 	int32 i;
 	int32 i;
 
 
 	nullpo_retr(false, bl);
 	nullpo_retr(false, bl);
@@ -1098,7 +1098,7 @@ t_tick unit_get_walkpath_time(struct block_list& bl)
  * @param flag: unit_walktoxy flag
  * @param flag: unit_walktoxy flag
  * @return The duration the unit will run (0 on fail)
  * @return The duration the unit will run (0 on fail)
  */
  */
-t_tick unit_escape(struct block_list *bl, struct block_list *target, short dist, uint8 flag)
+t_tick unit_escape(struct block_list *bl, struct block_list *target, int16 dist, uint8 flag)
 {
 {
 	uint8 dir = map_calc_dir(target, bl->x, bl->y);
 	uint8 dir = map_calc_dir(target, bl->x, bl->y);
 
 
@@ -1123,9 +1123,9 @@ t_tick unit_escape(struct block_list *bl, struct block_list *target, short dist,
  * @param checkpath: Whether or not to do a cell and path check for NOPASS and NOREACH
  * @param checkpath: Whether or not to do a cell and path check for NOPASS and NOREACH
  * @return True: Success False: Fail
  * @return True: Success False: Fail
  */
  */
-bool unit_movepos(struct block_list *bl, short dst_x, short dst_y, int32 easy, bool checkpath)
+bool unit_movepos(struct block_list *bl, int16 dst_x, int16 dst_y, int32 easy, bool checkpath)
 {
 {
-	short dx,dy;
+	int16 dx,dy;
 	struct unit_data        *ud = nullptr;
 	struct unit_data        *ud = nullptr;
 	map_session_data *sd = nullptr;
 	map_session_data *sd = nullptr;
 
 
@@ -1378,7 +1378,7 @@ enum e_unit_blown unit_blown_immune(struct block_list* bl, uint8 flag)
  * @param type: Clear type used in clif_clearunit_area()
  * @param type: Clear type used in clif_clearunit_area()
  * @return Success(0); Failed(1); Error(2); unit_remove_map() Failed(3); map_addblock Failed(4)
  * @return Success(0); Failed(1); Error(2); unit_remove_map() Failed(3); map_addblock Failed(4)
  */
  */
-int32 unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
+int32 unit_warp(struct block_list *bl,int16 m,int16 x,int16 y,clr_type type)
 {
 {
 	struct unit_data *ud;
 	struct unit_data *ud;
 
 
@@ -1484,8 +1484,8 @@ void unit_stop_walking_soon(struct block_list& bl)
 	// Get how much percent we traversed on the timer
 	// Get how much percent we traversed on the timer
 	double cell_percent = 1.0 - ((double)DIFF_TICK(td->tick, gettick()) / (double)td->data);
 	double cell_percent = 1.0 - ((double)DIFF_TICK(td->tick, gettick()) / (double)td->data);
 
 
-	short ox = bl.x, oy = bl.y; // Remember original x and y coordinates
-	short path_remain = 1; // Remaining path to walk
+	int16 ox = bl.x, oy = bl.y; // Remember original x and y coordinates
+	int16 path_remain = 1; // Remaining path to walk
 
 
 	if (cell_percent > 0.0 && cell_percent < 1.0) {
 	if (cell_percent > 0.0 && cell_percent < 1.0) {
 		// Set subcell coordinates according to timer
 		// Set subcell coordinates according to timer
@@ -2273,7 +2273,7 @@ int32 unit_skilluse_id2(struct block_list *src, int32 target_id, uint16 skill_id
  * @param skill_lv: Skill Level
  * @param skill_lv: Skill Level
  * @return unit_skilluse_pos2()
  * @return unit_skilluse_pos2()
  */
  */
-int32 unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv)
+int32 unit_skilluse_pos(struct block_list *src, int16 skill_x, int16 skill_y, uint16 skill_id, uint16 skill_lv)
 {
 {
 	return unit_skilluse_pos2(
 	return unit_skilluse_pos2(
 		src, skill_x, skill_y, skill_id, skill_lv,
 		src, skill_x, skill_y, skill_id, skill_lv,
@@ -2293,7 +2293,7 @@ int32 unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, ui
  * @param castcancel: Whether or not the skill can be cancelled by interuption (hit)
  * @param castcancel: Whether or not the skill can be cancelled by interuption (hit)
  * @return Success(1); Fail(0);
  * @return Success(1); Fail(0);
  */
  */
-int32 unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int32 casttime, int32 castcancel, bool ignore_range)
+int32 unit_skilluse_pos2( struct block_list *src, int16 skill_x, int16 skill_y, uint16 skill_id, uint16 skill_lv, int32 casttime, int32 castcancel, bool ignore_range)
 {
 {
 	map_session_data *sd = nullptr;
 	map_session_data *sd = nullptr;
 	struct unit_data *ud = nullptr;
 	struct unit_data *ud = nullptr;
@@ -2706,10 +2706,10 @@ bool unit_can_reach_pos(struct block_list *bl,int32 x,int32 y, int32 easy)
  * @param y: Pointer storing a valid Y coordinate around tbl that can be reached
  * @param y: Pointer storing a valid Y coordinate around tbl that can be reached
  * @return true or false
  * @return true or false
  */
  */
-bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int32 range, int32 easy, short *x, short *y)
+bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int32 range, int32 easy, int16 *x, int16 *y)
 {
 {
 	struct walkpath_data wpd;
 	struct walkpath_data wpd;
-	short dx, dy;
+	int16 dx, dy;
 
 
 	nullpo_retr(false, bl);
 	nullpo_retr(false, bl);
 	nullpo_retr(false, tbl);
 	nullpo_retr(false, tbl);

+ 12 - 12
src/map/unit.hpp

@@ -16,8 +16,8 @@ struct unit_data;
 class map_session_data;
 class map_session_data;
 enum clr_type : uint8;
 enum clr_type : uint8;
 
 
-extern const short dirx[DIR_MAX]; ///lookup to know where will move to x according dir
-extern const short diry[DIR_MAX]; ///lookup to know where will move to y according dir
+extern const int16 dirx[DIR_MAX]; ///lookup to know where will move to x according dir
+extern const int16 diry[DIR_MAX]; ///lookup to know where will move to y according dir
 
 
 struct unit_data {
 struct unit_data {
 	struct block_list *bl; ///link to owner object BL_PC|BL_MOB|BL_PET|BL_NPC|BL_HOM|BL_MER|BL_ELEM
 	struct block_list *bl; ///link to owner object BL_PC|BL_MOB|BL_PET|BL_NPC|BL_HOM|BL_MER|BL_ELEM
@@ -25,10 +25,10 @@ struct unit_data {
 	struct skill_timerskill *skilltimerskill[MAX_SKILLTIMERSKILL];
 	struct skill_timerskill *skilltimerskill[MAX_SKILLTIMERSKILL];
 	std::vector<std::shared_ptr<s_skill_unit_group>> skillunits;
 	std::vector<std::shared_ptr<s_skill_unit_group>> skillunits;
 	struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET];
 	struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET];
-	short attacktarget_lv;
-	short to_x, to_y;
+	int16 attacktarget_lv;
+	int16 to_x, to_y;
 	uint8 sx, sy; // Subtile position (0-15, with 8 being center of cell)
 	uint8 sx, sy; // Subtile position (0-15, with 8 being center of cell)
-	short skillx, skilly;
+	int16 skillx, skilly;
 	uint16 skill_id, skill_lv;
 	uint16 skill_id, skill_lv;
 	int32 skilltarget;
 	int32 skilltarget;
 	int32 skilltimer;
 	int32 skilltimer;
@@ -108,7 +108,7 @@ enum e_unit_stop_walking {
 // PC, MOB, PET
 // PC, MOB, PET
 
 
 // Does walk action for unit
 // Does walk action for unit
-int32 unit_walktoxy(struct block_list *bl, short x, short y, unsigned char flag);
+int32 unit_walktoxy(struct block_list *bl, int16 x, int16 y, unsigned char flag);
 int32 unit_walktobl(struct block_list *bl, struct block_list *target, int32 range, unsigned char flag);
 int32 unit_walktobl(struct block_list *bl, struct block_list *target, int32 range, unsigned char flag);
 void unit_run_hit(struct block_list *bl, status_change *sc, map_session_data *sd, enum sc_type type);
 void unit_run_hit(struct block_list *bl, status_change *sc, map_session_data *sd, enum sc_type type);
 bool unit_run(struct block_list *bl, map_session_data *sd, enum sc_type type);
 bool unit_run(struct block_list *bl, map_session_data *sd, enum sc_type type);
@@ -124,11 +124,11 @@ int32 unit_is_walking(struct block_list *bl);
 int32 unit_set_walkdelay(struct block_list *bl, t_tick tick, t_tick delay, int32 type);
 int32 unit_set_walkdelay(struct block_list *bl, t_tick tick, t_tick delay, int32 type);
 
 
 t_tick unit_get_walkpath_time(struct block_list& bl);
 t_tick unit_get_walkpath_time(struct block_list& bl);
-t_tick unit_escape(struct block_list *bl, struct block_list *target, short dist, uint8 flag = 0);
+t_tick unit_escape(struct block_list *bl, struct block_list *target, int16 dist, uint8 flag = 0);
 
 
 // Instant unit changes
 // Instant unit changes
-bool unit_movepos(struct block_list *bl, short dst_x, short dst_y, int32 easy, bool checkpath);
-int32 unit_warp(struct block_list *bl, short map, short x, short y, clr_type type);
+bool unit_movepos(struct block_list *bl, int16 dst_x, int16 dst_y, int32 easy, bool checkpath);
+int32 unit_warp(struct block_list *bl, int16 map, int16 x, int16 y, clr_type type);
 bool unit_setdir(block_list *bl, uint8 dir, bool send_update = true);
 bool unit_setdir(block_list *bl, uint8 dir, bool send_update = true);
 uint8 unit_getdir(struct block_list *bl);
 uint8 unit_getdir(struct block_list *bl);
 int32 unit_blown(struct block_list* bl, int32 dx, int32 dy, int32 count, enum e_skill_blown flag);
 int32 unit_blown(struct block_list* bl, int32 dx, int32 dy, int32 count, enum e_skill_blown flag);
@@ -136,7 +136,7 @@ enum e_unit_blown unit_blown_immune(struct block_list* bl, uint8 flag);
 
 
 // Can-reach checks
 // Can-reach checks
 bool unit_can_reach_pos(struct block_list *bl,int32 x,int32 y,int32 easy);
 bool unit_can_reach_pos(struct block_list *bl,int32 x,int32 y,int32 easy);
-bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int32 range, int32 easy, short *x, short *y);
+bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int32 range, int32 easy, int16 *x, int16 *y);
 
 
 // Unit attack functions
 // Unit attack functions
 int32 unit_stopattack(struct block_list *bl, va_list ap);
 int32 unit_stopattack(struct block_list *bl, va_list ap);
@@ -147,9 +147,9 @@ bool unit_can_attack(struct block_list *bl, int32 target_id);
 
 
 // Cast on a unit
 // Cast on a unit
 int32 unit_skilluse_id(struct block_list *src, int32 target_id, uint16 skill_id, uint16 skill_lv);
 int32 unit_skilluse_id(struct block_list *src, int32 target_id, uint16 skill_id, uint16 skill_lv);
-int32 unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv);
+int32 unit_skilluse_pos(struct block_list *src, int16 skill_x, int16 skill_y, uint16 skill_id, uint16 skill_lv);
 int32 unit_skilluse_id2(struct block_list *src, int32 target_id, uint16 skill_id, uint16 skill_lv, int32 casttime, int32 castcancel, bool ignore_range = false);
 int32 unit_skilluse_id2(struct block_list *src, int32 target_id, uint16 skill_id, uint16 skill_lv, int32 casttime, int32 castcancel, bool ignore_range = false);
-int32 unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int32 casttime, int32 castcancel, bool ignore_range = false);
+int32 unit_skilluse_pos2( struct block_list *src, int16 skill_x, int16 skill_y, uint16 skill_id, uint16 skill_lv, int32 casttime, int32 castcancel, bool ignore_range = false);
 
 
 // Step timer used for delayed attack and skill use
 // Step timer used for delayed attack and skill use
 TIMER_FUNC(unit_step_timer);
 TIMER_FUNC(unit_step_timer);

+ 6 - 6
src/map/vending.cpp

@@ -153,8 +153,8 @@ void vending_purchasereq(map_session_data* sd, int32 aid, int32 uid, const uint8
 	z = 0.; // zeny counter
 	z = 0.; // zeny counter
 	w = 0;  // weight counter
 	w = 0;  // weight counter
 	for( i = 0; i < count; i++ ) {
 	for( i = 0; i < count; i++ ) {
-		short amount = *(uint16*)(data + 4*i + 0);
-		short idx    = *(uint16*)(data + 4*i + 2);
+		int16 amount = *(uint16*)(data + 4*i + 0);
+		int16 idx    = *(uint16*)(data + 4*i + 2);
 		idx -= 2;
 		idx -= 2;
 
 
 		if( amount <= 0 )
 		if( amount <= 0 )
@@ -219,8 +219,8 @@ void vending_purchasereq(map_session_data* sd, int32 aid, int32 uid, const uint8
 	pc_getzeny(vsd, (int32)z, LOG_TYPE_VENDING, sd->status.char_id);
 	pc_getzeny(vsd, (int32)z, LOG_TYPE_VENDING, sd->status.char_id);
 
 
 	for( i = 0; i < count; i++ ) {
 	for( i = 0; i < count; i++ ) {
-		short amount = *(uint16*)(data + 4*i + 0);
-		short idx    = *(uint16*)(data + 4*i + 2);
+		int16 amount = *(uint16*)(data + 4*i + 0);
+		int16 idx    = *(uint16*)(data + 4*i + 2);
 		idx -= 2;
 		idx -= 2;
 		z = 0.; // zeny counter
 		z = 0.; // zeny counter
 
 
@@ -332,8 +332,8 @@ int8 vending_openvending( map_session_data& sd, const char* message, const uint8
 	i = 0;
 	i = 0;
 	int64 total = 0;
 	int64 total = 0;
 	for( j = 0; j < count; j++ ) {
 	for( j = 0; j < count; j++ ) {
-		short index        = *(uint16*)(data + 8*j + 0);
-		short amount       = *(uint16*)(data + 8*j + 2);
+		int16 index        = *(uint16*)(data + 8*j + 0);
+		int16 amount       = *(uint16*)(data + 8*j + 2);
 		uint32 value       = *(uint32*)(data + 8*j + 4);
 		uint32 value       = *(uint32*)(data + 8*j + 4);
 
 
 		index -= 2; // offset adjustment (client says that the first cart position is 2)
 		index -= 2; // offset adjustment (client says that the first cart position is 2)

+ 2 - 2
src/map/vending.hpp

@@ -13,8 +13,8 @@ struct s_search_store_search;
 struct s_autotrader;
 struct s_autotrader;
 
 
 struct s_vending {
 struct s_vending {
-	short index; /// cart index (return item data)
-	short amount; ///amout of the item for vending
+	int16 index; /// cart index (return item data)
+	int16 amount; ///amout of the item for vending
 	uint32 value; ///at which price
 	uint32 value; ///at which price
 };
 };