Browse Source

Changed all int to int32 (#8787)

Lemongrass3110 6 months ago
parent
commit
0d2d088bb2
100 changed files with 2560 additions and 2538 deletions
  1. 71 71
      src/char/char.cpp
  2. 71 71
      src/char/char.hpp
  3. 69 69
      src/char/char_clif.cpp
  4. 39 39
      src/char/char_clif.hpp
  5. 2 2
      src/char/char_cnslif.cpp
  6. 3 1
      src/char/char_cnslif.hpp
  7. 39 39
      src/char/char_logif.cpp
  8. 26 26
      src/char/char_logif.hpp
  9. 86 86
      src/char/char_mapif.cpp
  10. 44 44
      src/char/char_mapif.hpp
  11. 14 14
      src/char/int_achievement.cpp
  12. 3 1
      src/char/int_achievement.hpp
  13. 22 22
      src/char/int_auction.cpp
  14. 4 2
      src/char/int_auction.hpp
  15. 12 12
      src/char/int_clan.cpp
  16. 4 2
      src/char/int_clan.hpp
  17. 11 11
      src/char/int_elemental.cpp
  18. 4 2
      src/char/int_elemental.hpp
  19. 91 91
      src/char/int_guild.cpp
  20. 9 9
      src/char/int_guild.hpp
  21. 17 17
      src/char/int_homun.cpp
  22. 4 4
      src/char/int_homun.hpp
  23. 39 39
      src/char/int_mail.cpp
  24. 4 4
      src/char/int_mail.hpp
  25. 12 12
      src/char/int_mercenary.cpp
  26. 3 3
      src/char/int_mercenary.hpp
  27. 56 56
      src/char/int_party.cpp
  28. 6 6
      src/char/int_party.hpp
  29. 20 20
      src/char/int_pet.cpp
  30. 6 6
      src/char/int_pet.hpp
  31. 4 4
      src/char/int_quest.cpp
  32. 3 1
      src/char/int_quest.hpp
  33. 24 24
      src/char/int_storage.cpp
  34. 3 3
      src/char/int_storage.hpp
  35. 54 54
      src/char/inter.cpp
  36. 8 8
      src/char/inter.hpp
  37. 2 2
      src/common/cbasetypes.hpp
  38. 3 3
      src/common/cli.cpp
  39. 3 3
      src/common/cli.hpp
  40. 4 4
      src/common/conf.cpp
  41. 2 2
      src/common/conf.hpp
  42. 7 7
      src/common/core.cpp
  43. 5 5
      src/common/core.hpp
  44. 1 1
      src/common/database.cpp
  45. 40 39
      src/common/db.cpp
  46. 21 21
      src/common/db.hpp
  47. 1 1
      src/common/des.hpp
  48. 1 1
      src/common/ers.cpp
  49. 38 38
      src/common/grfio.cpp
  50. 2 2
      src/common/grfio.hpp
  51. 13 13
      src/common/malloc.cpp
  52. 10 10
      src/common/malloc.hpp
  53. 6 6
      src/common/mapindex.cpp
  54. 3 2
      src/common/mapindex.hpp
  55. 2 2
      src/common/md5calc.cpp
  56. 65 65
      src/common/mmo.hpp
  57. 9 9
      src/common/msg_conf.cpp
  58. 6 6
      src/common/msg_conf.hpp
  59. 8 8
      src/common/nullpo.cpp
  60. 4 4
      src/common/nullpo.hpp
  61. 3 3
      src/common/packets.hpp
  62. 16 16
      src/common/showmsg.cpp
  63. 7 5
      src/common/showmsg.hpp
  64. 90 90
      src/common/socket.cpp
  65. 22 22
      src/common/socket.hpp
  66. 28 28
      src/common/sql.cpp
  67. 17 17
      src/common/sql.hpp
  68. 27 27
      src/common/strlib.cpp
  69. 17 17
      src/common/strlib.hpp
  70. 25 25
      src/common/timer.cpp
  71. 11 11
      src/common/timer.hpp
  72. 5 3
      src/common/utilities.cpp
  73. 1 1
      src/common/utilities.hpp
  74. 4 4
      src/common/utils.cpp
  75. 3 3
      src/common/utils.hpp
  76. 1 1
      src/config/core.hpp
  77. 10 10
      src/login/account.cpp
  78. 3 3
      src/login/account.hpp
  79. 2 2
      src/login/ipban.cpp
  80. 21 21
      src/login/login.cpp
  81. 26 26
      src/login/login.hpp
  82. 45 45
      src/login/loginchrif.cpp
  83. 2 2
      src/login/loginchrif.hpp
  84. 22 22
      src/login/loginclif.cpp
  85. 3 1
      src/login/loginclif.hpp
  86. 2 2
      src/login/logincnslif.cpp
  87. 3 1
      src/login/logincnslif.hpp
  88. 2 2
      src/login/loginlog.cpp
  89. 1 1
      src/login/loginlog.hpp
  90. 31 31
      src/map/achievement.cpp
  91. 12 12
      src/map/achievement.hpp
  92. 127 127
      src/map/atcommand.cpp
  93. 5 5
      src/map/atcommand.hpp
  94. 132 132
      src/map/battle.cpp
  95. 615 615
      src/map/battle.hpp
  96. 25 25
      src/map/battleground.cpp
  97. 22 22
      src/map/battleground.hpp
  98. 15 15
      src/map/buyingstore.cpp
  99. 4 4
      src/map/buyingstore.hpp
  100. 10 10
      src/map/cashshop.cpp

+ 71 - 71
src/char/char.cpp

@@ -45,15 +45,15 @@ using namespace rathena;
 using namespace rathena::server_character;
 using namespace rathena::server_character;
 
 
 //definition of exported var declared in header
 //definition of exported var declared in header
-int login_fd=-1; //login file descriptor
-int char_fd=-1; //char file descriptor
+int32 login_fd=-1; //login file descriptor
+int32 char_fd=-1; //char file descriptor
 struct Schema_Config schema_config;
 struct Schema_Config schema_config;
 struct CharServ_Config charserv_config;
 struct CharServ_Config charserv_config;
 struct mmo_map_server map_server[MAX_MAP_SERVERS];
 struct mmo_map_server map_server[MAX_MAP_SERVERS];
 //Custom limits for the fame lists. [Skotlex]
 //Custom limits for the fame lists. [Skotlex]
-int fame_list_size_chemist = MAX_FAME_LIST;
-int fame_list_size_smith = MAX_FAME_LIST;
-int fame_list_size_taekwon = MAX_FAME_LIST;
+int32 fame_list_size_chemist = MAX_FAME_LIST;
+int32 fame_list_size_smith = MAX_FAME_LIST;
+int32 fame_list_size_taekwon = MAX_FAME_LIST;
 // Char-server-side stored fame lists [DracoRPG]
 // Char-server-side stored fame lists [DracoRPG]
 struct fame_list smith_fame_list[MAX_FAME_LIST];
 struct fame_list smith_fame_list[MAX_FAME_LIST];
 struct fame_list chemist_fame_list[MAX_FAME_LIST];
 struct fame_list chemist_fame_list[MAX_FAME_LIST];
@@ -73,7 +73,7 @@ struct s_subnet {
 	uint32 char_ip;
 	uint32 char_ip;
 	uint32 map_ip;
 	uint32 map_ip;
 } subnet[16];
 } subnet[16];
-int subnet_count = 0;
+int32 subnet_count = 0;
 
 
 // uint32 account_id -> struct auth_node*
 // uint32 account_id -> struct auth_node*
 std::unordered_map<uint32, std::shared_ptr<struct auth_node>> auth_db;
 std::unordered_map<uint32, std::shared_ptr<struct auth_node>> auth_db;
@@ -118,7 +118,7 @@ void char_set_charselect(uint32 account_id) {
 
 
 }
 }
 
 
-void char_set_char_online(int map_id, uint32 char_id, uint32 account_id) {
+void char_set_char_online(int32 map_id, uint32 char_id, uint32 account_id) {
 	//Update DB
 	//Update DB
 	if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `online`='1', `last_login`=NOW() WHERE `char_id`='%d' LIMIT 1", schema_config.char_db, char_id) )
 	if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `online`='1', `last_login`=NOW() WHERE `char_id`='%d' LIMIT 1", schema_config.char_db, char_id) )
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
@@ -207,7 +207,7 @@ void char_set_char_offline(uint32 char_id, uint32 account_id){
 	}
 	}
 }
 }
 
 
-void char_db_setoffline( std::shared_ptr<struct online_char_data> character, int server ){
+void char_db_setoffline( std::shared_ptr<struct online_char_data> character, int32 server ){
 	if (server == -1) {
 	if (server == -1) {
 		character->char_id = -1;
 		character->char_id = -1;
 		character->server = -1;
 		character->server = -1;
@@ -219,7 +219,7 @@ void char_db_setoffline( std::shared_ptr<struct online_char_data> character, int
 		character->server = -2; //In some map server that we aren't connected to.
 		character->server = -2; //In some map server that we aren't connected to.
 }
 }
 
 
-void char_db_kickoffline( std::shared_ptr<struct online_char_data> character, int server_id ){
+void char_db_kickoffline( std::shared_ptr<struct online_char_data> character, int32 server_id ){
 	if (server_id > -1 && character->server != server_id)
 	if (server_id > -1 && character->server != server_id)
 		return;
 		return;
 
 
@@ -230,7 +230,7 @@ void char_db_kickoffline( std::shared_ptr<struct online_char_data> character, in
 		char_set_char_offline(character->char_id, character->account_id);
 		char_set_char_offline(character->char_id, character->account_id);
 }
 }
 
 
-void char_set_all_offline(int id){
+void char_set_all_offline(int32 id){
 	if (id < 0)
 	if (id < 0)
 		ShowNotice("Sending all users offline.\n");
 		ShowNotice("Sending all users offline.\n");
 	else
 	else
@@ -254,12 +254,12 @@ void char_set_all_offline_sql(void){
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
 }
 }
 
 
-int char_mmo_char_tosql(uint32 char_id, struct mmo_charstatus* p){
-	int i = 0;
-	int count = 0;
-	int diff = 0;
+int32 char_mmo_char_tosql(uint32 char_id, struct mmo_charstatus* p){
+	int32 i = 0;
+	int32 count = 0;
+	int32 diff = 0;
 	char save_status[128]; //For displaying save information. [Skotlex]
 	char save_status[128]; //For displaying save information. [Skotlex]
-	int errors = 0; //If there are any errors while saving, "cp" will not be updated at the end.
+	int32 errors = 0; //If there are any errors while saving, "cp" will not be updated at the end.
 	StringBuf buf;
 	StringBuf buf;
 
 
 	if (char_id!=p->char_id) return 0;
 	if (char_id!=p->char_id) return 0;
@@ -529,10 +529,10 @@ int char_mmo_char_tosql(uint32 char_id, struct mmo_charstatus* p){
 }
 }
 
 
 /// Saves an array of 'item' entries into the specified table.
 /// Saves an array of 'item' entries into the specified table.
-int char_memitemdata_to_sql(const struct item items[], int max, int id, enum storage_type tableswitch, uint8 stor_id) {
+int32 char_memitemdata_to_sql(const struct item items[], int32 max, int32 id, enum storage_type tableswitch, uint8 stor_id) {
 	StringBuf buf;
 	StringBuf buf;
 	SqlStmt* stmt;
 	SqlStmt* stmt;
-	int i, j, offset = 0, errors = 0;
+	int32 i, j, offset = 0, errors = 0;
 	const char *tablename, *selectoption, *printname;
 	const char *tablename, *selectoption, *printname;
 	struct item item; // temp storage variable
 	struct item item; // temp storage variable
 	bool* flag; // bit array for inventory matching
 	bool* flag; // bit array for inventory matching
@@ -636,7 +636,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
 			&&  items[i].card[3] == item.card[3]
 			&&  items[i].card[3] == item.card[3]
 			&&  items[i].unique_id == item.unique_id
 			&&  items[i].unique_id == item.unique_id
 			) {	//They are the same item.
 			) {	//They are the same item.
-				int k;
+				int32 k;
 				
 				
 				ARR_FIND( 0, MAX_SLOTS, j, items[i].card[j] != item.card[j] );
 				ARR_FIND( 0, MAX_SLOTS, j, items[i].card[j] != item.card[j] );
 				ARR_FIND( 0, MAX_ITEM_RDM_OPT, k, items[i].option[k].id != item.option[k].id || items[i].option[k].value != item.option[k].value || items[i].option[k].param != item.option[k].param );
 				ARR_FIND( 0, MAX_ITEM_RDM_OPT, k, items[i].option[k].id != item.option[k].id || items[i].option[k].value != item.option[k].value || items[i].option[k].param != item.option[k].param );
@@ -745,10 +745,10 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
 	return errors;
 	return errors;
 }
 }
 
 
-bool char_memitemdata_from_sql(struct s_storage* p, int max, int id, enum storage_type tableswitch, uint8 stor_id) {
+bool char_memitemdata_from_sql(struct s_storage* p, int32 max, int32 id, enum storage_type tableswitch, uint8 stor_id) {
 	StringBuf buf;
 	StringBuf buf;
 	SqlStmt* stmt;
 	SqlStmt* stmt;
-	int i,j, offset = 0, max2;
+	int32 i,j, offset = 0, max2;
 	struct item item, *storage;
 	struct item item, *storage;
 	const char *tablename, *selectoption, *printname;
 	const char *tablename, *selectoption, *printname;
 
 
@@ -871,7 +871,7 @@ bool char_memitemdata_from_sql(struct s_storage* p, int max, int id, enum storag
  * @retval SEX_MALE if the per-character sex is male
  * @retval SEX_MALE if the per-character sex is male
  * @retval SEX_FEMALE if the per-character sex is female
  * @retval SEX_FEMALE if the per-character sex is female
  */
  */
-int char_mmo_gender( const struct char_session_data *sd, const struct mmo_charstatus *p, char sex ){
+int32 char_mmo_gender( const struct char_session_data *sd, const struct mmo_charstatus *p, char sex ){
 #if PACKETVER >= 20141016
 #if PACKETVER >= 20141016
 	switch( sex ){
 	switch( sex ){
 		case 'M':
 		case 'M':
@@ -885,7 +885,7 @@ int char_mmo_gender( const struct char_session_data *sd, const struct mmo_charst
 #endif
 #endif
 			// There are calls to this function that do not contain the session
 			// There are calls to this function that do not contain the session
 			if( sd == nullptr ){
 			if( sd == nullptr ){
-				int i;
+				int32 i;
 
 
 				// Find player session
 				// Find player session
 				ARR_FIND( 0, fd_max, i, session[i] && ( sd = (struct char_session_data*)session[i]->session_data ) && sd->account_id == p->account_id );
 				ARR_FIND( 0, fd_max, i, session[i] && ( sd = (struct char_session_data*)session[i]->session_data ) && sd->account_id == p->account_id );
@@ -906,14 +906,14 @@ int char_mmo_gender( const struct char_session_data *sd, const struct mmo_charst
 #endif
 #endif
 }
 }
 
 
-int char_mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p);
+int32 char_mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p);
 
 
 //=====================================================================================================
 //=====================================================================================================
 // Loads the basic character rooster for the given account. Returns total buffer used.
 // Loads the basic character rooster for the given account. Returns total buffer used.
-int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf, uint8* count ) {
+int32 char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf, uint8* count ) {
 	SqlStmt* stmt;
 	SqlStmt* stmt;
 	struct mmo_charstatus p;
 	struct mmo_charstatus p;
-	int j = 0, i;
+	int32 j = 0, i;
 	char sex[2];
 	char sex[2];
 
 
 	stmt = SqlStmt_Malloc(sql_handle);
 	stmt = SqlStmt_Malloc(sql_handle);
@@ -1028,8 +1028,8 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf, uint8* coun
 }
 }
 
 
 //=====================================================================================================
 //=====================================================================================================
-int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_everything) {
-	int i;
+int32 char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_everything) {
+	int32 i;
 	SqlStmt* stmt;
 	SqlStmt* stmt;
 	struct s_point_str tmp_point;
 	struct s_point_str tmp_point;
 	struct s_skill tmp_skill;
 	struct s_skill tmp_skill;
@@ -1037,7 +1037,7 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev
 	struct s_friend tmp_friend;
 	struct s_friend tmp_friend;
 #ifdef HOTKEY_SAVING
 #ifdef HOTKEY_SAVING
 	struct hotkey tmp_hotkey;
 	struct hotkey tmp_hotkey;
-	int hotkey_num;
+	int32 hotkey_num;
 #endif
 #endif
 	StringBuf msg_buf;
 	StringBuf msg_buf;
 	char sex[2];
 	char sex[2];
@@ -1265,7 +1265,7 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev
 }
 }
 
 
 //==========================================================================================================
 //==========================================================================================================
-int char_mmo_sql_init(void) {
+int32 char_mmo_sql_init(void) {
 	ShowStatus("Characters per Account: '%d'.\n", charserv_config.char_config.char_per_account);
 	ShowStatus("Characters per Account: '%d'.\n", charserv_config.char_config.char_per_account);
 
 
 	//the 'set offline' part is now in check_login_conn ...
 	//the 'set offline' part is now in check_login_conn ...
@@ -1283,7 +1283,7 @@ int char_mmo_sql_init(void) {
 //-----------------------------------
 //-----------------------------------
 // Function to change chararcter's names
 // Function to change chararcter's names
 //-----------------------------------
 //-----------------------------------
-int char_rename_char_sql(struct char_session_data *sd, uint32 char_id)
+int32 char_rename_char_sql(struct char_session_data *sd, uint32 char_id)
 {
 {
 	struct mmo_charstatus char_dat;
 	struct mmo_charstatus char_dat;
 	char esc_name[NAME_LENGTH*2+1];
 	char esc_name[NAME_LENGTH*2+1];
@@ -1350,9 +1350,9 @@ int char_rename_char_sql(struct char_session_data *sd, uint32 char_id)
 	return 0;
 	return 0;
 }
 }
 
 
-int char_check_char_name(char * name, char * esc_name)
+int32 char_check_char_name(char * name, char * esc_name)
 {
 {
-	int i;
+	int32 i;
 
 
 	// check length of character name
 	// check length of character name
 	if( name[0] == '\0' )
 	if( name[0] == '\0' )
@@ -1410,14 +1410,14 @@ int char_check_char_name(char * name, char * esc_name)
 //-----------------------------------
 //-----------------------------------
 // Function to create a new character
 // Function to create a new character
 //-----------------------------------
 //-----------------------------------
-int char_make_new_char( struct char_session_data* sd, char* name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short start_job, int 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, short 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];
 	struct startitem tmp_start_items[MAX_STARTITEM];
 	struct startitem tmp_start_items[MAX_STARTITEM];
 	uint32 char_id;
 	uint32 char_id;
-	int flag, k, start_point_idx = rnd() % charserv_config.start_point_count;
-	int status_points;
+	int32 flag, k, start_point_idx = rnd() % charserv_config.start_point_count;
+	int32 status_points;
 
 
 	safestrncpy(name, name_, NAME_LENGTH);
 	safestrncpy(name, name_, NAME_LENGTH);
 	normalize_name(name,TRIM_CHARS);
 	normalize_name(name,TRIM_CHARS);
@@ -1546,7 +1546,7 @@ int char_make_new_char( struct char_session_data* sd, char* name_, int str, int
 /*----------------------------------------------------------------------------------------------------------*/
 /*----------------------------------------------------------------------------------------------------------*/
 /* Divorce Players */
 /* Divorce Players */
 /*----------------------------------------------------------------------------------------------------------*/
 /*----------------------------------------------------------------------------------------------------------*/
-int char_divorce_char_sql(int partner_id1, int partner_id2){
+int32 char_divorce_char_sql(int32 partner_id1, int32 partner_id2){
 	if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", schema_config.char_db, partner_id1, partner_id2) )
 	if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", schema_config.char_db, partner_id1, partner_id2) )
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%u' OR `nameid`='%u') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", schema_config.inventory_db, WEDDING_RING_M, WEDDING_RING_F, partner_id1, partner_id2) )
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%u' OR `nameid`='%u') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", schema_config.inventory_db, WEDDING_RING_M, WEDDING_RING_F, partner_id1, partner_id2) )
@@ -1565,11 +1565,11 @@ enum e_char_del_response char_delete(struct char_session_data* sd, uint32 char_i
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 	char esc_name[NAME_LENGTH*2+1]; //Name needs be escaped.
 	char esc_name[NAME_LENGTH*2+1]; //Name needs be escaped.
 	uint32 account_id;
 	uint32 account_id;
-	int party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id;
+	int32 party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id;
 	time_t delete_date;
 	time_t delete_date;
 	char *data;
 	char *data;
 	size_t len;
 	size_t len;
-	int i;
+	int32 i;
 
 
 	ARR_FIND(0, MAX_CHARS, i, sd->found_char[i] == char_id);
 	ARR_FIND(0, MAX_CHARS, i, sd->found_char[i] == char_id);
 
 
@@ -1778,9 +1778,9 @@ enum e_char_del_response char_delete(struct char_session_data* sd, uint32 char_i
  * This function parse all map-serv attached to this char-serv and increase user count
  * This function parse all map-serv attached to this char-serv and increase user count
  * @return numbers of total users
  * @return numbers of total users
  */
  */
-int char_count_users(void)
+int32 char_count_users(void)
 {
 {
-	int i, users;
+	int32 i, users;
 
 
 	users = 0;
 	users = 0;
 	for(i = 0; i < ARRAYLENGTH(map_server); i++) {
 	for(i = 0; i < ARRAYLENGTH(map_server); i++) {
@@ -1794,7 +1794,7 @@ int char_count_users(void)
 // Writes char data to the buffer in the format used by the client.
 // Writes char data to the buffer in the format used by the client.
 // Used in packets 0x6b (chars info) and 0x6d (new char info)
 // Used in packets 0x6b (chars info) and 0x6d (new char info)
 // Returns the size
 // Returns the size
-int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p){
+int32 char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p){
 	if( buffer == nullptr || p == nullptr )
 	if( buffer == nullptr || p == nullptr )
 		return 0;
 		return 0;
 
 
@@ -1882,7 +1882,7 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p){
 }
 }
 
 
 
 
-int char_married(int pl1, int pl2)
+int32 char_married(int32 pl1, int32 pl2)
 {
 {
 	if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", schema_config.char_db, pl1) )
 	if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", schema_config.char_db, pl1) )
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
@@ -1901,7 +1901,7 @@ int char_married(int pl1, int pl2)
 	return 0;
 	return 0;
 }
 }
 
 
-int char_child(int parent_id, int child_id)
+int32 char_child(int32 parent_id, int32 child_id)
 {
 {
 	if( parent_id == 0 || child_id == 0) //Failsafe, avoild querys and fix EXP bug dividing with lower level chars
 	if( parent_id == 0 || child_id == 0) //Failsafe, avoild querys and fix EXP bug dividing with lower level chars
 		return 0;
 		return 0;
@@ -1922,7 +1922,7 @@ int char_child(int parent_id, int child_id)
 	return 0;
 	return 0;
 }
 }
 
 
-int char_family(int cid1, int cid2, int cid3)
+int32 char_family(int32 cid1, int32 cid2, int32 cid3)
 {
 {
 	if ( cid1 == 0 || cid2 == 0 || cid3 == 0 ) //Failsafe, and avoid querys where there is no sense to keep executing if any of the inputs are 0
 	if ( cid1 == 0 || cid2 == 0 || cid3 == 0 ) //Failsafe, and avoid querys where there is no sense to keep executing if any of the inputs are 0
 		return 0;
 		return 0;
@@ -1930,9 +1930,9 @@ int char_family(int cid1, int cid2, int cid3)
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
 	else while( SQL_SUCCESS == Sql_NextRow(sql_handle) )
 	else while( SQL_SUCCESS == Sql_NextRow(sql_handle) )
 	{
 	{
-		int charid;
-		int partnerid;
-		int childid;
+		int32 charid;
+		int32 partnerid;
+		int32 childid;
 		char* data;
 		char* data;
 
 
 		Sql_GetData(sql_handle, 0, &data, nullptr); charid = atoi(data);
 		Sql_GetData(sql_handle, 0, &data, nullptr); charid = atoi(data);
@@ -1956,7 +1956,7 @@ int char_family(int cid1, int cid2, int cid3)
 //----------------------------------------------------------------------
 //----------------------------------------------------------------------
 void char_disconnect_player(uint32 account_id)
 void char_disconnect_player(uint32 account_id)
 {
 {
-	int i;
+	int32 i;
 	struct char_session_data* sd;
 	struct char_session_data* sd;
 
 
 	// disconnect player if online on char-server
 	// disconnect player if online on char-server
@@ -1971,8 +1971,8 @@ void char_disconnect_player(uint32 account_id)
 * @param value
 * @param value
 * @param set True: set the value by using '|= val', False: unset the value by using '&= ~val'
 * @param set True: set the value by using '|= val', False: unset the value by using '&= ~val'
 **/
 **/
-void char_set_session_flag_(int account_id, int val, bool set) {
-	int i;
+void char_set_session_flag_(int32 account_id, int32 val, bool set) {
+	int32 i;
 	struct char_session_data* sd;
 	struct char_session_data* sd;
 
 
 	ARR_FIND(0, fd_max, i, session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->account_id == account_id);
 	ARR_FIND(0, fd_max, i, session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->account_id == account_id);
@@ -1984,7 +1984,7 @@ void char_set_session_flag_(int account_id, int val, bool set) {
 	}
 	}
 }
 }
 
 
-void char_auth_ok(int fd, struct char_session_data *sd) {
+void char_auth_ok(int32 fd, struct char_session_data *sd) {
 	std::shared_ptr<struct online_char_data> character = util::umap_find( char_get_onlinedb(), sd->account_id );
 	std::shared_ptr<struct online_char_data> character = util::umap_find( char_get_onlinedb(), sd->account_id );
 
 
 	// Check if character is not online already. [Skotlex]
 	// Check if character is not online already. [Skotlex]
@@ -2018,7 +2018,7 @@ void char_auth_ok(int fd, struct char_session_data *sd) {
 
 
 void char_read_fame_list(void)
 void char_read_fame_list(void)
 {
 {
-	int i;
+	int32 i;
 	char* data;
 	char* data;
 	size_t len;
 	size_t len;
 
 
@@ -2076,7 +2076,7 @@ void char_read_fame_list(void)
 
 
 //Loads a character's name and stores it in the buffer given (must be NAME_LENGTH in size)
 //Loads a character's name and stores it in the buffer given (must be NAME_LENGTH in size)
 //Returns 1 on found, 0 on not found (buffer is filled with Unknown char name)
 //Returns 1 on found, 0 on not found (buffer is filled with Unknown char name)
-int char_loadName(uint32 char_id, char* name){
+int32 char_loadName(uint32 char_id, char* name){
 	char* data;
 	char* data;
 	size_t len;
 	size_t len;
 
 
@@ -2101,8 +2101,8 @@ int char_loadName(uint32 char_id, char* name){
 
 
 // Searches for the mapserver that has a given map (and optionally ip/port, if not -1).
 // Searches for the mapserver that has a given map (and optionally ip/port, if not -1).
 // If found, returns the server's index in the 'server' array (otherwise returns -1).
 // If found, returns the server's index in the 'server' array (otherwise returns -1).
-int char_search_mapserver( const std::string& map, uint32 ip, uint16 port ){
-	for(int i = 0; i < ARRAYLENGTH(map_server); i++)
+int32 char_search_mapserver( const std::string& map, uint32 ip, uint16 port ){
+	for(int32 i = 0; i < ARRAYLENGTH(map_server); i++)
 	{
 	{
 		if (session_isValid(map_server[i].fd)
 		if (session_isValid(map_server[i].fd)
 		&& (ip == (uint32)-1 || map_server[i].ip == ip)
 		&& (ip == (uint32)-1 || map_server[i].ip == ip)
@@ -2124,8 +2124,8 @@ int char_search_mapserver( const std::string& map, uint32 ip, uint16 port ){
  * @param ip: ip to check if in auth network
  * @param ip: ip to check if in auth network
  * @return 0 if from wan, or subnet_map_ip if lan
  * @return 0 if from wan, or subnet_map_ip if lan
  **/
  **/
-int char_lan_subnetcheck(uint32 ip){
-	int i;
+int32 char_lan_subnetcheck(uint32 ip){
+	int32 i;
 	ARR_FIND( 0, subnet_count, i, (subnet[i].char_ip & subnet[i].mask) == (ip & subnet[i].mask) );
 	ARR_FIND( 0, subnet_count, i, (subnet[i].char_ip & subnet[i].mask) == (ip & subnet[i].mask) );
 	if( i < subnet_count ) {
 	if( i < subnet_count ) {
 		ShowInfo("Subnet check [%u.%u.%u.%u]: Matches " CL_CYAN "%u.%u.%u.%u/%u.%u.%u.%u" CL_RESET"\n", CONVIP(ip), CONVIP(subnet[i].char_ip & subnet[i].mask), CONVIP(subnet[i].mask));
 		ShowInfo("Subnet check [%u.%u.%u.%u]: Matches " CL_CYAN "%u.%u.%u.%u/%u.%u.%u.%u" CL_RESET"\n", CONVIP(ip), CONVIP(subnet[i].char_ip & subnet[i].mask), CONVIP(subnet[i].mask));
@@ -2138,7 +2138,7 @@ int char_lan_subnetcheck(uint32 ip){
 
 
 // Console Command Parser [Wizputer]
 // Console Command Parser [Wizputer]
 //FIXME to be remove (moved to cnslif / will be done once map/char/login, all have their cnslif interface ready)
 //FIXME to be remove (moved to cnslif / will be done once map/char/login, all have their cnslif interface ready)
-int parse_console(const char* buf){
+int32 parse_console(const char* buf){
 	return cnslif_parse(buf);
 	return cnslif_parse(buf);
 }
 }
 
 
@@ -2146,7 +2146,7 @@ int parse_console(const char* buf){
 //------------------------------------------------
 //------------------------------------------------
 //Pincode system
 //Pincode system
 //------------------------------------------------
 //------------------------------------------------
-int char_pincode_compare( int fd, struct char_session_data* sd, char* pin ){
+int32 char_pincode_compare( int32 fd, struct char_session_data* sd, char* pin ){
 	if( strcmp( sd->pincode, pin ) == 0 ){
 	if( strcmp( sd->pincode, pin ) == 0 ){
 		sd->pincode_try = 0;
 		sd->pincode_try = 0;
 		return 1;
 		return 1;
@@ -2162,7 +2162,7 @@ int char_pincode_compare( int fd, struct char_session_data* sd, char* pin ){
 }
 }
 
 
 bool char_pincode_decrypt( uint32 userSeed, char* pin ){
 bool char_pincode_decrypt( uint32 userSeed, char* pin ){
-	int i;
+	int32 i;
 	char tab[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
 	char tab[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
 	char *buf;
 	char *buf;
 
 
@@ -2175,7 +2175,7 @@ bool char_pincode_decrypt( uint32 userSeed, char* pin ){
 	}
 	}
 
 
 	for( i = 1; i < 10; i++ ){
 	for( i = 1; i < 10; i++ ){
-		int pos;
+		int32 pos;
 		uint32 multiplier = 0x3498, baseSeed = 0x881234;
 		uint32 multiplier = 0x3498, baseSeed = 0x881234;
 
 
 		userSeed = baseSeed + userSeed * multiplier;
 		userSeed = baseSeed + userSeed * multiplier;
@@ -2256,9 +2256,9 @@ TIMER_FUNC(char_clan_member_cleanup){
 // Reading Lan Support configuration
 // Reading Lan Support configuration
 // Rewrote: Anvanced subnet check [LuzZza]
 // Rewrote: Anvanced subnet check [LuzZza]
 //----------------------------------
 //----------------------------------
-int char_lan_config_read(const char *lancfgName) {
+int32 char_lan_config_read(const char *lancfgName) {
 	FILE *fp;
 	FILE *fp;
-	int line_num = 0, s_subnet=ARRAYLENGTH(subnet);
+	int32 line_num = 0, s_subnet=ARRAYLENGTH(subnet);
 	char line[1024], w1[64], w2[64], w3[64], w4[64];
 	char line[1024], w1[64], w2[64], w3[64], w4[64];
 
 
 	if((fp = fopen(lancfgName, "r")) == nullptr) {
 	if((fp = fopen(lancfgName, "r")) == nullptr) {
@@ -2312,7 +2312,7 @@ int char_lan_config_read(const char *lancfgName) {
  * @return 0:fail, 1:success
  * @return 0:fail, 1:success
  */
  */
 bool char_checkdb(void){
 bool char_checkdb(void){
-	int i;
+	int32 i;
 	const char* sqltable[] = {
 	const char* sqltable[] = {
 		schema_config.char_db, schema_config.hotkey_db, schema_config.scdata_db, schema_config.cart_db, 
 		schema_config.char_db, schema_config.hotkey_db, schema_config.scdata_db, schema_config.cart_db, 
                 schema_config.inventory_db, schema_config.charlog_db,
                 schema_config.inventory_db, schema_config.charlog_db,
@@ -2833,7 +2833,7 @@ void char_set_defaults(){
  */
  */
 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], short* count ){
 	char *lineitem, **fields;
 	char *lineitem, **fields;
-	int i = 0;
+	int32 i = 0;
 	size_t fields_length = 3 + 1;
 	size_t fields_length = 3 + 1;
 
 
 	(*count) = 0; // Reset to begin reading
 	(*count) = 0; // Reset to begin reading
@@ -2874,7 +2874,7 @@ void char_config_split_startpoint( char* w1_value, char* w2_value, struct s_poin
 void char_config_split_startitem(char *w1_value, char *w2_value, struct startitem start_items[MAX_STARTITEM])
 void char_config_split_startitem(char *w1_value, char *w2_value, struct startitem start_items[MAX_STARTITEM])
 {
 {
 	char *lineitem, **fields;
 	char *lineitem, **fields;
-	int i = 0;
+	int32 i = 0;
 	size_t fields_length = 3 + 1;
 	size_t fields_length = 3 + 1;
 
 
 	memset(start_items, 0, sizeof(struct startitem) * MAX_STARTITEM);
 	memset(start_items, 0, sizeof(struct startitem) * MAX_STARTITEM);
@@ -3131,10 +3131,10 @@ void char_config_adjust() {
 /*
 /*
  * Message conf function
  * Message conf function
  */
  */
-int char_msg_config_read(const char *cfgName){
+int32 char_msg_config_read(const char *cfgName){
 	return _msg_config_read(cfgName,CHAR_MAX_MSG,msg_table);
 	return _msg_config_read(cfgName,CHAR_MAX_MSG,msg_table);
 }
 }
-const char* char_msg_txt(int msg_number){
+const char* char_msg_txt(int32 msg_number){
 	return _msg_txt(msg_number,CHAR_MAX_MSG,msg_table);
 	return _msg_txt(msg_number,CHAR_MAX_MSG,msg_table);
 }
 }
 void char_do_final_msg(void){
 void char_do_final_msg(void){
@@ -3174,12 +3174,12 @@ void CharacterServer::finalize(){
 void CharacterServer::handle_shutdown(){
 void CharacterServer::handle_shutdown(){
 	ShowStatus("Shutting down...\n");
 	ShowStatus("Shutting down...\n");
 	// TODO proper shutdown procedure; wait for acks?, kick all characters, ... [FlavoJS]
 	// TODO proper shutdown procedure; wait for acks?, kick all characters, ... [FlavoJS]
-	for( int id = 0; id < ARRAYLENGTH(map_server); ++id )
+	for( int32 id = 0; id < ARRAYLENGTH(map_server); ++id )
 		chmapif_server_reset(id);
 		chmapif_server_reset(id);
 	flush_fifos();
 	flush_fifos();
 }
 }
 
 
-bool CharacterServer::initialize( int argc, char *argv[] ){
+bool CharacterServer::initialize( int32 argc, char *argv[] ){
 	// Init default value
 	// Init default value
 	safestrncpy(console_log_filepath, "./log/char-msg_log.log", sizeof(console_log_filepath));
 	safestrncpy(console_log_filepath, "./log/char-msg_log.log", sizeof(console_log_filepath));
 
 
@@ -3283,6 +3283,6 @@ bool CharacterServer::initialize( int argc, char *argv[] ){
 	return true;
 	return true;
 }
 }
 
 
-int main( int argc, char *argv[] ){
+int32 main( int32 argc, char *argv[] ){
 	return main_core<CharacterServer>( argc, argv );
 	return main_core<CharacterServer>( argc, argv );
 }
 }

+ 71 - 71
src/char/char.hpp

@@ -23,7 +23,7 @@ namespace rathena{
 	namespace server_character{
 	namespace server_character{
 		class CharacterServer : public Core{
 		class CharacterServer : public Core{
 			protected:
 			protected:
-				bool initialize( int argc, char* argv[] ) override;
+				bool initialize( int32 argc, char* argv[] ) override;
 				void finalize() override;
 				void finalize() override;
 				void handle_shutdown() override;
 				void handle_shutdown() override;
 
 
@@ -35,8 +35,8 @@ namespace rathena{
 	}
 	}
 }
 }
 
 
-extern int login_fd; //login file descriptor
-extern int char_fd; //char file descriptor
+extern int32 login_fd; //login file descriptor
+extern int32 char_fd; //char file descriptor
 
 
 #define MAX_STARTPOINT 5
 #define MAX_STARTPOINT 5
 #define MAX_STARTITEM 32
 #define MAX_STARTITEM 32
@@ -63,7 +63,7 @@ enum e_char_del_response {
 };
 };
 
 
 struct Schema_Config {
 struct Schema_Config {
-	int db_use_sqldbs;
+	int32 db_use_sqldbs;
 	char db_path[1024];
 	char db_path[1024];
 	char char_db[DB_NAME_LEN];
 	char char_db[DB_NAME_LEN];
 	char scdata_db[DB_NAME_LEN];
 	char scdata_db[DB_NAME_LEN];
@@ -130,8 +130,8 @@ enum pincode_state : uint8 {
 };
 };
 struct Pincode_Config {
 struct Pincode_Config {
 	bool pincode_enabled;
 	bool pincode_enabled;
-	int pincode_changetime;
-	int pincode_maxtry;
+	int32 pincode_changetime;
+	int32 pincode_maxtry;
 	bool pincode_force;
 	bool pincode_force;
 	bool pincode_allow_repeated;
 	bool pincode_allow_repeated;
 	bool pincode_allow_sequential;
 	bool pincode_allow_sequential;
@@ -144,16 +144,16 @@ struct CharMove_Config {
 	bool char_moves_unlimited;
 	bool char_moves_unlimited;
 };
 };
 struct Char_Config {
 struct Char_Config {
-	int char_per_account; //Maximum chars per account (default unlimited) [Sirius]
-	int char_del_level; //From which level u can delete character [Lupus]
-	int char_del_delay; //minimum delay before effectly do the deletion
+	int32 char_per_account; //Maximum chars per account (default unlimited) [Sirius]
+	int32 char_del_level; //From which level u can delete character [Lupus]
+	int32 char_del_delay; //minimum delay before effectly do the deletion
 	bool name_ignoring_case; // Allow or not identical name for characters but with a different case by [Yor]
 	bool name_ignoring_case; // Allow or not identical name for characters but with a different case by [Yor]
 	char unknown_char_name[NAME_LENGTH]; // Name to use when the requested name cannot be determined
 	char unknown_char_name[NAME_LENGTH]; // Name to use when the requested name cannot be determined
 	char char_name_letters[1024]; // list of letters/symbols allowed (or not) in a character name. by [Yor]
 	char char_name_letters[1024]; // list of letters/symbols allowed (or not) in a character name. by [Yor]
-	int char_name_option; // Option to know which letters/symbols are authorised in the name of a character (0: all, 1: only those in char_name_letters, 2: all EXCEPT those in char_name_letters) by [Yor]
+	int32 char_name_option; // Option to know which letters/symbols are authorised in the name of a character (0: all, 1: only those in char_name_letters, 2: all EXCEPT those in char_name_letters) by [Yor]
 	uint8 char_name_min_length; // Minimum character name length (default: 4)
 	uint8 char_name_min_length; // Minimum character name length (default: 4)
-	int char_del_option;	// Character deletion type, email = 1, birthdate = 2 (default)
-	int char_del_restriction;	// Character deletion restriction (0: none, 1: if the character is in a party, 2: if the character is in a guild, 3: if the character is in a party or a guild)
+	int32 char_del_option;	// Character deletion type, email = 1, birthdate = 2 (default)
+	int32 char_del_restriction;	// Character deletion restriction (0: none, 1: if the character is in a party, 2: if the character is in a guild, 3: if the character is in a party or a guild)
 	bool char_rename_party;	// Character renaming in a party
 	bool char_rename_party;	// Character renaming in a party
 	bool char_rename_guild;	// Character renaming in a guild
 	bool char_rename_guild;	// Character renaming in a guild
 };
 };
@@ -172,9 +172,9 @@ struct CharServ_Config {
 	char bind_ip_str[128];
 	char bind_ip_str[128];
 	uint32 bind_ip;
 	uint32 bind_ip;
 	uint16 char_port;
 	uint16 char_port;
-	int char_maintenance;
+	int32 char_maintenance;
 	bool char_new;
 	bool char_new;
-	int char_new_display;
+	int32 char_new_display;
 
 
 	struct CharMove_Config charmove_config;
 	struct CharMove_Config charmove_config;
 	struct Char_Config char_config;
 	struct Char_Config char_config;
@@ -182,39 +182,39 @@ struct CharServ_Config {
 	struct Pincode_Config pincode_config;
 	struct Pincode_Config pincode_config;
 #endif
 #endif
 
 
-	int save_log; // show loading/saving messages
-	int log_char;	// loggin char or not [devil]
-	int log_inter;	// loggin inter or not [devil]
-	int char_check_db;	///cheking sql-table at begining ?
+	int32 save_log; // show loading/saving messages
+	int32 log_char;	// loggin char or not [devil]
+	int32 log_inter;	// loggin inter or not [devil]
+	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
 	short 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;
-	int console;
-	int max_connect_user;
-	int gm_allow_group;
-	int autosave_interval;
-	int start_zeny;
-	int guild_exp_rate;
-
-	int clan_remove_inactive_days;
-	int mail_return_days;
-	int mail_delete_days;
-	int mail_retrieve;
-	int mail_return_empty;
-
-	int allowed_job_flag;
-	int clear_parties;
+	int32 console;
+	int32 max_connect_user;
+	int32 gm_allow_group;
+	int32 autosave_interval;
+	int32 start_zeny;
+	int32 guild_exp_rate;
+
+	int32 clan_remove_inactive_days;
+	int32 mail_return_days;
+	int32 mail_delete_days;
+	int32 mail_retrieve;
+	int32 mail_return_empty;
+
+	int32 allowed_job_flag;
+	int32 clear_parties;
 };
 };
 extern struct CharServ_Config charserv_config;
 extern struct CharServ_Config charserv_config;
 
 
 #define MAX_MAP_SERVERS 2 //how many mapserver a char server can handle
 #define MAX_MAP_SERVERS 2 //how many mapserver a char server can handle
 struct mmo_map_server {
 struct mmo_map_server {
-	int fd;
+	int32 fd;
 	uint32 ip;
 	uint32 ip;
 	uint16 port;
 	uint16 port;
-	int users;
+	int32 users;
 	std::vector<std::string> maps;
 	std::vector<std::string> maps;
 };
 };
 extern struct mmo_map_server map_server[MAX_MAP_SERVERS];
 extern struct mmo_map_server map_server[MAX_MAP_SERVERS];
@@ -226,9 +226,9 @@ struct auth_node {
 	uint32 login_id1;
 	uint32 login_id1;
 	uint32 login_id2;
 	uint32 login_id2;
 	uint32 ip;
 	uint32 ip;
-	int sex;
+	int32 sex;
 	time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
 	time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
-	int group_id;
+	int32 group_id;
 	unsigned changing_mapservers : 1;
 	unsigned changing_mapservers : 1;
 	uint8 version;
 	uint8 version;
 };
 };
@@ -238,8 +238,8 @@ std::unordered_map<uint32, std::shared_ptr<struct auth_node>>& char_get_authdb()
 struct online_char_data {
 struct online_char_data {
 	uint32 account_id;
 	uint32 account_id;
 	uint32 char_id;
 	uint32 char_id;
-	int fd;
-	int waiting_disconnect;
+	int32 fd;
+	int32 waiting_disconnect;
 	short server; // -2: unknown server, -1: not connected, 0+: id of server
 	short server; // -2: unknown server, -1: not connected, 0+: id of server
 	bool pincode_success;
 	bool pincode_success;
 
 
@@ -252,10 +252,10 @@ std::unordered_map<uint32, std::shared_ptr<struct online_char_data>>& char_get_o
 struct char_session_data {
 struct char_session_data {
 	bool auth; // whether the session is authed or not
 	bool auth; // whether the session is authed or not
 	uint32 account_id, login_id1, login_id2, sex;
 	uint32 account_id, login_id1, login_id2, sex;
-	int found_char[MAX_CHARS]; // ids of chars on this account
+	int32 found_char[MAX_CHARS]; // ids of chars on this account
 	char email[40]; // e-mail (default: a@a.com) by [Yor]
 	char email[40]; // e-mail (default: a@a.com) by [Yor]
 	time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
 	time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
-	int group_id; // permission
+	int32 group_id; // permission
 	uint8 char_slots; // total number of characters that can be created
 	uint8 char_slots; // total number of characters that can be created
 	uint8 chars_vip;
 	uint8 chars_vip;
 	uint8 chars_billing;
 	uint8 chars_billing;
@@ -272,16 +272,16 @@ struct char_session_data {
 	uint32 char_moves[MAX_CHARS]; // character moves left
 	uint32 char_moves[MAX_CHARS]; // character moves left
 	uint8 isvip;
 	uint8 isvip;
 	time_t unban_time[MAX_CHARS];
 	time_t unban_time[MAX_CHARS];
-	int charblock_timer;
+	int32 charblock_timer;
 	uint8 flag; // &1 - Retrieving guild bound items
 	uint8 flag; // &1 - Retrieving guild bound items
 };
 };
 
 
 std::unordered_map<uint32, std::shared_ptr<struct mmo_charstatus>>& char_get_chardb();
 std::unordered_map<uint32, std::shared_ptr<struct mmo_charstatus>>& char_get_chardb();
 
 
 //Custom limits for the fame lists. [Skotlex]
 //Custom limits for the fame lists. [Skotlex]
-extern int fame_list_size_chemist;
-extern int fame_list_size_smith;
-extern int fame_list_size_taekwon;
+extern int32 fame_list_size_chemist;
+extern int32 fame_list_size_smith;
+extern int32 fame_list_size_taekwon;
 // Char-server-side stored fame lists [DracoRPG]
 // Char-server-side stored fame lists [DracoRPG]
 extern struct fame_list smith_fame_list[MAX_FAME_LIST];
 extern struct fame_list smith_fame_list[MAX_FAME_LIST];
 extern struct fame_list chemist_fame_list[MAX_FAME_LIST];
 extern struct fame_list chemist_fame_list[MAX_FAME_LIST];
@@ -290,45 +290,45 @@ extern struct fame_list taekwon_fame_list[MAX_FAME_LIST];
 #define DEFAULT_AUTOSAVE_INTERVAL 300*1000
 #define DEFAULT_AUTOSAVE_INTERVAL 300*1000
 #define MAX_CHAR_BUF sizeof( struct CHARACTER_INFO ) //Max size (for WFIFOHEAD calls)
 #define MAX_CHAR_BUF sizeof( struct CHARACTER_INFO ) //Max size (for WFIFOHEAD calls)
 
 
-int char_search_mapserver( const std::string& map, uint32 ip, uint16 port );
-int char_lan_subnetcheck(uint32 ip);
+int32 char_search_mapserver( const std::string& map, uint32 ip, uint16 port );
+int32 char_lan_subnetcheck(uint32 ip);
 
 
-int char_count_users(void);
-void char_db_setoffline( std::shared_ptr<struct online_char_data> character, int server );
-void char_set_char_online(int map_id, uint32 char_id, uint32 account_id);
+int32 char_count_users(void);
+void char_db_setoffline( std::shared_ptr<struct online_char_data> character, int32 server );
+void char_set_char_online(int32 map_id, uint32 char_id, uint32 account_id);
 void char_set_char_offline(uint32 char_id, uint32 account_id);
 void char_set_char_offline(uint32 char_id, uint32 account_id);
-void char_set_all_offline(int id);
+void char_set_all_offline(int32 id);
 void char_disconnect_player(uint32 account_id);
 void char_disconnect_player(uint32 account_id);
 TIMER_FUNC(char_chardb_waiting_disconnect);
 TIMER_FUNC(char_chardb_waiting_disconnect);
 
 
-int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex);
-int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p);
-int char_mmo_char_tosql(uint32 char_id, struct mmo_charstatus* p);
-int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_everything);
-int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf, uint8* count = nullptr);
+int32 char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex);
+int32 char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p);
+int32 char_mmo_char_tosql(uint32 char_id, struct mmo_charstatus* p);
+int32 char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_everything);
+int32 char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf, uint8* count = nullptr);
 enum e_char_del_response char_delete(struct char_session_data* sd, uint32 char_id);
 enum e_char_del_response char_delete(struct char_session_data* sd, uint32 char_id);
-int char_rename_char_sql(struct char_session_data *sd, uint32 char_id);
-int char_divorce_char_sql(int partner_id1, int partner_id2);
-int char_memitemdata_to_sql(const struct item items[], int max, int id, enum storage_type tableswitch, uint8 stor_id);
-bool char_memitemdata_from_sql(struct s_storage* p, int max, int id, enum storage_type tableswitch, uint8 stor_id);
+int32 char_rename_char_sql(struct char_session_data *sd, uint32 char_id);
+int32 char_divorce_char_sql(int32 partner_id1, int32 partner_id2);
+int32 char_memitemdata_to_sql(const struct item items[], int32 max, int32 id, enum storage_type tableswitch, uint8 stor_id);
+bool char_memitemdata_from_sql(struct s_storage* p, int32 max, int32 id, enum storage_type tableswitch, uint8 stor_id);
 
 
-int char_married(int pl1,int pl2);
-int char_child(int parent_id, int child_id);
-int char_family(int pl1,int pl2,int pl3);
+int32 char_married(int32 pl1,int32 pl2);
+int32 char_child(int32 parent_id, int32 child_id);
+int32 char_family(int32 pl1,int32 pl2,int32 pl3);
 
 
 //extern bool char_gm_read;
 //extern bool char_gm_read;
-int char_loadName(uint32 char_id, char* name);
-int char_check_char_name(char * name, char * esc_name);
+int32 char_loadName(uint32 char_id, char* name);
+int32 char_check_char_name(char * name, char * esc_name);
 
 
 bool char_pincode_decrypt( uint32 userSeed, char* pin );
 bool char_pincode_decrypt( uint32 userSeed, char* pin );
-int char_pincode_compare( int fd, struct char_session_data* sd, char* pin );
-void char_auth_ok(int fd, struct char_session_data *sd);
+int32 char_pincode_compare( int32 fd, struct char_session_data* sd, char* pin );
+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);
 
 
-int char_make_new_char( struct char_session_data* sd, char* name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short start_job, int 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, short start_job, int32 sex );
 
 
-void char_set_session_flag_(int account_id, int 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)  )
 #define char_unset_session_flag(account_id, val) ( char_set_session_flag_((account_id), (val), false) )
 #define char_unset_session_flag(account_id, val) ( char_set_session_flag_((account_id), (val), false) )
 
 
@@ -338,8 +338,8 @@ void char_set_session_flag_(int account_id, int val, bool set);
 #define msg_config_read(cfgName) char_msg_config_read(cfgName)
 #define msg_config_read(cfgName) char_msg_config_read(cfgName)
 #define msg_txt(msg_number) char_msg_txt(msg_number)
 #define msg_txt(msg_number) char_msg_txt(msg_number)
 #define do_final_msg() char_do_final_msg()
 #define do_final_msg() char_do_final_msg()
-int char_msg_config_read(const char *cfgName);
-const char* char_msg_txt(int msg_number);
+int32 char_msg_config_read(const char *cfgName);
+const char* char_msg_txt(int32 msg_number);
 void char_do_final_msg(void);
 void char_do_final_msg(void);
 bool char_config_read(const char* cfgName, bool normal);
 bool char_config_read(const char* cfgName, bool normal);
 
 

+ 69 - 69
src/char/char_clif.cpp

@@ -48,7 +48,7 @@ bool pincode_allowed( char* pincode );
 // reason
 // reason
 // 0: success
 // 0: success
 // 1: failed
 // 1: failed
-void chclif_moveCharSlotReply( int fd, struct char_session_data* sd, unsigned short index, short reason ){
+void chclif_moveCharSlotReply( int32 fd, struct char_session_data* sd, unsigned short index, short 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;
@@ -60,7 +60,7 @@ void chclif_moveCharSlotReply( int fd, struct char_session_data* sd, unsigned sh
 /*
 /*
  * Client is requesting to move a charslot
  * Client is requesting to move a charslot
  */
  */
-int chclif_parse_moveCharSlot( int fd, struct char_session_data* sd){
+int32 chclif_parse_moveCharSlot( int32 fd, struct char_session_data* sd){
 	FIFOSD_CHECK(8);
 	FIFOSD_CHECK(8);
 
 
 	uint16 from, to;
 	uint16 from, to;
@@ -133,7 +133,7 @@ int chclif_parse_moveCharSlot( int fd, struct char_session_data* sd){
  *   7 = char select window shows a button - client sends 0x8c5
  *   7 = char select window shows a button - client sends 0x8c5
  *   8 = pincode was incorrect
  *   8 = pincode was incorrect
 */
 */
-void chclif_pincode_sendstate( int 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 ){
 	WFIFOHEAD(fd, 12);
 	WFIFOHEAD(fd, 12);
 	WFIFOW(fd, 0) = 0x8b9;
 	WFIFOW(fd, 0) = 0x8b9;
 	WFIFOL(fd, 2) = sd->pincode_seed = rnd() % 0xFFFF;
 	WFIFOL(fd, 2) = sd->pincode_seed = rnd() % 0xFFFF;
@@ -145,7 +145,7 @@ void chclif_pincode_sendstate( int fd, struct char_session_data* sd, enum pincod
 /*
 /*
  * Client just entering charserv from login, send him pincode confirmation
  * Client just entering charserv from login, send him pincode confirmation
  */
  */
-int chclif_parse_reqpincode_window(int fd, struct char_session_data* sd){
+int32 chclif_parse_reqpincode_window(int32 fd, struct char_session_data* sd){
 	FIFOSD_CHECK(6);
 	FIFOSD_CHECK(6);
 
 
 	if( charserv_config.pincode_config.pincode_enabled && RFIFOL(fd,2) == sd->account_id ){
 	if( charserv_config.pincode_config.pincode_enabled && RFIFOL(fd,2) == sd->account_id ){
@@ -162,7 +162,7 @@ int chclif_parse_reqpincode_window(int fd, struct char_session_data* sd){
 /*
 /*
  * Client as anwsered pincode questionning, checking if valid anwser
  * Client as anwsered pincode questionning, checking if valid anwser
  */
  */
-int chclif_parse_pincode_check( int fd, struct char_session_data* sd ){
+int32 chclif_parse_pincode_check( int32 fd, struct char_session_data* sd ){
 	FIFOSD_CHECK(10);
 	FIFOSD_CHECK(10);
 
 
 	char pin[PINCODE_LENGTH+1];
 	char pin[PINCODE_LENGTH+1];
@@ -192,7 +192,7 @@ int chclif_parse_pincode_check( int fd, struct char_session_data* sd ){
  * Helper function to check if a new pincode contains illegal characters or combinations
  * Helper function to check if a new pincode contains illegal characters or combinations
  */
  */
 bool pincode_allowed( char* pincode ){
 bool pincode_allowed( char* pincode ){
-	int i;
+	int32 i;
 	char c, n, compare[PINCODE_LENGTH+1];
 	char c, n, compare[PINCODE_LENGTH+1];
 
 
 	memset( compare, 0, PINCODE_LENGTH+1);
 	memset( compare, 0, PINCODE_LENGTH+1);
@@ -261,7 +261,7 @@ bool pincode_allowed( char* pincode ){
 /*
 /*
  * Client request to change pincode
  * Client request to change pincode
  */
  */
-int chclif_parse_pincode_change( int fd, struct char_session_data* sd ){
+int32 chclif_parse_pincode_change( int32 fd, struct char_session_data* sd ){
 	FIFOSD_CHECK(14);
 	FIFOSD_CHECK(14);
 
 
 	if( charserv_config.pincode_config.pincode_enabled==0 || RFIFOL(fd,2) != sd->account_id ) {
 	if( charserv_config.pincode_config.pincode_enabled==0 || RFIFOL(fd,2) != sd->account_id ) {
@@ -303,7 +303,7 @@ int chclif_parse_pincode_change( int fd, struct char_session_data* sd ){
 /*
 /*
  * activate PIN system and set first PIN
  * activate PIN system and set first PIN
  */
  */
-int chclif_parse_pincode_setnew( int fd, struct char_session_data* sd ){
+int32 chclif_parse_pincode_setnew( int32 fd, struct char_session_data* sd ){
 	FIFOSD_CHECK(10);
 	FIFOSD_CHECK(10);
 
 
 	if( charserv_config.pincode_config.pincode_enabled==0 || RFIFOL(fd,2) != sd->account_id ) {
 	if( charserv_config.pincode_config.pincode_enabled==0 || RFIFOL(fd,2) != sd->account_id ) {
@@ -340,20 +340,20 @@ int chclif_parse_pincode_setnew( int fd, struct char_session_data* sd ){
 //----------------------------------------
 //----------------------------------------
 // Tell client how many pages, kRO sends 17 (Yommy)
 // Tell client how many pages, kRO sends 17 (Yommy)
 //----------------------------------------
 //----------------------------------------
-void chclif_charlist_notify( int fd, struct char_session_data* sd ){
+void chclif_charlist_notify( int32 fd, struct char_session_data* sd ){
 // This is needed on RE clients from october 2015 onwards
 // This is needed on RE clients from october 2015 onwards
 #if defined(PACKETVER_RE) && PACKETVER >= 20151001 && PACKETVER < 20180103
 #if defined(PACKETVER_RE) && PACKETVER >= 20151001 && PACKETVER < 20180103
 	WFIFOHEAD(fd, 10);
 	WFIFOHEAD(fd, 10);
 	WFIFOW(fd, 0) = 0x9a0;
 	WFIFOW(fd, 0) = 0x9a0;
 	// pages to req / send them all in 1 until mmo_chars_fromsql can split them up
 	// pages to req / send them all in 1 until mmo_chars_fromsql can split them up
-	WFIFOL(fd, 2) = (sd->char_slots>3)?sd->char_slots/3:1; //int TotalCnt (nb page to load)
+	WFIFOL(fd, 2) = (sd->char_slots>3)?sd->char_slots/3:1; //int32 TotalCnt (nb page to load)
 	WFIFOL(fd, 6) = sd->char_slots;
 	WFIFOL(fd, 6) = sd->char_slots;
 	WFIFOSET(fd,10);
 	WFIFOSET(fd,10);
 #else
 #else
 	WFIFOHEAD(fd, 6);
 	WFIFOHEAD(fd, 6);
 	WFIFOW(fd, 0) = 0x9a0;
 	WFIFOW(fd, 0) = 0x9a0;
 	// pages to req / send them all in 1 until mmo_chars_fromsql can split them up
 	// pages to req / send them all in 1 until mmo_chars_fromsql can split them up
-	WFIFOL(fd, 2) = (sd->char_slots>3)?sd->char_slots/3:1; //int TotalCnt (nb page to load)
+	WFIFOL(fd, 2) = (sd->char_slots>3)?sd->char_slots/3:1; //int32 TotalCnt (nb page to load)
 	WFIFOSET(fd,6);
 	WFIFOSET(fd,6);
 #endif
 #endif
 }
 }
@@ -361,8 +361,8 @@ void chclif_charlist_notify( int fd, struct char_session_data* sd ){
 //----------------------------------------
 //----------------------------------------
 // Function to send characters to a player
 // Function to send characters to a player
 //----------------------------------------
 //----------------------------------------
-int chclif_mmo_send006b(int fd, struct char_session_data* sd){
-	int j, offset;
+int32 chclif_mmo_send006b(int32 fd, struct char_session_data* sd){
+	int32 j, offset;
 
 
 #if PACKETVER >= 20100413
 #if PACKETVER >= 20100413
 	offset = 3;
 	offset = 3;
@@ -392,7 +392,7 @@ int chclif_mmo_send006b(int fd, struct char_session_data* sd){
 //----------------------------------------
 //----------------------------------------
 // Notify client about charselect window data [Ind]
 // Notify client about charselect window data [Ind]
 //----------------------------------------
 //----------------------------------------
-void chclif_mmo_send082d(int fd, struct char_session_data* sd) {
+void chclif_mmo_send082d(int32 fd, struct char_session_data* sd) {
 	if (charserv_config.save_log)
 	if (charserv_config.save_log)
 		ShowInfo("Loading Char Data (" CL_BOLD "%d" CL_RESET ")\n",sd->account_id);
 		ShowInfo("Loading Char Data (" CL_BOLD "%d" CL_RESET ")\n",sd->account_id);
 	WFIFOHEAD(fd,29);
 	WFIFOHEAD(fd,29);
@@ -407,7 +407,7 @@ void chclif_mmo_send082d(int fd, struct char_session_data* sd) {
 	WFIFOSET(fd,29);
 	WFIFOSET(fd,29);
 }
 }
 
 
-void chclif_mmo_send099d(int fd, struct char_session_data *sd) {
+void chclif_mmo_send099d(int32 fd, struct char_session_data *sd) {
 	uint8 count = 0;
 	uint8 count = 0;
 
 
 	WFIFOHEAD(fd,4 + (MAX_CHARS*MAX_CHAR_BUF));
 	WFIFOHEAD(fd,4 + (MAX_CHARS*MAX_CHAR_BUF));
@@ -429,7 +429,7 @@ void chclif_mmo_send099d(int fd, struct char_session_data *sd) {
 /*
 /*
  * Function to choose wich kind of charlist to send to client depending on his version
  * Function to choose wich kind of charlist to send to client depending on his version
  */
  */
-void chclif_mmo_char_send(int fd, struct char_session_data* sd){
+void chclif_mmo_char_send(int32 fd, struct char_session_data* sd){
 #if PACKETVER >= 20130000
 #if PACKETVER >= 20130000
 	chclif_mmo_send082d(fd, sd);
 	chclif_mmo_send082d(fd, sd);
 	chclif_mmo_send006b(fd, sd);
 	chclif_mmo_send006b(fd, sd);
@@ -452,7 +452,7 @@ void chclif_mmo_char_send(int fd, struct char_session_data* sd){
  *  2 : Someone has already logged in with this id
  *  2 : Someone has already logged in with this id
  *  8 : already online
  *  8 : already online
  */
  */
-void chclif_send_auth_result(int fd,char result){
+void chclif_send_auth_result(int32 fd,char result){
 	WFIFOHEAD(fd,3);
 	WFIFOHEAD(fd,3);
 	WFIFOW(fd,0) = 0x81;
 	WFIFOW(fd,0) = 0x81;
 	WFIFOB(fd,2) = result;
 	WFIFOB(fd,2) = result;
@@ -467,7 +467,7 @@ void chclif_send_auth_result(int fd,char result){
 /// 5 (0x71b): To delete a character you must withdraw from the party.
 /// 5 (0x71b): To delete a character you must withdraw from the party.
 /// Any (0x718): An unknown error has occurred.
 /// Any (0x718): An unknown error has occurred.
 /// HC: <0828>.W <char id>.L <Msg:0-5>.L <deleteDate>.L
 /// HC: <0828>.W <char id>.L <Msg:0-5>.L <deleteDate>.L
-void chclif_char_delete2_ack(int fd, uint32 char_id, uint32 result, time_t delete_date) {
+void chclif_char_delete2_ack(int32 fd, uint32 char_id, uint32 result, time_t delete_date) {
 	WFIFOHEAD(fd,14);
 	WFIFOHEAD(fd,14);
 	WFIFOW(fd,0) = 0x828;
 	WFIFOW(fd,0) = 0x828;
 	WFIFOL(fd,2) = char_id;
 	WFIFOL(fd,2) = char_id;
@@ -491,7 +491,7 @@ void chclif_char_delete2_ack(int fd, uint32 char_id, uint32 result, time_t delet
 /// 7 Character Deletion has failed because you have entered an incorrect e-mail address.
 /// 7 Character Deletion has failed because you have entered an incorrect e-mail address.
 /// Any (0x718): An unknown error has occurred.
 /// Any (0x718): An unknown error has occurred.
 /// HC: <082a>.W <char id>.L <Msg>.L
 /// HC: <082a>.W <char id>.L <Msg>.L
-void chclif_char_delete2_accept_ack(int fd, uint32 char_id, uint32 result) {
+void chclif_char_delete2_accept_ack(int32 fd, uint32 char_id, uint32 result) {
 #if PACKETVER >= 20130000
 #if PACKETVER >= 20130000
 	if(result == 1 ){
 	if(result == 1 ){
 		chclif_mmo_char_send(fd, (char_session_data*)session[fd]->session_data);
 		chclif_mmo_char_send(fd, (char_session_data*)session[fd]->session_data);
@@ -510,7 +510,7 @@ void chclif_char_delete2_accept_ack(int fd, uint32 char_id, uint32 result) {
 /// 2 (0x719): A database error occurred.
 /// 2 (0x719): A database error occurred.
 /// Any (0x718): An unknown error has occurred.
 /// Any (0x718): An unknown error has occurred.
 /// HC: <082c>.W <char id>.L <Msg:1-2>.L
 /// HC: <082c>.W <char id>.L <Msg:1-2>.L
-void chclif_char_delete2_cancel_ack(int fd, uint32 char_id, uint32 result) {
+void chclif_char_delete2_cancel_ack(int32 fd, uint32 char_id, uint32 result) {
 	WFIFOHEAD(fd,10);
 	WFIFOHEAD(fd,10);
 	WFIFOW(fd,0) = 0x82c;
 	WFIFOW(fd,0) = 0x82c;
 	WFIFOL(fd,2) = char_id;
 	WFIFOL(fd,2) = char_id;
@@ -519,7 +519,7 @@ void chclif_char_delete2_cancel_ack(int fd, uint32 char_id, uint32 result) {
 }
 }
 
 
 // CH: <0827>.W <char id>.L
 // CH: <0827>.W <char id>.L
-int chclif_parse_char_delete2_req(int fd, struct char_session_data* sd) {
+int32 chclif_parse_char_delete2_req(int32 fd, struct char_session_data* sd) {
 	FIFOSD_CHECK(6)
 	FIFOSD_CHECK(6)
 	{
 	{
 		uint32 char_id, i, guild_id, party_id;
 		uint32 char_id, i, guild_id, party_id;
@@ -611,7 +611,7 @@ bool chclif_delchar_check(struct char_session_data *sd, char *delcode, uint8 fla
 }
 }
 
 
 // CH: <0829>.W <char id>.L <birth date:YYMMDD>.6B
 // CH: <0829>.W <char id>.L <birth date:YYMMDD>.6B
-int chclif_parse_char_delete2_accept(int fd, struct char_session_data* sd) {
+int32 chclif_parse_char_delete2_accept(int32 fd, struct char_session_data* sd) {
 	FIFOSD_CHECK(12)
 	FIFOSD_CHECK(12)
 	{
 	{
 		char birthdate[8+1];
 		char birthdate[8+1];
@@ -667,7 +667,7 @@ int chclif_parse_char_delete2_accept(int fd, struct char_session_data* sd) {
 }
 }
 
 
 // CH: <082b>.W <char id>.L
 // CH: <082b>.W <char id>.L
-int chclif_parse_char_delete2_cancel(int fd, struct char_session_data* sd) {
+int32 chclif_parse_char_delete2_cancel(int32 fd, struct char_session_data* sd) {
 	FIFOSD_CHECK(6);
 	FIFOSD_CHECK(6);
 
 
 	uint32 char_id, i;
 	uint32 char_id, i;
@@ -700,11 +700,11 @@ int chclif_parse_char_delete2_cancel(int fd, struct char_session_data* sd) {
  * Register a new mapserver into that char-serv
  * Register a new mapserver into that char-serv
  * charserv can handle a MAX_SERVERS mapservs
  * charserv can handle a MAX_SERVERS mapservs
  */
  */
-int chclif_parse_maplogin(int fd){
+int32 chclif_parse_maplogin(int32 fd){
 	if (RFIFOREST(fd) < 60)
 	if (RFIFOREST(fd) < 60)
 		return 0;
 		return 0;
 	else {
 	else {
-		int i;
+		int32 i;
 		char* l_user = RFIFOCP(fd,2);
 		char* l_user = RFIFOCP(fd,2);
 		char* l_pass = RFIFOCP(fd,26);
 		char* l_pass = RFIFOCP(fd,26);
 		l_user[23] = '\0';
 		l_user[23] = '\0';
@@ -735,14 +735,14 @@ int chclif_parse_maplogin(int fd){
 }
 }
 
 
 // 0065 <account id>.L <login id1>.L <login id2>.L <???>.W <sex>.B
 // 0065 <account id>.L <login id1>.L <login id2>.L <???>.W <sex>.B
-int chclif_parse_reqtoconnect(int fd, struct char_session_data* sd,uint32 ipl){
+int32 chclif_parse_reqtoconnect(int32 fd, struct char_session_data* sd,uint32 ipl){
 	if( RFIFOREST(fd) < 17 ) // request to connect
 	if( RFIFOREST(fd) < 17 ) // request to connect
 		return 0;
 		return 0;
 	else {
 	else {
 		uint32 account_id = RFIFOL(fd,2);
 		uint32 account_id = RFIFOL(fd,2);
 		uint32 login_id1 = RFIFOL(fd,6);
 		uint32 login_id1 = RFIFOL(fd,6);
 		uint32 login_id2 = RFIFOL(fd,10);
 		uint32 login_id2 = RFIFOL(fd,10);
-		int sex = RFIFOB(fd,16);
+		int32 sex = RFIFOB(fd,16);
 		RFIFOSKIP(fd,17);
 		RFIFOSKIP(fd,17);
 
 
 		ShowInfo("request connect - account_id:%d/login_id1:%d/login_id2:%d\n", account_id, login_id1, login_id2);
 		ShowInfo("request connect - account_id:%d/login_id1:%d/login_id2:%d\n", account_id, login_id1, login_id2);
@@ -808,7 +808,7 @@ int chclif_parse_reqtoconnect(int fd, struct char_session_data* sd,uint32 ipl){
 }
 }
 
 
 //struct PACKET_CH_CHARLIST_REQ { 0x0 short PacketType}
 //struct PACKET_CH_CHARLIST_REQ { 0x0 short PacketType}
-int chclif_parse_req_charlist(int 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);
 	chclif_mmo_send099d(fd,sd);
 	chclif_mmo_send099d(fd,sd);
@@ -816,13 +816,13 @@ int chclif_parse_req_charlist(int fd, struct char_session_data* sd){
 }
 }
 
 
 //Send player to map
 //Send player to map
-void chclif_send_map_data( int fd, std::shared_ptr<struct mmo_charstatus> cd, uint32 ipl, int map_server_index ){
+void chclif_send_map_data( int32 fd, std::shared_ptr<struct mmo_charstatus> cd, uint32 ipl, int32 map_server_index ){
 #if PACKETVER >= 20170315
 #if PACKETVER >= 20170315
-	int cmd = 0xAC5;
-	int size = 156;
+	int32 cmd = 0xAC5;
+	int32 size = 156;
 #else
 #else
-	int cmd = 0x71;
-	int size = 28;
+	int32 cmd = 0x71;
+	int32 size = 28;
 #endif
 #endif
 
 
 	WFIFOHEAD(fd,size);
 	WFIFOHEAD(fd,size);
@@ -843,7 +843,7 @@ void chclif_send_map_data( int fd, std::shared_ptr<struct mmo_charstatus> cd, ui
 	WFIFOSET(fd,size);
 	WFIFOSET(fd,size);
 }
 }
 
 
-int chclif_parse_select_accessible_map( int fd, struct char_session_data* sd, uint32 ipl ){
+int32 chclif_parse_select_accessible_map( int32 fd, struct char_session_data* sd, uint32 ipl ){
 #if PACKETVER >= 20100714
 #if PACKETVER >= 20100714
 	struct PACKET_CH_SELECT_ACCESSIBLE_MAPNAME p;
 	struct PACKET_CH_SELECT_ACCESSIBLE_MAPNAME p;
 
 
@@ -937,7 +937,7 @@ int chclif_parse_select_accessible_map( int fd, struct char_session_data* sd, ui
 		return 1;
 		return 1;
 	}
 	}
 
 
-	int map_fd;
+	int32 map_fd;
 
 
 	// Send NEW auth packet [Kevin]
 	// Send NEW auth packet [Kevin]
 	// FIXME: is this case even possible? [ultramage]
 	// FIXME: is this case even possible? [ultramage]
@@ -971,14 +971,14 @@ int chclif_parse_select_accessible_map( int fd, struct char_session_data* sd, ui
 #endif
 #endif
 }
 }
 
 
-void chclif_accessible_maps( int fd ){
+void chclif_accessible_maps( int32 fd ){
 #if PACKETVER >= 20100714
 #if PACKETVER >= 20100714
 	PACKET_HC_NOTIFY_ACCESSIBLE_MAPNAME* p = reinterpret_cast<PACKET_HC_NOTIFY_ACCESSIBLE_MAPNAME*>( packet_buffer );
 	PACKET_HC_NOTIFY_ACCESSIBLE_MAPNAME* p = reinterpret_cast<PACKET_HC_NOTIFY_ACCESSIBLE_MAPNAME*>( packet_buffer );
 
 
 	p->packetType = HEADER_HC_NOTIFY_ACCESSIBLE_MAPNAME;
 	p->packetType = HEADER_HC_NOTIFY_ACCESSIBLE_MAPNAME;
 	p->packetLength = sizeof( *p );
 	p->packetLength = sizeof( *p );
 
 
-	int count = 0;
+	int32 count = 0;
 	for( s_point_str& accessible_map : accessible_maps ){
 	for( s_point_str& accessible_map : accessible_maps ){
 		int32 mapserver = char_search_mapserver( accessible_map.map, -1, -1 );
 		int32 mapserver = char_search_mapserver( accessible_map.map, -1, -1 );
 
 
@@ -1002,15 +1002,15 @@ void chclif_accessible_maps( int fd ){
 #endif
 #endif
 }
 }
 
 
-int chclif_parse_charselect(int fd, struct char_session_data* sd,uint32 ipl){
+int32 chclif_parse_charselect(int32 fd, struct char_session_data* sd,uint32 ipl){
 	FIFOSD_CHECK(3)
 	FIFOSD_CHECK(3)
 	{
 	{
 		struct mmo_charstatus char_dat;
 		struct mmo_charstatus char_dat;
 		char* data;
 		char* data;
 		uint32 char_id;
 		uint32 char_id;
-		int i, map_fd, server_id;
+		int32 i, map_fd, server_id;
 
 
-		int slot = RFIFOB(fd,2);
+		int32 slot = RFIFOB(fd,2);
 		RFIFOSKIP(fd,3);
 		RFIFOSKIP(fd,3);
 
 
 		ARR_FIND( 0, ARRAYLENGTH(map_server), server_id, session_isValid(map_server[server_id].fd) && !map_server[server_id].maps.empty() );
 		ARR_FIND( 0, ARRAYLENGTH(map_server), server_id, session_isValid(map_server[server_id].fd) && !map_server[server_id].maps.empty() );
@@ -1141,24 +1141,24 @@ int chclif_parse_charselect(int fd, struct char_session_data* sd,uint32 ipl){
 // S 0970 <name>.24B <slot>.B <hair color>.W <hair style>.W
 // S 0970 <name>.24B <slot>.B <hair color>.W <hair style>.W
 // S 0067 <name>.24B <str>.B <agi>.B <vit>.B <int>.B <dex>.B <luk>.B <slot>.B <hair color>.W <hair style>.W
 // S 0067 <name>.24B <str>.B <agi>.B <vit>.B <int>.B <dex>.B <luk>.B <slot>.B <hair color>.W <hair style>.W
 // S 0a39 <name>.24B <slot>.B <hair color>.W <hair style>.W <starting job ID>.W <Unknown>.(W or 2 B's)??? <sex>.B
 // S 0a39 <name>.24B <slot>.B <hair color>.W <hair style>.W <starting job ID>.W <Unknown>.(W or 2 B's)??? <sex>.B
-int chclif_parse_createnewchar(int fd, struct char_session_data* sd,int cmd){
+int32 chclif_parse_createnewchar(int32 fd, struct char_session_data* sd,int32 cmd){
 	if (cmd == 0xa39) FIFOSD_CHECK(36) //>=20151001
 	if (cmd == 0xa39) FIFOSD_CHECK(36) //>=20151001
 	else if (cmd == 0x970) FIFOSD_CHECK(31) //>=20120307
 	else if (cmd == 0x970) FIFOSD_CHECK(31) //>=20120307
 	else if (cmd == 0x67) FIFOSD_CHECK(37)
 	else if (cmd == 0x67) FIFOSD_CHECK(37)
 	else return 0;
 	else return 0;
 
 
-	int char_id;
+	int32 char_id;
 
 
 	if( (charserv_config.char_new)==0 ) //turn character creation on/off [Kevin]
 	if( (charserv_config.char_new)==0 ) //turn character creation on/off [Kevin]
 		char_id = -2;
 		char_id = -2;
 	else {
 	else {
 		char name[NAME_LENGTH];
 		char name[NAME_LENGTH];
-		int str, agi, vit, int_, dex, luk;
-		int slot;
-		int hair_color;
-		int hair_style;
+		int32 str, agi, vit, int_, dex, luk;
+		int32 slot;
+		int32 hair_color;
+		int32 hair_style;
 		short start_job;
 		short start_job;
-		int sex;
+		int32 sex;
 
 
 #if PACKETVER >= 20151001
 #if PACKETVER >= 20151001
 		// Sent values
 		// Sent values
@@ -1237,7 +1237,7 @@ int chclif_parse_createnewchar(int fd, struct char_session_data* sd,int cmd){
 		}
 		}
 		WFIFOSET(fd,3);
 		WFIFOSET(fd,3);
 	} else {
 	} else {
-		int len;
+		int32 len;
 		// retrieve data
 		// retrieve data
 		struct mmo_charstatus char_dat;
 		struct mmo_charstatus char_dat;
 		char_mmo_char_fromsql(char_id, &char_dat, false); //Only the short data is needed.
 		char_mmo_char_fromsql(char_id, &char_dat, false); //Only the short data is needed.
@@ -1263,14 +1263,14 @@ int chclif_parse_createnewchar(int fd, struct char_session_data* sd,int cmd){
  *	01 = Invalid Slot
  *	01 = Invalid Slot
  *	02 = In a party or guild
  *	02 = In a party or guild
  */
  */
-void chclif_refuse_delchar(int fd, uint8 errCode){
+void chclif_refuse_delchar(int32 fd, uint8 errCode){
 	WFIFOHEAD(fd,3);
 	WFIFOHEAD(fd,3);
 	WFIFOW(fd,0) = 0x70;
 	WFIFOW(fd,0) = 0x70;
 	WFIFOB(fd,2) = errCode;
 	WFIFOB(fd,2) = errCode;
 	WFIFOSET(fd,3);
 	WFIFOSET(fd,3);
 }
 }
 
 
-int chclif_parse_delchar(int fd,struct char_session_data* sd, int cmd){
+int32 chclif_parse_delchar(int32 fd,struct char_session_data* sd, int32 cmd){
 	if (cmd == 0x68) FIFOSD_CHECK(46)
 	if (cmd == 0x68) FIFOSD_CHECK(46)
 	else if (cmd == 0x1fb) FIFOSD_CHECK(56)
 	else if (cmd == 0x1fb) FIFOSD_CHECK(56)
 	else return 0;
 	else return 0;
@@ -1314,10 +1314,10 @@ int chclif_parse_delchar(int fd,struct char_session_data* sd, int cmd){
 }
 }
 
 
 // R 0187 <account ID>.l
 // R 0187 <account ID>.l
-int chclif_parse_keepalive(int fd){
+int32 chclif_parse_keepalive(int32 fd){
 	if (RFIFOREST(fd) < 6)
 	if (RFIFOREST(fd) < 6)
 		return 0;
 		return 0;
-	//int aid = RFIFOL(fd,2);
+	//int32 aid = RFIFOL(fd,2);
 	RFIFOSKIP(fd,6);
 	RFIFOSKIP(fd,6);
 	return 1;
 	return 1;
 }
 }
@@ -1327,7 +1327,7 @@ int chclif_parse_keepalive(int fd){
 // result:
 // result:
 //		0 = name is not OK
 //		0 = name is not OK
 //		1 = name is OK
 //		1 = name is OK
-void chclif_reqrename_response( int fd, struct char_session_data* sd, bool name_valid ){
+void chclif_reqrename_response( int32 fd, struct char_session_data* sd, bool name_valid ){
 	WFIFOHEAD(fd, 4);
 	WFIFOHEAD(fd, 4);
 	WFIFOW(fd, 0) = 0x28e;
 	WFIFOW(fd, 0) = 0x28e;
 	WFIFOW(fd, 2) = name_valid;
 	WFIFOW(fd, 2) = name_valid;
@@ -1336,10 +1336,10 @@ void chclif_reqrename_response( int fd, struct char_session_data* sd, bool name_
 
 
 // Request for checking the new name on character renaming
 // Request for checking the new name on character renaming
 // 028d <account ID>.l <char ID>.l <new name>.24B (CH_REQ_IS_VALID_CHARNAME)
 // 028d <account ID>.l <char ID>.l <new name>.24B (CH_REQ_IS_VALID_CHARNAME)
-int chclif_parse_reqrename( int fd, struct char_session_data* sd ){
+int32 chclif_parse_reqrename( int32 fd, struct char_session_data* sd ){
 	FIFOSD_CHECK(34);
 	FIFOSD_CHECK(34);
 
 
-	int i, cid, aid;
+	int32 i, cid, aid;
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 	char esc_name[NAME_LENGTH*2+1];
 	char esc_name[NAME_LENGTH*2+1];
 
 
@@ -1372,7 +1372,7 @@ int chclif_parse_reqrename( int fd, struct char_session_data* sd ){
 
 
 TIMER_FUNC(charblock_timer){
 TIMER_FUNC(charblock_timer){
 	struct char_session_data* sd=nullptr;
 	struct char_session_data* sd=nullptr;
-	int i=0;
+	int32 i=0;
 	ARR_FIND( 0, fd_max, i, session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->account_id == id);
 	ARR_FIND( 0, fd_max, i, session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->account_id == id);
 
 
 	if(sd == nullptr || sd->charblock_timer==INVALID_TIMER) //has disconected or was required to stop
 	if(sd == nullptr || sd->charblock_timer==INVALID_TIMER) //has disconected or was required to stop
@@ -1389,8 +1389,8 @@ TIMER_FUNC(charblock_timer){
  * 0x20d <PacketLength>.W <TAG_CHARACTER_BLOCK_INFO>24B (HC_BLOCK_CHARACTER)
  * 0x20d <PacketLength>.W <TAG_CHARACTER_BLOCK_INFO>24B (HC_BLOCK_CHARACTER)
  * <GID>L <szExpireDate>20B (TAG_CHARACTER_BLOCK_INFO)
  * <GID>L <szExpireDate>20B (TAG_CHARACTER_BLOCK_INFO)
  */
  */
-void chclif_block_character( int fd, struct char_session_data* sd){
-	int i=0, j=0, len=4;
+void chclif_block_character( int32 fd, struct char_session_data* sd){
+	int32 i=0, j=0, len=4;
 	time_t now = time(nullptr);
 	time_t now = time(nullptr);
 
 
 	WFIFOHEAD(fd, 4+MAX_CHARS*24);
 	WFIFOHEAD(fd, 4+MAX_CHARS*24);
@@ -1442,7 +1442,7 @@ void chclif_block_character( int fd, struct char_session_data* sd){
 //		8: Name contains invalid characters. Character name change failed.
 //		8: Name contains invalid characters. Character name change failed.
 //		9: The name change is prohibited. Character name change failed.
 //		9: The name change is prohibited. Character name change failed.
 //		10: Character name change failed, due an unknown error.
 //		10: Character name change failed, due an unknown error.
-void chclif_rename_response(int fd, struct char_session_data* sd, int16 response) {
+void chclif_rename_response(int32 fd, struct char_session_data* sd, int16 response) {
 #if PACKETVER >= 20111101
 #if PACKETVER >= 20111101
 	WFIFOHEAD(fd, 6);
 	WFIFOHEAD(fd, 6);
 	WFIFOW(fd, 0) = 0x8fd;
 	WFIFOW(fd, 0) = 0x8fd;
@@ -1459,11 +1459,11 @@ void chclif_rename_response(int fd, struct char_session_data* sd, int16 response
 // Request to change a character name
 // Request to change a character name
 // 028f <char_id>.L (CH_REQ_CHANGE_CHARNAME)
 // 028f <char_id>.L (CH_REQ_CHANGE_CHARNAME)
 // 08fc <char_id>.L <new name>.24B (CH_REQ_CHANGE_CHARACTERNAME)
 // 08fc <char_id>.L <new name>.24B (CH_REQ_CHANGE_CHARACTERNAME)
-int chclif_parse_ackrename(int fd, struct char_session_data* sd){
+int32 chclif_parse_ackrename(int32 fd, struct char_session_data* sd){
 #if PACKETVER >= 20111101
 #if PACKETVER >= 20111101
 	FIFOSD_CHECK(30)
 	FIFOSD_CHECK(30)
 	{
 	{
-		int i, cid;
+		int32 i, cid;
 		char name[NAME_LENGTH], esc_name[NAME_LENGTH * 2 + 1];
 		char name[NAME_LENGTH], esc_name[NAME_LENGTH * 2 + 1];
 
 
 		cid = RFIFOL(fd, 2);
 		cid = RFIFOL(fd, 2);
@@ -1493,8 +1493,8 @@ int chclif_parse_ackrename(int fd, struct char_session_data* sd){
 #else
 #else
 	FIFOSD_CHECK(6)
 	FIFOSD_CHECK(6)
 	{
 	{
-		int i;
-		int cid = RFIFOL(fd,2);
+		int32 i;
+		int32 cid = RFIFOL(fd,2);
 		RFIFOSKIP(fd,6);
 		RFIFOSKIP(fd,6);
 
 
 		ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == cid );
 		ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == cid );
@@ -1508,7 +1508,7 @@ int chclif_parse_ackrename(int fd, struct char_session_data* sd){
 #endif
 #endif
 }
 }
 
 
-int chclif_ack_captcha(int fd){
+int32 chclif_ack_captcha(int32 fd){
 	WFIFOHEAD(fd,5);
 	WFIFOHEAD(fd,5);
 	WFIFOW(fd,0) = 0x7e9;
 	WFIFOW(fd,0) = 0x7e9;
 	WFIFOW(fd,2) = 5;
 	WFIFOW(fd,2) = 5;
@@ -1518,7 +1518,7 @@ int chclif_ack_captcha(int fd){
 }
 }
 
 
 // R 06C <ErrorCode>B HEADER_HC_REFUSE_ENTER
 // R 06C <ErrorCode>B HEADER_HC_REFUSE_ENTER
-void chclif_reject(int fd, uint8 errCode){
+void chclif_reject(int32 fd, uint8 errCode){
 	WFIFOHEAD(fd,3);
 	WFIFOHEAD(fd,3);
 	WFIFOW(fd,0) = 0x6c;
 	WFIFOW(fd,0) = 0x6c;
 	WFIFOB(fd,2) = errCode;// rejected from server
 	WFIFOB(fd,2) = errCode;// rejected from server
@@ -1526,7 +1526,7 @@ void chclif_reject(int fd, uint8 errCode){
 }
 }
 
 
 // R 07e5 <?>.w <aid>.l
 // R 07e5 <?>.w <aid>.l
-int chclif_parse_reqcaptcha(int fd){
+int32 chclif_parse_reqcaptcha(int32 fd){
 	//FIFOSD_CHECK(8)
 	//FIFOSD_CHECK(8)
 	RFIFOSKIP(fd,8);
 	RFIFOSKIP(fd,8);
 	chclif_ack_captcha(fd);
 	chclif_ack_captcha(fd);
@@ -1534,7 +1534,7 @@ int chclif_parse_reqcaptcha(int fd){
 }
 }
 
 
 // R 07e7 <len>.w <aid>.l <code>.b10 <?>.b14
 // R 07e7 <len>.w <aid>.l <code>.b10 <?>.b14
-int chclif_parse_chkcaptcha(int fd){
+int32 chclif_parse_chkcaptcha(int32 fd){
 	//FIFOSD_CHECK(32)
 	//FIFOSD_CHECK(32)
 	RFIFOSKIP(fd,32);
 	RFIFOSKIP(fd,32);
 	chclif_ack_captcha(fd);
 	chclif_ack_captcha(fd);
@@ -1546,7 +1546,7 @@ int chclif_parse_chkcaptcha(int fd){
  * function that check incoming command then split it to correct handler.
  * function that check incoming command then split it to correct handler.
  * @param fd: file descriptor to parse, (link to client)
  * @param fd: file descriptor to parse, (link to client)
  */
  */
-int chclif_parse(int fd) {
+int32 chclif_parse(int32 fd) {
 	struct char_session_data* sd = (struct char_session_data*)session[fd]->session_data;
 	struct char_session_data* sd = (struct char_session_data*)session[fd]->session_data;
 	uint32 ipl = session[fd]->client_addr;
 	uint32 ipl = session[fd]->client_addr;
 
 
@@ -1572,7 +1572,7 @@ int chclif_parse(int fd) {
 	}
 	}
 
 
 	while( RFIFOREST(fd) >= 2 ) {
 	while( RFIFOREST(fd) >= 2 ) {
-		int next = 1;
+		int32 next = 1;
 		unsigned short cmd;
 		unsigned short cmd;
 
 
 		cmd = RFIFOW(fd,0);
 		cmd = RFIFOW(fd,0);

+ 39 - 39
src/char/char_clif.hpp

@@ -10,47 +10,47 @@
 struct char_session_data;
 struct char_session_data;
 enum pincode_state : uint8;
 enum pincode_state : uint8;
 
 
-void chclif_moveCharSlotReply( int fd, struct char_session_data* sd, unsigned short index, short reason );
-int chclif_parse_moveCharSlot( int fd, struct char_session_data* sd);
+void chclif_moveCharSlotReply( int32 fd, struct char_session_data* sd, unsigned short index, short reason );
+int32 chclif_parse_moveCharSlot( int32 fd, struct char_session_data* sd);
 #if PACKETVER_SUPPORTS_PINCODE
 #if PACKETVER_SUPPORTS_PINCODE
-void chclif_pincode_sendstate( int fd, struct char_session_data* sd, enum pincode_state state );
-int chclif_parse_reqpincode_window(int fd, struct char_session_data* sd);
-int chclif_parse_pincode_check( int fd, struct char_session_data* sd );
-int chclif_parse_pincode_change( int fd, struct char_session_data* sd );
-int chclif_parse_pincode_setnew( int fd, struct char_session_data* sd );
+void chclif_pincode_sendstate( int32 fd, struct char_session_data* sd, enum pincode_state state );
+int32 chclif_parse_reqpincode_window(int32 fd, struct char_session_data* sd);
+int32 chclif_parse_pincode_check( int32 fd, struct char_session_data* sd );
+int32 chclif_parse_pincode_change( int32 fd, struct char_session_data* sd );
+int32 chclif_parse_pincode_setnew( int32 fd, struct char_session_data* sd );
 #endif
 #endif
 
 
-void chclif_reject(int fd, uint8 errCode);
-void chclif_refuse_delchar(int fd, uint8 errCode);
-void chclif_charlist_notify( int fd, struct char_session_data* sd );
-void chclif_block_character( int fd, struct char_session_data* sd );
-int chclif_mmo_send006b(int fd, struct char_session_data* sd);
-void chclif_mmo_send082d(int fd, struct char_session_data* sd);
-void chclif_mmo_send099d(int fd, struct char_session_data *sd);
-void chclif_mmo_char_send(int fd, struct char_session_data* sd);
-void chclif_send_auth_result(int fd,char result);
-void chclif_char_delete2_ack(int fd, uint32 char_id, uint32 result, time_t delete_date);
-void chclif_char_delete2_accept_ack(int fd, uint32 char_id, uint32 result);
-void chclif_char_delete2_cancel_ack(int fd, uint32 char_id, uint32 result);
-
-int chclif_parse_char_delete2_req(int fd, struct char_session_data* sd);
-int chclif_parse_char_delete2_accept(int fd, struct char_session_data* sd);
-int chclif_parse_char_delete2_cancel(int fd, struct char_session_data* sd);
-
-int chclif_parse_maplogin(int fd);
-int chclif_parse_reqtoconnect(int fd, struct char_session_data* sd,uint32 ipl);
-int chclif_parse_req_charlist(int fd, struct char_session_data* sd);
-int chclif_parse_charselect(int fd, struct char_session_data* sd,uint32 ipl);
-int chclif_parse_createnewchar(int fd, struct char_session_data* sd,int cmd);
-int chclif_parse_delchar(int fd,struct char_session_data* sd, int cmd);
-int chclif_parse_keepalive(int fd);
-int chclif_parse_reqrename(int fd, struct char_session_data* sd);
-int chclif_parse_ackrename(int fd, struct char_session_data* sd);
-int chclif_ack_captcha(int fd);
-int chclif_parse_reqcaptcha(int fd);
-int chclif_parse_chkcaptcha(int fd);
-void chclif_block_character( int fd, struct char_session_data* sd);
-
-int chclif_parse(int fd);
+void chclif_reject(int32 fd, uint8 errCode);
+void chclif_refuse_delchar(int32 fd, uint8 errCode);
+void chclif_charlist_notify( int32 fd, struct char_session_data* sd );
+void chclif_block_character( int32 fd, struct char_session_data* sd );
+int32 chclif_mmo_send006b(int32 fd, struct char_session_data* sd);
+void chclif_mmo_send082d(int32 fd, struct char_session_data* sd);
+void chclif_mmo_send099d(int32 fd, struct char_session_data *sd);
+void chclif_mmo_char_send(int32 fd, struct char_session_data* sd);
+void chclif_send_auth_result(int32 fd,char result);
+void chclif_char_delete2_ack(int32 fd, uint32 char_id, uint32 result, time_t delete_date);
+void chclif_char_delete2_accept_ack(int32 fd, uint32 char_id, uint32 result);
+void chclif_char_delete2_cancel_ack(int32 fd, uint32 char_id, uint32 result);
+
+int32 chclif_parse_char_delete2_req(int32 fd, struct char_session_data* sd);
+int32 chclif_parse_char_delete2_accept(int32 fd, struct char_session_data* sd);
+int32 chclif_parse_char_delete2_cancel(int32 fd, struct char_session_data* sd);
+
+int32 chclif_parse_maplogin(int32 fd);
+int32 chclif_parse_reqtoconnect(int32 fd, struct char_session_data* sd,uint32 ipl);
+int32 chclif_parse_req_charlist(int32 fd, struct char_session_data* sd);
+int32 chclif_parse_charselect(int32 fd, struct char_session_data* sd,uint32 ipl);
+int32 chclif_parse_createnewchar(int32 fd, struct char_session_data* sd,int32 cmd);
+int32 chclif_parse_delchar(int32 fd,struct char_session_data* sd, int32 cmd);
+int32 chclif_parse_keepalive(int32 fd);
+int32 chclif_parse_reqrename(int32 fd, struct char_session_data* sd);
+int32 chclif_parse_ackrename(int32 fd, struct char_session_data* sd);
+int32 chclif_ack_captcha(int32 fd);
+int32 chclif_parse_reqcaptcha(int32 fd);
+int32 chclif_parse_chkcaptcha(int32 fd);
+void chclif_block_character( int32 fd, struct char_session_data* sd);
+
+int32 chclif_parse(int32 fd);
 
 
 #endif /* CHAR_CLIF_HPP */
 #endif /* CHAR_CLIF_HPP */

+ 2 - 2
src/char/char_cnslif.cpp

@@ -56,11 +56,11 @@ TIMER_FUNC(cnslif_console_timer){
 }
 }
 
 
 // Console Command Parser [Wizputer]
 // Console Command Parser [Wizputer]
-int cnslif_parse(const char* buf)
+int32 cnslif_parse(const char* buf)
 {
 {
 	char type[64];
 	char type[64];
 	char command[64];
 	char command[64];
-	int n=0;
+	int32 n=0;
 
 
 	if( ( n = sscanf(buf, "%63[^:]:%63[^\n]", type, command) ) < 2 ){
 	if( ( n = sscanf(buf, "%63[^:]:%63[^\n]", type, command) ) < 2 ){
 		if((n = sscanf(buf, "%63[^\n]", type))<1) return -1; //nothing to do no arg
 		if((n = sscanf(buf, "%63[^\n]", type))<1) return -1; //nothing to do no arg

+ 3 - 1
src/char/char_cnslif.hpp

@@ -4,7 +4,9 @@
 #ifndef CHAR_CNSLIF_HPP
 #ifndef CHAR_CNSLIF_HPP
 #define CHAR_CNSLIF_HPP
 #define CHAR_CNSLIF_HPP
 
 
-int cnslif_parse(const char* buf);
+#include <common/cbasetypes.hpp>
+
+int32 cnslif_parse(const char* buf);
 void do_init_chcnslif(void);
 void do_init_chcnslif(void);
 
 
 
 

+ 39 - 39
src/char/char_logif.cpp

@@ -39,7 +39,7 @@ void chlogif_pincode_notifyLoginPinError( uint32 account_id ){
 
 
 void chlogif_pincode_notifyLoginPinUpdate( uint32 account_id, char* pin ){
 void chlogif_pincode_notifyLoginPinUpdate( uint32 account_id, char* pin ){
 	if ( chlogif_isconnected() ){
 	if ( chlogif_isconnected() ){
-		int size = 8 + PINCODE_LENGTH+1;
+		int32 size = 8 + PINCODE_LENGTH+1;
 		WFIFOHEAD(login_fd,size);
 		WFIFOHEAD(login_fd,size);
 		WFIFOW(login_fd,0) = 0x2738;
 		WFIFOW(login_fd,0) = 0x2738;
 		WFIFOW(login_fd,2) = size;
 		WFIFOW(login_fd,2) = size;
@@ -49,7 +49,7 @@ void chlogif_pincode_notifyLoginPinUpdate( uint32 account_id, char* pin ){
 	}
 	}
 }
 }
 
 
-void chlogif_pincode_start(int fd, struct char_session_data* sd){
+void chlogif_pincode_start(int32 fd, struct char_session_data* sd){
 	if( charserv_config.pincode_config.pincode_enabled ){
 	if( charserv_config.pincode_config.pincode_enabled ){
 		//ShowInfo("Asking to start pincode to AID: %d\n", sd->account_id);
 		//ShowInfo("Asking to start pincode to AID: %d\n", sd->account_id);
 		// PIN code system enabled
 		// PIN code system enabled
@@ -97,7 +97,7 @@ TIMER_FUNC(chlogif_send_acc_tologin){
 	if ( chlogif_isconnected() ){
 	if ( chlogif_isconnected() ){
 		// send account list to login server
 		// send account list to login server
 		size_t users = char_get_onlinedb().size();
 		size_t users = char_get_onlinedb().size();
-		int i = 0;
+		int32 i = 0;
 
 
 		WFIFOHEAD(login_fd,8+users*4);
 		WFIFOHEAD(login_fd,8+users*4);
 		WFIFOW(login_fd,0) = 0x272d;
 		WFIFOW(login_fd,0) = 0x272d;
@@ -117,7 +117,7 @@ TIMER_FUNC(chlogif_send_acc_tologin){
 	return 0;
 	return 0;
 }
 }
 
 
-void chlogif_send_usercount(int users){
+void chlogif_send_usercount(int32 users){
 	if (!chlogif_isconnected())
 	if (!chlogif_isconnected())
 		return;
 		return;
 	// send number of user to login server
 	// send number of user to login server
@@ -130,10 +130,10 @@ void chlogif_send_usercount(int users){
 
 
 TIMER_FUNC(chlogif_broadcast_user_count){
 TIMER_FUNC(chlogif_broadcast_user_count){
 	uint8 buf[6];
 	uint8 buf[6];
-	int users = char_count_users();
+	int32 users = char_count_users();
 
 
 	// only send an update when needed
 	// only send an update when needed
-	static int prev_users = 0;
+	static int32 prev_users = 0;
 	if( prev_users == users )
 	if( prev_users == users )
 		return 0;
 		return 0;
 	prev_users = users;
 	prev_users = users;
@@ -217,7 +217,7 @@ void chlogif_send_global_accreg(const char *key, uint32 index, int64 int_value,
 	WFIFOW(login_fd, 2) = nlen;
 	WFIFOW(login_fd, 2) = nlen;
 
 
 	if( WFIFOW(login_fd, 2) > 60000 ) {
 	if( WFIFOW(login_fd, 2) > 60000 ) {
-		int account_id = WFIFOL(login_fd,4), char_id = WFIFOL(login_fd,8);
+		int32 account_id = WFIFOL(login_fd,4), char_id = WFIFOL(login_fd,8);
 
 
 		chlogif_prepsend_global_accreg();
 		chlogif_prepsend_global_accreg();
 		chlogif_upd_global_accreg(account_id, char_id); // prepare next
 		chlogif_upd_global_accreg(account_id, char_id); // prepare next
@@ -234,7 +234,7 @@ void chlogif_request_accreg2(uint32 account_id, uint32 char_id){
 	WFIFOSET(login_fd,10);
 	WFIFOSET(login_fd,10);
 }
 }
 
 
-void chlogif_send_reqaccdata(int fd, struct char_session_data *sd){
+void chlogif_send_reqaccdata(int32 fd, struct char_session_data *sd){
 	if (!chlogif_isconnected())
 	if (!chlogif_isconnected())
 		return;
 		return;
 	WFIFOHEAD(fd,6);
 	WFIFOHEAD(fd,6);
@@ -243,7 +243,7 @@ void chlogif_send_reqaccdata(int fd, struct char_session_data *sd){
 	WFIFOSET(fd,6);
 	WFIFOSET(fd,6);
 }
 }
 
 
-void chlogif_send_setacconline(int aid){
+void chlogif_send_setacconline(int32 aid){
 	if (!chlogif_isconnected())
 	if (!chlogif_isconnected())
 		return;
 		return;
 	WFIFOHEAD(login_fd,6);
 	WFIFOHEAD(login_fd,6);
@@ -252,7 +252,7 @@ void chlogif_send_setacconline(int aid){
 	WFIFOSET(login_fd,6);
 	WFIFOSET(login_fd,6);
 }
 }
 
 
-void chlogif_send_setallaccoffline(int fd){
+void chlogif_send_setallaccoffline(int32 fd){
 	if (!chlogif_isconnected())
 	if (!chlogif_isconnected())
 		return;
 		return;
 	WFIFOHEAD(fd,2);
 	WFIFOHEAD(fd,2);
@@ -260,7 +260,7 @@ void chlogif_send_setallaccoffline(int fd){
 	WFIFOSET(fd,2);
 	WFIFOSET(fd,2);
 }
 }
 
 
-void chlogif_send_setaccoffline(int fd, int aid){
+void chlogif_send_setaccoffline(int32 fd, int32 aid){
 	if (!chlogif_isconnected())
 	if (!chlogif_isconnected())
 		return;
 		return;
 	WFIFOHEAD(fd,6);
 	WFIFOHEAD(fd,6);
@@ -269,7 +269,7 @@ void chlogif_send_setaccoffline(int fd, int aid){
 	WFIFOSET(fd,6);
 	WFIFOSET(fd,6);
 }
 }
 
 
-int chlogif_parse_ackconnect(int fd){
+int32 chlogif_parse_ackconnect(int32 fd){
 	if (RFIFOREST(fd) < 3)
 	if (RFIFOREST(fd) < 3)
 		return 0;
 		return 0;
 
 
@@ -289,7 +289,7 @@ int chlogif_parse_ackconnect(int fd){
 	return 1;
 	return 1;
 }
 }
 
 
-int chlogif_parse_ackaccreq(int fd){
+int32 chlogif_parse_ackaccreq(int32 fd){
 	if (RFIFOREST(fd) < 21)
 	if (RFIFOREST(fd) < 21)
 		return 0;
 		return 0;
 	{
 	{
@@ -299,14 +299,14 @@ int chlogif_parse_ackaccreq(int fd){
 		uint32 login_id2 = RFIFOL(fd,10);
 		uint32 login_id2 = RFIFOL(fd,10);
 		uint8 sex = RFIFOB(fd,14);
 		uint8 sex = RFIFOB(fd,14);
 		uint8 result = RFIFOB(fd,15);
 		uint8 result = RFIFOB(fd,15);
-		int request_id = RFIFOL(fd,16);
+		int32 request_id = RFIFOL(fd,16);
 		uint8 clienttype = RFIFOB(fd,20);
 		uint8 clienttype = RFIFOB(fd,20);
 		RFIFOSKIP(fd,21);
 		RFIFOSKIP(fd,21);
 
 
 		if( session_isActive(request_id) && (sd=(struct char_session_data*)session[request_id]->session_data) &&
 		if( session_isActive(request_id) && (sd=(struct char_session_data*)session[request_id]->session_data) &&
 			!sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex )
 			!sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex )
 		{
 		{
-			int client_fd = request_id;
+			int32 client_fd = request_id;
 			sd->clienttype = clienttype;
 			sd->clienttype = clienttype;
 
 
 			switch( result )
 			switch( result )
@@ -327,10 +327,10 @@ int chlogif_parse_ackaccreq(int fd){
  * Receive account data from login-server
  * Receive account data from login-server
  * AH 0x2717 <aid>.L <email>.40B <expiration_time>.L <group_id>.B <birthdate>.11B <pincode>.5B <pincode_change>.L <isvip>.B <char_vip>.B <char_billing>.B
  * AH 0x2717 <aid>.L <email>.40B <expiration_time>.L <group_id>.B <birthdate>.11B <pincode>.5B <pincode_change>.L <isvip>.B <char_vip>.B <char_billing>.B
  **/
  **/
-int chlogif_parse_reqaccdata(int fd){
+int32 chlogif_parse_reqaccdata(int32 fd){
 	if (RFIFOREST(fd) < 75)
 	if (RFIFOREST(fd) < 75)
 		return 0;
 		return 0;
-	int u_fd; //user fd
+	int32 u_fd; //user fd
 	struct char_session_data* sd;
 	struct char_session_data* sd;
 
 
 	// find the authenticated session with this account id
 	// find the authenticated session with this account id
@@ -370,7 +370,7 @@ int chlogif_parse_reqaccdata(int fd){
 	return 1;
 	return 1;
 }
 }
 
 
-int chlogif_parse_keepalive(int fd){
+int32 chlogif_parse_keepalive(int32 fd){
 	if (RFIFOREST(fd) < 2)
 	if (RFIFOREST(fd) < 2)
 		return 0;
 		return 0;
 	RFIFOSKIP(fd,2);
 	RFIFOSKIP(fd,2);
@@ -389,7 +389,7 @@ int chlogif_parse_keepalive(int fd){
  * @param class_   The character's current job class.
  * @param class_   The character's current job class.
  * @param guild_id The character's guild ID.
  * @param guild_id The character's guild ID.
  */
  */
-void chlogif_parse_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id)
+void chlogif_parse_change_sex_sub(int32 sex, int32 acc, int32 char_id, int32 class_, int32 guild_id)
 {
 {
 	// job modification
 	// job modification
 	switch (class_)
 	switch (class_)
@@ -465,19 +465,19 @@ void chlogif_parse_change_sex_sub(int sex, int acc, int char_id, int class_, int
 		inter_guild_sex_changed(guild_id, acc, char_id, sex);
 		inter_guild_sex_changed(guild_id, acc, char_id, sex);
 }
 }
 
 
-int chlogif_parse_ackchangesex(int fd)
+int32 chlogif_parse_ackchangesex(int32 fd)
 {
 {
 	if (RFIFOREST(fd) < 7)
 	if (RFIFOREST(fd) < 7)
 		return 0;
 		return 0;
 	else {
 	else {
 		unsigned char buf[7];
 		unsigned char buf[7];
 		uint32 acc = RFIFOL(fd,2);
 		uint32 acc = RFIFOL(fd,2);
-		int sex = RFIFOB(fd,6);
+		int32 sex = RFIFOB(fd,6);
 		RFIFOSKIP(fd,7);
 		RFIFOSKIP(fd,7);
 
 
 		if (acc > 0) { // TODO: Is this even possible?
 		if (acc > 0) { // TODO: Is this even possible?
 			unsigned char i;
 			unsigned char i;
-			int char_id = 0, class_ = 0, guild_id = 0;
+			int32 char_id = 0, class_ = 0, guild_id = 0;
 			std::shared_ptr<struct auth_node> node = util::umap_find( char_get_authdb(), acc );
 			std::shared_ptr<struct auth_node> node = util::umap_find( char_get_authdb(), acc );
 			SqlStmt *stmt;
 			SqlStmt *stmt;
 
 
@@ -520,9 +520,9 @@ int chlogif_parse_ackchangesex(int fd)
  * @retval 0 in case of success.
  * @retval 0 in case of success.
  * @retval 1 in case of failure.
  * @retval 1 in case of failure.
  */
  */
-int chlogif_parse_ackchangecharsex(int char_id, int sex)
+int32 chlogif_parse_ackchangecharsex(int32 char_id, int32 sex)
 {
 {
-	int class_ = 0, guild_id = 0, account_id = 0;
+	int32 class_ = 0, guild_id = 0, account_id = 0;
 	unsigned char buf[7];
 	unsigned char buf[7];
 	char *data;
 	char *data;
 
 
@@ -554,7 +554,7 @@ int chlogif_parse_ackchangecharsex(int char_id, int sex)
 	return 0;
 	return 0;
 }
 }
 
 
-int chlogif_parse_ack_global_accreg(int fd){
+int32 chlogif_parse_ack_global_accreg(int32 fd){
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 		return 0;
 		return 0;
 	else { //Receive account_reg2 registry, forward to map servers.
 	else { //Receive account_reg2 registry, forward to map servers.
@@ -565,7 +565,7 @@ int chlogif_parse_ack_global_accreg(int fd){
 	return 1;
 	return 1;
 }
 }
 
 
-int chlogif_parse_accbannotification(int fd){
+int32 chlogif_parse_accbannotification(int32 fd){
 	if (RFIFOREST(fd) < 11)
 	if (RFIFOREST(fd) < 11)
 		return 0;
 		return 0;
 	else { // send to all map-servers to disconnect the player
 	else { // send to all map-servers to disconnect the player
@@ -582,7 +582,7 @@ int chlogif_parse_accbannotification(int fd){
 	return 1;
 	return 1;
 }
 }
 
 
-int chlogif_parse_askkick(int fd){
+int32 chlogif_parse_askkick(int32 fd){
 	if (RFIFOREST(fd) < 6)
 	if (RFIFOREST(fd) < 6)
 		return 0;
 		return 0;
 	else {
 	else {
@@ -602,7 +602,7 @@ int chlogif_parse_askkick(int fd){
 			else
 			else
 			{// Manual kick from char server.
 			{// Manual kick from char server.
 				struct char_session_data *tsd;
 				struct char_session_data *tsd;
-				int i;
+				int32 i;
 				ARR_FIND( 0, fd_max, i, session[i] && (tsd = (struct char_session_data*)session[i]->session_data) && tsd->account_id == aid );
 				ARR_FIND( 0, fd_max, i, session[i] && (tsd = (struct char_session_data*)session[i]->session_data) && tsd->account_id == aid );
 				if( i < fd_max )
 				if( i < fd_max )
 				{
 				{
@@ -620,7 +620,7 @@ int chlogif_parse_askkick(int fd){
 	return 1;
 	return 1;
 }
 }
 
 
-int chlogif_parse_updip(int fd){
+int32 chlogif_parse_updip(int32 fd){
 	unsigned char buf[2];
 	unsigned char buf[2];
 	uint32 new_ip = 0;
 	uint32 new_ip = 0;
 
 
@@ -654,7 +654,7 @@ int chlogif_parse_updip(int fd){
  * AH 0x2743
  * AH 0x2743
  * We received the info from login-serv, transmit it to map
  * We received the info from login-serv, transmit it to map
  */
  */
-int chlogif_parse_vipack(int fd) {
+int32 chlogif_parse_vipack(int32 fd) {
 #ifdef VIP_ENABLE
 #ifdef VIP_ENABLE
 	if (RFIFOREST(fd) < 19)
 	if (RFIFOREST(fd) < 19)
 		return 0;
 		return 0;
@@ -663,7 +663,7 @@ int chlogif_parse_vipack(int fd) {
 		uint32 vip_time = RFIFOL(fd,6); //vip_time
 		uint32 vip_time = RFIFOL(fd,6); //vip_time
 		uint8 flag = RFIFOB(fd,10);
 		uint8 flag = RFIFOB(fd,10);
 		uint32 groupid = RFIFOL(fd,11); //new group id
 		uint32 groupid = RFIFOL(fd,11); //new group id
-		int mapfd = RFIFOL(fd,15); //link to mapserv for ack
+		int32 mapfd = RFIFOL(fd,15); //link to mapserv for ack
 		RFIFOSKIP(fd,19);
 		RFIFOSKIP(fd,19);
 		chmapif_vipack(mapfd,aid,vip_time,groupid,flag);
 		chmapif_vipack(mapfd,aid,vip_time,groupid,flag);
 	}
 	}
@@ -680,7 +680,7 @@ int chlogif_parse_vipack(int fd) {
  * @param mapfd: link to mapserv for ack
  * @param mapfd: link to mapserv for ack
  * @return 0 if success
  * @return 0 if success
  */
  */
-int chlogif_reqvipdata(uint32 aid, uint8 flag, int32 timediff, int mapfd) {
+int32 chlogif_reqvipdata(uint32 aid, uint8 flag, int32 timediff, int32 mapfd) {
 	loginif_check(-1);
 	loginif_check(-1);
 #ifdef VIP_ENABLE
 #ifdef VIP_ENABLE
 	WFIFOHEAD(login_fd,15);
 	WFIFOHEAD(login_fd,15);
@@ -698,7 +698,7 @@ int chlogif_reqvipdata(uint32 aid, uint8 flag, int32 timediff, int mapfd) {
 * HA 0x2720
 * HA 0x2720
 * Request account info to login-server
 * Request account info to login-server
 */
 */
-int chlogif_req_accinfo(int fd, int u_fd, int u_aid, int account_id, int8 type) {
+int32 chlogif_req_accinfo(int32 fd, int32 u_fd, int32 u_aid, int32 account_id, int8 type) {
 	loginif_check(-1);
 	loginif_check(-1);
 	//ShowInfo("%d request account info for %d (type %d)\n", u_aid, account_id, type);
 	//ShowInfo("%d request account info for %d (type %d)\n", u_aid, account_id, type);
 	WFIFOHEAD(login_fd,19);
 	WFIFOHEAD(login_fd,19);
@@ -716,7 +716,7 @@ int chlogif_req_accinfo(int fd, int u_fd, int u_aid, int account_id, int8 type)
  * AH 0x2721
  * AH 0x2721
  * Retrieve account info from login-server, ask inter-server to tell player
  * Retrieve account info from login-server, ask inter-server to tell player
  */
  */
-int chlogif_parse_AccInfoAck(int fd) {
+int32 chlogif_parse_AccInfoAck(int32 fd) {
 	if (RFIFOREST(fd) < 19)
 	if (RFIFOREST(fd) < 19)
 		return 0;
 		return 0;
 	else {
 	else {
@@ -736,7 +736,7 @@ int chlogif_parse_AccInfoAck(int fd) {
 }
 }
 
 
 
 
-int chlogif_parse(int fd) {
+int32 chlogif_parse(int32 fd) {
 
 
 	// only process data from the login-server
 	// only process data from the login-server
 	if( fd != login_fd ) {
 	if( fd != login_fd ) {
@@ -767,7 +767,7 @@ int chlogif_parse(int fd) {
 		// -1: Login server is not connected
 		// -1: Login server is not connected
 		//  0: Avoid processing followup packets (prev was probably incomplete) packet
 		//  0: Avoid processing followup packets (prev was probably incomplete) packet
 		//  1: Continue parsing
 		//  1: Continue parsing
-		int next = 1;
+		int32 next = 1;
 		uint16 command = RFIFOW(fd,0);
 		uint16 command = RFIFOW(fd,0);
 		switch( command ) {
 		switch( command ) {
 			case 0x2711: next = chlogif_parse_ackconnect(fd); break;
 			case 0x2711: next = chlogif_parse_ackconnect(fd); break;
@@ -827,7 +827,7 @@ TIMER_FUNC(chlogif_check_connect_logserver){
 
 
 
 
 
 
-int chlogif_isconnected(){
+int32 chlogif_isconnected(){
 	return session_isActive(login_fd);
 	return session_isActive(login_fd);
 }
 }
 
 
@@ -843,7 +843,7 @@ void do_init_chlogif(void) {
 
 
 /// Resets all the data.
 /// Resets all the data.
 void chlogif_reset(void){
 void chlogif_reset(void){
-	int id;
+	int32 id;
 	// TODO kick everyone out and reset everything or wait for connect and try to reaquire locks [FlavioJS]
 	// TODO kick everyone out and reset everything or wait for connect and try to reaquire locks [FlavioJS]
 	for( id = 0; id < ARRAYLENGTH(map_server); ++id )
 	for( id = 0; id < ARRAYLENGTH(map_server); ++id )
 		chmapif_server_reset(id);
 		chmapif_server_reset(id);
@@ -859,7 +859,7 @@ void chlogif_on_disconnect(void){
 /// Called when all the connection steps are completed.
 /// Called when all the connection steps are completed.
 void chlogif_on_ready(void)
 void chlogif_on_ready(void)
 {
 {
-	int i;
+	int32 i;
 
 
 	//Send online accounts to login server.
 	//Send online accounts to login server.
 	chlogif_send_acc_tologin(INVALID_TIMER, gettick(), 0, 0);
 	chlogif_send_acc_tologin(INVALID_TIMER, gettick(), 0, 0);

+ 26 - 26
src/char/char_logif.hpp

@@ -12,39 +12,39 @@ struct char_session_data;
 #if PACKETVER_SUPPORTS_PINCODE
 #if PACKETVER_SUPPORTS_PINCODE
 void chlogif_pincode_notifyLoginPinError( uint32 account_id );
 void chlogif_pincode_notifyLoginPinError( uint32 account_id );
 void chlogif_pincode_notifyLoginPinUpdate( uint32 account_id, char* pin );
 void chlogif_pincode_notifyLoginPinUpdate( uint32 account_id, char* pin );
-void chlogif_pincode_start(int fd, struct char_session_data* sd);
+void chlogif_pincode_start(int32 fd, struct char_session_data* sd);
 #endif
 #endif
 TIMER_FUNC(chlogif_send_acc_tologin);
 TIMER_FUNC(chlogif_send_acc_tologin);
 TIMER_FUNC(chlogif_broadcast_user_count);
 TIMER_FUNC(chlogif_broadcast_user_count);
-void chlogif_send_usercount(int users);
+void chlogif_send_usercount(int32 users);
 void chlogif_upd_global_accreg(uint32 account_id, uint32 char_id);
 void chlogif_upd_global_accreg(uint32 account_id, uint32 char_id);
 void chlogif_prepsend_global_accreg(void);
 void chlogif_prepsend_global_accreg(void);
 void chlogif_send_global_accreg(const char *key, uint32 index, int64 int_value, const char* string_value, bool is_string);
 void chlogif_send_global_accreg(const char *key, uint32 index, int64 int_value, const char* string_value, bool is_string);
 void chlogif_request_accreg2(uint32 account_id, uint32 char_id);
 void chlogif_request_accreg2(uint32 account_id, uint32 char_id);
-void chlogif_send_reqaccdata(int fd, struct char_session_data *sd);
-void chlogif_send_setacconline(int aid);
-void chlogif_send_setallaccoffline(int fd);
-void chlogif_send_setaccoffline(int fd, int aid);
-
-int chlogif_parse_ackconnect(int fd);
-int chlogif_parse_ackaccreq(int fd);
-int chlogif_parse_reqaccdata(int fd);
-int chlogif_parse_keepalive(int fd);
-void chlogif_parse_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id);
-int chlogif_parse_ackchangesex(int fd);
-int chlogif_parse_ackchangecharsex(int char_id, int sex);
-int chlogif_parse_ack_global_accreg(int fd);
-int chlogif_parse_accbannotification(int fd);
-int chlogif_parse_askkick(int fd);
-int chlogif_parse_updip(int fd);
-
-int chlogif_parse_vipack(int fd);
-int chlogif_reqvipdata(uint32 aid, uint8 flag, int32 timediff, int mapfd);
-int chlogif_req_accinfo(int fd, int u_fd, int u_aid, int account_id, int8 type);
-
-int chlogif_parse(int fd);
-
-int chlogif_isconnected();
+void chlogif_send_reqaccdata(int32 fd, struct char_session_data *sd);
+void chlogif_send_setacconline(int32 aid);
+void chlogif_send_setallaccoffline(int32 fd);
+void chlogif_send_setaccoffline(int32 fd, int32 aid);
+
+int32 chlogif_parse_ackconnect(int32 fd);
+int32 chlogif_parse_ackaccreq(int32 fd);
+int32 chlogif_parse_reqaccdata(int32 fd);
+int32 chlogif_parse_keepalive(int32 fd);
+void chlogif_parse_change_sex_sub(int32 sex, int32 acc, int32 char_id, int32 class_, int32 guild_id);
+int32 chlogif_parse_ackchangesex(int32 fd);
+int32 chlogif_parse_ackchangecharsex(int32 char_id, int32 sex);
+int32 chlogif_parse_ack_global_accreg(int32 fd);
+int32 chlogif_parse_accbannotification(int32 fd);
+int32 chlogif_parse_askkick(int32 fd);
+int32 chlogif_parse_updip(int32 fd);
+
+int32 chlogif_parse_vipack(int32 fd);
+int32 chlogif_reqvipdata(uint32 aid, uint8 flag, int32 timediff, int32 mapfd);
+int32 chlogif_req_accinfo(int32 fd, int32 u_fd, int32 u_aid, int32 account_id, int8 type);
+
+int32 chlogif_parse(int32 fd);
+
+int32 chlogif_isconnected();
 TIMER_FUNC(chlogif_check_connect_logserver);
 TIMER_FUNC(chlogif_check_connect_logserver);
 void do_init_chlogif(void);
 void do_init_chlogif(void);
 void chlogif_reset(void);
 void chlogif_reset(void);

+ 86 - 86
src/char/char_mapif.cpp

@@ -27,12 +27,12 @@ using namespace rathena;
  * @param len: size of packet
  * @param len: size of packet
  * @return : the number of map-serv the packet was sent to
  * @return : the number of map-serv the packet was sent to
  */
  */
-int chmapif_sendall(unsigned char *buf, uint32 len){
-	int i, c;
+int32 chmapif_sendall(unsigned char *buf, uint32 len){
+	int32 i, c;
 
 
 	c = 0;
 	c = 0;
 	for(i = 0; i < ARRAYLENGTH(map_server); i++) {
 	for(i = 0; i < ARRAYLENGTH(map_server); i++) {
-		int fd;
+		int32 fd;
 		if (session_isValid(fd = map_server[i].fd)) {
 		if (session_isValid(fd = map_server[i].fd)) {
 			WFIFOHEAD(fd,len);
 			WFIFOHEAD(fd,len);
 			memcpy(WFIFOP(fd,0), buf, len);
 			memcpy(WFIFOP(fd,0), buf, len);
@@ -51,12 +51,12 @@ int chmapif_sendall(unsigned char *buf, uint32 len){
  * @param len: size of packet
  * @param len: size of packet
  * @return : the number of map-serv the packet was sent to
  * @return : the number of map-serv the packet was sent to
  */
  */
-int chmapif_sendallwos(int sfd, unsigned char *buf, uint32 len){
-	int i, c;
+int32 chmapif_sendallwos(int32 sfd, unsigned char *buf, uint32 len){
+	int32 i, c;
 
 
 	c = 0;
 	c = 0;
 	for(i = 0; i < ARRAYLENGTH(map_server); i++) {
 	for(i = 0; i < ARRAYLENGTH(map_server); i++) {
-		int fd;
+		int32 fd;
 		if (session_isValid(fd = map_server[i].fd) && fd != sfd) {
 		if (session_isValid(fd = map_server[i].fd) && fd != sfd) {
 			WFIFOHEAD(fd,len);
 			WFIFOHEAD(fd,len);
 			memcpy(WFIFOP(fd,0), buf, len);
 			memcpy(WFIFOP(fd,0), buf, len);
@@ -75,9 +75,9 @@ int chmapif_sendallwos(int sfd, unsigned char *buf, uint32 len){
  * @param len: size of packet
  * @param len: size of packet
  * @return : the number of map-serv the packet was sent to (O|1)
  * @return : the number of map-serv the packet was sent to (O|1)
  */
  */
-int chmapif_send(int fd, unsigned char *buf, uint32 len){
+int32 chmapif_send(int32 fd, unsigned char *buf, uint32 len){
 	if (session_isValid(fd)) {
 	if (session_isValid(fd)) {
-		int i;
+		int32 i;
 		ARR_FIND( 0, ARRAYLENGTH(map_server), i, fd == map_server[i].fd );
 		ARR_FIND( 0, ARRAYLENGTH(map_server), i, fd == map_server[i].fd );
 		if( i < ARRAYLENGTH(map_server) )
 		if( i < ARRAYLENGTH(map_server) )
 		{
 		{
@@ -99,8 +99,8 @@ int chmapif_send(int fd, unsigned char *buf, uint32 len){
  * @param fd: fd to send packet too (map-serv) if -1 send to all
  * @param fd: fd to send packet too (map-serv) if -1 send to all
  * @return : 0 success
  * @return : 0 success
  */
  */
-int chmapif_send_fame_list(int fd){
-	int i, len = 8;
+int32 chmapif_send_fame_list(int32 fd){
+	int32 i, len = 8;
 	unsigned char buf[32000];
 	unsigned char buf[32000];
 
 
 	WBUFW(buf,0) = 0x2b1b;
 	WBUFW(buf,0) = 0x2b1b;
@@ -141,7 +141,7 @@ int chmapif_send_fame_list(int fd){
  * @param index: position in the ranking
  * @param index: position in the ranking
  * @param fame: number of points
  * @param fame: number of points
  */
  */
-void chmapif_update_fame_list(int type, int index, int fame) {
+void chmapif_update_fame_list(int32 type, int32 index, int32 fame) {
 	unsigned char buf[8];
 	unsigned char buf[8];
 	WBUFW(buf,0) = 0x2b22;
 	WBUFW(buf,0) = 0x2b22;
 	WBUFB(buf,2) = type;
 	WBUFB(buf,2) = type;
@@ -154,7 +154,7 @@ void chmapif_update_fame_list(int type, int index, int fame) {
  * Send to map-servers the users count on this char-serv, (meaning the total of all mapserv)
  * Send to map-servers the users count on this char-serv, (meaning the total of all mapserv)
  * @param users: number of players on this char-serv
  * @param users: number of players on this char-serv
  */
  */
-void chmapif_sendall_playercount(int users){
+void chmapif_sendall_playercount(int32 users){
 	uint8 buf[6];
 	uint8 buf[6];
 	// send number of players to all map-servers
 	// send number of players to all map-servers
 	WBUFW(buf,0) = 0x2b00;
 	WBUFW(buf,0) = 0x2b00;
@@ -169,7 +169,7 @@ void chmapif_sendall_playercount(int users){
  * HZ 0x2afb <size>.W <status>.B <whisper name>.24B <server name>.24B
  * HZ 0x2afb <size>.W <status>.B <whisper name>.24B <server name>.24B
  * @param fd
  * @param fd
  **/
  **/
-void chmapif_send_misc(int fd) {
+void chmapif_send_misc(int32 fd) {
 	uint16 offs = 5;
 	uint16 offs = 5;
 	unsigned char buf[5+NAME_LENGTH+NAME_LENGTH];
 	unsigned char buf[5+NAME_LENGTH+NAME_LENGTH];
 
 
@@ -195,7 +195,7 @@ void chmapif_send_misc(int fd) {
  * @param map_id
  * @param map_id
  * @param count Number of map from new map-server has
  * @param count Number of map from new map-server has
  **/
  **/
-void chmapif_send_maps( int fd, int map_id, size_t count, unsigned char* mapbuf ){
+void chmapif_send_maps( int32 fd, int32 map_id, size_t count, unsigned char* mapbuf ){
 	uint16 x;
 	uint16 x;
 
 
 	if (count == 0) {
 	if (count == 0) {
@@ -241,8 +241,8 @@ void chmapif_send_maps( int fd, int map_id, size_t count, unsigned char* mapbuf
  * @param id: wich map_serv id
  * @param id: wich map_serv id
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_getmapname(int fd, int id){
-	int i = 0;
+int32 chmapif_parse_getmapname(int32 fd, int32 id){
+	int32 i = 0;
 	unsigned char *mapbuf;
 	unsigned char *mapbuf;
 
 
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
@@ -251,7 +251,7 @@ int chmapif_parse_getmapname(int fd, int id){
 	//Retain what map-index that map-serv contains
 	//Retain what map-index that map-serv contains
 	map_server[id].maps.clear();
 	map_server[id].maps.clear();
 
 
-	for( int i = 4; i < RFIFOW( fd, 2 ); i += MAP_NAME_LENGTH_EXT ){
+	for( int32 i = 4; i < RFIFOW( fd, 2 ); i += MAP_NAME_LENGTH_EXT ){
 		char mapname[MAP_NAME_LENGTH_EXT];
 		char mapname[MAP_NAME_LENGTH_EXT];
 
 
 		safestrncpy( mapname, RFIFOCP( fd, i ), sizeof( mapname ) );
 		safestrncpy( mapname, RFIFOCP( fd, i ), sizeof( mapname ) );
@@ -279,12 +279,12 @@ int chmapif_parse_getmapname(int fd, int id){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_askscdata(int fd){
+int32 chmapif_parse_askscdata(int32 fd){
 	if (RFIFOREST(fd) < 10)
 	if (RFIFOREST(fd) < 10)
 		return 0;
 		return 0;
 	else {
 	else {
 #ifdef ENABLE_SC_SAVING
 #ifdef ENABLE_SC_SAVING
-		int aid, cid;
+		int32 aid, cid;
 		aid = RFIFOL(fd,2);
 		aid = RFIFOL(fd,2);
 		cid = RFIFOL(fd,6);
 		cid = RFIFOL(fd,6);
 		if( SQL_ERROR == Sql_Query(sql_handle, "SELECT type, tick, val1, val2, val3, val4 from `%s` WHERE `account_id` = '%d' AND `char_id`='%d'",
 		if( SQL_ERROR == Sql_Query(sql_handle, "SELECT type, tick, val1, val2, val3, val4 from `%s` WHERE `account_id` = '%d' AND `char_id`='%d'",
@@ -296,7 +296,7 @@ int chmapif_parse_askscdata(int fd){
 		if( Sql_NumRows(sql_handle) > 0 )
 		if( Sql_NumRows(sql_handle) > 0 )
 		{
 		{
 			struct status_change_data scdata;
 			struct status_change_data scdata;
-			int count;
+			int32 count;
 			char* data;
 			char* data;
 
 
 			WFIFOHEAD(fd,14+50*sizeof(struct status_change_data));
 			WFIFOHEAD(fd,14+50*sizeof(struct status_change_data));
@@ -343,7 +343,7 @@ int chmapif_parse_askscdata(int fd){
  * @param id: wich map_serv id
  * @param id: wich map_serv id
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_getusercount(int fd, int id){
+int32 chmapif_parse_getusercount(int32 fd, int32 id){
 	if (RFIFOREST(fd) < 4)
 	if (RFIFOREST(fd) < 4)
 		return 0;
 		return 0;
 	if (RFIFOW(fd,2) != map_server[id].users) {
 	if (RFIFOW(fd,2) != map_server[id].users) {
@@ -360,7 +360,7 @@ int chmapif_parse_getusercount(int fd, int id){
  * @param id: wich map_serv id
  * @param id: wich map_serv id
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_regmapuser(int fd, int id){
+int32 chmapif_parse_regmapuser(int32 fd, int32 id){
 	if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2))
 	if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2))
 		return 0;
 		return 0;
 	else {
 	else {
@@ -372,7 +372,7 @@ int chmapif_parse_regmapuser(int fd, int id){
 			char_db_setoffline( pair.second, id );
 			char_db_setoffline( pair.second, id );
 		}
 		}
 
 
-		for( int i = 0; i < map_server[id].users; i++ ){
+		for( int32 i = 0; i < map_server[id].users; i++ ){
 			uint32 aid = RFIFOL(fd,6+i*8);
 			uint32 aid = RFIFOL(fd,6+i*8);
 			uint32 cid = RFIFOL(fd,6+i*8+4);
 			uint32 cid = RFIFOL(fd,6+i*8+4);
 
 
@@ -405,7 +405,7 @@ int chmapif_parse_regmapuser(int fd, int id){
  * @param id: wich map_serv id
  * @param id: wich map_serv id
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_reqsavechar(int fd, int id){
+int32 chmapif_parse_reqsavechar(int32 fd, int32 id){
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 		return 0;
 		return 0;
 	else {
 	else {
@@ -451,7 +451,7 @@ int chmapif_parse_reqsavechar(int fd, int id){
  * @param aid : Player account id
  * @param aid : Player account id
  * @param res : result, 0=not ok, 1=ok
  * @param res : result, 0=not ok, 1=ok
  */
  */
-void chmapif_charselres(int fd, uint32 aid, uint8 res){
+void chmapif_charselres(int32 fd, uint32 aid, uint8 res){
 	WFIFOHEAD(fd,7);
 	WFIFOHEAD(fd,7);
 	WFIFOW(fd,0) = 0x2b03;
 	WFIFOW(fd,0) = 0x2b03;
 	WFIFOL(fd,2) = aid;
 	WFIFOL(fd,2) = aid;
@@ -464,7 +464,7 @@ void chmapif_charselres(int fd, uint32 aid, uint8 res){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_authok(int fd){
+int32 chmapif_parse_authok(int32 fd){
 	if( RFIFOREST(fd) < 18 )
 	if( RFIFOREST(fd) < 18 )
 		return 0;
 		return 0;
 	else{
 	else{
@@ -507,11 +507,11 @@ int chmapif_parse_authok(int fd){
 }
 }
 
 
 //Request to save skill cooldown data
 //Request to save skill cooldown data
-int chmapif_parse_req_saveskillcooldown(int fd){
+int32 chmapif_parse_req_saveskillcooldown(int32 fd){
 	if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) )
 	if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) )
 		return 0;
 		return 0;
 	else {
 	else {
-		int count, aid, cid;
+		int32 count, aid, cid;
 		aid = RFIFOL(fd,4);
 		aid = RFIFOL(fd,4);
 		cid = RFIFOL(fd,8);
 		cid = RFIFOL(fd,8);
 		count = RFIFOW(fd,12);
 		count = RFIFOW(fd,12);
@@ -519,7 +519,7 @@ int chmapif_parse_req_saveskillcooldown(int fd){
 		{
 		{
 			struct skill_cooldown_data data;
 			struct skill_cooldown_data data;
 			StringBuf buf;
 			StringBuf buf;
-			int i;
+			int32 i;
 
 
 			StringBuf_Init(&buf);
 			StringBuf_Init(&buf);
 			StringBuf_Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `skill`, `tick`) VALUES ", schema_config.skillcooldown_db);
 			StringBuf_Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `skill`, `tick`) VALUES ", schema_config.skillcooldown_db);
@@ -540,11 +540,11 @@ int chmapif_parse_req_saveskillcooldown(int fd){
 }
 }
 
 
 //Request skillcooldown data 0x2b0a
 //Request skillcooldown data 0x2b0a
-int chmapif_parse_req_skillcooldown(int fd){
+int32 chmapif_parse_req_skillcooldown(int32 fd){
 	if (RFIFOREST(fd) < 10)
 	if (RFIFOREST(fd) < 10)
 		return 0;
 		return 0;
 	else {
 	else {
-		int aid, cid;
+		int32 aid, cid;
 		aid = RFIFOL(fd,2);
 		aid = RFIFOL(fd,2);
 		cid = RFIFOL(fd,6);
 		cid = RFIFOL(fd,6);
 		RFIFOSKIP(fd, 10);
 		RFIFOSKIP(fd, 10);
@@ -556,7 +556,7 @@ int chmapif_parse_req_skillcooldown(int fd){
 		}
 		}
 		if( Sql_NumRows(sql_handle) > 0 )
 		if( Sql_NumRows(sql_handle) > 0 )
 		{
 		{
-			int count;
+			int32 count;
 			char* data;
 			char* data;
 			struct skill_cooldown_data scd;
 			struct skill_cooldown_data scd;
 
 
@@ -592,7 +592,7 @@ int chmapif_parse_req_skillcooldown(int fd){
  * @param fd :Link to mapserv
  * @param fd :Link to mapserv
  * @param nok : 0=accepted or no=1
  * @param nok : 0=accepted or no=1
  */
  */
-void chmapif_changemapserv_ack(int fd, bool nok){
+void chmapif_changemapserv_ack(int32 fd, bool nok){
 	// TODO: Refactor... You crazy *** [Lemongrass]
 	// TODO: Refactor... You crazy *** [Lemongrass]
     WFIFOHEAD( fd, 28 + MAP_NAME_LENGTH_EXT );
     WFIFOHEAD( fd, 28 + MAP_NAME_LENGTH_EXT );
     WFIFOW(fd,0) = 0x2b06;
     WFIFOW(fd,0) = 0x2b06;
@@ -607,14 +607,14 @@ void chmapif_changemapserv_ack(int fd, bool nok){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_reqchangemapserv(int fd){
+int32 chmapif_parse_reqchangemapserv(int32 fd){
 	if( RFIFOREST( fd ) < ( 37 + MAP_NAME_LENGTH_EXT ) ){
 	if( RFIFOREST( fd ) < ( 37 + MAP_NAME_LENGTH_EXT ) ){
 		return 0;
 		return 0;
 	}
 	}
 	else {
 	else {
-		int map_id, map_fd = -1;
+		int32 map_id, map_fd = -1;
 		struct mmo_charstatus char_dat;
 		struct mmo_charstatus char_dat;
-		int offset = 18 + MAP_NAME_LENGTH_EXT;
+		int32 offset = 18 + MAP_NAME_LENGTH_EXT;
 
 
 		map_id = char_search_mapserver( RFIFOCP( fd, 18 ), ntohl( RFIFOL( fd, offset + 4 ) ), ntohs( RFIFOW( fd, offset + 8 ) ) ); //Locate mapserver by ip and port.
 		map_id = char_search_mapserver( RFIFOCP( fd, 18 ), ntohl( RFIFOL( fd, offset + 4 ) ), ntohs( RFIFOW( fd, offset + 8 ) ) ); //Locate mapserver by ip and port.
 		if (map_id >= 0)
 		if (map_id >= 0)
@@ -685,7 +685,7 @@ int chmapif_parse_reqchangemapserv(int fd){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_askrmfriend(int fd){
+int32 chmapif_parse_askrmfriend(int32 fd){
 	if (RFIFOREST(fd) < 10)
 	if (RFIFOREST(fd) < 10)
 		return 0;
 		return 0;
 	else {
 	else {
@@ -708,7 +708,7 @@ int chmapif_parse_askrmfriend(int fd){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_reqcharname(int fd){
+int32 chmapif_parse_reqcharname(int32 fd){
 	if (RFIFOREST(fd) < 6)
 	if (RFIFOREST(fd) < 6)
 		return 0;
 		return 0;
 
 
@@ -728,7 +728,7 @@ int chmapif_parse_reqcharname(int fd){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_reqnewemail(int fd){
+int32 chmapif_parse_reqnewemail(int32 fd){
 	if (RFIFOREST(fd) < 86)
 	if (RFIFOREST(fd) < 86)
 		return 0;
 		return 0;
 	if (chlogif_isconnected()) { // don't send request if no login-server
 	if (chlogif_isconnected()) { // don't send request if no login-server
@@ -746,18 +746,18 @@ int chmapif_parse_reqnewemail(int fd){
  * @param fd: which fd to parse from
  * @param fd: which fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_fwlog_changestatus(int fd){
+int32 chmapif_parse_fwlog_changestatus(int32 fd){
 	if (RFIFOREST(fd) < 44)
 	if (RFIFOREST(fd) < 44)
 		return 0;
 		return 0;
 	else {
 	else {
-		int result = 0; // 0-login-server request done, 1-player not found, 2-gm level too low, 3-login-server offline, 4-current group level > VIP group level
+		int32 result = 0; // 0-login-server request done, 1-player not found, 2-gm level too low, 3-login-server offline, 4-current group level > VIP group level
 		char esc_name[NAME_LENGTH*2+1];
 		char esc_name[NAME_LENGTH*2+1];
 		char answer = true;
 		char answer = true;
-		int aid = RFIFOL(fd,2); // account_id of who ask (-1 if server itself made this request)
+		int32 aid = RFIFOL(fd,2); // account_id of who ask (-1 if server itself made this request)
 		const char* name = RFIFOCP(fd,6); // name of the target character
 		const char* name = RFIFOCP(fd,6); // name of the target character
-		int operation = RFIFOW(fd,30); // type of operation @see enum chrif_req_op
+		int32 operation = RFIFOW(fd,30); // type of operation @see enum chrif_req_op
 		int32 timediff = 0;
 		int32 timediff = 0;
-		int val1 = 0, sex = SEX_MALE;
+		int32 val1 = 0, sex = SEX_MALE;
 
 
 		if (operation == CHRIF_OP_LOGIN_BAN || operation == CHRIF_OP_LOGIN_VIP) {
 		if (operation == CHRIF_OP_LOGIN_BAN || operation == CHRIF_OP_LOGIN_VIP) {
 			timediff = RFIFOL(fd, 32);
 			timediff = RFIFOL(fd, 32);
@@ -776,8 +776,8 @@ int chmapif_parse_fwlog_changestatus(int fd){
 			Sql_ShowDebug(sql_handle);
 			Sql_ShowDebug(sql_handle);
 			result = 1;
 			result = 1;
 		} else {
 		} else {
-			int t_aid; // target account id
-			int t_cid; // target char id
+			int32 t_aid; // target account id
+			int32 t_cid; // target char id
 			char* data;
 			char* data;
 
 
 			Sql_GetData(sql_handle, 0, &data, nullptr); t_aid = atoi(data);
 			Sql_GetData(sql_handle, 0, &data, nullptr); t_aid = atoi(data);
@@ -858,7 +858,7 @@ int chmapif_parse_fwlog_changestatus(int fd){
  * @param partner_id1: char id1 divorced
  * @param partner_id1: char id1 divorced
  * @param partner_id2: char id2 divorced
  * @param partner_id2: char id2 divorced
  */
  */
-void chmapif_send_ackdivorce(int partner_id1, int partner_id2){
+void chmapif_send_ackdivorce(int32 partner_id1, int32 partner_id2){
 	unsigned char buf[11];
 	unsigned char buf[11];
 	WBUFW(buf,0) = 0x2b12;
 	WBUFW(buf,0) = 0x2b12;
 	WBUFL(buf,2) = partner_id1;
 	WBUFL(buf,2) = partner_id1;
@@ -871,7 +871,7 @@ void chmapif_send_ackdivorce(int partner_id1, int partner_id2){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_reqdivorce(int fd){
+int32 chmapif_parse_reqdivorce(int32 fd){
 	if( RFIFOREST(fd) < 10 )
 	if( RFIFOREST(fd) < 10 )
 		return 0;
 		return 0;
 	char_divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6));
 	char_divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6));
@@ -885,7 +885,7 @@ int chmapif_parse_reqdivorce(int fd){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_setcharoffline(int fd){
+int32 chmapif_parse_setcharoffline(int32 fd){
 	if (RFIFOREST(fd) < 6)
 	if (RFIFOREST(fd) < 6)
 		return 0;
 		return 0;
 	char_set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6));
 	char_set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6));
@@ -901,7 +901,7 @@ int chmapif_parse_setcharoffline(int fd){
  * @param id: wich map_serv id
  * @param id: wich map_serv id
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_setalloffline(int fd, int id){
+int32 chmapif_parse_setalloffline(int32 fd, int32 id){
 	char_set_all_offline(id);
 	char_set_all_offline(id);
 	RFIFOSKIP(fd,2);
 	RFIFOSKIP(fd,2);
 	return 1;
 	return 1;
@@ -914,7 +914,7 @@ int chmapif_parse_setalloffline(int fd, int id){
  * @param id: wich map_serv id
  * @param id: wich map_serv id
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_setcharonline(int fd, int id){
+int32 chmapif_parse_setcharonline(int32 fd, int32 id){
 	if (RFIFOREST(fd) < 10)
 	if (RFIFOREST(fd) < 10)
 		return 0;
 		return 0;
 	char_set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6));
 	char_set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6));
@@ -929,7 +929,7 @@ int chmapif_parse_setcharonline(int fd, int id){
  * @param id: wich map_serv id
  * @param id: wich map_serv id
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_reqfamelist(int fd){
+int32 chmapif_parse_reqfamelist(int32 fd){
 	if (RFIFOREST(fd) < 2)
 	if (RFIFOREST(fd) < 2)
 		return 0;
 		return 0;
 	char_read_fame_list();
 	char_read_fame_list();
@@ -944,12 +944,12 @@ int chmapif_parse_reqfamelist(int fd){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_save_scdata(int fd){
+int32 chmapif_parse_save_scdata(int32 fd){
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 		return 0;
 		return 0;
 	{
 	{
 #ifdef ENABLE_SC_SAVING
 #ifdef ENABLE_SC_SAVING
-		int count, aid, cid;
+		int32 count, aid, cid;
 
 
 		aid = RFIFOL(fd, 4);
 		aid = RFIFOL(fd, 4);
 		cid = RFIFOL(fd, 8);
 		cid = RFIFOL(fd, 8);
@@ -963,7 +963,7 @@ int chmapif_parse_save_scdata(int fd){
 		{
 		{
 			struct status_change_data data;
 			struct status_change_data data;
 			StringBuf buf;
 			StringBuf buf;
-			int i;
+			int32 i;
 
 
 			StringBuf_Init(&buf);
 			StringBuf_Init(&buf);
 			StringBuf_Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", schema_config.scdata_db);
 			StringBuf_Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", schema_config.scdata_db);
@@ -990,7 +990,7 @@ int chmapif_parse_save_scdata(int fd){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_keepalive(int fd){
+int32 chmapif_parse_keepalive(int32 fd){
 	WFIFOHEAD(fd,2);
 	WFIFOHEAD(fd,2);
 	WFIFOW(fd,0) = 0x2b24;
 	WFIFOW(fd,0) = 0x2b24;
 	WFIFOSET(fd,2);
 	WFIFOSET(fd,2);
@@ -1003,7 +1003,7 @@ int chmapif_parse_keepalive(int fd){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_reqauth(int fd, int id){
+int32 chmapif_parse_reqauth(int32 fd, int32 id){
 	if (RFIFOREST(fd) < 20)
 	if (RFIFOREST(fd) < 20)
 		return 0;
 		return 0;
 	else {
 	else {
@@ -1096,7 +1096,7 @@ int chmapif_parse_reqauth(int fd, int id){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_updmapip(int fd, int id){
+int32 chmapif_parse_updmapip(int32 fd, int32 id){
 	if (RFIFOREST(fd) < 6) 
 	if (RFIFOREST(fd) < 6) 
 		return 0;
 		return 0;
 	map_server[id].ip = ntohl(RFIFOL(fd, 2));
 	map_server[id].ip = ntohl(RFIFOL(fd, 2));
@@ -1111,17 +1111,17 @@ int chmapif_parse_updmapip(int fd, int id){
  * @param fd: wich fd to parse from
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  * @return : 0 not enough data received, 1 success
  */
  */
-int chmapif_parse_updfamelist(int fd){
+int32 chmapif_parse_updfamelist(int32 fd){
     if (RFIFOREST(fd) < 11)
     if (RFIFOREST(fd) < 11)
         return 0;
         return 0;
     {
     {
-            int cid = RFIFOL(fd, 2);
-            int fame = RFIFOL(fd, 6);
+            int32 cid = RFIFOL(fd, 2);
+            int32 fame = RFIFOL(fd, 6);
             char type = RFIFOB(fd, 10);
             char type = RFIFOB(fd, 10);
-            int size;
+            int32 size;
             struct fame_list* list;
             struct fame_list* list;
-            int player_pos;
-            int fame_pos;
+            int32 player_pos;
+            int32 fame_pos;
 
 
             switch(type)
             switch(type)
             {
             {
@@ -1169,7 +1169,7 @@ int chmapif_parse_updfamelist(int fd){
  * HZ 0x2b2b
  * HZ 0x2b2b
  * Transmist vip data to mapserv
  * Transmist vip data to mapserv
  */
  */
-int chmapif_vipack(int mapfd, uint32 aid, uint32 vip_time, uint32 groupid, uint8 flag) {
+int32 chmapif_vipack(int32 mapfd, uint32 aid, uint32 vip_time, uint32 groupid, uint8 flag) {
 #ifdef VIP_ENABLE
 #ifdef VIP_ENABLE
 	uint8 buf[15];
 	uint8 buf[15];
 	WBUFW(buf,0) = 0x2b2b;
 	WBUFW(buf,0) = 0x2b2b;
@@ -1182,12 +1182,12 @@ int chmapif_vipack(int mapfd, uint32 aid, uint32 vip_time, uint32 groupid, uint8
 	return 0;
 	return 0;
 }
 }
 
 
-int chmapif_parse_reqcharban(int fd){
+int32 chmapif_parse_reqcharban(int32 fd){
 	if (RFIFOREST(fd) < 10+NAME_LENGTH)
 	if (RFIFOREST(fd) < 10+NAME_LENGTH)
 		return 0;
 		return 0;
 	else {
 	else {
-		//int aid = RFIFOL(fd,2); aid of player who as requested the ban
-		int timediff = RFIFOL(fd,6);
+		//int32 aid = RFIFOL(fd,2); aid of player who as requested the ban
+		int32 timediff = RFIFOL(fd,6);
 		const char* name = RFIFOCP(fd,10); // name of the target character
 		const char* name = RFIFOCP(fd,10); // name of the target character
 		char esc_name[NAME_LENGTH*2+1];
 		char esc_name[NAME_LENGTH*2+1];
 		RFIFOSKIP(fd,10+NAME_LENGTH);
 		RFIFOSKIP(fd,10+NAME_LENGTH);
@@ -1203,7 +1203,7 @@ int chmapif_parse_reqcharban(int fd){
 			Sql_FreeResult(sql_handle);
 			Sql_FreeResult(sql_handle);
 			return 1;
 			return 1;
 		} else {
 		} else {
-			int t_cid=0,t_aid=0;
+			int32 t_cid=0,t_aid=0;
 			char* data;
 			char* data;
 			time_t unban_time;
 			time_t unban_time;
 			time_t now = time(nullptr);
 			time_t now = time(nullptr);
@@ -1251,7 +1251,7 @@ int chmapif_parse_reqcharban(int fd){
 	return 1;
 	return 1;
 }
 }
 
 
-int chmapif_parse_reqcharunban(int fd){
+int32 chmapif_parse_reqcharunban(int32 fd){
 	if (RFIFOREST(fd) < 6+NAME_LENGTH)
 	if (RFIFOREST(fd) < 6+NAME_LENGTH)
 		return 0;
 		return 0;
 	else {
 	else {
@@ -1277,7 +1277,7 @@ int chmapif_parse_reqcharunban(int fd){
  * @param fd
  * @param fd
  * @author [Cydh]
  * @author [Cydh]
  **/
  **/
-int chmapif_bonus_script_get(int fd) {
+int32 chmapif_bonus_script_get(int32 fd) {
 	if (RFIFOREST(fd) < 6)
 	if (RFIFOREST(fd) < 6)
 		return 0;
 		return 0;
 	else {
 	else {
@@ -1347,7 +1347,7 @@ int chmapif_bonus_script_get(int fd) {
  * @param fd
  * @param fd
  * @author [Cydh]
  * @author [Cydh]
  **/
  **/
-int chmapif_bonus_script_save(int fd) {
+int32 chmapif_bonus_script_save(int32 fd) {
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 		return 0;
 		return 0;
 	else {
 	else {
@@ -1388,7 +1388,7 @@ int chmapif_bonus_script_save(int fd) {
  * @param fd : file descriptor to parse, (link to mapserv)
  * @param fd : file descriptor to parse, (link to mapserv)
  * @param errCode 0:success, 3:fail
  * @param errCode 0:success, 3:fail
  */
  */
-void chmapif_connectack(int fd, uint8 errCode){
+void chmapif_connectack(int32 fd, uint8 errCode){
 	WFIFOHEAD(fd,3);
 	WFIFOHEAD(fd,3);
 	WFIFOW(fd,0) = 0x2af9;
 	WFIFOW(fd,0) = 0x2af9;
 	WFIFOB(fd,2) = errCode;
 	WFIFOB(fd,2) = errCode;
@@ -1402,8 +1402,8 @@ void chmapif_connectack(int fd, uint8 errCode){
  * @param fd: file descriptor to parse, (link to map-serv)
  * @param fd: file descriptor to parse, (link to map-serv)
  * @return 0=invalid server,marked for disconnection,unknow packet; 1=success
  * @return 0=invalid server,marked for disconnection,unknow packet; 1=success
  */
  */
-int chmapif_parse(int fd){
-	int id; //mapserv id
+int32 chmapif_parse(int32 fd){
+	int32 id; //mapserv id
 
 
 	ARR_FIND( 0, ARRAYLENGTH(map_server), id, map_server[id].fd == fd );
 	ARR_FIND( 0, ARRAYLENGTH(map_server), id, map_server[id].fd == fd );
 	if( id == ARRAYLENGTH(map_server) )
 	if( id == ARRAYLENGTH(map_server) )
@@ -1421,7 +1421,7 @@ int chmapif_parse(int fd){
 	}
 	}
 
 
 	while(RFIFOREST(fd) >= 2){
 	while(RFIFOREST(fd) >= 2){
-		int next=1;
+		int32 next=1;
 		switch(RFIFOW(fd,0)){
 		switch(RFIFOW(fd,0)){
 			case 0x2afa: next=chmapif_parse_getmapname(fd,id); break;
 			case 0x2afa: next=chmapif_parse_getmapname(fd,id); break;
 			case 0x2afc: next=chmapif_parse_askscdata(fd); break;
 			case 0x2afc: next=chmapif_parse_askscdata(fd); break;
@@ -1454,7 +1454,7 @@ int chmapif_parse(int fd){
 			default:
 			default:
 			{
 			{
 					// inter server - packet
 					// inter server - packet
-					int r = inter_parse_frommap(fd);
+					int32 r = inter_parse_frommap(fd);
 					if (r == 1) break;		// processed
 					if (r == 1) break;		// processed
 					if (r == 2) return 0;	// need more packet
 					if (r == 2) return 0;	// need more packet
 					// no inter server packet. no char server packet -> disconnect
 					// no inter server packet. no char server packet -> disconnect
@@ -1470,7 +1470,7 @@ int chmapif_parse(int fd){
 
 
 
 
 // Initialization process (currently only initialization inter_mapif)
 // Initialization process (currently only initialization inter_mapif)
-int chmapif_init(int fd){
+int32 chmapif_init(int32 fd){
 	return inter_mapif_init(fd);
 	return inter_mapif_init(fd);
 }
 }
 
 
@@ -1478,7 +1478,7 @@ int chmapif_init(int fd){
  * Initializes a server structure.
  * Initializes a server structure.
  * @param id: id of map-serv (should be >0, FIXME)
  * @param id: id of map-serv (should be >0, FIXME)
  */
  */
-void chmapif_server_init(int id) {
+void chmapif_server_init(int32 id) {
 	map_server[id] = {};
 	map_server[id] = {};
 	map_server[id].fd = -1;
 	map_server[id].fd = -1;
 }
 }
@@ -1487,7 +1487,7 @@ void chmapif_server_init(int id) {
  * Destroys a server structure.
  * Destroys a server structure.
  * @param id: id of map-serv (should be >0, FIXME)
  * @param id: id of map-serv (should be >0, FIXME)
  */
  */
-void chmapif_server_destroy(int id){
+void chmapif_server_destroy(int32 id){
 	if( map_server[id].fd == -1 ){
 	if( map_server[id].fd == -1 ){
 		do_close(map_server[id].fd);
 		do_close(map_server[id].fd);
 		map_server[id].fd = -1;
 		map_server[id].fd = -1;
@@ -1499,7 +1499,7 @@ void chmapif_server_destroy(int id){
  *  Initialisation, function called at start of the char-serv.
  *  Initialisation, function called at start of the char-serv.
  */
  */
 void do_init_chmapif(void){
 void do_init_chmapif(void){
-	int i;
+	int32 i;
 	for( i = 0; i < ARRAYLENGTH(map_server); ++i )
 	for( i = 0; i < ARRAYLENGTH(map_server); ++i )
 		chmapif_server_init(i);
 		chmapif_server_init(i);
 }
 }
@@ -1509,10 +1509,10 @@ void do_init_chmapif(void){
  *  Actually destroys then recreates the struct.
  *  Actually destroys then recreates the struct.
  * @param id: id of map-serv (should be >0, FIXME)
  * @param id: id of map-serv (should be >0, FIXME)
  */
  */
-void chmapif_server_reset(int id){
-	int j = 0;
+void chmapif_server_reset(int32 id){
+	int32 j = 0;
 	unsigned char buf[INT16_MAX];
 	unsigned char buf[INT16_MAX];
-	int fd = map_server[id].fd;
+	int32 fd = map_server[id].fd;
 
 
 	//Notify other map servers that this one is gone. [Skotlex]
 	//Notify other map servers that this one is gone. [Skotlex]
 	WBUFW(buf,0) = 0x2b20;
 	WBUFW(buf,0) = 0x2b20;
@@ -1541,7 +1541,7 @@ void chmapif_server_reset(int id){
  * Called when the connection to Map Server is disconnected.
  * Called when the connection to Map Server is disconnected.
  * @param id: id of map-serv (should be >0, FIXME)
  * @param id: id of map-serv (should be >0, FIXME)
  */
  */
-void chmapif_on_disconnect(int id){
+void chmapif_on_disconnect(int32 id){
 	ShowStatus("Map-server #%d has disconnected.\n", id);
 	ShowStatus("Map-server #%d has disconnected.\n", id);
 	chmapif_server_reset(id);
 	chmapif_server_reset(id);
 }
 }
@@ -1552,7 +1552,7 @@ void chmapif_on_disconnect(int id){
  *  dealloc..., function called at exit of the char-serv
  *  dealloc..., function called at exit of the char-serv
  */
  */
 void do_final_chmapif(void){
 void do_final_chmapif(void){
-	int i;
+	int32 i;
 	for( i = 0; i < ARRAYLENGTH(map_server); ++i )
 	for( i = 0; i < ARRAYLENGTH(map_server); ++i )
 		chmapif_server_destroy(i);
 		chmapif_server_destroy(i);
 }
 }

+ 44 - 44
src/char/char_mapif.hpp

@@ -6,54 +6,54 @@
 
 
 #include <common/cbasetypes.hpp>
 #include <common/cbasetypes.hpp>
 
 
-int chmapif_sendall(unsigned char *buf, uint32 len);
-int chmapif_sendallwos(int sfd, unsigned char *buf, uint32 len);
-int chmapif_send(int fd, unsigned char *buf, uint32 len);
-int chmapif_send_fame_list(int fd);
-void chmapif_update_fame_list(int type, int index, int fame);
-void chmapif_sendall_playercount(int users);
-int chmapif_parse_getmapname(int fd, int id);
-int chmapif_parse_askscdata(int fd);
-int chmapif_parse_getusercount(int fd, int id);
-int chmapif_parse_regmapuser(int fd, int id);
-int chmapif_parse_reqsavechar(int fd, int id);
-int chmapif_parse_authok(int fd);
-int chmapif_parse_req_saveskillcooldown(int fd);
-int chmapif_parse_req_skillcooldown(int fd);
-int chmapif_parse_reqchangemapserv(int fd);
-int chmapif_parse_askrmfriend(int fd);
-int chmapif_parse_reqcharname(int fd);
-int chmapif_parse_reqnewemail(int fd);
-int chmapif_parse_fwlog_changestatus(int fd);
-int chmapif_parse_updfamelist(int fd);
-void chmapif_send_ackdivorce(int partner_id1, int partner_id2);
-int chmapif_parse_reqdivorce(int fd);
-int chmapif_parse_setcharoffline(int fd);
-int chmapif_parse_setalloffline(int fd, int id);
-int chmapif_parse_setcharonline(int fd, int id);
-int chmapif_parse_reqfamelist(int fd);
-int chmapif_parse_save_scdata(int fd);
-int chmapif_parse_keepalive(int fd);
-int chmapif_parse_reqauth(int fd, int id);
-int chmapif_parse_updmapip(int fd, int id);
+int32 chmapif_sendall(unsigned char *buf, uint32 len);
+int32 chmapif_sendallwos(int32 sfd, unsigned char *buf, uint32 len);
+int32 chmapif_send(int32 fd, unsigned char *buf, uint32 len);
+int32 chmapif_send_fame_list(int32 fd);
+void chmapif_update_fame_list(int32 type, int32 index, int32 fame);
+void chmapif_sendall_playercount(int32 users);
+int32 chmapif_parse_getmapname(int32 fd, int32 id);
+int32 chmapif_parse_askscdata(int32 fd);
+int32 chmapif_parse_getusercount(int32 fd, int32 id);
+int32 chmapif_parse_regmapuser(int32 fd, int32 id);
+int32 chmapif_parse_reqsavechar(int32 fd, int32 id);
+int32 chmapif_parse_authok(int32 fd);
+int32 chmapif_parse_req_saveskillcooldown(int32 fd);
+int32 chmapif_parse_req_skillcooldown(int32 fd);
+int32 chmapif_parse_reqchangemapserv(int32 fd);
+int32 chmapif_parse_askrmfriend(int32 fd);
+int32 chmapif_parse_reqcharname(int32 fd);
+int32 chmapif_parse_reqnewemail(int32 fd);
+int32 chmapif_parse_fwlog_changestatus(int32 fd);
+int32 chmapif_parse_updfamelist(int32 fd);
+void chmapif_send_ackdivorce(int32 partner_id1, int32 partner_id2);
+int32 chmapif_parse_reqdivorce(int32 fd);
+int32 chmapif_parse_setcharoffline(int32 fd);
+int32 chmapif_parse_setalloffline(int32 fd, int32 id);
+int32 chmapif_parse_setcharonline(int32 fd, int32 id);
+int32 chmapif_parse_reqfamelist(int32 fd);
+int32 chmapif_parse_save_scdata(int32 fd);
+int32 chmapif_parse_keepalive(int32 fd);
+int32 chmapif_parse_reqauth(int32 fd, int32 id);
+int32 chmapif_parse_updmapip(int32 fd, int32 id);
 
 
-int chmapif_vipack(int mapfd, uint32 aid, uint32 vip_time, uint32 groupid, uint8 flag);
-int chmapif_parse_reqcharban(int fd);
-int chmapif_parse_reqcharunban(int fd);
-int chmapif_bonus_script_get(int fd);
-int chmapif_bonus_script_save(int fd);
+int32 chmapif_vipack(int32 mapfd, uint32 aid, uint32 vip_time, uint32 groupid, uint8 flag);
+int32 chmapif_parse_reqcharban(int32 fd);
+int32 chmapif_parse_reqcharunban(int32 fd);
+int32 chmapif_bonus_script_get(int32 fd);
+int32 chmapif_bonus_script_save(int32 fd);
 
 
-void chmapif_connectack(int fd, uint8 errCode);
-void chmapif_charselres(int fd, uint32 aid, uint8 res);
-void chmapif_changemapserv_ack(int fd, bool nok);
+void chmapif_connectack(int32 fd, uint8 errCode);
+void chmapif_charselres(int32 fd, uint32 aid, uint8 res);
+void chmapif_changemapserv_ack(int32 fd, bool nok);
 
 
-int chmapif_parse(int fd);
-int chmapif_init(int fd);
-void chmapif_server_init(int id);
-void chmapif_server_destroy(int id);
+int32 chmapif_parse(int32 fd);
+int32 chmapif_init(int32 fd);
+void chmapif_server_init(int32 id);
+void chmapif_server_destroy(int32 id);
 void do_init_chmapif(void);
 void do_init_chmapif(void);
-void chmapif_server_reset(int id);
-void chmapif_on_disconnect(int id);
+void chmapif_server_reset(int32 id);
+void chmapif_on_disconnect(int32 id);
 void do_final_chmapif(void);
 void do_final_chmapif(void);
 
 
 #endif /* CHAR_MAPIF_HPP */
 #endif /* CHAR_MAPIF_HPP */

+ 14 - 14
src/char/int_achievement.cpp

@@ -25,13 +25,13 @@
  * @param count: Pointer to return the number of found entries.
  * @param count: Pointer to return the number of found entries.
  * @return Array of found entries. It has *count entries, and it is care of the caller to aFree() it afterwards.
  * @return Array of found entries. It has *count entries, and it is care of the caller to aFree() it afterwards.
  */
  */
-struct achievement *mapif_achievements_fromsql(uint32 char_id, int *count)
+struct achievement *mapif_achievements_fromsql(uint32 char_id, int32 *count)
 {
 {
 	struct achievement *achievelog = nullptr;
 	struct achievement *achievelog = nullptr;
 	struct achievement tmp_achieve;
 	struct achievement tmp_achieve;
 	SqlStmt *stmt;
 	SqlStmt *stmt;
 	StringBuf buf;
 	StringBuf buf;
-	int i;
+	int32 i;
 
 
 	if (!count)
 	if (!count)
 		return nullptr;
 		return nullptr;
@@ -92,7 +92,7 @@ struct achievement *mapif_achievements_fromsql(uint32 char_id, int *count)
  * @param achievement_id: Achievement ID
  * @param achievement_id: Achievement ID
  * @return false in case of errors, true otherwise
  * @return false in case of errors, true otherwise
  */
  */
-bool mapif_achievement_delete(uint32 char_id, int achievement_id)
+bool mapif_achievement_delete(uint32 char_id, int32 achievement_id)
 {
 {
 	if (SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d' AND `char_id` = '%u'", schema_config.achievement_table, achievement_id, char_id)) {
 	if (SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d' AND `char_id` = '%u'", schema_config.achievement_table, achievement_id, char_id)) {
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
@@ -111,7 +111,7 @@ bool mapif_achievement_delete(uint32 char_id, int achievement_id)
 bool mapif_achievement_add(uint32 char_id, struct achievement* ad)
 bool mapif_achievement_add(uint32 char_id, struct achievement* ad)
 {
 {
 	StringBuf buf;
 	StringBuf buf;
-	int i;
+	int32 i;
 
 
 	ARR_FIND( 0, MAX_ACHIEVEMENT_OBJECTIVES, i, ad->count[i] != 0 );
 	ARR_FIND( 0, MAX_ACHIEVEMENT_OBJECTIVES, i, ad->count[i] != 0 );
 
 
@@ -160,7 +160,7 @@ bool mapif_achievement_add(uint32 char_id, struct achievement* ad)
 bool mapif_achievement_update(uint32 char_id, struct achievement* ad)
 bool mapif_achievement_update(uint32 char_id, struct achievement* ad)
 {
 {
 	StringBuf buf;
 	StringBuf buf;
-	int i;
+	int32 i;
 
 
 	StringBuf_Init(&buf);
 	StringBuf_Init(&buf);
 	StringBuf_Printf(&buf, "UPDATE `%s` SET ", schema_config.achievement_table);
 	StringBuf_Printf(&buf, "UPDATE `%s` SET ", schema_config.achievement_table);
@@ -192,7 +192,7 @@ bool mapif_achievement_update(uint32 char_id, struct achievement* ad)
 /**
 /**
  * Notifies the map-server of the result of saving a character's achievementlog.
  * Notifies the map-server of the result of saving a character's achievementlog.
  */
  */
-void mapif_achievement_save( int fd, uint32 char_id, bool success ){
+void mapif_achievement_save( int32 fd, uint32 char_id, bool success ){
 	WFIFOHEAD(fd, 7);
 	WFIFOHEAD(fd, 7);
 	WFIFOW(fd, 0) = 0x3863;
 	WFIFOW(fd, 0) = 0x3863;
 	WFIFOL(fd, 2) = char_id;
 	WFIFOL(fd, 2) = char_id;
@@ -205,9 +205,9 @@ void mapif_achievement_save( int fd, uint32 char_id, bool success ){
  * Received achievements are saved, and an ack is sent back to the map server.
  * Received achievements are saved, and an ack is sent back to the map server.
  * @see inter_parse_frommap
  * @see inter_parse_frommap
  */
  */
-int mapif_parse_achievement_save(int fd)
+int32 mapif_parse_achievement_save(int32 fd)
 {
 {
-	int i, j, k, old_n, new_n = (RFIFOW(fd, 2) - 8) / sizeof(struct achievement);
+	int32 i, j, k, old_n, new_n = (RFIFOW(fd, 2) - 8) / sizeof(struct achievement);
 	uint32 char_id = RFIFOL(fd, 4);
 	uint32 char_id = RFIFOL(fd, 4);
 	struct achievement *old_ad = nullptr, *new_ad = nullptr;
 	struct achievement *old_ad = nullptr, *new_ad = nullptr;
 	bool success = true;
 	bool success = true;
@@ -256,9 +256,9 @@ int mapif_parse_achievement_save(int fd)
 /**
 /**
  * Sends the achievementlog of a character to the map-server.
  * Sends the achievementlog of a character to the map-server.
  */
  */
-void mapif_achievement_load( int fd, uint32 char_id ){
+void mapif_achievement_load( int32 fd, uint32 char_id ){
 	struct achievement *tmp_achievementlog = nullptr;
 	struct achievement *tmp_achievementlog = nullptr;
-	int num_achievements = 0;
+	int32 num_achievements = 0;
 
 
 	tmp_achievementlog = mapif_achievements_fromsql(char_id, &num_achievements);
 	tmp_achievementlog = mapif_achievements_fromsql(char_id, &num_achievements);
 
 
@@ -281,7 +281,7 @@ void mapif_achievement_load( int fd, uint32 char_id ){
  * NOTE: Achievements sent to the player are only completed ones
  * NOTE: Achievements sent to the player are only completed ones
  * @see inter_parse_frommap
  * @see inter_parse_frommap
  */
  */
-int mapif_parse_achievement_load(int fd)
+int32 mapif_parse_achievement_load(int32 fd)
 {
 {
 	mapif_achievement_load( fd, RFIFOL(fd, 2) );
 	mapif_achievement_load( fd, RFIFOL(fd, 2) );
 
 
@@ -291,7 +291,7 @@ int mapif_parse_achievement_load(int fd)
 /**
 /**
  * Notify the map-server if claiming the reward has succeeded.
  * Notify the map-server if claiming the reward has succeeded.
  */
  */
-void mapif_achievement_reward( int fd, uint32 char_id, int32 achievement_id, time_t rewarded ){
+void mapif_achievement_reward( int32 fd, uint32 char_id, int32 achievement_id, time_t rewarded ){
 	WFIFOHEAD(fd, 14);
 	WFIFOHEAD(fd, 14);
 	WFIFOW(fd, 0) = 0x3864;
 	WFIFOW(fd, 0) = 0x3864;
 	WFIFOL(fd, 2) = char_id;
 	WFIFOL(fd, 2) = char_id;
@@ -304,7 +304,7 @@ void mapif_achievement_reward( int fd, uint32 char_id, int32 achievement_id, tim
  * Request of the map-server that a player claimed his achievement rewards.
  * Request of the map-server that a player claimed his achievement rewards.
  * @see inter_parse_frommap
  * @see inter_parse_frommap
  */
  */
-int mapif_parse_achievement_reward(int fd){
+int32 mapif_parse_achievement_reward(int32 fd){
 	time_t current = time(nullptr);
 	time_t current = time(nullptr);
 	uint32 char_id = RFIFOL(fd, 2);
 	uint32 char_id = RFIFOL(fd, 2);
 	int32 achievement_id = RFIFOL(fd, 6);
 	int32 achievement_id = RFIFOL(fd, 6);
@@ -343,7 +343,7 @@ int mapif_parse_achievement_reward(int fd){
  * Parses achievementlog related packets from the map server.
  * Parses achievementlog related packets from the map server.
  * @see inter_parse_frommap
  * @see inter_parse_frommap
  */
  */
-int inter_achievement_parse_frommap(int fd)
+int32 inter_achievement_parse_frommap(int32 fd)
 {
 {
 	switch (RFIFOW(fd, 0)) {
 	switch (RFIFOW(fd, 0)) {
 		case 0x3062: mapif_parse_achievement_load(fd); break;
 		case 0x3062: mapif_parse_achievement_load(fd); break;

+ 3 - 1
src/char/int_achievement.hpp

@@ -4,6 +4,8 @@
 #ifndef INT_ACHIEVEMENT_HPP
 #ifndef INT_ACHIEVEMENT_HPP
 #define INT_ACHIEVEMENT_HPP
 #define INT_ACHIEVEMENT_HPP
 
 
-int inter_achievement_parse_frommap(int fd);
+#include <common/cbasetypes.hpp>
+
+int32 inter_achievement_parse_frommap(int32 fd);
 
 
 #endif /* INT_ACHIEVEMENT_HPP */
 #endif /* INT_ACHIEVEMENT_HPP */

+ 22 - 22
src/char/int_auction.cpp

@@ -25,15 +25,15 @@
 
 
 using namespace rathena;
 using namespace rathena;
 
 
-// int auction_id -> struct auction_data*
+// int32 auction_id -> struct auction_data*
 static std::unordered_map<uint32, std::shared_ptr<struct auction_data>> auction_db;
 static std::unordered_map<uint32, std::shared_ptr<struct auction_data>> auction_db;
 
 
 void auction_delete( std::shared_ptr<struct auction_data> auction );
 void auction_delete( std::shared_ptr<struct auction_data> auction );
 TIMER_FUNC(auction_end_timer);
 TIMER_FUNC(auction_end_timer);
 
 
-int auction_count(uint32 char_id, bool buy)
+int32 auction_count(uint32 char_id, bool buy)
 {
 {
-	int i = 0;
+	int32 i = 0;
 
 
 	for( const auto& pair : auction_db ){
 	for( const auto& pair : auction_db ){
 		std::shared_ptr<struct auction_data> auction = pair.second;
 		std::shared_ptr<struct auction_data> auction = pair.second;
@@ -47,7 +47,7 @@ int auction_count(uint32 char_id, bool buy)
 }
 }
 
 
 void auction_save( std::shared_ptr<struct auction_data> auction ){
 void auction_save( std::shared_ptr<struct auction_data> auction ){
-	int j;
+	int32 j;
 	StringBuf buf;
 	StringBuf buf;
 	SqlStmt* stmt;
 	SqlStmt* stmt;
 
 
@@ -81,7 +81,7 @@ void auction_save( std::shared_ptr<struct auction_data> auction ){
 }
 }
 
 
 uint32 auction_create( std::shared_ptr<struct auction_data> auction ){
 uint32 auction_create( std::shared_ptr<struct auction_data> auction ){
-	int j;
+	int32 j;
 	StringBuf buf;
 	StringBuf buf;
 	SqlStmt* stmt;
 	SqlStmt* stmt;
 
 
@@ -187,7 +187,7 @@ void auction_delete( std::shared_ptr<struct auction_data> auction ){
 
 
 void inter_auctions_fromsql(void)
 void inter_auctions_fromsql(void)
 {
 {
-	int i;
+	int32 i;
 	char *data;
 	char *data;
 	StringBuf buf;
 	StringBuf buf;
 	t_tick tick = gettick(), endtick;
 	t_tick tick = gettick(), endtick;
@@ -267,9 +267,9 @@ void inter_auctions_fromsql(void)
 	Sql_FreeResult(sql_handle);
 	Sql_FreeResult(sql_handle);
 }
 }
 
 
-void mapif_Auction_sendlist(int fd, uint32 char_id, short count, short pages, unsigned char *buf)
+void mapif_Auction_sendlist(int32 fd, uint32 char_id, short count, short pages, unsigned char *buf)
 {
 {
-	int len = (sizeof(struct auction_data) * count) + 12;
+	int32 len = (sizeof(struct auction_data) * count) + 12;
 
 
 	WFIFOHEAD(fd, len);
 	WFIFOHEAD(fd, len);
 	WFIFOW(fd,0) = 0x3850;
 	WFIFOW(fd,0) = 0x3850;
@@ -281,11 +281,11 @@ void mapif_Auction_sendlist(int fd, uint32 char_id, short count, short pages, un
 	WFIFOSET(fd,len);
 	WFIFOSET(fd,len);
 }
 }
 
 
-void mapif_parse_Auction_requestlist(int fd)
+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);
-	int price = RFIFOL(fd,10);
+	int32 price = RFIFOL(fd,10);
 	short type = RFIFOW(fd,8), page = max(1,RFIFOW(fd,14));
 	short 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;
 	short i = 0, j = 0, pages = 1;
@@ -322,9 +322,9 @@ void mapif_parse_Auction_requestlist(int fd)
 	mapif_Auction_sendlist(fd, char_id, j, pages, buf);
 	mapif_Auction_sendlist(fd, char_id, j, pages, buf);
 }
 }
 
 
-void mapif_Auction_register(int fd, struct auction_data *auction)
+void mapif_Auction_register(int32 fd, struct auction_data *auction)
 {
 {
-	int len = sizeof(struct auction_data) + 4;
+	int32 len = sizeof(struct auction_data) + 4;
 
 
 	WFIFOHEAD(fd,len);
 	WFIFOHEAD(fd,len);
 	WFIFOW(fd,0) = 0x3851;
 	WFIFOW(fd,0) = 0x3851;
@@ -333,7 +333,7 @@ void mapif_Auction_register(int fd, struct auction_data *auction)
 	WFIFOSET(fd,len);
 	WFIFOSET(fd,len);
 }
 }
 
 
-void mapif_parse_Auction_register(int fd)
+void mapif_parse_Auction_register(int32 fd)
 {
 {
 	if( RFIFOW(fd,2) != sizeof(struct auction_data) + 4 )
 	if( RFIFOW(fd,2) != sizeof(struct auction_data) + 4 )
 		return;
 		return;
@@ -353,7 +353,7 @@ void mapif_parse_Auction_register(int fd)
 	mapif_Auction_register( fd, auction );
 	mapif_Auction_register( fd, auction );
 }
 }
 
 
-void mapif_Auction_cancel(int fd, uint32 char_id, unsigned char result)
+void mapif_Auction_cancel(int32 fd, uint32 char_id, unsigned char result)
 {
 {
 	WFIFOHEAD(fd,7);
 	WFIFOHEAD(fd,7);
 	WFIFOW(fd,0) = 0x3852;
 	WFIFOW(fd,0) = 0x3852;
@@ -362,7 +362,7 @@ void mapif_Auction_cancel(int fd, uint32 char_id, unsigned char result)
 	WFIFOSET(fd,7);
 	WFIFOSET(fd,7);
 }
 }
 
 
-void mapif_parse_Auction_cancel(int fd)
+void mapif_parse_Auction_cancel(int32 fd)
 {
 {
 	uint32 char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6);
 	uint32 char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6);
 
 
@@ -391,7 +391,7 @@ void mapif_parse_Auction_cancel(int fd)
 	mapif_Auction_cancel(fd, char_id, 0); // The auction has been canceled
 	mapif_Auction_cancel(fd, char_id, 0); // The auction has been canceled
 }
 }
 
 
-void mapif_Auction_close(int fd, uint32 char_id, unsigned char result)
+void mapif_Auction_close(int32 fd, uint32 char_id, unsigned char result)
 {
 {
 	WFIFOHEAD(fd,7);
 	WFIFOHEAD(fd,7);
 	WFIFOW(fd,0) = 0x3853;
 	WFIFOW(fd,0) = 0x3853;
@@ -400,7 +400,7 @@ void mapif_Auction_close(int fd, uint32 char_id, unsigned char result)
 	WFIFOSET(fd,7);
 	WFIFOSET(fd,7);
 }
 }
 
 
-void mapif_parse_Auction_close(int fd)
+void mapif_parse_Auction_close(int32 fd)
 {
 {
 	uint32 char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6);
 	uint32 char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6);
 	std::shared_ptr<struct auction_data> auction = util::umap_find( auction_db, auction_id );
 	std::shared_ptr<struct auction_data> auction = util::umap_find( auction_db, auction_id );
@@ -432,7 +432,7 @@ void mapif_parse_Auction_close(int fd)
 	mapif_Auction_close(fd, char_id, 0); // You have ended the auction
 	mapif_Auction_close(fd, char_id, 0); // You have ended the auction
 }
 }
 
 
-void mapif_Auction_bid(int fd, uint32 char_id, int bid, unsigned char result)
+void mapif_Auction_bid(int32 fd, uint32 char_id, int32 bid, unsigned char result)
 {
 {
 	WFIFOHEAD(fd,11);
 	WFIFOHEAD(fd,11);
 	WFIFOW(fd,0) = 0x3855;
 	WFIFOW(fd,0) = 0x3855;
@@ -442,10 +442,10 @@ void mapif_Auction_bid(int fd, uint32 char_id, int bid, unsigned char result)
 	WFIFOSET(fd,11);
 	WFIFOSET(fd,11);
 }
 }
 
 
-void mapif_parse_Auction_bid(int fd)
+void mapif_parse_Auction_bid(int32 fd)
 {
 {
 	uint32 char_id = RFIFOL(fd,4), auction_id = RFIFOL(fd,8);
 	uint32 char_id = RFIFOL(fd,4), auction_id = RFIFOL(fd,8);
-	int bid = RFIFOL(fd,12);
+	int32 bid = RFIFOL(fd,12);
 	std::shared_ptr<struct auction_data> auction = util::umap_find( auction_db, auction_id );
 	std::shared_ptr<struct auction_data> auction = util::umap_find( auction_db, auction_id );
 
 
 	if( auction == nullptr || auction->price >= bid || auction->seller_id == char_id ){
 	if( auction == nullptr || auction->price >= bid || auction->seller_id == char_id ){
@@ -494,7 +494,7 @@ void mapif_parse_Auction_bid(int fd)
 /*==========================================
 /*==========================================
  * Packets From Map Server
  * Packets From Map Server
  *------------------------------------------*/
  *------------------------------------------*/
-int inter_auction_parse_frommap(int fd)
+int32 inter_auction_parse_frommap(int32 fd)
 {
 {
 	switch(RFIFOW(fd,0))
 	switch(RFIFOW(fd,0))
 	{
 	{
@@ -509,7 +509,7 @@ int inter_auction_parse_frommap(int fd)
 	return 1;
 	return 1;
 }
 }
 
 
-int inter_auction_sql_init(void)
+int32 inter_auction_sql_init(void)
 {
 {
 	inter_auctions_fromsql();
 	inter_auctions_fromsql();
 
 

+ 4 - 2
src/char/int_auction.hpp

@@ -4,9 +4,11 @@
 #ifndef INT_AUCTION_HPP
 #ifndef INT_AUCTION_HPP
 #define INT_AUCTION_HPP
 #define INT_AUCTION_HPP
 
 
-int inter_auction_parse_frommap(int fd);
+#include <common/cbasetypes.hpp>
 
 
-int inter_auction_sql_init(void);
+int32 inter_auction_parse_frommap(int32 fd);
+
+int32 inter_auction_sql_init(void);
 void inter_auction_sql_final(void);
 void inter_auction_sql_final(void);
 
 
 #endif /* INT_AUCTION_HPP */
 #endif /* INT_AUCTION_HPP */

+ 12 - 12
src/char/int_clan.cpp

@@ -20,12 +20,12 @@
 #include "char_mapif.hpp"
 #include "char_mapif.hpp"
 #include "inter.hpp"
 #include "inter.hpp"
 
 
-// int clan_id -> struct clan*
+// int32 clan_id -> struct clan*
 static std::unordered_map<int32, std::shared_ptr<struct clan>> clan_db;
 static std::unordered_map<int32, std::shared_ptr<struct clan>> clan_db;
 
 
 using namespace rathena;
 using namespace rathena;
 
 
-int inter_clan_removemember_tosql(uint32 account_id, uint32 char_id){
+int32 inter_clan_removemember_tosql(uint32 account_id, uint32 char_id){
 	if( SQL_ERROR == Sql_Query( sql_handle, "UPDATE `%s` SET `clan_id` = '0' WHERE `char_id` = '%d'", schema_config.char_db, char_id ) ){
 	if( SQL_ERROR == Sql_Query( sql_handle, "UPDATE `%s` SET `clan_id` = '0' WHERE `char_id` = '%d'", schema_config.char_db, char_id ) ){
 		Sql_ShowDebug( sql_handle );
 		Sql_ShowDebug( sql_handle );
 		return 1;
 		return 1;
@@ -34,10 +34,10 @@ int inter_clan_removemember_tosql(uint32 account_id, uint32 char_id){
 	}
 	}
 }
 }
 
 
-std::shared_ptr<struct clan> inter_clan_fromsql(int clan_id){
+std::shared_ptr<struct clan> inter_clan_fromsql(int32 clan_id){
 	char* data;
 	char* data;
 	size_t len;
 	size_t len;
-	int i;
+	int32 i;
 
 
 	if( clan_id <= 0 )
 	if( clan_id <= 0 )
 		return nullptr;
 		return nullptr;
@@ -98,7 +98,7 @@ std::shared_ptr<struct clan> inter_clan_fromsql(int clan_id){
 	return clan;
 	return clan;
 }
 }
 
 
-int mapif_clan_info( int fd ){
+int32 mapif_clan_info( int32 fd ){
 	size_t offset = 4;
 	size_t offset = 4;
 	size_t length = offset + clan_db.size() * sizeof( struct clan );
 	size_t length = offset + clan_db.size() * sizeof( struct clan );
 
 
@@ -118,13 +118,13 @@ int mapif_clan_info( int fd ){
 	return 0;
 	return 0;
 }
 }
 
 
-static int mapif_parse_clan_request( int fd ){
+static int32 mapif_parse_clan_request( int32 fd ){
 	mapif_clan_info( fd );
 	mapif_clan_info( fd );
 
 
 	return 0;
 	return 0;
 }
 }
 
 
-static int mapif_parse_clan_message( int fd ){
+static int32 mapif_parse_clan_message( int32 fd ){
 	unsigned char buf[500];
 	unsigned char buf[500];
 	uint16 len;
 	uint16 len;
 
 
@@ -138,7 +138,7 @@ static int mapif_parse_clan_message( int fd ){
 	return 0;
 	return 0;
 }
 }
 
 
-static void mapif_clan_refresh_onlinecount( int fd, std::shared_ptr<struct clan> clan ){
+static void mapif_clan_refresh_onlinecount( int32 fd, std::shared_ptr<struct clan> clan ){
 	unsigned char buf[8];
 	unsigned char buf[8];
 
 
 	WBUFW(buf,0) = 0x38A2;
 	WBUFW(buf,0) = 0x38A2;
@@ -148,7 +148,7 @@ static void mapif_clan_refresh_onlinecount( int fd, std::shared_ptr<struct clan>
 	chmapif_sendallwos( fd, buf, 8 );
 	chmapif_sendallwos( fd, buf, 8 );
 }
 }
 
 
-static void mapif_parse_clan_member_left( int fd ){
+static void mapif_parse_clan_member_left( int32 fd ){
 	std::shared_ptr<struct clan> clan = util::umap_find( clan_db, static_cast<int32>( RFIFOL( fd, 2 ) ) );
 	std::shared_ptr<struct clan> clan = util::umap_find( clan_db, static_cast<int32>( RFIFOL( fd, 2 ) ) );
 
 
 	// Unknown clan
 	// Unknown clan
@@ -163,7 +163,7 @@ static void mapif_parse_clan_member_left( int fd ){
 	}
 	}
 }
 }
 
 
-static void mapif_parse_clan_member_joined( int fd ){
+static void mapif_parse_clan_member_joined( int32 fd ){
 	std::shared_ptr<struct clan> clan = util::umap_find( clan_db, static_cast<int32>( RFIFOL( fd, 2 ) ) );
 	std::shared_ptr<struct clan> clan = util::umap_find( clan_db, static_cast<int32>( RFIFOL( fd, 2 ) ) );
 
 
 	// Unknown clan
 	// Unknown clan
@@ -183,7 +183,7 @@ static void mapif_parse_clan_member_joined( int fd ){
 // Must Return
 // Must Return
 //	1 : ok
 //	1 : ok
 //  0 : error
 //  0 : error
-int inter_clan_parse_frommap( int fd ){
+int32 inter_clan_parse_frommap( int32 fd ){
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	switch(RFIFOW(fd,0)) {
 	switch(RFIFOW(fd,0)) {
 		case 0x30A0:
 		case 0x30A0:
@@ -204,7 +204,7 @@ int inter_clan_parse_frommap( int fd ){
 }
 }
 
 
 // Initialize clan sql
 // Initialize clan sql
-int inter_clan_init(void){
+int32 inter_clan_init(void){
 	if( SQL_ERROR == Sql_Query( sql_handle, "SELECT `clan_id` FROM `%s`", schema_config.clan_table ) ){
 	if( SQL_ERROR == Sql_Query( sql_handle, "SELECT `clan_id` FROM `%s`", schema_config.clan_table ) ){
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
 		return 1;
 		return 1;

+ 4 - 2
src/char/int_clan.hpp

@@ -4,8 +4,10 @@
 #ifndef INT_CLAN_HPP
 #ifndef INT_CLAN_HPP
 #define INT_CLAN_HPP
 #define INT_CLAN_HPP
 
 
-int inter_clan_parse_frommap( int fd );
-int inter_clan_init(void);
+#include <common/cbasetypes.hpp>
+
+int32 inter_clan_parse_frommap( int32 fd );
+int32 inter_clan_init(void);
 void inter_clan_final(void);
 void inter_clan_final(void);
 
 
 #endif /* INT_CLAN_HPP */
 #endif /* INT_CLAN_HPP */

+ 11 - 11
src/char/int_elemental.cpp

@@ -42,7 +42,7 @@ bool mapif_elemental_save(struct s_elemental* ele) {
 	return flag;
 	return flag;
 }
 }
 
 
-bool mapif_elemental_load(int ele_id, uint32 char_id, struct s_elemental *ele) {
+bool mapif_elemental_load(int32 ele_id, uint32 char_id, struct s_elemental *ele) {
 	char* data;
 	char* data;
 
 
 	memset(ele, 0, sizeof(struct s_elemental));
 	memset(ele, 0, sizeof(struct s_elemental));
@@ -83,7 +83,7 @@ bool mapif_elemental_load(int ele_id, uint32 char_id, struct s_elemental *ele) {
 	return true;
 	return true;
 }
 }
 
 
-bool mapif_elemental_delete(int ele_id) {
+bool mapif_elemental_delete(int32 ele_id) {
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `ele_id` = '%d'", schema_config.elemental_db, ele_id) ) {
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `ele_id` = '%d'", schema_config.elemental_db, ele_id) ) {
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
 		return false;
 		return false;
@@ -92,8 +92,8 @@ bool mapif_elemental_delete(int ele_id) {
 	return true;
 	return true;
 }
 }
 
 
-void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) {
-	int size = sizeof(struct s_elemental) + 5;
+void mapif_elemental_send(int32 fd, struct s_elemental *ele, unsigned char flag) {
+	int32 size = sizeof(struct s_elemental) + 5;
 
 
 	WFIFOHEAD(fd,size);
 	WFIFOHEAD(fd,size);
 	WFIFOW(fd,0) = 0x387c;
 	WFIFOW(fd,0) = 0x387c;
@@ -103,37 +103,37 @@ void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) {
 	WFIFOSET(fd,size);
 	WFIFOSET(fd,size);
 }
 }
 
 
-void mapif_parse_elemental_create(int fd, struct s_elemental* ele) {
+void mapif_parse_elemental_create(int32 fd, struct s_elemental* ele) {
 	bool result = mapif_elemental_save(ele);
 	bool result = mapif_elemental_save(ele);
 	mapif_elemental_send(fd, ele, result);
 	mapif_elemental_send(fd, ele, result);
 }
 }
 
 
-void mapif_parse_elemental_load(int fd, int ele_id, uint32 char_id) {
+void mapif_parse_elemental_load(int32 fd, int32 ele_id, uint32 char_id) {
 	struct s_elemental ele;
 	struct s_elemental ele;
 	bool result = mapif_elemental_load(ele_id, char_id, &ele);
 	bool result = mapif_elemental_load(ele_id, char_id, &ele);
 	mapif_elemental_send(fd, &ele, result);
 	mapif_elemental_send(fd, &ele, result);
 }
 }
 
 
-void mapif_elemental_deleted(int fd, unsigned char flag) {
+void mapif_elemental_deleted(int32 fd, unsigned char flag) {
 	WFIFOHEAD(fd,3);
 	WFIFOHEAD(fd,3);
 	WFIFOW(fd,0) = 0x387d;
 	WFIFOW(fd,0) = 0x387d;
 	WFIFOB(fd,2) = flag;
 	WFIFOB(fd,2) = flag;
 	WFIFOSET(fd,3);
 	WFIFOSET(fd,3);
 }
 }
 
 
-void mapif_parse_elemental_delete(int fd, int ele_id) {
+void mapif_parse_elemental_delete(int32 fd, int32 ele_id) {
 	bool result = mapif_elemental_delete(ele_id);
 	bool result = mapif_elemental_delete(ele_id);
 	mapif_elemental_deleted(fd, result);
 	mapif_elemental_deleted(fd, result);
 }
 }
 
 
-void mapif_elemental_saved(int fd, unsigned char flag) {
+void mapif_elemental_saved(int32 fd, unsigned char flag) {
 	WFIFOHEAD(fd,3);
 	WFIFOHEAD(fd,3);
 	WFIFOW(fd,0) = 0x387e;
 	WFIFOW(fd,0) = 0x387e;
 	WFIFOB(fd,2) = flag;
 	WFIFOB(fd,2) = flag;
 	WFIFOSET(fd,3);
 	WFIFOSET(fd,3);
 }
 }
 
 
-void mapif_parse_elemental_save(int fd, struct s_elemental* ele) {
+void mapif_parse_elemental_save(int32 fd, struct s_elemental* ele) {
 	bool result = mapif_elemental_save(ele);
 	bool result = mapif_elemental_save(ele);
 	mapif_elemental_saved(fd, result);
 	mapif_elemental_saved(fd, result);
 }
 }
@@ -148,7 +148,7 @@ void inter_elemental_sql_final(void) {
 /*==========================================
 /*==========================================
  * Inter Packets
  * Inter Packets
  *------------------------------------------*/
  *------------------------------------------*/
-int inter_elemental_parse_frommap(int fd) {
+int32 inter_elemental_parse_frommap(int32 fd) {
 	unsigned short cmd = RFIFOW(fd,0);
 	unsigned short cmd = RFIFOW(fd,0);
 
 
 	switch( cmd ) {
 	switch( cmd ) {

+ 4 - 2
src/char/int_elemental.hpp

@@ -4,12 +4,14 @@
 #ifndef INT_ELEMENTAL_HPP
 #ifndef INT_ELEMENTAL_HPP
 #define INT_ELEMENTAL_HPP
 #define INT_ELEMENTAL_HPP
 
 
+#include <common/cbasetypes.hpp>
+
 struct s_elemental;
 struct s_elemental;
 
 
 void inter_elemental_sql_init(void);
 void inter_elemental_sql_init(void);
 void inter_elemental_sql_final(void);
 void inter_elemental_sql_final(void);
-int inter_elemental_parse_frommap(int fd);
+int32 inter_elemental_parse_frommap(int32 fd);
 
 
-bool mapif_elemental_delete(int ele_id);
+bool mapif_elemental_delete(int32 ele_id);
 
 
 #endif /* INT_ELEMENTAL_HPP */
 #endif /* INT_ELEMENTAL_HPP */

+ 91 - 91
src/char/int_guild.cpp

@@ -35,22 +35,22 @@ using namespace rathena;
 
 
 static const char dataToHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
 static const char dataToHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
 
 
-// int guild_id -> CharGuild*
+// int32 guild_id -> CharGuild*
 static std::unordered_map<int32, std::shared_ptr<CharGuild>> guild_db;
 static std::unordered_map<int32, std::shared_ptr<CharGuild>> guild_db;
 static std::unordered_map<int32, std::shared_ptr<struct guild_castle>> castle_db;
 static std::unordered_map<int32, std::shared_ptr<struct guild_castle>> castle_db;
 
 
-int mapif_parse_GuildLeave(int fd,int guild_id,uint32 account_id,uint32 char_id,int flag,const char *mes);
-int mapif_guild_broken(int guild_id,int flag);
+int32 mapif_parse_GuildLeave(int32 fd,int32 guild_id,uint32 account_id,uint32 char_id,int32 flag,const char *mes);
+int32 mapif_guild_broken(int32 guild_id,int32 flag);
 bool guild_check_empty( std::shared_ptr<CharGuild> g );
 bool guild_check_empty( std::shared_ptr<CharGuild> g );
-int guild_calcinfo( std::shared_ptr<CharGuild> g );
-int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len);
-int mapif_guild_info( int fd, const struct mmo_guild &g );
-int inter_guild_tosql( mmo_guild &g, int flag );
-int guild_checkskill( std::shared_ptr<CharGuild> g, int id );
+int32 guild_calcinfo( std::shared_ptr<CharGuild> g );
+int32 mapif_guild_basicinfochanged(int32 guild_id,int32 type,const void *data,int32 len);
+int32 mapif_guild_info( int32 fd, const struct mmo_guild &g );
+int32 inter_guild_tosql( mmo_guild &g, int32 flag );
+int32 guild_checkskill( std::shared_ptr<CharGuild> g, int32 id );
 
 
 TIMER_FUNC(guild_save_timer){
 TIMER_FUNC(guild_save_timer){
-	static int last_id = 0; //To know in which guild we were.
-	int state = 0; //0: Have not reached last guild. 1: Reached last guild, ready for save. 2: Some guild saved, don't do further saving.
+	static int32 last_id = 0; //To know in which guild we were.
+	int32 state = 0; //0: Have not reached last guild. 1: Reached last guild, ready for save. 2: Some guild saved, don't do further saving.
 
 
 	if( last_id == 0 ) //Save the first guild in the list.
 	if( last_id == 0 ) //Save the first guild in the list.
 		state = 1;
 		state = 1;
@@ -91,7 +91,7 @@ TIMER_FUNC(guild_save_timer){
 	return 0;
 	return 0;
 }
 }
 
 
-int inter_guild_removemember_tosql(uint32 char_id)
+int32 inter_guild_removemember_tosql(uint32 char_id)
 {
 {
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE from `%s` where `char_id` = '%d'", schema_config.guild_member_db, char_id) )
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE from `%s` where `char_id` = '%d'", schema_config.guild_member_db, char_id) )
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
@@ -101,7 +101,7 @@ int inter_guild_removemember_tosql(uint32 char_id)
 }
 }
 
 
 // Save mmo_guild into sql
 // Save mmo_guild into sql
-int inter_guild_tosql( mmo_guild &g, int flag ){
+int32 inter_guild_tosql( mmo_guild &g, int32 flag ){
 	// Table guild (GS_BASIC_MASK)
 	// Table guild (GS_BASIC_MASK)
 	// GS_EMBLEM `emblem_len`,`emblem_id`,`emblem_data`
 	// GS_EMBLEM `emblem_len`,`emblem_id`,`emblem_data`
 	// GS_CONNECT `connect_member`,`average_lv`
 	// GS_CONNECT `connect_member`,`average_lv`
@@ -121,7 +121,7 @@ int inter_guild_tosql( mmo_guild &g, int flag ){
 	char esc_name[NAME_LENGTH*2+1];
 	char esc_name[NAME_LENGTH*2+1];
 	char esc_master[NAME_LENGTH*2+1];
 	char esc_master[NAME_LENGTH*2+1];
 	char new_guild = 0;
 	char new_guild = 0;
-	int i=0;
+	int32 i=0;
 
 
 	if (g.guild_id<=0 && g.guild_id != -1) return 0;
 	if (g.guild_id<=0 && g.guild_id != -1) return 0;
 
 
@@ -337,7 +337,7 @@ std::shared_ptr<CharGuild> inter_guild_fromsql( int32 guild_id ){
 	char* data;
 	char* data;
 	size_t len;
 	size_t len;
 	char* p;
 	char* p;
-	int i;
+	int32 i;
 
 
 	if( guild_id <= 0 ){
 	if( guild_id <= 0 ){
 		return nullptr;
 		return nullptr;
@@ -458,7 +458,7 @@ std::shared_ptr<CharGuild> inter_guild_fromsql( int32 guild_id ){
 	}
 	}
 	while( SQL_SUCCESS == Sql_NextRow(sql_handle) )
 	while( SQL_SUCCESS == Sql_NextRow(sql_handle) )
 	{
 	{
-		int position;
+		int32 position;
 		struct guild_position* gpos;
 		struct guild_position* gpos;
 
 
 		Sql_GetData(sql_handle, 0, &data, nullptr); position = atoi(data);
 		Sql_GetData(sql_handle, 0, &data, nullptr); position = atoi(data);
@@ -516,7 +516,7 @@ std::shared_ptr<CharGuild> inter_guild_fromsql( int32 guild_id ){
 
 
 	while( SQL_SUCCESS == Sql_NextRow(sql_handle) )
 	while( SQL_SUCCESS == Sql_NextRow(sql_handle) )
 	{
 	{
-		int id;
+		int32 id;
 		Sql_GetData(sql_handle, 0, &data, nullptr); id = atoi(data) - GD_SKILLBASE;
 		Sql_GetData(sql_handle, 0, &data, nullptr); id = atoi(data) - GD_SKILLBASE;
 		if( id < 0 || id >= MAX_GUILDSKILL )
 		if( id < 0 || id >= MAX_GUILDSKILL )
 			continue;// invalid guild skill
 			continue;// invalid guild skill
@@ -541,7 +541,7 @@ std::shared_ptr<CharGuild> inter_guild_fromsql( int32 guild_id ){
  * @param guild_id: Guild ID to search
  * @param guild_id: Guild ID to search
  * @return Guild storage max size
  * @return Guild storage max size
  */
  */
-uint16 inter_guild_storagemax(int guild_id)
+uint16 inter_guild_storagemax(int32 guild_id)
 {
 {
 #ifdef OFFICIAL_GUILD_STORAGE
 #ifdef OFFICIAL_GUILD_STORAGE
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
@@ -563,9 +563,9 @@ uint16 inter_guild_storagemax(int guild_id)
 }
 }
 
 
 // `guild_castle` (`castle_id`, `guild_id`, `economy`, `defense`, `triggerE`, `triggerD`, `nextTime`, `payTime`, `createTime`, `visibleC`, `visibleG0`, `visibleG1`, `visibleG2`, `visibleG3`, `visibleG4`, `visibleG5`, `visibleG6`, `visibleG7`)
 // `guild_castle` (`castle_id`, `guild_id`, `economy`, `defense`, `triggerE`, `triggerD`, `nextTime`, `payTime`, `createTime`, `visibleC`, `visibleG0`, `visibleG1`, `visibleG2`, `visibleG3`, `visibleG4`, `visibleG5`, `visibleG6`, `visibleG7`)
-int inter_guildcastle_tosql( std::shared_ptr<struct guild_castle> gc ){
+int32 inter_guildcastle_tosql( std::shared_ptr<struct guild_castle> gc ){
 	StringBuf buf;
 	StringBuf buf;
-	int i;
+	int32 i;
 
 
 	StringBuf_Init(&buf);
 	StringBuf_Init(&buf);
 	StringBuf_Printf(&buf, "REPLACE INTO `%s` SET `castle_id`='%d', `guild_id`='%d', `economy`='%d', `defense`='%d', "
 	StringBuf_Printf(&buf, "REPLACE INTO `%s` SET `castle_id`='%d', `guild_id`='%d', `economy`='%d', `defense`='%d', "
@@ -585,9 +585,9 @@ int inter_guildcastle_tosql( std::shared_ptr<struct guild_castle> gc ){
 }
 }
 
 
 // Read guild_castle from SQL
 // Read guild_castle from SQL
-std::shared_ptr<struct guild_castle> inter_guildcastle_fromsql( int castle_id ){
+std::shared_ptr<struct guild_castle> inter_guildcastle_fromsql( int32 castle_id ){
 	char *data;
 	char *data;
-	int i;
+	int32 i;
 	StringBuf buf;
 	StringBuf buf;
 
 
 	std::shared_ptr<struct guild_castle> gc = util::umap_find( castle_db, castle_id );
 	std::shared_ptr<struct guild_castle> gc = util::umap_find( castle_db, castle_id );
@@ -638,9 +638,9 @@ std::shared_ptr<struct guild_castle> inter_guildcastle_fromsql( int castle_id ){
 }
 }
 
 
 
 
-int inter_guild_CharOnline(uint32 char_id, int guild_id)
+int32 inter_guild_CharOnline(uint32 char_id, int32 guild_id)
 {
 {
-	int i;
+	int32 i;
 
 
 	if (guild_id == -1) {
 	if (guild_id == -1) {
 		//Get guild_id from the database
 		//Get guild_id from the database
@@ -688,9 +688,9 @@ int inter_guild_CharOnline(uint32 char_id, int guild_id)
 	return 1;
 	return 1;
 }
 }
 
 
-int inter_guild_CharOffline(uint32 char_id, int guild_id)
+int32 inter_guild_CharOffline(uint32 char_id, int32 guild_id)
 {
 {
-	int online_count, i;
+	int32 online_count, i;
 
 
 	if (guild_id == -1)
 	if (guild_id == -1)
 	{
 	{
@@ -824,9 +824,9 @@ void inter_guild_sql_final(void)
 }
 }
 
 
 // Get guild_id by its name. Returns 0 if not found, -1 on error.
 // Get guild_id by its name. Returns 0 if not found, -1 on error.
-int search_guildname(char *str)
+int32 search_guildname(char *str)
 {
 {
-	int guild_id;
+	int32 guild_id;
 	char esc_name[NAME_LENGTH*2+1];
 	char esc_name[NAME_LENGTH*2+1];
 
 
 	Sql_EscapeStringLen(sql_handle, esc_name, str, safestrnlen(str, NAME_LENGTH));
 	Sql_EscapeStringLen(sql_handle, esc_name, str, safestrnlen(str, NAME_LENGTH));
@@ -854,7 +854,7 @@ int search_guildname(char *str)
 
 
 // Check if guild is empty
 // Check if guild is empty
 bool guild_check_empty( std::shared_ptr<CharGuild> g ){
 bool guild_check_empty( std::shared_ptr<CharGuild> g ){
-	int i;
+	int32 i;
 	ARR_FIND( 0, g->guild.max_member, i, g->guild.member[i].account_id > 0 );
 	ARR_FIND( 0, g->guild.max_member, i, g->guild.member[i].account_id > 0 );
 	//Let the calling function handle the guild removal in case they need
 	//Let the calling function handle the guild removal in case they need
 	//to do something else with it before freeing the data. [Skotlex]
 	//to do something else with it before freeing the data. [Skotlex]
@@ -867,13 +867,13 @@ t_exp GuildExpDatabase::get_nextexp(uint16 level) {
 	return ((guild_exp == nullptr) ? 0 : guild_exp->exp);
 	return ((guild_exp == nullptr) ? 0 : guild_exp->exp);
 }
 }
 
 
-int guild_checkskill( std::shared_ptr<CharGuild> g, int id ){
-	int idx = id - GD_SKILLBASE;
+int32 guild_checkskill( std::shared_ptr<CharGuild> g, int32 id ){
+	int32 idx = id - GD_SKILLBASE;
 	return idx < 0 || idx >= MAX_GUILDSKILL ? 0 : g->guild.skill[idx].lv;
 	return idx < 0 || idx >= MAX_GUILDSKILL ? 0 : g->guild.skill[idx].lv;
 }
 }
 
 
-int guild_calcinfo( std::shared_ptr<CharGuild> g ){
-	int i,c;
+int32 guild_calcinfo( std::shared_ptr<CharGuild> g ){
+	int32 i,c;
 	struct mmo_guild before = g->guild; // Save guild current values
 	struct mmo_guild before = g->guild; // Save guild current values
 
 
 	if(g->guild.guild_lv<=0)
 	if(g->guild.guild_lv<=0)
@@ -934,7 +934,7 @@ int guild_calcinfo( std::shared_ptr<CharGuild> g ){
 //-------------------------------------------------------------------
 //-------------------------------------------------------------------
 // Packet sent to map server
 // Packet sent to map server
 
 
-int mapif_guild_created( int fd, uint32 account_id, struct mmo_guild *g ){
+int32 mapif_guild_created( int32 fd, uint32 account_id, struct mmo_guild *g ){
 	WFIFOHEAD(fd, 10);
 	WFIFOHEAD(fd, 10);
 	WFIFOW(fd,0)=0x3830;
 	WFIFOW(fd,0)=0x3830;
 	WFIFOL(fd,2)=account_id;
 	WFIFOL(fd,2)=account_id;
@@ -950,7 +950,7 @@ int mapif_guild_created( int fd, uint32 account_id, struct mmo_guild *g ){
 }
 }
 
 
 // Guild not found
 // Guild not found
-int mapif_guild_noinfo(int fd,int guild_id)
+int32 mapif_guild_noinfo(int32 fd,int32 guild_id)
 {
 {
 	unsigned char buf[12];
 	unsigned char buf[12];
 	WBUFW(buf,0)=0x3831;
 	WBUFW(buf,0)=0x3831;
@@ -965,7 +965,7 @@ int mapif_guild_noinfo(int fd,int guild_id)
 }
 }
 
 
 // Send guild info
 // Send guild info
-int mapif_guild_info( int fd, const struct mmo_guild &g ){
+int32 mapif_guild_info( int32 fd, const struct mmo_guild &g ){
 	unsigned char buf[8+sizeof(struct mmo_guild)];
 	unsigned char buf[8+sizeof(struct mmo_guild)];
 	WBUFW(buf,0)=0x3831;
 	WBUFW(buf,0)=0x3831;
 	WBUFW(buf,2)=4+sizeof(struct mmo_guild);
 	WBUFW(buf,2)=4+sizeof(struct mmo_guild);
@@ -978,7 +978,7 @@ int mapif_guild_info( int fd, const struct mmo_guild &g ){
 }
 }
 
 
 // ACK member add
 // ACK member add
-int mapif_guild_memberadded(int fd,int guild_id,uint32 account_id,uint32 char_id,int flag)
+int32 mapif_guild_memberadded(int32 fd,int32 guild_id,uint32 account_id,uint32 char_id,int32 flag)
 {
 {
 	WFIFOHEAD(fd, 15);
 	WFIFOHEAD(fd, 15);
 	WFIFOW(fd,0)=0x3832;
 	WFIFOW(fd,0)=0x3832;
@@ -991,7 +991,7 @@ int mapif_guild_memberadded(int fd,int guild_id,uint32 account_id,uint32 char_id
 }
 }
 
 
 // ACK member leave
 // ACK member leave
-int mapif_guild_withdraw(int guild_id,uint32 account_id,uint32 char_id,int flag, const char *name, const char *mes)
+int32 mapif_guild_withdraw(int32 guild_id,uint32 account_id,uint32 char_id,int32 flag, const char *name, const char *mes)
 {
 {
 	unsigned char buf[55+NAME_LENGTH];
 	unsigned char buf[55+NAME_LENGTH];
 	WBUFW(buf, 0)=0x3834;
 	WBUFW(buf, 0)=0x3834;
@@ -1007,7 +1007,7 @@ int mapif_guild_withdraw(int guild_id,uint32 account_id,uint32 char_id,int flag,
 }
 }
 
 
 // Send short member's info
 // Send short member's info
-int mapif_guild_memberinfoshort( const struct mmo_guild &g, int idx ){
+int32 mapif_guild_memberinfoshort( const struct mmo_guild &g, int32 idx ){
 	unsigned char buf[19];
 	unsigned char buf[19];
 	WBUFW(buf, 0)=0x3835;
 	WBUFW(buf, 0)=0x3835;
 	WBUFL(buf, 2)=g.guild_id;
 	WBUFL(buf, 2)=g.guild_id;
@@ -1021,7 +1021,7 @@ int mapif_guild_memberinfoshort( const struct mmo_guild &g, int idx ){
 }
 }
 
 
 // Send guild broken
 // Send guild broken
-int mapif_guild_broken(int guild_id,int flag)
+int32 mapif_guild_broken(int32 guild_id,int32 flag)
 {
 {
 	unsigned char buf[7];
 	unsigned char buf[7];
 	WBUFW(buf,0)=0x3836;
 	WBUFW(buf,0)=0x3836;
@@ -1033,7 +1033,7 @@ int mapif_guild_broken(int guild_id,int flag)
 }
 }
 
 
 // Send guild message
 // Send guild message
-int mapif_guild_message(int guild_id,uint32 account_id,char *mes,int len, int sfd)
+int32 mapif_guild_message(int32 guild_id,uint32 account_id,char *mes,int32 len, int32 sfd)
 {
 {
 	unsigned char buf[512];
 	unsigned char buf[512];
 	if (len > 500)
 	if (len > 500)
@@ -1048,7 +1048,7 @@ int mapif_guild_message(int guild_id,uint32 account_id,char *mes,int len, int sf
 }
 }
 
 
 // Send basic info
 // Send basic info
-int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len)
+int32 mapif_guild_basicinfochanged(int32 guild_id,int32 type,const void *data,int32 len)
 {
 {
 	unsigned char buf[2048];
 	unsigned char buf[2048];
 	if (len > 2038)
 	if (len > 2038)
@@ -1063,7 +1063,7 @@ int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len)
 }
 }
 
 
 // Send member info
 // Send member info
-int mapif_guild_memberinfochanged(int guild_id,uint32 account_id,uint32 char_id, int type,const void *data,int len)
+int32 mapif_guild_memberinfochanged(int32 guild_id,uint32 account_id,uint32 char_id, int32 type,const void *data,int32 len)
 {
 {
 	unsigned char buf[2048];
 	unsigned char buf[2048];
 	if (len > 2030)
 	if (len > 2030)
@@ -1080,7 +1080,7 @@ int mapif_guild_memberinfochanged(int guild_id,uint32 account_id,uint32 char_id,
 }
 }
 
 
 // ACK guild skill up
 // ACK guild skill up
-int mapif_guild_skillupack(int guild_id,uint16 skill_id,uint32 account_id)
+int32 mapif_guild_skillupack(int32 guild_id,uint16 skill_id,uint32 account_id)
 {
 {
 	unsigned char buf[14];
 	unsigned char buf[14];
 	WBUFW(buf, 0)=0x383c;
 	WBUFW(buf, 0)=0x383c;
@@ -1092,7 +1092,7 @@ int mapif_guild_skillupack(int guild_id,uint16 skill_id,uint32 account_id)
 }
 }
 
 
 // ACK guild alliance
 // ACK guild alliance
-int mapif_guild_alliance(int guild_id1,int guild_id2,uint32 account_id1,uint32 account_id2,int flag,const char *name1,const char *name2)
+int32 mapif_guild_alliance(int32 guild_id1,int32 guild_id2,uint32 account_id1,uint32 account_id2,int32 flag,const char *name1,const char *name2)
 {
 {
 	unsigned char buf[19+2*NAME_LENGTH];
 	unsigned char buf[19+2*NAME_LENGTH];
 	WBUFW(buf, 0)=0x383d;
 	WBUFW(buf, 0)=0x383d;
@@ -1108,7 +1108,7 @@ int mapif_guild_alliance(int guild_id1,int guild_id2,uint32 account_id1,uint32 a
 }
 }
 
 
 // Send a guild position desc
 // Send a guild position desc
-int mapif_guild_position( const struct mmo_guild &g, int idx ){
+int32 mapif_guild_position( const struct mmo_guild &g, int32 idx ){
 	unsigned char buf[12 + sizeof(struct guild_position)];
 	unsigned char buf[12 + sizeof(struct guild_position)];
 	WBUFW(buf,0)=0x383b;
 	WBUFW(buf,0)=0x383b;
 	WBUFW(buf,2)=sizeof(struct guild_position)+12;
 	WBUFW(buf,2)=sizeof(struct guild_position)+12;
@@ -1120,7 +1120,7 @@ int mapif_guild_position( const struct mmo_guild &g, int idx ){
 }
 }
 
 
 // Send the guild notice
 // Send the guild notice
-int mapif_guild_notice( const struct mmo_guild &g ){
+int32 mapif_guild_notice( const struct mmo_guild &g ){
 	unsigned char buf[256];
 	unsigned char buf[256];
 	WBUFW(buf,0)=0x383e;
 	WBUFW(buf,0)=0x383e;
 	WBUFL(buf,2)=g.guild_id;
 	WBUFL(buf,2)=g.guild_id;
@@ -1131,7 +1131,7 @@ int mapif_guild_notice( const struct mmo_guild &g ){
 }
 }
 
 
 // Send emblem data
 // Send emblem data
-int mapif_guild_emblem( const struct mmo_guild &g ){
+int32 mapif_guild_emblem( const struct mmo_guild &g ){
 	unsigned char buf[12 + sizeof(g.emblem_data)];
 	unsigned char buf[12 + sizeof(g.emblem_data)];
 	WBUFW(buf,0)=0x383f;
 	WBUFW(buf,0)=0x383f;
 	WBUFW(buf,2)=g.emblem_len+12;
 	WBUFW(buf,2)=g.emblem_len+12;
@@ -1143,7 +1143,7 @@ int mapif_guild_emblem( const struct mmo_guild &g ){
 }
 }
 
 
 // Send the guild emblem_id (version)
 // Send the guild emblem_id (version)
-int mapif_guild_emblem_version( const struct mmo_guild &g ){
+int32 mapif_guild_emblem_version( const struct mmo_guild &g ){
 	unsigned char buf[10];
 	unsigned char buf[10];
 	WBUFW(buf, 0) = 0x3841;
 	WBUFW(buf, 0) = 0x3841;
 	WBUFL(buf, 2) = g.guild_id;
 	WBUFL(buf, 2) = g.guild_id;
@@ -1153,7 +1153,7 @@ int mapif_guild_emblem_version( const struct mmo_guild &g ){
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_guild_master_changed( const struct mmo_guild &g, int aid, int cid, time_t time ){
+int32 mapif_guild_master_changed( const struct mmo_guild &g, int32 aid, int32 cid, time_t time ){
 	unsigned char buf[18];
 	unsigned char buf[18];
 	WBUFW(buf,0)=0x3843;
 	WBUFW(buf,0)=0x3843;
 	WBUFL(buf,2)=g.guild_id;
 	WBUFL(buf,2)=g.guild_id;
@@ -1164,11 +1164,11 @@ int mapif_guild_master_changed( const struct mmo_guild &g, int aid, int cid, tim
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_guild_castle_dataload(int fd, int sz, int *castle_ids)
+int32 mapif_guild_castle_dataload(int32 fd, int32 sz, int32 *castle_ids)
 {
 {
-	int num = (sz - 4) / sizeof(int);
-	int len = 4 + num * sizeof( struct guild_castle );
-	int i;
+	int32 num = (sz - 4) / sizeof(int);
+	int32 len = 4 + num * sizeof( struct guild_castle );
+	int32 i;
 
 
 	WFIFOHEAD(fd, len);
 	WFIFOHEAD(fd, len);
 	WFIFOW(fd, 0) = 0x3840;
 	WFIFOW(fd, 0) = 0x3840;
@@ -1186,9 +1186,9 @@ int mapif_guild_castle_dataload(int fd, int sz, int *castle_ids)
 
 
 
 
 // Guild creation request
 // Guild creation request
-int mapif_parse_CreateGuild(int fd,uint32 account_id,char *name,struct guild_member *master)
+int32 mapif_parse_CreateGuild(int32 fd,uint32 account_id,char *name,struct guild_member *master)
 {
 {
-	int i=0;
+	int32 i=0;
 #ifdef NOISY
 #ifdef NOISY
 	ShowInfo("Creating Guild (%s)\n", name);
 	ShowInfo("Creating Guild (%s)\n", name);
 #endif
 #endif
@@ -1262,7 +1262,7 @@ int mapif_parse_CreateGuild(int fd,uint32 account_id,char *name,struct guild_mem
 }
 }
 
 
 // Return guild info to client
 // Return guild info to client
-int mapif_parse_GuildInfo(int fd,int guild_id)
+int32 mapif_parse_GuildInfo(int32 fd,int32 guild_id)
 {
 {
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1275,7 +1275,7 @@ int mapif_parse_GuildInfo(int fd,int guild_id)
 }
 }
 
 
 // Add member to guild
 // Add member to guild
-int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m)
+int32 mapif_parse_GuildAddMember(int32 fd,int32 guild_id,struct guild_member *m)
 {
 {
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1286,7 +1286,7 @@ int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m)
 	}
 	}
 
 
 	// Find an empty slot
 	// Find an empty slot
-	for( int i = 0; i < g->guild.max_member; i++ ){
+	for( int32 i = 0; i < g->guild.max_member; i++ ){
 		if(g->guild.member[i].account_id==0)
 		if(g->guild.member[i].account_id==0)
 		{
 		{
 			memcpy(&g->guild.member[i],m,sizeof(struct guild_member));
 			memcpy(&g->guild.member[i],m,sizeof(struct guild_member));
@@ -1308,9 +1308,9 @@ int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m)
 }
 }
 
 
 // Delete member from guild
 // Delete member from guild
-int mapif_parse_GuildLeave(int fd, int guild_id, uint32 account_id, uint32 char_id, int flag, const char *mes)
+int32 mapif_parse_GuildLeave(int32 fd, int32 guild_id, uint32 account_id, uint32 char_id, int32 flag, const char *mes)
 {
 {
-	int i;
+	int32 i;
 
 
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1333,7 +1333,7 @@ int mapif_parse_GuildLeave(int fd, int guild_id, uint32 account_id, uint32 char_
 	if( flag )
 	if( flag )
 	{	// Write expulsion reason
 	{	// Write expulsion reason
 		// Find an empty slot
 		// Find an empty slot
-		int j;
+		int32 j;
 		ARR_FIND( 0, MAX_GUILDEXPULSION, j, g->guild.expulsion[j].account_id == 0 );
 		ARR_FIND( 0, MAX_GUILDEXPULSION, j, g->guild.expulsion[j].account_id == 0 );
 		if( j == MAX_GUILDEXPULSION )
 		if( j == MAX_GUILDEXPULSION )
 		{
 		{
@@ -1367,11 +1367,11 @@ int mapif_parse_GuildLeave(int fd, int guild_id, uint32 account_id, uint32 char_
 }
 }
 
 
 // Change member info
 // Change member info
-int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id,uint32 account_id,uint32 char_id,int online,int lv,int class_)
+int32 mapif_parse_GuildChangeMemberInfoShort(int32 fd,int32 guild_id,uint32 account_id,uint32 char_id,int32 online,int32 lv,int32 class_)
 {
 {
 	// Could speed up by manipulating only guild_member
 	// Could speed up by manipulating only guild_member
-	int i,sum,c;
-	int prev_count, prev_alv;
+	int32 i,sum,c;
+	int32 prev_count, prev_alv;
 
 
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1421,7 +1421,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id,uint32 account_id
 }
 }
 
 
 // BreakGuild
 // BreakGuild
-int mapif_parse_BreakGuild(int fd,int guild_id)
+int32 mapif_parse_BreakGuild(int32 fd,int32 guild_id)
 {
 {
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1471,13 +1471,13 @@ int mapif_parse_BreakGuild(int fd,int guild_id)
 }
 }
 
 
 // Forward Guild message to others map servers
 // Forward Guild message to others map servers
-int mapif_parse_GuildMessage(int fd,int guild_id,uint32 account_id,char *mes,int len)
+int32 mapif_parse_GuildMessage(int32 fd,int32 guild_id,uint32 account_id,char *mes,int32 len)
 {
 {
 	return mapif_guild_message(guild_id,account_id,mes,len, fd);
 	return mapif_guild_message(guild_id,account_id,mes,len, fd);
 }
 }
 
 
 // Modification of the guild
 // Modification of the guild
-int mapif_parse_GuildBasicInfoChange(int fd,int guild_id,int type,const char *data,int len)
+int32 mapif_parse_GuildBasicInfoChange(int32 fd,int32 guild_id,int32 type,const char *data,int32 len)
 {
 {
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1517,10 +1517,10 @@ int mapif_parse_GuildBasicInfoChange(int fd,int guild_id,int type,const char *da
  * @param len : Size of value
  * @param len : Size of value
  * @return 
  * @return 
  */
  */
-int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,uint32 account_id,uint32 char_id,int type,const char *data,int len)
+int32 mapif_parse_GuildMemberInfoChange(int32 fd,int32 guild_id,uint32 account_id,uint32 char_id,int32 type,const char *data,int32 len)
 {
 {
 	// Could make some improvement in speed, because only change guild_member
 	// Could make some improvement in speed, because only change guild_member
-	int i;
+	int32 i;
 
 
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1622,14 +1622,14 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,uint32 account_id,uint
 	return 0;
 	return 0;
 }
 }
 
 
-int inter_guild_sex_changed(int guild_id,uint32 account_id,uint32 char_id, short gender)
+int32 inter_guild_sex_changed(int32 guild_id,uint32 account_id,uint32 char_id, short 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));
 }
 }
 
 
-int inter_guild_charname_changed(int 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)
 {
 {
-	int i, flag = 0;
+	int32 i, flag = 0;
 
 
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1663,7 +1663,7 @@ int inter_guild_charname_changed(int guild_id,uint32 account_id, uint32 char_id,
 }
 }
 
 
 // Change a position desc
 // Change a position desc
-int mapif_parse_GuildPosition(int fd,int guild_id,int idx,struct guild_position *p)
+int32 mapif_parse_GuildPosition(int32 fd,int32 guild_id,int32 idx,struct guild_position *p)
 {
 {
 	// Could make some improvement in speed, because only change guild_position
 	// Could make some improvement in speed, because only change guild_position
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
@@ -1680,9 +1680,9 @@ int mapif_parse_GuildPosition(int fd,int guild_id,int idx,struct guild_position
 }
 }
 
 
 // Guild Skill UP
 // Guild Skill UP
-int mapif_parse_GuildSkillUp(int fd,int guild_id,uint16 skill_id,uint32 account_id,int max)
+int32 mapif_parse_GuildSkillUp(int32 fd,int32 guild_id,uint16 skill_id,uint32 account_id,int32 max)
 {
 {
-	int idx = skill_id - GD_SKILLBASE;
+	int32 idx = skill_id - GD_SKILLBASE;
 
 
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1705,8 +1705,8 @@ int mapif_parse_GuildSkillUp(int fd,int guild_id,uint16 skill_id,uint32 account_
 }
 }
 
 
 //Manual deletion of an alliance when partnering guild does not exists. [Skotlex]
 //Manual deletion of an alliance when partnering guild does not exists. [Skotlex]
-int mapif_parse_GuildDeleteAlliance( std::shared_ptr<CharGuild> &g, int guild_id, uint32 account_id1, uint32 account_id2, int flag ){
-	int i;
+int32 mapif_parse_GuildDeleteAlliance( std::shared_ptr<CharGuild> &g, int32 guild_id, uint32 account_id1, uint32 account_id2, int32 flag ){
+	int32 i;
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 
 
 	ARR_FIND( 0, MAX_GUILDALLIANCE, i, g->guild.alliance[i].guild_id == guild_id );
 	ARR_FIND( 0, MAX_GUILDALLIANCE, i, g->guild.alliance[i].guild_id == guild_id );
@@ -1731,11 +1731,11 @@ int mapif_parse_GuildDeleteAlliance( std::shared_ptr<CharGuild> &g, int guild_id
  * @param flag
  * @param flag
  * @return 
  * @return 
  */
  */
-int mapif_parse_GuildAlliance(int fd,int guild_id1,int guild_id2,uint32 account_id1,uint32 account_id2,int flag)
+int32 mapif_parse_GuildAlliance(int32 fd,int32 guild_id1,int32 guild_id2,uint32 account_id1,uint32 account_id2,int32 flag)
 {
 {
 	// Could speed up
 	// Could speed up
 	std::shared_ptr<CharGuild> g[2];
 	std::shared_ptr<CharGuild> g[2];
-	int j,i;
+	int32 j,i;
 	g[0] = inter_guild_fromsql(guild_id1);
 	g[0] = inter_guild_fromsql(guild_id1);
 	g[1] = inter_guild_fromsql(guild_id2);
 	g[1] = inter_guild_fromsql(guild_id2);
 
 
@@ -1785,7 +1785,7 @@ int mapif_parse_GuildAlliance(int fd,int guild_id1,int guild_id2,uint32 account_
 }
 }
 
 
 // Change guild message
 // Change guild message
-int mapif_parse_GuildNotice(int fd,int guild_id,const char *mes1,const char *mes2)
+int32 mapif_parse_GuildNotice(int32 fd,int32 guild_id,const char *mes1,const char *mes2)
 {
 {
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1800,7 +1800,7 @@ int mapif_parse_GuildNotice(int fd,int guild_id,const char *mes1,const char *mes
 	return mapif_guild_notice(g->guild);
 	return mapif_guild_notice(g->guild);
 }
 }
 
 
-int mapif_parse_GuildEmblem(int fd,int len,int guild_id,int dummy,const char *data)
+int32 mapif_parse_GuildEmblem(int32 fd,int32 len,int32 guild_id,int32 dummy,const char *data)
 {
 {
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1818,12 +1818,12 @@ int mapif_parse_GuildEmblem(int fd,int len,int guild_id,int dummy,const char *da
 	return mapif_guild_emblem(g->guild);
 	return mapif_guild_emblem(g->guild);
 }
 }
 
 
-int mapif_parse_GuildCastleDataLoad(int fd, int len, int *castle_ids)
+int32 mapif_parse_GuildCastleDataLoad(int32 fd, int32 len, int32 *castle_ids)
 {
 {
 	return mapif_guild_castle_dataload(fd, len, castle_ids);
 	return mapif_guild_castle_dataload(fd, len, castle_ids);
 }
 }
 
 
-int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value)
+int32 mapif_parse_GuildCastleDataSave(int32 fd, int32 castle_id, int32 index, int32 value)
 {
 {
 	std::shared_ptr<struct guild_castle> gc = inter_guildcastle_fromsql( castle_id );
 	std::shared_ptr<struct guild_castle> gc = inter_guildcastle_fromsql( castle_id );
 
 
@@ -1835,7 +1835,7 @@ int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value)
 	switch (index) {
 	switch (index) {
 		case CD_GUILD_ID:
 		case CD_GUILD_ID:
 			if (charserv_config.log_inter && gc->guild_id != value) {
 			if (charserv_config.log_inter && gc->guild_id != value) {
-				int gid = (value) ? value : gc->guild_id;
+				int32 gid = (value) ? value : gc->guild_id;
 				auto g = util::umap_find( guild_db, gid );
 				auto g = util::umap_find( guild_db, gid );
 				inter_log("guild %s (id=%d) %s castle id=%d\n",
 				inter_log("guild %s (id=%d) %s castle id=%d\n",
 				          (g) ? g->guild.name : "??", gid, (value) ? "occupy" : "abandon", castle_id);
 				          (g) ? g->guild.name : "??", gid, (value) ? "occupy" : "abandon", castle_id);
@@ -1862,10 +1862,10 @@ int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value)
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_parse_GuildMasterChange(int fd, int guild_id, const char* name, int len)
+int32 mapif_parse_GuildMasterChange(int32 fd, int32 guild_id, const char* name, int32 len)
 {
 {
 	struct guild_member gm;
 	struct guild_member gm;
-	int pos;
+	int32 pos;
 
 
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1902,7 +1902,7 @@ int mapif_parse_GuildMasterChange(int fd, int guild_id, const char* name, int le
 	return mapif_guild_master_changed(g->guild, g->guild.member[0].account_id, g->guild.member[0].char_id, g->guild.last_leader_change);
 	return mapif_guild_master_changed(g->guild, g->guild.member[0].account_id, g->guild.member[0].char_id, g->guild.last_leader_change);
 }
 }
 
 
-int mapif_parse_GuildEmblemVersion(int fd, int guild_id, int version)
+int32 mapif_parse_GuildEmblemVersion(int32 fd, int32 guild_id, int32 version)
 {
 {
 	auto g = inter_guild_fromsql( guild_id );
 	auto g = inter_guild_fromsql( guild_id );
 
 
@@ -1925,7 +1925,7 @@ int mapif_parse_GuildEmblemVersion(int fd, int guild_id, int version)
 // Must Return
 // Must Return
 //	1 : ok
 //	1 : ok
 //  0 : error
 //  0 : error
-int inter_guild_parse_frommap(int fd)
+int32 inter_guild_parse_frommap(int32 fd)
 {
 {
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	switch(RFIFOW(fd,0)) {
 	switch(RFIFOW(fd,0)) {
@@ -1944,7 +1944,7 @@ int inter_guild_parse_frommap(int fd)
 	case 0x303D: mapif_parse_GuildAlliance(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14),RFIFOB(fd,18)); break;
 	case 0x303D: mapif_parse_GuildAlliance(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14),RFIFOB(fd,18)); break;
 	case 0x303E: mapif_parse_GuildNotice(fd,RFIFOL(fd,2),RFIFOCP(fd,6),RFIFOCP(fd,66)); break;
 	case 0x303E: mapif_parse_GuildNotice(fd,RFIFOL(fd,2),RFIFOCP(fd,6),RFIFOCP(fd,66)); break;
 	case 0x303F: mapif_parse_GuildEmblem(fd,RFIFOW(fd,2)-12,RFIFOL(fd,4),RFIFOL(fd,8),RFIFOCP(fd,12)); break;
 	case 0x303F: mapif_parse_GuildEmblem(fd,RFIFOW(fd,2)-12,RFIFOL(fd,4),RFIFOL(fd,8),RFIFOCP(fd,12)); break;
-	case 0x3040: mapif_parse_GuildCastleDataLoad(fd,RFIFOW(fd,2),(int *)RFIFOP(fd,4)); break;
+	case 0x3040: mapif_parse_GuildCastleDataLoad(fd,RFIFOW(fd,2),(int32 *)RFIFOP(fd,4)); break;
 	case 0x3041: mapif_parse_GuildCastleDataSave(fd,RFIFOW(fd,2),RFIFOB(fd,4),RFIFOL(fd,5)); break;
 	case 0x3041: mapif_parse_GuildCastleDataSave(fd,RFIFOW(fd,2),RFIFOB(fd,4),RFIFOL(fd,5)); break;
 	case 0x3042: mapif_parse_GuildEmblemVersion(fd, RFIFOL(fd, 2), RFIFOL(fd, 6)); break;
 	case 0x3042: mapif_parse_GuildEmblemVersion(fd, RFIFOL(fd, 2), RFIFOL(fd, 6)); break;
 
 
@@ -1956,12 +1956,12 @@ int inter_guild_parse_frommap(int fd)
 }
 }
 
 
 //Leave request from the server (for deleting character from guild)
 //Leave request from the server (for deleting character from guild)
-int inter_guild_leave(int guild_id, uint32 account_id, uint32 char_id)
+int32 inter_guild_leave(int32 guild_id, uint32 account_id, uint32 char_id)
 {
 {
 	return mapif_parse_GuildLeave(-1, guild_id, account_id, char_id, 0, "** Character Deleted **");
 	return mapif_parse_GuildLeave(-1, guild_id, account_id, char_id, 0, "** Character Deleted **");
 }
 }
 
 
-int inter_guild_broken(int guild_id)
+int32 inter_guild_broken(int32 guild_id)
 {
 {
 	return mapif_guild_broken(guild_id, 0);
 	return mapif_guild_broken(guild_id, 0);
 }
 }

+ 9 - 9
src/char/int_guild.hpp

@@ -54,16 +54,16 @@ public:
 	unsigned short save_flag;
 	unsigned short save_flag;
 };
 };
 
 
-int inter_guild_parse_frommap(int fd);
+int32 inter_guild_parse_frommap(int32 fd);
 void inter_guild_sql_init(void);
 void inter_guild_sql_init(void);
 void inter_guild_sql_final(void);
 void inter_guild_sql_final(void);
-int inter_guild_leave(int guild_id,uint32 account_id,uint32 char_id);
-int mapif_parse_BreakGuild(int fd,int guild_id);
-int inter_guild_broken(int guild_id);
-int inter_guild_sex_changed(int guild_id,uint32 account_id,uint32 char_id, short gender);
-int inter_guild_charname_changed(int guild_id,uint32 account_id, uint32 char_id, char *name);
-int inter_guild_CharOnline(uint32 char_id, int guild_id);
-int inter_guild_CharOffline(uint32 char_id, int guild_id);
-uint16 inter_guild_storagemax(int guild_id);
+int32 inter_guild_leave(int32 guild_id,uint32 account_id,uint32 char_id);
+int32 mapif_parse_BreakGuild(int32 fd,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_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_CharOffline(uint32 char_id, int32 guild_id);
+uint16 inter_guild_storagemax(int32 guild_id);
 
 
 #endif /* INT_GUILD_HPP */
 #endif /* INT_GUILD_HPP */

+ 17 - 17
src/char/int_homun.cpp

@@ -16,7 +16,7 @@
 #include "char.hpp"
 #include "char.hpp"
 #include "inter.hpp"
 #include "inter.hpp"
 
 
-int inter_homunculus_sql_init(void)
+int32 inter_homunculus_sql_init(void)
 {
 {
 	return 0;
 	return 0;
 }
 }
@@ -25,7 +25,7 @@ void inter_homunculus_sql_final(void)
 	return;
 	return;
 }
 }
 
 
-void mapif_homunculus_created(int fd, uint32 account_id, struct s_homunculus *sh, unsigned char flag)
+void mapif_homunculus_created(int32 fd, uint32 account_id, struct s_homunculus *sh, unsigned char flag)
 {
 {
 	WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
 	WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
 	WFIFOW(fd,0) = 0x3890;
 	WFIFOW(fd,0) = 0x3890;
@@ -36,7 +36,7 @@ void mapif_homunculus_created(int fd, uint32 account_id, struct s_homunculus *sh
 	WFIFOSET(fd, WFIFOW(fd,2));
 	WFIFOSET(fd, WFIFOW(fd,2));
 }
 }
 
 
-void mapif_homunculus_deleted(int fd, int flag)
+void mapif_homunculus_deleted(int32 fd, int32 flag)
 {
 {
 	WFIFOHEAD(fd, 3);
 	WFIFOHEAD(fd, 3);
 	WFIFOW(fd, 0) = 0x3893;
 	WFIFOW(fd, 0) = 0x3893;
@@ -44,7 +44,7 @@ void mapif_homunculus_deleted(int fd, int flag)
 	WFIFOSET(fd, 3);
 	WFIFOSET(fd, 3);
 }
 }
 
 
-void mapif_homunculus_loaded(int fd, uint32 account_id, struct s_homunculus *hd)
+void mapif_homunculus_loaded(int32 fd, uint32 account_id, struct s_homunculus *hd)
 {
 {
 	WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
 	WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
 	WFIFOW(fd,0) = 0x3891;
 	WFIFOW(fd,0) = 0x3891;
@@ -63,7 +63,7 @@ void mapif_homunculus_loaded(int fd, uint32 account_id, struct s_homunculus *hd)
 	WFIFOSET(fd, sizeof(struct s_homunculus)+9);
 	WFIFOSET(fd, sizeof(struct s_homunculus)+9);
 }
 }
 
 
-void mapif_homunculus_saved(int fd, uint32 account_id, bool flag)
+void mapif_homunculus_saved(int32 fd, uint32 account_id, bool flag)
 {
 {
 	WFIFOHEAD(fd, 7);
 	WFIFOHEAD(fd, 7);
 	WFIFOW(fd,0) = 0x3892;
 	WFIFOW(fd,0) = 0x3892;
@@ -72,7 +72,7 @@ void mapif_homunculus_saved(int fd, uint32 account_id, bool flag)
 	WFIFOSET(fd, 7);
 	WFIFOSET(fd, 7);
 }
 }
 
 
-void mapif_homunculus_renamed(int fd, uint32 account_id, uint32 char_id, unsigned char flag, char* name)
+void mapif_homunculus_renamed(int32 fd, uint32 account_id, uint32 char_id, unsigned char flag, char* name)
 {
 {
 	WFIFOHEAD(fd, NAME_LENGTH+12);
 	WFIFOHEAD(fd, NAME_LENGTH+12);
 	WFIFOW(fd, 0) = 0x3894;
 	WFIFOW(fd, 0) = 0x3894;
@@ -118,7 +118,7 @@ bool mapif_homunculus_save(struct s_homunculus* hd)
 		else
 		else
 		{
 		{
 			SqlStmt* stmt;
 			SqlStmt* stmt;
-			int i;
+			int32 i;
 
 
 			stmt = SqlStmt_Malloc(sql_handle);
 			stmt = SqlStmt_Malloc(sql_handle);
 			if( SQL_ERROR == SqlStmt_Prepare(stmt, "REPLACE INTO `%s` (`homun_id`, `id`, `lv`) VALUES (%d, ?, ?)", schema_config.skill_homunculus_db, hd->hom_id) )
 			if( SQL_ERROR == SqlStmt_Prepare(stmt, "REPLACE INTO `%s` (`homun_id`, `id`, `lv`) VALUES (%d, ?, ?)", schema_config.skill_homunculus_db, hd->hom_id) )
@@ -148,7 +148,7 @@ bool mapif_homunculus_save(struct s_homunculus* hd)
 
 
 
 
 // Load an homunculus
 // Load an homunculus
-bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd)
+bool mapif_homunculus_load(int32 homun_id, struct s_homunculus* hd)
 {
 {
 	char* data;
 	char* data;
 	size_t len;
 	size_t len;
@@ -210,7 +210,7 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd)
 	}
 	}
 	while( SQL_SUCCESS == Sql_NextRow(sql_handle) )
 	while( SQL_SUCCESS == Sql_NextRow(sql_handle) )
 	{
 	{
-		int i;
+		int32 i;
 		// id
 		// id
 		Sql_GetData(sql_handle, 0, &data, nullptr);
 		Sql_GetData(sql_handle, 0, &data, nullptr);
 		i = atoi(data);
 		i = atoi(data);
@@ -231,7 +231,7 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd)
 	return true;
 	return true;
 }
 }
 
 
-bool mapif_homunculus_delete(int homun_id)
+bool mapif_homunculus_delete(int32 homun_id)
 {
 {
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%u'", schema_config.homunculus_db, homun_id)
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%u'", schema_config.homunculus_db, homun_id)
 	||	SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%u'", schema_config.skill_homunculus_db, homun_id)
 	||	SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%u'", schema_config.skill_homunculus_db, homun_id)
@@ -245,7 +245,7 @@ bool mapif_homunculus_delete(int homun_id)
 
 
 bool mapif_homunculus_rename(char *name)
 bool mapif_homunculus_rename(char *name)
 {
 {
-	int i;
+	int32 i;
 
 
 	// Check Authorised letters/symbols in the name of the homun
 	// Check Authorised letters/symbols in the name of the homun
 	if( charserv_config.char_config.char_name_option == 1 )
 	if( charserv_config.char_config.char_name_option == 1 )
@@ -265,32 +265,32 @@ bool mapif_homunculus_rename(char *name)
 }
 }
 
 
 
 
-void mapif_parse_homunculus_create(int fd, int len, uint32 account_id, struct s_homunculus* phd)
+void mapif_parse_homunculus_create(int32 fd, int32 len, uint32 account_id, struct s_homunculus* phd)
 {
 {
 	bool result = mapif_homunculus_save(phd);
 	bool result = mapif_homunculus_save(phd);
 	mapif_homunculus_created(fd, account_id, phd, result);
 	mapif_homunculus_created(fd, account_id, phd, result);
 }
 }
 
 
-void mapif_parse_homunculus_delete(int fd, int homun_id)
+void mapif_parse_homunculus_delete(int32 fd, int32 homun_id)
 {
 {
 	bool result = mapif_homunculus_delete(homun_id);
 	bool result = mapif_homunculus_delete(homun_id);
 	mapif_homunculus_deleted(fd, result);
 	mapif_homunculus_deleted(fd, result);
 }
 }
 
 
-void mapif_parse_homunculus_load(int fd, uint32 account_id, int homun_id)
+void mapif_parse_homunculus_load(int32 fd, uint32 account_id, int32 homun_id)
 {
 {
 	struct s_homunculus hd;
 	struct s_homunculus hd;
 	bool result = mapif_homunculus_load(homun_id, &hd);
 	bool result = mapif_homunculus_load(homun_id, &hd);
 	mapif_homunculus_loaded(fd, account_id, ( result ? &hd : nullptr ));
 	mapif_homunculus_loaded(fd, account_id, ( result ? &hd : nullptr ));
 }
 }
 
 
-void mapif_parse_homunculus_save(int fd, int len, uint32 account_id, struct s_homunculus* phd)
+void mapif_parse_homunculus_save(int32 fd, int32 len, uint32 account_id, struct s_homunculus* phd)
 {
 {
 	bool result = mapif_homunculus_save(phd);
 	bool result = mapif_homunculus_save(phd);
 	mapif_homunculus_saved(fd, account_id, result);
 	mapif_homunculus_saved(fd, account_id, result);
 }
 }
 
 
-void mapif_parse_homunculus_rename(int fd, uint32 account_id, uint32 char_id, char* name)
+void mapif_parse_homunculus_rename(int32 fd, uint32 account_id, uint32 char_id, char* name)
 {
 {
 	bool result = mapif_homunculus_rename(name);
 	bool result = mapif_homunculus_rename(name);
 	mapif_homunculus_renamed(fd, account_id, char_id, result, name);
 	mapif_homunculus_renamed(fd, account_id, char_id, result, name);
@@ -299,7 +299,7 @@ void mapif_parse_homunculus_rename(int fd, uint32 account_id, uint32 char_id, ch
 /*==========================================
 /*==========================================
  * Inter Packets
  * Inter Packets
  *------------------------------------------*/
  *------------------------------------------*/
-int inter_homunculus_parse_frommap(int fd)
+int32 inter_homunculus_parse_frommap(int32 fd)
 {
 {
 	unsigned short cmd = RFIFOW(fd,0);
 	unsigned short cmd = RFIFOW(fd,0);
 
 

+ 4 - 4
src/char/int_homun.hpp

@@ -8,13 +8,13 @@
 
 
 struct s_homunculus;
 struct s_homunculus;
 
 
-int inter_homunculus_sql_init(void);
+int32 inter_homunculus_sql_init(void);
 void inter_homunculus_sql_final(void);
 void inter_homunculus_sql_final(void);
-int inter_homunculus_parse_frommap(int fd);
+int32 inter_homunculus_parse_frommap(int32 fd);
 
 
 bool mapif_homunculus_save(struct s_homunculus* hd);
 bool mapif_homunculus_save(struct s_homunculus* hd);
-bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd);
-bool mapif_homunculus_delete(int homun_id);
+bool mapif_homunculus_load(int32 homun_id, struct s_homunculus* hd);
+bool mapif_homunculus_delete(int32 homun_id);
 bool mapif_homunculus_rename(char *name);
 bool mapif_homunculus_rename(char *name);
 
 
 #endif /* INT_HOMUN_HPP */
 #endif /* INT_HOMUN_HPP */

+ 39 - 39
src/char/int_mail.cpp

@@ -20,13 +20,13 @@
 
 
 using namespace rathena;
 using namespace rathena;
 
 
-bool mail_loadmessage(int mail_id, struct mail_message* msg);
-void mapif_Mail_return( int fd, uint32 char_id, int mail_id, uint32 account_id_receiver = 0, uint32 account_id_sender = 0 );
-bool mapif_Mail_delete( int fd, uint32 char_id, int mail_id, uint32 account_id = 0 );
+bool mail_loadmessage(int32 mail_id, struct mail_message* msg);
+void mapif_Mail_return( int32 fd, uint32 char_id, int32 mail_id, uint32 account_id_receiver = 0, uint32 account_id_sender = 0 );
+bool mapif_Mail_delete( int32 fd, uint32 char_id, int32 mail_id, uint32 account_id = 0 );
 
 
-int mail_fromsql(uint32 char_id, struct mail_data* md)
+int32 mail_fromsql(uint32 char_id, struct mail_data* md)
 {
 {
-	int i;
+	int32 i;
 	char *data;
 	char *data;
 
 
 	memset(md, 0, sizeof(struct mail_data));
 	memset(md, 0, sizeof(struct mail_data));
@@ -79,11 +79,11 @@ int mail_fromsql(uint32 char_id, struct mail_data* md)
 
 
 /// Stores a single message in the database.
 /// Stores a single message in the database.
 /// Returns the message's ID if successful (or 0 if it fails).
 /// Returns the message's ID if successful (or 0 if it fails).
-int mail_savemessage(struct mail_message* msg)
+int32 mail_savemessage(struct mail_message* msg)
 {
 {
 	StringBuf buf;
 	StringBuf buf;
 	SqlStmt* stmt;
 	SqlStmt* stmt;
-	int i, j;
+	int32 i, j;
 	bool found = false;
 	bool found = false;
 
 
 	if( SQL_ERROR == Sql_QueryStr( sql_handle, "START TRANSACTION" ) ){
 	if( SQL_ERROR == Sql_QueryStr( sql_handle, "START TRANSACTION" ) ){
@@ -166,9 +166,9 @@ int mail_savemessage(struct mail_message* msg)
 
 
 /// Retrieves a single message from the database.
 /// Retrieves a single message from the database.
 /// Returns true if the operation succeeds (or false if it fails).
 /// Returns true if the operation succeeds (or false if it fails).
-bool mail_loadmessage(int mail_id, struct mail_message* msg)
+bool mail_loadmessage(int32 mail_id, struct mail_message* msg)
 {
 {
-	int i, j;
+	int32 i, j;
 	StringBuf buf;
 	StringBuf buf;
 	char* data;
 	char* data;
 
 
@@ -252,7 +252,7 @@ bool mail_loadmessage(int mail_id, struct mail_message* msg)
 	return true;
 	return true;
 }
 }
 
 
-int mail_timer_sub( int limit, enum mail_inbox_type type ){
+int32 mail_timer_sub( int32 limit, enum mail_inbox_type type ){
 	// Start by deleting all expired mails sent by the server
 	// Start by deleting all expired mails sent by the server
 	if( SQL_ERROR == Sql_Query( sql_handle, "DELETE FROM `%s`WHERE `type` = '%d' AND `send_id` = '0' AND `time` <= UNIX_TIMESTAMP( NOW() - INTERVAL %d DAY )", schema_config.mail_db, type, limit ) ){
 	if( SQL_ERROR == Sql_Query( sql_handle, "DELETE FROM `%s`WHERE `type` = '%d' AND `send_id` = '0' AND `time` <= UNIX_TIMESTAMP( NOW() - INTERVAL %d DAY )", schema_config.mail_db, type, limit ) ){
 		Sql_ShowDebug( sql_handle );
 		Sql_ShowDebug( sql_handle );
@@ -260,10 +260,10 @@ int mail_timer_sub( int limit, enum mail_inbox_type type ){
 	}
 	}
 
 
 	struct{
 	struct{
-		int mail_id;
-		int char_id;
-		int account_id;
-		int account_id_sender;
+		int32 mail_id;
+		int32 char_id;
+		int32 account_id;
+		int32 account_id_sender;
 	}mails[MAIL_ITERATION_SIZE];
 	}mails[MAIL_ITERATION_SIZE];
 
 
 	if( limit <= 0 ){
 	if( limit <= 0 ){
@@ -288,7 +288,7 @@ int mail_timer_sub( int limit, enum mail_inbox_type type ){
 		return 0;
 		return 0;
 	}
 	}
 
 
-	for( int i = 0; i < MAIL_ITERATION_SIZE && SQL_SUCCESS == Sql_NextRow( sql_handle ); i++ ){
+	for( int32 i = 0; i < MAIL_ITERATION_SIZE && SQL_SUCCESS == Sql_NextRow( sql_handle ); i++ ){
 		char* data;
 		char* data;
 
 
 		Sql_GetData(sql_handle, 0, &data, nullptr); mails[i].mail_id = atoi(data);
 		Sql_GetData(sql_handle, 0, &data, nullptr); mails[i].mail_id = atoi(data);
@@ -299,7 +299,7 @@ int mail_timer_sub( int limit, enum mail_inbox_type type ){
 
 
 	Sql_FreeResult(sql_handle);
 	Sql_FreeResult(sql_handle);
 
 
-	for( int i = 0; i < MAIL_ITERATION_SIZE; i++ ){
+	for( int32 i = 0; i < MAIL_ITERATION_SIZE; i++ ){
 		if( mails[i].mail_id == 0 ){
 		if( mails[i].mail_id == 0 ){
 			break;
 			break;
 		}
 		}
@@ -328,7 +328,7 @@ TIMER_FUNC(mail_delete_timer){
 /*==========================================
 /*==========================================
  * Client Inbox Request
  * Client Inbox Request
  *------------------------------------------*/
  *------------------------------------------*/
-void mapif_Mail_sendinbox(int fd, uint32 char_id, unsigned char flag, enum mail_inbox_type type)
+void mapif_Mail_sendinbox(int32 fd, uint32 char_id, unsigned char flag, enum mail_inbox_type type)
 {
 {
 	struct mail_data md;
 	struct mail_data md;
 	mail_fromsql(char_id, &md);
 	mail_fromsql(char_id, &md);
@@ -344,7 +344,7 @@ void mapif_Mail_sendinbox(int fd, uint32 char_id, unsigned char flag, enum mail_
 	WFIFOSET(fd,WFIFOW(fd,2));
 	WFIFOSET(fd,WFIFOW(fd,2));
 }
 }
 
 
-void mapif_parse_Mail_requestinbox(int fd)
+void mapif_parse_Mail_requestinbox(int32 fd)
 {
 {
 	mapif_Mail_sendinbox(fd, RFIFOL(fd,2), RFIFOB(fd,6), (mail_inbox_type)RFIFOB(fd,7));
 	mapif_Mail_sendinbox(fd, RFIFOL(fd,2), RFIFOB(fd,6), (mail_inbox_type)RFIFOB(fd,7));
 }
 }
@@ -352,9 +352,9 @@ void mapif_parse_Mail_requestinbox(int fd)
 /*==========================================
 /*==========================================
  * Mark mail as 'Read'
  * Mark mail as 'Read'
  *------------------------------------------*/
  *------------------------------------------*/
-void mapif_parse_Mail_read(int fd)
+void mapif_parse_Mail_read(int32 fd)
 {
 {
-	int mail_id = RFIFOL(fd,2);
+	int32 mail_id = RFIFOL(fd,2);
 	if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", schema_config.mail_db, MAIL_READ, mail_id) )
 	if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", schema_config.mail_db, MAIL_READ, mail_id) )
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
 }
 }
@@ -362,7 +362,7 @@ void mapif_parse_Mail_read(int fd)
 /*==========================================
 /*==========================================
  * Client Attachment Request
  * Client Attachment Request
  *------------------------------------------*/
  *------------------------------------------*/
-bool mail_DeleteAttach(int mail_id){
+bool mail_DeleteAttach(int32 mail_id){
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", schema_config.mail_attachment_db, mail_id ) ){
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", schema_config.mail_attachment_db, mail_id ) ){
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
 		return false;
 		return false;
@@ -371,7 +371,7 @@ bool mail_DeleteAttach(int mail_id){
 	return true;
 	return true;
 }
 }
 
 
-void mapif_Mail_getattach(int fd, uint32 char_id, int mail_id, int type)
+void mapif_Mail_getattach(int32 fd, uint32 char_id, int32 mail_id, int32 type)
 {
 {
 	struct mail_message msg;
 	struct mail_message msg;
 
 
@@ -400,7 +400,7 @@ void mapif_Mail_getattach(int fd, uint32 char_id, int mail_id, int type)
 	}
 	}
 
 
 	if( type & MAIL_ATT_ITEM ){
 	if( type & MAIL_ATT_ITEM ){
-		int i;
+		int32 i;
 
 
 		ARR_FIND(0, MAIL_MAX_ITEM, i, msg.item[i].nameid > 0 && msg.item[i].amount > 0);
 		ARR_FIND(0, MAIL_MAX_ITEM, i, msg.item[i].nameid > 0 && msg.item[i].amount > 0);
 
 
@@ -435,7 +435,7 @@ void mapif_Mail_getattach(int fd, uint32 char_id, int mail_id, int type)
 	WFIFOSET(fd,WFIFOW(fd,2));
 	WFIFOSET(fd,WFIFOW(fd,2));
 }
 }
 
 
-void mapif_parse_Mail_getattach(int fd)
+void mapif_parse_Mail_getattach(int32 fd)
 {
 {
 	mapif_Mail_getattach(fd, RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10));
 	mapif_Mail_getattach(fd, RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10));
 }
 }
@@ -443,7 +443,7 @@ void mapif_parse_Mail_getattach(int fd)
 /*==========================================
 /*==========================================
  * Delete Mail
  * Delete Mail
  *------------------------------------------*/
  *------------------------------------------*/
-bool mapif_Mail_delete( int fd, uint32 char_id, int mail_id, uint32 account_id ){
+bool mapif_Mail_delete( int32 fd, uint32 char_id, int32 mail_id, uint32 account_id ){
 	bool failed = false;
 	bool failed = false;
 
 
 	if( SQL_ERROR == Sql_QueryStr( sql_handle, "START TRANSACTION" ) ||
 	if( SQL_ERROR == Sql_QueryStr( sql_handle, "START TRANSACTION" ) ||
@@ -485,7 +485,7 @@ bool mapif_Mail_delete( int fd, uint32 char_id, int mail_id, uint32 account_id )
 	return !failed;
 	return !failed;
 }
 }
 
 
-void mapif_parse_Mail_delete(int fd)
+void mapif_parse_Mail_delete(int32 fd)
 {
 {
 	mapif_Mail_delete( fd, RFIFOL( fd, 2 ), RFIFOL( fd, 6 ) );
 	mapif_Mail_delete( fd, RFIFOL( fd, 2 ), RFIFOL( fd, 6 ) );
 }
 }
@@ -512,7 +512,7 @@ void mapif_Mail_new(struct mail_message *msg)
 /*==========================================
 /*==========================================
  * Return Mail
  * Return Mail
  *------------------------------------------*/
  *------------------------------------------*/
-void mapif_Mail_return( int fd, uint32 char_id, int mail_id, uint32 account_id_receiver, uint32 account_id_sender ){
+void mapif_Mail_return( int32 fd, uint32 char_id, int32 mail_id, uint32 account_id_receiver, uint32 account_id_sender ){
 	struct mail_message msg;
 	struct mail_message msg;
 
 
 	if( !mail_loadmessage( mail_id, &msg ) ){
 	if( !mail_loadmessage( mail_id, &msg ) ){
@@ -535,7 +535,7 @@ void mapif_Mail_return( int fd, uint32 char_id, int mail_id, uint32 account_id_r
 
 
 	// If we do not want to return mails without any attachments and the request was not sent by a user
 	// If we do not want to return mails without any attachments and the request was not sent by a user
 	if( fd <= 0 && !charserv_config.mail_return_empty ){
 	if( fd <= 0 && !charserv_config.mail_return_empty ){
-		int i;
+		int32 i;
 
 
 		ARR_FIND( 0, MAIL_MAX_ITEM, i, msg.item[i].nameid > 0 );
 		ARR_FIND( 0, MAIL_MAX_ITEM, i, msg.item[i].nameid > 0 );
 
 
@@ -560,7 +560,7 @@ void mapif_Mail_return( int fd, uint32 char_id, int mail_id, uint32 account_id_r
 	msg.type = MAIL_INBOX_RETURNED;
 	msg.type = MAIL_INBOX_RETURNED;
 	msg.timestamp = time( nullptr );
 	msg.timestamp = time( nullptr );
 
 
-	int new_mail = mail_savemessage( &msg );
+	int32 new_mail = mail_savemessage( &msg );
 	mapif_Mail_new( &msg );
 	mapif_Mail_new( &msg );
 
 
 	// If the char server triggered this, check if we have to notify a map server
 	// If the char server triggered this, check if we have to notify a map server
@@ -584,7 +584,7 @@ void mapif_Mail_return( int fd, uint32 char_id, int mail_id, uint32 account_id_r
 	WFIFOSET(fd,11);
 	WFIFOSET(fd,11);
 }
 }
 
 
-void mapif_parse_Mail_return(int fd)
+void mapif_parse_Mail_return(int32 fd)
 {
 {
 	mapif_Mail_return(fd, RFIFOL(fd,2), RFIFOL(fd,6));
 	mapif_Mail_return(fd, RFIFOL(fd,2), RFIFOL(fd,6));
 }
 }
@@ -592,9 +592,9 @@ void mapif_parse_Mail_return(int fd)
 /*==========================================
 /*==========================================
  * Send Mail
  * Send Mail
  *------------------------------------------*/
  *------------------------------------------*/
-void mapif_Mail_send(int fd, struct mail_message* msg)
+void mapif_Mail_send(int32 fd, struct mail_message* msg)
 {
 {
-	int len = sizeof(struct mail_message) + 4;
+	int32 len = sizeof(struct mail_message) + 4;
 
 
 	WFIFOHEAD(fd,len);
 	WFIFOHEAD(fd,len);
 	WFIFOW(fd,0) = 0x384d;
 	WFIFOW(fd,0) = 0x384d;
@@ -603,7 +603,7 @@ void mapif_Mail_send(int fd, struct mail_message* msg)
 	WFIFOSET(fd,len);
 	WFIFOSET(fd,len);
 }
 }
 
 
-void mapif_parse_Mail_send(int fd)
+void mapif_parse_Mail_send(int32 fd)
 {
 {
 	struct mail_message msg;
 	struct mail_message msg;
 	char esc_name[NAME_LENGTH*2+1];
 	char esc_name[NAME_LENGTH*2+1];
@@ -664,7 +664,7 @@ void mapif_parse_Mail_send(int fd)
 	mapif_Mail_new(&msg); // notify recipient
 	mapif_Mail_new(&msg); // notify recipient
 }
 }
 
 
-bool mail_sendmail(int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item, int amount)
+bool mail_sendmail(int32 send_id, const char* send_name, int32 dest_id, const char* dest_name, const char* title, const char* body, int32 zeny, struct item *item, int32 amount)
 {
 {
 	struct mail_message msg;
 	struct mail_message msg;
 	memset(&msg, 0, sizeof(struct mail_message));
 	memset(&msg, 0, sizeof(struct mail_message));
@@ -677,7 +677,7 @@ bool mail_sendmail(int send_id, const char* send_name, int dest_id, const char*
 	safestrncpy(msg.body, body, MAIL_BODY_LENGTH);
 	safestrncpy(msg.body, body, MAIL_BODY_LENGTH);
 	msg.zeny = zeny;
 	msg.zeny = zeny;
 	if( item != nullptr ){
 	if( item != nullptr ){
-		int i;
+		int32 i;
 
 
 		for( i = 0; i < amount && i < MAIL_MAX_ITEM; i++ ){
 		for( i = 0; i < amount && i < MAIL_MAX_ITEM; i++ ){
 			memcpy(&msg.item[i], &item[i], sizeof(struct item));
 			memcpy(&msg.item[i], &item[i], sizeof(struct item));
@@ -695,7 +695,7 @@ bool mail_sendmail(int send_id, const char* send_name, int dest_id, const char*
 	return true;
 	return true;
 }
 }
 
 
-void mapif_Mail_receiver_send( int fd, int requesting_char_id, int char_id, int class_, int base_level, const char* name ){
+void mapif_Mail_receiver_send( int32 fd, int32 requesting_char_id, int32 char_id, int32 class_, int32 base_level, const char* name ){
 	WFIFOHEAD(fd,38);
 	WFIFOHEAD(fd,38);
 	WFIFOW(fd,0) = 0x384e;
 	WFIFOW(fd,0) = 0x384e;
 	WFIFOL(fd,2) = requesting_char_id;
 	WFIFOL(fd,2) = requesting_char_id;
@@ -706,7 +706,7 @@ void mapif_Mail_receiver_send( int fd, int requesting_char_id, int char_id, int
 	WFIFOSET(fd,38);
 	WFIFOSET(fd,38);
 }
 }
 
 
-void mapif_parse_Mail_receiver_check( int fd ){
+void mapif_parse_Mail_receiver_check( int32 fd ){
 	char name[NAME_LENGTH], esc_name[NAME_LENGTH * 2 + 1];
 	char name[NAME_LENGTH], esc_name[NAME_LENGTH * 2 + 1];
 	uint32 char_id = 0;
 	uint32 char_id = 0;
 	uint16 class_ = 0, base_level = 0;
 	uint16 class_ = 0, base_level = 0;
@@ -733,7 +733,7 @@ void mapif_parse_Mail_receiver_check( int fd ){
 /*==========================================
 /*==========================================
  * Packets From Map Server
  * Packets From Map Server
  *------------------------------------------*/
  *------------------------------------------*/
-int inter_mail_parse_frommap(int fd)
+int32 inter_mail_parse_frommap(int32 fd)
 {
 {
 	switch(RFIFOW(fd,0))
 	switch(RFIFOW(fd,0))
 	{
 	{
@@ -750,7 +750,7 @@ int inter_mail_parse_frommap(int fd)
 	return 1;
 	return 1;
 }
 }
 
 
-int inter_mail_sql_init(void)
+int32 inter_mail_sql_init(void)
 {
 {
 	return 1;
 	return 1;
 }
 }

+ 4 - 4
src/char/int_mail.hpp

@@ -12,13 +12,13 @@ struct mail_message;
 TIMER_FUNC(mail_return_timer);
 TIMER_FUNC(mail_return_timer);
 TIMER_FUNC(mail_delete_timer);
 TIMER_FUNC(mail_delete_timer);
 
 
-int inter_mail_parse_frommap(int fd);
-bool mail_sendmail(int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item, int amount);
+int32 inter_mail_parse_frommap(int32 fd);
+bool mail_sendmail(int32 send_id, const char* send_name, int32 dest_id, const char* dest_name, const char* title, const char* body, int32 zeny, struct item *item, int32 amount);
 
 
-int inter_mail_sql_init(void);
+int32 inter_mail_sql_init(void);
 void inter_mail_sql_final(void);
 void inter_mail_sql_final(void);
 
 
-int mail_savemessage(struct mail_message* msg);
+int32 mail_savemessage(struct mail_message* msg);
 void mapif_Mail_new(struct mail_message *msg);
 void mapif_Mail_new(struct mail_message *msg);
 
 
 #endif /* INT_MAIL_HPP */
 #endif /* INT_MAIL_HPP */

+ 12 - 12
src/char/int_mercenary.cpp

@@ -93,7 +93,7 @@ bool mapif_mercenary_save(struct s_mercenary* merc)
 	return flag;
 	return flag;
 }
 }
 
 
-bool mapif_mercenary_load(int merc_id, uint32 char_id, struct s_mercenary *merc)
+bool mapif_mercenary_load(int32 merc_id, uint32 char_id, struct s_mercenary *merc)
 {
 {
 	char* data;
 	char* data;
 
 
@@ -125,7 +125,7 @@ bool mapif_mercenary_load(int merc_id, uint32 char_id, struct s_mercenary *merc)
 	return true;
 	return true;
 }
 }
 
 
-bool mapif_mercenary_delete(int merc_id)
+bool mapif_mercenary_delete(int32 merc_id)
 {
 {
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `mer_id` = '%d'", schema_config.mercenary_db, merc_id) )
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `mer_id` = '%d'", schema_config.mercenary_db, merc_id) )
 	{
 	{
@@ -136,9 +136,9 @@ bool mapif_mercenary_delete(int merc_id)
 	return true;
 	return true;
 }
 }
 
 
-void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag)
+void mapif_mercenary_send(int32 fd, struct s_mercenary *merc, unsigned char flag)
 {
 {
-	int size = sizeof(struct s_mercenary) + 5;
+	int32 size = sizeof(struct s_mercenary) + 5;
 
 
 	WFIFOHEAD(fd,size);
 	WFIFOHEAD(fd,size);
 	WFIFOW(fd,0) = 0x3870;
 	WFIFOW(fd,0) = 0x3870;
@@ -148,20 +148,20 @@ void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag)
 	WFIFOSET(fd,size);
 	WFIFOSET(fd,size);
 }
 }
 
 
-void mapif_parse_mercenary_create(int fd, struct s_mercenary* merc)
+void mapif_parse_mercenary_create(int32 fd, struct s_mercenary* merc)
 {
 {
 	bool result = mapif_mercenary_save(merc);
 	bool result = mapif_mercenary_save(merc);
 	mapif_mercenary_send(fd, merc, result);
 	mapif_mercenary_send(fd, merc, result);
 }
 }
 
 
-void mapif_parse_mercenary_load(int fd, int merc_id, uint32 char_id)
+void mapif_parse_mercenary_load(int32 fd, int32 merc_id, uint32 char_id)
 {
 {
 	struct s_mercenary merc;
 	struct s_mercenary merc;
 	bool result = mapif_mercenary_load(merc_id, char_id, &merc);
 	bool result = mapif_mercenary_load(merc_id, char_id, &merc);
 	mapif_mercenary_send(fd, &merc, result);
 	mapif_mercenary_send(fd, &merc, result);
 }
 }
 
 
-void mapif_mercenary_deleted(int fd, unsigned char flag)
+void mapif_mercenary_deleted(int32 fd, unsigned char flag)
 {
 {
 	WFIFOHEAD(fd,3);
 	WFIFOHEAD(fd,3);
 	WFIFOW(fd,0) = 0x3871;
 	WFIFOW(fd,0) = 0x3871;
@@ -169,13 +169,13 @@ void mapif_mercenary_deleted(int fd, unsigned char flag)
 	WFIFOSET(fd,3);
 	WFIFOSET(fd,3);
 }
 }
 
 
-void mapif_parse_mercenary_delete(int fd, int merc_id)
+void mapif_parse_mercenary_delete(int32 fd, int32 merc_id)
 {
 {
 	bool result = mapif_mercenary_delete(merc_id);
 	bool result = mapif_mercenary_delete(merc_id);
 	mapif_mercenary_deleted(fd, result);
 	mapif_mercenary_deleted(fd, result);
 }
 }
 
 
-void mapif_mercenary_saved(int fd, unsigned char flag)
+void mapif_mercenary_saved(int32 fd, unsigned char flag)
 {
 {
 	WFIFOHEAD(fd,3);
 	WFIFOHEAD(fd,3);
 	WFIFOW(fd,0) = 0x3872;
 	WFIFOW(fd,0) = 0x3872;
@@ -183,13 +183,13 @@ void mapif_mercenary_saved(int fd, unsigned char flag)
 	WFIFOSET(fd,3);
 	WFIFOSET(fd,3);
 }
 }
 
 
-void mapif_parse_mercenary_save(int fd, struct s_mercenary* merc)
+void mapif_parse_mercenary_save(int32 fd, struct s_mercenary* merc)
 {
 {
 	bool result = mapif_mercenary_save(merc);
 	bool result = mapif_mercenary_save(merc);
 	mapif_mercenary_saved(fd, result);
 	mapif_mercenary_saved(fd, result);
 }
 }
 
 
-int inter_mercenary_sql_init(void)
+int32 inter_mercenary_sql_init(void)
 {
 {
 	return 0;
 	return 0;
 }
 }
@@ -201,7 +201,7 @@ void inter_mercenary_sql_final(void)
 /*==========================================
 /*==========================================
  * Inter Packets
  * Inter Packets
  *------------------------------------------*/
  *------------------------------------------*/
-int inter_mercenary_parse_frommap(int fd)
+int32 inter_mercenary_parse_frommap(int32 fd)
 {
 {
 	unsigned short cmd = RFIFOW(fd,0);
 	unsigned short cmd = RFIFOW(fd,0);
 
 

+ 3 - 3
src/char/int_mercenary.hpp

@@ -6,16 +6,16 @@
 
 
 #include <common/cbasetypes.hpp>
 #include <common/cbasetypes.hpp>
 
 
-int inter_mercenary_sql_init(void);
+int32 inter_mercenary_sql_init(void);
 void inter_mercenary_sql_final(void);
 void inter_mercenary_sql_final(void);
-int inter_mercenary_parse_frommap(int fd);
+int32 inter_mercenary_parse_frommap(int32 fd);
 
 
 // Mercenary Owner Database
 // Mercenary Owner Database
 bool mercenary_owner_fromsql(uint32 char_id, struct mmo_charstatus *status);
 bool mercenary_owner_fromsql(uint32 char_id, struct mmo_charstatus *status);
 bool mercenary_owner_tosql(uint32 char_id, struct mmo_charstatus *status);
 bool mercenary_owner_tosql(uint32 char_id, struct mmo_charstatus *status);
 bool mercenary_owner_delete(uint32 char_id);
 bool mercenary_owner_delete(uint32 char_id);
 
 
-bool mapif_mercenary_delete(int merc_id);
+bool mapif_mercenary_delete(int32 merc_id);
 
 
 
 
 #endif /* INT_MERCENARY_HPP */
 #endif /* INT_MERCENARY_HPP */

+ 56 - 56
src/char/int_party.cpp

@@ -26,23 +26,23 @@ using namespace rathena;
 struct party_data {
 struct party_data {
 	struct party party;
 	struct party party;
 	uint32 min_lv, max_lv;
 	uint32 min_lv, max_lv;
-	int family; //Is this party a family? if so, this holds the child id.
+	int32 family; //Is this party a family? if so, this holds the child id.
 	unsigned char size; //Total size of party.
 	unsigned char size; //Total size of party.
 };
 };
 
 
-// int party_id -> struct party_data*
+// int32 party_id -> struct party_data*
 static std::unordered_map<int32, std::shared_ptr<struct party_data>> party_db;
 static std::unordered_map<int32, std::shared_ptr<struct party_data>> party_db;
 
 
-int mapif_party_broken(int party_id,int flag);
-int party_check_empty( std::shared_ptr<struct party_data> p );
-int mapif_parse_PartyLeave(int fd, int party_id, uint32 account_id, uint32 char_id, char *name, enum e_party_member_withdraw type);
-int party_check_exp_share( std::shared_ptr<struct party_data> p );
-int mapif_party_optionchanged(int fd,struct party *p, uint32 account_id, int flag);
-int party_check_family_share( std::shared_ptr<struct party_data> p );
+int32 mapif_party_broken(int32 party_id,int32 flag);
+int32 party_check_empty( std::shared_ptr<struct party_data> p );
+int32 mapif_parse_PartyLeave(int32 fd, int32 party_id, uint32 account_id, uint32 char_id, char *name, enum e_party_member_withdraw type);
+int32 party_check_exp_share( std::shared_ptr<struct party_data> p );
+int32 mapif_party_optionchanged(int32 fd,struct party *p, uint32 account_id, int32 flag);
+int32 party_check_family_share( std::shared_ptr<struct party_data> p );
 
 
 //Updates party's level range and unsets even share if broken.
 //Updates party's level range and unsets even share if broken.
-static int int_party_check_lv( std::shared_ptr<struct party_data> p ){
-	int i;
+static int32 int_party_check_lv( std::shared_ptr<struct party_data> p ){
+	int32 i;
 	uint32 lv;
 	uint32 lv;
 	p->min_lv = UINT_MAX;
 	p->min_lv = UINT_MAX;
 	p->max_lv = 0;
 	p->max_lv = 0;
@@ -67,7 +67,7 @@ static int int_party_check_lv( std::shared_ptr<struct party_data> p ){
 }
 }
 //Calculates the state of a party.
 //Calculates the state of a party.
 void int_party_calc_state( std::shared_ptr<struct party_data> p ){
 void int_party_calc_state( std::shared_ptr<struct party_data> p ){
-	int i;
+	int32 i;
 	p->min_lv = UINT_MAX;
 	p->min_lv = UINT_MAX;
 	p->max_lv = 0;
 	p->max_lv = 0;
 	p->party.count =
 	p->party.count =
@@ -115,7 +115,7 @@ void int_party_calc_state( std::shared_ptr<struct party_data> p ){
 }
 }
 
 
 // Save party to mysql
 // Save party to mysql
-int inter_party_tosql(struct party *p, int flag, int index)
+int32 inter_party_tosql(struct party *p, int32 flag, int32 index)
 {
 {
 	// 'party' ('party_id','name','exp','item','leader_id','leader_char')
 	// 'party' ('party_id','name','exp','item','leader_id','leader_char')
 	char esc_name[NAME_LENGTH*2+1];// escaped party name
 	char esc_name[NAME_LENGTH*2+1];// escaped party name
@@ -189,13 +189,13 @@ int inter_party_tosql(struct party *p, int flag, int index)
 }
 }
 
 
 // Read party from mysql
 // Read party from mysql
-std::shared_ptr<struct party_data> inter_party_fromsql( int party_id ){
-	int leader_id = 0;
-	int leader_char = 0;
+std::shared_ptr<struct party_data> inter_party_fromsql( int32 party_id ){
+	int32 leader_id = 0;
+	int32 leader_char = 0;
 	struct party_member* m;
 	struct party_member* m;
 	char* data;
 	char* data;
 	size_t len;
 	size_t len;
-	int i;
+	int32 i;
 
 
 #ifdef NOISY
 #ifdef NOISY
 	ShowInfo("Load party request (" CL_BOLD "%d" CL_RESET ")\n", party_id);
 	ShowInfo("Load party request (" CL_BOLD "%d" CL_RESET ")\n", party_id);
@@ -260,7 +260,7 @@ std::shared_ptr<struct party_data> inter_party_fromsql( int party_id ){
 	return p;
 	return p;
 }
 }
 
 
-int inter_party_sql_init(void)
+int32 inter_party_sql_init(void)
 {
 {
 	// Remove parties with no members on startup from party_db. [Skotlex]
 	// Remove parties with no members on startup from party_db. [Skotlex]
 	if (charserv_config.clear_parties) {
 	if (charserv_config.clear_parties) {
@@ -297,8 +297,8 @@ std::shared_ptr<struct party_data> search_partyname( char* str ){
 	return p;
 	return p;
 }
 }
 
 
-int party_check_family_share( std::shared_ptr<struct party_data> p ){
-	int i;
+int32 party_check_family_share( std::shared_ptr<struct party_data> p ){
+	int32 i;
 	const char* map = nullptr;
 	const char* map = nullptr;
 	if (!p->family)
 	if (!p->family)
 		return 0;
 		return 0;
@@ -337,13 +337,13 @@ int party_check_family_share( std::shared_ptr<struct party_data> p ){
 }
 }
 
 
 // Returns whether this party can keep having exp share or not.
 // Returns whether this party can keep having exp share or not.
-int party_check_exp_share( std::shared_ptr<struct party_data> p ){
+int32 party_check_exp_share( std::shared_ptr<struct party_data> p ){
 	return (p->party.count < 2 || p->max_lv - p->min_lv <= party_share_level || party_check_family_share(p));
 	return (p->party.count < 2 || p->max_lv - p->min_lv <= party_share_level || party_check_family_share(p));
 }
 }
 
 
 // Is there any member in the party?
 // Is there any member in the party?
-int party_check_empty( std::shared_ptr<struct party_data> p ){
-	int i;
+int32 party_check_empty( std::shared_ptr<struct party_data> p ){
+	int32 i;
 
 
 	if( p == nullptr || p->party.party_id == 0 ){
 	if( p == nullptr || p->party.party_id == 0 ){
 		return 1;
 		return 1;
@@ -362,7 +362,7 @@ int party_check_empty( std::shared_ptr<struct party_data> p ){
 
 
 
 
 // Create a party whether or not
 // Create a party whether or not
-int mapif_party_created(int fd,uint32 account_id,uint32 char_id,struct party *p)
+int32 mapif_party_created(int32 fd,uint32 account_id,uint32 char_id,struct party *p)
 {
 {
 	WFIFOHEAD(fd, 39);
 	WFIFOHEAD(fd, 39);
 	WFIFOW(fd,0)=0x3820;
 	WFIFOW(fd,0)=0x3820;
@@ -384,7 +384,7 @@ int mapif_party_created(int fd,uint32 account_id,uint32 char_id,struct party *p)
 }
 }
 
 
 //Party information not found
 //Party information not found
-void mapif_party_noinfo(int fd, int party_id, uint32 char_id)
+void mapif_party_noinfo(int32 fd, int32 party_id, uint32 char_id)
 {
 {
 	WFIFOHEAD(fd, 12);
 	WFIFOHEAD(fd, 12);
 	WFIFOW(fd,0) = 0x3821;
 	WFIFOW(fd,0) = 0x3821;
@@ -396,7 +396,7 @@ void mapif_party_noinfo(int fd, int party_id, uint32 char_id)
 }
 }
 
 
 //Digest party information
 //Digest party information
-void mapif_party_info(int fd, struct party* p, uint32 char_id)
+void mapif_party_info(int32 fd, struct party* p, uint32 char_id)
 {
 {
 	unsigned char buf[8 + sizeof(struct party)];
 	unsigned char buf[8 + sizeof(struct party)];
 	WBUFW(buf,0) = 0x3821;
 	WBUFW(buf,0) = 0x3821;
@@ -411,7 +411,7 @@ void mapif_party_info(int fd, struct party* p, uint32 char_id)
 }
 }
 
 
 //Whether or not additional party members
 //Whether or not additional party members
-int mapif_party_memberadded(int fd, int party_id, uint32 account_id, uint32 char_id, int flag) {
+int32 mapif_party_memberadded(int32 fd, int32 party_id, uint32 account_id, uint32 char_id, int32 flag) {
 	WFIFOHEAD(fd, 15);
 	WFIFOHEAD(fd, 15);
 	WFIFOW(fd,0) = 0x3822;
 	WFIFOW(fd,0) = 0x3822;
 	WFIFOL(fd,2) = party_id;
 	WFIFOL(fd,2) = party_id;
@@ -424,7 +424,7 @@ int mapif_party_memberadded(int fd, int party_id, uint32 account_id, uint32 char
 }
 }
 
 
 // Party setting change notification
 // Party setting change notification
-int mapif_party_optionchanged(int fd,struct party *p,uint32 account_id,int flag)
+int32 mapif_party_optionchanged(int32 fd,struct party *p,uint32 account_id,int32 flag)
 {
 {
 	unsigned char buf[16];
 	unsigned char buf[16];
 	WBUFW(buf,0)=0x3823;
 	WBUFW(buf,0)=0x3823;
@@ -441,7 +441,7 @@ int mapif_party_optionchanged(int fd,struct party *p,uint32 account_id,int flag)
 }
 }
 
 
 //Withdrawal notification party
 //Withdrawal notification party
-int mapif_party_withdraw(int party_id, uint32 account_id, uint32 char_id, char *name, enum e_party_member_withdraw type) {
+int32 mapif_party_withdraw(int32 party_id, uint32 account_id, uint32 char_id, char *name, enum e_party_member_withdraw type) {
 	unsigned char buf[15+NAME_LENGTH];
 	unsigned char buf[15+NAME_LENGTH];
 
 
 	WBUFW(buf,0) = 0x3824;
 	WBUFW(buf,0) = 0x3824;
@@ -455,7 +455,7 @@ int mapif_party_withdraw(int party_id, uint32 account_id, uint32 char_id, char *
 }
 }
 
 
 //Party map update notification
 //Party map update notification
-int mapif_party_membermoved(struct party *p,int idx)
+int32 mapif_party_membermoved(struct party *p,int32 idx)
 {
 {
 	unsigned char buf[17+MAP_NAME_LENGTH_EXT];
 	unsigned char buf[17+MAP_NAME_LENGTH_EXT];
 
 
@@ -473,7 +473,7 @@ int mapif_party_membermoved(struct party *p,int idx)
 }
 }
 
 
 //Dissolution party notification
 //Dissolution party notification
-int mapif_party_broken(int party_id,int flag)
+int32 mapif_party_broken(int32 party_id,int32 flag)
 {
 {
 	unsigned char buf[16];
 	unsigned char buf[16];
 	WBUFW(buf,0)=0x3826;
 	WBUFW(buf,0)=0x3826;
@@ -485,7 +485,7 @@ int mapif_party_broken(int party_id,int flag)
 }
 }
 
 
 //Remarks in the party
 //Remarks in the party
-int mapif_party_message(int party_id,uint32 account_id,char *mes,int len, int sfd)
+int32 mapif_party_message(int32 party_id,uint32 account_id,char *mes,int32 len, int32 sfd)
 {
 {
 	unsigned char buf[512];
 	unsigned char buf[512];
 	WBUFW(buf,0)=0x3827;
 	WBUFW(buf,0)=0x3827;
@@ -502,7 +502,7 @@ int mapif_party_message(int party_id,uint32 account_id,char *mes,int len, int sf
 
 
 
 
 // Create Party
 // Create Party
-int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct party_member *leader)
+int32 mapif_parse_CreateParty(int32 fd, char *name, int32 item, int32 item2, struct party_member *leader)
 {
 {
 	std::shared_ptr<struct party_data> p = search_partyname( name );
 	std::shared_ptr<struct party_data> p = search_partyname( name );
 
 
@@ -513,7 +513,7 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part
 
 
 	// Check Authorised letters/symbols in the name of the character
 	// Check Authorised letters/symbols in the name of the character
 	if (charserv_config.char_config.char_name_option == 1) { // only letters/symbols in char_name_letters are authorised
 	if (charserv_config.char_config.char_name_option == 1) { // only letters/symbols in char_name_letters are authorised
-		for( int i = 0; i < NAME_LENGTH && name[i]; i++ ){
+		for( int32 i = 0; i < NAME_LENGTH && name[i]; i++ ){
 			if (strchr(charserv_config.char_config.char_name_letters, name[i]) == nullptr) {
 			if (strchr(charserv_config.char_config.char_name_letters, name[i]) == nullptr) {
 				if( name[i] == '"' ) { /* client-special-char */
 				if( name[i] == '"' ) { /* client-special-char */
 					normalize_name(name,"\"");
 					normalize_name(name,"\"");
@@ -525,7 +525,7 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part
 			}
 			}
 		}
 		}
 	} else if (charserv_config.char_config.char_name_option == 2) { // letters/symbols in char_name_letters are forbidden
 	} else if (charserv_config.char_config.char_name_option == 2) { // letters/symbols in char_name_letters are forbidden
-		for( int i = 0; i < NAME_LENGTH && name[i]; i++ ){
+		for( int32 i = 0; i < NAME_LENGTH && name[i]; i++ ){
 			if (strchr(charserv_config.char_config.char_name_letters, name[i]) != nullptr) {
 			if (strchr(charserv_config.char_config.char_name_letters, name[i]) != nullptr) {
 				mapif_party_created(fd,leader->account_id,leader->char_id,nullptr);
 				mapif_party_created(fd,leader->account_id,leader->char_id,nullptr);
 				return 0;
 				return 0;
@@ -559,7 +559,7 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part
 }
 }
 
 
 // Party information request
 // Party information request
-void mapif_parse_PartyInfo(int fd, int party_id, uint32 char_id)
+void mapif_parse_PartyInfo(int32 fd, int32 party_id, uint32 char_id)
 {
 {
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 
 
@@ -571,9 +571,9 @@ void mapif_parse_PartyInfo(int fd, int party_id, uint32 char_id)
 }
 }
 
 
 // Add a player to party request
 // Add a player to party request
-int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member)
+int32 mapif_parse_PartyAddMember(int32 fd, int32 party_id, struct party_member *member)
 {
 {
-	int i;
+	int32 i;
 
 
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 
 
@@ -609,9 +609,9 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member
 }
 }
 
 
 //Party setting change request
 //Party setting change request
-int mapif_parse_PartyChangeOption(int fd,int party_id,uint32 account_id,int exp,int item)
+int32 mapif_parse_PartyChangeOption(int32 fd,int32 party_id,uint32 account_id,int32 exp,int32 item)
 {
 {
-	int flag = 0;
+	int32 flag = 0;
 
 
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 
 
@@ -631,9 +631,9 @@ int mapif_parse_PartyChangeOption(int fd,int party_id,uint32 account_id,int exp,
 }
 }
 
 
 //Request leave party
 //Request leave party
-int mapif_parse_PartyLeave(int fd, int party_id, uint32 account_id, uint32 char_id, char *name, enum e_party_member_withdraw type)
+int32 mapif_parse_PartyLeave(int32 fd, int32 party_id, uint32 account_id, uint32 char_id, char *name, enum e_party_member_withdraw type)
 {
 {
-	int i,j=-1;
+	int32 i,j=-1;
 
 
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 
 
@@ -683,8 +683,8 @@ int mapif_parse_PartyLeave(int fd, int party_id, uint32 account_id, uint32 char_
 	return 0;
 	return 0;
 }
 }
 // When member goes to other map or levels up.
 // When member goes to other map or levels up.
-int mapif_parse_PartyChangeMap( int fd, int party_id, uint32 account_id, uint32 char_id, int online, uint32 lv, const char* map ){
-	int i;
+int32 mapif_parse_PartyChangeMap( int32 fd, int32 party_id, uint32 account_id, uint32 char_id, int32 online, uint32 lv, const char* map ){
+	int32 i;
 
 
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 
 
@@ -741,7 +741,7 @@ int mapif_parse_PartyChangeMap( int fd, int party_id, uint32 account_id, uint32
 }
 }
 
 
 //Request party dissolution
 //Request party dissolution
-int mapif_parse_BreakParty(int fd,int party_id)
+int32 mapif_parse_BreakParty(int32 fd,int32 party_id)
 {
 {
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 
 
@@ -753,19 +753,19 @@ int mapif_parse_BreakParty(int fd,int party_id)
 }
 }
 
 
 //Party sending the message
 //Party sending the message
-int mapif_parse_PartyMessage(int fd,int party_id,uint32 account_id,char *mes,int len)
+int32 mapif_parse_PartyMessage(int32 fd,int32 party_id,uint32 account_id,char *mes,int32 len)
 {
 {
 	return mapif_party_message(party_id,account_id,mes,len, fd);
 	return mapif_party_message(party_id,account_id,mes,len, fd);
 }
 }
 
 
-int mapif_parse_PartyLeaderChange(int fd,int party_id,uint32 account_id,uint32 char_id)
+int32 mapif_parse_PartyLeaderChange(int32 fd,int32 party_id,uint32 account_id,uint32 char_id)
 {
 {
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 
 
 	if(!p)
 	if(!p)
 		return 0;
 		return 0;
 
 
-	for( int i = 0; i < MAX_PARTY; i++ ){
+	for( int32 i = 0; i < MAX_PARTY; i++ ){
 		if(p->party.member[i].leader)
 		if(p->party.member[i].leader)
 			p->party.member[i].leader = 0;
 			p->party.member[i].leader = 0;
 		if(p->party.member[i].account_id == account_id &&
 		if(p->party.member[i].account_id == account_id &&
@@ -784,7 +784,7 @@ int mapif_parse_PartyLeaderChange(int fd,int party_id,uint32 account_id,uint32 c
  * @param share_lvl : Max level number of difference to share exp
  * @param share_lvl : Max level number of difference to share exp
  * @return 
  * @return 
  */
  */
-int mapif_parse_PartyShareLevel(int fd,uint32 share_lvl)
+int32 mapif_parse_PartyShareLevel(int32 fd,uint32 share_lvl)
 {
 {
 	party_share_level = share_lvl;
 	party_share_level = share_lvl;
 
 
@@ -808,7 +808,7 @@ int mapif_parse_PartyShareLevel(int fd,uint32 share_lvl)
 // Return :
 // Return :
 // 	0 : error
 // 	0 : error
 //	1 : ok
 //	1 : ok
-int inter_party_parse_frommap(int fd)
+int32 inter_party_parse_frommap(int32 fd)
 {
 {
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	switch(RFIFOW(fd,0)) {
 	switch(RFIFOW(fd,0)) {
@@ -829,14 +829,14 @@ int inter_party_parse_frommap(int fd)
 }
 }
 
 
 //Leave request from the server (for delete character)
 //Leave request from the server (for delete character)
-int inter_party_leave(int party_id,uint32 account_id, uint32 char_id, char *name)
+int32 inter_party_leave(int32 party_id,uint32 account_id, uint32 char_id, char *name)
 {
 {
 	return mapif_parse_PartyLeave(-1,party_id,account_id, char_id, name, PARTY_MEMBER_WITHDRAW_EXPEL);
 	return mapif_parse_PartyLeave(-1,party_id,account_id, char_id, name, PARTY_MEMBER_WITHDRAW_EXPEL);
 }
 }
 
 
-int inter_party_CharOnline(uint32 char_id, int party_id)
+int32 inter_party_CharOnline(uint32 char_id, int32 party_id)
 {
 {
-	int i;
+	int32 i;
 
 
 	if( party_id == -1 )
 	if( party_id == -1 )
 	{// Get party_id from the database
 	{// Get party_id from the database
@@ -881,8 +881,8 @@ int inter_party_CharOnline(uint32 char_id, int party_id)
 	return 1;
 	return 1;
 }
 }
 
 
-int inter_party_CharOffline(uint32 char_id, int party_id) {
-	int i;
+int32 inter_party_CharOffline(uint32 char_id, int32 party_id) {
+	int32 i;
 
 
 	if( party_id == -1 )
 	if( party_id == -1 )
 	{// Get guild_id from the database
 	{// Get guild_id from the database
@@ -932,9 +932,9 @@ int inter_party_CharOffline(uint32 char_id, int party_id) {
 	return 1;
 	return 1;
 }
 }
 
 
-int inter_party_charname_changed(int party_id, uint32 char_id, char *name)
+int32 inter_party_charname_changed(int32 party_id, uint32 char_id, char *name)
 {
 {
-	int i;
+	int32 i;
 
 
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 	std::shared_ptr<struct party_data> p = inter_party_fromsql( party_id );
 
 

+ 6 - 6
src/char/int_party.hpp

@@ -18,12 +18,12 @@ enum e_PartySaveWhatFlag {
 
 
 //struct party;
 //struct party;
 
 
-int inter_party_parse_frommap(int fd);
-int inter_party_sql_init(void);
+int32 inter_party_parse_frommap(int32 fd);
+int32 inter_party_sql_init(void);
 void inter_party_sql_final(void);
 void inter_party_sql_final(void);
-int inter_party_leave(int party_id,uint32 account_id, uint32 char_id, char *name);
-int inter_party_charname_changed(int party_id, uint32 char_id, char *name);
-int inter_party_CharOnline(uint32 char_id, int party_id);
-int inter_party_CharOffline(uint32 char_id, int party_id);
+int32 inter_party_leave(int32 party_id,uint32 account_id, uint32 char_id, char *name);
+int32 inter_party_charname_changed(int32 party_id, uint32 char_id, char *name);
+int32 inter_party_CharOnline(uint32 char_id, int32 party_id);
+int32 inter_party_CharOffline(uint32 char_id, int32 party_id);
 
 
 #endif /* INT_PARTY_HPP */
 #endif /* INT_PARTY_HPP */

+ 20 - 20
src/char/int_pet.cpp

@@ -18,10 +18,10 @@
 #include "inter.hpp"
 #include "inter.hpp"
 
 
 struct s_pet *pet_pt;
 struct s_pet *pet_pt;
-int mapif_load_pet(int fd, uint32 account_id, uint32 char_id, int pet_id);
+int32 mapif_load_pet(int32 fd, uint32 account_id, uint32 char_id, int32 pet_id);
 
 
 //---------------------------------------------------------
 //---------------------------------------------------------
-int inter_pet_tosql(int pet_id, struct s_pet* p)
+int32 inter_pet_tosql(int32 pet_id, struct s_pet* p)
 {
 {
 	//`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incubate`,`autofeed`)
 	//`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incubate`,`autofeed`)
 	char esc_name[NAME_LENGTH*2+1];// escaped pet name
 	char esc_name[NAME_LENGTH*2+1];// escaped pet name
@@ -59,7 +59,7 @@ int inter_pet_tosql(int pet_id, struct s_pet* p)
 	return 1;
 	return 1;
 }
 }
 
 
-int inter_pet_fromsql(int pet_id, struct s_pet* p)
+int32 inter_pet_fromsql(int32 pet_id, struct s_pet* p)
 {
 {
 	char* data;
 	char* data;
 	size_t len;
 	size_t len;
@@ -105,7 +105,7 @@ int inter_pet_fromsql(int pet_id, struct s_pet* p)
 }
 }
 //----------------------------------------------
 //----------------------------------------------
 
 
-int inter_pet_sql_init(void){
+int32 inter_pet_sql_init(void){
 	//memory alloc
 	//memory alloc
 	pet_pt = (struct s_pet*)aCalloc(sizeof(struct s_pet), 1);
 	pet_pt = (struct s_pet*)aCalloc(sizeof(struct s_pet), 1);
 	return 0;
 	return 0;
@@ -115,7 +115,7 @@ void inter_pet_sql_final(void){
 	return;
 	return;
 }
 }
 //----------------------------------
 //----------------------------------
-int inter_pet_delete(int pet_id){
+int32 inter_pet_delete(int32 pet_id){
 	ShowInfo("delete pet request: %d...\n",pet_id);
 	ShowInfo("delete pet request: %d...\n",pet_id);
 
 
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `pet_id`='%d'", schema_config.pet_db, pet_id) )
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `pet_id`='%d'", schema_config.pet_db, pet_id) )
@@ -123,7 +123,7 @@ int inter_pet_delete(int pet_id){
 	return 0;
 	return 0;
 }
 }
 //------------------------------------------------------
 //------------------------------------------------------
-int mapif_pet_created(int fd, uint32 account_id, struct s_pet *p)
+int32 mapif_pet_created(int32 fd, uint32 account_id, struct s_pet *p)
 {
 {
 	WFIFOHEAD(fd, 12);
 	WFIFOHEAD(fd, 12);
 	WFIFOW(fd, 0) = 0x3880;
 	WFIFOW(fd, 0) = 0x3880;
@@ -141,7 +141,7 @@ int mapif_pet_created(int fd, uint32 account_id, struct s_pet *p)
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_pet_info(int fd, uint32 account_id, struct s_pet *p){
+int32 mapif_pet_info(int32 fd, uint32 account_id, struct s_pet *p){
 	WFIFOHEAD(fd, sizeof(struct s_pet) + 9);
 	WFIFOHEAD(fd, sizeof(struct s_pet) + 9);
 	WFIFOW(fd, 0) =0x3881;
 	WFIFOW(fd, 0) =0x3881;
 	WFIFOW(fd, 2) =sizeof(struct s_pet) + 9;
 	WFIFOW(fd, 2) =sizeof(struct s_pet) + 9;
@@ -153,7 +153,7 @@ int mapif_pet_info(int fd, uint32 account_id, struct s_pet *p){
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_pet_noinfo(int fd, uint32 account_id){
+int32 mapif_pet_noinfo(int32 fd, uint32 account_id){
 	WFIFOHEAD(fd, sizeof(struct s_pet) + 9);
 	WFIFOHEAD(fd, sizeof(struct s_pet) + 9);
 	WFIFOW(fd, 0) =0x3881;
 	WFIFOW(fd, 0) =0x3881;
 	WFIFOW(fd, 2) =sizeof(struct s_pet) + 9;
 	WFIFOW(fd, 2) =sizeof(struct s_pet) + 9;
@@ -165,7 +165,7 @@ int mapif_pet_noinfo(int fd, uint32 account_id){
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_save_pet_ack(int fd, uint32 account_id, int flag){
+int32 mapif_save_pet_ack(int32 fd, uint32 account_id, int32 flag){
 	WFIFOHEAD(fd, 7);
 	WFIFOHEAD(fd, 7);
 	WFIFOW(fd, 0) =0x3882;
 	WFIFOW(fd, 0) =0x3882;
 	WFIFOL(fd, 2) =account_id;
 	WFIFOL(fd, 2) =account_id;
@@ -175,7 +175,7 @@ int mapif_save_pet_ack(int fd, uint32 account_id, int flag){
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_delete_pet_ack(int fd, int flag){
+int32 mapif_delete_pet_ack(int32 fd, int32 flag){
 	WFIFOHEAD(fd, 3);
 	WFIFOHEAD(fd, 3);
 	WFIFOW(fd, 0) =0x3883;
 	WFIFOW(fd, 0) =0x3883;
 	WFIFOB(fd, 2) =flag;
 	WFIFOB(fd, 2) =flag;
@@ -184,7 +184,7 @@ int mapif_delete_pet_ack(int fd, int flag){
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_create_pet(int 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, 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)
 {
 {
 	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);
@@ -226,7 +226,7 @@ int mapif_create_pet(int fd, uint32 account_id, uint32 char_id, short pet_class,
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_load_pet(int fd, uint32 account_id, uint32 char_id, int pet_id){
+int32 mapif_load_pet(int32 fd, uint32 account_id, uint32 char_id, int32 pet_id){
 	memset(pet_pt, 0, sizeof(struct s_pet));
 	memset(pet_pt, 0, sizeof(struct s_pet));
 
 
 	inter_pet_fromsql(pet_id, pet_pt);
 	inter_pet_fromsql(pet_id, pet_pt);
@@ -247,9 +247,9 @@ int mapif_load_pet(int fd, uint32 account_id, uint32 char_id, int pet_id){
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_save_pet(int fd, uint32 account_id, struct s_pet *data) {
+int32 mapif_save_pet(int32 fd, uint32 account_id, struct s_pet *data) {
 	//here process pet save request.
 	//here process pet save request.
-	int len;
+	int32 len;
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	len=RFIFOW(fd, 2);
 	len=RFIFOW(fd, 2);
 	if(sizeof(struct s_pet)!=len-8) {
 	if(sizeof(struct s_pet)!=len-8) {
@@ -272,38 +272,38 @@ int mapif_save_pet(int fd, uint32 account_id, struct s_pet *data) {
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_delete_pet(int fd, int pet_id){
+int32 mapif_delete_pet(int32 fd, int32 pet_id){
 	mapif_delete_pet_ack(fd, inter_pet_delete(pet_id));
 	mapif_delete_pet_ack(fd, inter_pet_delete(pet_id));
 
 
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_parse_CreatePet(int fd){
+int32 mapif_parse_CreatePet(int32 fd){
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	mapif_create_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOL(fd, 14), RFIFOL(fd, 18), RFIFOW(fd, 22),
 	mapif_create_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOL(fd, 14), RFIFOL(fd, 18), RFIFOW(fd, 22),
 		RFIFOW(fd, 24), RFIFOB(fd, 26), RFIFOB(fd, 27), RFIFOCP(fd, 28));
 		RFIFOW(fd, 24), RFIFOB(fd, 26), RFIFOB(fd, 27), RFIFOCP(fd, 28));
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_parse_LoadPet(int fd){
+int32 mapif_parse_LoadPet(int32 fd){
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	mapif_load_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOL(fd, 10));
 	mapif_load_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOL(fd, 10));
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_parse_SavePet(int fd){
+int32 mapif_parse_SavePet(int32 fd){
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	mapif_save_pet(fd, RFIFOL(fd, 4), (struct s_pet *) RFIFOP(fd, 8));
 	mapif_save_pet(fd, RFIFOL(fd, 4), (struct s_pet *) RFIFOP(fd, 8));
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_parse_DeletePet(int fd){
+int32 mapif_parse_DeletePet(int32 fd){
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	mapif_delete_pet(fd, RFIFOL(fd, 2));
 	mapif_delete_pet(fd, RFIFOL(fd, 2));
 	return 0;
 	return 0;
 }
 }
 
 
-int inter_pet_parse_frommap(int fd){
+int32 inter_pet_parse_frommap(int32 fd){
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	switch(RFIFOW(fd, 0)){
 	switch(RFIFOW(fd, 0)){
 	case 0x3080: mapif_parse_CreatePet(fd); break;
 	case 0x3080: mapif_parse_CreatePet(fd); break;

+ 6 - 6
src/char/int_pet.hpp

@@ -8,15 +8,15 @@
 
 
 struct s_pet;
 struct s_pet;
 
 
-int inter_pet_init(void);
+int32 inter_pet_init(void);
 void inter_pet_sql_final(void);
 void inter_pet_sql_final(void);
-int inter_pet_save(void);
-int inter_pet_delete(int pet_id);
+int32 inter_pet_save(void);
+int32 inter_pet_delete(int32 pet_id);
 
 
-int inter_pet_parse_frommap(int fd);
-int inter_pet_sql_init(void);
+int32 inter_pet_parse_frommap(int32 fd);
+int32 inter_pet_sql_init(void);
   //extern char pet_txt[256];
   //extern char pet_txt[256];
 
 
-int inter_pet_tosql(int pet_id, struct s_pet *p);
+int32 inter_pet_tosql(int32 pet_id, struct s_pet *p);
 
 
 #endif /* INT_PET_HPP */
 #endif /* INT_PET_HPP */

+ 4 - 4
src/char/int_quest.cpp

@@ -85,7 +85,7 @@ struct quest *mapif_quests_fromsql( uint32 char_id, size_t& count ){
  * @param quest_id Quest ID
  * @param quest_id Quest ID
  * @return false in case of errors, true otherwise
  * @return false in case of errors, true otherwise
  */
  */
-bool mapif_quest_delete(uint32 char_id, int quest_id) {
+bool mapif_quest_delete(uint32 char_id, int32 quest_id) {
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `quest_id` = '%d' AND `char_id` = '%d'", schema_config.quest_db, quest_id, char_id) )
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `quest_id` = '%d' AND `char_id` = '%d'", schema_config.quest_db, quest_id, char_id) )
 	{
 	{
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
@@ -136,7 +136,7 @@ bool mapif_quest_update(uint32 char_id, struct quest qd) {
  *
  *
  * @see inter_parse_frommap
  * @see inter_parse_frommap
  */
  */
-int mapif_parse_quest_save(int fd) {
+int32 mapif_parse_quest_save(int32 fd) {
 	uint32 char_id = RFIFOL(fd,4);
 	uint32 char_id = RFIFOL(fd,4);
 	struct quest *old_qd = nullptr, *new_qd = nullptr;
 	struct quest *old_qd = nullptr, *new_qd = nullptr;
 	bool success = true;
 	bool success = true;
@@ -193,7 +193,7 @@ int mapif_parse_quest_save(int fd) {
  *
  *
  * @see inter_parse_frommap
  * @see inter_parse_frommap
  */
  */
-int mapif_parse_quest_load(int fd) {
+int32 mapif_parse_quest_load(int32 fd) {
 	uint32 char_id = RFIFOL(fd,2);
 	uint32 char_id = RFIFOL(fd,2);
 	size_t num_quests;
 	size_t num_quests;
 	struct quest* tmp_questlog = mapif_quests_fromsql( char_id, num_quests );
 	struct quest* tmp_questlog = mapif_quests_fromsql( char_id, num_quests );
@@ -219,7 +219,7 @@ int mapif_parse_quest_load(int fd) {
  *
  *
  * @see inter_parse_frommap
  * @see inter_parse_frommap
  */
  */
-int inter_quest_parse_frommap(int fd) {
+int32 inter_quest_parse_frommap(int32 fd) {
 	switch(RFIFOW(fd,0)) {
 	switch(RFIFOW(fd,0)) {
 		case 0x3060: mapif_parse_quest_load(fd); break;
 		case 0x3060: mapif_parse_quest_load(fd); break;
 		case 0x3061: mapif_parse_quest_save(fd); break;
 		case 0x3061: mapif_parse_quest_save(fd); break;

+ 3 - 1
src/char/int_quest.hpp

@@ -4,6 +4,8 @@
 #ifndef INT_QUEST_HPP
 #ifndef INT_QUEST_HPP
 #define INT_QUEST_HPP
 #define INT_QUEST_HPP
 
 
-int inter_quest_parse_frommap(int fd);
+#include <common/cbasetypes.hpp>
+
+int32 inter_quest_parse_frommap(int32 fd);
 
 
 #endif /* INT_QUEST_HPP */
 #endif /* INT_QUEST_HPP */

+ 24 - 24
src/char/int_storage.cpp

@@ -23,7 +23,7 @@
  * @param id: Storage ID
  * @param id: Storage ID
  * @return Max amount
  * @return Max amount
  */
  */
-int inter_premiumStorage_getMax(uint8 id) {
+int32 inter_premiumStorage_getMax(uint8 id) {
 	std::shared_ptr<s_storage_table> storage = interServerDb.find( id );
 	std::shared_ptr<s_storage_table> storage = interServerDb.find( id );
 
 
 	if( storage != nullptr ){
 	if( storage != nullptr ){
@@ -69,7 +69,7 @@ const char *inter_premiumStorage_getPrintableName(uint8 id) {
  * @param p: Inventory entries
  * @param p: Inventory entries
  * @return 0 if success, or error count
  * @return 0 if success, or error count
  */
  */
-int inventory_tosql(uint32 char_id, struct s_storage* p)
+int32 inventory_tosql(uint32 char_id, struct s_storage* p)
 {
 {
 	return char_memitemdata_to_sql(p->u.items_inventory, MAX_INVENTORY, char_id, TABLE_INVENTORY, p->stor_id);
 	return char_memitemdata_to_sql(p->u.items_inventory, MAX_INVENTORY, char_id, TABLE_INVENTORY, p->stor_id);
 }
 }
@@ -80,7 +80,7 @@ int inventory_tosql(uint32 char_id, struct s_storage* p)
  * @param p: Storage entries
  * @param p: Storage entries
  * @return 0 if success, or error count
  * @return 0 if success, or error count
  */
  */
-int storage_tosql(uint32 account_id, struct s_storage* p)
+int32 storage_tosql(uint32 account_id, struct s_storage* p)
 {
 {
 	return char_memitemdata_to_sql(p->u.items_storage, MAX_STORAGE, account_id, TABLE_STORAGE, p->stor_id);
 	return char_memitemdata_to_sql(p->u.items_storage, MAX_STORAGE, account_id, TABLE_STORAGE, p->stor_id);
 }
 }
@@ -91,7 +91,7 @@ int storage_tosql(uint32 account_id, struct s_storage* p)
  * @param p: Cart entries
  * @param p: Cart entries
  * @return 0 if success, or error count
  * @return 0 if success, or error count
  */
  */
-int cart_tosql(uint32 char_id, struct s_storage* p)
+int32 cart_tosql(uint32 char_id, struct s_storage* p)
 {
 {
 	return char_memitemdata_to_sql(p->u.items_cart, MAX_CART, char_id, TABLE_CART, p->stor_id);
 	return char_memitemdata_to_sql(p->u.items_cart, MAX_CART, char_id, TABLE_CART, p->stor_id);
 }
 }
@@ -136,7 +136,7 @@ bool storage_fromsql(uint32 account_id, struct s_storage* p)
  * @param p: Guild Storage entries
  * @param p: Guild Storage entries
  * @return True if success, False if failed
  * @return True if success, False if failed
  */
  */
-bool guild_storage_tosql(int guild_id, struct s_storage* p)
+bool guild_storage_tosql(int32 guild_id, struct s_storage* p)
 {
 {
 	//ShowInfo("Guild Storage has been saved (GID: %d)\n", guild_id);
 	//ShowInfo("Guild Storage has been saved (GID: %d)\n", guild_id);
 	return char_memitemdata_to_sql(p->u.items_guild, inter_guild_storagemax(guild_id), guild_id, TABLE_GUILD_STORAGE, p->stor_id);
 	return char_memitemdata_to_sql(p->u.items_guild, inter_guild_storagemax(guild_id), guild_id, TABLE_GUILD_STORAGE, p->stor_id);
@@ -148,7 +148,7 @@ bool guild_storage_tosql(int guild_id, struct s_storage* p)
  * @param p: Guild Storage entries
  * @param p: Guild Storage entries
  * @return True if success, False if failed
  * @return True if success, False if failed
  */
  */
-bool guild_storage_fromsql(int guild_id, struct s_storage* p)
+bool guild_storage_fromsql(int32 guild_id, struct s_storage* p)
 {
 {
 	return char_memitemdata_from_sql( p, inter_guild_storagemax(guild_id), guild_id, TABLE_GUILD_STORAGE, p->stor_id );
 	return char_memitemdata_from_sql( p, inter_guild_storagemax(guild_id), guild_id, TABLE_GUILD_STORAGE, p->stor_id );
 }
 }
@@ -193,7 +193,7 @@ void inter_storage_sql_final(void)
  * @param flag: Additional parameters
  * @param flag: Additional parameters
  * @return True on success or false on failure
  * @return True on success or false on failure
  */
  */
-bool mapif_load_guild_storage(int fd,uint32 account_id,int guild_id, char flag)
+bool mapif_load_guild_storage(int32 fd,uint32 account_id,int32 guild_id, char flag)
 {
 {
 	if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `guild_id` FROM `%s` WHERE `guild_id`='%d'", schema_config.guild_db, guild_id) )
 	if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `guild_id` FROM `%s` WHERE `guild_id`='%d'", schema_config.guild_db, guild_id) )
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
@@ -220,7 +220,7 @@ bool mapif_load_guild_storage(int fd,uint32 account_id,int guild_id, char flag)
 	return false;
 	return false;
 }
 }
 
 
-void mapif_save_guild_storage_ack(int fd,uint32 account_id,int guild_id,int fail)
+void mapif_save_guild_storage_ack(int32 fd,uint32 account_id,int32 guild_id,int32 fail)
 {
 {
 	WFIFOHEAD(fd,11);
 	WFIFOHEAD(fd,11);
 	WFIFOW(fd,0)=0x3819;
 	WFIFOW(fd,0)=0x3819;
@@ -233,7 +233,7 @@ void mapif_save_guild_storage_ack(int fd,uint32 account_id,int guild_id,int fail
 //---------------------------------------------------------
 //---------------------------------------------------------
 // packet from map server
 // packet from map server
 
 
-void mapif_parse_LoadGuildStorage(int fd)
+void mapif_parse_LoadGuildStorage(int32 fd)
 {
 {
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	mapif_load_guild_storage(fd,RFIFOL(fd,2),RFIFOL(fd,6),1);
 	mapif_load_guild_storage(fd,RFIFOL(fd,2),RFIFOL(fd,6),1);
@@ -244,10 +244,10 @@ void mapif_parse_LoadGuildStorage(int fd)
  * @param fd: Map server's fd
  * @param fd: Map server's fd
  * @return True on success or false on failure
  * @return True on success or false on failure
  */
  */
-bool mapif_parse_SaveGuildStorage(int fd)
+bool mapif_parse_SaveGuildStorage(int32 fd)
 {
 {
-	int guild_id;
-	int len;
+	int32 guild_id;
+	int32 len;
 
 
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	guild_id = RFIFOL(fd,8);
 	guild_id = RFIFOL(fd,8);
@@ -279,7 +279,7 @@ bool mapif_parse_SaveGuildStorage(int fd)
  * IZ 0x3856 <account_id>.L <guild_id>.W
  * IZ 0x3856 <account_id>.L <guild_id>.W
  * Tells map-server if the process if complete, unlock the guild storage
  * Tells map-server if the process if complete, unlock the guild storage
  */
  */
-void mapif_itembound_ack(int fd, int account_id, int guild_id)
+void mapif_itembound_ack(int32 fd, int32 account_id, int32 guild_id)
 {
 {
 	WFIFOHEAD(fd,8);
 	WFIFOHEAD(fd,8);
 	WFIFOW(fd,0) = 0x3856;
 	WFIFOW(fd,0) = 0x3856;
@@ -301,8 +301,8 @@ void mapif_itembound_ack(int fd, int account_id, int guild_id)
  * @param count
  * @param count
  * @author [Cydh]
  * @author [Cydh]
  */
  */
-void mapif_itembound_store2gstorage(int fd, int guild_id, struct item items[], unsigned short count) {
-	int size = 8 + sizeof(struct item) * MAX_INVENTORY, i;
+void mapif_itembound_store2gstorage(int32 fd, int32 guild_id, struct item items[], unsigned short count) {
+	int32 size = 8 + sizeof(struct item) * MAX_INVENTORY, i;
 
 
 	WFIFOHEAD(fd, size);
 	WFIFOHEAD(fd, size);
 	WFIFOW(fd, 0) = 0x3857;
 	WFIFOW(fd, 0) = 0x3857;
@@ -322,13 +322,13 @@ void mapif_itembound_store2gstorage(int fd, int guild_id, struct item items[], u
  * Pulls guild bound items for offline characters
  * Pulls guild bound items for offline characters
  * @author [Akinari]
  * @author [Akinari]
  */
  */
-bool mapif_parse_itembound_retrieve(int fd)
+bool mapif_parse_itembound_retrieve(int32 fd)
 {
 {
 	StringBuf buf;
 	StringBuf buf;
 	SqlStmt* stmt;
 	SqlStmt* stmt;
 	unsigned short i = 0, count = 0;
 	unsigned short i = 0, count = 0;
 	struct item item, items[MAX_INVENTORY];
 	struct item item, items[MAX_INVENTORY];
-	int j, guild_id = RFIFOW(fd,10);
+	int32 j, guild_id = RFIFOW(fd,10);
 	uint32 char_id = RFIFOL(fd,2), account_id = RFIFOL(fd,6);
 	uint32 char_id = RFIFOL(fd,2), account_id = RFIFOL(fd,6);
 
 
 	StringBuf_Init(&buf);
 	StringBuf_Init(&buf);
@@ -470,7 +470,7 @@ bool mapif_parse_itembound_retrieve(int fd)
  * @param entries Inventory/cart/storage entries
  * @param entries Inventory/cart/storage entries
  * @param result
  * @param result
  */
  */
-void mapif_storage_data_loaded(int fd, uint32 account_id, char type, struct s_storage* entries, bool result) {
+void mapif_storage_data_loaded(int32 fd, uint32 account_id, char type, struct s_storage* entries, bool result) {
 	uint16 size = sizeof(struct s_storage) + 10;
 	uint16 size = sizeof(struct s_storage) + 10;
 	
 	
 	WFIFOHEAD(fd, size);
 	WFIFOHEAD(fd, size);
@@ -493,7 +493,7 @@ void mapif_storage_data_loaded(int fd, uint32 account_id, char type, struct s_st
  * @param type
  * @param type
  * @param stor_id
  * @param stor_id
  */
  */
-void mapif_storage_saved(int fd, uint32 account_id, uint32 char_id, bool success, char type, uint8 stor_id) {
+void mapif_storage_saved(int32 fd, uint32 account_id, uint32 char_id, bool success, char type, uint8 stor_id) {
 	WFIFOHEAD(fd,9);
 	WFIFOHEAD(fd,9);
 	WFIFOW(fd, 0) = 0x388b;
 	WFIFOW(fd, 0) = 0x388b;
 	WFIFOL(fd, 2) = account_id;
 	WFIFOL(fd, 2) = account_id;
@@ -508,9 +508,9 @@ void mapif_storage_saved(int fd, uint32 account_id, uint32 char_id, bool success
  * ZI 0x308a <type>.B <account_id>.L <char_id>.L <storage_id>.B <mode>.B
  * ZI 0x308a <type>.B <account_id>.L <char_id>.L <storage_id>.B <mode>.B
  * @param fd
  * @param fd
  */
  */
-bool mapif_parse_StorageLoad(int fd) {
+bool mapif_parse_StorageLoad(int32 fd) {
 	uint32 aid, cid;
 	uint32 aid, cid;
-	int type;
+	int32 type;
 	uint8 stor_id, mode;
 	uint8 stor_id, mode;
 	struct s_storage stor;
 	struct s_storage stor;
 	bool res = true;
 	bool res = true;
@@ -551,8 +551,8 @@ bool mapif_parse_StorageLoad(int fd) {
  * ZI 0x308b <size>.W <type>.B <account_id>.L <char_id>.L <entries>.?B
  * ZI 0x308b <size>.W <type>.B <account_id>.L <char_id>.L <entries>.?B
  * @param fd
  * @param fd
  */
  */
-bool mapif_parse_StorageSave(int fd) {
-	int aid, cid, type;
+bool mapif_parse_StorageSave(int32 fd) {
+	int32 aid, cid, type;
 	struct s_storage stor;
 	struct s_storage stor;
 
 
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
@@ -585,7 +585,7 @@ bool mapif_parse_StorageSave(int fd) {
 /*==========================================
 /*==========================================
  * Parse packet from map-server
  * Parse packet from map-server
  *------------------------------------------*/
  *------------------------------------------*/
-bool inter_storage_parse_frommap(int fd)
+bool inter_storage_parse_frommap(int32 fd)
 {
 {
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
 	switch(RFIFOW(fd,0)){
 	switch(RFIFOW(fd,0)){

+ 3 - 3
src/char/int_storage.hpp

@@ -11,12 +11,12 @@ struct s_storage;
 void inter_storage_sql_init(void);
 void inter_storage_sql_init(void);
 void inter_storage_sql_final(void);
 void inter_storage_sql_final(void);
 
 
-int inter_premiumStorage_getMax(uint8 id);
+int32 inter_premiumStorage_getMax(uint8 id);
 const char *inter_premiumStorage_getTableName(uint8 id);
 const char *inter_premiumStorage_getTableName(uint8 id);
 const char *inter_premiumStorage_getPrintableName(uint8 id);
 const char *inter_premiumStorage_getPrintableName(uint8 id);
 
 
-bool inter_storage_parse_frommap(int fd);
+bool inter_storage_parse_frommap(int32 fd);
 
 
-bool guild_storage_tosql(int guild_id, struct s_storage *p);
+bool guild_storage_tosql(int32 guild_id, struct s_storage *p);
 
 
 #endif /* INT_STORAGE_HPP */
 #endif /* INT_STORAGE_HPP */

+ 54 - 54
src/char/inter.cpp

@@ -46,7 +46,7 @@ InterServerDatabase interServerDb;
 
 
 Sql* sql_handle = nullptr;	///Link to mysql db, connection FD
 Sql* sql_handle = nullptr;	///Link to mysql db, connection FD
 
 
-int char_server_port = 3306;
+int32 char_server_port = 3306;
 std::string char_server_ip = "127.0.0.1";
 std::string char_server_ip = "127.0.0.1";
 std::string char_server_id = "ragnarok";
 std::string char_server_id = "ragnarok";
 std::string char_server_pw = ""; // Allow user to send empty password (bugreport:7787)
 std::string char_server_pw = ""; // Allow user to send empty password (bugreport:7787)
@@ -55,7 +55,7 @@ std::string default_codepage = ""; //Feature by irmin.
 uint32 party_share_level = 10;
 uint32 party_share_level = 10;
 
 
 /// Received packet Lengths from map-server
 /// Received packet Lengths from map-server
-int inter_recv_packet_length[] = {
+int32 inter_recv_packet_length[] = {
 	-1,-1, 7,-1, -1,13,36, (2+4+4+4+1+NAME_LENGTH),  0,-1, 0, 0,  0, 0,  0, 0,	// 3000-
 	-1,-1, 7,-1, -1,13,36, (2+4+4+4+1+NAME_LENGTH),  0,-1, 0, 0,  0, 0,  0, 0,	// 3000-
 	 6,-1, 0, 0,  0, 0, 0, 0, 10,-1, 0, 0,  0, 0,  0, 0,	// 3010-
 	 6,-1, 0, 0,  0, 0, 0, 0, 10,-1, 0, 0,  0, 0,  0, 0,	// 3010-
 	-1,10,-1,14, 15+NAME_LENGTH,17+MAP_NAME_LENGTH_EXT, 6,-1, 14,14, 6, 0,  0, 0,  0, 0,	// 3020- Party
 	-1,10,-1,14, 15+NAME_LENGTH,17+MAP_NAME_LENGTH_EXT, 6,-1, 14,14, 6, 0,  0, 0,  0, 0,	// 3020- Party
@@ -74,16 +74,16 @@ int inter_recv_packet_length[] = {
 #endif
 #endif
 
 
 struct WisData {
 struct WisData {
-	int id, fd, count, len, gmlvl;
+	int32 id, fd, count, len, gmlvl;
 	t_tick tick;
 	t_tick tick;
 	char src[NAME_LENGTH], dst[NAME_LENGTH], msg[WHISPER_MESSAGE_SIZE];
 	char src[NAME_LENGTH], dst[NAME_LENGTH], msg[WHISPER_MESSAGE_SIZE];
 };
 };
 
 
-// int wis_id -> struct WisData*
+// int32 wis_id -> struct WisData*
 static std::unordered_map<int32, std::shared_ptr<struct WisData>> wis_db;
 static std::unordered_map<int32, std::shared_ptr<struct WisData>> wis_db;
 
 
 /* from pc.cpp due to @accinfo. any ideas to replace this crap are more than welcome. */
 /* from pc.cpp due to @accinfo. any ideas to replace this crap are more than welcome. */
-const char* job_name(int class_) {
+const char* job_name(int32 class_) {
 	switch (class_) {
 	switch (class_) {
 		case JOB_NOVICE:
 		case JOB_NOVICE:
 		case JOB_SWORDMAN:
 		case JOB_SWORDMAN:
@@ -387,21 +387,21 @@ const char * geoip_countryname[253] = {"Unknown","Asia/Pacific Region","Europe",
 		"Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala",
 		"Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala",
 		"Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia",
 		"Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia",
 		"Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan",
 		"Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan",
-		"Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait",
-		"Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania",
+		"Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint32 Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait",
+		"Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint32 Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania",
 		"Luxembourg","Latvia","Libyan Arab Jamahiriya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali",
 		"Luxembourg","Latvia","Libyan Arab Jamahiriya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali",
 		"Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives",
 		"Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives",
 		"Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua",
 		"Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua",
 		"Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia",
 		"Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia",
-		"Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau",
+		"Papua New Guinea","Philippines","Pakistan","Poland","Saint32 Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau",
 		"Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan",
 		"Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan",
-		"Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname",
+		"Sweden","Singapore","Saint32 Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname",
 		"Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand",
 		"Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand",
 		"Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan",
 		"Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan",
-		"Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint Vincent and the Grenadines","Venezuela",
+		"Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint32 Vincent and the Grenadines","Venezuela",
 		"Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa",
 		"Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa",
 		"Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey",
 		"Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey",
-		"Saint Barthelemy","Saint Martin"};
+		"Saint32 Barthelemy","Saint32 Martin"};
 unsigned char *geoip_cache;
 unsigned char *geoip_cache;
 void geoip_readdb(void){
 void geoip_readdb(void){
 	struct stat bufa;
 	struct stat bufa;
@@ -415,7 +415,7 @@ void geoip_readdb(void){
 /* [Dekamaster/Nightroad] */
 /* [Dekamaster/Nightroad] */
 /* There are millions of entries in GeoIP and it has its own algorithm to go quickly through them */
 /* There are millions of entries in GeoIP and it has its own algorithm to go quickly through them */
 const char* geoip_getcountry(uint32 ipnum){
 const char* geoip_getcountry(uint32 ipnum){
-	int depth;
+	int32 depth;
 	uint32 x;
 	uint32 x;
 	uint32 offset = 0;
 	uint32 offset = 0;
 
 
@@ -443,10 +443,10 @@ const char* geoip_getcountry(uint32 ipnum){
 }
 }
 /* sends a mesasge to map server (fd) to a user (u_fd) although we use fd we keep aid for safe-check */
 /* sends a mesasge to map server (fd) to a user (u_fd) although we use fd we keep aid for safe-check */
 /* extremely handy I believe it will serve other uses in the near future */
 /* extremely handy I believe it will serve other uses in the near future */
-void inter_to_fd(int fd, int u_fd, int aid, char* msg, ...) {
+void inter_to_fd(int32 fd, int32 u_fd, int32 aid, char* msg, ...) {
 	char msg_out[512];
 	char msg_out[512];
 	va_list ap;
 	va_list ap;
-	int len = 1;/* yes we start at 1 */
+	int32 len = 1;/* yes we start at 1 */
 
 
 	va_start(ap,msg);
 	va_start(ap,msg);
 		len += vsnprintf(msg_out, 512, msg, ap);
 		len += vsnprintf(msg_out, 512, msg, ap);
@@ -472,7 +472,7 @@ void inter_to_fd(int fd, int u_fd, int aid, char* msg, ...) {
  * @param acc_id : id of player found
  * @param acc_id : id of player found
  * @param acc_name : name of player found
  * @param acc_name : name of player found
  */
  */
-void mapif_acc_info_ack(int fd, int u_fd, int acc_id, const char* acc_name){
+void mapif_acc_info_ack(int32 fd, int32 u_fd, int32 acc_id, const char* acc_name){
 	WFIFOHEAD(fd,10 + NAME_LENGTH);
 	WFIFOHEAD(fd,10 + NAME_LENGTH);
 	WFIFOW(fd,0) = 0x3808;
 	WFIFOW(fd,0) = 0x3808;
 	WFIFOL(fd,2) = u_fd;
 	WFIFOL(fd,2) = u_fd;
@@ -486,8 +486,8 @@ void mapif_acc_info_ack(int fd, int u_fd, int acc_id, const char* acc_name){
  * @author : [Dekamaster/Nightroad]
  * @author : [Dekamaster/Nightroad]
  * @param fd : map-serv link
  * @param fd : map-serv link
  */
  */
-void mapif_parse_accinfo(int fd) {
-	int u_fd = RFIFOL(fd,2), u_aid = RFIFOL(fd,6), u_group = RFIFOL(fd,10);
+void mapif_parse_accinfo(int32 fd) {
+	int32 u_fd = RFIFOL(fd,2), u_aid = RFIFOL(fd,6), u_group = RFIFOL(fd,10);
 	char type= RFIFOB(fd,14);
 	char type= RFIFOB(fd,14);
 	char query[NAME_LENGTH], query_esq[NAME_LENGTH*2+1];
 	char query[NAME_LENGTH], query_esq[NAME_LENGTH*2+1];
 	uint32 account_id = 0;
 	uint32 account_id = 0;
@@ -517,7 +517,7 @@ void mapif_parse_accinfo(int fd) {
 			} else {// more than one, listing... [Dekamaster/Nightroad]
 			} else {// more than one, listing... [Dekamaster/Nightroad]
 				inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(214),(int)Sql_NumRows(sql_handle));
 				inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(214),(int)Sql_NumRows(sql_handle));
 				while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
 				while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
-					int class_;
+					int32 class_;
 					short base_level, job_level, online;
 					short base_level, job_level, online;
 					char name[NAME_LENGTH];
 					char name[NAME_LENGTH];
 
 
@@ -546,8 +546,8 @@ void mapif_parse_accinfo(int fd) {
 /**
 /**
  * Show account info from login-server to user
  * Show account info from login-server to user
  */
  */
-void mapif_accinfo_ack(bool success, int map_fd, int u_fd, int u_aid, int account_id, int8 type,
-	int group_id, int logincount, int state, const char *email, const char *last_ip, const char *lastlogin,
+void mapif_accinfo_ack(bool success, int32 map_fd, int32 u_fd, int32 u_aid, int32 account_id, int8 type,
+	int32 group_id, int32 logincount, int32 state, const char *email, const char *last_ip, const char *lastlogin,
 	const char *birthdate, const char *userid)
 	const char *birthdate, const char *userid)
 {
 {
 	
 	
@@ -662,7 +662,7 @@ void inter_savereg(uint32 account_id, uint32 char_id, const char *key, uint32 in
 }
 }
 
 
 // Load account_reg from sql (type=2)
 // Load account_reg from sql (type=2)
-int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type)
+int32 inter_accreg_fromsql(uint32 account_id, uint32 char_id, int32 fd, int32 type)
 {
 {
 	char* data;
 	char* data;
 	size_t len;
 	size_t len;
@@ -771,14 +771,14 @@ int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type)
 	WFIFOL(fd, 4) = account_id;
 	WFIFOL(fd, 4) = account_id;
 	WFIFOL(fd, 8) = char_id;
 	WFIFOL(fd, 8) = char_id;
 	WFIFOB(fd, 12) = 0; // var type (only set when all vars have been sent, regardless of type)
 	WFIFOB(fd, 12) = 0; // var type (only set when all vars have been sent, regardless of type)
-	WFIFOB(fd, 13) = 0; // is int type
+	WFIFOB(fd, 13) = 0; // is int32 type
 	WFIFOW(fd, 14) = 0; // count
 	WFIFOW(fd, 14) = 0; // count
 	plen = 16;
 	plen = 16;
 
 
 	/**
 	/**
 	 * Vessel!
 	 * Vessel!
 	 *
 	 *
-	 * int type
+	 * int32 type
 	 * { keyLength(B), key(<keyLength>), index(L), value(L) }
 	 * { keyLength(B), key(<keyLength>), index(L), value(L) }
 	 **/
 	 **/
 	while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
 	while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
@@ -814,7 +814,7 @@ int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type)
 			WFIFOL(fd, 4) = account_id;
 			WFIFOL(fd, 4) = account_id;
 			WFIFOL(fd, 8) = char_id;
 			WFIFOL(fd, 8) = char_id;
 			WFIFOB(fd, 12) = 0;/* var type (only set when all vars have been sent, regardless of type) */
 			WFIFOB(fd, 12) = 0;/* var type (only set when all vars have been sent, regardless of type) */
-			WFIFOB(fd, 13) = 0;/* is int type */
+			WFIFOB(fd, 13) = 0;/* is int32 type */
 			WFIFOW(fd, 14) = 0;/* count */
 			WFIFOW(fd, 14) = 0;/* count */
 			plen = 16;
 			plen = 16;
 		}
 		}
@@ -831,7 +831,7 @@ int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type)
 /*==========================================
 /*==========================================
  * read config file
  * read config file
  *------------------------------------------*/
  *------------------------------------------*/
-int inter_config_read(const char* cfgName)
+int32 inter_config_read(const char* cfgName)
 {
 {
 	char line[1024];
 	char line[1024];
 	FILE* fp;
 	FILE* fp;
@@ -880,7 +880,7 @@ int inter_config_read(const char* cfgName)
 }
 }
 
 
 // Save interlog into sql
 // Save interlog into sql
-int inter_log(const char* fmt, ...)
+int32 inter_log(const char* fmt, ...)
 {
 {
 	char str[255];
 	char str[255];
 	char esc_str[sizeof(str)*2+1];// escaped str
 	char esc_str[sizeof(str)*2+1];// escaped str
@@ -974,7 +974,7 @@ uint64 InterServerDatabase::parseBodyNode( const ryml::NodeRef& node ){
 }
 }
 
 
 // initialize
 // initialize
-int inter_init_sql(const char *file)
+int32 inter_init_sql(const char *file)
 {
 {
 	inter_config_read(file);
 	inter_config_read(file);
 
 
@@ -1037,7 +1037,7 @@ void inter_final(void)
  * Sends storage information to map-server
  * Sends storage information to map-server
  * @param fd
  * @param fd
  **/
  **/
-void inter_Storage_sendInfo(int fd) {
+void inter_Storage_sendInfo(int32 fd) {
 	size_t offset = 4;
 	size_t offset = 4;
 	size_t size = sizeof( struct s_storage_table );
 	size_t size = sizeof( struct s_storage_table );
 	size_t len = offset + interServerDb.size() * size;
 	size_t len = offset + interServerDb.size() * size;
@@ -1054,7 +1054,7 @@ void inter_Storage_sendInfo(int fd) {
 	WFIFOSET(fd, len);
 	WFIFOSET(fd, len);
 }
 }
 
 
-int inter_mapif_init(int fd)
+int32 inter_mapif_init(int32 fd)
 {
 {
 	inter_Storage_sendInfo(fd);
 	inter_Storage_sendInfo(fd);
 	return 0;
 	return 0;
@@ -1064,7 +1064,7 @@ int inter_mapif_init(int fd)
 //--------------------------------------------------------
 //--------------------------------------------------------
 
 
 // broadcast sending
 // broadcast sending
-int mapif_broadcast(unsigned char *mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd)
+int32 mapif_broadcast(unsigned char *mes, int32 len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, int32 sfd)
 {
 {
 	unsigned char *buf = (unsigned char*)aMalloc((len)*sizeof(unsigned char));
 	unsigned char *buf = (unsigned char*)aMalloc((len)*sizeof(unsigned char));
 
 
@@ -1083,9 +1083,9 @@ int mapif_broadcast(unsigned char *mes, int len, unsigned long fontColor, short
 }
 }
 
 
 // Wis sending
 // Wis sending
-int mapif_wis_message( std::shared_ptr<struct WisData> wd ){
+int32 mapif_wis_message( std::shared_ptr<struct WisData> wd ){
 	unsigned char buf[2048];
 	unsigned char buf[2048];
-	int headersize = 12 + 2 * NAME_LENGTH;
+	int32 headersize = 12 + 2 * NAME_LENGTH;
 
 
 	if (wd->len > 2047-headersize) wd->len = 2047-headersize; //Force it to fit to avoid crashes. [Skotlex]
 	if (wd->len > 2047-headersize) wd->len = 2047-headersize; //Force it to fit to avoid crashes. [Skotlex]
 
 
@@ -1102,14 +1102,14 @@ int mapif_wis_message( std::shared_ptr<struct WisData> wd ){
 }
 }
 
 
 // Send the requested account_reg
 // Send the requested account_reg
-int mapif_account_reg_reply(int fd, uint32 account_id, uint32 char_id, int type)
+int32 mapif_account_reg_reply(int32 fd, uint32 account_id, uint32 char_id, int32 type)
 {
 {
 	inter_accreg_fromsql(account_id,char_id,fd,type);
 	inter_accreg_fromsql(account_id,char_id,fd,type);
 	return 0;
 	return 0;
 }
 }
 
 
 //Request to kick char from a certain map server. [Skotlex]
 //Request to kick char from a certain map server. [Skotlex]
-int mapif_disconnectplayer(int fd, uint32 account_id, uint32 char_id, int reason)
+int32 mapif_disconnectplayer(int32 fd, uint32 account_id, uint32 char_id, int32 reason)
 {
 {
 	if (session_isValid(fd))
 	if (session_isValid(fd))
 	{
 	{
@@ -1143,7 +1143,7 @@ void check_ttl_wisdata(){
 //--------------------------------------------------------
 //--------------------------------------------------------
 
 
 // broadcast sending
 // broadcast sending
-int mapif_parse_broadcast(int fd)
+int32 mapif_parse_broadcast(int32 fd)
 {
 {
 	mapif_broadcast(RFIFOP(fd,16), RFIFOW(fd,2), RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), fd);
 	mapif_broadcast(RFIFOP(fd,16), RFIFOW(fd,2), RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), fd);
 	return 0;
 	return 0;
@@ -1156,7 +1156,7 @@ int mapif_parse_broadcast(int fd)
  * @param fd
  * @param fd
  * @return
  * @return
  **/
  **/
-int mapif_parse_broadcast_item(int fd) {
+int32 mapif_parse_broadcast_item(int32 fd) {
 	unsigned char buf[11 + NAME_LENGTH*2];
 	unsigned char buf[11 + NAME_LENGTH*2];
 
 
 	memcpy(WBUFP(buf, 0), RFIFOP(fd, 0), RFIFOW(fd,2));
 	memcpy(WBUFP(buf, 0), RFIFOP(fd, 0), RFIFOW(fd,2));
@@ -1168,7 +1168,7 @@ int mapif_parse_broadcast_item(int fd) {
 
 
 // Wis sending result
 // Wis sending result
 // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
 // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
-int mapif_wis_reply( int mapserver_fd, char* target, uint8 flag ){
+int32 mapif_wis_reply( int32 mapserver_fd, char* target, uint8 flag ){
 	unsigned char buf[27];
 	unsigned char buf[27];
 
 
 	WBUFW(buf, 0) = 0x3802;
 	WBUFW(buf, 0) = 0x3802;
@@ -1179,13 +1179,13 @@ int mapif_wis_reply( int mapserver_fd, char* target, uint8 flag ){
 }
 }
 
 
 // Wisp/page request to send
 // Wisp/page request to send
-int mapif_parse_WisRequest(int fd)
+int32 mapif_parse_WisRequest(int32 fd)
 {
 {
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 	char esc_name[NAME_LENGTH*2+1];// escaped name
 	char esc_name[NAME_LENGTH*2+1];// escaped name
 	char* data;
 	char* data;
 	size_t len;
 	size_t len;
-	int headersize = 8+2*NAME_LENGTH;
+	int32 headersize = 8+2*NAME_LENGTH;
 
 
 
 
 	if ( fd <= 0 ) {return 0;} // check if we have a valid fd
 	if ( fd <= 0 ) {return 0;} // check if we have a valid fd
@@ -1222,7 +1222,7 @@ int mapif_parse_WisRequest(int fd)
 		}
 		}
 		else
 		else
 		{
 		{
-			static int wisid = 0;
+			static int32 wisid = 0;
 
 
 			// Whether the failure of previous wisp/page transmission (timeout)
 			// Whether the failure of previous wisp/page transmission (timeout)
 			check_ttl_wisdata();
 			check_ttl_wisdata();
@@ -1250,7 +1250,7 @@ int mapif_parse_WisRequest(int fd)
 
 
 
 
 // Wisp/page transmission result
 // Wisp/page transmission result
-int mapif_parse_WisReply(int fd)
+int32 mapif_parse_WisReply(int32 fd)
 {
 {
 	int32 id;
 	int32 id;
 	uint8 flag;
 	uint8 flag;
@@ -1272,7 +1272,7 @@ int mapif_parse_WisReply(int fd)
 }
 }
 
 
 // Received wisp message from map-server for ALL gm (just copy the message and resends it to ALL map-servers)
 // Received wisp message from map-server for ALL gm (just copy the message and resends it to ALL map-servers)
-int mapif_parse_WisToGM(int fd)
+int32 mapif_parse_WisToGM(int32 fd)
 {
 {
 	unsigned char buf[2048]; // 0x3003/0x3803 <packet_len>.w <wispname>.24B <permission>.L <message>.?B
 	unsigned char buf[2048]; // 0x3003/0x3803 <packet_len>.w <wispname>.24B <permission>.L <message>.?B
 
 
@@ -1284,13 +1284,13 @@ int mapif_parse_WisToGM(int fd)
 }
 }
 
 
 // Save account_reg into sql (type=2)
 // Save account_reg into sql (type=2)
-int mapif_parse_Registry(int fd)
+int32 mapif_parse_Registry(int32 fd)
 {
 {
 	uint32 account_id = RFIFOL(fd, 4), char_id = RFIFOL(fd, 8);
 	uint32 account_id = RFIFOL(fd, 4), char_id = RFIFOL(fd, 8);
 	uint16 count = RFIFOW(fd, 12);
 	uint16 count = RFIFOW(fd, 12);
 
 
 	if( count ) {
 	if( count ) {
-		int cursor = 14, i;
+		int32 cursor = 14, i;
 		bool isLoginActive = session_isActive(login_fd);
 		bool isLoginActive = session_isActive(login_fd);
 
 
 		if( isLoginActive )
 		if( isLoginActive )
@@ -1306,7 +1306,7 @@ int mapif_parse_Registry(int fd)
 			cursor += 4;
 			cursor += 4;
 
 
 			switch (RFIFOB(fd, cursor++)) {
 			switch (RFIFOB(fd, cursor++)) {
-				// int
+				// int32
 				case 0:
 				case 0:
 					inter_savereg( account_id, char_id, key.c_str(), index, RFIFOQ( fd, cursor ), nullptr, false );
 					inter_savereg( account_id, char_id, key.c_str(), index, RFIFOQ( fd, cursor ), nullptr, false );
 					cursor += 8;
 					cursor += 8;
@@ -1341,7 +1341,7 @@ int mapif_parse_Registry(int fd)
 }
 }
 
 
 // Request the value of all registries.
 // Request the value of all registries.
-int mapif_parse_RegistryRequest(int fd)
+int32 mapif_parse_RegistryRequest(int32 fd)
 {
 {
 	//Load Char Registry
 	//Load Char Registry
 	if (RFIFOB(fd,12)) mapif_account_reg_reply(fd,RFIFOL(fd,2),RFIFOL(fd,6),3);
 	if (RFIFOB(fd,12)) mapif_account_reg_reply(fd,RFIFOL(fd,2),RFIFOL(fd,6),3);
@@ -1352,7 +1352,7 @@ int mapif_parse_RegistryRequest(int fd)
 	return 1;
 	return 1;
 }
 }
 
 
-void mapif_namechange_ack(int fd, uint32 account_id, uint32 char_id, int type, int flag, char *name)
+void mapif_namechange_ack(int32 fd, uint32 account_id, uint32 char_id, int32 type, int32 flag, char *name)
 {
 {
 	WFIFOHEAD(fd, NAME_LENGTH+13);
 	WFIFOHEAD(fd, NAME_LENGTH+13);
 	WFIFOW(fd, 0) = 0x3806;
 	WFIFOW(fd, 0) = 0x3806;
@@ -1364,12 +1364,12 @@ void mapif_namechange_ack(int fd, uint32 account_id, uint32 char_id, int type, i
 	WFIFOSET(fd, NAME_LENGTH+13);
 	WFIFOSET(fd, NAME_LENGTH+13);
 }
 }
 
 
-int mapif_parse_NameChangeRequest(int fd)
+int32 mapif_parse_NameChangeRequest(int32 fd)
 {
 {
 	uint32 account_id, char_id;
 	uint32 account_id, char_id;
-	int type;
+	int32 type;
 	char* name;
 	char* name;
-	int i;
+	int32 i;
 
 
 	account_id = RFIFOL(fd,2);
 	account_id = RFIFOL(fd,2);
 	char_id = RFIFOL(fd,6);
 	char_id = RFIFOL(fd,6);
@@ -1405,7 +1405,7 @@ int mapif_parse_NameChangeRequest(int fd)
 /// or 0 if no complete packet exists in the queue.
 /// or 0 if no complete packet exists in the queue.
 ///
 ///
 /// @param length The minimum allowed length, or -1 for dynamic lookup
 /// @param length The minimum allowed length, or -1 for dynamic lookup
-int inter_check_length(int fd, int length)
+int32 inter_check_length(int32 fd, int32 length)
 {
 {
 	if( length == -1 )
 	if( length == -1 )
 	{// variable-length packet
 	{// variable-length packet
@@ -1420,10 +1420,10 @@ int inter_check_length(int fd, int length)
 	return length;
 	return length;
 }
 }
 
 
-int inter_parse_frommap(int fd)
+int32 inter_parse_frommap(int32 fd)
 {
 {
-	int cmd;
-	int len = 0;
+	int32 cmd;
+	int32 len = 0;
 	cmd = RFIFOW(fd,0);
 	cmd = RFIFOW(fd,0);
 	// Check is valid packet entry
 	// Check is valid packet entry
 	if(cmd < 0x3000 || cmd >= 0x3000 + ARRAYLENGTH(inter_recv_packet_length) || inter_recv_packet_length[cmd - 0x3000] == 0)
 	if(cmd < 0x3000 || cmd >= 0x3000 + ARRAYLENGTH(inter_recv_packet_length) || inter_recv_packet_length[cmd - 0x3000] == 0)

+ 8 - 8
src/char/inter.hpp

@@ -26,22 +26,22 @@ public:
 
 
 extern InterServerDatabase interServerDb;
 extern InterServerDatabase interServerDb;
 
 
-int inter_init_sql(const char *file);
+int32 inter_init_sql(const char *file);
 void inter_final(void);
 void inter_final(void);
-int inter_parse_frommap(int fd);
-int inter_mapif_init(int fd);
-int mapif_disconnectplayer(int fd, uint32 account_id, uint32 char_id, int reason);
-void mapif_accinfo_ack(bool success, int map_fd, int u_fd, int u_aid, int account_id, int8 type,
-	int group_id, int logincount, int state, const char *email, const char *last_ip, const char *lastlogin,
+int32 inter_parse_frommap(int32 fd);
+int32 inter_mapif_init(int32 fd);
+int32 mapif_disconnectplayer(int32 fd, uint32 account_id, uint32 char_id, int32 reason);
+void mapif_accinfo_ack(bool success, int32 map_fd, int32 u_fd, int32 u_aid, int32 account_id, int8 type,
+	int32 group_id, int32 logincount, int32 state, const char *email, const char *last_ip, const char *lastlogin,
 	const char *birthdate, const char *userid);
 	const char *birthdate, const char *userid);
 
 
-int inter_log(const char *fmt,...);
+int32 inter_log(const char *fmt,...);
 
 
 extern uint32 party_share_level;
 extern uint32 party_share_level;
 
 
 extern Sql* sql_handle;
 extern Sql* sql_handle;
 extern Sql* lsql_handle;
 extern Sql* lsql_handle;
 
 
-int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type);
+int32 inter_accreg_fromsql(uint32 account_id, uint32 char_id, int32 fd, int32 type);
 
 
 #endif /* INTER_HPP */
 #endif /* INTER_HPP */

+ 2 - 2
src/common/cbasetypes.hpp

@@ -380,7 +380,7 @@ void SET_FUNCPOINTER(T1& var, T2 p)
 #endif
 #endif
 
 
 #ifndef max
 #ifndef max
-static inline int max(int a, int b){ return (a > b) ? a : b; } //default is int
+static inline int32 max(int32 a, int32 b){ return (a > b) ? a : b; } //default is int32
 #endif
 #endif
 static inline int8 i8max(int8 a, int8 b){ return (a > b) ? a : b; }
 static inline int8 i8max(int8 a, int8 b){ return (a > b) ? a : b; }
 static inline int16 i16max(int16 a, int16 b){ return (a > b) ? a : b; }
 static inline int16 i16max(int16 a, int16 b){ return (a > b) ? a : b; }
@@ -398,7 +398,7 @@ static inline size_t zmax(size_t a, size_t b){ return (a > b) ? a : b; } //cause
 #endif
 #endif
 
 
 #ifndef min
 #ifndef min
-static inline int min(int a, int b){ return (a < b) ? a : b; } //default is int
+static inline int32 min(int32 a, int32 b){ return (a < b) ? a : b; } //default is int32
 #endif
 #endif
 static inline int8 i8min(int8 a, int8 b){ return (a < b) ? a : b; }
 static inline int8 i8min(int8 a, int8 b){ return (a < b) ? a : b; }
 static inline int16 i16min(int16 a, int16 b){ return (a < b) ? a : b; }
 static inline int16 i16min(int16 a, int16 b){ return (a < b) ? a : b; }

+ 3 - 3
src/common/cli.cpp

@@ -45,7 +45,7 @@ const char* MSG_CONF_NAME_EN = "conf/msg_conf/char_msg.conf"; //all
  *   false : no other args found, and throw a warning
  *   false : no other args found, and throw a warning
  *   true : something following us
  *   true : something following us
  */
  */
-bool opt_has_next_value(const char* option, int i, int argc){
+bool opt_has_next_value(const char* option, int32 i, int32 argc){
 	if (i >= argc - 1) {
 	if (i >= argc - 1) {
 		ShowWarning("Missing value for option '%s'.\n", option);
 		ShowWarning("Missing value for option '%s'.\n", option);
 		return false;
 		return false;
@@ -85,8 +85,8 @@ void display_versionscreen(bool do_exit)
  * @param argv: arguments values (from main)
  * @param argv: arguments values (from main)
  * @return true or exit on failure
  * @return true or exit on failure
  */
  */
-int cli_get_options(int argc, char ** argv) {
-	int i = 0;
+int32 cli_get_options(int32 argc, char ** argv) {
+	int32 i = 0;
 	for (i = 1; i < argc; i++) {
 	for (i = 1; i < argc; i++) {
 		const char* arg = argv[i];
 		const char* arg = argv[i];
 
 

+ 3 - 3
src/common/cli.hpp

@@ -29,9 +29,9 @@
 extern void display_helpscreen(bool exit);
 extern void display_helpscreen(bool exit);
 bool cli_hasevent();
 bool cli_hasevent();
 void display_versionscreen(bool do_exit);
 void display_versionscreen(bool do_exit);
-bool opt_has_next_value(const char* option, int i, int argc);
-int cli_get_options(int argc, char ** argv);
+bool opt_has_next_value(const char* option, int32 i, int32 argc);
+int32 cli_get_options(int32 argc, char ** argv);
 TIMER_FUNC(parse_console_timer);
 TIMER_FUNC(parse_console_timer);
-extern int parse_console(const char* buf); //particular for each serv
+extern int32 parse_console(const char* buf); //particular for each serv
 
 
 #endif /* CLI_HPP */
 #endif /* CLI_HPP */

+ 4 - 4
src/common/conf.cpp

@@ -5,7 +5,7 @@
 
 
 #include "showmsg.hpp" // ShowError
 #include "showmsg.hpp" // ShowError
 
 
-int conf_read_file(config_t *config, const char *config_filename)
+int32 conf_read_file(config_t *config, const char *config_filename)
 {
 {
 	config_init(config);
 	config_init(config);
 	if (!config_read_file(config, config_filename)) {
 	if (!config_read_file(config, config_filename)) {
@@ -23,7 +23,7 @@ int conf_read_file(config_t *config, const char *config_filename)
 static void config_setting_copy_simple(config_setting_t *parent, const config_setting_t *src);
 static void config_setting_copy_simple(config_setting_t *parent, const config_setting_t *src);
 static void config_setting_copy_elem(config_setting_t *parent, const config_setting_t *src);
 static void config_setting_copy_elem(config_setting_t *parent, const config_setting_t *src);
 static void config_setting_copy_aggregate(config_setting_t *parent, const config_setting_t *src);
 static void config_setting_copy_aggregate(config_setting_t *parent, const config_setting_t *src);
-int config_setting_copy(config_setting_t *parent, const config_setting_t *src);
+int32 config_setting_copy(config_setting_t *parent, const config_setting_t *src);
 
 
 void config_setting_copy_simple(config_setting_t *parent, const config_setting_t *src)
 void config_setting_copy_simple(config_setting_t *parent, const config_setting_t *src)
 {
 {
@@ -76,7 +76,7 @@ void config_setting_copy_elem(config_setting_t *parent, const config_setting_t *
 void config_setting_copy_aggregate(config_setting_t *parent, const config_setting_t *src)
 void config_setting_copy_aggregate(config_setting_t *parent, const config_setting_t *src)
 {
 {
 	config_setting_t *newAgg;
 	config_setting_t *newAgg;
-	int i, n;
+	int32 i, n;
 
 
 	newAgg = config_setting_add(parent, config_setting_name(src), config_setting_type(src));
 	newAgg = config_setting_add(parent, config_setting_name(src), config_setting_type(src));
 
 
@@ -94,7 +94,7 @@ void config_setting_copy_aggregate(config_setting_t *parent, const config_settin
 	}
 	}
 }
 }
 
 
-int config_setting_copy(config_setting_t *parent, const config_setting_t *src)
+int32 config_setting_copy(config_setting_t *parent, const config_setting_t *src)
 {
 {
 	if (!config_setting_is_group(parent) && !config_setting_is_list(parent))
 	if (!config_setting_is_group(parent) && !config_setting_is_list(parent))
 		return CONFIG_FALSE;
 		return CONFIG_FALSE;

+ 2 - 2
src/common/conf.hpp

@@ -8,7 +8,7 @@
 
 
 #include "cbasetypes.hpp"
 #include "cbasetypes.hpp"
 
 
-int conf_read_file(config_t *config, const char *config_filename);
-int config_setting_copy(config_setting_t *parent, const config_setting_t *src);
+int32 conf_read_file(config_t *config, const char *config_filename);
+int32 config_setting_copy(config_setting_t *parent, const config_setting_t *src);
 
 
 #endif /* CONF_HPP */
 #endif /* CONF_HPP */

+ 7 - 7
src/common/core.cpp

@@ -44,7 +44,7 @@ using namespace rathena::server_core;
 Core* global_core = nullptr;
 Core* global_core = nullptr;
 
 
 #if defined(BUILDBOT)
 #if defined(BUILDBOT)
-	int buildbotflag = 0;
+	int32 buildbotflag = 0;
 #endif
 #endif
 
 
 char db_path[12] = "db"; /// relative path for db from server
 char db_path[12] = "db"; /// relative path for db from server
@@ -66,7 +66,7 @@ char *SERVER_NAME = nullptr;
 #ifndef POSIX
 #ifndef POSIX
 #define compat_signal(signo, func) signal(signo, func)
 #define compat_signal(signo, func) signal(signo, func)
 #else
 #else
-sigfunc *compat_signal(int signo, sigfunc *func) {
+sigfunc *compat_signal(int32 signo, sigfunc *func) {
 	struct sigaction sact, oact;
 	struct sigaction sact, oact;
 
 
 	sact.sa_handler = func;
 	sact.sa_handler = func;
@@ -111,8 +111,8 @@ static void cevents_init() {
 /*======================================
 /*======================================
  *	CORE : Signal Sub Function
  *	CORE : Signal Sub Function
  *--------------------------------------*/
  *--------------------------------------*/
-static void sig_proc(int sn) {
-	static int is_called = 0;
+static void sig_proc(int32 sn) {
+	static int32 is_called = 0;
 
 
 	switch (sn) {
 	switch (sn) {
 	case SIGINT:
 	case SIGINT:
@@ -223,7 +223,7 @@ const char* get_svn_revision(void) {
 	if ((fp = fopen(".svn/entries", "r")) != nullptr)
 	if ((fp = fopen(".svn/entries", "r")) != nullptr)
 	{
 	{
 		char line[1024];
 		char line[1024];
-		int rev;
+		int32 rev;
 		// Check the version
 		// Check the version
 		if (fgets(line, sizeof(line), fp))
 		if (fgets(line, sizeof(line), fp))
 		{
 		{
@@ -330,7 +330,7 @@ void usercheck(void)
 #endif
 #endif
 }
 }
 
 
-int Core::start( int argc, char **argv ){
+int32 Core::start( int32 argc, char **argv ){
 	if( this->get_status() != e_core_status::NOT_STARTED) {
 	if( this->get_status() != e_core_status::NOT_STARTED) {
 		ShowFatalError( "Core was already started and cannot be started again!\n" );
 		ShowFatalError( "Core was already started and cannot be started again!\n" );
 		return EXIT_FAILURE;
 		return EXIT_FAILURE;
@@ -421,7 +421,7 @@ int Core::start( int argc, char **argv ){
 	return EXIT_SUCCESS;
 	return EXIT_SUCCESS;
 }
 }
 
 
-bool Core::initialize( int argc, char* argv[] ){
+bool Core::initialize( int32 argc, char* argv[] ){
 	// Do nothing
 	// Do nothing
 	return true;
 	return true;
 }
 }

+ 5 - 5
src/common/core.hpp

@@ -19,7 +19,7 @@
 #endif
 #endif
 
 
 #if defined(BUILDBOT)
 #if defined(BUILDBOT)
-	extern int buildbotflag;
+	extern int32 buildbotflag;
 #endif
 #endif
 
 
 #define UNKNOWN_VERSION '\x02'
 #define UNKNOWN_VERSION '\x02'
@@ -28,7 +28,7 @@ extern char *SERVER_NAME;
 extern char db_path[12]; /// relative path for db from servers
 extern char db_path[12]; /// relative path for db from servers
 extern char conf_path[12]; /// relative path for conf from servers
 extern char conf_path[12]; /// relative path for conf from servers
 
 
-extern int parse_console(const char* buf);
+extern int32 parse_console(const char* buf);
 const char *get_svn_revision(void);
 const char *get_svn_revision(void);
 const char *get_git_hash(void);
 const char *get_git_hash(void);
 
 
@@ -65,7 +65,7 @@ namespace rathena{
 				bool m_crashed;
 				bool m_crashed;
 
 
 			protected:
 			protected:
-				virtual bool initialize( int argc, char* argv[] );
+				virtual bool initialize( int32 argc, char* argv[] );
 				virtual void handle_main( t_tick next );
 				virtual void handle_main( t_tick next );
 				virtual void finalize();
 				virtual void finalize();
 				virtual void handle_crash();
 				virtual void handle_crash();
@@ -87,14 +87,14 @@ namespace rathena{
 				void set_run_once( bool run_once );
 				void set_run_once( bool run_once );
 				void signal_crash();
 				void signal_crash();
 				void signal_shutdown();
 				void signal_shutdown();
-				int start( int argc, char* argv[] );
+				int32 start( int32 argc, char* argv[] );
 		};
 		};
 	}
 	}
 }
 }
 
 
 extern rathena::server_core::Core* global_core;
 extern rathena::server_core::Core* global_core;
 
 
-template <typename T> int main_core( int argc, char *argv[] ){
+template <typename T> int32 main_core( int32 argc, char *argv[] ){
 	T server = {};
 	T server = {};
 
 
 	global_core = &server;
 	global_core = &server;

+ 1 - 1
src/common/database.cpp

@@ -363,7 +363,7 @@ void YamlDatabase::invalidWarning( const ryml::NodeRef& node, const char* fmt, .
 
 
 	// Remove any remaining garbage of a previous loading line
 	// Remove any remaining garbage of a previous loading line
 	ShowMessage( CL_CLL );
 	ShowMessage( CL_CLL );
-	// Print the actual error
+	// Print32 the actual error
 	_vShowMessage( MSG_ERROR, fmt, ap );
 	_vShowMessage( MSG_ERROR, fmt, ap );
 
 
 	va_end(ap);
 	va_end(ap);

+ 40 - 39
src/common/db.cpp

@@ -73,6 +73,7 @@
 #include <cstdio>
 #include <cstdio>
 #include <cstdlib>
 #include <cstdlib>
 
 
+#include "cbasetypes.hpp"
 #include "ers.hpp"
 #include "ers.hpp"
 #include "malloc.hpp"
 #include "malloc.hpp"
 #include "mmo.hpp"
 #include "mmo.hpp"
@@ -184,7 +185,7 @@ typedef struct DBMap_impl {
 	struct DBMap vtable;
 	struct DBMap vtable;
 	// File and line of allocation
 	// File and line of allocation
 	const char *alloc_file;
 	const char *alloc_file;
-	int alloc_line;
+	int32 alloc_line;
 	// Lock system
 	// Lock system
 	struct db_free *free_list;
 	struct db_free *free_list;
 	uint32 free_count;
 	uint32 free_count;
@@ -219,7 +220,7 @@ typedef struct DBIterator_impl {
 	// Iterator interface
 	// Iterator interface
 	struct DBIterator vtable;
 	struct DBIterator vtable;
 	DBMap_impl* db;
 	DBMap_impl* db;
-	int ht_index;
+	int32 ht_index;
 	DBNode *node;
 	DBNode *node;
 } DBIterator_impl;
 } DBIterator_impl;
 
 
@@ -629,7 +630,7 @@ static void db_rebalance_erase(DBNode *node, DBNode **root)
  * @see #db_obj_put(DBMap*,DBKey,DBData)
  * @see #db_obj_put(DBMap*,DBKey,DBData)
  * @see #db_obj_remove(DBMap*,DBKey)
  * @see #db_obj_remove(DBMap*,DBKey)
  */
  */
-static int db_is_key_null(DBType type, DBKey key)
+static int32 db_is_key_null(DBType type, DBKey key)
 {
 {
 	DB_COUNTSTAT(db_is_key_null);
 	DB_COUNTSTAT(db_is_key_null);
 	switch (type) {
 	switch (type) {
@@ -870,7 +871,7 @@ static void db_free_unlock(DBMap_impl* db)
  * @see #DBComparator
  * @see #DBComparator
  * @see #db_default_cmp(DBType)
  * @see #db_default_cmp(DBType)
  */
  */
-static int db_int_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
+static int32 db_int_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
 {
 {
 	(void)maxlen;//not used
 	(void)maxlen;//not used
 	DB_COUNTSTAT(db_int_cmp);
 	DB_COUNTSTAT(db_int_cmp);
@@ -892,7 +893,7 @@ static int db_int_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
  * @see #DBComparator
  * @see #DBComparator
  * @see #db_default_cmp(DBType)
  * @see #db_default_cmp(DBType)
  */
  */
-static int db_uint_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
+static int32 db_uint_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
 {
 {
 	(void)maxlen;//not used
 	(void)maxlen;//not used
 	DB_COUNTSTAT(db_uint_cmp);
 	DB_COUNTSTAT(db_uint_cmp);
@@ -913,7 +914,7 @@ static int db_uint_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
  * @see #DBComparator
  * @see #DBComparator
  * @see #db_default_cmp(DBType)
  * @see #db_default_cmp(DBType)
  */
  */
-static int db_string_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
+static int32 db_string_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
 {
 {
 	DB_COUNTSTAT(db_string_cmp);
 	DB_COUNTSTAT(db_string_cmp);
 	return strncmp((const char *)key1.str, (const char *)key2.str, maxlen);
 	return strncmp((const char *)key1.str, (const char *)key2.str, maxlen);
@@ -931,7 +932,7 @@ static int db_string_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
  * @see #DBComparator
  * @see #DBComparator
  * @see #db_default_cmp(DBType)
  * @see #db_default_cmp(DBType)
  */
  */
-static int db_istring_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
+static int32 db_istring_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
 {
 {
 	DB_COUNTSTAT(db_istring_cmp);
 	DB_COUNTSTAT(db_istring_cmp);
 	return strncasecmp((const char *)key1.str, (const char *)key2.str, maxlen);
 	return strncasecmp((const char *)key1.str, (const char *)key2.str, maxlen);
@@ -950,7 +951,7 @@ static int db_istring_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
  * @see #DBComparator
  * @see #DBComparator
  * @see #db_default_cmp(DBType)
  * @see #db_default_cmp(DBType)
  */
  */
-static int db_int64_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
+static int32 db_int64_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
 {
 {
 	(void)maxlen;//not used
 	(void)maxlen;//not used
 	DB_COUNTSTAT(db_int64_cmp);
 	DB_COUNTSTAT(db_int64_cmp);
@@ -972,7 +973,7 @@ static int db_int64_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
  * @see #DBComparator
  * @see #DBComparator
  * @see #db_default_cmp(DBType)
  * @see #db_default_cmp(DBType)
  */
  */
-static int db_uint64_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
+static int32 db_uint64_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
 {
 {
 	(void)maxlen;//not used
 	(void)maxlen;//not used
 	DB_COUNTSTAT(db_uint64_cmp);
 	DB_COUNTSTAT(db_uint64_cmp);
@@ -1439,11 +1440,11 @@ bool dbit_obj_exists(DBIterator* self)
  * @see DBMap#remove
  * @see DBMap#remove
  * @see DBIterator#remove
  * @see DBIterator#remove
  */
  */
-int dbit_obj_remove(DBIterator* self, DBData *out_data)
+int32 dbit_obj_remove(DBIterator* self, DBData *out_data)
 {
 {
 	DBIterator_impl* it = (DBIterator_impl*)self;
 	DBIterator_impl* it = (DBIterator_impl*)self;
 	DBNode *node;
 	DBNode *node;
-	int retval = 0;
+	int32 retval = 0;
 
 
 	DB_COUNTSTAT(dbit_remove);
 	DB_COUNTSTAT(dbit_remove);
 	node = it->node;
 	node = it->node;
@@ -1543,7 +1544,7 @@ static bool db_obj_exists(DBMap* self, DBKey key)
 	db_free_lock(db);
 	db_free_lock(db);
 	node = db->ht[db->hash(key, db->maxlen)%HASH_SIZE];
 	node = db->ht[db->hash(key, db->maxlen)%HASH_SIZE];
 	while (node) {
 	while (node) {
-		int c = db->cmp(key, node->key, db->maxlen);
+		int32 c = db->cmp(key, node->key, db->maxlen);
 		if (c == 0) {
 		if (c == 0) {
 			if (!(node->deleted)) {
 			if (!(node->deleted)) {
 				db->cache = node;
 				db->cache = node;
@@ -1594,7 +1595,7 @@ static DBData* db_obj_get(DBMap* self, DBKey key)
 	db_free_lock(db);
 	db_free_lock(db);
 	node = db->ht[db->hash(key, db->maxlen)%HASH_SIZE];
 	node = db->ht[db->hash(key, db->maxlen)%HASH_SIZE];
 	while (node) {
 	while (node) {
-		int c = db->cmp(key, node->key, db->maxlen);
+		int32 c = db->cmp(key, node->key, db->maxlen);
 		if (c == 0) {
 		if (c == 0) {
 			if (!(node->deleted)) {
 			if (!(node->deleted)) {
 				data = &node->data;
 				data = &node->data;
@@ -1731,7 +1732,7 @@ static DBData* db_obj_vensure(DBMap* self, DBKey key, DBCreateData create, va_li
 	DBNode *node;
 	DBNode *node;
 	DBNode *parent = nullptr;
 	DBNode *parent = nullptr;
 	uint32 hash;
 	uint32 hash;
-	int c = 0;
+	int32 c = 0;
 	DBData *data = nullptr;
 	DBData *data = nullptr;
 
 
 	DB_COUNTSTAT(db_vensure);
 	DB_COUNTSTAT(db_vensure);
@@ -1854,12 +1855,12 @@ static DBData* db_obj_ensure(DBMap* self, DBKey key, DBCreateData create, ...)
  * FIXME: If this method fails shouldn't it return another value?
  * FIXME: If this method fails shouldn't it return another value?
  *        Other functions rely on this to know if they were able to put something [Panikon]
  *        Other functions rely on this to know if they were able to put something [Panikon]
  */
  */
-static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data)
+static int32 db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data)
 {
 {
 	DBMap_impl* db = (DBMap_impl*)self;
 	DBMap_impl* db = (DBMap_impl*)self;
 	DBNode *node;
 	DBNode *node;
 	DBNode *parent = nullptr;
 	DBNode *parent = nullptr;
-	int c = 0, retval = 0;
+	int32 c = 0, retval = 0;
 	uint32 hash;
 	uint32 hash;
 
 
 	DB_COUNTSTAT(db_put);
 	DB_COUNTSTAT(db_put);
@@ -1959,12 +1960,12 @@ static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data)
  * @see #db_free_add(DBMap_impl*,DBNode*,DBNode **)
  * @see #db_free_add(DBMap_impl*,DBNode*,DBNode **)
  * @see DBMap#remove
  * @see DBMap#remove
  */
  */
-static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data)
+static int32 db_obj_remove(DBMap* self, DBKey key, DBData *out_data)
 {
 {
 	DBMap_impl* db = (DBMap_impl*)self;
 	DBMap_impl* db = (DBMap_impl*)self;
 	DBNode *node;
 	DBNode *node;
 	uint32 hash;
 	uint32 hash;
-	int retval = 0;
+	int32 retval = 0;
 
 
 	DB_COUNTSTAT(db_remove);
 	DB_COUNTSTAT(db_remove);
 	if (db == nullptr) return 0; // nullpo candidate
 	if (db == nullptr) return 0; // nullpo candidate
@@ -1982,7 +1983,7 @@ static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data)
 	db_free_lock(db);
 	db_free_lock(db);
 	hash = db->hash(key, db->maxlen)%HASH_SIZE;
 	hash = db->hash(key, db->maxlen)%HASH_SIZE;
 	for(node = db->ht[hash]; node; ){
 	for(node = db->ht[hash]; node; ){
-		int c = db->cmp(key, node->key, db->maxlen);
+		int32 c = db->cmp(key, node->key, db->maxlen);
 		if (c == 0) {
 		if (c == 0) {
 			if (!(node->deleted)) {
 			if (!(node->deleted)) {
 				if (db->cache == node)
 				if (db->cache == node)
@@ -2014,11 +2015,11 @@ static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data)
  * @protected
  * @protected
  * @see DBMap#vforeach
  * @see DBMap#vforeach
  */
  */
-static int db_obj_vforeach(DBMap* self, DBApply func, va_list args)
+static int32 db_obj_vforeach(DBMap* self, DBApply func, va_list args)
 {
 {
 	DBMap_impl* db = (DBMap_impl*)self;
 	DBMap_impl* db = (DBMap_impl*)self;
 	uint32 i;
 	uint32 i;
-	int sum = 0;
+	int32 sum = 0;
 	DBNode *node;
 	DBNode *node;
 	DBNode *parent;
 	DBNode *parent;
 
 
@@ -2074,10 +2075,10 @@ static int db_obj_vforeach(DBMap* self, DBApply func, va_list args)
  * @see DBMap#vforeach
  * @see DBMap#vforeach
  * @see DBMap#foreach
  * @see DBMap#foreach
  */
  */
-static int db_obj_foreach(DBMap* self, DBApply func, ...)
+static int32 db_obj_foreach(DBMap* self, DBApply func, ...)
 {
 {
 	va_list args;
 	va_list args;
-	int ret;
+	int32 ret;
 
 
 	DB_COUNTSTAT(db_foreach);
 	DB_COUNTSTAT(db_foreach);
 	if (self == nullptr) return 0; // nullpo candidate
 	if (self == nullptr) return 0; // nullpo candidate
@@ -2100,10 +2101,10 @@ static int db_obj_foreach(DBMap* self, DBApply func, ...)
  * @protected
  * @protected
  * @see DBMap#vclear
  * @see DBMap#vclear
  */
  */
-static int db_obj_vclear(DBMap* self, DBApply func, va_list args)
+static int32 db_obj_vclear(DBMap* self, DBApply func, va_list args)
 {
 {
 	DBMap_impl* db = (DBMap_impl*)self;
 	DBMap_impl* db = (DBMap_impl*)self;
-	int sum = 0;
+	int32 sum = 0;
 	uint32 i;
 	uint32 i;
 	DBNode *node;
 	DBNode *node;
 	DBNode *parent;
 	DBNode *parent;
@@ -2174,10 +2175,10 @@ static int db_obj_vclear(DBMap* self, DBApply func, va_list args)
  * @see DBMap#vclear
  * @see DBMap#vclear
  * @see DBMap#clear
  * @see DBMap#clear
  */
  */
-static int db_obj_clear(DBMap* self, DBApply func, ...)
+static int32 db_obj_clear(DBMap* self, DBApply func, ...)
 {
 {
 	va_list args;
 	va_list args;
-	int ret;
+	int32 ret;
 
 
 	DB_COUNTSTAT(db_clear);
 	DB_COUNTSTAT(db_clear);
 	if (self == nullptr) return 0; // nullpo candidate
 	if (self == nullptr) return 0; // nullpo candidate
@@ -2201,10 +2202,10 @@ static int db_obj_clear(DBMap* self, DBApply func, ...)
  * @protected
  * @protected
  * @see DBMap#vdestroy
  * @see DBMap#vdestroy
  */
  */
-static int db_obj_vdestroy(DBMap* self, DBApply func, va_list args)
+static int32 db_obj_vdestroy(DBMap* self, DBApply func, va_list args)
 {
 {
 	DBMap_impl* db = (DBMap_impl*)self;
 	DBMap_impl* db = (DBMap_impl*)self;
-	int sum;
+	int32 sum;
 
 
 	DB_COUNTSTAT(db_vdestroy);
 	DB_COUNTSTAT(db_vdestroy);
 	if (db == nullptr) return 0; // nullpo candidate
 	if (db == nullptr) return 0; // nullpo candidate
@@ -2257,10 +2258,10 @@ static int db_obj_vdestroy(DBMap* self, DBApply func, va_list args)
  * @see DBMap#vdestroy
  * @see DBMap#vdestroy
  * @see DBMap#destroy
  * @see DBMap#destroy
  */
  */
-static int db_obj_destroy(DBMap* self, DBApply func, ...)
+static int32 db_obj_destroy(DBMap* self, DBApply func, ...)
 {
 {
 	va_list args;
 	va_list args;
-	int ret;
+	int32 ret;
 
 
 	DB_COUNTSTAT(db_destroy);
 	DB_COUNTSTAT(db_destroy);
 	if (self == nullptr) return 0; // nullpo candidate
 	if (self == nullptr) return 0; // nullpo candidate
@@ -2518,7 +2519,7 @@ DBReleaser db_custom_release(DBRelease which)
  * @see #DBMap_impl
  * @see #DBMap_impl
  * @see #db_fix_options(DBType,DBOptions)
  * @see #db_fix_options(DBType,DBOptions)
  */
  */
-DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOptions options, unsigned short maxlen) {
+DBMap* db_alloc(const char *file, const char *func, int32 line, DBType type, DBOptions options, unsigned short maxlen) {
 	DBMap_impl* db;
 	DBMap_impl* db;
 	uint32 i;
 	uint32 i;
 	char ers_name[50];
 	char ers_name[50];
@@ -2591,7 +2592,7 @@ DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOpt
  * @return The key as a DBKey union
  * @return The key as a DBKey union
  * @public
  * @public
  */
  */
-DBKey db_i2key(int key)
+DBKey db_i2key(int32 key)
 {
 {
 	DBKey ret;
 	DBKey ret;
 
 
@@ -2666,7 +2667,7 @@ DBKey db_ui642key(uint64 key)
  * @return The data as a DBData struct
  * @return The data as a DBData struct
  * @public
  * @public
  */
  */
-DBData db_i2data(int data)
+DBData db_i2data(int32 data)
 {
 {
 	DBData ret;
 	DBData ret;
 
 
@@ -2725,13 +2726,13 @@ DBData db_i642data(int64 data)
 }
 }
 
 
 /**
 /**
- * Gets int type data from struct DBData.
- * If data is not int type, returns 0.
+ * Gets int32 type data from struct DBData.
+ * If data is not int32 type, returns 0.
  * @param data Data
  * @param data Data
  * @return Integer value of the data.
  * @return Integer value of the data.
  * @public
  * @public
  */
  */
-int db_data2i(DBData *data)
+int32 db_data2i(DBData *data)
 {
 {
 	DB_COUNTSTAT(db_data2i);
 	DB_COUNTSTAT(db_data2i);
 	if (data && DB_DATA_INT == data->type)
 	if (data && DB_DATA_INT == data->type)
@@ -2944,7 +2945,7 @@ void linkdb_foreach( struct linkdb_node** head, LinkDBFunc func, ...) {
 
 
 void* linkdb_search( struct linkdb_node** head, void *key)
 void* linkdb_search( struct linkdb_node** head, void *key)
 {
 {
-	int n = 0;
+	int32 n = 0;
 	struct linkdb_node *node;
 	struct linkdb_node *node;
 	if( head == nullptr ) return nullptr;
 	if( head == nullptr ) return nullptr;
 	node = *head;
 	node = *head;
@@ -2991,7 +2992,7 @@ void* linkdb_erase( struct linkdb_node** head, void *key)
 
 
 void linkdb_replace( struct linkdb_node** head, void *key, void *data )
 void linkdb_replace( struct linkdb_node** head, void *key, void *data )
 {
 {
-	int n = 0;
+	int32 n = 0;
 	struct linkdb_node *node;
 	struct linkdb_node *node;
 	if( head == nullptr ) return ;
 	if( head == nullptr ) return ;
 	node = *head;
 	node = *head;

+ 21 - 21
src/common/db.hpp

@@ -149,7 +149,7 @@ typedef enum DBOptions {
  * @see DBMap#remove
  * @see DBMap#remove
  */
  */
 typedef union DBKey {
 typedef union DBKey {
-	int i;
+	int32 i;
 	uint32 ui;
 	uint32 ui;
 	const char *str;
 	const char *str;
 	int64 i64;
 	int64 i64;
@@ -175,7 +175,7 @@ typedef enum DBDataType {
  * Struct for data types used by the database.
  * Struct for data types used by the database.
  * @param type Type of data
  * @param type Type of data
  * @param u Union of available data types
  * @param u Union of available data types
- * @param u.i Data of int type
+ * @param u.i Data of int32 type
  * @param u.ui Data of uint32 type
  * @param u.ui Data of uint32 type
  * @param u.ptr Data of void* type
  * @param u.ptr Data of void* type
  * @param u.i64 Data of int64 type
  * @param u.i64 Data of int64 type
@@ -184,7 +184,7 @@ typedef enum DBDataType {
 typedef struct DBData {
 typedef struct DBData {
 	DBDataType type;
 	DBDataType type;
 	union {
 	union {
-		int i;
+		int32 i;
 		uint32 ui;
 		uint32 ui;
 		void *ptr;
 		void *ptr;
 		int64 i64;
 		int64 i64;
@@ -218,7 +218,7 @@ typedef DBData (*DBCreateData)(DBKey key, va_list args);
  * @see DBMap#vdestroy
  * @see DBMap#vdestroy
  * @see DBMap#destroy
  * @see DBMap#destroy
  */
  */
-typedef int (*DBApply)(DBKey key, DBData *data, va_list args);
+typedef int32 (*DBApply)(DBKey key, DBData *data, va_list args);
 
 
 /**
 /**
  * Format of functions that match database entries.
  * Format of functions that match database entries.
@@ -231,7 +231,7 @@ typedef int (*DBApply)(DBKey key, DBData *data, va_list args);
  * @public
  * @public
  * @see DBMap#getall
  * @see DBMap#getall
  */
  */
-typedef int (*DBMatcher)(DBKey key, DBData data, va_list args);
+typedef int32 (*DBMatcher)(DBKey key, DBData data, va_list args);
 
 
 /**
 /**
  * Format of the comparators used internally by the database system.
  * Format of the comparators used internally by the database system.
@@ -245,7 +245,7 @@ typedef int (*DBMatcher)(DBKey key, DBData data, va_list args);
  * @public
  * @public
  * @see #db_default_cmp(DBType)
  * @see #db_default_cmp(DBType)
  */
  */
-typedef int (*DBComparator)(DBKey key1, DBKey key2, unsigned short maxlen);
+typedef int32 (*DBComparator)(DBKey key1, DBKey key2, unsigned short maxlen);
 
 
 /**
 /**
  * Format of the hashers used internally by the database system.
  * Format of the hashers used internally by the database system.
@@ -357,7 +357,7 @@ struct DBIterator
 	 * @protected
 	 * @protected
 	 * @see DBMap#remove
 	 * @see DBMap#remove
 	 */
 	 */
-	int (*remove)(DBIterator* self, DBData *out_data);
+	int32 (*remove)(DBIterator* self, DBData *out_data);
 
 
 	/**
 	/**
 	 * Destroys this iterator and unlocks the database.
 	 * Destroys this iterator and unlocks the database.
@@ -482,7 +482,7 @@ struct DBMap {
 	 * @return 1 if if the entry already exists, 0 otherwise
 	 * @return 1 if if the entry already exists, 0 otherwise
 	 * @protected
 	 * @protected
 	 */
 	 */
-	int (*put)(DBMap* self, DBKey key, DBData data, DBData *out_data);
+	int32 (*put)(DBMap* self, DBKey key, DBData data, DBData *out_data);
 
 
 	/**
 	/**
 	 * Remove an entry from the database.
 	 * Remove an entry from the database.
@@ -494,7 +494,7 @@ struct DBMap {
 	 * @return 1 if if the entry already exists, 0 otherwise
 	 * @return 1 if if the entry already exists, 0 otherwise
 	 * @protected
 	 * @protected
 	 */
 	 */
-	int (*remove)(DBMap* self, DBKey key, DBData *out_data);
+	int32 (*remove)(DBMap* self, DBKey key, DBData *out_data);
 
 
 	/**
 	/**
 	 * Just calls {@link DBMap#vforeach}.
 	 * Just calls {@link DBMap#vforeach}.
@@ -507,7 +507,7 @@ struct DBMap {
 	 * @protected
 	 * @protected
 	 * @see DBMap#vforeach(DBMap*,DBApply,va_list)
 	 * @see DBMap#vforeach(DBMap*,DBApply,va_list)
 	 */
 	 */
-	int (*foreach)(DBMap* self, DBApply func, ...);
+	int32 (*foreach)(DBMap* self, DBApply func, ...);
 
 
 	/**
 	/**
 	 * Apply <code>func</code> to every entry in the database.
 	 * Apply <code>func</code> to every entry in the database.
@@ -519,7 +519,7 @@ struct DBMap {
 	 * @protected
 	 * @protected
 	 * @see DBMap#foreach(DBMap*,DBApply,...)
 	 * @see DBMap#foreach(DBMap*,DBApply,...)
 	 */
 	 */
-	int (*vforeach)(DBMap* self, DBApply func, va_list args);
+	int32 (*vforeach)(DBMap* self, DBApply func, va_list args);
 
 
 	/**
 	/**
 	 * Just calls {@link DBMap#vclear}.
 	 * Just calls {@link DBMap#vclear}.
@@ -534,7 +534,7 @@ struct DBMap {
 	 * @protected
 	 * @protected
 	 * @see DBMap#vclear(DBMap*,DBApply,va_list)
 	 * @see DBMap#vclear(DBMap*,DBApply,va_list)
 	 */
 	 */
-	int (*clear)(DBMap* self, DBApply func, ...);
+	int32 (*clear)(DBMap* self, DBApply func, ...);
 
 
 	/**
 	/**
 	 * Removes all entries from the database.
 	 * Removes all entries from the database.
@@ -548,7 +548,7 @@ struct DBMap {
 	 * @protected
 	 * @protected
 	 * @see DBMap#clear(DBMap*,DBApply,...)
 	 * @see DBMap#clear(DBMap*,DBApply,...)
 	 */
 	 */
-	int (*vclear)(DBMap* self, DBApply func, va_list args);
+	int32 (*vclear)(DBMap* self, DBApply func, va_list args);
 
 
 	/**
 	/**
 	 * Just calls {@link DBMap#vdestroy}.
 	 * Just calls {@link DBMap#vdestroy}.
@@ -565,7 +565,7 @@ struct DBMap {
 	 * @protected
 	 * @protected
 	 * @see DBMap#vdestroy(DBMap*,DBApply,va_list)
 	 * @see DBMap#vdestroy(DBMap*,DBApply,va_list)
 	 */
 	 */
-	int (*destroy)(DBMap* self, DBApply func, ...);
+	int32 (*destroy)(DBMap* self, DBApply func, ...);
 
 
 	/**
 	/**
 	 * Finalize the database, feeing all the memory it uses.
 	 * Finalize the database, feeing all the memory it uses.
@@ -580,7 +580,7 @@ struct DBMap {
 	 * @protected
 	 * @protected
 	 * @see DBMap#destroy(DBMap*,DBApply,...)
 	 * @see DBMap#destroy(DBMap*,DBApply,...)
 	 */
 	 */
-	int (*vdestroy)(DBMap* self, DBApply func, va_list args);
+	int32 (*vdestroy)(DBMap* self, DBApply func, va_list args);
 
 
 	/**
 	/**
 	 * Return the size of the database (number of items in the database).
 	 * Return the size of the database (number of items in the database).
@@ -826,7 +826,7 @@ DBReleaser db_custom_release(DBRelease which);
  * @see #db_default_release(DBType,DBOptions)
  * @see #db_default_release(DBType,DBOptions)
  * @see #db_fix_options(DBType,DBOptions)
  * @see #db_fix_options(DBType,DBOptions)
  */
  */
-DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOptions options, unsigned short maxlen);
+DBMap* db_alloc(const char *file, const char *func, int32 line, DBType type, DBOptions options, unsigned short maxlen);
 
 
 /**
 /**
  * Manual cast from 'int' to the union DBKey.
  * Manual cast from 'int' to the union DBKey.
@@ -834,7 +834,7 @@ DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOpt
  * @return The key as a DBKey union
  * @return The key as a DBKey union
  * @public
  * @public
  */
  */
-DBKey db_i2key(int key);
+DBKey db_i2key(int32 key);
 
 
 /**
 /**
  * Manual cast from 'uint32' to the union DBKey.
  * Manual cast from 'uint32' to the union DBKey.
@@ -874,7 +874,7 @@ DBKey db_ui642key(uint64 key);
  * @return The data as a DBData struct
  * @return The data as a DBData struct
  * @public
  * @public
  */
  */
-DBData db_i2data(int data);
+DBData db_i2data(int32 data);
 
 
 /**
 /**
  * Manual cast from 'uint32' to the struct DBData.
  * Manual cast from 'uint32' to the struct DBData.
@@ -901,13 +901,13 @@ DBData db_ptr2data(void *data);
 DBData db_i642data(int64 data);
 DBData db_i642data(int64 data);
 
 
 /**
 /**
- * Gets int type data from struct DBData.
- * If data is not int type, returns 0.
+ * Gets int32 type data from struct DBData.
+ * If data is not int32 type, returns 0.
  * @param data Data
  * @param data Data
  * @return Integer value of the data.
  * @return Integer value of the data.
  * @public
  * @public
  */
  */
-int db_data2i(DBData *data);
+int32 db_data2i(DBData *data);
 
 
 /**
 /**
  * Gets uint32 type data from struct DBData.
  * Gets uint32 type data from struct DBData.

+ 1 - 1
src/common/des.hpp

@@ -4,7 +4,7 @@
 #ifndef DES_HPP
 #ifndef DES_HPP
 #define DES_HPP
 #define DES_HPP
 
 
-#include "cbasetypes.hpp"
+#include <common/cbasetypes.hpp>
 
 
 /// One 64-bit block.
 /// One 64-bit block.
 typedef struct BIT64 { uint8_t b[8]; } BIT64;
 typedef struct BIT64 { uint8_t b[8]; } BIT64;

+ 1 - 1
src/common/ers.cpp

@@ -67,7 +67,7 @@ typedef struct ers_cache
 	uint32 ObjectSize;
 	uint32 ObjectSize;
 
 
 	// Number of ers_instances referencing this
 	// Number of ers_instances referencing this
-	int ReferenceCount;
+	int32 ReferenceCount;
 
 
 	// Reuse linked list
 	// Reuse linked list
 	struct ers_list *ReuseList;
 	struct ers_list *ReuseList;

+ 38 - 38
src/common/grfio.cpp

@@ -18,11 +18,11 @@
 //	file entry table struct
 //	file entry table struct
 //----------------------------
 //----------------------------
 typedef struct _FILELIST {
 typedef struct _FILELIST {
-	int		srclen;				// compressed size
-	int		srclen_aligned;
-	int		declen;				// original size
-	int		srcpos;				// position of entry in grf
-	int		next;				// index of next filelist entry with same hash (-1: end of entry chain)
+	int32		srclen;				// compressed size
+	int32		srclen_aligned;
+	int32		declen;				// original size
+	int32		srcpos;				// position of entry in grf
+	int32		next;				// index of next filelist entry with same hash (-1: end of entry chain)
 	char	type;
 	char	type;
 	char	fn[128-4*5];		// file name
 	char	fn[128-4*5];		// file name
 	char*	fnd;				// if the file was cloned, contains name of original file
 	char*	fnd;				// if the file was cloned, contains name of original file
@@ -45,26 +45,26 @@ typedef struct _FILELIST {
 
 
 // stores info about every loaded file
 // stores info about every loaded file
 FILELIST* filelist		= nullptr;
 FILELIST* filelist		= nullptr;
-int filelist_entrys		= 0;
-int filelist_maxentry	= 0;
+int32 filelist_entrys		= 0;
+int32 filelist_maxentry	= 0;
 
 
 // stores grf file names
 // stores grf file names
 char** gentry_table		= nullptr;
 char** gentry_table		= nullptr;
-int gentry_entrys		= 0;
-int gentry_maxentry		= 0;
+int32 gentry_entrys		= 0;
+int32 gentry_maxentry		= 0;
 
 
 // the path to the data directory
 // the path to the data directory
 char data_dir[1024] = "";
 char data_dir[1024] = "";
 
 
 
 
-// little endian char array to uint conversion
+// little endian char array to uint32 conversion
 static uint32 getlong(unsigned char* p)
 static uint32 getlong(unsigned char* p)
 {
 {
 	return (p[0] << 0 | p[1] << 8 | p[2] << 16 | p[3] << 24);
 	return (p[0] << 0 | p[1] << 8 | p[2] << 16 | p[3] << 24);
 }
 }
 
 
 
 
-static void NibbleSwap(unsigned char* src, int len)
+static void NibbleSwap(unsigned char* src, int32 len)
 {
 {
 	while( len > 0 )
 	while( len > 0 )
 	{
 	{
@@ -151,11 +151,11 @@ static void grf_decode_header(unsigned char* buf, size_t len)
 }
 }
 
 
 
 
-static void grf_decode_full(unsigned char* buf, size_t len, int cycle)
+static void grf_decode_full(unsigned char* buf, size_t len, int32 cycle)
 {
 {
 	BIT64* p = (BIT64*)buf;
 	BIT64* p = (BIT64*)buf;
 	size_t nblocks = len / sizeof(BIT64);
 	size_t nblocks = len / sizeof(BIT64);
-	int dcycle, scycle;
+	int32 dcycle, scycle;
 	size_t i, j;
 	size_t i, j;
 
 
 	// first 20 blocks are all des-encrypted
 	// first 20 blocks are all des-encrypted
@@ -195,13 +195,13 @@ static void grf_decode_full(unsigned char* buf, size_t len, int cycle)
 /// @param len length of the data
 /// @param len length of the data
 /// @param entry_type flags associated with the data
 /// @param entry_type flags associated with the data
 /// @param entry_len true (unaligned) length of the data
 /// @param entry_len true (unaligned) length of the data
-static void grf_decode(unsigned char* buf, size_t len, char entry_type, int entry_len)
+static void grf_decode(unsigned char* buf, size_t len, char entry_type, int32 entry_len)
 {
 {
 	if( entry_type & FILELIST_TYPE_ENCRYPT_MIXED )
 	if( entry_type & FILELIST_TYPE_ENCRYPT_MIXED )
 	{// fully encrypted
 	{// fully encrypted
-		int digits;
-		int cycle;
-		int i;
+		int32 digits;
+		int32 cycle;
+		int32 i;
 
 
 		// compute number of digits of the entry length
 		// compute number of digits of the entry length
 		digits = 1;
 		digits = 1;
@@ -242,14 +242,14 @@ unsigned long grfio_crc32(const unsigned char* buf, uint32 len)
 
 
 
 
 /// zlib uncompress
 /// zlib uncompress
-int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen)
+int32 decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen)
 {
 {
 	return uncompress((Bytef*)dest, destLen, (const Bytef*)source, sourceLen);
 	return uncompress((Bytef*)dest, destLen, (const Bytef*)source, sourceLen);
 }
 }
 
 
 
 
 /// zlib compress
 /// zlib compress
-int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen)
+int32 encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen)
 {
 {
 	return compress((Bytef*)dest, destLen, (const Bytef*)source, sourceLen);
 	return compress((Bytef*)dest, destLen, (const Bytef*)source, sourceLen);
 }
 }
@@ -259,18 +259,18 @@ int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned
  ***                File List Subroutines                ***
  ***                File List Subroutines                ***
  ***********************************************************/
  ***********************************************************/
 // file list hash table
 // file list hash table
-int filelist_hash[256];
+int32 filelist_hash[256];
 
 
 // initializes the table that holds the first elements of all hash chains
 // initializes the table that holds the first elements of all hash chains
 static void hashinit(void)
 static void hashinit(void)
 {
 {
-	int i;
+	int32 i;
 	for (i = 0; i < 256; i++)
 	for (i = 0; i < 256; i++)
 		filelist_hash[i] = -1;
 		filelist_hash[i] = -1;
 }
 }
 
 
 // hashes a filename string into a number from {0..255}
 // hashes a filename string into a number from {0..255}
-static int filehash(const char* fname)
+static int32 filehash(const char* fname)
 {
 {
 	uint32 hash = 0;
 	uint32 hash = 0;
 	while(*fname) {
 	while(*fname) {
@@ -283,7 +283,7 @@ static int filehash(const char* fname)
 // finds a FILELIST entry with the specified file name
 // finds a FILELIST entry with the specified file name
 static FILELIST* filelist_find(const char* fname)
 static FILELIST* filelist_find(const char* fname)
 {
 {
-	int hash, index;
+	int32 hash, index;
 
 
 	if (!filelist)
 	if (!filelist)
 		return nullptr;
 		return nullptr;
@@ -307,7 +307,7 @@ char* grfio_find_file(const char* fname)
 // adds a FILELIST entry into the list of loaded files
 // adds a FILELIST entry into the list of loaded files
 static FILELIST* filelist_add(FILELIST* entry)
 static FILELIST* filelist_add(FILELIST* entry)
 {
 {
-	int hash;
+	int32 hash;
 
 
 	#define	FILELIST_ADDS	1024	// number increment of file lists `
 	#define	FILELIST_ADDS	1024	// number increment of file lists `
 
 
@@ -333,7 +333,7 @@ static FILELIST* filelist_modify(FILELIST* entry)
 {
 {
 	FILELIST* fentry = filelist_find(entry->fn);
 	FILELIST* fentry = filelist_find(entry->fn);
 	if (fentry != nullptr) {
 	if (fentry != nullptr) {
-		int tmp = fentry->next;
+		int32 tmp = fentry->next;
 		memcpy(fentry, entry, sizeof(FILELIST));
 		memcpy(fentry, entry, sizeof(FILELIST));
 		fentry->next = tmp;
 		fentry->next = tmp;
 	} else {
 	} else {
@@ -494,9 +494,9 @@ int32 grfio_read_rsw_water_level( const char* fname ){
 }
 }
 
 
 /// Decodes encrypted filename from a version 01xx grf index.
 /// Decodes encrypted filename from a version 01xx grf index.
-static char* decode_filename(unsigned char* buf, int len)
+static char* decode_filename(unsigned char* buf, int32 len)
 {
 {
-	int lop;
+	int32 lop;
 	for(lop=0;lop<len;lop+=8) {
 	for(lop=0;lop<len;lop+=8) {
 		NibbleSwap(&buf[lop],8);
 		NibbleSwap(&buf[lop],8);
 		des_decrypt(&buf[lop],8);
 		des_decrypt(&buf[lop],8);
@@ -524,11 +524,11 @@ static bool isFullEncrypt(const char* fname)
 
 
 /// Loads all entries in the specified grf file into the filelist.
 /// Loads all entries in the specified grf file into the filelist.
 /// @param gentry index of the grf file name in the gentry_table
 /// @param gentry index of the grf file name in the gentry_table
-static int grfio_entryread(const char* grfname, int gentry)
+static int32 grfio_entryread(const char* grfname, int32 gentry)
 {
 {
 	long grf_size;
 	long grf_size;
 	unsigned char grf_header[0x2e];
 	unsigned char grf_header[0x2e];
-	int entry,entrys,ofs,grf_version;
+	int32 entry,entrys,ofs,grf_version;
 	unsigned char *grf_filelist;
 	unsigned char *grf_filelist;
 
 
 	FILE* fp = fopen(grfname, "rb");
 	FILE* fp = fopen(grfname, "rb");
@@ -564,11 +564,11 @@ static int grfio_entryread(const char* grfname, int gentry)
 		for( entry = 0, ofs = 0; entry < entrys; ++entry ) {
 		for( entry = 0, ofs = 0; entry < entrys; ++entry ) {
 			FILELIST aentry;
 			FILELIST aentry;
 
 
-			int ofs2 = ofs+getlong(grf_filelist+ofs)+4;
+			int32 ofs2 = ofs+getlong(grf_filelist+ofs)+4;
 			unsigned char type = grf_filelist[ofs2+12];
 			unsigned char type = grf_filelist[ofs2+12];
 			if( type & FILELIST_TYPE_FILE ) {
 			if( type & FILELIST_TYPE_FILE ) {
 				char* fname = decode_filename(grf_filelist+ofs+6, grf_filelist[ofs]-6);
 				char* fname = decode_filename(grf_filelist+ofs+6, grf_filelist[ofs]-6);
-				int srclen = getlong(grf_filelist+ofs2+0) - getlong(grf_filelist+ofs2+8) - 715;
+				int32 srclen = getlong(grf_filelist+ofs2+0) - getlong(grf_filelist+ofs2+8) - 715;
 
 
 				if( strlen(fname) > sizeof(aentry.fn) - 1 ) {
 				if( strlen(fname) > sizeof(aentry.fn) - 1 ) {
 					ShowFatalError("GRF file name %s is too long\n", fname);
 					ShowFatalError("GRF file name %s is too long\n", fname);
@@ -626,8 +626,8 @@ static int grfio_entryread(const char* grfname, int gentry)
 			FILELIST aentry;
 			FILELIST aentry;
 
 
 			char* fname = (char*)(grf_filelist+ofs);
 			char* fname = (char*)(grf_filelist+ofs);
-			int ofs2 = ofs + (int)strlen(fname)+1;
-			int type = grf_filelist[ofs2+12];
+			int32 ofs2 = ofs + (int)strlen(fname)+1;
+			int32 type = grf_filelist[ofs2+12];
 
 
 			if( strlen(fname) > sizeof(aentry.fn)-1 ) {
 			if( strlen(fname) > sizeof(aentry.fn)-1 ) {
 				ShowFatalError("GRF file name %s is too long\n", fname);
 				ShowFatalError("GRF file name %s is too long\n", fname);
@@ -716,7 +716,7 @@ static void grfio_resourcecheck(void)
 	char *buf;
 	char *buf;
 	size_t size;
 	size_t size;
 	FILE* fp;
 	FILE* fp;
-	int i = 0;
+	int32 i = 0;
 
 
 	// read resnametable from data directory and return if successful
 	// read resnametable from data directory and return if successful
 	grfio_localpath_create(restable, sizeof(restable), "data\\resnametable.txt");
 	grfio_localpath_create(restable, sizeof(restable), "data\\resnametable.txt");
@@ -762,7 +762,7 @@ static void grfio_resourcecheck(void)
 
 
 
 
 /// Reads a grf file and adds it to the list.
 /// Reads a grf file and adds it to the list.
-static int grfio_add(const char* fname)
+static int32 grfio_add(const char* fname)
 {
 {
 	if( gentry_entrys >= gentry_maxentry )
 	if( gentry_entrys >= gentry_maxentry )
 	{
 	{
@@ -782,7 +782,7 @@ static int grfio_add(const char* fname)
 void grfio_final(void)
 void grfio_final(void)
 {
 {
 	if (filelist != nullptr) {
 	if (filelist != nullptr) {
-		int i;
+		int32 i;
 		for (i = 0; i < filelist_entrys; i++)
 		for (i = 0; i < filelist_entrys; i++)
 			if (filelist[i].fnd != nullptr)
 			if (filelist[i].fnd != nullptr)
 				aFree(filelist[i].fnd);
 				aFree(filelist[i].fnd);
@@ -793,7 +793,7 @@ void grfio_final(void)
 	filelist_entrys = filelist_maxentry = 0;
 	filelist_entrys = filelist_maxentry = 0;
 
 
 	if (gentry_table != nullptr) {
 	if (gentry_table != nullptr) {
-		int i;
+		int32 i;
 		for (i = 0; i < gentry_entrys; i++)
 		for (i = 0; i < gentry_entrys; i++)
 			if (gentry_table[i] != nullptr)
 			if (gentry_table[i] != nullptr)
 				aFree(gentry_table[i]);
 				aFree(gentry_table[i]);
@@ -809,7 +809,7 @@ void grfio_final(void)
 void grfio_init(const char* fname)
 void grfio_init(const char* fname)
 {
 {
 	FILE* data_conf;
 	FILE* data_conf;
-	int grf_num = 0;
+	int32 grf_num = 0;
 
 
 	hashinit();	// hash table initialization
 	hashinit();	// hash table initialization
 
 

+ 2 - 2
src/common/grfio.hpp

@@ -15,7 +15,7 @@ char* grfio_find_file(const char* fname);
 int32 grfio_read_rsw_water_level( const char* fname );
 int32 grfio_read_rsw_water_level( const char* fname );
 
 
 unsigned long grfio_crc32(const unsigned char *buf, uint32 len);
 unsigned long grfio_crc32(const unsigned char *buf, uint32 len);
-int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
-int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
+int32 decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
+int32 encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
 
 
 #endif /* GRFIO_HPP */
 #endif /* GRFIO_HPP */

+ 13 - 13
src/common/malloc.cpp

@@ -72,7 +72,7 @@
 
 
 #endif
 #endif
 
 
-void* aMalloc_(size_t size, const char *file, int line, const char *func)
+void* aMalloc_(size_t size, const char *file, int32 line, const char *func)
 {
 {
 	void *ret = MALLOC(size, file, line, func);
 	void *ret = MALLOC(size, file, line, func);
 	// ShowMessage("%s:%d: in func %s: aMalloc %d\n",file,line,func,size);
 	// ShowMessage("%s:%d: in func %s: aMalloc %d\n",file,line,func,size);
@@ -83,7 +83,7 @@ void* aMalloc_(size_t size, const char *file, int line, const char *func)
 
 
 	return ret;
 	return ret;
 }
 }
-void* aCalloc_(size_t num, size_t size, const char *file, int line, const char *func)
+void* aCalloc_(size_t num, size_t size, const char *file, int32 line, const char *func)
 {
 {
 	void *ret = CALLOC(num, size, file, line, func);
 	void *ret = CALLOC(num, size, file, line, func);
 	// ShowMessage("%s:%d: in func %s: aCalloc %d %d\n",file,line,func,num,size);
 	// ShowMessage("%s:%d: in func %s: aCalloc %d %d\n",file,line,func,num,size);
@@ -93,7 +93,7 @@ void* aCalloc_(size_t num, size_t size, const char *file, int line, const char *
 	}
 	}
 	return ret;
 	return ret;
 }
 }
-void* aRealloc_(void *p, size_t size, const char *file, int line, const char *func)
+void* aRealloc_(void *p, size_t size, const char *file, int32 line, const char *func)
 {
 {
 	void *ret = REALLOC(p, size, file, line, func);
 	void *ret = REALLOC(p, size, file, line, func);
 	// ShowMessage("%s:%d: in func %s: aRealloc %p %d\n",file,line,func,p,size);
 	// ShowMessage("%s:%d: in func %s: aRealloc %p %d\n",file,line,func,p,size);
@@ -103,7 +103,7 @@ void* aRealloc_(void *p, size_t size, const char *file, int line, const char *fu
 	}
 	}
 	return ret;
 	return ret;
 }
 }
-char* aStrdup_(const char *p, const char *file, int line, const char *func)
+char* aStrdup_(const char *p, const char *file, int32 line, const char *func)
 {
 {
 	char *ret = STRDUP(p, file, line, func);
 	char *ret = STRDUP(p, file, line, func);
 	// ShowMessage("%s:%d: in func %s: aStrdup %p\n",file,line,func,p);
 	// ShowMessage("%s:%d: in func %s: aStrdup %p\n",file,line,func,p);
@@ -113,7 +113,7 @@ char* aStrdup_(const char *p, const char *file, int line, const char *func)
 	}
 	}
 	return ret;
 	return ret;
 }
 }
-void aFree_(void *p, const char *file, int line, const char *func)
+void aFree_(void *p, const char *file, int32 line, const char *func)
 {
 {
 	// ShowMessage("%s:%d: in func %s: aFree %p\n",file,line,func,p);
 	// ShowMessage("%s:%d: in func %s: aFree %p\n",file,line,func,p);
 	if (p)
 	if (p)
@@ -225,7 +225,7 @@ static size_t hash2size( unsigned short hash )
 	}
 	}
 }
 }
 
 
-void* _mmalloc(size_t size, const char *file, int 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 );
 	short size_hash = size2hash( size );
@@ -327,14 +327,14 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
 	return (char *)head + sizeof(struct unit_head) - sizeof(long);
 	return (char *)head + sizeof(struct unit_head) - sizeof(long);
 }
 }
 
 
-void* _mcalloc(size_t num, size_t size, const char *file, int line, const char *func )
+void* _mcalloc(size_t num, size_t size, const char *file, int32 line, const char *func )
 {
 {
 	void *p = _mmalloc(num * size,file,line,func);
 	void *p = _mmalloc(num * size,file,line,func);
 	memset(p,0,num * size);
 	memset(p,0,num * size);
 	return p;
 	return p;
 }
 }
 
 
-void* _mrealloc(void *memblock, size_t size, const char *file, int line, const char *func )
+void* _mrealloc(void *memblock, size_t size, const char *file, int32 line, const char *func )
 {
 {
 	size_t old_size;
 	size_t old_size;
 	if(memblock == nullptr) {
 	if(memblock == nullptr) {
@@ -359,7 +359,7 @@ void* _mrealloc(void *memblock, size_t size, const char *file, int line, const c
 	}
 	}
 }
 }
 
 
-char* _mstrdup(const char *p, const char *file, int line, const char *func )
+char* _mstrdup(const char *p, const char *file, int32 line, const char *func )
 {
 {
 	if(p == nullptr) {
 	if(p == nullptr) {
 		return nullptr;
 		return nullptr;
@@ -371,7 +371,7 @@ char* _mstrdup(const char *p, const char *file, int line, const char *func )
 	}
 	}
 }
 }
 
 
-void _mfree(void *ptr, const char *file, int line, const char *func )
+void _mfree(void *ptr, const char *file, int32 line, const char *func )
 {
 {
 	struct unit_head *head;
 	struct unit_head *head;
 
 
@@ -451,7 +451,7 @@ static struct block* block_malloc(unsigned short hash)
 		p = hash_unfill[0];
 		p = hash_unfill[0];
 		hash_unfill[0] = hash_unfill[0]->unfill_next;
 		hash_unfill[0] = hash_unfill[0]->unfill_next;
 	} else {
 	} else {
-		int i;
+		int32 i;
 		/* Newly allocated space for the block */
 		/* Newly allocated space for the block */
 		p = (struct block*)MALLOC(sizeof(struct block) * (BLOCK_ALLOC), __FILE__, __LINE__, __func__ );
 		p = (struct block*)MALLOC(sizeof(struct block) * (BLOCK_ALLOC), __FILE__, __LINE__, __func__ );
 		if(p == nullptr) {
 		if(p == nullptr) {
@@ -605,12 +605,12 @@ static void memmgr_final (void)
 	struct unit_head_large *large = unit_head_large_first;
 	struct unit_head_large *large = unit_head_large_first;
 
 
 #ifdef LOG_MEMMGR
 #ifdef LOG_MEMMGR
-	int count = 0;
+	int32 count = 0;
 #endif /* LOG_MEMMGR */
 #endif /* LOG_MEMMGR */
 
 
 	while (block) {
 	while (block) {
 		if (block->unit_used) {
 		if (block->unit_used) {
-			int i;
+			int32 i;
 			for (i = 0; i < block->unit_maxused; i++) {
 			for (i = 0; i < block->unit_maxused; i++) {
 				struct unit_head *head = block2unit(block, i);
 				struct unit_head *head = block2unit(block, i);
 				if(head->block != nullptr) {
 				if(head->block != nullptr) {

+ 10 - 10
src/common/malloc.hpp

@@ -47,11 +47,11 @@
 #	define aStrdup2(p,file,line,func)		_mstrdup(p,file,line,func)
 #	define aStrdup2(p,file,line,func)		_mstrdup(p,file,line,func)
 #	define aFree2(p,file,line,func)			_mfree(p,file,line,func)
 #	define aFree2(p,file,line,func)			_mfree(p,file,line,func)
 
 
-	void* _mmalloc	(size_t size, const char *file, int line, const char *func);
-	void* _mcalloc	(size_t num, size_t size, const char *file, int line, const char *func);
-	void* _mrealloc	(void *p, size_t size, const char *file, int line, const char *func);
-	char* _mstrdup	(const char *p, const char *file, int line, const char *func);
-	void  _mfree	(void *p, const char *file, int line, const char *func);
+	void* _mmalloc	(size_t size, const char *file, int32 line, const char *func);
+	void* _mcalloc	(size_t num, size_t size, const char *file, int32 line, const char *func);
+	void* _mrealloc	(void *p, size_t size, const char *file, int32 line, const char *func);
+	char* _mstrdup	(const char *p, const char *file, int32 line, const char *func);
+	void  _mfree	(void *p, const char *file, int32 line, const char *func);
 
 
 #else
 #else
 
 
@@ -67,11 +67,11 @@
 #	define aStrdup2(p,file,line,func)		aStrdup_(p,file,line,func)
 #	define aStrdup2(p,file,line,func)		aStrdup_(p,file,line,func)
 #	define aFree2(p,file,line,func)			aFree_(p,file,line,func)
 #	define aFree2(p,file,line,func)			aFree_(p,file,line,func)
 
 
-	void* aMalloc_	(size_t size, const char *file, int line, const char *func);
-	void* aCalloc_	(size_t num, size_t size, const char *file, int line, const char *func);
-	void* aRealloc_	(void *p, size_t size, const char *file, int line, const char *func);
-	char* aStrdup_	(const char *p, const char *file, int line, const char *func);
-	void  aFree_	(void *p, const char *file, int line, const char *func);
+	void* aMalloc_	(size_t size, const char *file, int32 line, const char *func);
+	void* aCalloc_	(size_t num, size_t size, const char *file, int32 line, const char *func);
+	void* aRealloc_	(void *p, size_t size, const char *file, int32 line, const char *func);
+	char* aStrdup_	(const char *p, const char *file, int32 line, const char *func);
+	void  aFree_	(void *p, const char *file, int32 line, const char *func);
 
 
 #endif
 #endif
 
 

+ 6 - 6
src/common/mapindex.cpp

@@ -15,7 +15,7 @@ struct _indexes {
 	char name[MAP_NAME_LENGTH]; //Stores map name
 	char name[MAP_NAME_LENGTH]; //Stores map name
 } indexes[MAX_MAPINDEX];
 } indexes[MAX_MAPINDEX];
 
 
-int max_index = 0;
+int32 max_index = 0;
 
 
 #define mapindex_exists(id) (indexes[id].name[0] != '\0')
 #define mapindex_exists(id) (indexes[id].name[0] != '\0')
 
 
@@ -71,7 +71,7 @@ const char* mapindex_getmapname_ext(const char* string, char* output) {
 
 
 /// Adds a map to the specified index
 /// Adds a map to the specified index
 /// Returns 1 if successful, 0 oherwise
 /// Returns 1 if successful, 0 oherwise
-int mapindex_addmap(int index, const char* name) {
+int32 mapindex_addmap(int32 index, const char* name) {
 	char map_name[MAP_NAME_LENGTH];
 	char map_name[MAP_NAME_LENGTH];
 	if (index == -1){ //autogive index
 	if (index == -1){ //autogive index
 		ARR_FIND(1,max_index,index,(indexes[index].name[0] == '\0'));
 		ARR_FIND(1,max_index,index,(indexes[index].name[0] == '\0'));
@@ -108,7 +108,7 @@ int mapindex_addmap(int index, const char* name) {
 }
 }
 
 
 unsigned short mapindex_name2idx(const char* name, const char *func) {
 unsigned short mapindex_name2idx(const char* name, const char *func) {
-	int i;
+	int32 i;
 	char map_name[MAP_NAME_LENGTH];
 	char map_name[MAP_NAME_LENGTH];
 	mapindex_getmapname(name, map_name);
 	mapindex_getmapname(name, map_name);
 
 
@@ -131,8 +131,8 @@ const char* mapindex_idx2name(unsigned short id, const char *func) {
 void mapindex_init(void) {
 void mapindex_init(void) {
 	FILE *fp;
 	FILE *fp;
 	char line[1024];
 	char line[1024];
-	int last_index = -1;
-	int index;
+	int32 last_index = -1;
+	int32 index;
 	char map_name[MAP_NAME_LENGTH];
 	char map_name[MAP_NAME_LENGTH];
 	char path[255];
 	char path[255];
 	const char* mapindex_cfgfile[] = {
 	const char* mapindex_cfgfile[] = {
@@ -188,7 +188,7 @@ void mapindex_check_mapdefault(const char *mapname) {
 	}
 	}
 }
 }
 
 
-int mapindex_removemap(int index){
+int32 mapindex_removemap(int32 index){
 	indexes[index].name[0] = '\0';
 	indexes[index].name[0] = '\0';
 	return 0;
 	return 0;
 }
 }

+ 3 - 2
src/common/mapindex.hpp

@@ -4,6 +4,7 @@
 #ifndef MAPINDEX_HPP
 #ifndef MAPINDEX_HPP
 #define MAPINDEX_HPP
 #define MAPINDEX_HPP
 
 
+#include "cbasetypes.hpp"
 #include "mmo.hpp"
 #include "mmo.hpp"
 
 
 #define MAX_MAPINDEX 2000
 #define MAX_MAPINDEX 2000
@@ -63,8 +64,8 @@ unsigned short mapindex_name2idx(const char* name, const char *func);
 const char* mapindex_idx2name(unsigned short id, const char *func);
 const char* mapindex_idx2name(unsigned short id, const char *func);
 #define mapindex_id2name(mapindex) mapindex_idx2name((mapindex), __FUNCTION__)
 #define mapindex_id2name(mapindex) mapindex_idx2name((mapindex), __FUNCTION__)
 
 
-int mapindex_addmap(int index, const char* name);
-int mapindex_removemap(int index);
+int32 mapindex_addmap(int32 index, const char* name);
+int32 mapindex_removemap(int32 index);
 
 
 void mapindex_check_mapdefault(const char *mapname);
 void mapindex_check_mapdefault(const char *mapname);
 
 

+ 2 - 2
src/common/md5calc.cpp

@@ -91,7 +91,7 @@ static void MD5_Round_Calculate(const unsigned char *block,
 {
 {
 	//create X It is since it is required.
 	//create X It is since it is required.
 	uint32 X[16]; //512bit 64byte
 	uint32 X[16]; //512bit 64byte
-	int j,k;
+	int32 j,k;
 
 
 	//Save A as AA, B as BB, C as CC, and and D as DD (saving of A, B, C, and D)
 	//Save A as AA, B as BB, C as CC, and and D as DD (saving of A, B, C, and D)
 	uint32 A=*A2, B=*B2, C=*C2, D=*D2;
 	uint32 A=*A2, B=*B2, C=*C2, D=*D2;
@@ -158,7 +158,7 @@ static void MD5_String2binary(const char * string, unsigned char * output)
                 *B = &msg_digest[1],
                 *B = &msg_digest[1],
                 *C = &msg_digest[2],
                 *C = &msg_digest[2],
                 *D = &msg_digest[3];
                 *D = &msg_digest[3];
-	int i;
+	int32 i;
 
 
 //prog
 //prog
    //Step 3.Initialize MD Buffer (although it is the initialization; step 3 of A, B, C, and D -- unavoidable -- a head)
    //Step 3.Initialize MD Buffer (although it is the initialization; step 3 of A, B, C, and D -- unavoidable -- a head)

+ 65 - 65
src/common/mmo.hpp

@@ -284,19 +284,19 @@ enum e_quest_state : uint8 {
 
 
 /// Questlog entry
 /// Questlog entry
 struct quest {
 struct quest {
-	int quest_id;                    ///< Quest ID
+	int32 quest_id;                    ///< Quest ID
 	uint32 time;                     ///< Expiration time
 	uint32 time;                     ///< Expiration time
-	int count[MAX_QUEST_OBJECTIVES]; ///< Kill counters of each quest objective
+	int32 count[MAX_QUEST_OBJECTIVES]; ///< Kill counters of each quest objective
 	e_quest_state state;             ///< Current quest state
 	e_quest_state state;             ///< Current quest state
 };
 };
 
 
 /// Achievement log entry
 /// Achievement log entry
 struct achievement {
 struct achievement {
-	int achievement_id;                    ///< Achievement ID
-	int count[MAX_ACHIEVEMENT_OBJECTIVES]; ///< Counters of each achievement objective
+	int32 achievement_id;                    ///< Achievement ID
+	int32 count[MAX_ACHIEVEMENT_OBJECTIVES]; ///< Counters of each achievement objective
 	time_t completed;                      ///< Date completed
 	time_t completed;                      ///< Date completed
 	time_t rewarded;                       ///< Received reward?
 	time_t rewarded;                       ///< Received reward?
-	int score;                             ///< Amount of points achievement is worth
+	int32 score;                             ///< Amount of points achievement is worth
 };
 };
 
 
 // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
 // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
@@ -311,7 +311,7 @@ struct s_item_randomoption {
 } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct item {
 struct item {
-	int id;
+	int32 id;
 	t_itemid nameid;
 	t_itemid nameid;
 	short amount;
 	short 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)
@@ -478,7 +478,7 @@ struct s_storage_table {
 struct s_pet {
 struct s_pet {
 	uint32 account_id;
 	uint32 account_id;
 	uint32 char_id;
 	uint32 char_id;
-	int pet_id;
+	int32 pet_id;
 	short class_;
 	short class_;
 	short level;
 	short level;
 	t_itemid egg_id;//pet egg id
 	t_itemid egg_id;//pet egg id
@@ -493,7 +493,7 @@ struct s_pet {
 
 
 struct s_homunculus {	//[orn]
 struct s_homunculus {	//[orn]
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
-	int hom_id;
+	int32 hom_id;
 	uint32 char_id;
 	uint32 char_id;
 	short class_;
 	short class_;
 	short prev_class;
 	short prev_class;
@@ -506,39 +506,39 @@ struct s_homunculus {	//[orn]
 	t_exp exp;
 	t_exp exp;
 	short rename_flag;
 	short rename_flag;
 	short vaporize; //albator
 	short vaporize; //albator
-	int str;
-	int agi;
-	int vit;
-	int int_;
-	int dex;
-	int luk;
-
-	int str_value;
-	int agi_value;
-	int vit_value;
-	int int_value;
-	int dex_value;
-	int luk_value;
+	int32 str;
+	int32 agi;
+	int32 vit;
+	int32 int_;
+	int32 dex;
+	int32 luk;
+
+	int32 str_value;
+	int32 agi_value;
+	int32 vit_value;
+	int32 int_value;
+	int32 dex_value;
+	int32 luk_value;
 
 
 	char spiritball; //for homun S [lighta]
 	char spiritball; //for homun S [lighta]
 	bool autofeed;
 	bool autofeed;
 };
 };
 
 
 struct s_mercenary {
 struct s_mercenary {
-	int mercenary_id;
+	int32 mercenary_id;
 	uint32 char_id;
 	uint32 char_id;
 	short class_;
 	short class_;
-	int hp, sp;
+	int32 hp, sp;
 	uint32 kill_count;
 	uint32 kill_count;
 	t_tick life_time;
 	t_tick life_time;
 };
 };
 
 
 struct s_elemental {
 struct s_elemental {
-	int elemental_id;
+	int32 elemental_id;
 	uint32 char_id;
 	uint32 char_id;
 	short class_;
 	short class_;
-	int mode;
-	int hp, sp, max_hp, max_sp, matk, atk, atk2;
+	int32 mode;
+	int32 hp, sp, max_hp, max_sp, matk, atk, atk2;
 	short hit, flee, amotion, def, mdef;
 	short hit, flee, amotion, def, mdef;
 	t_tick life_time;
 	t_tick life_time;
 };
 };
@@ -566,22 +566,22 @@ struct mmo_charstatus {
 	uint32 child;
 	uint32 child;
 
 
 	t_exp base_exp,job_exp;
 	t_exp base_exp,job_exp;
-	int zeny;
+	int32 zeny;
 
 
 	short class_; ///< Player's JobID
 	short class_; ///< Player's JobID
 	uint32 status_point,skill_point,trait_point;
 	uint32 status_point,skill_point,trait_point;
-	int 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.
 	short 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;
 	short hair,hair_color,clothes_color,body;
-	int party_id,guild_id,pet_id,hom_id,mer_id,ele_id,clan_id;
-	int fame;
+	int32 party_id,guild_id,pet_id,hom_id,mer_id,ele_id,clan_id;
+	int32 fame;
 
 
 	// Mercenary Guilds Rank
 	// Mercenary Guilds Rank
-	int arch_faith, arch_calls;
-	int spear_faith, spear_calls;
-	int sword_faith, sword_calls;
+	int32 arch_faith, arch_calls;
+	int32 spear_faith, spear_calls;
+	int32 sword_faith, sword_calls;
 
 
 	short weapon; // enum weapon_type
 	short weapon; // enum weapon_type
 	short shield; // view-id
 	short shield; // view-id
@@ -650,7 +650,7 @@ enum mail_attachment_type {
 };
 };
 
 
 struct mail_message {
 struct mail_message {
-	int id;
+	int32 id;
 	uint32 send_id;                 //hold char_id of sender
 	uint32 send_id;                 //hold char_id of sender
 	char send_name[NAME_LENGTH];    //sender nickname
 	char send_name[NAME_LENGTH];    //sender nickname
 	uint32 dest_id;                 //hold char_id of receiver
 	uint32 dest_id;                 //hold char_id of receiver
@@ -676,9 +676,9 @@ struct mail_data {
 
 
 struct auction_data {
 struct auction_data {
 	uint32 auction_id;
 	uint32 auction_id;
-	int seller_id;
+	int32 seller_id;
 	char seller_name[NAME_LENGTH];
 	char seller_name[NAME_LENGTH];
-	int buyer_id;
+	int32 buyer_id;
 	char buyer_name[NAME_LENGTH];
 	char buyer_name[NAME_LENGTH];
 
 
 	struct item item;
 	struct item item;
@@ -687,9 +687,9 @@ struct auction_data {
 	short type;
 	short type;
 
 
 	unsigned short hours;
 	unsigned short hours;
-	int price, buynow;
+	int32 price, buynow;
 	time_t timestamp; // auction's end time
 	time_t timestamp; // auction's end time
-	int auction_end_timer;
+	int32 auction_end_timer;
 };
 };
 
 
 struct party_member {
 struct party_member {
@@ -704,7 +704,7 @@ struct party_member {
 };
 };
 
 
 struct party {
 struct party {
-	int party_id;
+	int32 party_id;
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 	unsigned char count; //Count of online characters.
 	unsigned char count; //Count of online characters.
 	unsigned exp : 1,
 	unsigned exp : 1,
@@ -726,14 +726,14 @@ struct guild_member {
 
 
 struct guild_position {
 struct guild_position {
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
-	int mode;
-	int exp_mode;
+	int32 mode;
+	int32 exp_mode;
 	unsigned char modified;
 	unsigned char modified;
 };
 };
 
 
 struct guild_alliance {
 struct guild_alliance {
-	int opposition;
-	int guild_id;
+	int32 opposition;
+	int32 guild_id;
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 };
 };
 
 
@@ -745,21 +745,21 @@ struct guild_expulsion {
 };
 };
 
 
 struct guild_skill {
 struct guild_skill {
-	int id,lv;
+	int32 id,lv;
 };
 };
 
 
 struct Channel;
 struct Channel;
 struct mmo_guild {
 struct mmo_guild {
-	int guild_id;
+	int32 guild_id;
 	short guild_lv, connect_member, max_member, average_lv;
 	short guild_lv, connect_member, max_member, average_lv;
 	t_exp exp;
 	t_exp exp;
 	t_exp next_exp;
 	t_exp next_exp;
-	int skill_point;
+	int32 skill_point;
 	char name[NAME_LENGTH],master[NAME_LENGTH];
 	char name[NAME_LENGTH],master[NAME_LENGTH];
 	struct guild_member member[MAX_GUILD];
 	struct guild_member member[MAX_GUILD];
 	struct guild_position position[MAX_GUILDPOSITION];
 	struct guild_position position[MAX_GUILDPOSITION];
 	char mes1[MAX_GUILDMES1],mes2[MAX_GUILDMES2];
 	char mes1[MAX_GUILDMES1],mes2[MAX_GUILDMES2];
-	int emblem_len,emblem_id;
+	int32 emblem_len,emblem_id;
 	char emblem_data[2048];
 	char emblem_data[2048];
 	struct guild_alliance alliance[MAX_GUILDALLIANCE];
 	struct guild_alliance alliance[MAX_GUILDALLIANCE];
 	struct guild_expulsion expulsion[MAX_GUILDEXPULSION];
 	struct guild_expulsion expulsion[MAX_GUILDEXPULSION];
@@ -775,8 +775,8 @@ enum e_woe_type{
 };
 };
 
 
 struct guild_castle {
 struct guild_castle {
-	int castle_id;
-	int mapindex;
+	int32 castle_id;
+	int32 mapindex;
 	char castle_name[NAME_LENGTH];
 	char castle_name[NAME_LENGTH];
 	char castle_event[NPC_NAME_LENGTH];
 	char castle_event[NPC_NAME_LENGTH];
 	e_woe_type type;
 	e_woe_type type;
@@ -786,21 +786,21 @@ struct guild_castle {
 	uint16 warp_y;
 	uint16 warp_y;
 	uint32 zeny;
 	uint32 zeny;
 	uint32 zeny_siege;
 	uint32 zeny_siege;
-	int guild_id;
-	int economy;
-	int defense;
-	int triggerE;
-	int triggerD;
-	int nextTime;
-	int payTime;
-	int createTime;
-	int visibleC;
+	int32 guild_id;
+	int32 economy;
+	int32 defense;
+	int32 triggerE;
+	int32 triggerD;
+	int32 nextTime;
+	int32 payTime;
+	int32 createTime;
+	int32 visibleC;
 	struct {
 	struct {
 		unsigned visible : 1;
 		unsigned visible : 1;
-		int id; // object id
+		int32 id; // object id
 	} guardian[MAX_GUARDIANS];
 	} guardian[MAX_GUARDIANS];
 	int* temp_guardians; // ids of temporary guardians (mobs)
 	int* temp_guardians; // ids of temporary guardians (mobs)
-	int temp_guardians_max;
+	int32 temp_guardians_max;
 };
 };
 
 
 /// Enum for guild castle data script commands
 /// Enum for guild castle data script commands
@@ -834,8 +834,8 @@ enum e_guild_permission {
 };
 };
 
 
 struct fame_list {
 struct fame_list {
-	int id;
-	int fame;
+	int32 id;
+	int32 fame;
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 };
 };
 
 
@@ -1137,13 +1137,13 @@ enum e_rank {
 };
 };
 
 
 struct clan_alliance {
 struct clan_alliance {
-	int opposition;
-	int clan_id;
+	int32 opposition;
+	int32 clan_id;
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 };
 };
 
 
 struct clan{
 struct clan{
-	int id;
+	int32 id;
 	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];

+ 9 - 9
src/common/msg_conf.cpp

@@ -15,7 +15,7 @@
  * Return the message string of the specified number by [Yor]
  * Return the message string of the specified number by [Yor]
  * (read in table msg_table, with specified lenght table in size)
  * (read in table msg_table, with specified lenght table in size)
  */
  */
-const char* _msg_txt(int msg_number,int size, char ** msg_table)
+const char* _msg_txt(int32 msg_number,int32 size, char ** msg_table)
 {
 {
 	if (msg_number >= 0 && msg_number < size &&
 	if (msg_number >= 0 && msg_number < size &&
 		msg_table[msg_number] != nullptr && msg_table[msg_number][0] != '\0')
 		msg_table[msg_number] != nullptr && msg_table[msg_number][0] != '\0')
@@ -28,12 +28,12 @@ const char* _msg_txt(int msg_number,int size, char ** msg_table)
 /*
 /*
  * Read txt file and store them into msg_table
  * Read txt file and store them into msg_table
  */
  */
-int _msg_config_read(const char* cfgName,int size, char ** msg_table)
+int32 _msg_config_read(const char* cfgName,int32 size, char ** msg_table)
 {
 {
 	uint16 msg_number, msg_count = 0, line_num = 0;
 	uint16 msg_number, msg_count = 0, line_num = 0;
 	char line[1024], w1[8], w2[512];
 	char line[1024], w1[8], w2[512];
 	FILE *fp;
 	FILE *fp;
-	static int called = 1;
+	static int32 called = 1;
 
 
 	if ((fp = fopen(cfgName, "r")) == nullptr) {
 	if ((fp = fopen(cfgName, "r")) == nullptr) {
 		ShowError("Messages file not found: %s\n", cfgName);
 		ShowError("Messages file not found: %s\n", cfgName);
@@ -76,8 +76,8 @@ int _msg_config_read(const char* cfgName,int size, char ** msg_table)
 /*
 /*
  * Destroy msg_table (freeup mem)
  * Destroy msg_table (freeup mem)
  */
  */
-void _do_final_msg(int size, char ** msg_table){
-	int i;
+void _do_final_msg(int32 size, char ** msg_table){
+	int32 i;
 	for (i = 0; i < size; i++)
 	for (i = 0; i < size; i++)
 		aFree(msg_table[i]);
 		aFree(msg_table[i]);
 }
 }
@@ -86,8 +86,8 @@ void _do_final_msg(int size, char ** msg_table){
  * lookup a langtype string into his associate langtype number
  * lookup a langtype string into his associate langtype number
  * return -1 if not found
  * return -1 if not found
  */
  */
-int msg_langstr2langtype(char * langtype){
-	int lang=-1;
+int32 msg_langstr2langtype(char * langtype){
+	int32 lang=-1;
 	if (!strncmpi(langtype, "eng",2)) lang = 0;
 	if (!strncmpi(langtype, "eng",2)) lang = 0;
 	else if (!strncmpi(langtype, "rus",2)) lang = 1;
 	else if (!strncmpi(langtype, "rus",2)) lang = 1;
 	else if (!strncmpi(langtype, "spn",2)) lang = 2;
 	else if (!strncmpi(langtype, "spn",2)) lang = 2;
@@ -106,7 +106,7 @@ int msg_langstr2langtype(char * langtype){
  * lookup a langtype into his associate lang string
  * lookup a langtype into his associate lang string
  * return ?? if not found
  * return ?? if not found
  */
  */
-const char* msg_langtype2langstr(int langtype){
+const char* msg_langtype2langstr(int32 langtype){
 	switch(langtype){
 	switch(langtype){
 		case 0: return "English (ENG)";
 		case 0: return "English (ENG)";
 		case 1: return "Russkiy (RUS)"; //transliteration
 		case 1: return "Russkiy (RUS)"; //transliteration
@@ -129,7 +129,7 @@ const char* msg_langtype2langstr(int langtype){
  * -1 : false range
  * -1 : false range
  * -2 : disable
  * -2 : disable
  */
  */
-int msg_checklangtype(int lang, bool display){
+int32 msg_checklangtype(int32 lang, bool display){
 	uint16 test= (1<<(lang-1));
 	uint16 test= (1<<(lang-1));
 	if(!lang) return 1; //default english
 	if(!lang) return 1; //default english
 	else if(lang < 0 || test > LANG_MAX) return -1; //false range
 	else if(lang < 0 || test > LANG_MAX) return -1; //false range

+ 6 - 6
src/common/msg_conf.hpp

@@ -27,15 +27,15 @@ enum lang_types {
 #endif
 #endif
 
 
 //read msg in table
 //read msg in table
-const char* _msg_txt(int msg_number,int size, char ** msg_table);
+const char* _msg_txt(int32 msg_number,int32 size, char ** msg_table);
 //store msg from txtfile into msg_table
 //store msg from txtfile into msg_table
-int _msg_config_read(const char* cfgName,int size, char ** msg_table);
+int32 _msg_config_read(const char* cfgName,int32 size, char ** msg_table);
 //clear msg_table
 //clear msg_table
-void _do_final_msg(int size, char ** msg_table);
+void _do_final_msg(int32 size, char ** msg_table);
 //Lookups
 //Lookups
-int msg_langstr2langtype(char * langtype);
-const char* msg_langtype2langstr(int langtype);
+int32 msg_langstr2langtype(char * langtype);
+const char* msg_langtype2langstr(int32 langtype);
 // Verify that the choosen langtype is enabled.
 // Verify that the choosen langtype is enabled.
-int msg_checklangtype(int lang, bool display);
+int32 msg_checklangtype(int32 lang, bool display);
 
 
 #endif	/* MSG_CONF_HPP */
 #endif	/* MSG_CONF_HPP */

+ 8 - 8
src/common/nullpo.cpp

@@ -9,13 +9,13 @@
 
 
 #include "showmsg.hpp"
 #include "showmsg.hpp"
 
 
-static void nullpo_info_core(const char *file, int line, const char *func, const char *fmt, va_list ap);
-static void nullpo_info_core_(const char *file, int line, const char *func);
+static void nullpo_info_core(const char *file, int32 line, const char *func, const char *fmt, va_list ap);
+static void nullpo_info_core_(const char *file, int32 line, const char *func);
 
 
 /*======================================
 /*======================================
  * Null Information output and check
  * Null Information output and check
  *--------------------------------------*/
  *--------------------------------------*/
-int nullpo_chk_f(const char *file, int line, const char *func, const void *target,
+int32 nullpo_chk_f(const char *file, int32 line, const char *func, const void *target,
                  const char *fmt, ...)
                  const char *fmt, ...)
 {
 {
 	va_list ap;
 	va_list ap;
@@ -29,7 +29,7 @@ int nullpo_chk_f(const char *file, int line, const char *func, const void *targe
 	return 1;
 	return 1;
 }
 }
 
 
-int nullpo_chk(const char *file, int line, const char *func, const void *target)
+int32 nullpo_chk(const char *file, int32 line, const char *func, const void *target)
 {
 {
  	if (target != nullptr)
  	if (target != nullptr)
 		return 0;
 		return 0;
@@ -41,7 +41,7 @@ int nullpo_chk(const char *file, int line, const char *func, const void *target)
 /*======================================
 /*======================================
  * nullpo Information output (external call)
  * nullpo Information output (external call)
  *--------------------------------------*/
  *--------------------------------------*/
-void nullpo_info_f(const char *file, int line, const char *func, 
+void nullpo_info_f(const char *file, int32 line, const char *func, 
                  const char *fmt, ...)
                  const char *fmt, ...)
 {
 {
 	va_list ap;
 	va_list ap;
@@ -51,12 +51,12 @@ void nullpo_info_f(const char *file, int line, const char *func,
 	va_end(ap);
 	va_end(ap);
 }
 }
 
 
-void nullpo_info(const char *file, int line, const char *func)
+void nullpo_info(const char *file, int32 line, const char *func)
 {
 {
 	nullpo_info_core_(file, line, func);
 	nullpo_info_core_(file, line, func);
 }
 }
 
 
-static void nullpo_info_core_(const char *file, int line, const char *func){
+static void nullpo_info_core_(const char *file, int32 line, const char *func){
 	if (file == nullptr)
 	if (file == nullptr)
 		file = "??";
 		file = "??";
 	
 	
@@ -72,7 +72,7 @@ static void nullpo_info_core_(const char *file, int line, const char *func){
 /*======================================
 /*======================================
  * nullpo intelligence Output (Main)
  * nullpo intelligence Output (Main)
  *--------------------------------------*/
  *--------------------------------------*/
-static void nullpo_info_core(const char *file, int line, const char *func, 
+static void nullpo_info_core(const char *file, int32 line, const char *func, 
                              const char *fmt, va_list ap)
                              const char *fmt, va_list ap)
 {
 {
 	nullpo_info_core_(file,line,func);
 	nullpo_info_core_(file,line,func);

+ 4 - 4
src/common/nullpo.hpp

@@ -171,7 +171,7 @@
  * @param target: Target to check
  * @param target: Target to check
  * @return 0 on success or 1 on nullptr
  * @return 0 on success or 1 on nullptr
  */
  */
-int nullpo_chk(const char *file, int line, const char *func, const void *target);
+int32 nullpo_chk(const char *file, int32 line, const char *func, const void *target);
 
 
 /**
 /**
  * Check for nullptr pointer and output detailed information.
  * Check for nullptr pointer and output detailed information.
@@ -182,7 +182,7 @@ int nullpo_chk(const char *file, int line, const char *func, const void *target)
  * @param fmt: Passed to vprintf
  * @param fmt: Passed to vprintf
  * @return 0 on success or 1 on nullptr
  * @return 0 on success or 1 on nullptr
  */
  */
-int nullpo_chk_f(const char *file, int line, const char *func, const void *target,
+int32 nullpo_chk_f(const char *file, int32 line, const char *func, const void *target,
                  const char *fmt, ...)
                  const char *fmt, ...)
                  __attribute__((format(printf,5,6)));
                  __attribute__((format(printf,5,6)));
 
 
@@ -193,7 +193,7 @@ int nullpo_chk_f(const char *file, int line, const char *func, const void *targe
  * @param func: __func__ (name of the function) [NLP_MARK]
  * @param func: __func__ (name of the function) [NLP_MARK]
  * @param target: Target to check
  * @param target: Target to check
  */
  */
-void nullpo_info(const char *file, int line, const char *func);
+void nullpo_info(const char *file, int32 line, const char *func);
 
 
 /**
 /**
  * Check for nullptr pointer and output detailed information.
  * Check for nullptr pointer and output detailed information.
@@ -203,7 +203,7 @@ void nullpo_info(const char *file, int line, const char *func);
  * @param target: Target to check
  * @param target: Target to check
  * @param fmt: Passed to vprintf
  * @param fmt: Passed to vprintf
  */
  */
-void nullpo_info_f(const char *file, int line, const char *func, 
+void nullpo_info_f(const char *file, int32 line, const char *func, 
                    const char *fmt, ...)
                    const char *fmt, ...)
                    __attribute__((format(printf,4,5)));
                    __attribute__((format(printf,4,5)));
 
 

+ 3 - 3
src/common/packets.hpp

@@ -224,13 +224,13 @@ private:
 	struct s_packet_info{
 	struct s_packet_info{
 		bool fixed;
 		bool fixed;
 		int16 size;
 		int16 size;
-		std::function<bool ( int fd, sessiontype& sd )> func;
+		std::function<bool ( int32 fd, sessiontype& sd )> func;
 	};
 	};
 
 
 	std::unordered_map<int16, s_packet_info> infos;
 	std::unordered_map<int16, s_packet_info> infos;
 
 
 public:
 public:
-	void add( int16 packetType, bool fixed, int16 size, std::function<bool ( int fd, sessiontype& sd )> func ){
+	void add( int16 packetType, bool fixed, int16 size, std::function<bool ( int32 fd, sessiontype& sd )> func ){
 		if( fixed ){
 		if( fixed ){
 			if( size < 2 ){
 			if( size < 2 ){
 				ShowError( "Definition for packet 0x%04x is invalid. Minimum size for a fixed length packet is 2 bytes.\n", packetType );
 				ShowError( "Definition for packet 0x%04x is invalid. Minimum size for a fixed length packet is 2 bytes.\n", packetType );
@@ -250,7 +250,7 @@ public:
 		info.func = func;
 		info.func = func;
 	}
 	}
 
 
-	bool handle( int fd, sessiontype& sd ){
+	bool handle( int32 fd, sessiontype& sd ){
 		int16 remaining =  static_cast<int16>( RFIFOREST( fd ) );
 		int16 remaining =  static_cast<int16>( RFIFOREST( fd ) );
 
 
 		if( remaining < 2 ){
 		if( remaining < 2 ){

+ 16 - 16
src/common/showmsg.cpp

@@ -45,10 +45,10 @@
 /// when redirecting output:
 /// when redirecting output:
 /// if true prints escape sequences
 /// if true prints escape sequences
 /// if false removes the escape sequences
 /// if false removes the escape sequences
-int stdout_with_ansisequence = 0;
+int32 stdout_with_ansisequence = 0;
 
 
-int msg_silent = 0; //Specifies how silent the console is.
-int console_msg_log = 0;//[Ind] msg error logging
+int32 msg_silent = 0; //Specifies how silent the console is.
+int32 console_msg_log = 0;//[Ind] msg error logging
 char console_log_filepath[32] = "./log/unknown.log";
 char console_log_filepath[32] = "./log/unknown.log";
 
 
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
@@ -190,7 +190,7 @@ Escape sequences for Select Character Set
 #define is_console(handle) (FILE_TYPE_CHAR==GetFileType(handle))
 #define is_console(handle) (FILE_TYPE_CHAR==GetFileType(handle))
 
 
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
-int	VFPRINTF(HANDLE handle, const char *fmt, va_list argptr)
+int32	VFPRINTF(HANDLE handle, const char *fmt, va_list argptr)
 {
 {
 	/////////////////////////////////////////////////////////////////
 	/////////////////////////////////////////////////////////////////
 	/* XXX Two streams are being used. Disabled to avoid inconsistency [flaviojs]
 	/* XXX Two streams are being used. Disabled to avoid inconsistency [flaviojs]
@@ -205,7 +205,7 @@ int	VFPRINTF(HANDLE handle, const char *fmt, va_list argptr)
 	if(!fmt || !*fmt)
 	if(!fmt || !*fmt)
 		return 0;
 		return 0;
 
 
-	// Print everything to the buffer
+	// Print32 everything to the buffer
 	BUFVPRINTF(tempbuf,fmt,argptr);
 	BUFVPRINTF(tempbuf,fmt,argptr);
 
 
 	if( !is_console(handle) && stdout_with_ansisequence )
 	if( !is_console(handle) && stdout_with_ansisequence )
@@ -349,7 +349,7 @@ int	VFPRINTF(HANDLE handle, const char *fmt, va_list argptr)
 					//    \033[1J - Clears the screen from start to cursor. The cursor position is unchanged.
 					//    \033[1J - Clears the screen from start to cursor. The cursor position is unchanged.
 					//    \033[2J - Clears the screen and moves the cursor to the home position (line 1, column 1).
 					//    \033[2J - Clears the screen and moves the cursor to the home position (line 1, column 1).
 					uint8 num = (numbers[numpoint]>>4)*10+(numbers[numpoint]&0x0F);
 					uint8 num = (numbers[numpoint]>>4)*10+(numbers[numpoint]&0x0F);
-					int cnt;
+					int32 cnt;
 					DWORD tmp;
 					DWORD tmp;
 					COORD origin = {0,0};
 					COORD origin = {0,0};
 					if(num==1)
 					if(num==1)
@@ -507,9 +507,9 @@ int	VFPRINTF(HANDLE handle, const char *fmt, va_list argptr)
 	return 0;
 	return 0;
 }
 }
 
 
-int	FPRINTF(HANDLE handle, const char *fmt, ...)
+int32	FPRINTF(HANDLE handle, const char *fmt, ...)
 {
 {
-	int ret;
+	int32 ret;
 	va_list argptr;
 	va_list argptr;
 	va_start(argptr, fmt);
 	va_start(argptr, fmt);
 	ret = VFPRINTF(handle,fmt,argptr);
 	ret = VFPRINTF(handle,fmt,argptr);
@@ -528,7 +528,7 @@ int	FPRINTF(HANDLE handle, const char *fmt, ...)
 #define is_console(file) (0!=isatty(fileno(file)))
 #define is_console(file) (0!=isatty(fileno(file)))
 
 
 //vprintf_without_ansiformats
 //vprintf_without_ansiformats
-int	VFPRINTF(FILE *file, const char *fmt, va_list argptr)
+int32	VFPRINTF(FILE *file, const char *fmt, va_list argptr)
 {
 {
 	char *p, *q;
 	char *p, *q;
 	NEWBUF(tempbuf); // temporary buffer
 	NEWBUF(tempbuf); // temporary buffer
@@ -542,7 +542,7 @@ int	VFPRINTF(FILE *file, const char *fmt, va_list argptr)
 		return 0;
 		return 0;
 	}
 	}
 
 
-	// Print everything to the buffer
+	// Print32 everything to the buffer
 	BUFVPRINTF(tempbuf,fmt,argptr);
 	BUFVPRINTF(tempbuf,fmt,argptr);
 
 
 	// start with processing
 	// start with processing
@@ -643,9 +643,9 @@ int	VFPRINTF(FILE *file, const char *fmt, va_list argptr)
 	FREEBUF(tempbuf);
 	FREEBUF(tempbuf);
 	return 0;
 	return 0;
 }
 }
-int	FPRINTF(FILE *file, const char *fmt, ...)
+int32	FPRINTF(FILE *file, const char *fmt, ...)
 {
 {
-	int ret;
+	int32 ret;
 	va_list argptr;
 	va_list argptr;
 	va_start(argptr, fmt);
 	va_start(argptr, fmt);
 	ret = VFPRINTF(file,fmt,argptr);
 	ret = VFPRINTF(file,fmt,argptr);
@@ -662,7 +662,7 @@ int	FPRINTF(FILE *file, const char *fmt, ...)
 
 
 char timestamp_format[20] = ""; //For displaying Timestamps
 char timestamp_format[20] = ""; //For displaying Timestamps
 
 
-int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
+int32 _vShowMessage(enum msg_type flag, const char *string, va_list ap)
 {
 {
 	va_list apcopy;
 	va_list apcopy;
 	char prefix[100];
 	char prefix[100];
@@ -716,7 +716,7 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
 	    (flag == MSG_SQL && msg_silent&16) ||
 	    (flag == MSG_SQL && msg_silent&16) ||
 	    (flag == MSG_DEBUG && msg_silent&32)
 	    (flag == MSG_DEBUG && msg_silent&32)
 	)
 	)
-		return 0; //Do not print it.
+		return 0; //Do not print32 it.
 
 
 	if (timestamp_format[0] && flag != MSG_NONE)
 	if (timestamp_format[0] && flag != MSG_NONE)
 	{	//Display time format. [Skotlex]
 	{	//Display time format. [Skotlex]
@@ -800,9 +800,9 @@ void ClearScreen(void)
 	ShowMessage(CL_CLS);	// to prevent empty string passed messages
 	ShowMessage(CL_CLS);	// to prevent empty string passed messages
 #endif
 #endif
 }
 }
-int _ShowMessage(enum msg_type flag, const char *string, ...)
+int32 _ShowMessage(enum msg_type flag, const char *string, ...)
 {
 {
-	int ret;
+	int32 ret;
 	va_list ap;
 	va_list ap;
 	va_start(ap, string);
 	va_start(ap, string);
 	ret = _vShowMessage(flag, string, ap);
 	ret = _vShowMessage(flag, string, ap);

+ 7 - 5
src/common/showmsg.hpp

@@ -6,6 +6,8 @@
 
 
 #include <libconfig.h>
 #include <libconfig.h>
 
 
+#include <common/cbasetypes.hpp>
+
 // for help with the console colors look here:
 // for help with the console colors look here:
 // http://www.edoceo.com/liberum/?doc=printf-with-color
 // http://www.edoceo.com/liberum/?doc=printf-with-color
 // some code explanation (used here):
 // some code explanation (used here):
@@ -65,11 +67,11 @@
 #define CL_XXBL			"\033[0;44m"	// default on blue
 #define CL_XXBL			"\033[0;44m"	// default on blue
 #define CL_PASS			"\033[0;32;42m"	// green on green
 #define CL_PASS			"\033[0;32;42m"	// green on green
 
 
-#define CL_SPACE		"           "	// space aquivalent of the print messages
+#define CL_SPACE		"           "	// space aquivalent of the print32 messages
 
 
-extern int stdout_with_ansisequence; //If the color ansi sequences are to be used. [flaviojs]
-extern int msg_silent; //Specifies how silent the console is. [Skotlex]
-extern int console_msg_log; //Specifies what error messages to log. [Ind]
+extern int32 stdout_with_ansisequence; //If the color ansi sequences are to be used. [flaviojs]
+extern int32 msg_silent; //Specifies how silent the console is. [Skotlex]
+extern int32 console_msg_log; //Specifies what error messages to log. [Ind]
 extern char console_log_filepath[32]; ///< Filepath to save console_msg_log. [Cydh]
 extern char console_log_filepath[32]; ///< Filepath to save console_msg_log. [Cydh]
 extern char timestamp_format[20]; //For displaying Timestamps [Skotlex]
 extern char timestamp_format[20]; //For displaying Timestamps [Skotlex]
 
 
@@ -86,7 +88,7 @@ enum msg_type {
 };
 };
 
 
 extern void ClearScreen(void);
 extern void ClearScreen(void);
-extern int _vShowMessage(enum msg_type flag, const char *string, va_list ap);
+extern int32 _vShowMessage(enum msg_type flag, const char *string, va_list ap);
 extern void ShowMessage(const char *, ...);
 extern void ShowMessage(const char *, ...);
 extern void ShowStatus(const char *, ...);
 extern void ShowStatus(const char *, ...);
 extern void ShowSQL(const char *, ...);
 extern void ShowSQL(const char *, ...);

+ 90 - 90
src/common/socket.cpp

@@ -56,7 +56,7 @@ int8 packet_buffer[UINT16_MAX];
 /////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////
 // windows portability layer
 // windows portability layer
 
 
-typedef int socklen_t;
+typedef int32 socklen_t;
 
 
 #define sErrno WSAGetLastError()
 #define sErrno WSAGetLastError()
 #define S_ENOTSOCK WSAENOTSOCK
 #define S_ENOTSOCK WSAENOTSOCK
@@ -71,7 +71,7 @@ typedef int socklen_t;
 // global array of sockets (emulating linux)
 // global array of sockets (emulating linux)
 // fd is the position in the array
 // fd is the position in the array
 static SOCKET sock_arr[MAXCONN];
 static SOCKET sock_arr[MAXCONN];
-static int sock_arr_len = 0;
+static int32 sock_arr_len = 0;
 
 
 /// Returns the socket associated with the target fd.
 /// Returns the socket associated with the target fd.
 ///
 ///
@@ -84,9 +84,9 @@ static int sock_arr_len = 0;
 ///
 ///
 /// @param s Socket
 /// @param s Socket
 /// @return Fd or -1
 /// @return Fd or -1
-int sock2fd(SOCKET s)
+int32 sock2fd(SOCKET s)
 {
 {
-	int fd;
+	int32 fd;
 
 
 	// search for the socket
 	// search for the socket
 	for( fd = 1; fd < sock_arr_len; ++fd )
 	for( fd = 1; fd < sock_arr_len; ++fd )
@@ -106,9 +106,9 @@ int sock2fd(SOCKET s)
 ///
 ///
 /// @param s Socket
 /// @param s Socket
 /// @return New fd or -1
 /// @return New fd or -1
-int sock2newfd(SOCKET s)
+int32 sock2newfd(SOCKET s)
 {
 {
-	int fd;
+	int32 fd;
 
 
 	// find an empty position
 	// find an empty position
 	for( fd = 1; fd < sock_arr_len; ++fd )
 	for( fd = 1; fd < sock_arr_len; ++fd )
@@ -126,7 +126,7 @@ int sock2newfd(SOCKET s)
 	return fd;
 	return fd;
 }
 }
 
 
-int sAccept(int fd, struct sockaddr* addr, int* addrlen)
+int32 sAccept(int32 fd, struct sockaddr* addr, int* addrlen)
 {
 {
 	SOCKET s;
 	SOCKET s;
 
 
@@ -137,14 +137,14 @@ int sAccept(int fd, struct sockaddr* addr, int* addrlen)
 	return sock2newfd(s);
 	return sock2newfd(s);
 }
 }
 
 
-int sClose(int fd)
+int32 sClose(int32 fd)
 {
 {
-	int ret = closesocket(fd2sock(fd));
+	int32 ret = closesocket(fd2sock(fd));
 	fd2sock(fd) = INVALID_SOCKET;
 	fd2sock(fd) = INVALID_SOCKET;
 	return ret;
 	return ret;
 }
 }
 
 
-int sSocket(int af, int type, int protocol)
+int32 sSocket(int32 af, int32 type, int32 protocol)
 {
 {
 	SOCKET s;
 	SOCKET s;
 
 
@@ -155,7 +155,7 @@ int sSocket(int af, int type, int protocol)
 	return sock2newfd(s);
 	return sock2newfd(s);
 }
 }
 
 
-char* sErr(int code)
+char* sErr(int32 code)
 {
 {
 	static char sbuf[512];
 	static char sbuf[512];
 	// strerror does not handle socket codes
 	// strerror does not handle socket codes
@@ -224,18 +224,18 @@ char* sErr(int code)
 	fd_set readfds;
 	fd_set readfds;
 #else
 #else
 	// Epoll based Event Dispatcher
 	// Epoll based Event Dispatcher
-	static int epoll_maxevents = (MAXCONN / 2);
-	static int epfd = SOCKET_ERROR;
+	static int32 epoll_maxevents = (MAXCONN / 2);
+	static int32 epfd = SOCKET_ERROR;
 	static struct epoll_event epevent;
 	static struct epoll_event epevent;
 	static struct epoll_event *epevents = nullptr;
 	static struct epoll_event *epevents = nullptr;
 #endif
 #endif
 
 
-int fd_max;
+int32 fd_max;
 time_t last_tick;
 time_t last_tick;
 time_t stall_time = 60;
 time_t stall_time = 60;
 
 
 uint32 addr_[16];   // ip addresses of local host (host byte order)
 uint32 addr_[16];   // ip addresses of local host (host byte order)
-int naddr_ = 0;   // # of ip addresses
+int32 naddr_ = 0;   // # of ip addresses
 
 
 // Maximum packet size in bytes, which the client is able to handle.
 // Maximum packet size in bytes, which the client is able to handle.
 // Larger packets cause a buffer overflow and stack corruption.
 // Larger packets cause a buffer overflow and stack corruption.
@@ -265,22 +265,22 @@ static time_t socket_data_last_tick = 0;
 struct socket_data* session[MAXCONN];
 struct socket_data* session[MAXCONN];
 
 
 #ifdef SEND_SHORTLIST
 #ifdef SEND_SHORTLIST
-int send_shortlist_array[MAXCONN];// we only support MAXCONN sockets, limit the array to that
+int32 send_shortlist_array[MAXCONN];// we only support MAXCONN sockets, limit the array to that
 size_t send_shortlist_count = 0;// how many fd's are in the shortlist
 size_t send_shortlist_count = 0;// how many fd's are in the shortlist
 uint32 send_shortlist_set[(MAXCONN+31)/32];// to know if specific fd's are already in the shortlist
 uint32 send_shortlist_set[(MAXCONN+31)/32];// to know if specific fd's are already in the shortlist
 #endif
 #endif
 
 
-static int create_session(int fd, RecvFunc func_recv, SendFunc func_send, ParseFunc func_parse);
+static int32 create_session(int32 fd, RecvFunc func_recv, SendFunc func_send, ParseFunc func_parse);
 
 
 #ifndef MINICORE
 #ifndef MINICORE
-	int ip_rules = 1;
-	static int connect_check(uint32 ip);
+	int32 ip_rules = 1;
+	static int32 connect_check(uint32 ip);
 #endif
 #endif
 
 
 const char* error_msg(void)
 const char* error_msg(void)
 {
 {
 	static char buf[512];
 	static char buf[512];
-	int code = sErrno;
+	int32 code = sErrno;
 	snprintf(buf, sizeof(buf), "error %d: %s", code, sErr(code));
 	snprintf(buf, sizeof(buf), "error %d: %s", code, sErr(code));
 	return buf;
 	return buf;
 }
 }
@@ -288,9 +288,9 @@ const char* error_msg(void)
 /*======================================
 /*======================================
  *	CORE : Default processing functions
  *	CORE : Default processing functions
  *--------------------------------------*/
  *--------------------------------------*/
-int null_recv(int fd) { return 0; }
-int null_send(int fd) { return 0; }
-int null_parse(int fd) { return 0; }
+int32 null_recv(int32 fd) { return 0; }
+int32 null_send(int32 fd) { return 0; }
+int32 null_parse(int32 fd) { return 0; }
 
 
 ParseFunc default_func_parse = null_parse;
 ParseFunc default_func_parse = null_parse;
 
 
@@ -303,7 +303,7 @@ void set_defaultparse(ParseFunc defaultparse)
 /*======================================
 /*======================================
  *	CORE : Socket options
  *	CORE : Socket options
  *--------------------------------------*/
  *--------------------------------------*/
-void set_nonblocking(int fd, unsigned long yes)
+void set_nonblocking(int32 fd, unsigned long yes)
 {
 {
 	// FIONBIO Use with a nonzero argp parameter to enable the nonblocking mode of socket s.
 	// FIONBIO Use with a nonzero argp parameter to enable the nonblocking mode of socket s.
 	// The argp parameter is zero if nonblocking is to be disabled.
 	// The argp parameter is zero if nonblocking is to be disabled.
@@ -311,8 +311,8 @@ void set_nonblocking(int fd, unsigned long yes)
 		ShowError("set_nonblocking: Failed to set socket #%d to non-blocking mode (%s) - Please report this!!!\n", fd, error_msg());
 		ShowError("set_nonblocking: Failed to set socket #%d to non-blocking mode (%s) - Please report this!!!\n", fd, error_msg());
 }
 }
 
 
-void setsocketopts(int fd,int delay_timeout){
-	int yes = 1; // reuse fix
+void setsocketopts(int32 fd,int32 delay_timeout){
+	int32 yes = 1; // reuse fix
 
 
 #if !defined(WIN32)
 #if !defined(WIN32)
 	// set SO_REAUSEADDR to true, unix only. on windows this option causes
 	// set SO_REAUSEADDR to true, unix only. on windows this option causes
@@ -339,7 +339,7 @@ void setsocketopts(int fd,int delay_timeout){
 	}
 	}
 	if(delay_timeout){
 	if(delay_timeout){
 #if defined(WIN32)
 #if defined(WIN32)
-		int timeout = delay_timeout * 1000;
+		int32 timeout = delay_timeout * 1000;
 #else
 #else
 		struct timeval timeout;
 		struct timeval timeout;
 		timeout.tv_sec = delay_timeout;
 		timeout.tv_sec = delay_timeout;
@@ -356,7 +356,7 @@ void setsocketopts(int fd,int delay_timeout){
 /*======================================
 /*======================================
  *	CORE : Socket Sub Function
  *	CORE : Socket Sub Function
  *--------------------------------------*/
  *--------------------------------------*/
-void set_eof(int fd)
+void set_eof(int32 fd)
 {
 {
 	if( session_isActive(fd) )
 	if( session_isActive(fd) )
 	{
 	{
@@ -368,9 +368,9 @@ void set_eof(int fd)
 	}
 	}
 }
 }
 
 
-int recv_to_fifo(int fd)
+int32 recv_to_fifo(int32 fd)
 {
 {
-	int len;
+	int32 len;
 
 
 	if( !session_isActive(fd) )
 	if( !session_isActive(fd) )
 		return -1;
 		return -1;
@@ -405,9 +405,9 @@ int recv_to_fifo(int fd)
 	return 0;
 	return 0;
 }
 }
 
 
-int send_from_fifo(int fd)
+int32 send_from_fifo(int32 fd)
 {
 {
-	int len;
+	int32 len;
 
 
 	if( !session_isValid(fd) )
 	if( !session_isValid(fd) )
 		return -1;
 		return -1;
@@ -454,7 +454,7 @@ int send_from_fifo(int fd)
 }
 }
 
 
 /// Best effort - there's no warranty that the data will be sent.
 /// Best effort - there's no warranty that the data will be sent.
-void flush_fifo(int fd)
+void flush_fifo(int32 fd)
 {
 {
 	if(session[fd] != nullptr)
 	if(session[fd] != nullptr)
 		session[fd]->func_send(fd);
 		session[fd]->func_send(fd);
@@ -462,7 +462,7 @@ void flush_fifo(int fd)
 
 
 void flush_fifos(void)
 void flush_fifos(void)
 {
 {
-	int i;
+	int32 i;
 	for(i = 1; i < fd_max; i++)
 	for(i = 1; i < fd_max; i++)
 		flush_fifo(i);
 		flush_fifo(i);
 }
 }
@@ -470,9 +470,9 @@ void flush_fifos(void)
 /*======================================
 /*======================================
  *	CORE : Connection functions
  *	CORE : Connection functions
  *--------------------------------------*/
  *--------------------------------------*/
-int connect_client(int listen_fd)
+int32 connect_client(int32 listen_fd)
 {
 {
-	int fd;
+	int32 fd;
 	struct sockaddr_in client_address;
 	struct sockaddr_in client_address;
 	socklen_t len;
 	socklen_t len;
 
 
@@ -529,11 +529,11 @@ int connect_client(int listen_fd)
 	return fd;
 	return fd;
 }
 }
 
 
-int make_listen_bind(uint32 ip, uint16 port)
+int32 make_listen_bind(uint32 ip, uint16 port)
 {
 {
 	struct sockaddr_in server_address;
 	struct sockaddr_in server_address;
-	int fd;
-	int result;
+	int32 fd;
+	int32 result;
 
 
 	fd = sSocket(AF_INET, SOCK_STREAM, 0);
 	fd = sSocket(AF_INET, SOCK_STREAM, 0);
 
 
@@ -598,10 +598,10 @@ int make_listen_bind(uint32 ip, uint16 port)
 	return fd;
 	return fd;
 }
 }
 
 
-int make_connection(uint32 ip, uint16 port, bool silent,int timeout) {
+int32 make_connection(uint32 ip, uint16 port, bool silent,int32 timeout) {
 	struct sockaddr_in remote_address;
 	struct sockaddr_in remote_address;
-	int fd;
-	int result;
+	int32 fd;
+	int32 result;
 
 
 	fd = sSocket(AF_INET, SOCK_STREAM, 0);
 	fd = sSocket(AF_INET, SOCK_STREAM, 0);
 
 
@@ -723,7 +723,7 @@ int make_connection(uint32 ip, uint16 port, bool silent,int timeout) {
 	return fd;
 	return fd;
 }
 }
 
 
-static int create_session(int fd, RecvFunc func_recv, SendFunc func_send, ParseFunc func_parse)
+static int32 create_session(int32 fd, RecvFunc func_recv, SendFunc func_send, ParseFunc func_parse)
 {
 {
 	CREATE(session[fd], struct socket_data, 1);
 	CREATE(session[fd], struct socket_data, 1);
 	CREATE(session[fd]->rdata, unsigned char, RFIFO_SIZE);
 	CREATE(session[fd]->rdata, unsigned char, RFIFO_SIZE);
@@ -738,7 +738,7 @@ static int create_session(int fd, RecvFunc func_recv, SendFunc func_send, ParseF
 	return 0;
 	return 0;
 }
 }
 
 
-static void delete_session(int fd)
+static void delete_session(int32 fd)
 {
 {
 	if( session_isValid(fd) )
 	if( session_isValid(fd) )
 	{
 	{
@@ -754,7 +754,7 @@ static void delete_session(int fd)
 	}
 	}
 }
 }
 
 
-int _realloc_fifo( int fd, uint32 rfifo_size, uint32 wfifo_size, const char* file, int line, const char* func ){
+int32 _realloc_fifo( int32 fd, uint32 rfifo_size, uint32 wfifo_size, const char* file, int32 line, const char* func ){
 	if( !session_isValid(fd) )
 	if( !session_isValid(fd) )
 		return 0;
 		return 0;
 
 
@@ -770,7 +770,7 @@ int _realloc_fifo( int fd, uint32 rfifo_size, uint32 wfifo_size, const char* fil
 	return 0;
 	return 0;
 }
 }
 
 
-int _realloc_writefifo( int fd, size_t addition, const char* file, int line, const char* func ){
+int32 _realloc_writefifo( int32 fd, size_t addition, const char* file, int32 line, const char* func ){
 	size_t newsize;
 	size_t newsize;
 
 
 	if( !session_isValid(fd) ) // might not happen
 	if( !session_isValid(fd) ) // might not happen
@@ -797,7 +797,7 @@ int _realloc_writefifo( int fd, size_t addition, const char* file, int line, con
 }
 }
 
 
 /// advance the RFIFO cursor (marking 'len' bytes as processed)
 /// advance the RFIFO cursor (marking 'len' bytes as processed)
-int RFIFOSKIP(int fd, size_t len)
+int32 RFIFOSKIP(int32 fd, size_t len)
 {
 {
     struct socket_data *s;
     struct socket_data *s;
 
 
@@ -819,7 +819,7 @@ int RFIFOSKIP(int fd, size_t len)
 }
 }
 
 
 /// advance the WFIFO cursor (marking 'len' bytes for sending)
 /// advance the WFIFO cursor (marking 'len' bytes for sending)
-int WFIFOSET(int fd, size_t len)
+int32 WFIFOSET(int32 fd, size_t len)
 {
 {
 	size_t newreserve;
 	size_t newreserve;
 	struct socket_data* s = session[fd];
 	struct socket_data* s = session[fd];
@@ -889,13 +889,13 @@ int WFIFOSET(int fd, size_t len)
 	return 0;
 	return 0;
 }
 }
 
 
-int do_sockets(t_tick next)
+int32 do_sockets(t_tick next)
 {
 {
 #ifndef SOCKET_EPOLL
 #ifndef SOCKET_EPOLL
 	fd_set rfd;
 	fd_set rfd;
 	struct timeval timeout;
 	struct timeval timeout;
 #endif
 #endif
-	int ret,i;
+	int32 ret,i;
 
 
 	// PRESEND Timers are executed before do_sendrecv and can send packets and/or set sessions to eof.
 	// PRESEND Timers are executed before do_sendrecv and can send packets and/or set sessions to eof.
 	// Send remaining data and process client-side disconnects here.
 	// Send remaining data and process client-side disconnects here.
@@ -952,7 +952,7 @@ int do_sockets(t_tick next)
 	// on windows, enumerating all members of the fd_set is way faster if we access the internals
 	// on windows, enumerating all members of the fd_set is way faster if we access the internals
 	for( i = 0; i < (int)rfd.fd_count; ++i )
 	for( i = 0; i < (int)rfd.fd_count; ++i )
 	{
 	{
-		int fd = sock2fd(rfd.fd_array[i]);
+		int32 fd = sock2fd(rfd.fd_array[i]);
 		if( session[fd] )
 		if( session[fd] )
 			session[fd]->func_recv(fd);
 			session[fd]->func_recv(fd);
 	}
 	}
@@ -961,7 +961,7 @@ int do_sockets(t_tick next)
 
 
 	for( i = 0; i < ret; i++ ){
 	for( i = 0; i < ret; i++ ){
 		struct epoll_event *it = &epevents[i];
 		struct epoll_event *it = &epevents[i];
-		int fd = it->data.fd;
+		int32 fd = it->data.fd;
 		struct socket_data *sock = session[fd];
 		struct socket_data *sock = session[fd];
 
 
 		if( !sock ){
 		if( !sock ){
@@ -1065,7 +1065,7 @@ typedef struct _connect_history {
 	struct _connect_history* next;
 	struct _connect_history* next;
 	uint32 ip;
 	uint32 ip;
 	t_tick tick;
 	t_tick tick;
-	int count;
+	int32 count;
 	unsigned ddos : 1;
 	unsigned ddos : 1;
 } ConnectHistory;
 } ConnectHistory;
 
 
@@ -1082,24 +1082,24 @@ enum _aco {
 
 
 static AccessControl* access_allow = nullptr;
 static AccessControl* access_allow = nullptr;
 static AccessControl* access_deny = nullptr;
 static AccessControl* access_deny = nullptr;
-static int access_order    = ACO_DENY_ALLOW;
-static int access_allownum = 0;
-static int access_denynum  = 0;
-static int access_debug    = 0;
-static int ddos_count      = 10;
-static int ddos_interval   = 3*1000;
-static int ddos_autoreset  = 10*60*1000;
+static int32 access_order    = ACO_DENY_ALLOW;
+static int32 access_allownum = 0;
+static int32 access_denynum  = 0;
+static int32 access_debug    = 0;
+static int32 ddos_count      = 10;
+static int32 ddos_interval   = 3*1000;
+static int32 ddos_autoreset  = 10*60*1000;
 /// Connection history, an array of linked lists.
 /// Connection history, an array of linked lists.
 /// The array's index for any ip is ip&0xFFFF
 /// The array's index for any ip is ip&0xFFFF
 static ConnectHistory* connect_history[0x10000];
 static ConnectHistory* connect_history[0x10000];
 
 
-static int connect_check_(uint32 ip);
+static int32 connect_check_(uint32 ip);
 
 
 /// Verifies if the IP can connect. (with debug info)
 /// Verifies if the IP can connect. (with debug info)
 /// @see connect_check_()
 /// @see connect_check_()
-static int connect_check(uint32 ip)
+static int32 connect_check(uint32 ip)
 {
 {
-	int result = connect_check_(ip);
+	int32 result = connect_check_(ip);
 	if( access_debug ) {
 	if( access_debug ) {
 		ShowInfo("connect_check: Connection from %d.%d.%d.%d %s\n", CONVIP(ip),result ? "allowed." : "denied!");
 		ShowInfo("connect_check: Connection from %d.%d.%d.%d %s\n", CONVIP(ip),result ? "allowed." : "denied!");
 	}
 	}
@@ -1109,13 +1109,13 @@ static int connect_check(uint32 ip)
 /// Verifies if the IP can connect.
 /// Verifies if the IP can connect.
 ///  0      : Connection Rejected
 ///  0      : Connection Rejected
 ///  1 or 2 : Connection Accepted
 ///  1 or 2 : Connection Accepted
-static int connect_check_(uint32 ip)
+static int32 connect_check_(uint32 ip)
 {
 {
 	ConnectHistory* hist = connect_history[ip&0xFFFF];
 	ConnectHistory* hist = connect_history[ip&0xFFFF];
-	int i;
-	int is_allowip = 0;
-	int is_denyip = 0;
-	int connect_ok = 0;
+	int32 i;
+	int32 is_allowip = 0;
+	int32 is_denyip = 0;
+	int32 connect_ok = 0;
 
 
 	// Search the allow list
 	// Search the allow list
 	for( i=0; i < access_allownum; ++i ){
 	for( i=0; i < access_allownum; ++i ){
@@ -1212,9 +1212,9 @@ static int connect_check_(uint32 ip)
 /// Timer function.
 /// Timer function.
 /// Deletes old connection history records.
 /// Deletes old connection history records.
 static TIMER_FUNC(connect_check_clear){
 static TIMER_FUNC(connect_check_clear){
-	int i;
-	int clear = 0;
-	int list  = 0;
+	int32 i;
+	int32 clear = 0;
+	int32 list  = 0;
 	ConnectHistory root;
 	ConnectHistory root;
 	ConnectHistory* prev_hist;
 	ConnectHistory* prev_hist;
 	ConnectHistory* hist;
 	ConnectHistory* hist;
@@ -1246,7 +1246,7 @@ static TIMER_FUNC(connect_check_clear){
 
 
 /// Parses the ip address and mask and puts it into acc.
 /// Parses the ip address and mask and puts it into acc.
 /// Returns 1 is successful, 0 otherwise.
 /// Returns 1 is successful, 0 otherwise.
-int access_ipmask(const char* str, AccessControl* acc)
+int32 access_ipmask(const char* str, AccessControl* acc)
 {
 {
 	uint32 ip;
 	uint32 ip;
 	uint32 mask;
 	uint32 mask;
@@ -1257,7 +1257,7 @@ int access_ipmask(const char* str, AccessControl* acc)
 	} else {
 	} else {
 		uint32 a[4];
 		uint32 a[4];
 		uint32 m[4];
 		uint32 m[4];
-		int n;
+		int32 n;
 		if( ((n=sscanf(str,"%3u.%3u.%3u.%3u/%3u.%3u.%3u.%3u",a,a+1,a+2,a+3,m,m+1,m+2,m+3)) != 8 && // not an ip + standard mask
 		if( ((n=sscanf(str,"%3u.%3u.%3u.%3u/%3u.%3u.%3u.%3u",a,a+1,a+2,a+3,m,m+1,m+2,m+3)) != 8 && // not an ip + standard mask
 				(n=sscanf(str,"%3u.%3u.%3u.%3u/%3u",a,a+1,a+2,a+3,m)) != 5 && // not an ip + bit mask
 				(n=sscanf(str,"%3u.%3u.%3u.%3u/%3u",a,a+1,a+2,a+3,m)) != 5 && // not an ip + bit mask
 				(n=sscanf(str,"%3u.%3u.%3u.%3u",a,a+1,a+2,a+3)) != 4 ) || // not an ip
 				(n=sscanf(str,"%3u.%3u.%3u.%3u",a,a+1,a+2,a+3)) != 4 ) || // not an ip
@@ -1293,7 +1293,7 @@ int access_ipmask(const char* str, AccessControl* acc)
 #endif
 #endif
 //////////////////////////////
 //////////////////////////////
 
 
-int socket_config_read(const char* cfgName)
+int32 socket_config_read(const char* cfgName)
 {
 {
 	char line[1024],w1[1024],w2[1024];
 	char line[1024],w1[1024],w2[1024];
 	FILE *fp;
 	FILE *fp;
@@ -1372,7 +1372,7 @@ int socket_config_read(const char* cfgName)
 
 
 void socket_final(void)
 void socket_final(void)
 {
 {
-	int i;
+	int32 i;
 #ifndef MINICORE
 #ifndef MINICORE
 	ConnectHistory* hist;
 	ConnectHistory* hist;
 	ConnectHistory* next_hist;
 	ConnectHistory* next_hist;
@@ -1421,7 +1421,7 @@ void socket_final(void)
 }
 }
 
 
 /// Closes a socket.
 /// Closes a socket.
-void do_close(int fd)
+void do_close(int32 fd)
 {
 {
 	if( fd <= 0 ||fd >= MAXCONN )
 	if( fd <= 0 ||fd >= MAXCONN )
 		return;// invalid
 		return;// invalid
@@ -1445,9 +1445,9 @@ void do_close(int fd)
 
 
 /// Retrieve local ips in host byte order.
 /// Retrieve local ips in host byte order.
 /// Uses loopback is no address is found.
 /// Uses loopback is no address is found.
-int socket_getips(uint32* ips, int max)
+int32 socket_getips(uint32* ips, int32 max)
 {
 {
-	int num = 0;
+	int32 num = 0;
 
 
 	if( ips == nullptr || max <= 0 )
 	if( ips == nullptr || max <= 0 )
 		return 0;
 		return 0;
@@ -1481,7 +1481,7 @@ int socket_getips(uint32* ips, int max)
 	}
 	}
 #else // not WIN32
 #else // not WIN32
 	{
 	{
-		int fd;
+		int32 fd;
 		char buf[2*16*sizeof(struct ifreq)];
 		char buf[2*16*sizeof(struct ifreq)];
 		struct ifconf ic;
 		struct ifconf ic;
 		u_long ad;
 		u_long ad;
@@ -1501,7 +1501,7 @@ int socket_getips(uint32* ips, int max)
 		}
 		}
 		else
 		else
 		{
 		{
-			int pos;
+			int32 pos;
 			for( pos=0; pos < ic.ifc_len && num < max; )
 			for( pos=0; pos < ic.ifc_len && num < max; )
 			{
 			{
 				struct ifreq* ir = (struct ifreq*)(buf+pos);
 				struct ifreq* ir = (struct ifreq*)(buf+pos);
@@ -1563,7 +1563,7 @@ void socket_init(void)
 				if( 0 != setrlimit(RLIMIT_NOFILE, &rlp) )
 				if( 0 != setrlimit(RLIMIT_NOFILE, &rlp) )
 				{// failed
 				{// failed
 					const char *errmsg = error_msg();
 					const char *errmsg = error_msg();
-					int rlim_ori;
+					int32 rlim_ori;
 					// set to maximum allowed
 					// set to maximum allowed
 					getrlimit(RLIMIT_NOFILE, &rlp);
 					getrlimit(RLIMIT_NOFILE, &rlp);
 					rlim_ori = (int)rlp.rlim_cur;
 					rlim_ori = (int)rlp.rlim_cur;
@@ -1625,12 +1625,12 @@ void socket_init(void)
 }
 }
 
 
 
 
-bool session_isValid(int fd)
+bool session_isValid(int32 fd)
 {
 {
 	return ( fd > 0 && fd < MAXCONN && session[fd] != nullptr );
 	return ( fd > 0 && fd < MAXCONN && session[fd] != nullptr );
 }
 }
 
 
-bool session_isActive(int fd)
+bool session_isActive(int32 fd)
 {
 {
 	return ( session_isValid(fd) && !session[fd]->flag.eof );
 	return ( session_isValid(fd) && !session[fd]->flag.eof );
 }
 }
@@ -1667,10 +1667,10 @@ uint16 ntows(uint16 netshort)
 #ifdef SEND_SHORTLIST
 #ifdef SEND_SHORTLIST
 // Add a fd to the shortlist so that it'll be recognized as a fd that needs
 // Add a fd to the shortlist so that it'll be recognized as a fd that needs
 // sending or eof handling.
 // sending or eof handling.
-void send_shortlist_add_fd(int fd)
+void send_shortlist_add_fd(int32 fd)
 {
 {
-	int i;
-	int bit;
+	int32 i;
+	int32 bit;
 
 
 	if( !session_isValid(fd) )
 	if( !session_isValid(fd) )
 		return;// out of range
 		return;// out of range
@@ -1696,10 +1696,10 @@ void send_shortlist_add_fd(int fd)
 // Do pending network sends and eof handling from the shortlist.
 // Do pending network sends and eof handling from the shortlist.
 void send_shortlist_do_sends()
 void send_shortlist_do_sends()
 {
 {
-	for( int i = static_cast<int>( send_shortlist_count - 1 ); i >= 0; --i ){
-		int fd = send_shortlist_array[i];
-		int idx = fd/32;
-		int bit = fd%32;
+	for( int32 i = static_cast<int>( send_shortlist_count - 1 ); i >= 0; --i ){
+		int32 fd = send_shortlist_array[i];
+		int32 idx = fd/32;
+		int32 bit = fd%32;
 
 
 		// Remove fd from shortlist, move the last fd to the current position
 		// Remove fd from shortlist, move the last fd to the current position
 		--send_shortlist_count;
 		--send_shortlist_count;

+ 22 - 22
src/common/socket.hpp

@@ -86,9 +86,9 @@
 
 
 
 
 // Struct declaration
 // Struct declaration
-typedef int (*RecvFunc)(int fd);
-typedef int (*SendFunc)(int fd);
-typedef int (*ParseFunc)(int fd);
+typedef int32 (*RecvFunc)(int32 fd);
+typedef int32 (*SendFunc)(int32 fd);
+typedef int32 (*ParseFunc)(int32 fd);
 
 
 struct socket_data
 struct socket_data
 {
 {
@@ -119,36 +119,36 @@ struct socket_data
 
 
 extern struct socket_data* session[MAXCONN];
 extern struct socket_data* session[MAXCONN];
 
 
-extern int fd_max;
+extern int32 fd_max;
 
 
 extern time_t last_tick;
 extern time_t last_tick;
 extern time_t stall_time;
 extern time_t stall_time;
 
 
 //////////////////////////////////
 //////////////////////////////////
 // some checking on sockets
 // some checking on sockets
-extern bool session_isValid(int fd);
-extern bool session_isActive(int fd);
+extern bool session_isValid(int32 fd);
+extern bool session_isActive(int32 fd);
 //////////////////////////////////
 //////////////////////////////////
 
 
 // Function prototype declaration
 // Function prototype declaration
 
 
-int make_listen_bind(uint32 ip, uint16 port);
-int make_connection(uint32 ip, uint16 port, bool silent, int timeout);
+int32 make_listen_bind(uint32 ip, uint16 port);
+int32 make_connection(uint32 ip, uint16 port, bool silent, int32 timeout);
 #define realloc_fifo( fd, rfifo_size, wfifo_size ) _realloc_fifo( ( fd ), ( rfifo_size ), ( wfifo_size ), ALC_MARK )
 #define realloc_fifo( fd, rfifo_size, wfifo_size ) _realloc_fifo( ( fd ), ( rfifo_size ), ( wfifo_size ), ALC_MARK )
 #define realloc_writefifo( fd, addition ) _realloc_writefifo( ( fd ), ( addition ), ALC_MARK )
 #define realloc_writefifo( fd, addition ) _realloc_writefifo( ( fd ), ( addition ), ALC_MARK )
-int _realloc_fifo( int fd, uint32 rfifo_size, uint32 wfifo_size, const char* file, int line, const char* func );
-int _realloc_writefifo( int fd, size_t addition, const char* file, int line, const char* func );
-int WFIFOSET(int fd, size_t len);
-int RFIFOSKIP(int fd, size_t len);
+int32 _realloc_fifo( int32 fd, uint32 rfifo_size, uint32 wfifo_size, const char* file, int32 line, const char* func );
+int32 _realloc_writefifo( int32 fd, size_t addition, const char* file, int32 line, const char* func );
+int32 WFIFOSET(int32 fd, size_t len);
+int32 RFIFOSKIP(int32 fd, size_t len);
 
 
-int do_sockets(t_tick next);
-void do_close(int fd);
+int32 do_sockets(t_tick next);
+void do_close(int32 fd);
 void socket_init(void);
 void socket_init(void);
 void socket_final(void);
 void socket_final(void);
 
 
-extern void flush_fifo(int fd);
+extern void flush_fifo(int32 fd);
 extern void flush_fifos(void);
 extern void flush_fifos(void);
-extern void set_nonblocking(int fd, unsigned long yes);
+extern void set_nonblocking(int32 fd, unsigned long yes);
 
 
 void set_defaultparse(ParseFunc defaultparse);
 void set_defaultparse(ParseFunc defaultparse);
 
 
@@ -178,12 +178,12 @@ uint32 str2ip(const char* ip_str);
 #define MAKEIP(a,b,c,d) (uint32)( ( ( (a)&0xFF ) << 24 ) | ( ( (b)&0xFF ) << 16 ) | ( ( (c)&0xFF ) << 8 ) | ( ( (d)&0xFF ) << 0 ) )
 #define MAKEIP(a,b,c,d) (uint32)( ( ( (a)&0xFF ) << 24 ) | ( ( (b)&0xFF ) << 16 ) | ( ( (c)&0xFF ) << 8 ) | ( ( (d)&0xFF ) << 0 ) )
 uint16 ntows(uint16 netshort);
 uint16 ntows(uint16 netshort);
 
 
-int socket_getips(uint32* ips, int max);
+int32 socket_getips(uint32* ips, int32 max);
 
 
 extern uint32 addr_[16];   // ip addresses of local host (host byte order)
 extern uint32 addr_[16];   // ip addresses of local host (host byte order)
-extern int naddr_;   // # of ip addresses
+extern int32 naddr_;   // # of ip addresses
 
 
-void set_eof(int fd);
+void set_eof(int32 fd);
 
 
 /// Use a shortlist of sockets instead of iterating all sessions for sockets
 /// Use a shortlist of sockets instead of iterating all sessions for sockets
 /// that have data to send or need eof handling.
 /// that have data to send or need eof handling.
@@ -195,7 +195,7 @@ void set_eof(int fd);
 #ifdef SEND_SHORTLIST
 #ifdef SEND_SHORTLIST
 // Add a fd to the shortlist so that it'll be recognized as a fd that needs
 // Add a fd to the shortlist so that it'll be recognized as a fd that needs
 // sending done on it.
 // sending done on it.
-void send_shortlist_add_fd(int fd);
+void send_shortlist_add_fd(int32 fd);
 // Do pending network sends (and eof handling) from the shortlist.
 // Do pending network sends (and eof handling) from the shortlist.
 void send_shortlist_do_sends();
 void send_shortlist_do_sends();
 #endif
 #endif
@@ -205,7 +205,7 @@ void send_shortlist_do_sends();
 extern int8 packet_buffer[UINT16_MAX];
 extern int8 packet_buffer[UINT16_MAX];
 
 
 template <typename P>
 template <typename P>
-bool socket_send( int fd, P& packet ){
+bool socket_send( int32 fd, P& packet ){
 	if( !session_isActive( fd ) ){
 	if( !session_isActive( fd ) ){
 		return false;
 		return false;
 	}
 	}
@@ -218,7 +218,7 @@ bool socket_send( int fd, P& packet ){
 }
 }
 
 
 template <typename P>
 template <typename P>
-bool socket_send( int fd, P* packet ){
+bool socket_send( int32 fd, P* packet ){
 	if( !session_isActive( fd ) ){
 	if( !session_isActive( fd ) ){
 		return false;
 		return false;
 	}
 	}

+ 28 - 28
src/common/sql.cpp

@@ -27,7 +27,7 @@
 
 
 void ra_mysql_error_handler(uint32 ecode);
 void ra_mysql_error_handler(uint32 ecode);
 
 
-int mysql_reconnect_type;
+int32 mysql_reconnect_type;
 uint32 mysql_reconnect_count;
 uint32 mysql_reconnect_count;
 
 
 /// Sql handle
 /// Sql handle
@@ -38,7 +38,7 @@ struct Sql
 	MYSQL_RES* result;
 	MYSQL_RES* result;
 	MYSQL_ROW row;
 	MYSQL_ROW row;
 	unsigned long* lengths;
 	unsigned long* lengths;
-	int keepalive;
+	int32 keepalive;
 };
 };
 
 
 
 
@@ -102,7 +102,7 @@ uint32 Sql_GetError( Sql* self ){
 	return mysql_errno( &self->handle );
 	return mysql_errno( &self->handle );
 }
 }
 
 
-static int Sql_P_Keepalive(Sql* self);
+static int32 Sql_P_Keepalive(Sql* self);
 
 
 /**
 /**
  * Establishes a connection to schema
  * Establishes a connection to schema
@@ -114,7 +114,7 @@ static int Sql_P_Keepalive(Sql* self);
  * @param db : schema name
  * @param db : schema name
  * @return 
  * @return 
  */
  */
-int Sql_Connect(Sql* self, const char* user, const char* passwd, const char* host, uint16 port, const char* db)
+int32 Sql_Connect(Sql* self, const char* user, const char* passwd, const char* host, uint16 port, const char* db)
 {
 {
 	if( self == nullptr )
 	if( self == nullptr )
 		return SQL_ERROR;
 		return SQL_ERROR;
@@ -148,7 +148,7 @@ int Sql_Connect(Sql* self, const char* user, const char* passwd, const char* hos
 
 
 
 
 /// Retrieves the timeout of the connection.
 /// Retrieves the timeout of the connection.
-int Sql_GetTimeout(Sql* self, uint32* out_timeout)
+int32 Sql_GetTimeout(Sql* self, uint32* out_timeout)
 {
 {
 	if( self && out_timeout && SQL_SUCCESS == Sql_Query(self, "SHOW VARIABLES LIKE 'wait_timeout'") )
 	if( self && out_timeout && SQL_SUCCESS == Sql_Query(self, "SHOW VARIABLES LIKE 'wait_timeout'") )
 	{
 	{
@@ -169,7 +169,7 @@ int Sql_GetTimeout(Sql* self, uint32* out_timeout)
 
 
 
 
 /// Retrieves the name of the columns of a table into out_buf, with the separator after each name.
 /// Retrieves the name of the columns of a table into out_buf, with the separator after each name.
-int Sql_GetColumnNames(Sql* self, const char* table, char* out_buf, size_t buf_len, char sep)
+int32 Sql_GetColumnNames(Sql* self, const char* table, char* out_buf, size_t buf_len, char sep)
 {
 {
 	char* data;
 	char* data;
 	size_t len;
 	size_t len;
@@ -200,7 +200,7 @@ int Sql_GetColumnNames(Sql* self, const char* table, char* out_buf, size_t buf_l
 
 
 
 
 /// Changes the encoding of the connection.
 /// Changes the encoding of the connection.
-int Sql_SetEncoding(Sql* self, const char* encoding)
+int32 Sql_SetEncoding(Sql* self, const char* encoding)
 {
 {
 	if( self && Sql_Query(self, "SET NAMES %s", encoding) == 0 )
 	if( self && Sql_Query(self, "SET NAMES %s", encoding) == 0 )
 		return SQL_SUCCESS;
 		return SQL_SUCCESS;
@@ -210,7 +210,7 @@ int Sql_SetEncoding(Sql* self, const char* encoding)
 
 
 
 
 /// Pings the connection.
 /// Pings the connection.
-int Sql_Ping(Sql* self)
+int32 Sql_Ping(Sql* self)
 {
 {
 	if( self && mysql_ping(&self->handle) == 0 )
 	if( self && mysql_ping(&self->handle) == 0 )
 		return SQL_SUCCESS;
 		return SQL_SUCCESS;
@@ -235,7 +235,7 @@ static TIMER_FUNC(Sql_P_KeepaliveTimer){
 ///
 ///
 /// @return the keepalive timer id, or INVALID_TIMER
 /// @return the keepalive timer id, or INVALID_TIMER
 /// @private
 /// @private
-static int Sql_P_Keepalive(Sql* self)
+static int32 Sql_P_Keepalive(Sql* self)
 {
 {
 	uint32 timeout, ping_interval;
 	uint32 timeout, ping_interval;
 
 
@@ -279,9 +279,9 @@ size_t Sql_EscapeStringLen(Sql* self, char *out_to, const char *from, size_t fro
 
 
 
 
 /// Executes a query.
 /// Executes a query.
-int Sql_Query(Sql* self, const char* query, ...)
+int32 Sql_Query(Sql* self, const char* query, ...)
 {
 {
-	int res;
+	int32 res;
 	va_list args;
 	va_list args;
 
 
 	va_start(args, query);
 	va_start(args, query);
@@ -294,7 +294,7 @@ int Sql_Query(Sql* self, const char* query, ...)
 
 
 
 
 /// Executes a query.
 /// Executes a query.
-int Sql_QueryV(Sql* self, const char* query, va_list args)
+int32 Sql_QueryV(Sql* self, const char* query, va_list args)
 {
 {
 	if( self == nullptr )
 	if( self == nullptr )
 		return SQL_ERROR;
 		return SQL_ERROR;
@@ -321,7 +321,7 @@ int Sql_QueryV(Sql* self, const char* query, va_list args)
 
 
 
 
 /// Executes a query.
 /// Executes a query.
-int Sql_QueryStr(Sql* self, const char* query)
+int32 Sql_QueryStr(Sql* self, const char* query)
 {
 {
 	if( self == nullptr )
 	if( self == nullptr )
 		return SQL_ERROR;
 		return SQL_ERROR;
@@ -389,7 +389,7 @@ uint64 Sql_NumRowsAffected(Sql* self)
 
 
 
 
 /// Fetches the next row.
 /// Fetches the next row.
-int Sql_NextRow(Sql* self)
+int32 Sql_NextRow(Sql* self)
 {
 {
 	if( self && self->result )
 	if( self && self->result )
 	{
 	{
@@ -409,7 +409,7 @@ int Sql_NextRow(Sql* self)
 
 
 
 
 /// Gets the data of a column.
 /// Gets the data of a column.
-int Sql_GetData(Sql* self, size_t col, char** out_buf, size_t* out_len)
+int32 Sql_GetData(Sql* self, size_t col, char** out_buf, size_t* out_len)
 {
 {
 	if( self && self->row )
 	if( self && self->row )
 	{
 	{
@@ -487,7 +487,7 @@ void Sql_Free(Sql* self)
 /// Returns the mysql integer type for the target size.
 /// Returns the mysql integer type for the target size.
 ///
 ///
 /// @private
 /// @private
-static enum enum_field_types Sql_P_SizeToMysqlIntType(int sz)
+static enum enum_field_types Sql_P_SizeToMysqlIntType(int32 sz)
 {
 {
 	switch( sz )
 	switch( sz )
 	{
 	{
@@ -506,7 +506,7 @@ static enum enum_field_types Sql_P_SizeToMysqlIntType(int sz)
 /// Binds a parameter/result.
 /// Binds a parameter/result.
 ///
 ///
 /// @private
 /// @private
-static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type, void* buffer, size_t buffer_len, unsigned long* out_length, int8* out_is_null)
+static int32 Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type, void* buffer, size_t buffer_len, unsigned long* out_length, int8* out_is_null)
 {
 {
 	memset(bind, 0, sizeof(MYSQL_BIND));
 	memset(bind, 0, sizeof(MYSQL_BIND));
 	switch( buffer_type )
 	switch( buffer_type )
@@ -613,7 +613,7 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type,
 /// Prints debug information about a field (type and length).
 /// Prints debug information about a field (type and length).
 ///
 ///
 /// @private
 /// @private
-static void Sql_P_ShowDebugMysqlFieldInfo(const char* prefix, enum enum_field_types type, int is_unsigned, unsigned long length, const char* length_postfix)
+static void Sql_P_ShowDebugMysqlFieldInfo(const char* prefix, enum enum_field_types type, int32 is_unsigned, unsigned long length, const char* length_postfix)
 {
 {
 	const char* sign = (is_unsigned ? "UNSIGNED " : "");
 	const char* sign = (is_unsigned ? "UNSIGNED " : "");
 	const char* type_string;
 	const char* type_string;
@@ -705,9 +705,9 @@ SqlStmt* SqlStmt_Malloc(Sql* sql)
 
 
 
 
 /// Prepares the statement.
 /// Prepares the statement.
-int SqlStmt_Prepare(SqlStmt* self, const char* query, ...)
+int32 SqlStmt_Prepare(SqlStmt* self, const char* query, ...)
 {
 {
-	int res;
+	int32 res;
 	va_list args;
 	va_list args;
 
 
 	va_start(args, query);
 	va_start(args, query);
@@ -720,7 +720,7 @@ int SqlStmt_Prepare(SqlStmt* self, const char* query, ...)
 
 
 
 
 /// Prepares the statement.
 /// Prepares the statement.
-int SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args)
+int32 SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args)
 {
 {
 	if( self == nullptr )
 	if( self == nullptr )
 		return SQL_ERROR;
 		return SQL_ERROR;
@@ -742,7 +742,7 @@ int SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args)
 
 
 
 
 /// Prepares the statement.
 /// Prepares the statement.
-int SqlStmt_PrepareStr(SqlStmt* self, const char* query)
+int32 SqlStmt_PrepareStr(SqlStmt* self, const char* query)
 {
 {
 	if( self == nullptr )
 	if( self == nullptr )
 		return SQL_ERROR;
 		return SQL_ERROR;
@@ -775,7 +775,7 @@ size_t SqlStmt_NumParams(SqlStmt* self)
 
 
 
 
 /// Binds a parameter to a buffer.
 /// Binds a parameter to a buffer.
-int SqlStmt_BindParam(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, void* buffer, size_t buffer_len)
+int32 SqlStmt_BindParam(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, void* buffer, size_t buffer_len)
 {
 {
 	if( self == nullptr )
 	if( self == nullptr )
 		return SQL_ERROR;
 		return SQL_ERROR;
@@ -805,7 +805,7 @@ int SqlStmt_BindParam(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, v
 
 
 
 
 /// Executes the prepared statement.
 /// Executes the prepared statement.
-int SqlStmt_Execute(SqlStmt* self)
+int32 SqlStmt_Execute(SqlStmt* self)
 {
 {
 	if( self == nullptr )
 	if( self == nullptr )
 		return SQL_ERROR;
 		return SQL_ERROR;
@@ -854,7 +854,7 @@ size_t SqlStmt_NumColumns(SqlStmt* self)
 
 
 
 
 /// Binds the result of a column to a buffer.
 /// Binds the result of a column to a buffer.
-int SqlStmt_BindColumn(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, void* buffer, size_t buffer_len, uint32* out_length, int8* out_is_null)
+int32 SqlStmt_BindColumn(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, void* buffer, size_t buffer_len, uint32* out_length, int8* out_is_null)
 {
 {
 	if( self == nullptr )
 	if( self == nullptr )
 		return SQL_ERROR;
 		return SQL_ERROR;
@@ -911,9 +911,9 @@ uint64 SqlStmt_NumRows(SqlStmt* self)
 
 
 
 
 /// Fetches the next row.
 /// Fetches the next row.
-int SqlStmt_NextRow(SqlStmt* self)
+int32 SqlStmt_NextRow(SqlStmt* self)
 {
 {
-	int err;
+	int32 err;
 	size_t i;
 	size_t i;
 	size_t cols;
 	size_t cols;
 
 
@@ -1074,7 +1074,7 @@ void Sql_inter_server_read(const char* cfgName, bool first) {
 	}
 	}
 
 
 	while(fgets(line, sizeof(line), fp)) {
 	while(fgets(line, sizeof(line), fp)) {
-		int i = sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2);
+		int32 i = sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2);
 		if(i != 2)
 		if(i != 2)
 			continue;
 			continue;
 
 

+ 17 - 17
src/common/sql.hpp

@@ -76,7 +76,7 @@ uint32 Sql_GetError( Sql* self );
 /// Establishes a connection.
 /// Establishes a connection.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int Sql_Connect(Sql* self, const char* user, const char* passwd, const char* host, uint16 port, const char* db);
+int32 Sql_Connect(Sql* self, const char* user, const char* passwd, const char* host, uint16 port, const char* db);
 
 
 
 
 
 
@@ -84,7 +84,7 @@ int Sql_Connect(Sql* self, const char* user, const char* passwd, const char* hos
 /// Retrieves the timeout of the connection.
 /// Retrieves the timeout of the connection.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int Sql_GetTimeout(Sql* self, uint32* out_timeout);
+int32 Sql_GetTimeout(Sql* self, uint32* out_timeout);
 
 
 
 
 
 
@@ -92,7 +92,7 @@ int Sql_GetTimeout(Sql* self, uint32* out_timeout);
 /// Retrieves the name of the columns of a table into out_buf, with the separator after each name.
 /// Retrieves the name of the columns of a table into out_buf, with the separator after each name.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int Sql_GetColumnNames(Sql* self, const char* table, char* out_buf, size_t buf_len, char sep);
+int32 Sql_GetColumnNames(Sql* self, const char* table, char* out_buf, size_t buf_len, char sep);
 
 
 
 
 
 
@@ -100,14 +100,14 @@ int Sql_GetColumnNames(Sql* self, const char* table, char* out_buf, size_t buf_l
 /// Changes the encoding of the connection.
 /// Changes the encoding of the connection.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int Sql_SetEncoding(Sql* self, const char* encoding);
+int32 Sql_SetEncoding(Sql* self, const char* encoding);
 
 
 
 
 
 
 /// Pings the connection.
 /// Pings the connection.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int Sql_Ping(Sql* self);
+int32 Sql_Ping(Sql* self);
 
 
 
 
 
 
@@ -132,7 +132,7 @@ size_t Sql_EscapeStringLen(Sql* self, char* out_to, const char* from, size_t fro
 /// The query is constructed as if it was sprintf.
 /// The query is constructed as if it was sprintf.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int Sql_Query(Sql* self, const char* query, ...);
+int32 Sql_Query(Sql* self, const char* query, ...);
 
 
 
 
 
 
@@ -141,7 +141,7 @@ int Sql_Query(Sql* self, const char* query, ...);
 /// The query is constructed as if it was svprintf.
 /// The query is constructed as if it was svprintf.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int Sql_QueryV(Sql* self, const char* query, va_list args);
+int32 Sql_QueryV(Sql* self, const char* query, va_list args);
 
 
 
 
 
 
@@ -150,7 +150,7 @@ int Sql_QueryV(Sql* self, const char* query, va_list args);
 /// The query is used directly.
 /// The query is used directly.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int Sql_QueryStr(Sql* self, const char* query);
+int32 Sql_QueryStr(Sql* self, const char* query);
 
 
 
 
 
 
@@ -186,7 +186,7 @@ uint64 Sql_NumRowsAffected(Sql* self);
 /// The data of the previous row is no longer valid.
 /// The data of the previous row is no longer valid.
 ///
 ///
 /// @return SQL_SUCCESS, SQL_ERROR or SQL_NO_DATA
 /// @return SQL_SUCCESS, SQL_ERROR or SQL_NO_DATA
-int Sql_NextRow(Sql* self);
+int32 Sql_NextRow(Sql* self);
 
 
 
 
 
 
@@ -194,7 +194,7 @@ int Sql_NextRow(Sql* self);
 /// The data remains valid until the next row is fetched or the result is freed.
 /// The data remains valid until the next row is fetched or the result is freed.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int Sql_GetData(Sql* self, size_t col, char** out_buf, size_t* out_len);
+int32 Sql_GetData(Sql* self, size_t col, char** out_buf, size_t* out_len);
 
 
 
 
 
 
@@ -247,7 +247,7 @@ struct SqlStmt* SqlStmt_Malloc(Sql* sql);
 /// The query is constructed as if it was sprintf.
 /// The query is constructed as if it was sprintf.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_Prepare(SqlStmt* self, const char* query, ...);
+int32 SqlStmt_Prepare(SqlStmt* self, const char* query, ...);
 
 
 
 
 
 
@@ -256,7 +256,7 @@ int SqlStmt_Prepare(SqlStmt* self, const char* query, ...);
 /// The query is constructed as if it was svprintf.
 /// The query is constructed as if it was svprintf.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args);
+int32 SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args);
 
 
 
 
 
 
@@ -265,7 +265,7 @@ int SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args);
 /// The query is used directly.
 /// The query is used directly.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_PrepareStr(SqlStmt* self, const char* query);
+int32 SqlStmt_PrepareStr(SqlStmt* self, const char* query);
 
 
 
 
 
 
@@ -281,7 +281,7 @@ size_t SqlStmt_NumParams(SqlStmt* self);
 /// All parameters should have bindings.
 /// All parameters should have bindings.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_BindParam(SqlStmt* self, size_t idx, SqlDataType buffer_type, void* buffer, size_t buffer_len);
+int32 SqlStmt_BindParam(SqlStmt* self, size_t idx, SqlDataType buffer_type, void* buffer, size_t buffer_len);
 
 
 
 
 
 
@@ -289,7 +289,7 @@ int SqlStmt_BindParam(SqlStmt* self, size_t idx, SqlDataType buffer_type, void*
 /// Any previous result is freed and all column bindings are removed.
 /// Any previous result is freed and all column bindings are removed.
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_Execute(SqlStmt* self);
+int32 SqlStmt_Execute(SqlStmt* self);
 
 
 
 
 
 
@@ -313,7 +313,7 @@ size_t SqlStmt_NumColumns(SqlStmt* self);
 /// and the nul-terminator (an extra byte).
 /// and the nul-terminator (an extra byte).
 ///
 ///
 /// @return SQL_SUCCESS or SQL_ERROR
 /// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_BindColumn(SqlStmt* self, size_t idx, SqlDataType buffer_type, void* buffer, size_t buffer_len, uint32* out_length, int8* out_is_null);
+int32 SqlStmt_BindColumn(SqlStmt* self, size_t idx, SqlDataType buffer_type, void* buffer, size_t buffer_len, uint32* out_length, int8* out_is_null);
 
 
 
 
 
 
@@ -328,7 +328,7 @@ uint64 SqlStmt_NumRows(SqlStmt* self);
 /// All column bindings will be filled with data.
 /// All column bindings will be filled with data.
 ///
 ///
 /// @return SQL_SUCCESS, SQL_ERROR or SQL_NO_DATA
 /// @return SQL_SUCCESS, SQL_ERROR or SQL_NO_DATA
-int SqlStmt_NextRow(SqlStmt* self);
+int32 SqlStmt_NextRow(SqlStmt* self);
 
 
 
 
 
 

+ 27 - 27
src/common/strlib.cpp

@@ -11,10 +11,10 @@
 #include "showmsg.hpp"
 #include "showmsg.hpp"
 
 
 // Function to suppress control characters in a string.
 // Function to suppress control characters in a string.
-int remove_control_chars(char* str)
+int32 remove_control_chars(char* str)
 {
 {
-	int i;
-	int change = 0;
+	int32 i;
+	int32 change = 0;
 
 
 	for(i = 0; str[i]; i++) {
 	for(i = 0; str[i]; i++) {
 		if (ISCNTRL(str[i])) {
 		if (ISCNTRL(str[i])) {
@@ -60,7 +60,7 @@ char* normalize_name(char* str,const char* delims)
 {
 {
 	char* in = str;
 	char* in = str;
 	char* out = str;
 	char* out = str;
-	int put_space = 0;
+	int32 put_space = 0;
 
 
 	if( str == nullptr || delims == nullptr )
 	if( str == nullptr || delims == nullptr )
 		return str;
 		return str;
@@ -154,11 +154,11 @@ size_t strnlen (const char* string, size_t maxlen)
 #endif
 #endif
 
 
 #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER <= 1200
 #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER <= 1200
-uint64 strtoull(const char* str, char** endptr, int base)
+uint64 strtoull(const char* str, char** endptr, int32 base)
 {
 {
 	uint64 result;
 	uint64 result;
-	int count;
-	int n;
+	int32 count;
+	int32 n;
 
 
 	if( base == 0 )
 	if( base == 0 )
 	{
 	{
@@ -199,7 +199,7 @@ uint64 strtoull(const char* str, char** endptr, int base)
 //----------------------------------------------------
 //----------------------------------------------------
 // E-mail check: return 0 (not correct) or 1 (valid).
 // E-mail check: return 0 (not correct) or 1 (valid).
 //----------------------------------------------------
 //----------------------------------------------------
-int e_mail_check(char* email)
+int32 e_mail_check(char* email)
 {
 {
 	char ch;
 	char ch;
 	char* last_arobas;
 	char* last_arobas;
@@ -236,7 +236,7 @@ int e_mail_check(char* email)
 // Return numerical value of a switch configuration
 // Return numerical value of a switch configuration
 // on/off, english, fran�ais, deutsch, espa�ol, portuguese
 // on/off, english, fran�ais, deutsch, espa�ol, portuguese
 //--------------------------------------------------
 //--------------------------------------------------
-int config_switch(const char* str)
+int32 config_switch(const char* str)
 {
 {
 	if (strcmpi(str, "on") == 0 || strcmpi(str, "yes") == 0 || strcmpi(str, "oui") == 0 || strcmpi(str, "ja") == 0 || strcmpi(str, "si") == 0 || strcmpi(str, "sim") == 0)
 	if (strcmpi(str, "on") == 0 || strcmpi(str, "yes") == 0 || strcmpi(str, "oui") == 0 || strcmpi(str, "ja") == 0 || strcmpi(str, "si") == 0 || strcmpi(str, "sim") == 0)
 		return 1;
 		return 1;
@@ -282,10 +282,10 @@ size_t safestrnlen(const char* string, size_t maxlen)
 /// @param fmt Format string
 /// @param fmt Format string
 /// @param ... Format arguments
 /// @param ... Format arguments
 /// @return The size of the string or -1 if the buffer is too small
 /// @return The size of the string or -1 if the buffer is too small
-int safesnprintf(char* buf, size_t sz, const char* fmt, ...)
+int32 safesnprintf(char* buf, size_t sz, const char* fmt, ...)
 {
 {
 	va_list ap;
 	va_list ap;
-	int ret;
+	int32 ret;
 
 
 	va_start(ap,fmt);
 	va_start(ap,fmt);
 	ret = vsnprintf(buf, sz, fmt, ap);
 	ret = vsnprintf(buf, sz, fmt, ap);
@@ -300,10 +300,10 @@ int safesnprintf(char* buf, size_t sz, const char* fmt, ...)
 
 
 /// Returns the line of the target position in the string.
 /// Returns the line of the target position in the string.
 /// Lines start at 1.
 /// Lines start at 1.
-int strline(const char* str, size_t pos)
+int32 strline(const char* str, size_t pos)
 {
 {
 	const char* target;
 	const char* target;
-	int line;
+	int32 line;
 
 
 	if( str == nullptr || pos == 0 )
 	if( str == nullptr || pos == 0 )
 		return 1;
 		return 1;
@@ -349,7 +349,7 @@ bool bin2hex(char* output, unsigned char* input, size_t count)
 ///
 ///
 /// @param sv Parse state
 /// @param sv Parse state
 /// @return 1 if a field was parsed, 0 if already done, -1 on error.
 /// @return 1 if a field was parsed, 0 if already done, -1 on error.
-int sv_parse_next( s_svstate& sv ){
+int32 sv_parse_next( s_svstate& sv ){
 	enum {
 	enum {
 		START_OF_FIELD,
 		START_OF_FIELD,
 		PARSING_FIELD,
 		PARSING_FIELD,
@@ -361,7 +361,7 @@ int sv_parse_next( s_svstate& sv ){
 
 
 	const char* str = sv.str;
 	const char* str = sv.str;
 	size_t len = sv.len;
 	size_t len = sv.len;
-	int opt = sv.opt;
+	int32 opt = sv.opt;
 	char delim = sv.delim;
 	char delim = sv.delim;
 
 
 	// check opt
 	// check opt
@@ -512,7 +512,7 @@ int sv_parse_next( s_svstate& sv ){
 /// @param npos Size of the pos array
 /// @param npos Size of the pos array
 /// @param opt Options that determine the parsing behaviour
 /// @param opt Options that determine the parsing behaviour
 /// @return Number of fields found in the string or -1 if an error occured
 /// @return Number of fields found in the string or -1 if an error occured
-size_t sv_parse( const char* str, size_t len, size_t startoff, char delim, size_t* out_pos, size_t npos, int opt, bool& error ){
+size_t sv_parse( const char* str, size_t len, size_t startoff, char delim, size_t* out_pos, size_t npos, int32 opt, bool& error ){
 	// initialize
 	// initialize
 	error = false;
 	error = false;
 
 
@@ -583,7 +583,7 @@ size_t sv_parse( const char* str, size_t len, size_t startoff, char delim, size_
 /// @param nfields Size of the field array
 /// @param nfields Size of the field array
 /// @param opt Options that determine the parsing behaviour
 /// @param opt Options that determine the parsing behaviour
 /// @return Number of fields found in the string or -1 if an error occured
 /// @return Number of fields found in the string or -1 if an error occured
-size_t sv_split( char* str, size_t len, size_t startoff, char delim, char** out_fields, size_t nfields, int opt, bool& error ){
+size_t sv_split( char* str, size_t len, size_t startoff, char delim, char** out_fields, size_t nfields, int32 opt, bool& error ){
 	if( out_fields == nullptr || nfields <= 0 ){
 	if( out_fields == nullptr || nfields <= 0 ){
 		return 0; // nothing to do
 		return 0; // nothing to do
 	}
 	}
@@ -886,7 +886,7 @@ const char* skip_escaped_c(const char* p)
  */
  */
 bool sv_readdb( const char* directory, const char* filename, char delim, size_t mincols, size_t maxcols, size_t maxrows, bool (*parseproc)( char* fields[], size_t columns, size_t current ), bool silent ){
 bool sv_readdb( const char* directory, const char* filename, char delim, size_t mincols, size_t maxcols, size_t maxrows, bool (*parseproc)( char* fields[], size_t columns, size_t current ), bool silent ){
 	FILE* fp;
 	FILE* fp;
-	int lines = 0;
+	int32 lines = 0;
 	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;
@@ -974,7 +974,7 @@ bool sv_readdb( const char* directory, const char* filename, char delim, size_t
 // @author MouseJstr (original)
 // @author MouseJstr (original)
 
 
 /// Allocates a StringBuf
 /// Allocates a StringBuf
-StringBuf* _StringBuf_Malloc(const char *file, int line, const char *func)
+StringBuf* _StringBuf_Malloc(const char *file, int32 line, const char *func)
 {
 {
 	StringBuf* self;
 	StringBuf* self;
 	self = (StringBuf *)aCalloc2(1, sizeof(StringBuf), file, line, func);
 	self = (StringBuf *)aCalloc2(1, sizeof(StringBuf), file, line, func);
@@ -983,14 +983,14 @@ StringBuf* _StringBuf_Malloc(const char *file, int line, const char *func)
 }
 }
 
 
 /// Initializes a previously allocated StringBuf
 /// Initializes a previously allocated StringBuf
-void _StringBuf_Init(const char *file, int line, const char *func,StringBuf* self)
+void _StringBuf_Init(const char *file, int32 line, const char *func,StringBuf* self)
 {
 {
 	self->max_ = 1024;
 	self->max_ = 1024;
 	self->ptr_ = self->buf_ = (char*)aMalloc2(self->max_ + 1, file, line, func);
 	self->ptr_ = self->buf_ = (char*)aMalloc2(self->max_ + 1, file, line, func);
 }
 }
 
 
 /// Appends the result of printf to the StringBuf
 /// Appends the result of printf to the StringBuf
-size_t _StringBuf_Printf( const char* file, int line, const char* func, StringBuf* self, const char* fmt, ... ){
+size_t _StringBuf_Printf( const char* file, int32 line, const char* func, StringBuf* self, const char* fmt, ... ){
 	va_list ap;
 	va_list ap;
 
 
 	va_start(ap, fmt);
 	va_start(ap, fmt);
@@ -1001,14 +1001,14 @@ size_t _StringBuf_Printf( const char* file, int line, const char* func, StringBu
 }
 }
 
 
 /// Appends the result of vprintf to the StringBuf
 /// Appends the result of vprintf to the StringBuf
-size_t _StringBuf_Vprintf( const char* file, int line, const char* func, StringBuf* self, const char* fmt, va_list ap ){
+size_t _StringBuf_Vprintf( const char* file, int32 line, const char* func, StringBuf* self, const char* fmt, va_list ap ){
 	for(;;)
 	for(;;)
 	{
 	{
 		va_list apcopy;
 		va_list apcopy;
-		/* Try to print in the allocated space. */
+		/* Try to print32 in the allocated space. */
 		size_t size = self->max_ - (self->ptr_ - self->buf_);
 		size_t size = self->max_ - (self->ptr_ - self->buf_);
 		va_copy(apcopy, ap);
 		va_copy(apcopy, ap);
-		int n = vsnprintf( self->ptr_, size, fmt, apcopy );
+		int32 n = vsnprintf( self->ptr_, size, fmt, apcopy );
 		va_end(apcopy);
 		va_end(apcopy);
 		/* If that worked, return the length. */
 		/* If that worked, return the length. */
 		if( n > -1 && static_cast<size_t>(n) < size )
 		if( n > -1 && static_cast<size_t>(n) < size )
@@ -1025,7 +1025,7 @@ size_t _StringBuf_Vprintf( const char* file, int line, const char* func, StringB
 }
 }
 
 
 /// Appends the contents of another StringBuf to the StringBuf
 /// Appends the contents of another StringBuf to the StringBuf
-size_t _StringBuf_Append(const char *file, int line, const char *func,StringBuf* self, const StringBuf* sbuf)
+size_t _StringBuf_Append(const char *file, int32 line, const char *func,StringBuf* self, const StringBuf* sbuf)
 {
 {
 	size_t available = self->max_ - (self->ptr_ - self->buf_);
 	size_t available = self->max_ - (self->ptr_ - self->buf_);
 	size_t needed = sbuf->ptr_ - sbuf->buf_;
 	size_t needed = sbuf->ptr_ - sbuf->buf_;
@@ -1044,7 +1044,7 @@ size_t _StringBuf_Append(const char *file, int line, const char *func,StringBuf*
 }
 }
 
 
 // Appends str to the StringBuf
 // Appends str to the StringBuf
-size_t _StringBuf_AppendStr(const char *file, int line, const char *func,StringBuf* self, const char* str)
+size_t _StringBuf_AppendStr(const char *file, int32 line, const char *func,StringBuf* self, const char* str)
 {
 {
 	size_t available = self->max_ - ( self->ptr_ - self->buf_ );
 	size_t available = self->max_ - ( self->ptr_ - self->buf_ );
 	size_t needed = strlen( str );
 	size_t needed = strlen( str );
@@ -1063,7 +1063,7 @@ size_t _StringBuf_AppendStr(const char *file, int line, const char *func,StringB
 }
 }
 
 
 // Returns the length of the data in the Stringbuf
 // Returns the length of the data in the Stringbuf
-int StringBuf_Length(StringBuf* self)
+int32 StringBuf_Length(StringBuf* self)
 {
 {
 	return (int)(self->ptr_ - self->buf_);
 	return (int)(self->ptr_ - self->buf_);
 }
 }

+ 17 - 17
src/common/strlib.hpp

@@ -18,7 +18,7 @@
 #include "cbasetypes.hpp"
 #include "cbasetypes.hpp"
 #include "malloc.hpp"
 #include "malloc.hpp"
 
 
-int remove_control_chars(char* str);
+int32 remove_control_chars(char* str);
 char* trim(char* str);
 char* trim(char* str);
 char* normalize_name(char* str,const char* delims);
 char* normalize_name(char* str,const char* delims);
 const char *stristr(const char *haystack, const char *needle);
 const char *stristr(const char *haystack, const char *needle);
@@ -34,11 +34,11 @@ size_t strnlen (const char* string, size_t maxlen);
 #endif
 #endif
 
 
 #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER <= 1200
 #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER <= 1200
-uint64 strtoull(const char* str, char** endptr, int base);
+uint64 strtoull(const char* str, char** endptr, int32 base);
 #endif
 #endif
 
 
-int e_mail_check(char* email);
-int config_switch(const char* str);
+int32 e_mail_check(char* email);
+int32 config_switch(const char* str);
 
 
 /// strncpy that always nul-terminates the string
 /// strncpy that always nul-terminates the string
 char* safestrncpy(char* dst, const char* src, size_t n);
 char* safestrncpy(char* dst, const char* src, size_t n);
@@ -49,11 +49,11 @@ size_t safestrnlen(const char* string, size_t maxlen);
 /// Works like snprintf, but always nul-terminates the buffer.
 /// Works like snprintf, but always nul-terminates the buffer.
 /// Returns the size of the string (without nul-terminator)
 /// Returns the size of the string (without nul-terminator)
 /// or -1 if the buffer is too small.
 /// or -1 if the buffer is too small.
-int safesnprintf(char* buf, size_t sz, const char* fmt, ...);
+int32 safesnprintf(char* buf, size_t sz, const char* fmt, ...);
 
 
 /// Returns the line of the target position in the string.
 /// Returns the line of the target position in the string.
 /// Lines start at 1.
 /// Lines start at 1.
-int strline(const char* str, size_t pos);
+int32 strline(const char* str, size_t pos);
 
 
 /// Produces the hexadecimal representation of the given input.
 /// Produces the hexadecimal representation of the given input.
 /// The output buffer must be at least count*2+1 in size.
 /// The output buffer must be at least count*2+1 in size.
@@ -88,7 +88,7 @@ struct s_svstate
 	size_t off; //< current offset in the string
 	size_t off; //< current offset in the string
 	size_t start; //< where the field starts
 	size_t start; //< where the field starts
 	size_t end; //< where the field ends
 	size_t end; //< where the field ends
-	int opt; //< parse options
+	int32 opt; //< parse options
 	char delim; //< field delimiter
 	char delim; //< field delimiter
 	bool done; //< if all the text has been parsed
 	bool done; //< if all the text has been parsed
 };
 };
@@ -98,14 +98,14 @@ struct s_svstate
 ///
 ///
 /// @param sv Parse state
 /// @param sv Parse state
 /// @return 1 if a field was parsed, 0 if done, -1 on error.
 /// @return 1 if a field was parsed, 0 if done, -1 on error.
-int sv_parse_next( s_svstate& sv );
+int32 sv_parse_next( s_svstate& sv );
 
 
 /// Parses a delim-separated string.
 /// Parses a delim-separated string.
 /// Starts parsing at startoff and fills the pos array with position pairs.
 /// Starts parsing at startoff and fills the pos array with position pairs.
 /// out_pos[0] and out_pos[1] are the start and end of line.
 /// out_pos[0] and out_pos[1] are the start and end of line.
 /// Other position pairs are the start and end of fields.
 /// Other position pairs are the start and end of fields.
 /// Returns the number of fields found or -1 if an error occurs.
 /// Returns the number of fields found or -1 if an error occurs.
-size_t sv_parse( const char* str, size_t len, size_t startoff, char delim, size_t* out_pos, size_t npos, int opt, bool& error );
+size_t sv_parse( const char* str, size_t len, size_t startoff, char delim, size_t* out_pos, size_t npos, int32 opt, bool& error );
 
 
 /// Splits a delim-separated string.
 /// Splits a delim-separated string.
 /// WARNING: this function modifies the input string
 /// WARNING: this function modifies the input string
@@ -113,7 +113,7 @@ size_t sv_parse( const char* str, size_t len, size_t startoff, char delim, size_
 /// out_fields[0] is the start of the next line.
 /// out_fields[0] is the start of the next line.
 /// Other entries are the start of fields (nul-teminated).
 /// Other entries are the start of fields (nul-teminated).
 /// Returns the number of fields found or -1 if an error occurs.
 /// Returns the number of fields found or -1 if an error occurs.
-size_t sv_split( char* str, size_t len, size_t startoff, char delim, char** out_fields, size_t nfields, int opt, bool& error );
+size_t sv_split( char* str, size_t len, size_t startoff, char delim, char** out_fields, size_t nfields, int32 opt, bool& error );
 
 
 /// Escapes src to out_dest according to the format of the C compiler.
 /// Escapes src to out_dest according to the format of the C compiler.
 /// Returns the length of the escaped string.
 /// Returns the length of the escaped string.
@@ -143,19 +143,19 @@ struct StringBuf
 };
 };
 typedef struct StringBuf StringBuf;
 typedef struct StringBuf StringBuf;
 
 
-StringBuf* _StringBuf_Malloc(const char *file, int line, const char *func);
+StringBuf* _StringBuf_Malloc(const char *file, int32 line, const char *func);
 #define StringBuf_Malloc() _StringBuf_Malloc(ALC_MARK)
 #define StringBuf_Malloc() _StringBuf_Malloc(ALC_MARK)
-void _StringBuf_Init(const char *file, int line, const char *func, StringBuf* self);
+void _StringBuf_Init(const char *file, int32 line, const char *func, StringBuf* self);
 #define StringBuf_Init(self) _StringBuf_Init(ALC_MARK,self)
 #define StringBuf_Init(self) _StringBuf_Init(ALC_MARK,self)
-size_t _StringBuf_Printf( const char* file, int line, const char* func, StringBuf* self, const char* fmt, ... );
+size_t _StringBuf_Printf( const char* file, int32 line, const char* func, StringBuf* self, const char* fmt, ... );
 #define StringBuf_Printf(self,fmt,...) _StringBuf_Printf(ALC_MARK,self,fmt, ## __VA_ARGS__)
 #define StringBuf_Printf(self,fmt,...) _StringBuf_Printf(ALC_MARK,self,fmt, ## __VA_ARGS__)
-size_t _StringBuf_Vprintf( const char* file, int line, const char* func, StringBuf* self, const char* fmt, va_list args );
+size_t _StringBuf_Vprintf( const char* file, int32 line, const char* func, StringBuf* self, const char* fmt, va_list args );
 #define StringBuf_Vprintf(self,fmt,args) _StringBuf_Vprintf(ALC_MARK,self,fmt,args)
 #define StringBuf_Vprintf(self,fmt,args) _StringBuf_Vprintf(ALC_MARK,self,fmt,args)
-size_t _StringBuf_Append(const char *file, int line, const char *func, StringBuf* self, const StringBuf *sbuf);
+size_t _StringBuf_Append(const char *file, int32 line, const char *func, StringBuf* self, const StringBuf *sbuf);
 #define StringBuf_Append(self,sbuf) _StringBuf_Append(ALC_MARK,self,sbuf)
 #define StringBuf_Append(self,sbuf) _StringBuf_Append(ALC_MARK,self,sbuf)
-size_t _StringBuf_AppendStr(const char *file, int line, const char *func, StringBuf* self, const char* str);
+size_t _StringBuf_AppendStr(const char *file, int32 line, const char *func, StringBuf* self, const char* str);
 #define StringBuf_AppendStr(self,str) _StringBuf_AppendStr(ALC_MARK,self,str)
 #define StringBuf_AppendStr(self,str) _StringBuf_AppendStr(ALC_MARK,self,str)
-int StringBuf_Length(StringBuf* self);
+int32 StringBuf_Length(StringBuf* self);
 char* StringBuf_Value(StringBuf* self);
 char* StringBuf_Value(StringBuf* self);
 void StringBuf_Clear(StringBuf* self);
 void StringBuf_Clear(StringBuf* self);
 void StringBuf_Destroy(StringBuf* self);
 void StringBuf_Destroy(StringBuf* self);

+ 25 - 25
src/common/timer.cpp

@@ -26,13 +26,13 @@ const t_tick TIMER_MAX_INTERVAL = 1000;
 
 
 // timers (array)
 // timers (array)
 static struct TimerData* timer_data = nullptr;
 static struct TimerData* timer_data = nullptr;
-static int timer_data_max = 0;
-static int timer_data_num = 0;
+static int32 timer_data_max = 0;
+static int32 timer_data_num = 0;
 
 
 // free timers (array)
 // free timers (array)
 static int* free_timer_list = nullptr;
 static int* free_timer_list = nullptr;
-static int free_timer_list_max = 0;
-static int free_timer_list_pos = 0;
+static int32 free_timer_list_max = 0;
+static int32 free_timer_list_pos = 0;
 
 
 
 
 /// Comparator for the timer heap. (minimum tick at top)
 /// Comparator for the timer heap. (minimum tick at top)
@@ -61,7 +61,7 @@ struct timer_func_list {
 } *tfl_root = nullptr;
 } *tfl_root = nullptr;
 
 
 /// Sets the name of a timer function.
 /// Sets the name of a timer function.
-int add_timer_func_list(TimerFunc func, const char* name)
+int32 add_timer_func_list(TimerFunc func, const char* name)
 {
 {
 	struct timer_func_list* tfl;
 	struct timer_func_list* tfl;
 
 
@@ -171,7 +171,7 @@ static t_tick tick(void)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 // tick is cached for TICK_CACHE calls
 // tick is cached for TICK_CACHE calls
 static t_tick gettick_cache;
 static t_tick gettick_cache;
-static int gettick_count = 1;
+static int32 gettick_count = 1;
 
 
 t_tick gettick_nocache(void)
 t_tick gettick_nocache(void)
 {
 {
@@ -206,7 +206,7 @@ t_tick gettick(void)
  *--------------------------------------*/
  *--------------------------------------*/
 
 
 /// Adds a timer to the timer_heap
 /// Adds a timer to the timer_heap
-static void push_timer_heap(int tid)
+static void push_timer_heap(int32 tid)
 {
 {
 	BHEAP_ENSURE(timer_heap, 1, 256);
 	BHEAP_ENSURE(timer_heap, 1, 256);
 	BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP);
 	BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP);
@@ -217,9 +217,9 @@ static void push_timer_heap(int tid)
  *--------------------------*/
  *--------------------------*/
 
 
 /// Returns a free timer id.
 /// Returns a free timer id.
-static int acquire_timer(void)
+static int32 acquire_timer(void)
 {
 {
-	int tid;
+	int32 tid;
 
 
 	// select a free timer
 	// select a free timer
 	if (free_timer_list_pos) {
 	if (free_timer_list_pos) {
@@ -250,9 +250,9 @@ static int acquire_timer(void)
 
 
 /// Starts a new timer that is deleted once it expires (single-use).
 /// Starts a new timer that is deleted once it expires (single-use).
 /// Returns the timer's id.
 /// Returns the timer's id.
-int add_timer(t_tick tick, TimerFunc func, int id, intptr_t data)
+int32 add_timer(t_tick tick, TimerFunc func, int32 id, intptr_t data)
 {
 {
-	int tid;
+	int32 tid;
 
 
 	tid = acquire_timer();
 	tid = acquire_timer();
 	timer_data[tid].tick     = tick;
 	timer_data[tid].tick     = tick;
@@ -268,9 +268,9 @@ int add_timer(t_tick tick, TimerFunc func, int id, intptr_t data)
 
 
 /// Starts a new timer that automatically restarts itself (infinite loop until manually removed).
 /// Starts a new timer that automatically restarts itself (infinite loop until manually removed).
 /// Returns the timer's id, or INVALID_TIMER if it fails.
 /// Returns the timer's id, or INVALID_TIMER if it fails.
-int add_timer_interval(t_tick tick, TimerFunc func, int id, intptr_t data, int interval)
+int32 add_timer_interval(t_tick tick, TimerFunc func, int32 id, intptr_t data, int32 interval)
 {
 {
-	int tid;
+	int32 tid;
 
 
 	if( interval < 1 )
 	if( interval < 1 )
 	{
 	{
@@ -291,7 +291,7 @@ int add_timer_interval(t_tick tick, TimerFunc func, int id, intptr_t data, int i
 }
 }
 
 
 /// Retrieves internal timer data
 /// Retrieves internal timer data
-const struct TimerData* get_timer(int tid)
+const struct TimerData* get_timer(int32 tid)
 {
 {
 	return ( tid >= 0 && tid < timer_data_num ) ? &timer_data[tid] : nullptr;
 	return ( tid >= 0 && tid < timer_data_num ) ? &timer_data[tid] : nullptr;
 }
 }
@@ -299,7 +299,7 @@ const struct TimerData* get_timer(int tid)
 /// Marks a timer specified by 'id' for immediate deletion once it expires.
 /// Marks a timer specified by 'id' for immediate deletion once it expires.
 /// Param 'func' is used for debug/verification purposes.
 /// Param 'func' is used for debug/verification purposes.
 /// Returns 0 on success, < 0 on failure.
 /// Returns 0 on success, < 0 on failure.
-int delete_timer(int tid, TimerFunc func)
+int32 delete_timer(int32 tid, TimerFunc func)
 {
 {
 	if( tid < 0 || tid >= timer_data_num )
 	if( tid < 0 || tid >= timer_data_num )
 	{
 	{
@@ -320,14 +320,14 @@ int delete_timer(int tid, TimerFunc func)
 
 
 /// Adjusts a timer's expiration time.
 /// Adjusts a timer's expiration time.
 /// Returns the new tick value, or -1 if it fails.
 /// Returns the new tick value, or -1 if it fails.
-t_tick addtick_timer(int tid, t_tick tick)
+t_tick addtick_timer(int32 tid, t_tick tick)
 {
 {
 	return settick_timer(tid, timer_data[tid].tick+tick);
 	return settick_timer(tid, timer_data[tid].tick+tick);
 }
 }
 
 
 /// Modifies a timer's expiration time (an alternative to deleting a timer and starting a new one).
 /// Modifies a timer's expiration time (an alternative to deleting a timer and starting a new one).
 /// Returns the new tick value, or -1 if it fails.
 /// Returns the new tick value, or -1 if it fails.
-t_tick settick_timer(int tid, t_tick tick)
+t_tick settick_timer(int32 tid, t_tick tick)
 {
 {
 	size_t i;
 	size_t i;
 
 
@@ -361,7 +361,7 @@ t_tick do_timer(t_tick tick)
 	// process all timers one by one
 	// process all timers one by one
 	while( BHEAP_LENGTH(timer_heap) )
 	while( BHEAP_LENGTH(timer_heap) )
 	{
 	{
-		int tid = BHEAP_PEEK(timer_heap);// top element in heap (smallest tick)
+		int32 tid = BHEAP_PEEK(timer_heap);// top element in heap (smallest tick)
 
 
 		diff = DIFF_TICK(timer_data[tid].tick, tick);
 		diff = DIFF_TICK(timer_data[tid].tick, tick);
 		if( diff > 0 )
 		if( diff > 0 )
@@ -434,12 +434,12 @@ const char* timestamp2string(char* str, size_t size, time_t timestamp, const cha
 /*
 /*
  * Split given timein into year, month, day, hour, minute, second
  * Split given timein into year, month, day, hour, minute, second
  */
  */
-void split_time(int timein, int* year, int* month, int* day, int* hour, int* minute, int *second) {
-	const int factor_min = 60;
-	const int factor_hour = factor_min*60;
-	const int factor_day = factor_hour*24;
-	const int factor_month = 2629743; // Approx  (30.44 days) 
-	const int factor_year = 31556926; // Approx (365.24 days)
+void split_time(int32 timein, int* year, int* month, int* day, int* hour, int* minute, int32 *second) {
+	const int32 factor_min = 60;
+	const int32 factor_hour = factor_min*60;
+	const int32 factor_day = factor_hour*24;
+	const int32 factor_month = 2629743; // Approx  (30.44 days) 
+	const int32 factor_year = 31556926; // Approx (365.24 days)
 
 
 	*year = timein/factor_year;
 	*year = timein/factor_year;
 	timein -= *year*factor_year;
 	timein -= *year*factor_year;
@@ -474,7 +474,7 @@ double solve_time(char* modif_p) {
 	nullpo_retr(0,modif_p);
 	nullpo_retr(0,modif_p);
 
 
 	while (modif_p[0] != '\0') {
 	while (modif_p[0] != '\0') {
-		int value = atoi(modif_p);
+		int32 value = atoi(modif_p);
 		if (value == 0)
 		if (value == 0)
 			modif_p++;
 			modif_p++;
 		else {
 		else {

+ 11 - 11
src/common/timer.hpp

@@ -30,7 +30,7 @@ enum {
 	TIMER_REMOVE_HEAP = 0x10,
 	TIMER_REMOVE_HEAP = 0x10,
 };
 };
 
 
-#define TIMER_FUNC(x) int x ( int tid, t_tick tick, int id, intptr_t data )
+#define TIMER_FUNC(x) int32 x ( int32 tid, t_tick tick, int32 id, intptr_t data )
 
 
 // Struct declaration
 // Struct declaration
 typedef TIMER_FUNC((*TimerFunc));
 typedef TIMER_FUNC((*TimerFunc));
@@ -39,10 +39,10 @@ struct TimerData {
 	t_tick tick;
 	t_tick tick;
 	TimerFunc func;
 	TimerFunc func;
 	uint32 type;
 	uint32 type;
-	int interval;
+	int32 interval;
 
 
 	// general-purpose storage
 	// general-purpose storage
-	int id;
+	int32 id;
 	intptr_t data;
 	intptr_t data;
 };
 };
 
 
@@ -51,21 +51,21 @@ struct TimerData {
 t_tick gettick(void);
 t_tick gettick(void);
 t_tick gettick_nocache(void);
 t_tick gettick_nocache(void);
 
 
-int add_timer(t_tick tick, TimerFunc func, int id, intptr_t data);
-int add_timer_interval(t_tick tick, TimerFunc func, int id, intptr_t data, int interval);
-const struct TimerData* get_timer(int tid);
-int delete_timer(int tid, TimerFunc func);
+int32 add_timer(t_tick tick, TimerFunc func, int32 id, intptr_t data);
+int32 add_timer_interval(t_tick tick, TimerFunc func, int32 id, intptr_t data, int32 interval);
+const struct TimerData* get_timer(int32 tid);
+int32 delete_timer(int32 tid, TimerFunc func);
 
 
-t_tick addtick_timer(int tid, t_tick tick);
-t_tick settick_timer(int tid, t_tick tick);
+t_tick addtick_timer(int32 tid, t_tick tick);
+t_tick settick_timer(int32 tid, t_tick tick);
 
 
-int add_timer_func_list(TimerFunc func, const char* name);
+int32 add_timer_func_list(TimerFunc func, const char* name);
 
 
 unsigned long get_uptime(void);
 unsigned long get_uptime(void);
 
 
 //transform a timestamp to string
 //transform a timestamp to string
 const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format);
 const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format);
-void split_time(int time, int* year, int* month, int* day, int* hour, int* minute, int* second);
+void split_time(int32 time, int* year, int* month, int* day, int* hour, int* minute, int* second);
 double solve_time(char* modif_p);
 double solve_time(char* modif_p);
 
 
 t_tick do_timer(t_tick tick);
 t_tick do_timer(t_tick tick);

+ 5 - 3
src/common/utilities.cpp

@@ -9,6 +9,8 @@
 #include <numeric> //iota
 #include <numeric> //iota
 #include <string>
 #include <string>
 
 
+#include "cbasetypes.hpp"
+
 #ifndef __has_builtin
 #ifndef __has_builtin
 	#define __has_builtin(x) 0
 	#define __has_builtin(x) 0
 #endif
 #endif
@@ -38,12 +40,12 @@ cScopeTimer::cScopeTimer()
  * @author http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#C.2B.2B
  * @author http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#C.2B.2B
  * comparison test was done here http://cpp.sh/2o7w
  * comparison test was done here http://cpp.sh/2o7w
  */
  */
-int levenshtein(const std::string &s1, const std::string &s2)
+int32 levenshtein(const std::string &s1, const std::string &s2)
 {
 {
 	// To change the type this function manipulates and returns, change
 	// To change the type this function manipulates and returns, change
 	// the return type and the types of the two variables below.
 	// the return type and the types of the two variables below.
-	int s1len = static_cast<int>(s1.size());
-	int s2len = static_cast<int>(s2.size());
+	int32 s1len = static_cast<int>(s1.size());
+	int32 s2len = static_cast<int>(s2.size());
 	
 	
 	auto column_start = (decltype(s1len))1;
 	auto column_start = (decltype(s1len))1;
 	
 	

+ 1 - 1
src/common/utilities.hpp

@@ -27,7 +27,7 @@ class cScopeTimer {
 	cScopeTimer();
 	cScopeTimer();
 };
 };
 
 
-int levenshtein( const std::string &s1, const std::string &s2 );
+int32 levenshtein( const std::string &s1, const std::string &s2 );
 
 
 namespace rathena {
 namespace rathena {
 	namespace util {
 	namespace util {

+ 4 - 4
src/common/utils.cpp

@@ -150,7 +150,7 @@ void findfile(const char *p, const char *pat, void (func)(const char*))
  *         2 = File
  *         2 = File
  *         3 = File but doesn't exist
  *         3 = File but doesn't exist
  */
  */
-int check_filepath(const char* filepath)
+int32 check_filepath(const char* filepath)
 {
 {
 	DWORD Attribute;
 	DWORD Attribute;
 
 
@@ -179,7 +179,7 @@ int check_filepath(const char* filepath)
  *         2 = File
  *         2 = File
  *         3 = Neither a file or directory
  *         3 = Neither a file or directory
  */
  */
-int check_filepath(const char* filepath)
+int32 check_filepath(const char* filepath)
 {
 {
 	struct stat s;
 	struct stat s;
 
 
@@ -264,7 +264,7 @@ bool exists(const char* filename)
 	return !access(filename, F_OK);
 	return !access(filename, F_OK);
 }
 }
 
 
-uint8 GetByte(uint32 val, int idx)
+uint8 GetByte(uint32 val, int32 idx)
 {
 {
 	switch( idx )
 	switch( idx )
 	{
 	{
@@ -280,7 +280,7 @@ uint8 GetByte(uint32 val, int idx)
 	}
 	}
 }
 }
 
 
-uint16 GetWord(uint32 val, int idx)
+uint16 GetWord(uint32 val, int32 idx)
 {
 {
 	switch( idx )
 	switch( idx )
 	{
 	{

+ 3 - 3
src/common/utils.hpp

@@ -12,7 +12,7 @@
 void WriteDump(FILE* fp, const void* buffer, size_t length);
 void WriteDump(FILE* fp, const void* buffer, size_t length);
 void ShowDump(const void* buffer, size_t length);
 void ShowDump(const void* buffer, size_t length);
 
 
-int check_filepath(const char* filepath);
+int32 check_filepath(const char* filepath);
 void findfile(const char *p, const char *pat, void (func)(const char*));
 void findfile(const char *p, const char *pat, void (func)(const char*));
 bool exists(const char* filename);
 bool exists(const char* filename);
 
 
@@ -33,8 +33,8 @@ uint32 get_percentage_exp(const uint64 a, const uint64 b);
 // byte word dword access [Shinomori]
 // byte word dword access [Shinomori]
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 
 
-extern uint8 GetByte(uint32 val, int idx);
-extern uint16 GetWord(uint32 val, int idx);
+extern uint8 GetByte(uint32 val, int32 idx);
+extern uint16 GetWord(uint32 val, int32 idx);
 extern uint16 MakeWord(uint8 byte0, uint8 byte1);
 extern uint16 MakeWord(uint8 byte0, uint8 byte1);
 extern uint32 MakeDWord(uint16 word0, uint16 word1);
 extern uint32 MakeDWord(uint16 word0, uint16 word1);
 
 

+ 1 - 1
src/config/core.hpp

@@ -105,7 +105,7 @@
 #endif
 #endif
 
 
 /// Uncomment to forcibly disable the detailed loading output.
 /// Uncomment to forcibly disable the detailed loading output.
-/// This will noticeably decrease the boot time of the map server by not having to print so many status messages.
+/// This will noticeably decrease the boot time of the map server by not having to print32 so many status messages.
 //#undef DETAILED_LOADING_OUTPUT
 //#undef DETAILED_LOADING_OUTPUT
 
 
 /**
 /**

+ 10 - 10
src/login/account.cpp

@@ -41,7 +41,7 @@ typedef struct AccountDB_SQL {
 typedef struct AccountDBIterator_SQL {
 typedef struct AccountDBIterator_SQL {
 	AccountDBIterator vtable;    // public interface
 	AccountDBIterator vtable;    // public interface
 	AccountDB_SQL* db;
 	AccountDB_SQL* db;
-	int last_account_id;
+	int32 last_account_id;
 } AccountDBIterator_SQL;
 } AccountDBIterator_SQL;
 
 
 /// internal functions
 /// internal functions
@@ -657,8 +657,8 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo
 			break;
 			break;
 		}
 		}
 
 
-		const int MAX_RETRIES = 20;
-		int i = 0;
+		const int32 MAX_RETRIES = 20;
+		int32 i = 0;
 		bool success = false;
 		bool success = false;
 
 
 		// Retry it for a maximum number of retries
 		// Retry it for a maximum number of retries
@@ -707,13 +707,13 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo
 	return result;
 	return result;
 }
 }
 
 
-void mmo_save_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 char_id) {
+void mmo_save_global_accreg(AccountDB* self, int32 fd, uint32 account_id, uint32 char_id) {
 	Sql* sql_handle = ((AccountDB_SQL*)self)->accounts;
 	Sql* sql_handle = ((AccountDB_SQL*)self)->accounts;
 	AccountDB_SQL* db = (AccountDB_SQL*)self;
 	AccountDB_SQL* db = (AccountDB_SQL*)self;
 	uint16 count = RFIFOW(fd, 12);
 	uint16 count = RFIFOW(fd, 12);
 
 
 	if (count) {
 	if (count) {
-		int cursor = 14, i;
+		int32 cursor = 14, i;
 		char key[32], sval[254], esc_key[32*2+1], esc_sval[254*2+1];
 		char key[32], sval[254], esc_key[32*2+1], esc_sval[254*2+1];
 
 
 		for (i = 0; i < count; i++) {
 		for (i = 0; i < count; i++) {
@@ -726,7 +726,7 @@ void mmo_save_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 c
 			cursor += 4;
 			cursor += 4;
 
 
 			switch (RFIFOB(fd, cursor++)) {
 			switch (RFIFOB(fd, cursor++)) {
-				// int
+				// int32
 				case 0:
 				case 0:
 					if( SQL_ERROR == Sql_Query(sql_handle, "REPLACE INTO `%s` (`account_id`,`key`,`index`,`value`) VALUES ('%" PRIu32 "','%s','%" PRIu32 "','%" PRId64 "')", db->global_acc_reg_num_table, account_id, esc_key, index, RFIFOQ(fd, cursor)) )
 					if( SQL_ERROR == Sql_Query(sql_handle, "REPLACE INTO `%s` (`account_id`,`key`,`index`,`value`) VALUES ('%" PRIu32 "','%s','%" PRIu32 "','%" PRId64 "')", db->global_acc_reg_num_table, account_id, esc_key, index, RFIFOQ(fd, cursor)) )
 						Sql_ShowDebug(sql_handle);
 						Sql_ShowDebug(sql_handle);
@@ -756,7 +756,7 @@ void mmo_save_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 c
 	}
 	}
 }
 }
 
 
-void mmo_send_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 char_id) {
+void mmo_send_global_accreg(AccountDB* self, int32 fd, uint32 account_id, uint32 char_id) {
 	Sql* sql_handle = ((AccountDB_SQL*)self)->accounts;
 	Sql* sql_handle = ((AccountDB_SQL*)self)->accounts;
 	AccountDB_SQL* db = (AccountDB_SQL*)self;
 	AccountDB_SQL* db = (AccountDB_SQL*)self;
 	char* data;
 	char* data;
@@ -839,14 +839,14 @@ void mmo_send_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 c
 	WFIFOL(fd, 4) = account_id;
 	WFIFOL(fd, 4) = account_id;
 	WFIFOL(fd, 8) = char_id;
 	WFIFOL(fd, 8) = char_id;
 	WFIFOB(fd, 12) = 0; // var type (only set when all vars have been sent, regardless of type)
 	WFIFOB(fd, 12) = 0; // var type (only set when all vars have been sent, regardless of type)
-	WFIFOB(fd, 13) = 0; // is int type
+	WFIFOB(fd, 13) = 0; // is int32 type
 	WFIFOW(fd, 14) = 0; // count
 	WFIFOW(fd, 14) = 0; // count
 	plen = 16;
 	plen = 16;
 
 
 	/**
 	/**
 	 * Vessel!
 	 * Vessel!
 	 *
 	 *
-	 * int type
+	 * int32 type
 	 * { keyLength(B), key(<keyLength>), index(L), value(L) }
 	 * { keyLength(B), key(<keyLength>), index(L), value(L) }
 	 **/
 	 **/
 	while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
 	while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
@@ -882,7 +882,7 @@ void mmo_send_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 c
 			WFIFOL(fd, 4) = account_id;
 			WFIFOL(fd, 4) = account_id;
 			WFIFOL(fd, 8) = char_id;
 			WFIFOL(fd, 8) = char_id;
 			WFIFOB(fd, 12) = 0; // var type (only set when all vars have been sent, regardless of type)
 			WFIFOB(fd, 12) = 0; // var type (only set when all vars have been sent, regardless of type)
-			WFIFOB(fd, 13) = 0; // is int type
+			WFIFOB(fd, 13) = 0; // is int32 type
 			WFIFOW(fd, 14) = 0; // count
 			WFIFOW(fd, 14) = 0; // count
 
 
 			plen = 16;
 			plen = 16;

+ 3 - 3
src/login/account.hpp

@@ -34,7 +34,7 @@ struct mmo_account {
 	time_t pincode_change;	// (timestamp): last time of pincode change
 	time_t pincode_change;	// (timestamp): last time of pincode change
 	char web_auth_token[WEB_AUTH_TOKEN_LENGTH]; // web authentication token (randomized on each login)
 	char web_auth_token[WEB_AUTH_TOKEN_LENGTH]; // web authentication token (randomized on each login)
 #ifdef VIP_ENABLE
 #ifdef VIP_ENABLE
-	int old_group;
+	int32 old_group;
 	time_t vip_time;
 	time_t vip_time;
 #endif
 #endif
 };
 };
@@ -143,7 +143,7 @@ struct AccountDB {
 	AccountDBIterator* (*iterator)(AccountDB* self);
 	AccountDBIterator* (*iterator)(AccountDB* self);
 };
 };
 
 
-void mmo_send_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 char_id);
-void mmo_save_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 char_id);
+void mmo_send_global_accreg(AccountDB* self, int32 fd, uint32 account_id, uint32 char_id);
+void mmo_save_global_accreg(AccountDB* self, int32 fd, uint32 account_id, uint32 char_id);
 
 
 #endif /* ACCOUNT_HPP */
 #endif /* ACCOUNT_HPP */

+ 2 - 2
src/login/ipban.cpp

@@ -26,7 +26,7 @@ std::string ipban_table = "ipbanlist";
 
 
 // globals
 // globals
 static Sql* sql_handle = nullptr;
 static Sql* sql_handle = nullptr;
-static int cleanup_timer_id = INVALID_TIMER;
+static int32 cleanup_timer_id = INVALID_TIMER;
 static bool ipban_inited = false;
 static bool ipban_inited = false;
 
 
 //early declaration
 //early declaration
@@ -40,7 +40,7 @@ TIMER_FUNC(ipban_cleanup);
 bool ipban_check(uint32 ip) {
 bool ipban_check(uint32 ip) {
 	uint8* p = (uint8*)&ip;
 	uint8* p = (uint8*)&ip;
 	char* data = nullptr;
 	char* data = nullptr;
-	int matches;
+	int32 matches;
 
 
 	if( !login_config.ipban )
 	if( !login_config.ipban )
 		return false;// ipban disabled
 		return false;// ipban disabled

+ 21 - 21
src/login/login.cpp

@@ -51,9 +51,9 @@ struct s_subnet {
 	uint32 char_ip;
 	uint32 char_ip;
 	uint32 map_ip;
 	uint32 map_ip;
 } subnet[16];
 } subnet[16];
-int subnet_count = 0; //number of subnet config
+int32 subnet_count = 0; //number of subnet config
 
 
-int login_fd; // login server file descriptor socket
+int32 login_fd; // login server file descriptor socket
 
 
 //early declaration
 //early declaration
 bool login_check_password( struct login_session_data& sd, struct mmo_account& acc );
 bool login_check_password( struct login_session_data& sd, struct mmo_account& acc );
@@ -65,7 +65,7 @@ AccountDB* login_get_accounts_db(void){
 
 
 // Console Command Parser [Wizputer]
 // Console Command Parser [Wizputer]
 //FIXME to be remove (moved to cnslif / will be done once map/char/login, all have their cnslif interface ready)
 //FIXME to be remove (moved to cnslif / will be done once map/char/login, all have their cnslif interface ready)
-int parse_console(const char* buf){
+int32 parse_console(const char* buf){
 	return cnslif_parse(buf);
 	return cnslif_parse(buf);
 }
 }
 
 
@@ -80,7 +80,7 @@ struct online_login_data* login_get_online_user( uint32 account_id ){
  * @param account_id : aid connected
  * @param account_id : aid connected
  * @return the new online_login_data for that user
  * @return the new online_login_data for that user
  */
  */
-struct online_login_data* login_add_online_user(int char_server, uint32 account_id){
+struct online_login_data* login_add_online_user(int32 char_server, uint32 account_id){
 	struct online_login_data* p = login_get_online_user( account_id );
 	struct online_login_data* p = login_get_online_user( account_id );
 
 
 	if( p == nullptr ){
 	if( p == nullptr ){
@@ -170,7 +170,7 @@ TIMER_FUNC(login_waiting_disconnect_timer){
 	return 0;
 	return 0;
 }
 }
 
 
-void login_online_db_setoffline( int char_server ){
+void login_online_db_setoffline( int32 char_server ){
 	for( std::pair<uint32,struct online_login_data> pair : online_db ){
 	for( std::pair<uint32,struct online_login_data> pair : online_db ){
 		if( char_server == -1 ){
 		if( char_server == -1 ){
 			pair.second.char_server = -1;
 			pair.second.char_server = -1;
@@ -218,8 +218,8 @@ static TIMER_FUNC(login_online_data_cleanup){
  *	1: incorrect pass or userid (userid|pass too short or already exist);
  *	1: incorrect pass or userid (userid|pass too short or already exist);
  *	3: registration limit exceeded;
  *	3: registration limit exceeded;
  */
  */
-int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) {
-	static int num_regs = 0; // registration counter
+int32 login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) {
+	static int32 num_regs = 0; // registration counter
 	static t_tick new_reg_tick = 0;
 	static t_tick new_reg_tick = 0;
 	t_tick tick = gettick();
 	t_tick tick = gettick();
 	struct mmo_account acc;
 	struct mmo_account acc;
@@ -290,7 +290,7 @@ int login_mmo_auth_new(const char* userid, const char* pass, const char sex, con
  *	6: banned
  *	6: banned
  *	x: acc state (TODO document me deeper)
  *	x: acc state (TODO document me deeper)
  */
  */
-int login_mmo_auth(struct login_session_data* sd, bool isServer) {
+int32 login_mmo_auth(struct login_session_data* sd, bool isServer) {
 	struct mmo_account acc;
 	struct mmo_account acc;
 
 
 	char ip[16];
 	char ip[16];
@@ -328,7 +328,7 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) {
 				return 0; // unregistered id
 				return 0; // unregistered id
 			}
 			}
 
 
-			int result;
+			int32 result;
 			// remove the _M/_F suffix
 			// remove the _M/_F suffix
 			len -= 2;
 			len -= 2;
 			sd->userid[len] = '\0';
 			sd->userid[len] = '\0';
@@ -388,7 +388,7 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) {
 
 
 		if( !match ) {
 		if( !match ) {
 			char smd5[33];
 			char smd5[33];
-			int i;
+			int32 i;
 
 
 			if( !sd->has_client_hash ) {
 			if( !sd->has_client_hash ) {
 				ShowNotice("Client didn't send client hash (account: %s, ip: %s)\n", sd->userid, ip);
 				ShowNotice("Client didn't send client hash (account: %s, ip: %s)\n", sd->userid, ip);
@@ -478,7 +478,7 @@ bool login_check_password( struct login_session_data& sd, struct mmo_account& ac
 	return false;
 	return false;
 }
 }
 
 
-int login_get_usercount( int users ){
+int32 login_get_usercount( int32 users ){
 #if PACKETVER >= 20170726
 #if PACKETVER >= 20170726
 	if( login_config.usercount_disable ){
 	if( login_config.usercount_disable ){
 		return 4; // Removes count and colorization completely
 		return 4; // Removes count and colorization completely
@@ -501,8 +501,8 @@ int login_get_usercount( int users ){
  * @param ip: ip to check if in auth network
  * @param ip: ip to check if in auth network
  * @return 0 if from wan, or subnet_char_ip if lan
  * @return 0 if from wan, or subnet_char_ip if lan
  */
  */
-int lan_subnetcheck(uint32 ip) {
-	int i;
+int32 lan_subnetcheck(uint32 ip) {
+	int32 i;
 	ARR_FIND( 0, subnet_count, i, (subnet[i].char_ip & subnet[i].mask) == (ip & subnet[i].mask) );
 	ARR_FIND( 0, subnet_count, i, (subnet[i].char_ip & subnet[i].mask) == (ip & subnet[i].mask) );
 	return ( i < subnet_count ) ? subnet[i].char_ip : 0;
 	return ( i < subnet_count ) ? subnet[i].char_ip : 0;
 }
 }
@@ -511,10 +511,10 @@ int lan_subnetcheck(uint32 ip) {
 
 
 
 
 /// Msg_conf tayloring
 /// Msg_conf tayloring
-int login_msg_config_read(const char *cfgName){
+int32 login_msg_config_read(const char *cfgName){
 	return _msg_config_read(cfgName,LOGIN_MAX_MSG,msg_table);
 	return _msg_config_read(cfgName,LOGIN_MAX_MSG,msg_table);
 }
 }
-const char* login_msg_txt(int msg_number){
+const char* login_msg_txt(int32 msg_number){
 	return _msg_txt(msg_number,LOGIN_MAX_MSG,msg_table);
 	return _msg_txt(msg_number,LOGIN_MAX_MSG,msg_table);
 }
 }
 void login_do_final_msg(void){
 void login_do_final_msg(void){
@@ -531,9 +531,9 @@ void login_do_final_msg(void){
  * @param lancfgName: Name of the lan configuration (could be fullpath)
  * @param lancfgName: Name of the lan configuration (could be fullpath)
  * @return 0:success, 1:failure (file not found|readable)
  * @return 0:success, 1:failure (file not found|readable)
  */
  */
-int login_lan_config_read(const char *lancfgName) {
+int32 login_lan_config_read(const char *lancfgName) {
 	FILE *fp;
 	FILE *fp;
-	int line_num = 0, s_subnet=ARRAYLENGTH(subnet);
+	int32 line_num = 0, s_subnet=ARRAYLENGTH(subnet);
 	char line[1024], w1[64], w2[64], w3[64], w4[64];
 	char line[1024], w1[64], w2[64], w3[64], w4[64];
 
 
 	if((fp = fopen(lancfgName, "r")) == nullptr) {
 	if((fp = fopen(lancfgName, "r")) == nullptr) {
@@ -666,7 +666,7 @@ bool login_config_read(const char* cfgName, bool normal) {
 		else if (!strcmpi(w1, "disable_webtoken_delay"))
 		else if (!strcmpi(w1, "disable_webtoken_delay"))
 			login_config.disable_webtoken_delay = cap_value(atoi(w2), 0, INT_MAX);
 			login_config.disable_webtoken_delay = cap_value(atoi(w2), 0, INT_MAX);
 		else if(!strcmpi(w1, "client_hash")) {
 		else if(!strcmpi(w1, "client_hash")) {
-			int group = 0;
+			int32 group = 0;
 			char md5[33];
 			char md5[33];
 
 
 			if (sscanf(w2, "%3d, %32s", &group, md5) == 2) {
 			if (sscanf(w2, "%3d, %32s", &group, md5) == 2) {
@@ -675,7 +675,7 @@ bool login_config_read(const char* cfgName, bool normal) {
 				if (strcmpi(md5, "disabled") == 0) {
 				if (strcmpi(md5, "disabled") == 0) {
 					nnode->hash[0] = '\0';
 					nnode->hash[0] = '\0';
 				} else {
 				} else {
-					int i;
+					int32 i;
 					for (i = 0; i < 32; i += 2) {
 					for (i = 0; i < 32; i += 2) {
 						char buf[3];
 						char buf[3];
 						uint32 byte;
 						uint32 byte;
@@ -847,7 +847,7 @@ void LoginServer::handle_shutdown(){
 	flush_fifos();
 	flush_fifos();
 }
 }
 
 
-bool LoginServer::initialize( int argc, char* argv[] ){
+bool LoginServer::initialize( int32 argc, char* argv[] ){
 	// Init default value
 	// Init default value
 	safestrncpy(console_log_filepath, "./log/login-msg_log.log", sizeof(console_log_filepath));
 	safestrncpy(console_log_filepath, "./log/login-msg_log.log", sizeof(console_log_filepath));
 
 
@@ -907,6 +907,6 @@ bool LoginServer::initialize( int argc, char* argv[] ){
 	return true;
 	return true;
 }
 }
 
 
-int main( int argc, char *argv[] ){
+int32 main( int32 argc, char *argv[] ){
 	return main_core<LoginServer>( argc, argv );
 	return main_core<LoginServer>( argc, argv );
 }
 }

+ 26 - 26
src/login/login.hpp

@@ -21,7 +21,7 @@ namespace rathena{
 	namespace server_login{
 	namespace server_login{
 		class LoginServer : public Core{
 		class LoginServer : public Core{
 			protected:
 			protected:
-				bool initialize( int argc, char* argv[] ) override;
+				bool initialize( int32 argc, char* argv[] ) override;
 				void finalize() override;
 				void finalize() override;
 				void handle_shutdown() override;
 				void handle_shutdown() override;
 
 
@@ -45,7 +45,7 @@ struct login_session_data {
 
 
 	char userid[NAME_LENGTH];	/// account name
 	char userid[NAME_LENGTH];	/// account name
 	char passwd[PASSWD_LENGTH]; // 23+1 for plaintext, 32+1 for md5-ed passwords
 	char passwd[PASSWD_LENGTH]; // 23+1 for plaintext, 32+1 for md5-ed passwords
-	int passwdenc;			/// was the passwd transmited encrypted or clear ?
+	int32 passwdenc;			/// was the passwd transmited encrypted or clear ?
 	char md5key[20];		/// md5 key of session (each connection could be encrypted with a md5 key)
 	char md5key[20];		/// md5 key of session (each connection could be encrypted with a md5 key)
 	uint16 md5keylen;		/// len of the md5 key
 	uint16 md5keylen;		/// len of the md5 key
 
 
@@ -54,9 +54,9 @@ struct login_session_data {
 	uint8 clienttype;		/// ???
 	uint8 clienttype;		/// ???
 
 
 	uint8 client_hash[16];		///hash of client
 	uint8 client_hash[16];		///hash of client
-	int has_client_hash;		///client ha sent an hash
+	int32 has_client_hash;		///client ha sent an hash
 
 
-	int fd;				///socket of client
+	int32 fd;				///socket of client
 
 
 	char web_auth_token[WEB_AUTH_TOKEN_LENGTH]; /// web authentication token
 	char web_auth_token[WEB_AUTH_TOKEN_LENGTH]; /// web authentication token
 };
 };
@@ -65,7 +65,7 @@ struct login_session_data {
 ///Struct describing 1 char-serv attach to us
 ///Struct describing 1 char-serv attach to us
 struct mmo_char_server {
 struct mmo_char_server {
 	char name[20];	///char-serv name
 	char name[20];	///char-serv name
-	int fd;			///char-serv socket (well actually file descriptor)
+	int32 fd;			///char-serv socket (well actually file descriptor)
 	uint32 ip;		///char-serv IP
 	uint32 ip;		///char-serv IP
 	uint16 port;	///char-serv rt
 	uint16 port;	///char-serv rt
 	uint16 users;	/// user count on this server
 	uint16 users;	/// user count on this server
@@ -91,10 +91,10 @@ struct Login_Config {
 	bool new_account_flag;                          /// autoregistration via _M/_F ?
 	bool new_account_flag;                          /// autoregistration via _M/_F ?
 	uint8 acc_name_min_length;                      /// minimum account name length
 	uint8 acc_name_min_length;                      /// minimum account name length
 	uint8 password_min_length;                      /// minimum password length
 	uint8 password_min_length;                      /// minimum password length
-	int start_limited_time;                         /// new account expiration time (-1: unlimited)
+	int32 start_limited_time;                         /// new account expiration time (-1: unlimited)
 	bool use_md5_passwds;                           /// work with password hashes instead of plaintext passwords?
 	bool use_md5_passwds;                           /// work with password hashes instead of plaintext passwords?
-	int group_id_to_connect;                        /// required group id to connect
-	int min_group_id_to_connect;                    /// minimum group id to connect
+	int32 group_id_to_connect;                        /// required group id to connect
+	int32 min_group_id_to_connect;                    /// minimum group id to connect
 
 
 	bool ipban;                                     /// perform IP blocking (via contents of `ipbanlist`) ?
 	bool ipban;                                     /// perform IP blocking (via contents of `ipbanlist`) ?
 	bool dynamic_pass_failure_ban;                  /// automatic IP blocking due to failed login attempts ?
 	bool dynamic_pass_failure_ban;                  /// automatic IP blocking due to failed login attempts ?
@@ -104,18 +104,18 @@ struct Login_Config {
 	bool use_dnsbl;                                 /// dns blacklist blocking ?
 	bool use_dnsbl;                                 /// dns blacklist blocking ?
 	char dnsbl_servs[1024];                         /// comma-separated list of dnsbl servers
 	char dnsbl_servs[1024];                         /// comma-separated list of dnsbl servers
 
 
-	int allowed_regs;								/// max number of registration
-	int time_allowed;								/// registration interval in seconds
+	int32 allowed_regs;								/// max number of registration
+	int32 time_allowed;								/// registration interval in seconds
 
 
-	int client_hash_check;							/// flags for checking client md5
+	int32 client_hash_check;							/// flags for checking client md5
 	struct client_hash_node *client_hash_nodes;		/// linked list containing md5 hash for each gm group
 	struct client_hash_node *client_hash_nodes;		/// linked list containing md5 hash for each gm group
 
 
 	bool usercount_disable;							/// Disable colorization and description in general?
 	bool usercount_disable;							/// Disable colorization and description in general?
-	int usercount_low;								/// Amount of users that will display in green
-	int usercount_medium;							/// Amount of users that will display in yellow
-	int usercount_high;								/// Amount of users that will display in red
+	int32 usercount_low;								/// Amount of users that will display in green
+	int32 usercount_medium;							/// Amount of users that will display in yellow
+	int32 usercount_high;								/// Amount of users that will display in red
 
 
-	int char_per_account;							/// number of characters an account can have
+	int32 char_per_account;							/// number of characters an account can have
 #ifdef VIP_ENABLE
 #ifdef VIP_ENABLE
 	struct {
 	struct {
 		uint32 group;								/// VIP group ID
 		uint32 group;								/// VIP group ID
@@ -123,7 +123,7 @@ struct Login_Config {
 	} vip_sys;
 	} vip_sys;
 #endif
 #endif
 	bool use_web_auth_token;						/// Enable web authentication token system
 	bool use_web_auth_token;						/// Enable web authentication token system
-	int disable_webtoken_delay;						/// delay disabling web token after char logs off in milliseconds
+	int32 disable_webtoken_delay;						/// delay disabling web token after char logs off in milliseconds
 };
 };
 extern struct Login_Config login_config;
 extern struct Login_Config login_config;
 
 
@@ -133,16 +133,16 @@ extern struct Login_Config login_config;
 #define msg_config_read(cfgName) login_msg_config_read(cfgName)
 #define msg_config_read(cfgName) login_msg_config_read(cfgName)
 #define msg_txt(msg_number) login_msg_txt(msg_number)
 #define msg_txt(msg_number) login_msg_txt(msg_number)
 #define do_final_msg() login_do_final_msg()
 #define do_final_msg() login_do_final_msg()
-int login_msg_config_read(const char *cfgName);
-const char* login_msg_txt(int msg_number);
+int32 login_msg_config_read(const char *cfgName);
+const char* login_msg_txt(int32 msg_number);
 void login_do_final_msg(void);
 void login_do_final_msg(void);
 bool login_config_read(const char* cfgName, bool normal);
 bool login_config_read(const char* cfgName, bool normal);
 
 
 /// Online User Database [Wizputer]
 /// Online User Database [Wizputer]
 struct online_login_data {
 struct online_login_data {
 	uint32 account_id;
 	uint32 account_id;
-	int waiting_disconnect;
-	int char_server;
+	int32 waiting_disconnect;
+	int32 char_server;
 };
 };
 
 
 /// Auth database
 /// Auth database
@@ -169,7 +169,7 @@ struct online_login_data* login_get_online_user( uint32 account_id );
  * @param account_id: the account identifier
  * @param account_id: the account identifier
  * @return the new|registered online data
  * @return the new|registered online data
  */
  */
-struct online_login_data* login_add_online_user(int char_server, uint32 account_id);
+struct online_login_data* login_add_online_user(int32 char_server, uint32 account_id);
 
 
 /**
 /**
  * Function to remove a user from online_db.
  * Function to remove a user from online_db.
@@ -197,14 +197,14 @@ void login_remove_auth_node( uint32 account_id );
  */
  */
 TIMER_FUNC(login_waiting_disconnect_timer);
 TIMER_FUNC(login_waiting_disconnect_timer);
 
 
-void login_online_db_setoffline( int char_server );
+void login_online_db_setoffline( int32 char_server );
 
 
 /**
 /**
  * Test to determine if an IP come from LAN or WAN.
  * Test to determine if an IP come from LAN or WAN.
  * @param ip: ip to check if in auth network
  * @param ip: ip to check if in auth network
  * @return 0 if from wan, or subnet_char_ip if lan
  * @return 0 if from wan, or subnet_char_ip if lan
  */
  */
-int lan_subnetcheck(uint32 ip);
+int32 lan_subnetcheck(uint32 ip);
 
 
 
 
 /**
 /**
@@ -219,7 +219,7 @@ int lan_subnetcheck(uint32 ip);
  *	1: incorrect pass or userid (userid|pass too short or already exist);
  *	1: incorrect pass or userid (userid|pass too short or already exist);
  *	3: registration limit exceeded;
  *	3: registration limit exceeded;
  */
  */
-int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip);
+int32 login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip);
 
 
 /**
 /**
  * Check/authentication of a connection.
  * Check/authentication of a connection.
@@ -235,8 +235,8 @@ int login_mmo_auth_new(const char* userid, const char* pass, const char sex, con
  *	6: banned
  *	6: banned
  *	x: acc state (TODO document me deeper)
  *	x: acc state (TODO document me deeper)
  */
  */
-int login_mmo_auth(struct login_session_data* sd, bool isServer);
+int32 login_mmo_auth(struct login_session_data* sd, bool isServer);
 
 
-int login_get_usercount( int users );
+int32 login_get_usercount( int32 users );
 
 
 #endif /* LOGIN_HPP */
 #endif /* LOGIN_HPP */

+ 45 - 45
src/login/loginchrif.cpp

@@ -8,7 +8,7 @@
 
 
 #include <common/showmsg.hpp> //show notice
 #include <common/showmsg.hpp> //show notice
 #include <common/socket.hpp> //wfifo session
 #include <common/socket.hpp> //wfifo session
-#include <common/strlib.hpp> //safeprint
+#include <common/strlib.hpp> //safeprint32
 #include <common/timer.hpp> //difftick
 #include <common/timer.hpp> //difftick
 
 
 #include "account.hpp"
 #include "account.hpp"
@@ -16,7 +16,7 @@
 #include "loginlog.hpp"
 #include "loginlog.hpp"
 
 
 //early declaration
 //early declaration
-void logchrif_on_disconnect(int id);
+void logchrif_on_disconnect(int32 id);
 
 
 /**
 /**
  * Packet send to all char-servers, except one. (wos: without our self)
  * Packet send to all char-servers, except one. (wos: without our self)
@@ -25,10 +25,10 @@ void logchrif_on_disconnect(int id);
  * @param len: size of packet
  * @param len: size of packet
  * @return : the number of char-serv the packet was sent to
  * @return : the number of char-serv the packet was sent to
  */
  */
-int logchrif_sendallwos(int sfd, uint8* buf, size_t len) {
-	int i, c;
+int32 logchrif_sendallwos(int32 sfd, uint8* buf, size_t len) {
+	int32 i, c;
 	for( i = 0, c = 0; i < ARRAYLENGTH(ch_server); ++i ) {
 	for( i = 0, c = 0; i < ARRAYLENGTH(ch_server); ++i ) {
-		int fd = ch_server[i].fd;
+		int32 fd = ch_server[i].fd;
 		if( session_isValid(fd) && fd != sfd ){
 		if( session_isValid(fd) && fd != sfd ){
 			WFIFOHEAD(fd,len);
 			WFIFOHEAD(fd,len);
 			memcpy(WFIFOP(fd,0), buf, len);
 			memcpy(WFIFOP(fd,0), buf, len);
@@ -69,7 +69,7 @@ TIMER_FUNC(logchrif_sync_ip_addresses){
  * @param ip: char-serv ip (used for info)
  * @param ip: char-serv ip (used for info)
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_reqauth(int fd, int id,char* ip){
+int32 logchrif_parse_reqauth(int32 fd, int32 id,char* ip){
 	if( RFIFOREST(fd) < 23 )
 	if( RFIFOREST(fd) < 23 )
 		return 0;
 		return 0;
 	else{
 	else{
@@ -78,7 +78,7 @@ int logchrif_parse_reqauth(int fd, int id,char* ip){
 		uint32 login_id2 = RFIFOL(fd,10);
 		uint32 login_id2 = RFIFOL(fd,10);
 		uint8 sex = RFIFOB(fd,14);
 		uint8 sex = RFIFOB(fd,14);
 		//uint32 ip_ = ntohl(RFIFOL(fd,15));
 		//uint32 ip_ = ntohl(RFIFOL(fd,15));
-		int request_id = RFIFOL(fd,19);
+		int32 request_id = RFIFOL(fd,19);
 		RFIFOSKIP(fd,23);
 		RFIFOSKIP(fd,23);
 
 
 		struct auth_node* node = login_get_auth_node( account_id );
 		struct auth_node* node = login_get_auth_node( account_id );
@@ -129,11 +129,11 @@ int logchrif_parse_reqauth(int fd, int id,char* ip){
  * @param id: id of char-serv
  * @param id: id of char-serv
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_ackusercount(int fd, int id){
+int32 logchrif_parse_ackusercount(int32 fd, int32 id){
 	if( RFIFOREST(fd) < 6 )
 	if( RFIFOREST(fd) < 6 )
 		return 0;
 		return 0;
 	else{
 	else{
-		int users = RFIFOL(fd,2);
+		int32 users = RFIFOL(fd,2);
 		RFIFOSKIP(fd,6);
 		RFIFOSKIP(fd,6);
 		// how many users on world? (update)
 		// how many users on world? (update)
 		if( ch_server[id].users != users ){
 		if( ch_server[id].users != users ){
@@ -150,11 +150,11 @@ int logchrif_parse_ackusercount(int fd, int id){
  *  isvip.1B char_vip.1B max_billing.1B (tot 75)  
  *  isvip.1B char_vip.1B max_billing.1B (tot 75)  
  * @return -1 : account not found, 1:sucess
  * @return -1 : account not found, 1:sucess
  */
  */
-int logchrif_send_accdata(int fd, uint32 aid) {
+int32 logchrif_send_accdata(int32 fd, uint32 aid) {
 	struct mmo_account acc;
 	struct mmo_account acc;
 	time_t expiration_time = 0;
 	time_t expiration_time = 0;
 	char email[40] = "";
 	char email[40] = "";
-	int group_id = 0;
+	int32 group_id = 0;
 	char birthdate[10+1] = "";
 	char birthdate[10+1] = "";
 	char pincode[PINCODE_LENGTH+1];
 	char pincode[PINCODE_LENGTH+1];
 	char isvip = false;
 	char isvip = false;
@@ -211,7 +211,7 @@ int logchrif_send_accdata(int fd, uint32 aid) {
  * @param flag 0x1: VIP, 0x2: GM, 0x4: Show rates on player
  * @param flag 0x1: VIP, 0x2: GM, 0x4: Show rates on player
  * @param mapfd
  * @param mapfd
  */
  */
-int logchrif_sendvipdata(int fd, struct mmo_account* acc, unsigned char flag, int mapfd) {
+int32 logchrif_sendvipdata(int32 fd, struct mmo_account* acc, unsigned char flag, int32 mapfd) {
 #ifdef VIP_ENABLE
 #ifdef VIP_ENABLE
 	WFIFOHEAD(fd,19);
 	WFIFOHEAD(fd,19);
 	WFIFOW(fd,0) = 0x2743;
 	WFIFOW(fd,0) = 0x2743;
@@ -233,7 +233,7 @@ int logchrif_sendvipdata(int fd, struct mmo_account* acc, unsigned char flag, in
  * @param ip: char-serv ip (used for info)
  * @param ip: char-serv ip (used for info)
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_reqaccdata(int fd, int id, char *ip){
+int32 logchrif_parse_reqaccdata(int32 fd, int32 id, char *ip){
 	if( RFIFOREST(fd) < 6 )
 	if( RFIFOREST(fd) < 6 )
 		return 0;
 		return 0;
 	else {
 	else {
@@ -250,7 +250,7 @@ int logchrif_parse_reqaccdata(int fd, int id, char *ip){
  * @param fd: fd to parse from (char-serv)
  * @param fd: fd to parse from (char-serv)
  * @return 1 success
  * @return 1 success
  */
  */
-int logchrif_parse_keepalive(int fd){
+int32 logchrif_parse_keepalive(int32 fd){
 	RFIFOSKIP(fd,2);
 	RFIFOSKIP(fd,2);
 	WFIFOHEAD(fd,2);
 	WFIFOHEAD(fd,2);
 	WFIFOW(fd,0) = 0x2718;
 	WFIFOW(fd,0) = 0x2718;
@@ -266,7 +266,7 @@ int logchrif_parse_keepalive(int fd){
  * @param ip: char-serv ip (used for info)
  * @param ip: char-serv ip (used for info)
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_reqchangemail(int fd, int id, char* ip){
+int32 logchrif_parse_reqchangemail(int32 fd, int32 id, char* ip){
 	if (RFIFOREST(fd) < 86)
 	if (RFIFOREST(fd) < 86)
 		return 0;
 		return 0;
 	else{
 	else{
@@ -308,7 +308,7 @@ int logchrif_parse_reqchangemail(int fd, int id, char* ip){
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  * TODO seems pretty damn close to logchrif_parse_reqbanacc
  * TODO seems pretty damn close to logchrif_parse_reqbanacc
  */
  */
-int logchrif_parse_requpdaccstate(int fd, int id, char* ip){
+int32 logchrif_parse_requpdaccstate(int32 fd, int32 id, char* ip){
 	if (RFIFOREST(fd) < 10)
 	if (RFIFOREST(fd) < 10)
 		return 0;
 		return 0;
 	else{
 	else{
@@ -353,7 +353,7 @@ int logchrif_parse_requpdaccstate(int fd, int id, char* ip){
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  * TODO check logchrif_parse_requpdaccstate for possible merge
  * TODO check logchrif_parse_requpdaccstate for possible merge
  */
  */
-int logchrif_parse_reqbanacc(int fd, int id, char* ip){
+int32 logchrif_parse_reqbanacc(int32 fd, int32 id, char* ip){
 	if (RFIFOREST(fd) < 10)
 	if (RFIFOREST(fd) < 10)
 		return 0;
 		return 0;
 	else{
 	else{
@@ -361,7 +361,7 @@ int logchrif_parse_reqbanacc(int fd, int id, char* ip){
 		AccountDB* accounts = login_get_accounts_db();
 		AccountDB* accounts = login_get_accounts_db();
 
 
 		uint32 account_id = RFIFOL(fd,2);
 		uint32 account_id = RFIFOL(fd,2);
-		int timediff = RFIFOL(fd,6);
+		int32 timediff = RFIFOL(fd,6);
 		RFIFOSKIP(fd,10);
 		RFIFOSKIP(fd,10);
 
 
 		if( !accounts->load_num(accounts, &acc, account_id) )
 		if( !accounts->load_num(accounts, &acc, account_id) )
@@ -406,7 +406,7 @@ int logchrif_parse_reqbanacc(int fd, int id, char* ip){
  * @param ip: char-serv ip (used for info)
  * @param ip: char-serv ip (used for info)
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_reqchgsex(int fd, int id, char* ip){
+int32 logchrif_parse_reqchgsex(int32 fd, int32 id, char* ip){
 	if( RFIFOREST(fd) < 6 )
 	if( RFIFOREST(fd) < 6 )
 		return 0;
 		return 0;
 	else{
 	else{
@@ -447,7 +447,7 @@ int logchrif_parse_reqchgsex(int fd, int id, char* ip){
  * @param ip: char-serv ip (used for info)
  * @param ip: char-serv ip (used for info)
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_upd_global_accreg(int fd, int id, char* ip){
+int32 logchrif_parse_upd_global_accreg(int32 fd, int32 id, char* ip){
 	if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) )
 	if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) )
 		return 0;
 		return 0;
 	else{
 	else{
@@ -471,7 +471,7 @@ int logchrif_parse_upd_global_accreg(int fd, int id, char* ip){
  * @param ip: char-serv ip (used for info)
  * @param ip: char-serv ip (used for info)
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_requnbanacc(int fd, int id, char* ip){
+int32 logchrif_parse_requnbanacc(int32 fd, int32 id, char* ip){
 	if( RFIFOREST(fd) < 6 )
 	if( RFIFOREST(fd) < 6 )
 		return 0;
 		return 0;
 	else{
 	else{
@@ -501,7 +501,7 @@ int logchrif_parse_requnbanacc(int fd, int id, char* ip){
  * @param id: id of char-serv
  * @param id: id of char-serv
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_setacconline(int fd, int id){
+int32 logchrif_parse_setacconline(int32 fd, int32 id){
 	if( RFIFOREST(fd) < 6 )
 	if( RFIFOREST(fd) < 6 )
 		return 0;
 		return 0;
 	login_add_online_user(id, RFIFOL(fd,2));
 	login_add_online_user(id, RFIFOL(fd,2));
@@ -515,7 +515,7 @@ int logchrif_parse_setacconline(int fd, int id){
  * @param fd: fd to parse from (char-serv)
  * @param fd: fd to parse from (char-serv)
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_setaccoffline(int fd){
+int32 logchrif_parse_setaccoffline(int32 fd){
 	if( RFIFOREST(fd) < 6 )
 	if( RFIFOREST(fd) < 6 )
 		return 0;
 		return 0;
 	login_remove_online_user(RFIFOL(fd,2));
 	login_remove_online_user(RFIFOL(fd,2));
@@ -530,7 +530,7 @@ int logchrif_parse_setaccoffline(int fd){
  * @param id: id of char-serv
  * @param id: id of char-serv
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_updonlinedb(int fd, int id){
+int32 logchrif_parse_updonlinedb(int32 fd, int32 id){
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 		return 0;
 		return 0;
 	else{
 	else{
@@ -552,7 +552,7 @@ int logchrif_parse_updonlinedb(int fd, int id){
  * @param fd: fd to parse from (char-serv)
  * @param fd: fd to parse from (char-serv)
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_req_global_accreg(int fd){
+int32 logchrif_parse_req_global_accreg(int32 fd){
 	if (RFIFOREST(fd) < 10)
 	if (RFIFOREST(fd) < 10)
 		return 0;
 		return 0;
 	else{
 	else{
@@ -572,7 +572,7 @@ int logchrif_parse_req_global_accreg(int fd){
  * @param id: char-serv id
  * @param id: char-serv id
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-int logchrif_parse_updcharip(int fd, int id){
+int32 logchrif_parse_updcharip(int32 fd, int32 id){
 	if( RFIFOREST(fd) < 6 )
 	if( RFIFOREST(fd) < 6 )
 		return 0;
 		return 0;
 	ch_server[id].ip = ntohl(RFIFOL(fd,2));
 	ch_server[id].ip = ntohl(RFIFOL(fd,2));
@@ -587,7 +587,7 @@ int logchrif_parse_updcharip(int fd, int id){
  * @param id: id of char-serv (char-serv)
  * @param id: id of char-serv (char-serv)
  * @return 1 success
  * @return 1 success
  */
  */
-int logchrif_parse_setalloffline(int fd, int id){
+int32 logchrif_parse_setalloffline(int32 fd, int32 id){
 	ShowInfo("Setting accounts from char-server %d offline.\n", id);
 	ShowInfo("Setting accounts from char-server %d offline.\n", id);
 	login_online_db_setoffline( id );
 	login_online_db_setoffline( id );
 	RFIFOSKIP(fd,2);
 	RFIFOSKIP(fd,2);
@@ -600,7 +600,7 @@ int logchrif_parse_setalloffline(int fd, int id){
  * @param fd: fd to parse from (char-serv)
  * @param fd: fd to parse from (char-serv)
  * @return 0 fail (packet does not have enough data), 1 success
  * @return 0 fail (packet does not have enough data), 1 success
  */
  */
-int logchrif_parse_updpincode(int fd){
+int32 logchrif_parse_updpincode(int32 fd){
 	if( RFIFOREST(fd) < 8 + PINCODE_LENGTH+1 )
 	if( RFIFOREST(fd) < 8 + PINCODE_LENGTH+1 )
 		return 0;
 		return 0;
 	else{
 	else{
@@ -622,7 +622,7 @@ int logchrif_parse_updpincode(int fd){
  * @param fd: fd to parse from (char-serv)
  * @param fd: fd to parse from (char-serv)
  * @return 0 fail (packet does not have enough data), 1 success (continue parsing)
  * @return 0 fail (packet does not have enough data), 1 success (continue parsing)
  */
  */
-int logchrif_parse_pincode_authfail(int fd){
+int32 logchrif_parse_pincode_authfail(int32 fd){
 	if( RFIFOREST(fd) < 6 )
 	if( RFIFOREST(fd) < 6 )
 		return 0;
 		return 0;
 	else{
 	else{
@@ -653,17 +653,17 @@ int logchrif_parse_pincode_authfail(int fd){
  * @param fd link to charserv
  * @param fd link to charserv
  * @return 0 missing data, 1 succeeded
  * @return 0 missing data, 1 succeeded
  */
  */
-int logchrif_parse_reqvipdata(int fd) {
+int32 logchrif_parse_reqvipdata(int32 fd) {
 #ifdef VIP_ENABLE
 #ifdef VIP_ENABLE
 	if( RFIFOREST(fd) < 15 )
 	if( RFIFOREST(fd) < 15 )
 		return 0;
 		return 0;
 	else { //request vip info
 	else { //request vip info
 		struct mmo_account acc;
 		struct mmo_account acc;
 		AccountDB* accounts = login_get_accounts_db();
 		AccountDB* accounts = login_get_accounts_db();
-		int aid = RFIFOL(fd,2);
+		int32 aid = RFIFOL(fd,2);
 		int8 flag = RFIFOB(fd,6);
 		int8 flag = RFIFOB(fd,6);
 		int32 timediff = RFIFOL(fd,7);
 		int32 timediff = RFIFOL(fd,7);
-		int mapfd = RFIFOL(fd,11);
+		int32 mapfd = RFIFOL(fd,11);
 		RFIFOSKIP(fd,15);
 		RFIFOSKIP(fd,15);
 		
 		
 		if( accounts->load_num(accounts, &acc, aid ) ) {
 		if( accounts->load_num(accounts, &acc, aid ) ) {
@@ -716,11 +716,11 @@ int logchrif_parse_reqvipdata(int fd) {
 * IA 0x2720
 * IA 0x2720
 * Get account info that asked by inter/char-server
 * Get account info that asked by inter/char-server
 */
 */
-int logchrif_parse_accinfo(int fd) {
+int32 logchrif_parse_accinfo(int32 fd) {
 	if( RFIFOREST(fd) < 19 )
 	if( RFIFOREST(fd) < 19 )
 		return 0;
 		return 0;
 	else {
 	else {
-		int map_fd = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), account_id = RFIFOL(fd, 14);
+		int32 map_fd = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), account_id = RFIFOL(fd, 14);
 		int8 type = RFIFOB(fd, 18);
 		int8 type = RFIFOB(fd, 18);
 		AccountDB* accounts = login_get_accounts_db();
 		AccountDB* accounts = login_get_accounts_db();
 		struct mmo_account acc;
 		struct mmo_account acc;
@@ -728,7 +728,7 @@ int logchrif_parse_accinfo(int fd) {
 
 
 		// Send back the result to char-server
 		// Send back the result to char-server
 		if (accounts->load_num(accounts, &acc, account_id)) {
 		if (accounts->load_num(accounts, &acc, account_id)) {
-			int len = 122 + NAME_LENGTH;
+			int32 len = 122 + NAME_LENGTH;
 			//ShowInfo("Found account info for %d, requested by %d\n", account_id, u_aid);
 			//ShowInfo("Found account info for %d, requested by %d\n", account_id, u_aid);
 			WFIFOHEAD(fd, len);
 			WFIFOHEAD(fd, len);
 			WFIFOW(fd, 0) = 0x2721;
 			WFIFOW(fd, 0) = 0x2721;
@@ -768,8 +768,8 @@ int logchrif_parse_accinfo(int fd) {
  * @param fd: file descriptor to parse, (link to char-serv)
  * @param fd: file descriptor to parse, (link to char-serv)
  * @return 0=invalid server,marked for disconnection,unknow packet; 1=success
  * @return 0=invalid server,marked for disconnection,unknow packet; 1=success
  */
  */
-int logchrif_parse(int fd){
-	int cid; //char-serv id
+int32 logchrif_parse(int32 fd){
+	int32 cid; //char-serv id
 	uint32 ipl;
 	uint32 ipl;
 	char ip[16];
 	char ip[16];
 
 
@@ -792,7 +792,7 @@ int logchrif_parse(int fd){
 	ip2str(ipl, ip);
 	ip2str(ipl, ip);
 
 
 	while( RFIFOREST(fd) >= 2 ){
 	while( RFIFOREST(fd) >= 2 ){
-		int next = 1; // 0: avoid processing followup packets (prev was probably incomplete) packet, 1: Continue parsing
+		int32 next = 1; // 0: avoid processing followup packets (prev was probably incomplete) packet, 1: Continue parsing
 		uint16 command = RFIFOW(fd,0);
 		uint16 command = RFIFOW(fd,0);
 		switch( command ){
 		switch( command ){
 			case 0x2712: next = logchrif_parse_reqauth(fd, cid, ip); break;
 			case 0x2712: next = logchrif_parse_reqauth(fd, cid, ip); break;
@@ -837,7 +837,7 @@ int logchrif_parse(int fd){
  * Initializes a server structure.
  * Initializes a server structure.
  * @param id: id of char-serv (should be >0, FIXME)
  * @param id: id of char-serv (should be >0, FIXME)
  */
  */
-void logchrif_server_init(int id) {
+void logchrif_server_init(int32 id) {
 	memset(&ch_server[id], 0, sizeof(ch_server[id]));
 	memset(&ch_server[id], 0, sizeof(ch_server[id]));
 	ch_server[id].fd = -1;
 	ch_server[id].fd = -1;
 }
 }
@@ -846,7 +846,7 @@ void logchrif_server_init(int id) {
  * Destroys a server structure.
  * Destroys a server structure.
  * @param id: id of char-serv (should be >0, FIXME)
  * @param id: id of char-serv (should be >0, FIXME)
  */
  */
-void logchrif_server_destroy(int id){
+void logchrif_server_destroy(int32 id){
 	if( ch_server[id].fd != -1 ) {
 	if( ch_server[id].fd != -1 ) {
 		do_close(ch_server[id].fd);
 		do_close(ch_server[id].fd);
 		ch_server[id].fd = -1;
 		ch_server[id].fd = -1;
@@ -858,7 +858,7 @@ void logchrif_server_destroy(int id){
  *  Actually destroys then recreates the struct.
  *  Actually destroys then recreates the struct.
  * @param id: id of char-serv (should be >0, FIXME)
  * @param id: id of char-serv (should be >0, FIXME)
  */
  */
-void logchrif_server_reset(int id) {
+void logchrif_server_reset(int32 id) {
 	login_online_db_setoffline(id); //Set all chars from this char server to offline.
 	login_online_db_setoffline(id); //Set all chars from this char server to offline.
 	logchrif_server_destroy(id);
 	logchrif_server_destroy(id);
 	logchrif_server_init(id);
 	logchrif_server_init(id);
@@ -868,7 +868,7 @@ void logchrif_server_reset(int id) {
  * Called when the connection to Char Server is disconnected.
  * Called when the connection to Char Server is disconnected.
  * @param id: id of char-serv (should be >0, FIXME)
  * @param id: id of char-serv (should be >0, FIXME)
  */
  */
-void logchrif_on_disconnect(int id) {
+void logchrif_on_disconnect(int32 id) {
 	ShowStatus("Char-server '%s' has disconnected.\n", ch_server[id].name);
 	ShowStatus("Char-server '%s' has disconnected.\n", ch_server[id].name);
 	logchrif_server_reset(id);
 	logchrif_server_reset(id);
 }
 }
@@ -878,7 +878,7 @@ void logchrif_on_disconnect(int id) {
  *  Initialisation, function called at start of the login-serv.
  *  Initialisation, function called at start of the login-serv.
  */
  */
 void do_init_loginchrif(void){
 void do_init_loginchrif(void){
-	int i;
+	int32 i;
 	for( i = 0; i < ARRAYLENGTH(ch_server); ++i )
 	for( i = 0; i < ARRAYLENGTH(ch_server); ++i )
 		logchrif_server_init(i);
 		logchrif_server_init(i);
 
 
@@ -895,7 +895,7 @@ void do_init_loginchrif(void){
  *  current signal catch : SIGTERM, SIGINT
  *  current signal catch : SIGTERM, SIGINT
  */
  */
 void do_shutdown_loginchrif(void){
 void do_shutdown_loginchrif(void){
-	int id;
+	int32 id;
 	for( id = 0; id < ARRAYLENGTH(ch_server); ++id )
 	for( id = 0; id < ARRAYLENGTH(ch_server); ++id )
 		logchrif_server_reset(id);
 		logchrif_server_reset(id);
 }
 }
@@ -905,7 +905,7 @@ void do_shutdown_loginchrif(void){
  *  dealloc..., function called at exit of the login-serv
  *  dealloc..., function called at exit of the login-serv
  */
  */
 void do_final_loginchrif(void){
 void do_final_loginchrif(void){
-	int i;
+	int32 i;
 	for( i = 0; i < ARRAYLENGTH(ch_server); ++i )
 	for( i = 0; i < ARRAYLENGTH(ch_server); ++i )
 		logchrif_server_destroy(i);
 		logchrif_server_destroy(i);
 }
 }

+ 2 - 2
src/login/loginchrif.hpp

@@ -12,7 +12,7 @@
  * @param fd: file descriptor to parse, (link to char-serv)
  * @param fd: file descriptor to parse, (link to char-serv)
  * @return 0=invalid server,marked for disconnection,unknow packet; 1=success
  * @return 0=invalid server,marked for disconnection,unknow packet; 1=success
  */
  */
-int logchrif_parse(int fd);
+int32 logchrif_parse(int32 fd);
 
 
 /**
 /**
  * Packet send to all char-servers, except one. (wos: without our self)
  * Packet send to all char-servers, except one. (wos: without our self)
@@ -21,7 +21,7 @@ int logchrif_parse(int fd);
  * @param len: size of packet
  * @param len: size of packet
  * @return : the number of char-serv the packet was sent to
  * @return : the number of char-serv the packet was sent to
  */
  */
-int logchrif_sendallwos(int sfd, uint8* buf, size_t len);
+int32 logchrif_sendallwos(int32 sfd, uint8* buf, size_t len);
 
 
 /**
 /**
  * loginchrif constructor
  * loginchrif constructor

+ 22 - 22
src/login/loginclif.cpp

@@ -12,7 +12,7 @@
 #include <common/random.hpp>
 #include <common/random.hpp>
 #include <common/showmsg.hpp> //show notice
 #include <common/showmsg.hpp> //show notice
 #include <common/socket.hpp> //wfifo session
 #include <common/socket.hpp> //wfifo session
-#include <common/strlib.hpp> //safeprint
+#include <common/strlib.hpp> //safeprint32
 #include <common/timer.hpp> //difftick
 #include <common/timer.hpp> //difftick
 #include <common/utils.hpp>
 #include <common/utils.hpp>
 
 
@@ -31,7 +31,7 @@
  *  8 : already online
  *  8 : already online
  * <result>.B (SC_NOTIFY_BAN)
  * <result>.B (SC_NOTIFY_BAN)
  */
  */
-static void logclif_sent_auth_result(int fd,char result){
+static void logclif_sent_auth_result(int32 fd,char result){
 	PACKET_SC_NOTIFY_BAN p = {};
 	PACKET_SC_NOTIFY_BAN p = {};
 
 
 	p.packetType = HEADER_SC_NOTIFY_BAN;
 	p.packetType = HEADER_SC_NOTIFY_BAN;
@@ -45,12 +45,12 @@ static void logclif_sent_auth_result(int fd,char result){
  * @param sd: player session
  * @param sd: player session
  */
  */
 static void logclif_auth_ok(struct login_session_data* sd) {
 static void logclif_auth_ok(struct login_session_data* sd) {
-	int fd = sd->fd;
+	int32 fd = sd->fd;
 	uint32 ip = session[fd]->client_addr;
 	uint32 ip = session[fd]->client_addr;
 
 
 	uint8 server_num, n;
 	uint8 server_num, n;
 	uint32 subnet_char_ip;
 	uint32 subnet_char_ip;
-	int i;
+	int32 i;
 
 
 	if( !global_core->is_running() ){
 	if( !global_core->is_running() ){
 		// players can only login while running
 		// players can only login while running
@@ -167,7 +167,7 @@ static void logclif_auth_ok(struct login_session_data* sd) {
 	data->waiting_disconnect = add_timer(gettick()+AUTH_TIMEOUT, login_waiting_disconnect_timer, sd->account_id, 0);
 	data->waiting_disconnect = add_timer(gettick()+AUTH_TIMEOUT, login_waiting_disconnect_timer, sd->account_id, 0);
 }
 }
 
 
-static void logclif_auth_failed( int fd, int result, const char* unblock_time = "" ){
+static void logclif_auth_failed( int32 fd, int32 result, const char* unblock_time = "" ){
 	PACKET_AC_REFUSE_LOGIN p = {};
 	PACKET_AC_REFUSE_LOGIN p = {};
 
 
 	p.packetType = HEADER_AC_REFUSE_LOGIN;
 	p.packetType = HEADER_AC_REFUSE_LOGIN;
@@ -205,8 +205,8 @@ static void logclif_auth_failed( int fd, int result, const char* unblock_time =
     104 = This character is being deleted. Login is temporarily unavailable for the time being
     104 = This character is being deleted. Login is temporarily unavailable for the time being
      default = Unknown Error.
      default = Unknown Error.
  */
  */
-static void logclif_auth_failed(struct login_session_data* sd, int result) {
-	int fd = sd->fd;
+static void logclif_auth_failed(struct login_session_data* sd, int32 result) {
+	int32 fd = sd->fd;
 	uint32 ip = session[fd]->client_addr;
 	uint32 ip = session[fd]->client_addr;
 
 
 	if (login_config.log_login)
 	if (login_config.log_login)
@@ -242,7 +242,7 @@ static void logclif_auth_failed(struct login_session_data* sd, int result) {
  * @param fd: fd to parse from (client fd)
  * @param fd: fd to parse from (client fd)
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-static bool logclif_parse_keepalive( int fd, struct login_session_data& ){
+static bool logclif_parse_keepalive( int32 fd, struct login_session_data& ){
 	// Do nothing
 	// Do nothing
 	return true;
 	return true;
 }
 }
@@ -253,7 +253,7 @@ static bool logclif_parse_keepalive( int fd, struct login_session_data& ){
  * @param fd: fd to parse from (client fd)
  * @param fd: fd to parse from (client fd)
  * @return 0 not enough info transmitted, 1 success
  * @return 0 not enough info transmitted, 1 success
  */
  */
-static bool logclif_parse_updclhash( int fd, struct login_session_data& sd ){
+static bool logclif_parse_updclhash( int32 fd, struct login_session_data& sd ){
 	PACKET_CA_EXE_HASHCHECK* p = (PACKET_CA_EXE_HASHCHECK*)RFIFOP( fd, 0 );
 	PACKET_CA_EXE_HASHCHECK* p = (PACKET_CA_EXE_HASHCHECK*)RFIFOP( fd, 0 );
 
 
 	sd.has_client_hash = 1;
 	sd.has_client_hash = 1;
@@ -263,7 +263,7 @@ static bool logclif_parse_updclhash( int fd, struct login_session_data& sd ){
 }
 }
 
 
 template <typename P>
 template <typename P>
-static bool logclif_parse_reqauth_raw( int fd, login_session_data& sd ){
+static bool logclif_parse_reqauth_raw( int32 fd, login_session_data& sd ){
 	P* p = (P*)RFIFOP( fd, 0 );
 	P* p = (P*)RFIFOP( fd, 0 );
 
 
 	char ip[16];
 	char ip[16];
@@ -282,7 +282,7 @@ static bool logclif_parse_reqauth_raw( int fd, login_session_data& sd ){
 
 
 	sd.passwdenc = 0;
 	sd.passwdenc = 0;
 
 
-	int result = login_mmo_auth( &sd, false );
+	int32 result = login_mmo_auth( &sd, false );
 
 
 	if( result == -1 ){
 	if( result == -1 ){
 		logclif_auth_ok( &sd );
 		logclif_auth_ok( &sd );
@@ -294,7 +294,7 @@ static bool logclif_parse_reqauth_raw( int fd, login_session_data& sd ){
 }
 }
 
 
 template <typename P>
 template <typename P>
-static bool logclif_parse_reqauth_md5( int fd, login_session_data& sd ){
+static bool logclif_parse_reqauth_md5( int32 fd, login_session_data& sd ){
 	P* p = (P*)RFIFOP( fd, 0 );
 	P* p = (P*)RFIFOP( fd, 0 );
 
 
 	char ip[16];
 	char ip[16];
@@ -314,7 +314,7 @@ static bool logclif_parse_reqauth_md5( int fd, login_session_data& sd ){
 		return false;
 		return false;
 	}
 	}
 
 
-	int result = login_mmo_auth( &sd, false );
+	int32 result = login_mmo_auth( &sd, false );
 
 
 	if( result == -1 ){
 	if( result == -1 ){
 		logclif_auth_ok( &sd );
 		logclif_auth_ok( &sd );
@@ -326,7 +326,7 @@ static bool logclif_parse_reqauth_md5( int fd, login_session_data& sd ){
 }
 }
 
 
 template <typename P>
 template <typename P>
-static bool logclif_parse_reqauth_sso( int fd, login_session_data& sd ){
+static bool logclif_parse_reqauth_sso( int32 fd, login_session_data& sd ){
 	P* p = (P*)RFIFOP( fd, 0 );
 	P* p = (P*)RFIFOP( fd, 0 );
 
 
 	char ip[16];
 	char ip[16];
@@ -348,7 +348,7 @@ static bool logclif_parse_reqauth_sso( int fd, login_session_data& sd ){
 
 
 	sd.passwdenc = 0;
 	sd.passwdenc = 0;
 
 
-	int result = login_mmo_auth( &sd, false );
+	int32 result = login_mmo_auth( &sd, false );
 
 
 	if( result == -1 ){
 	if( result == -1 ){
 		logclif_auth_ok( &sd );
 		logclif_auth_ok( &sd );
@@ -359,7 +359,7 @@ static bool logclif_parse_reqauth_sso( int fd, login_session_data& sd ){
 	return true;
 	return true;
 }
 }
 
 
-static void logclif_reqkey_result( int fd, struct login_session_data& sd ){
+static void logclif_reqkey_result( int32 fd, struct login_session_data& sd ){
 	PACKET_AC_ACK_HASH* p = (PACKET_AC_ACK_HASH*)packet_buffer;
 	PACKET_AC_ACK_HASH* p = (PACKET_AC_ACK_HASH*)packet_buffer;
 
 
 	p->packetType = HEADER_AC_ACK_HASH;
 	p->packetType = HEADER_AC_ACK_HASH;
@@ -375,7 +375,7 @@ static void logclif_reqkey_result( int fd, struct login_session_data& sd ){
  * @param sd: client session
  * @param sd: client session
  * @return 1 success
  * @return 1 success
  */
  */
-static bool logclif_parse_reqkey( int fd, struct login_session_data& sd ){
+static bool logclif_parse_reqkey( int32 fd, struct login_session_data& sd ){
 	PACKET_CA_REQ_HASH* p_in = (PACKET_CA_REQ_HASH*)RFIFOP( fd, 0 );
 	PACKET_CA_REQ_HASH* p_in = (PACKET_CA_REQ_HASH*)RFIFOP( fd, 0 );
 
 
 	sd.md5keylen = sizeof( sd.md5key );
 	sd.md5keylen = sizeof( sd.md5key );
@@ -394,11 +394,11 @@ static bool logclif_parse_reqkey( int fd, struct login_session_data& sd ){
  * @param ip: ipv4 address (client)
  * @param ip: ipv4 address (client)
  * @return 0 packet received too shirt, 1 success
  * @return 0 packet received too shirt, 1 success
  */
  */
-static int logclif_parse_reqcharconnec(int fd, struct login_session_data *sd, char* ip){
+static int32 logclif_parse_reqcharconnec(int32 fd, struct login_session_data *sd, char* ip){
 	if (RFIFOREST(fd) < 86)
 	if (RFIFOREST(fd) < 86)
 		return 0;
 		return 0;
 	else {
 	else {
-		int result;
+		int32 result;
 		char server_name[20];
 		char server_name[20];
 		char message[256];
 		char message[256];
 		uint32 server_ip;
 		uint32 server_ip;
@@ -460,7 +460,7 @@ static int logclif_parse_reqcharconnec(int fd, struct login_session_data *sd, ch
 	return 1;
 	return 1;
 }
 }
 
 
-static void logclif_otp_result( int fd ){
+static void logclif_otp_result( int32 fd ){
 	PACKET_TC_RESULT p = {};
 	PACKET_TC_RESULT p = {};
 
 
 	p.packetType = HEADER_TC_RESULT;
 	p.packetType = HEADER_TC_RESULT;
@@ -472,7 +472,7 @@ static void logclif_otp_result( int fd ){
 	socket_send( fd, p );
 	socket_send( fd, p );
 }
 }
 
 
-static bool logclif_parse_otp_login( int fd, struct login_session_data& ){
+static bool logclif_parse_otp_login( int32 fd, struct login_session_data& ){
 	PACKET_CT_AUTH* p = (PACKET_CT_AUTH*)RFIFOP( fd, 0 );
 	PACKET_CT_AUTH* p = (PACKET_CT_AUTH*)RFIFOP( fd, 0 );
 
 
 	logclif_otp_result( fd );
 	logclif_otp_result( fd );
@@ -503,7 +503,7 @@ public:
  * @param fd: file descriptor to parse, (link to client)
  * @param fd: file descriptor to parse, (link to client)
  * @return 0=invalid session,marked for disconnection,unknow packet, banned..; 1=success
  * @return 0=invalid session,marked for disconnection,unknow packet, banned..; 1=success
  */
  */
-int logclif_parse(int fd) {
+int32 logclif_parse(int32 fd) {
 	struct login_session_data* sd = (struct login_session_data*)session[fd]->session_data;
 	struct login_session_data* sd = (struct login_session_data*)session[fd]->session_data;
 
 
 	char ip[16];
 	char ip[16];

+ 3 - 1
src/login/loginclif.hpp

@@ -4,13 +4,15 @@
 #ifndef LOGINCLIF_HPP
 #ifndef LOGINCLIF_HPP
 #define LOGINCLIF_HPP
 #define LOGINCLIF_HPP
 
 
+#include <common/cbasetypes.hpp>
+
 /**
 /**
  * Entry point from client to log-server.
  * Entry point from client to log-server.
  * Function that checks incoming command, then splits it to the correct handler.
  * Function that checks incoming command, then splits it to the correct handler.
  * @param fd: file descriptor to parse, (link to client)
  * @param fd: file descriptor to parse, (link to client)
  * @return 0=invalid session,marked for disconnection,unknow packet, banned..; 1=success
  * @return 0=invalid session,marked for disconnection,unknow packet, banned..; 1=success
  */
  */
-int logclif_parse(int fd);
+int32 logclif_parse(int32 fd);
 
 
 /**
 /**
  * Initialize the module.
  * Initialize the module.

+ 2 - 2
src/login/logincnslif.cpp

@@ -42,10 +42,10 @@ void display_helpscreen(bool do_exit) {
  * @param buf: buffer to parse, (from console)
  * @param buf: buffer to parse, (from console)
  * @return 1=success
  * @return 1=success
  */
  */
-int cnslif_parse(const char* buf){
+int32 cnslif_parse(const char* buf){
 	char type[64];
 	char type[64];
 	char command[64];
 	char command[64];
-	int n=0;
+	int32 n=0;
 
 
 	if( ( n = sscanf(buf, "%127[^:]:%255[^\n\r]", type, command) ) < 2 ){
 	if( ( n = sscanf(buf, "%127[^:]:%255[^\n\r]", type, command) ) < 2 ){
 		if((n = sscanf(buf, "%63[^\n]", type))<1) return -1; //nothing to do no arg
 		if((n = sscanf(buf, "%63[^\n]", type))<1) return -1; //nothing to do no arg

+ 3 - 1
src/login/logincnslif.hpp

@@ -4,6 +4,8 @@
 #ifndef LOGINCNSLIF_HPP
 #ifndef LOGINCNSLIF_HPP
 #define LOGINCNSLIF_HPP
 #define LOGINCNSLIF_HPP
 
 
+#include <common/cbasetypes.hpp>
+
 /**
 /**
  * Console Command Parser
  * Console Command Parser
  * Transmited from command cli.cpp
  * Transmited from command cli.cpp
@@ -12,7 +14,7 @@
  * @param buf: buffer to parse, (from console)
  * @param buf: buffer to parse, (from console)
  * @return 1=success
  * @return 1=success
  */
  */
-int cnslif_parse(const char* buf);
+int32 cnslif_parse(const char* buf);
 
 
 /**
 /**
  * Initialize the module.
  * Initialize the module.

+ 2 - 2
src/login/loginlog.cpp

@@ -60,10 +60,10 @@ unsigned long loginlog_failedattempts(uint32 ip, uint32 minutes) {
  * @param rcode:
  * @param rcode:
  * @param message:
  * @param message:
  */
  */
-void login_log(uint32 ip, const char* username, int rcode, const char* message) {
+void login_log(uint32 ip, const char* username, int32 rcode, const char* message) {
 	char esc_username[NAME_LENGTH*2+1];
 	char esc_username[NAME_LENGTH*2+1];
 	char esc_message[255*2+1];
 	char esc_message[255*2+1];
-	int retcode;
+	int32 retcode;
 
 
 	if( !enabled )
 	if( !enabled )
 		return;
 		return;

+ 1 - 1
src/login/loginlog.hpp

@@ -23,7 +23,7 @@ unsigned long loginlog_failedattempts(uint32 ip, uint32 minutes);
  * @param rcode:
  * @param rcode:
  * @param message:
  * @param message:
  */
  */
-void login_log(uint32 ip, const char* username, int rcode, const char* message);
+void login_log(uint32 ip, const char* username, int32 rcode, const char* message);
 
 
 /**
 /**
  * Read configuration options.
  * Read configuration options.

+ 31 - 31
src/map/achievement.cpp

@@ -439,9 +439,9 @@ AchievementLevelDatabase achievement_level_db;
  * @param achievement_id: Achievement to add
  * @param achievement_id: Achievement to add
  * @return nullptr on failure, achievement data on success
  * @return nullptr on failure, achievement data on success
  */
  */
-struct achievement *achievement_add(map_session_data *sd, int achievement_id)
+struct achievement *achievement_add(map_session_data *sd, int32 achievement_id)
 {
 {
-	int i, index;
+	int32 i, index;
 
 
 	nullpo_retr(nullptr, sd);
 	nullpo_retr(nullptr, sd);
 
 
@@ -485,10 +485,10 @@ struct achievement *achievement_add(map_session_data *sd, int achievement_id)
  * @param achievement_id: Achievement to remove
  * @param achievement_id: Achievement to remove
  * @return True on success, false on failure
  * @return True on success, false on failure
  */
  */
-bool achievement_remove(map_session_data *sd, int achievement_id)
+bool achievement_remove(map_session_data *sd, int32 achievement_id)
 {
 {
 	struct achievement dummy;
 	struct achievement dummy;
-	int i;
+	int32 i;
 
 
 	nullpo_retr(false, sd);
 	nullpo_retr(false, sd);
 
 
@@ -532,8 +532,8 @@ bool achievement_remove(map_session_data *sd, int achievement_id)
  * @param achievement_id: Achievement to check if it's complete
  * @param achievement_id: Achievement to check if it's complete
  * @return True on completed, false if not
  * @return True on completed, false if not
  */
  */
-static bool achievement_done(map_session_data *sd, int achievement_id) {
-	for (int i = 0; i < sd->achievement_data.count; i++) {
+static bool achievement_done(map_session_data *sd, int32 achievement_id) {
+	for (int32 i = 0; i < sd->achievement_data.count; i++) {
 		if (sd->achievement_data.achievements[i].achievement_id == achievement_id && sd->achievement_data.achievements[i].completed > 0)
 		if (sd->achievement_data.achievements[i].achievement_id == achievement_id && sd->achievement_data.achievements[i].completed > 0)
 			return true;
 			return true;
 	}
 	}
@@ -547,7 +547,7 @@ static bool achievement_done(map_session_data *sd, int achievement_id) {
  * @param achievement_id: Achievement to check if it has a dependent
  * @param achievement_id: Achievement to check if it has a dependent
  * @return False on failure or not complete, true on complete or no dependents
  * @return False on failure or not complete, true on complete or no dependents
  */
  */
-bool achievement_check_dependent(map_session_data *sd, int achievement_id)
+bool achievement_check_dependent(map_session_data *sd, int32 achievement_id)
 {
 {
 	nullpo_retr(false, sd);
 	nullpo_retr(false, sd);
 
 
@@ -573,9 +573,9 @@ bool achievement_check_dependent(map_session_data *sd, int achievement_id)
  * @param sd: Achievement to compare for completed dependents
  * @param sd: Achievement to compare for completed dependents
  * @return True if successful, false if not
  * @return True if successful, false if not
  */
  */
-static int achievement_check_groups(map_session_data *sd, struct s_achievement_db *ad)
+static int32 achievement_check_groups(map_session_data *sd, struct s_achievement_db *ad)
 {
 {
-	int i;
+	int32 i;
 
 
 	if (ad == nullptr || sd == nullptr)
 	if (ad == nullptr || sd == nullptr)
 		return 0;
 		return 0;
@@ -604,9 +604,9 @@ static int achievement_check_groups(map_session_data *sd, struct s_achievement_d
  * @param complete: Complete state of an achievement
  * @param complete: Complete state of an achievement
  * @return True if successful, false if not
  * @return True if successful, false if not
  */
  */
-bool achievement_update_achievement(map_session_data *sd, int achievement_id, bool complete)
+bool achievement_update_achievement(map_session_data *sd, int32 achievement_id, bool complete)
 {
 {
-	int i;
+	int32 i;
 
 
 	nullpo_retr(false, sd);
 	nullpo_retr(false, sd);
 
 
@@ -658,9 +658,9 @@ bool achievement_update_achievement(map_session_data *sd, int achievement_id, bo
  * @param sd: Player getting the reward
  * @param sd: Player getting the reward
  * @param achievement_id: Achievement to get reward data
  * @param achievement_id: Achievement to get reward data
  */
  */
-void achievement_get_reward(map_session_data *sd, int achievement_id, time_t rewarded)
+void achievement_get_reward(map_session_data *sd, int32 achievement_id, time_t rewarded)
 {
 {
-	int i;
+	int32 i;
 
 
 	nullpo_retv(sd);
 	nullpo_retv(sd);
 
 
@@ -699,9 +699,9 @@ void achievement_get_reward(map_session_data *sd, int achievement_id, time_t rew
  * @param sd: Player to get reward
  * @param sd: Player to get reward
  * @param achievement_id: Achievement to get reward data
  * @param achievement_id: Achievement to get reward data
  */
  */
-void achievement_check_reward(map_session_data *sd, int achievement_id)
+void achievement_check_reward(map_session_data *sd, int32 achievement_id)
 {
 {
-	int i;
+	int32 i;
 
 
 	nullpo_retv(sd);
 	nullpo_retv(sd);
 
 
@@ -741,7 +741,7 @@ void achievement_get_titles(uint32 char_id)
 		sd->titles.clear();
 		sd->titles.clear();
 
 
 		if (sd->achievement_data.count) {
 		if (sd->achievement_data.count) {
-			for (int i = 0; i < sd->achievement_data.count; i++) {
+			for (int32 i = 0; i < sd->achievement_data.count; i++) {
 				std::shared_ptr<s_achievement_db> adb = achievement_db.find( sd->achievement_data.achievements[i].achievement_id );
 				std::shared_ptr<s_achievement_db> adb = achievement_db.find( sd->achievement_data.achievements[i].achievement_id );
 
 
 				// If the achievement has a title and is complete, give it to the player
 				// If the achievement has a title and is complete, give it to the player
@@ -775,9 +775,9 @@ void achievement_free(map_session_data *sd)
  * @param type: Type to return
  * @param type: Type to return
  * @return The type's data, -1 if player doesn't have achievement, -2 on failure/incorrect type
  * @return The type's data, -1 if player doesn't have achievement, -2 on failure/incorrect type
  */
  */
-int achievement_check_progress(map_session_data *sd, int achievement_id, int type)
+int32 achievement_check_progress(map_session_data *sd, int32 achievement_id, int32 type)
 {
 {
-	int i;
+	int32 i;
 
 
 	nullpo_retr(-2, sd);
 	nullpo_retr(-2, sd);
 
 
@@ -808,18 +808,18 @@ int achievement_check_progress(map_session_data *sd, int achievement_id, int typ
  * @param flag: If the call should attempt to give the AG_GOAL_ACHIEVE achievement
  * @param flag: If the call should attempt to give the AG_GOAL_ACHIEVE achievement
  * @return Rollover and TNL EXP or 0 on failure
  * @return Rollover and TNL EXP or 0 on failure
  */
  */
-int *achievement_level(map_session_data *sd, bool flag)
+int32 *achievement_level(map_session_data *sd, bool flag)
 {
 {
 	nullpo_retr(nullptr, sd);
 	nullpo_retr(nullptr, sd);
 
 
 	sd->achievement_data.total_score = 0;
 	sd->achievement_data.total_score = 0;
 
 
-	for (int i = 0; i < sd->achievement_data.count; i++) { // Recount total score
+	for (int32 i = 0; i < sd->achievement_data.count; i++) { // Recount total score
 		if (sd->achievement_data.achievements[i].completed > 0)
 		if (sd->achievement_data.achievements[i].completed > 0)
 			sd->achievement_data.total_score += sd->achievement_data.achievements[i].score;
 			sd->achievement_data.total_score += sd->achievement_data.achievements[i].score;
 	}
 	}
 
 
-	int left_score, right_score, old_level = sd->achievement_data.level;
+	int32 left_score, right_score, old_level = sd->achievement_data.level;
 
 
 	for( sd->achievement_data.level = 0; /* Break condition's inside the loop */; sd->achievement_data.level++ ){
 	for( sd->achievement_data.level = 0; /* Break condition's inside the loop */; sd->achievement_data.level++ ){
 		std::shared_ptr<s_achievement_level> level = achievement_level_db.find( sd->achievement_data.level );
 		std::shared_ptr<s_achievement_level> level = achievement_level_db.find( sd->achievement_data.level );
@@ -860,7 +860,7 @@ int *achievement_level(map_session_data *sd, bool flag)
 		}
 		}
 	}
 	}
 
 
-	static int info[2];
+	static int32 info[2];
 
 
 	info[0] = left_score; // Left number
 	info[0] = left_score; // Left number
 	info[1] = right_score; // Right number
 	info[1] = right_score; // Right number
@@ -886,7 +886,7 @@ bool achievement_check_condition( struct script_code* condition, map_session_dat
 
 
 	struct script_state* st = sd->st;
 	struct script_state* st = sd->st;
 
 
-	int value = 0;
+	int32 value = 0;
 
 
 	if( st != nullptr ){
 	if( st != nullptr ){
 		value = script_getnum( st, 2 );
 		value = script_getnum( st, 2 );
@@ -941,7 +941,7 @@ static bool achievement_update_objectives(map_session_data *sd, std::shared_ptr<
 	struct achievement *entry = nullptr;
 	struct achievement *entry = nullptr;
 	bool isNew = false, changed = false, complete = false;
 	bool isNew = false, changed = false, complete = false;
 	std::array<int, MAX_ACHIEVEMENT_OBJECTIVES> current_count = {}; // Player's current objective values
 	std::array<int, MAX_ACHIEVEMENT_OBJECTIVES> current_count = {}; // Player's current objective values
-	int i;
+	int32 i;
 
 
 	ARR_FIND(0, sd->achievement_data.count, i, sd->achievement_data.achievements[i].achievement_id == ad->achievement_id);
 	ARR_FIND(0, sd->achievement_data.count, i, sd->achievement_data.achievements[i].achievement_id == ad->achievement_id);
 	if (i == sd->achievement_data.count) { // Achievement isn't in player's log
 	if (i == sd->achievement_data.count) { // Achievement isn't in player's log
@@ -1055,7 +1055,7 @@ static bool achievement_update_objectives(map_session_data *sd, std::shared_ptr<
 		// If it was not completed
 		// If it was not completed
 		if( !hasCounter ){
 		if( !hasCounter ){
 			// Check if it has a counter
 			// Check if it has a counter
-			for( int counter : current_count ){
+			for( int32 counter : current_count ){
 				if( counter != 0 ){
 				if( counter != 0 ){
 					hasCounter = true;
 					hasCounter = true;
 					break;
 					break;
@@ -1097,7 +1097,7 @@ void achievement_update_objective(map_session_data *sd, enum e_achievement_group
 		std::array<int, MAX_ACHIEVEMENT_OBJECTIVES> count = {};
 		std::array<int, MAX_ACHIEVEMENT_OBJECTIVES> count = {};
 
 
 		va_start(ap, arg_count);
 		va_start(ap, arg_count);
-		for (int i = 0; i < arg_count; i++){
+		for (int32 i = 0; i < arg_count; i++){
 			std::string name = "ARG" + std::to_string(i);
 			std::string name = "ARG" + std::to_string(i);
 
 
 			count[i] = va_arg(ap, int);
 			count[i] = va_arg(ap, int);
@@ -1110,7 +1110,7 @@ void achievement_update_objective(map_session_data *sd, enum e_achievement_group
 			achievement_update_objectives(sd, ach.second, group, count);
 			achievement_update_objectives(sd, ach.second, group, count);
 
 
 		// Remove variables that might have been set
 		// Remove variables that might have been set
-		for (int i = 0; i < arg_count; i++){
+		for (int32 i = 0; i < arg_count; i++){
 			std::string name = "ARG" + std::to_string(i);
 			std::string name = "ARG" + std::to_string(i);
 
 
 			pc_setglobalreg( sd, add_str( name.c_str() ), 0 );
 			pc_setglobalreg( sd, add_str( name.c_str() ), 0 );
@@ -1122,13 +1122,13 @@ void achievement_update_objective(map_session_data *sd, enum e_achievement_group
  * Map iterator subroutine to update achievement objectives for a party after killing a monster.
  * Map iterator subroutine to update achievement objectives for a party after killing a monster.
  * @see map_foreachinrange
  * @see map_foreachinrange
  * @param ap: Argument list, expecting:
  * @param ap: Argument list, expecting:
- *   int Party ID
- *   int Mob ID
+ *   int32 Party ID
+ *   int32 Mob ID
  */
  */
-int achievement_update_objective_sub(block_list *bl, va_list ap)
+int32 achievement_update_objective_sub(block_list *bl, va_list ap)
 {
 {
 	map_session_data *sd;
 	map_session_data *sd;
-	int mob_id, party_id;
+	int32 mob_id, party_id;
 
 
 	nullpo_ret(bl);
 	nullpo_ret(bl);
 	nullpo_ret(sd = (map_session_data *)bl);
 	nullpo_ret(sd = (map_session_data *)bl);

+ 12 - 12
src/map/achievement.hpp

@@ -70,8 +70,8 @@ enum e_title_table : uint16 {
 };
 };
 
 
 struct achievement_target {
 struct achievement_target {
-	int mob;
-	int count;
+	int32 mob;
+	int32 count;
 };
 };
 
 
 struct s_achievement_db {
 struct s_achievement_db {
@@ -90,8 +90,8 @@ struct s_achievement_db {
 		ach_reward();
 		ach_reward();
 		~ach_reward();
 		~ach_reward();
 	} rewards;
 	} rewards;
-	int score;
-	int has_dependent; // Used for quick updating of achievements that depend on others - this is their ID
+	int32 score;
+	int32 has_dependent; // Used for quick updating of achievements that depend on others - this is their ID
 
 
 	s_achievement_db();
 	s_achievement_db();
 	~s_achievement_db();
 	~s_achievement_db();
@@ -134,18 +134,18 @@ public:
 
 
 extern AchievementLevelDatabase achievement_level_db;
 extern AchievementLevelDatabase achievement_level_db;
 
 
-void achievement_get_reward(map_session_data *sd, int achievement_id, time_t rewarded);
-struct achievement *achievement_add(map_session_data *sd, int achievement_id);
-bool achievement_remove(map_session_data *sd, int achievement_id);
-bool achievement_update_achievement(map_session_data *sd, int achievement_id, bool complete);
-void achievement_check_reward(map_session_data *sd, int achievement_id);
+void achievement_get_reward(map_session_data *sd, int32 achievement_id, time_t rewarded);
+struct achievement *achievement_add(map_session_data *sd, int32 achievement_id);
+bool achievement_remove(map_session_data *sd, int32 achievement_id);
+bool achievement_update_achievement(map_session_data *sd, int32 achievement_id, bool complete);
+void achievement_check_reward(map_session_data *sd, int32 achievement_id);
 void achievement_free(map_session_data *sd);
 void achievement_free(map_session_data *sd);
-int achievement_check_progress(map_session_data *sd, int achievement_id, int type);
-int *achievement_level(map_session_data *sd, bool flag);
+int32 achievement_check_progress(map_session_data *sd, int32 achievement_id, int32 type);
+int32 *achievement_level(map_session_data *sd, bool flag);
 bool achievement_check_condition(struct script_code* condition, map_session_data* sd);
 bool achievement_check_condition(struct script_code* condition, map_session_data* sd);
 void achievement_get_titles(uint32 char_id);
 void achievement_get_titles(uint32 char_id);
 void achievement_update_objective(map_session_data *sd, enum e_achievement_group group, uint8 arg_count, ...);
 void achievement_update_objective(map_session_data *sd, enum e_achievement_group group, uint8 arg_count, ...);
-int achievement_update_objective_sub(block_list *bl, va_list ap);
+int32 achievement_update_objective_sub(block_list *bl, va_list ap);
 void achievement_read_db(void);
 void achievement_read_db(void);
 void achievement_db_reload(void);
 void achievement_db_reload(void);
 
 

File diff suppressed because it is too large
+ 127 - 127
src/map/atcommand.cpp


+ 5 - 5
src/map/atcommand.hpp

@@ -12,16 +12,16 @@ class map_session_data;
 //global var
 //global var
 extern char atcommand_symbol;
 extern char atcommand_symbol;
 extern char charcommand_symbol;
 extern char charcommand_symbol;
-extern int atcmd_binding_count;
+extern int32 atcmd_binding_count;
 
 
 enum AtCommandType : uint8 {
 enum AtCommandType : uint8 {
 	COMMAND_ATCOMMAND = 1,
 	COMMAND_ATCOMMAND = 1,
 	COMMAND_CHARCOMMAND = 2,
 	COMMAND_CHARCOMMAND = 2,
 } ;
 } ;
 
 
-typedef int (*AtCommandFunc)(const int fd, map_session_data* sd, const char* command, const char* message);
+typedef int32 (*AtCommandFunc)(const int32 fd, map_session_data* sd, const char* command, const char* message);
 
 
-bool is_atcommand(const int fd, map_session_data* sd, const char* message, int type);
+bool is_atcommand(const int32 fd, map_session_data* sd, const char* message, int32 type);
 
 
 void do_init_atcommand(void);
 void do_init_atcommand(void);
 void do_final_atcommand(void);
 void do_final_atcommand(void);
@@ -33,8 +33,8 @@ bool atcommand_exists(const char* name);
 struct atcmd_binding_data {
 struct atcmd_binding_data {
 	char command[50];
 	char command[50];
 	char npc_event[EVENT_NAME_LENGTH];
 	char npc_event[EVENT_NAME_LENGTH];
-	int level;
-	int level2;
+	int32 level;
+	int32 level2;
 };
 };
 extern struct atcmd_binding_data** atcmd_binding;
 extern struct atcmd_binding_data** atcmd_binding;
 struct atcmd_binding_data* get_atcommandbind_byname(const char* name);
 struct atcmd_binding_data* get_atcommandbind_byname(const char* name);

File diff suppressed because it is too large
+ 132 - 132
src/map/battle.cpp


File diff suppressed because it is too large
+ 615 - 615
src/map/battle.hpp


+ 25 - 25
src/map/battleground.cpp

@@ -31,7 +31,7 @@ using namespace rathena;
 BattlegroundDatabase battleground_db;
 BattlegroundDatabase battleground_db;
 std::unordered_map<int, std::shared_ptr<s_battleground_data>> bg_team_db;
 std::unordered_map<int, std::shared_ptr<s_battleground_data>> bg_team_db;
 std::vector<std::shared_ptr<s_battleground_queue>> bg_queues;
 std::vector<std::shared_ptr<s_battleground_queue>> bg_queues;
-int bg_queue_count = 1;
+int32 bg_queue_count = 1;
 
 
 const std::string BattlegroundDatabase::getDefaultLocation() {
 const std::string BattlegroundDatabase::getDefaultLocation() {
 	return std::string(db_path) + "/battleground_db.yml";
 	return std::string(db_path) + "/battleground_db.yml";
@@ -70,7 +70,7 @@ uint64 BattlegroundDatabase::parseBodyNode(const ryml::NodeRef& node) {
 	}
 	}
 
 
 	if (this->nodeExists(node, "MinPlayers")) {
 	if (this->nodeExists(node, "MinPlayers")) {
-		int min;
+		int32 min;
 
 
 		if (!this->asInt32(node, "MinPlayers", min))
 		if (!this->asInt32(node, "MinPlayers", min))
 			return 0;
 			return 0;
@@ -92,7 +92,7 @@ uint64 BattlegroundDatabase::parseBodyNode(const ryml::NodeRef& node) {
 	}
 	}
 
 
 	if (this->nodeExists(node, "MaxPlayers")) {
 	if (this->nodeExists(node, "MaxPlayers")) {
-		int max;
+		int32 max;
 
 
 		if (!this->asInt32(node, "MaxPlayers", max))
 		if (!this->asInt32(node, "MaxPlayers", max))
 			return 0;
 			return 0;
@@ -114,7 +114,7 @@ uint64 BattlegroundDatabase::parseBodyNode(const ryml::NodeRef& node) {
 	}
 	}
 
 
 	if (this->nodeExists(node, "MinLevel")) {
 	if (this->nodeExists(node, "MinLevel")) {
-		int min;
+		int32 min;
 
 
 		if (!this->asInt32(node, "MinLevel", min))
 		if (!this->asInt32(node, "MinLevel", min))
 			return 0;
 			return 0;
@@ -131,7 +131,7 @@ uint64 BattlegroundDatabase::parseBodyNode(const ryml::NodeRef& node) {
 	}
 	}
 
 
 	if (this->nodeExists(node, "MaxLevel")) {
 	if (this->nodeExists(node, "MaxLevel")) {
-		int max;
+		int32 max;
 
 
 		if (!this->asInt32(node, "MaxLevel", max))
 		if (!this->asInt32(node, "MaxLevel", max))
 			return 0;
 			return 0;
@@ -244,7 +244,7 @@ uint64 BattlegroundDatabase::parseBodyNode(const ryml::NodeRef& node) {
 	}
 	}
 
 
 	if (this->nodeExists(node, "Locations")) {
 	if (this->nodeExists(node, "Locations")) {
-		int count = 0;
+		int32 count = 0;
 
 
 		for (const auto& location : node["Locations"]) {
 		for (const auto& location : node["Locations"]) {
 			s_battleground_map map_entry;
 			s_battleground_map map_entry;
@@ -424,7 +424,7 @@ std::shared_ptr<s_battleground_type> bg_search_name(const char *name)
  * @param queue_id: Queue ID
  * @param queue_id: Queue ID
  * @return s_battleground_queue on success or nullptr on failure
  * @return s_battleground_queue on success or nullptr on failure
  */
  */
-std::shared_ptr<s_battleground_queue> bg_search_queue(int queue_id)
+std::shared_ptr<s_battleground_queue> bg_search_queue(int32 queue_id)
 {
 {
 	for (const auto &queue : bg_queues) {
 	for (const auto &queue : bg_queues) {
 		if (queue_id == queue->queue_id)
 		if (queue_id == queue->queue_id)
@@ -456,7 +456,7 @@ map_session_data* bg_getavailablesd(s_battleground_data *bg)
  * @param bg_id: Battleground ID
  * @param bg_id: Battleground ID
  * @return True on success or false otherwise
  * @return True on success or false otherwise
  */
  */
-bool bg_team_delete(int bg_id)
+bool bg_team_delete(int32 bg_id)
 {
 {
 	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);
 
 
@@ -482,7 +482,7 @@ bool bg_team_delete(int 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(int bg_id, unsigned short mapindex, short x, short y)
+bool bg_team_warp(int32 bg_id, unsigned short mapindex, short x, short 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);
 
 
@@ -516,7 +516,7 @@ void bg_send_dot_remove(map_session_data *sd)
  * @param is_queue: Joined from queue
  * @param is_queue: Joined from queue
  * @return True on success or false otherwise
  * @return True on success or false otherwise
  */
  */
-bool bg_team_join(int bg_id, map_session_data *sd, bool is_queue)
+bool bg_team_join(int32 bg_id, map_session_data *sd, bool is_queue)
 {
 {
 	if (!sd || sd->bg_id)
 	if (!sd || sd->bg_id)
 		return false;
 		return false;
@@ -562,14 +562,14 @@ bool bg_team_join(int bg_id, map_session_data *sd, bool is_queue)
  * @param deserter: Whether to apply the deserter status or not
  * @param deserter: Whether to apply the deserter status or not
  * @return Remaining count in Battleground team or -1 on failure
  * @return Remaining count in Battleground team or -1 on failure
  */
  */
-int bg_team_leave(map_session_data *sd, bool quit, bool deserter)
+int32 bg_team_leave(map_session_data *sd, bool quit, bool deserter)
 {
 {
 	if (!sd || !sd->bg_id)
 	if (!sd || !sd->bg_id)
 		return -1;
 		return -1;
 
 
 	bg_send_dot_remove(sd);
 	bg_send_dot_remove(sd);
 
 
-	int bg_id = sd->bg_id;
+	int32 bg_id = sd->bg_id;
 	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);
 
 
 	sd->bg_id = 0;
 	sd->bg_id = 0;
@@ -652,9 +652,9 @@ bool bg_member_respawn(map_session_data *sd)
  * @param dev: Death NPC Event
  * @param dev: Death NPC Event
  * @return Battleground ID
  * @return Battleground ID
  */
  */
-int bg_create(uint16 mapindex, s_battleground_team* team)
+int32 bg_create(uint16 mapindex, s_battleground_team* team)
 {
 {
-	int bg_team_counter = 1;
+	int32 bg_team_counter = 1;
 
 
 	while (bg_team_db.find(bg_team_counter) != bg_team_db.end())
 	while (bg_team_db.find(bg_team_counter) != bg_team_db.end())
 		bg_team_counter++;
 		bg_team_counter++;
@@ -679,7 +679,7 @@ int bg_create(uint16 mapindex, s_battleground_team* team)
  * @param bl: Object
  * @param bl: Object
  * @return Battleground ID
  * @return Battleground ID
  */
  */
-int bg_team_get_id(struct block_list *bl)
+int32 bg_team_get_id(struct block_list *bl)
 {
 {
 	nullpo_ret(bl);
 	nullpo_ret(bl);
 
 
@@ -739,7 +739,7 @@ void bg_send_message(map_session_data *sd, const char *mes, size_t len)
  * Update a player's Battleground minimap icon
  * Update a player's Battleground minimap icon
  * @see DBApply
  * @see DBApply
  */
  */
-int bg_send_xy_timer_sub(std::shared_ptr<s_battleground_data> bg)
+int32 bg_send_xy_timer_sub(std::shared_ptr<s_battleground_data> bg)
 {
 {
 	map_session_data *sd;
 	map_session_data *sd;
 
 
@@ -780,7 +780,7 @@ TIMER_FUNC(bg_send_xy_timer)
  */
  */
 static TIMER_FUNC(bg_on_ready_loopback)
 static TIMER_FUNC(bg_on_ready_loopback)
 {
 {
-	int queue_id = (int)data;
+	int32 queue_id = (int)data;
 	std::shared_ptr<s_battleground_queue> queue = bg_search_queue(queue_id);
 	std::shared_ptr<s_battleground_queue> queue = bg_search_queue(queue_id);
 
 
 	if (queue == nullptr) {
 	if (queue == nullptr) {
@@ -808,7 +808,7 @@ static TIMER_FUNC(bg_on_ready_loopback)
  */
  */
 static TIMER_FUNC(bg_on_ready_expire)
 static TIMER_FUNC(bg_on_ready_expire)
 {
 {
-	int queue_id = (int)data;
+	int32 queue_id = (int)data;
 	std::shared_ptr<s_battleground_queue> queue = bg_search_queue(queue_id);
 	std::shared_ptr<s_battleground_queue> queue = bg_search_queue(queue_id);
 
 
 	if (queue == nullptr) {
 	if (queue == nullptr) {
@@ -841,7 +841,7 @@ static TIMER_FUNC(bg_on_ready_expire)
  */
  */
 static TIMER_FUNC(bg_on_ready_start)
 static TIMER_FUNC(bg_on_ready_start)
 {
 {
-	int queue_id = (int)data;
+	int32 queue_id = (int)data;
 	std::shared_ptr<s_battleground_queue> queue = bg_search_queue(queue_id);
 	std::shared_ptr<s_battleground_queue> queue = bg_search_queue(queue_id);
 
 
 	if (queue == nullptr) {
 	if (queue == nullptr) {
@@ -1046,7 +1046,7 @@ void bg_queue_join_party(const char *name, map_session_data *sd)
 			return;
 			return;
 		}
 		}
 
 
-		int p_online = 0;
+		int32 p_online = 0;
 
 
 		for (const auto &it : p->party.member) {
 		for (const auto &it : p->party.member) {
 			if (it.online)
 			if (it.online)
@@ -1395,7 +1395,7 @@ void bg_join_active(map_session_data *sd, std::shared_ptr<s_battleground_queue>
 
 
 	pc_delete_bg_queue_timer(sd); // Cancel timer so player doesn't leave the queue.
 	pc_delete_bg_queue_timer(sd); // Cancel timer so player doesn't leave the queue.
 
 
-	int bg_id_team_1 = static_cast<int>(mapreg_readreg(add_str(queue->map->team1.bg_id_var.c_str())));
+	int32 bg_id_team_1 = static_cast<int>(mapreg_readreg(add_str(queue->map->team1.bg_id_var.c_str())));
 	std::shared_ptr<s_battleground_data> bgteam_1 = util::umap_find(bg_team_db, bg_id_team_1);
 	std::shared_ptr<s_battleground_data> bgteam_1 = util::umap_find(bg_team_db, bg_id_team_1);
 
 
 	for (auto &pl_sd : queue->teama_members) {
 	for (auto &pl_sd : queue->teama_members) {
@@ -1415,7 +1415,7 @@ void bg_join_active(map_session_data *sd, std::shared_ptr<s_battleground_queue>
 		return;
 		return;
 	}
 	}
 
 
-	int bg_id_team_2 = static_cast<int>(mapreg_readreg(add_str(queue->map->team2.bg_id_var.c_str())));
+	int32 bg_id_team_2 = static_cast<int>(mapreg_readreg(add_str(queue->map->team2.bg_id_var.c_str())));
 	std::shared_ptr<s_battleground_data> bgteam_2 = util::umap_find(bg_team_db, bg_id_team_2);
 	std::shared_ptr<s_battleground_data> bgteam_2 = util::umap_find(bg_team_db, bg_id_team_2);
 
 
 	for (auto &pl_sd : queue->teamb_members) {
 	for (auto &pl_sd : queue->teamb_members) {
@@ -1547,8 +1547,8 @@ void bg_queue_start_battleground(std::shared_ptr<s_battleground_queue> queue)
 		return;
 		return;
 
 
 	uint16 map_idx = queue->map->mapindex;
 	uint16 map_idx = queue->map->mapindex;
-	int bg_team_1 = bg_create(map_idx, &queue->map->team1);
-	int bg_team_2 = bg_create(map_idx, &queue->map->team2);
+	int32 bg_team_1 = bg_create(map_idx, &queue->map->team1);
+	int32 bg_team_2 = bg_create(map_idx, &queue->map->team2);
 
 
 	for (const auto &sd : queue->teama_members) {
 	for (const auto &sd : queue->teama_members) {
 		clif_bg_queue_entry_init(sd);
 		clif_bg_queue_entry_init(sd);
@@ -1574,7 +1574,7 @@ void bg_queue_start_battleground(std::shared_ptr<s_battleground_queue> queue)
  * @param req_players: Required amount of players
  * @param req_players: Required amount of players
  * @return s_battleground_queue*
  * @return s_battleground_queue*
  */
  */
-static void bg_queue_create(int bg_id, int req_players)
+static void bg_queue_create(int32 bg_id, int32 req_players)
 {
 {
 	auto queue = std::make_shared<s_battleground_queue>();
 	auto queue = std::make_shared<s_battleground_queue>();
 
 

+ 22 - 22
src/map/battleground.hpp

@@ -22,7 +22,7 @@ struct s_battleground_member_data {
 };
 };
 
 
 struct s_battleground_data {
 struct s_battleground_data {
-	int id; ///< Battleground ID
+	int32 id; ///< Battleground ID
 	std::vector<s_battleground_member_data> members; ///< List of players in battleground
 	std::vector<s_battleground_member_data> members; ///< List of players in battleground
 	struct point cemetery; ///< Respawn point for players who die
 	struct point cemetery; ///< Respawn point for players who die
 	std::string logout_event; ///< NPC Event to call on log out events
 	std::string logout_event; ///< NPC Event to call on log out events
@@ -39,7 +39,7 @@ struct s_battleground_team {
 };
 };
 
 
 struct s_battleground_map {
 struct s_battleground_map {
-	int id; ///< Battleground ID
+	int32 id; ///< Battleground ID
 	uint16 mapindex; ///< Index of the map
 	uint16 mapindex; ///< Index of the map
 	s_battleground_team team1, team2; ///< Team data
 	s_battleground_team team1, team2; ///< Team data
 	std::string bgcallscript; ///< Script to be called when players join the battleground
 	std::string bgcallscript; ///< Script to be called when players join the battleground
@@ -56,27 +56,27 @@ enum e_queue_state : uint16 {
 
 
 /// Battlegrounds client interface queue system [MasterOfMuppets]
 /// Battlegrounds client interface queue system [MasterOfMuppets]
 struct s_battleground_queue {
 struct s_battleground_queue {
-	int queue_id; ///< Battlegrounds Queue ID
-	int id; ///< Battlegrounds database ID
+	int32 queue_id; ///< Battlegrounds Queue ID
+	int32 id; ///< Battlegrounds database ID
 	std::vector<map_session_data *> teama_members; ///< List of members on team A
 	std::vector<map_session_data *> teama_members; ///< List of members on team A
 	std::vector<map_session_data *> teamb_members; ///< List of members on team B
 	std::vector<map_session_data *> teamb_members; ///< List of members on team B
-	int required_players; ///< Amount of players required on each side to start
-	int max_players; ///< Maximum amount of players on each side
-	int accepted_players; ///< Amount of players who accepted the offer to enter the battleground
+	int32 required_players; ///< Amount of players required on each side to start
+	int32 max_players; ///< Maximum amount of players on each side
+	int32 accepted_players; ///< Amount of players who accepted the offer to enter the battleground
 	e_queue_state state; ///< See @e_queue_state
 	e_queue_state state; ///< See @e_queue_state
-	int tid_expire; ///< Timer ID associated with the time out at the ready to enter window
-	int tid_start; ///< Timer ID associated with the start delay
-	int tid_requeue; ///< Timer ID associated with requeuing this group if all BG maps are reserved
+	int32 tid_expire; ///< Timer ID associated with the time out at the ready to enter window
+	int32 tid_start; ///< Timer ID associated with the start delay
+	int32 tid_requeue; ///< Timer ID associated with requeuing this group if all BG maps are reserved
 	s_battleground_map *map; ///< Map this BG queue has been assigned to
 	s_battleground_map *map; ///< Map this BG queue has been assigned to
 };
 };
 
 
 struct s_battleground_type {
 struct s_battleground_type {
-	int id; ///< Battlegrounds database ID
+	int32 id; ///< Battlegrounds database ID
 	std::string name; ///< Name of the battleground type
 	std::string name; ///< Name of the battleground type
-	int required_players; ///< Amount of players required on each side to start
-	int max_players; ///< Maximum amount of players on each side
-	int min_lvl; ///< Minimum level to participate in this battleground type
-	int max_lvl; ///< Maximum level to participate in this battleground type
+	int32 required_players; ///< Amount of players required on each side to start
+	int32 max_players; ///< Maximum amount of players on each side
+	int32 min_lvl; ///< Minimum level to participate in this battleground type
+	int32 max_lvl; ///< Maximum level to participate in this battleground type
 	std::vector<s_battleground_map> maps; ///< List of battleground locations
 	std::vector<s_battleground_map> maps; ///< List of battleground locations
 	uint32 deserter_time; ///< Amount of time a player is marked deserter (seconds)
 	uint32 deserter_time; ///< Amount of time a player is marked deserter (seconds)
 	uint32 start_delay; ///< Amount of time before the start message is sent to players (seconds)
 	uint32 start_delay; ///< Amount of time before the start message is sent to players (seconds)
@@ -127,20 +127,20 @@ extern std::unordered_map<int, std::shared_ptr<s_battleground_data>> bg_team_db;
 extern std::vector<std::shared_ptr<s_battleground_queue>> bg_queues;
 extern std::vector<std::shared_ptr<s_battleground_queue>> bg_queues;
 
 
 std::shared_ptr<s_battleground_type> bg_search_name(const char *name);
 std::shared_ptr<s_battleground_type> bg_search_name(const char *name);
-std::shared_ptr<s_battleground_queue> bg_search_queue(int queue_id);
+std::shared_ptr<s_battleground_queue> bg_search_queue(int32 queue_id);
 void bg_send_dot_remove(map_session_data *sd);
 void bg_send_dot_remove(map_session_data *sd);
-int bg_team_get_id(struct block_list *bl);
+int32 bg_team_get_id(struct block_list *bl);
 map_session_data *bg_getavailablesd(s_battleground_data *bg);
 map_session_data *bg_getavailablesd(s_battleground_data *bg);
 
 
 bool bg_queue_reservation(const char *name, bool state, bool ended);
 bool bg_queue_reservation(const char *name, bool state, bool ended);
 #define bg_queue_reserve(name, end) (bg_queue_reservation(name, true, end))
 #define bg_queue_reserve(name, end) (bg_queue_reservation(name, true, end))
 #define bg_queue_unbook(name) (bg_queue_reservation(name, false, false))
 #define bg_queue_unbook(name) (bg_queue_reservation(name, false, false))
 
 
-int bg_create(uint16 mapindex, s_battleground_team* team);
-bool bg_team_join(int bg_id, map_session_data *sd, bool is_queue);
-bool bg_team_delete(int bg_id);
-int bg_team_leave(map_session_data *sd, bool quit, bool deserter);
-bool bg_team_warp(int bg_id, unsigned short mapindex, short x, short y);
+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_delete(int32 bg_id);
+int32 bg_team_leave(map_session_data *sd, bool quit, bool deserter);
+bool bg_team_warp(int32 bg_id, unsigned short mapindex, short x, short 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);

+ 15 - 15
src/map/buyingstore.cpp

@@ -24,7 +24,7 @@
 //Autotrader
 //Autotrader
 static DBMap *buyingstore_autotrader_db; /// Holds autotrader info: char_id -> struct s_autotrader
 static DBMap *buyingstore_autotrader_db; /// Holds autotrader info: char_id -> struct s_autotrader
 static void buyingstore_autotrader_remove(struct s_autotrader *at, bool remove);
 static void buyingstore_autotrader_remove(struct s_autotrader *at, bool remove);
-static int buyingstore_autotrader_free(DBKey key, DBData *data, va_list ap);
+static int32 buyingstore_autotrader_free(DBKey key, DBData *data, va_list ap);
 
 
 /// constants (client-side restrictions)
 /// constants (client-side restrictions)
 #define BUYINGSTORE_MAX_PRICE 99990000
 #define BUYINGSTORE_MAX_PRICE 99990000
@@ -113,7 +113,7 @@ int8 buyingstore_setup(map_session_data* sd, unsigned char slots){
 * @param at Autotrader info, or nullptr if requetsed not from autotrade persistance
 * @param at Autotrader info, or nullptr if requetsed not from autotrade persistance
 * @return 0 If success, 1 - Cannot open, 2 - Manner penalty, 3 - Mapflag restiction, 4 - Cell restriction, 5 - Invalid count/result, 6 - Cannot give item, 7 - Will be overweight
 * @return 0 If success, 1 - Cannot open, 2 - Manner penalty, 3 - Mapflag restiction, 4 - Cell restriction, 5 - Invalid count/result, 6 - Cannot give item, 7 - Will be overweight
 */
 */
-int8 buyingstore_create( map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub* itemlist, uint32 count, struct s_autotrader *at ){
+int8 buyingstore_create( map_session_data* sd, int32 zenylimit, unsigned char result, const char* storename, const struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub* itemlist, uint32 count, struct s_autotrader *at ){
 	uint32 i, weight, listidx;
 	uint32 i, weight, listidx;
 	char message_sql[MESSAGE_SIZE*2];
 	char message_sql[MESSAGE_SIZE*2];
 	StringBuf buf;
 	StringBuf buf;
@@ -179,7 +179,7 @@ int8 buyingstore_create( map_session_data* sd, int zenylimit, unsigned char resu
 			break;
 			break;
 		}
 		}
 
 
-		int idx = pc_search_inventory( sd, item->itemId );
+		int32 idx = pc_search_inventory( sd, item->itemId );
 
 
 		// At least one must be owned
 		// At least one must be owned
 		if( idx < 0 ){
 		if( idx < 0 ){
@@ -324,7 +324,7 @@ void buyingstore_open(map_session_data* sd, uint32 account_id)
 * @param count Number of item on the itemlist
 * @param count Number of item on the itemlist
 */
 */
 void buyingstore_trade( map_session_data* sd, uint32 account_id, uint32 buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, uint32 count ){
 void buyingstore_trade( map_session_data* sd, uint32 account_id, uint32 buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, uint32 count ){
-	int zeny = 0;
+	int32 zeny = 0;
 	uint32 weight;
 	uint32 weight;
 	map_session_data* pl_sd;
 	map_session_data* pl_sd;
 
 
@@ -369,11 +369,11 @@ void buyingstore_trade( map_session_data* sd, uint32 account_id, uint32 buyer_id
 	weight = pl_sd->weight;
 	weight = pl_sd->weight;
 
 
 	// check item list
 	// check item list
-	for( int i = 0; i < count; i++ ){
+	for( int32 i = 0; i < count; i++ ){
 		const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* item = &itemlist[i];
 		const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* item = &itemlist[i];
 
 
 		// duplicate check. as the client does this too, only malicious intent should be caught here
 		// duplicate check. as the client does this too, only malicious intent should be caught here
-		for( int k = 0; k < i; k++ ){
+		for( int32 k = 0; k < i; k++ ){
 			// duplicate
 			// duplicate
 			if( itemlist[k].index == item->index && k != i ){
 			if( itemlist[k].index == item->index && k != i ){
 				ShowWarning( "buyingstore_trade: Found duplicate item on selling list (prevnameid=%u, prevamount=%hu, nameid=%u, amount=%hu, account_id=%d, char_id=%d).\n", itemlist[k].itemId, itemlist[k].amount, item->itemId, item->amount, sd->status.account_id, sd->status.char_id );
 				ShowWarning( "buyingstore_trade: Found duplicate item on selling list (prevnameid=%u, prevamount=%hu, nameid=%u, amount=%hu, account_id=%d, char_id=%d).\n", itemlist[k].itemId, itemlist[k].amount, item->itemId, item->amount, sd->status.account_id, sd->status.char_id );
@@ -382,7 +382,7 @@ void buyingstore_trade( map_session_data* sd, uint32 account_id, uint32 buyer_id
 			}
 			}
 		}
 		}
 
 
-		int index = item->index - 2; // TODO: clif::server_index
+		int32 index = item->index - 2; // TODO: clif::server_index
 
 
 		// invalid input
 		// invalid input
 		if( index < 0 || index >= ARRAYLENGTH( sd->inventory.u.items_inventory ) || sd->inventory_data[index] == nullptr || sd->inventory.u.items_inventory[index].nameid != item->itemId || sd->inventory.u.items_inventory[index].amount < item->amount ){
 		if( index < 0 || index >= ARRAYLENGTH( sd->inventory.u.items_inventory ) || sd->inventory_data[index] == nullptr || sd->inventory.u.items_inventory[index].nameid != item->itemId || sd->inventory.u.items_inventory[index].amount < item->amount ){
@@ -396,7 +396,7 @@ void buyingstore_trade( map_session_data* sd, uint32 account_id, uint32 buyer_id
 			return;
 			return;
 		}
 		}
 
 
-		int listidx;
+		int32 listidx;
 
 
 		ARR_FIND( 0, pl_sd->buyingstore.slots, listidx, pl_sd->buyingstore.items[listidx].nameid == item->itemId );
 		ARR_FIND( 0, pl_sd->buyingstore.slots, listidx, pl_sd->buyingstore.items[listidx].nameid == item->itemId );
 
 
@@ -437,14 +437,14 @@ void buyingstore_trade( map_session_data* sd, uint32 account_id, uint32 buyer_id
 	}
 	}
 
 
 	// process item list
 	// process item list
-	for( int i = 0; i < count; i++ ){
+	for( int32 i = 0; i < count; i++ ){
 		const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* item = &itemlist[i];
 		const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* item = &itemlist[i];
-		int listidx;
+		int32 listidx;
 
 
 		ARR_FIND( 0, pl_sd->buyingstore.slots, listidx, pl_sd->buyingstore.items[listidx].nameid == item->itemId );
 		ARR_FIND( 0, pl_sd->buyingstore.slots, listidx, pl_sd->buyingstore.items[listidx].nameid == item->itemId );
 		zeny = item->amount * pl_sd->buyingstore.items[listidx].price;
 		zeny = item->amount * pl_sd->buyingstore.items[listidx].price;
 
 
-		int index = item->index - 2; // TODO: clif::server_index
+		int32 index = item->index - 2; // TODO: clif::server_index
 
 
 		// move item
 		// move item
 		pc_additem(pl_sd, &sd->inventory.u.items_inventory[index], item->amount, LOG_TYPE_BUYING_STORE);
 		pc_additem(pl_sd, &sd->inventory.u.items_inventory[index], item->amount, LOG_TYPE_BUYING_STORE);
@@ -477,7 +477,7 @@ void buyingstore_trade( map_session_data* sd, uint32 account_id, uint32 buyer_id
 	}
 	}
 	
 	
 	// check whether or not there is still something to buy
 	// check whether or not there is still something to buy
-	int i;
+	int32 i;
 	ARR_FIND( 0, pl_sd->buyingstore.slots, i, pl_sd->buyingstore.items[i].amount != 0 );
 	ARR_FIND( 0, pl_sd->buyingstore.slots, i, pl_sd->buyingstore.items[i].amount != 0 );
 	if( i == pl_sd->buyingstore.slots )
 	if( i == pl_sd->buyingstore.slots )
 	{// everything was bought
 	{// everything was bought
@@ -580,7 +580,7 @@ bool buyingstore_searchall(map_session_data* sd, const struct s_search_store_sea
 		ssitem->nameid = it->nameid;
 		ssitem->nameid = it->nameid;
 		ssitem->amount = it->amount;
 		ssitem->amount = it->amount;
 		ssitem->price = it->price;
 		ssitem->price = it->price;
-		for( int j = 0; j < MAX_SLOTS; j++ ){
+		for( int32 j = 0; j < MAX_SLOTS; j++ ){
 			ssitem->card[j] = 0;
 			ssitem->card[j] = 0;
 		}
 		}
 		ssitem->refine = 0;
 		ssitem->refine = 0;
@@ -609,7 +609,7 @@ void buyingstore_reopen( map_session_data* sd ){
 		// Init buyingstore data for autotrader
 		// Init buyingstore data for autotrader
 		CREATE(data, struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub, at->count );
 		CREATE(data, struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub, at->count );
 
 
-		for( int j = 0; j < at->count; j++) {
+		for( int32 j = 0; j < at->count; j++) {
 			data[j].itemId = at->entries[j]->item_id;
 			data[j].itemId = at->entries[j]->item_id;
 			data[j].amount = at->entries[j]->amount;
 			data[j].amount = at->entries[j]->amount;
 			data[j].price = at->entries[j]->price;
 			data[j].price = at->entries[j]->price;
@@ -791,7 +791,7 @@ static void buyingstore_autotrader_remove(struct s_autotrader *at, bool remove)
 * Clear all autotraders
 * Clear all autotraders
 * @author [Cydh]
 * @author [Cydh]
 */
 */
-static int buyingstore_autotrader_free(DBKey key, DBData *data, va_list ap) {
+static int32 buyingstore_autotrader_free(DBKey key, DBData *data, va_list ap) {
 	struct s_autotrader *at = (struct s_autotrader *)db_data2ptr(data);
 	struct s_autotrader *at = (struct s_autotrader *)db_data2ptr(data);
 	if (at)
 	if (at)
 		buyingstore_autotrader_remove(at, false);
 		buyingstore_autotrader_remove(at, false);

+ 4 - 4
src/map/buyingstore.hpp

@@ -15,7 +15,7 @@ class map_session_data;
 
 
 struct s_buyingstore_item
 struct s_buyingstore_item
 {
 {
-	int price;
+	int32 price;
 	unsigned short amount;
 	unsigned short amount;
 	t_itemid nameid;
 	t_itemid nameid;
 };
 };
@@ -23,7 +23,7 @@ struct s_buyingstore_item
 struct s_buyingstore
 struct s_buyingstore
 {
 {
 	struct s_buyingstore_item items[MAX_BUYINGSTORE_SLOTS];
 	struct s_buyingstore_item items[MAX_BUYINGSTORE_SLOTS];
-	int zenylimit;
+	int32 zenylimit;
 	unsigned char slots;
 	unsigned char slots;
 };
 };
 
 
@@ -41,7 +41,7 @@ struct s_autotrader {
 	uint32 id; ///< vendor/buyer id
 	uint32 id; ///< vendor/buyer id
 	uint32 account_id; ///< Account ID
 	uint32 account_id; ///< Account ID
 	uint32 char_id; ///< Char ID
 	uint32 char_id; ///< Char ID
-	int m; ///< Map location
+	int32 m; ///< Map location
 	uint16 x, ///< X location
 	uint16 x, ///< X location
 		y; ///< Y location
 		y; ///< Y location
 	unsigned char sex, ///< Autotrader's sex
 	unsigned char sex, ///< Autotrader's sex
@@ -56,7 +56,7 @@ struct s_autotrader {
 };
 };
 
 
 int8 buyingstore_setup(map_session_data* sd, unsigned char slots);
 int8 buyingstore_setup(map_session_data* sd, unsigned char slots);
-int8 buyingstore_create(map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub* itemlist, uint32 count, struct s_autotrader *at);
+int8 buyingstore_create(map_session_data* sd, int32 zenylimit, unsigned char result, const char* storename, const struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub* itemlist, uint32 count, struct s_autotrader *at);
 void buyingstore_close(map_session_data* sd);
 void buyingstore_close(map_session_data* sd);
 void buyingstore_open(map_session_data* sd, uint32 account_id);
 void buyingstore_open(map_session_data* sd, uint32 account_id);
 void buyingstore_trade(map_session_data* sd, uint32 account_id, uint32 buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, uint32 count);
 void buyingstore_trade(map_session_data* sd, uint32 account_id, uint32 buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, uint32 count);

+ 10 - 10
src/map/cashshop.cpp

@@ -138,9 +138,9 @@ std::shared_ptr<s_cash_item> CashShopDatabase::findItemInTab( e_cash_shop_tab ta
 CashShopDatabase cash_shop_db;
 CashShopDatabase cash_shop_db;
 
 
 #if PACKETVER_SUPPORTS_SALES
 #if PACKETVER_SUPPORTS_SALES
-static bool sale_parse_dbrow( char* fields[], int columns, int current ){
+static bool sale_parse_dbrow( char* fields[], int32 columns, int32 current ){
 	t_itemid nameid = strtoul(fields[0], nullptr, 10);
 	t_itemid nameid = strtoul(fields[0], nullptr, 10);
-	int start = atoi(fields[1]), end = atoi(fields[2]), amount = atoi(fields[3]);
+	int32 start = atoi(fields[1]), end = atoi(fields[2]), amount = atoi(fields[3]);
 	time_t now = time(nullptr);
 	time_t now = time(nullptr);
 	struct sale_item_data* sale_item = nullptr;
 	struct sale_item_data* sale_item = nullptr;
 
 
@@ -197,7 +197,7 @@ static void sale_read_db_sql( void ){
 	while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) ){
 	while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) ){
 		char* str[4];
 		char* str[4];
 		char dummy[256] = "";
 		char dummy[256] = "";
-		int i;
+		int32 i;
 
 
 		lines++;
 		lines++;
 
 
@@ -301,7 +301,7 @@ enum e_sale_add_result sale_add_item( t_itemid nameid, int32 count, time_t from,
 
 
 bool sale_remove_item( t_itemid nameid ){
 bool sale_remove_item( t_itemid nameid ){
 	struct sale_item_data* sale_item;
 	struct sale_item_data* sale_item;
-	int i;
+	int32 i;
 
 
 	// Check if there is an entry for this item id
 	// Check if there is an entry for this item id
 	sale_item = sale_find_item(nameid, false);
 	sale_item = sale_find_item(nameid, false);
@@ -353,7 +353,7 @@ bool sale_remove_item( t_itemid nameid ){
 }
 }
 
 
 struct sale_item_data* sale_find_item( t_itemid nameid, bool onsale ){
 struct sale_item_data* sale_find_item( t_itemid nameid, bool onsale ){
-	int i;
+	int32 i;
 	struct sale_item_data* sale_item;
 	struct sale_item_data* sale_item;
 	time_t now = time(nullptr);
 	time_t now = time(nullptr);
 
 
@@ -391,7 +391,7 @@ struct sale_item_data* sale_find_item( t_itemid nameid, bool onsale ){
 }
 }
 
 
 void sale_notify_login( map_session_data* sd ){
 void sale_notify_login( map_session_data* sd ){
-	int i;
+	int32 i;
 
 
 	for( i = 0; i < sale_items.count; i++ ){
 	for( i = 0; i < sale_items.count; i++ ){
 		if( sale_items.item[i]->timer_end != INVALID_TIMER ){
 		if( sale_items.item[i]->timer_end != INVALID_TIMER ){
@@ -406,7 +406,7 @@ static void cashshop_read_db( void ){
 	cash_shop_db.load();
 	cash_shop_db.load();
 
 
 #if PACKETVER_SUPPORTS_SALES
 #if PACKETVER_SUPPORTS_SALES
-	int i;
+	int32 i;
 	time_t now = time(nullptr);
 	time_t now = time(nullptr);
 
 
 	sale_read_db_sql();
 	sale_read_db_sql();
@@ -438,10 +438,10 @@ static void cashshop_read_db( void ){
  * @param item_list Array of item ID
  * @param item_list Array of item ID
  * @return true: success, false: fail
  * @return true: success, false: fail
  */
  */
-bool cashshop_buylist( map_session_data* sd, uint32 kafrapoints, int n, const PACKET_CZ_SE_PC_BUY_CASHITEM_LIST_sub* item_list ){
+bool cashshop_buylist( map_session_data* sd, uint32 kafrapoints, int32 n, const PACKET_CZ_SE_PC_BUY_CASHITEM_LIST_sub* item_list ){
 	uint32 totalcash = 0;
 	uint32 totalcash = 0;
 	uint32 totalweight = 0;
 	uint32 totalweight = 0;
-	int i,new_;
+	int32 i,new_;
 
 
 	if( sd == nullptr || item_list == nullptr ){
 	if( sd == nullptr || item_list == nullptr ){
 		clif_cashshop_result( sd, 0, CASHSHOP_RESULT_ERROR_UNKNOWN );
 		clif_cashshop_result( sd, 0, CASHSHOP_RESULT_ERROR_UNKNOWN );
@@ -640,7 +640,7 @@ void do_final_cashshop( void ){
 
 
 #if PACKETVER_SUPPORTS_SALES
 #if PACKETVER_SUPPORTS_SALES
 	if( sale_items.count > 0 ){
 	if( sale_items.count > 0 ){
-		for( int i = 0; i < sale_items.count; i++ ){
+		for( int32 i = 0; i < sale_items.count; i++ ){
 			struct sale_item_data* it = sale_items.item[i];
 			struct sale_item_data* it = sale_items.item[i];
 
 
 			if( it->timer_start != INVALID_TIMER ){
 			if( it->timer_start != INVALID_TIMER ){

Some files were not shown because too many files changed in this diff