Explorar o código

Changed all int to int32 (#8787)

Lemongrass3110 hai 6 meses
pai
achega
0d2d088bb2
Modificáronse 100 ficheiros con 2560 adicións e 2538 borrados
  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;
 
 //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 CharServ_Config charserv_config;
 struct mmo_map_server map_server[MAX_MAP_SERVERS];
 //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]
 struct fame_list smith_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 map_ip;
 } subnet[16];
-int subnet_count = 0;
+int32 subnet_count = 0;
 
 // uint32 account_id -> struct auth_node*
 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
 	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);
@@ -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) {
 		character->char_id = -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.
 }
 
-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)
 		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);
 }
 
-void char_set_all_offline(int id){
+void char_set_all_offline(int32 id){
 	if (id < 0)
 		ShowNotice("Sending all users offline.\n");
 	else
@@ -254,12 +254,12 @@ void char_set_all_offline_sql(void){
 		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]
-	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;
 
 	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.
-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;
 	SqlStmt* stmt;
-	int i, j, offset = 0, errors = 0;
+	int32 i, j, offset = 0, errors = 0;
 	const char *tablename, *selectoption, *printname;
 	struct item item; // temp storage variable
 	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].unique_id == item.unique_id
 			) {	//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_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;
 }
 
-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;
 	SqlStmt* stmt;
-	int i,j, offset = 0, max2;
+	int32 i,j, offset = 0, max2;
 	struct item item, *storage;
 	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_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
 	switch( sex ){
 		case 'M':
@@ -885,7 +885,7 @@ int char_mmo_gender( const struct char_session_data *sd, const struct mmo_charst
 #endif
 			// There are calls to this function that do not contain the session
 			if( sd == nullptr ){
-				int i;
+				int32 i;
 
 				// 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 );
@@ -906,14 +906,14 @@ int char_mmo_gender( const struct char_session_data *sd, const struct mmo_charst
 #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.
-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;
 	struct mmo_charstatus p;
-	int j = 0, i;
+	int32 j = 0, i;
 	char sex[2];
 
 	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;
 	struct s_point_str tmp_point;
 	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;
 #ifdef HOTKEY_SAVING
 	struct hotkey tmp_hotkey;
-	int hotkey_num;
+	int32 hotkey_num;
 #endif
 	StringBuf msg_buf;
 	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);
 
 	//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
 //-----------------------------------
-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;
 	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;
 }
 
-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
 	if( name[0] == '\0' )
@@ -1410,14 +1410,14 @@ int char_check_char_name(char * name, char * esc_name)
 //-----------------------------------
 // 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 esc_name[NAME_LENGTH*2+1];
 	struct s_point_str tmp_start_point[MAX_STARTPOINT];
 	struct startitem tmp_start_items[MAX_STARTITEM];
 	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);
 	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 */
 /*----------------------------------------------------------------------------------------------------------*/
-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) )
 		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) )
@@ -1565,11 +1565,11 @@ enum e_char_del_response char_delete(struct char_session_data* sd, uint32 char_i
 	char name[NAME_LENGTH];
 	char esc_name[NAME_LENGTH*2+1]; //Name needs be escaped.
 	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;
 	char *data;
 	size_t len;
-	int i;
+	int32 i;
 
 	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
  * @return numbers of total users
  */
-int char_count_users(void)
+int32 char_count_users(void)
 {
-	int i, users;
+	int32 i, users;
 
 	users = 0;
 	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.
 // Used in packets 0x6b (chars info) and 0x6d (new char info)
 // 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 )
 		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) )
 		Sql_ShowDebug(sql_handle);
@@ -1901,7 +1901,7 @@ int char_married(int pl1, int pl2)
 	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
 		return 0;
@@ -1922,7 +1922,7 @@ int char_child(int parent_id, int child_id)
 	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
 		return 0;
@@ -1930,9 +1930,9 @@ int char_family(int cid1, int cid2, int cid3)
 		Sql_ShowDebug(sql_handle);
 	else while( SQL_SUCCESS == Sql_NextRow(sql_handle) )
 	{
-		int charid;
-		int partnerid;
-		int childid;
+		int32 charid;
+		int32 partnerid;
+		int32 childid;
 		char* 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)
 {
-	int i;
+	int32 i;
 	struct char_session_data* sd;
 
 	// disconnect player if online on char-server
@@ -1971,8 +1971,8 @@ void char_disconnect_player(uint32 account_id)
 * @param value
 * @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;
 
 	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 );
 
 	// 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)
 {
-	int i;
+	int32 i;
 	char* data;
 	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)
 //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;
 	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).
 // 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)
 		&& (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
  * @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) );
 	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));
@@ -2138,7 +2138,7 @@ int char_lan_subnetcheck(uint32 ip){
 
 // Console Command Parser [Wizputer]
 //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);
 }
 
@@ -2146,7 +2146,7 @@ int parse_console(const char* buf){
 //------------------------------------------------
 //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 ){
 		sd->pincode_try = 0;
 		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 ){
-	int i;
+	int32 i;
 	char tab[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
 	char *buf;
 
@@ -2175,7 +2175,7 @@ bool char_pincode_decrypt( uint32 userSeed, char* pin ){
 	}
 
 	for( i = 1; i < 10; i++ ){
-		int pos;
+		int32 pos;
 		uint32 multiplier = 0x3498, baseSeed = 0x881234;
 
 		userSeed = baseSeed + userSeed * multiplier;
@@ -2256,9 +2256,9 @@ TIMER_FUNC(char_clan_member_cleanup){
 // Reading Lan Support configuration
 // Rewrote: Anvanced subnet check [LuzZza]
 //----------------------------------
-int char_lan_config_read(const char *lancfgName) {
+int32 char_lan_config_read(const char *lancfgName) {
 	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];
 
 	if((fp = fopen(lancfgName, "r")) == nullptr) {
@@ -2312,7 +2312,7 @@ int char_lan_config_read(const char *lancfgName) {
  * @return 0:fail, 1:success
  */
 bool char_checkdb(void){
-	int i;
+	int32 i;
 	const char* sqltable[] = {
 		schema_config.char_db, schema_config.hotkey_db, schema_config.scdata_db, schema_config.cart_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 ){
 	char *lineitem, **fields;
-	int i = 0;
+	int32 i = 0;
 	size_t fields_length = 3 + 1;
 
 	(*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])
 {
 	char *lineitem, **fields;
-	int i = 0;
+	int32 i = 0;
 	size_t fields_length = 3 + 1;
 
 	memset(start_items, 0, sizeof(struct startitem) * MAX_STARTITEM);
@@ -3131,10 +3131,10 @@ void char_config_adjust() {
 /*
  * 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);
 }
-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);
 }
 void char_do_final_msg(void){
@@ -3174,12 +3174,12 @@ void CharacterServer::finalize(){
 void CharacterServer::handle_shutdown(){
 	ShowStatus("Shutting down...\n");
 	// 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);
 	flush_fifos();
 }
 
-bool CharacterServer::initialize( int argc, char *argv[] ){
+bool CharacterServer::initialize( int32 argc, char *argv[] ){
 	// Init default value
 	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;
 }
 
-int main( int argc, char *argv[] ){
+int32 main( int32 argc, char *argv[] ){
 	return main_core<CharacterServer>( argc, argv );
 }

+ 71 - 71
src/char/char.hpp

@@ -23,7 +23,7 @@ namespace rathena{
 	namespace server_character{
 		class CharacterServer : public Core{
 			protected:
-				bool initialize( int argc, char* argv[] ) override;
+				bool initialize( int32 argc, char* argv[] ) override;
 				void finalize() 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_STARTITEM 32
@@ -63,7 +63,7 @@ enum e_char_del_response {
 };
 
 struct Schema_Config {
-	int db_use_sqldbs;
+	int32 db_use_sqldbs;
 	char db_path[1024];
 	char char_db[DB_NAME_LEN];
 	char scdata_db[DB_NAME_LEN];
@@ -130,8 +130,8 @@ enum pincode_state : uint8 {
 };
 struct Pincode_Config {
 	bool pincode_enabled;
-	int pincode_changetime;
-	int pincode_maxtry;
+	int32 pincode_changetime;
+	int32 pincode_maxtry;
 	bool pincode_force;
 	bool pincode_allow_repeated;
 	bool pincode_allow_sequential;
@@ -144,16 +144,16 @@ struct CharMove_Config {
 	bool char_moves_unlimited;
 };
 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]
 	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]
-	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)
-	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_guild;	// Character renaming in a guild
 };
@@ -172,9 +172,9 @@ struct CharServ_Config {
 	char bind_ip_str[128];
 	uint32 bind_ip;
 	uint16 char_port;
-	int char_maintenance;
+	int32 char_maintenance;
 	bool char_new;
-	int char_new_display;
+	int32 char_new_display;
 
 	struct CharMove_Config charmove_config;
 	struct Char_Config char_config;
@@ -182,39 +182,39 @@ struct CharServ_Config {
 	struct Pincode_Config pincode_config;
 #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
 	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
 	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;
 
 #define MAX_MAP_SERVERS 2 //how many mapserver a char server can handle
 struct mmo_map_server {
-	int fd;
+	int32 fd;
 	uint32 ip;
 	uint16 port;
-	int users;
+	int32 users;
 	std::vector<std::string> maps;
 };
 extern struct mmo_map_server map_server[MAX_MAP_SERVERS];
@@ -226,9 +226,9 @@ struct auth_node {
 	uint32 login_id1;
 	uint32 login_id2;
 	uint32 ip;
-	int sex;
+	int32 sex;
 	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;
 	uint8 version;
 };
@@ -238,8 +238,8 @@ std::unordered_map<uint32, std::shared_ptr<struct auth_node>>& char_get_authdb()
 struct online_char_data {
 	uint32 account_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
 	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 {
 	bool auth; // whether the session is authed or not
 	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]
 	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 chars_vip;
 	uint8 chars_billing;
@@ -272,16 +272,16 @@ struct char_session_data {
 	uint32 char_moves[MAX_CHARS]; // character moves left
 	uint8 isvip;
 	time_t unban_time[MAX_CHARS];
-	int charblock_timer;
+	int32 charblock_timer;
 	uint8 flag; // &1 - Retrieving guild bound items
 };
 
 std::unordered_map<uint32, std::shared_ptr<struct mmo_charstatus>>& char_get_chardb();
 
 //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]
 extern struct fame_list smith_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 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_all_offline(int id);
+void char_set_all_offline(int32 id);
 void char_disconnect_player(uint32 account_id);
 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);
-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;
-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 );
-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_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_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_txt(msg_number) char_msg_txt(msg_number)
 #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);
 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
 // 0: success
 // 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);
 	WFIFOW(fd,0) = HEADER_HC_ACK_CHANGE_CHARACTER_SLOT;
 	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
  */
-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);
 
 	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
  *   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);
 	WFIFOW(fd, 0) = 0x8b9;
 	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
  */
-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);
 
 	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
  */
-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);
 
 	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
  */
 bool pincode_allowed( char* pincode ){
-	int i;
+	int32 i;
 	char c, n, compare[PINCODE_LENGTH+1];
 
 	memset( compare, 0, PINCODE_LENGTH+1);
@@ -261,7 +261,7 @@ bool pincode_allowed( char* 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);
 
 	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
  */
-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);
 
 	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)
 //----------------------------------------
-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
 #if defined(PACKETVER_RE) && PACKETVER >= 20151001 && PACKETVER < 20180103
 	WFIFOHEAD(fd, 10);
 	WFIFOW(fd, 0) = 0x9a0;
 	// 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;
 	WFIFOSET(fd,10);
 #else
 	WFIFOHEAD(fd, 6);
 	WFIFOW(fd, 0) = 0x9a0;
 	// 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);
 #endif
 }
@@ -361,8 +361,8 @@ void chclif_charlist_notify( int fd, struct char_session_data* sd ){
 //----------------------------------------
 // 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
 	offset = 3;
@@ -392,7 +392,7 @@ int chclif_mmo_send006b(int fd, struct char_session_data* sd){
 //----------------------------------------
 // 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)
 		ShowInfo("Loading Char Data (" CL_BOLD "%d" CL_RESET ")\n",sd->account_id);
 	WFIFOHEAD(fd,29);
@@ -407,7 +407,7 @@ void chclif_mmo_send082d(int fd, struct char_session_data* sd) {
 	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;
 
 	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
  */
-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
 	chclif_mmo_send082d(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
  *  8 : already online
  */
-void chclif_send_auth_result(int fd,char result){
+void chclif_send_auth_result(int32 fd,char result){
 	WFIFOHEAD(fd,3);
 	WFIFOW(fd,0) = 0x81;
 	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.
 /// Any (0x718): An unknown error has occurred.
 /// 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);
 	WFIFOW(fd,0) = 0x828;
 	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.
 /// Any (0x718): An unknown error has occurred.
 /// 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(result == 1 ){
 		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.
 /// Any (0x718): An unknown error has occurred.
 /// 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);
 	WFIFOW(fd,0) = 0x82c;
 	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
-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)
 	{
 		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
-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)
 	{
 		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
-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);
 
 	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
  * charserv can handle a MAX_SERVERS mapservs
  */
-int chclif_parse_maplogin(int fd){
+int32 chclif_parse_maplogin(int32 fd){
 	if (RFIFOREST(fd) < 60)
 		return 0;
 	else {
-		int i;
+		int32 i;
 		char* l_user = RFIFOCP(fd,2);
 		char* l_pass = RFIFOCP(fd,26);
 		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
-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
 		return 0;
 	else {
 		uint32 account_id = RFIFOL(fd,2);
 		uint32 login_id1 = RFIFOL(fd,6);
 		uint32 login_id2 = RFIFOL(fd,10);
-		int sex = RFIFOB(fd,16);
+		int32 sex = RFIFOB(fd,16);
 		RFIFOSKIP(fd,17);
 
 		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}
-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);
 	RFIFOSKIP(fd,2);
 	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
-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
-	int cmd = 0xAC5;
-	int size = 156;
+	int32 cmd = 0xAC5;
+	int32 size = 156;
 #else
-	int cmd = 0x71;
-	int size = 28;
+	int32 cmd = 0x71;
+	int32 size = 28;
 #endif
 
 	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);
 }
 
-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
 	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;
 	}
 
-	int map_fd;
+	int32 map_fd;
 
 	// Send NEW auth packet [Kevin]
 	// 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
 }
 
-void chclif_accessible_maps( int fd ){
+void chclif_accessible_maps( int32 fd ){
 #if PACKETVER >= 20100714
 	PACKET_HC_NOTIFY_ACCESSIBLE_MAPNAME* p = reinterpret_cast<PACKET_HC_NOTIFY_ACCESSIBLE_MAPNAME*>( packet_buffer );
 
 	p->packetType = HEADER_HC_NOTIFY_ACCESSIBLE_MAPNAME;
 	p->packetLength = sizeof( *p );
 
-	int count = 0;
+	int32 count = 0;
 	for( s_point_str& accessible_map : accessible_maps ){
 		int32 mapserver = char_search_mapserver( accessible_map.map, -1, -1 );
 
@@ -1002,15 +1002,15 @@ void chclif_accessible_maps( int fd ){
 #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)
 	{
 		struct mmo_charstatus char_dat;
 		char* data;
 		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);
 
 		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 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
-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
 	else if (cmd == 0x970) FIFOSD_CHECK(31) //>=20120307
 	else if (cmd == 0x67) FIFOSD_CHECK(37)
 	else return 0;
 
-	int char_id;
+	int32 char_id;
 
 	if( (charserv_config.char_new)==0 ) //turn character creation on/off [Kevin]
 		char_id = -2;
 	else {
 		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;
-		int sex;
+		int32 sex;
 
 #if PACKETVER >= 20151001
 		// Sent values
@@ -1237,7 +1237,7 @@ int chclif_parse_createnewchar(int fd, struct char_session_data* sd,int cmd){
 		}
 		WFIFOSET(fd,3);
 	} else {
-		int len;
+		int32 len;
 		// retrieve data
 		struct mmo_charstatus char_dat;
 		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
  *	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);
 	WFIFOW(fd,0) = 0x70;
 	WFIFOB(fd,2) = errCode;
 	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)
 	else if (cmd == 0x1fb) FIFOSD_CHECK(56)
 	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
-int chclif_parse_keepalive(int fd){
+int32 chclif_parse_keepalive(int32 fd){
 	if (RFIFOREST(fd) < 6)
 		return 0;
-	//int aid = RFIFOL(fd,2);
+	//int32 aid = RFIFOL(fd,2);
 	RFIFOSKIP(fd,6);
 	return 1;
 }
@@ -1327,7 +1327,7 @@ int chclif_parse_keepalive(int fd){
 // result:
 //		0 = name is not 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);
 	WFIFOW(fd, 0) = 0x28e;
 	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
 // 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);
 
-	int i, cid, aid;
+	int32 i, cid, aid;
 	char name[NAME_LENGTH];
 	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){
 	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);
 
 	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)
  * <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);
 
 	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.
 //		9: The name change is prohibited. Character name change failed.
 //		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
 	WFIFOHEAD(fd, 6);
 	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
 // 028f <char_id>.L (CH_REQ_CHANGE_CHARNAME)
 // 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
 	FIFOSD_CHECK(30)
 	{
-		int i, cid;
+		int32 i, cid;
 		char name[NAME_LENGTH], esc_name[NAME_LENGTH * 2 + 1];
 
 		cid = RFIFOL(fd, 2);
@@ -1493,8 +1493,8 @@ int chclif_parse_ackrename(int fd, struct char_session_data* sd){
 #else
 	FIFOSD_CHECK(6)
 	{
-		int i;
-		int cid = RFIFOL(fd,2);
+		int32 i;
+		int32 cid = RFIFOL(fd,2);
 		RFIFOSKIP(fd,6);
 
 		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
 }
 
-int chclif_ack_captcha(int fd){
+int32 chclif_ack_captcha(int32 fd){
 	WFIFOHEAD(fd,5);
 	WFIFOW(fd,0) = 0x7e9;
 	WFIFOW(fd,2) = 5;
@@ -1518,7 +1518,7 @@ int chclif_ack_captcha(int fd){
 }
 
 // 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);
 	WFIFOW(fd,0) = 0x6c;
 	WFIFOB(fd,2) = errCode;// rejected from server
@@ -1526,7 +1526,7 @@ void chclif_reject(int fd, uint8 errCode){
 }
 
 // R 07e5 <?>.w <aid>.l
-int chclif_parse_reqcaptcha(int fd){
+int32 chclif_parse_reqcaptcha(int32 fd){
 	//FIFOSD_CHECK(8)
 	RFIFOSKIP(fd,8);
 	chclif_ack_captcha(fd);
@@ -1534,7 +1534,7 @@ int chclif_parse_reqcaptcha(int fd){
 }
 
 // R 07e7 <len>.w <aid>.l <code>.b10 <?>.b14
-int chclif_parse_chkcaptcha(int fd){
+int32 chclif_parse_chkcaptcha(int32 fd){
 	//FIFOSD_CHECK(32)
 	RFIFOSKIP(fd,32);
 	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.
  * @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;
 	uint32 ipl = session[fd]->client_addr;
 
@@ -1572,7 +1572,7 @@ int chclif_parse(int fd) {
 	}
 
 	while( RFIFOREST(fd) >= 2 ) {
-		int next = 1;
+		int32 next = 1;
 		unsigned short cmd;
 
 		cmd = RFIFOW(fd,0);

+ 39 - 39
src/char/char_clif.hpp

@@ -10,47 +10,47 @@
 struct char_session_data;
 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
-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
 
-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 */

+ 2 - 2
src/char/char_cnslif.cpp

@@ -56,11 +56,11 @@ TIMER_FUNC(cnslif_console_timer){
 }
 
 // Console Command Parser [Wizputer]
-int cnslif_parse(const char* buf)
+int32 cnslif_parse(const char* buf)
 {
 	char type[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[^\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
 #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);
 
 

+ 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 ){
 	if ( chlogif_isconnected() ){
-		int size = 8 + PINCODE_LENGTH+1;
+		int32 size = 8 + PINCODE_LENGTH+1;
 		WFIFOHEAD(login_fd,size);
 		WFIFOW(login_fd,0) = 0x2738;
 		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 ){
 		//ShowInfo("Asking to start pincode to AID: %d\n", sd->account_id);
 		// PIN code system enabled
@@ -97,7 +97,7 @@ TIMER_FUNC(chlogif_send_acc_tologin){
 	if ( chlogif_isconnected() ){
 		// send account list to login server
 		size_t users = char_get_onlinedb().size();
-		int i = 0;
+		int32 i = 0;
 
 		WFIFOHEAD(login_fd,8+users*4);
 		WFIFOW(login_fd,0) = 0x272d;
@@ -117,7 +117,7 @@ TIMER_FUNC(chlogif_send_acc_tologin){
 	return 0;
 }
 
-void chlogif_send_usercount(int users){
+void chlogif_send_usercount(int32 users){
 	if (!chlogif_isconnected())
 		return;
 	// send number of user to login server
@@ -130,10 +130,10 @@ void chlogif_send_usercount(int users){
 
 TIMER_FUNC(chlogif_broadcast_user_count){
 	uint8 buf[6];
-	int users = char_count_users();
+	int32 users = char_count_users();
 
 	// only send an update when needed
-	static int prev_users = 0;
+	static int32 prev_users = 0;
 	if( prev_users == users )
 		return 0;
 	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;
 
 	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_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);
 }
 
-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())
 		return;
 	WFIFOHEAD(fd,6);
@@ -243,7 +243,7 @@ void chlogif_send_reqaccdata(int fd, struct char_session_data *sd){
 	WFIFOSET(fd,6);
 }
 
-void chlogif_send_setacconline(int aid){
+void chlogif_send_setacconline(int32 aid){
 	if (!chlogif_isconnected())
 		return;
 	WFIFOHEAD(login_fd,6);
@@ -252,7 +252,7 @@ void chlogif_send_setacconline(int aid){
 	WFIFOSET(login_fd,6);
 }
 
-void chlogif_send_setallaccoffline(int fd){
+void chlogif_send_setallaccoffline(int32 fd){
 	if (!chlogif_isconnected())
 		return;
 	WFIFOHEAD(fd,2);
@@ -260,7 +260,7 @@ void chlogif_send_setallaccoffline(int fd){
 	WFIFOSET(fd,2);
 }
 
-void chlogif_send_setaccoffline(int fd, int aid){
+void chlogif_send_setaccoffline(int32 fd, int32 aid){
 	if (!chlogif_isconnected())
 		return;
 	WFIFOHEAD(fd,6);
@@ -269,7 +269,7 @@ void chlogif_send_setaccoffline(int fd, int aid){
 	WFIFOSET(fd,6);
 }
 
-int chlogif_parse_ackconnect(int fd){
+int32 chlogif_parse_ackconnect(int32 fd){
 	if (RFIFOREST(fd) < 3)
 		return 0;
 
@@ -289,7 +289,7 @@ int chlogif_parse_ackconnect(int fd){
 	return 1;
 }
 
-int chlogif_parse_ackaccreq(int fd){
+int32 chlogif_parse_ackaccreq(int32 fd){
 	if (RFIFOREST(fd) < 21)
 		return 0;
 	{
@@ -299,14 +299,14 @@ int chlogif_parse_ackaccreq(int fd){
 		uint32 login_id2 = RFIFOL(fd,10);
 		uint8 sex = RFIFOB(fd,14);
 		uint8 result = RFIFOB(fd,15);
-		int request_id = RFIFOL(fd,16);
+		int32 request_id = RFIFOL(fd,16);
 		uint8 clienttype = RFIFOB(fd,20);
 		RFIFOSKIP(fd,21);
 
 		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 )
 		{
-			int client_fd = request_id;
+			int32 client_fd = request_id;
 			sd->clienttype = clienttype;
 
 			switch( result )
@@ -327,10 +327,10 @@ int chlogif_parse_ackaccreq(int fd){
  * 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
  **/
-int chlogif_parse_reqaccdata(int fd){
+int32 chlogif_parse_reqaccdata(int32 fd){
 	if (RFIFOREST(fd) < 75)
 		return 0;
-	int u_fd; //user fd
+	int32 u_fd; //user fd
 	struct char_session_data* sd;
 
 	// find the authenticated session with this account id
@@ -370,7 +370,7 @@ int chlogif_parse_reqaccdata(int fd){
 	return 1;
 }
 
-int chlogif_parse_keepalive(int fd){
+int32 chlogif_parse_keepalive(int32 fd){
 	if (RFIFOREST(fd) < 2)
 		return 0;
 	RFIFOSKIP(fd,2);
@@ -389,7 +389,7 @@ int chlogif_parse_keepalive(int fd){
  * @param class_   The character's current job class.
  * @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
 	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);
 }
 
-int chlogif_parse_ackchangesex(int fd)
+int32 chlogif_parse_ackchangesex(int32 fd)
 {
 	if (RFIFOREST(fd) < 7)
 		return 0;
 	else {
 		unsigned char buf[7];
 		uint32 acc = RFIFOL(fd,2);
-		int sex = RFIFOB(fd,6);
+		int32 sex = RFIFOB(fd,6);
 		RFIFOSKIP(fd,7);
 
 		if (acc > 0) { // TODO: Is this even possible?
 			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 );
 			SqlStmt *stmt;
 
@@ -520,9 +520,9 @@ int chlogif_parse_ackchangesex(int fd)
  * @retval 0 in case of success.
  * @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];
 	char *data;
 
@@ -554,7 +554,7 @@ int chlogif_parse_ackchangecharsex(int char_id, int sex)
 	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))
 		return 0;
 	else { //Receive account_reg2 registry, forward to map servers.
@@ -565,7 +565,7 @@ int chlogif_parse_ack_global_accreg(int fd){
 	return 1;
 }
 
-int chlogif_parse_accbannotification(int fd){
+int32 chlogif_parse_accbannotification(int32 fd){
 	if (RFIFOREST(fd) < 11)
 		return 0;
 	else { // send to all map-servers to disconnect the player
@@ -582,7 +582,7 @@ int chlogif_parse_accbannotification(int fd){
 	return 1;
 }
 
-int chlogif_parse_askkick(int fd){
+int32 chlogif_parse_askkick(int32 fd){
 	if (RFIFOREST(fd) < 6)
 		return 0;
 	else {
@@ -602,7 +602,7 @@ int chlogif_parse_askkick(int fd){
 			else
 			{// Manual kick from char server.
 				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 );
 				if( i < fd_max )
 				{
@@ -620,7 +620,7 @@ int chlogif_parse_askkick(int fd){
 	return 1;
 }
 
-int chlogif_parse_updip(int fd){
+int32 chlogif_parse_updip(int32 fd){
 	unsigned char buf[2];
 	uint32 new_ip = 0;
 
@@ -654,7 +654,7 @@ int chlogif_parse_updip(int fd){
  * AH 0x2743
  * 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
 	if (RFIFOREST(fd) < 19)
 		return 0;
@@ -663,7 +663,7 @@ int chlogif_parse_vipack(int fd) {
 		uint32 vip_time = RFIFOL(fd,6); //vip_time
 		uint8 flag = RFIFOB(fd,10);
 		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);
 		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
  * @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);
 #ifdef VIP_ENABLE
 	WFIFOHEAD(login_fd,15);
@@ -698,7 +698,7 @@ int chlogif_reqvipdata(uint32 aid, uint8 flag, int32 timediff, int mapfd) {
 * HA 0x2720
 * 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);
 	//ShowInfo("%d request account info for %d (type %d)\n", u_aid, account_id, type);
 	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
  * 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)
 		return 0;
 	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
 	if( fd != login_fd ) {
@@ -767,7 +767,7 @@ int chlogif_parse(int fd) {
 		// -1: Login server is not connected
 		//  0: Avoid processing followup packets (prev was probably incomplete) packet
 		//  1: Continue parsing
-		int next = 1;
+		int32 next = 1;
 		uint16 command = RFIFOW(fd,0);
 		switch( command ) {
 			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);
 }
 
@@ -843,7 +843,7 @@ void do_init_chlogif(void) {
 
 /// Resets all the data.
 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]
 	for( id = 0; id < ARRAYLENGTH(map_server); ++id )
 		chmapif_server_reset(id);
@@ -859,7 +859,7 @@ void chlogif_on_disconnect(void){
 /// Called when all the connection steps are completed.
 void chlogif_on_ready(void)
 {
-	int i;
+	int32 i;
 
 	//Send online accounts to login server.
 	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
 void chlogif_pincode_notifyLoginPinError( uint32 account_id );
 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
 TIMER_FUNC(chlogif_send_acc_tologin);
 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_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_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);
 void do_init_chlogif(void);
 void chlogif_reset(void);

+ 86 - 86
src/char/char_mapif.cpp

@@ -27,12 +27,12 @@ using namespace rathena;
  * @param len: size of packet
  * @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;
 	for(i = 0; i < ARRAYLENGTH(map_server); i++) {
-		int fd;
+		int32 fd;
 		if (session_isValid(fd = map_server[i].fd)) {
 			WFIFOHEAD(fd,len);
 			memcpy(WFIFOP(fd,0), buf, len);
@@ -51,12 +51,12 @@ int chmapif_sendall(unsigned char *buf, uint32 len){
  * @param len: size of packet
  * @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;
 	for(i = 0; i < ARRAYLENGTH(map_server); i++) {
-		int fd;
+		int32 fd;
 		if (session_isValid(fd = map_server[i].fd) && fd != sfd) {
 			WFIFOHEAD(fd,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
  * @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)) {
-		int i;
+		int32 i;
 		ARR_FIND( 0, ARRAYLENGTH(map_server), i, fd == map_server[i].fd );
 		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
  * @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];
 
 	WBUFW(buf,0) = 0x2b1b;
@@ -141,7 +141,7 @@ int chmapif_send_fame_list(int fd){
  * @param index: position in the ranking
  * @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];
 	WBUFW(buf,0) = 0x2b22;
 	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)
  * @param users: number of players on this char-serv
  */
-void chmapif_sendall_playercount(int users){
+void chmapif_sendall_playercount(int32 users){
 	uint8 buf[6];
 	// send number of players to all map-servers
 	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
  * @param fd
  **/
-void chmapif_send_misc(int fd) {
+void chmapif_send_misc(int32 fd) {
 	uint16 offs = 5;
 	unsigned char buf[5+NAME_LENGTH+NAME_LENGTH];
 
@@ -195,7 +195,7 @@ void chmapif_send_misc(int fd) {
  * @param map_id
  * @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;
 
 	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
  * @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;
 
 	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
 	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];
 
 		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
  * @return : 0 not enough data received, 1 success
  */
-int chmapif_parse_askscdata(int fd){
+int32 chmapif_parse_askscdata(int32 fd){
 	if (RFIFOREST(fd) < 10)
 		return 0;
 	else {
 #ifdef ENABLE_SC_SAVING
-		int aid, cid;
+		int32 aid, cid;
 		aid = RFIFOL(fd,2);
 		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'",
@@ -296,7 +296,7 @@ int chmapif_parse_askscdata(int fd){
 		if( Sql_NumRows(sql_handle) > 0 )
 		{
 			struct status_change_data scdata;
-			int count;
+			int32 count;
 			char* 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
  * @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)
 		return 0;
 	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
  * @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))
 		return 0;
 	else {
@@ -372,7 +372,7 @@ int chmapif_parse_regmapuser(int fd, int 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 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
  * @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))
 		return 0;
 	else {
@@ -451,7 +451,7 @@ int chmapif_parse_reqsavechar(int fd, int id){
  * @param aid : Player account id
  * @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);
 	WFIFOW(fd,0) = 0x2b03;
 	WFIFOL(fd,2) = aid;
@@ -464,7 +464,7 @@ void chmapif_charselres(int fd, uint32 aid, uint8 res){
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  */
-int chmapif_parse_authok(int fd){
+int32 chmapif_parse_authok(int32 fd){
 	if( RFIFOREST(fd) < 18 )
 		return 0;
 	else{
@@ -507,11 +507,11 @@ int chmapif_parse_authok(int fd){
 }
 
 //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) )
 		return 0;
 	else {
-		int count, aid, cid;
+		int32 count, aid, cid;
 		aid = RFIFOL(fd,4);
 		cid = RFIFOL(fd,8);
 		count = RFIFOW(fd,12);
@@ -519,7 +519,7 @@ int chmapif_parse_req_saveskillcooldown(int fd){
 		{
 			struct skill_cooldown_data data;
 			StringBuf buf;
-			int i;
+			int32 i;
 
 			StringBuf_Init(&buf);
 			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
-int chmapif_parse_req_skillcooldown(int fd){
+int32 chmapif_parse_req_skillcooldown(int32 fd){
 	if (RFIFOREST(fd) < 10)
 		return 0;
 	else {
-		int aid, cid;
+		int32 aid, cid;
 		aid = RFIFOL(fd,2);
 		cid = RFIFOL(fd,6);
 		RFIFOSKIP(fd, 10);
@@ -556,7 +556,7 @@ int chmapif_parse_req_skillcooldown(int fd){
 		}
 		if( Sql_NumRows(sql_handle) > 0 )
 		{
-			int count;
+			int32 count;
 			char* data;
 			struct skill_cooldown_data scd;
 
@@ -592,7 +592,7 @@ int chmapif_parse_req_skillcooldown(int fd){
  * @param fd :Link to mapserv
  * @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]
     WFIFOHEAD( fd, 28 + MAP_NAME_LENGTH_EXT );
     WFIFOW(fd,0) = 0x2b06;
@@ -607,14 +607,14 @@ void chmapif_changemapserv_ack(int fd, bool nok){
  * @param fd: wich fd to parse from
  * @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 ) ){
 		return 0;
 	}
 	else {
-		int map_id, map_fd = -1;
+		int32 map_id, map_fd = -1;
 		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.
 		if (map_id >= 0)
@@ -685,7 +685,7 @@ int chmapif_parse_reqchangemapserv(int fd){
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  */
-int chmapif_parse_askrmfriend(int fd){
+int32 chmapif_parse_askrmfriend(int32 fd){
 	if (RFIFOREST(fd) < 10)
 		return 0;
 	else {
@@ -708,7 +708,7 @@ int chmapif_parse_askrmfriend(int fd){
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  */
-int chmapif_parse_reqcharname(int fd){
+int32 chmapif_parse_reqcharname(int32 fd){
 	if (RFIFOREST(fd) < 6)
 		return 0;
 
@@ -728,7 +728,7 @@ int chmapif_parse_reqcharname(int fd){
  * @param fd: wich fd to parse from
  * @return : 0 not enough data received, 1 success
  */
-int chmapif_parse_reqnewemail(int fd){
+int32 chmapif_parse_reqnewemail(int32 fd){
 	if (RFIFOREST(fd) < 86)
 		return 0;
 	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
  * @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)
 		return 0;
 	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 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
-		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;
-		int val1 = 0, sex = SEX_MALE;
+		int32 val1 = 0, sex = SEX_MALE;
 
 		if (operation == CHRIF_OP_LOGIN_BAN || operation == CHRIF_OP_LOGIN_VIP) {
 			timediff = RFIFOL(fd, 32);
@@ -776,8 +776,8 @@ int chmapif_parse_fwlog_changestatus(int fd){
 			Sql_ShowDebug(sql_handle);
 			result = 1;
 		} 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;
 
 			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_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];
 	WBUFW(buf,0) = 0x2b12;
 	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
  * @return : 0 not enough data received, 1 success
  */
-int chmapif_parse_reqdivorce(int fd){
+int32 chmapif_parse_reqdivorce(int32 fd){
 	if( RFIFOREST(fd) < 10 )
 		return 0;
 	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
  * @return : 0 not enough data received, 1 success
  */
-int chmapif_parse_setcharoffline(int fd){
+int32 chmapif_parse_setcharoffline(int32 fd){
 	if (RFIFOREST(fd) < 6)
 		return 0;
 	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
  * @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);
 	RFIFOSKIP(fd,2);
 	return 1;
@@ -914,7 +914,7 @@ int chmapif_parse_setalloffline(int fd, int id){
  * @param id: wich map_serv id
  * @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)
 		return 0;
 	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
  * @return : 0 not enough data received, 1 success
  */
-int chmapif_parse_reqfamelist(int fd){
+int32 chmapif_parse_reqfamelist(int32 fd){
 	if (RFIFOREST(fd) < 2)
 		return 0;
 	char_read_fame_list();
@@ -944,12 +944,12 @@ int chmapif_parse_reqfamelist(int fd){
  * @param fd: wich fd to parse from
  * @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))
 		return 0;
 	{
 #ifdef ENABLE_SC_SAVING
-		int count, aid, cid;
+		int32 count, aid, cid;
 
 		aid = RFIFOL(fd, 4);
 		cid = RFIFOL(fd, 8);
@@ -963,7 +963,7 @@ int chmapif_parse_save_scdata(int fd){
 		{
 			struct status_change_data data;
 			StringBuf buf;
-			int i;
+			int32 i;
 
 			StringBuf_Init(&buf);
 			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
  * @return : 0 not enough data received, 1 success
  */
-int chmapif_parse_keepalive(int fd){
+int32 chmapif_parse_keepalive(int32 fd){
 	WFIFOHEAD(fd,2);
 	WFIFOW(fd,0) = 0x2b24;
 	WFIFOSET(fd,2);
@@ -1003,7 +1003,7 @@ int chmapif_parse_keepalive(int fd){
  * @param fd: wich fd to parse from
  * @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)
 		return 0;
 	else {
@@ -1096,7 +1096,7 @@ int chmapif_parse_reqauth(int fd, int id){
  * @param fd: wich fd to parse from
  * @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) 
 		return 0;
 	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
  * @return : 0 not enough data received, 1 success
  */
-int chmapif_parse_updfamelist(int fd){
+int32 chmapif_parse_updfamelist(int32 fd){
     if (RFIFOREST(fd) < 11)
         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);
-            int size;
+            int32 size;
             struct fame_list* list;
-            int player_pos;
-            int fame_pos;
+            int32 player_pos;
+            int32 fame_pos;
 
             switch(type)
             {
@@ -1169,7 +1169,7 @@ int chmapif_parse_updfamelist(int fd){
  * HZ 0x2b2b
  * 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
 	uint8 buf[15];
 	WBUFW(buf,0) = 0x2b2b;
@@ -1182,12 +1182,12 @@ int chmapif_vipack(int mapfd, uint32 aid, uint32 vip_time, uint32 groupid, uint8
 	return 0;
 }
 
-int chmapif_parse_reqcharban(int fd){
+int32 chmapif_parse_reqcharban(int32 fd){
 	if (RFIFOREST(fd) < 10+NAME_LENGTH)
 		return 0;
 	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
 		char esc_name[NAME_LENGTH*2+1];
 		RFIFOSKIP(fd,10+NAME_LENGTH);
@@ -1203,7 +1203,7 @@ int chmapif_parse_reqcharban(int fd){
 			Sql_FreeResult(sql_handle);
 			return 1;
 		} else {
-			int t_cid=0,t_aid=0;
+			int32 t_cid=0,t_aid=0;
 			char* data;
 			time_t unban_time;
 			time_t now = time(nullptr);
@@ -1251,7 +1251,7 @@ int chmapif_parse_reqcharban(int fd){
 	return 1;
 }
 
-int chmapif_parse_reqcharunban(int fd){
+int32 chmapif_parse_reqcharunban(int32 fd){
 	if (RFIFOREST(fd) < 6+NAME_LENGTH)
 		return 0;
 	else {
@@ -1277,7 +1277,7 @@ int chmapif_parse_reqcharunban(int fd){
  * @param fd
  * @author [Cydh]
  **/
-int chmapif_bonus_script_get(int fd) {
+int32 chmapif_bonus_script_get(int32 fd) {
 	if (RFIFOREST(fd) < 6)
 		return 0;
 	else {
@@ -1347,7 +1347,7 @@ int chmapif_bonus_script_get(int fd) {
  * @param fd
  * @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))
 		return 0;
 	else {
@@ -1388,7 +1388,7 @@ int chmapif_bonus_script_save(int fd) {
  * @param fd : file descriptor to parse, (link to mapserv)
  * @param errCode 0:success, 3:fail
  */
-void chmapif_connectack(int fd, uint8 errCode){
+void chmapif_connectack(int32 fd, uint8 errCode){
 	WFIFOHEAD(fd,3);
 	WFIFOW(fd,0) = 0x2af9;
 	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)
  * @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 );
 	if( id == ARRAYLENGTH(map_server) )
@@ -1421,7 +1421,7 @@ int chmapif_parse(int fd){
 	}
 
 	while(RFIFOREST(fd) >= 2){
-		int next=1;
+		int32 next=1;
 		switch(RFIFOW(fd,0)){
 			case 0x2afa: next=chmapif_parse_getmapname(fd,id); break;
 			case 0x2afc: next=chmapif_parse_askscdata(fd); break;
@@ -1454,7 +1454,7 @@ int chmapif_parse(int fd){
 			default:
 			{
 					// inter server - packet
-					int r = inter_parse_frommap(fd);
+					int32 r = inter_parse_frommap(fd);
 					if (r == 1) break;		// processed
 					if (r == 2) return 0;	// need more packet
 					// 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)
-int chmapif_init(int fd){
+int32 chmapif_init(int32 fd){
 	return inter_mapif_init(fd);
 }
 
@@ -1478,7 +1478,7 @@ int chmapif_init(int fd){
  * Initializes a server structure.
  * @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].fd = -1;
 }
@@ -1487,7 +1487,7 @@ void chmapif_server_init(int id) {
  * Destroys a server structure.
  * @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 ){
 		do_close(map_server[id].fd);
 		map_server[id].fd = -1;
@@ -1499,7 +1499,7 @@ void chmapif_server_destroy(int id){
  *  Initialisation, function called at start of the char-serv.
  */
 void do_init_chmapif(void){
-	int i;
+	int32 i;
 	for( i = 0; i < ARRAYLENGTH(map_server); ++i )
 		chmapif_server_init(i);
 }
@@ -1509,10 +1509,10 @@ void do_init_chmapif(void){
  *  Actually destroys then recreates the struct.
  * @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];
-	int fd = map_server[id].fd;
+	int32 fd = map_server[id].fd;
 
 	//Notify other map servers that this one is gone. [Skotlex]
 	WBUFW(buf,0) = 0x2b20;
@@ -1541,7 +1541,7 @@ void chmapif_server_reset(int id){
  * Called when the connection to Map Server is disconnected.
  * @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);
 	chmapif_server_reset(id);
 }
@@ -1552,7 +1552,7 @@ void chmapif_on_disconnect(int id){
  *  dealloc..., function called at exit of the char-serv
  */
 void do_final_chmapif(void){
-	int i;
+	int32 i;
 	for( i = 0; i < ARRAYLENGTH(map_server); ++i )
 		chmapif_server_destroy(i);
 }

+ 44 - 44
src/char/char_mapif.hpp

@@ -6,54 +6,54 @@
 
 #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 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);
 
 #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.
  * @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 tmp_achieve;
 	SqlStmt *stmt;
 	StringBuf buf;
-	int i;
+	int32 i;
 
 	if (!count)
 		return nullptr;
@@ -92,7 +92,7 @@ struct achievement *mapif_achievements_fromsql(uint32 char_id, int *count)
  * @param achievement_id: Achievement ID
  * @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)) {
 		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)
 {
 	StringBuf buf;
-	int i;
+	int32 i;
 
 	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)
 {
 	StringBuf buf;
-	int i;
+	int32 i;
 
 	StringBuf_Init(&buf);
 	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.
  */
-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);
 	WFIFOW(fd, 0) = 0x3863;
 	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.
  * @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);
 	struct achievement *old_ad = nullptr, *new_ad = nullptr;
 	bool success = true;
@@ -256,9 +256,9 @@ int mapif_parse_achievement_save(int fd)
 /**
  * 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;
-	int num_achievements = 0;
+	int32 num_achievements = 0;
 
 	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
  * @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) );
 
@@ -291,7 +291,7 @@ int mapif_parse_achievement_load(int fd)
 /**
  * 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);
 	WFIFOW(fd, 0) = 0x3864;
 	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.
  * @see inter_parse_frommap
  */
-int mapif_parse_achievement_reward(int fd){
+int32 mapif_parse_achievement_reward(int32 fd){
 	time_t current = time(nullptr);
 	uint32 char_id = RFIFOL(fd, 2);
 	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.
  * @see inter_parse_frommap
  */
-int inter_achievement_parse_frommap(int fd)
+int32 inter_achievement_parse_frommap(int32 fd)
 {
 	switch (RFIFOW(fd, 0)) {
 		case 0x3062: mapif_parse_achievement_load(fd); break;

+ 3 - 1
src/char/int_achievement.hpp

@@ -4,6 +4,8 @@
 #ifndef 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 */

+ 22 - 22
src/char/int_auction.cpp

@@ -25,15 +25,15 @@
 
 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;
 
 void auction_delete( std::shared_ptr<struct auction_data> auction );
 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 ){
 		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 ){
-	int j;
+	int32 j;
 	StringBuf buf;
 	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 ){
-	int j;
+	int32 j;
 	StringBuf buf;
 	SqlStmt* stmt;
 
@@ -187,7 +187,7 @@ void auction_delete( std::shared_ptr<struct auction_data> auction ){
 
 void inter_auctions_fromsql(void)
 {
-	int i;
+	int32 i;
 	char *data;
 	StringBuf buf;
 	t_tick tick = gettick(), endtick;
@@ -267,9 +267,9 @@ void inter_auctions_fromsql(void)
 	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);
 	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);
 }
 
-void mapif_parse_Auction_requestlist(int fd)
+void mapif_parse_Auction_requestlist(int32 fd)
 {
 	char searchtext[NAME_LENGTH];
 	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));
 	unsigned char buf[5 * sizeof(struct auction_data)];
 	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);
 }
 
-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);
 	WFIFOW(fd,0) = 0x3851;
@@ -333,7 +333,7 @@ void mapif_Auction_register(int fd, struct auction_data *auction)
 	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 )
 		return;
@@ -353,7 +353,7 @@ void mapif_parse_Auction_register(int fd)
 	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);
 	WFIFOW(fd,0) = 0x3852;
@@ -362,7 +362,7 @@ void mapif_Auction_cancel(int fd, uint32 char_id, unsigned char result)
 	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);
 
@@ -391,7 +391,7 @@ void mapif_parse_Auction_cancel(int fd)
 	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);
 	WFIFOW(fd,0) = 0x3853;
@@ -400,7 +400,7 @@ void mapif_Auction_close(int fd, uint32 char_id, unsigned char result)
 	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);
 	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
 }
 
-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);
 	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);
 }
 
-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);
-	int bid = RFIFOL(fd,12);
+	int32 bid = RFIFOL(fd,12);
 	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 ){
@@ -494,7 +494,7 @@ void mapif_parse_Auction_bid(int fd)
 /*==========================================
  * Packets From Map Server
  *------------------------------------------*/
-int inter_auction_parse_frommap(int fd)
+int32 inter_auction_parse_frommap(int32 fd)
 {
 	switch(RFIFOW(fd,0))
 	{
@@ -509,7 +509,7 @@ int inter_auction_parse_frommap(int fd)
 	return 1;
 }
 
-int inter_auction_sql_init(void)
+int32 inter_auction_sql_init(void)
 {
 	inter_auctions_fromsql();
 

+ 4 - 2
src/char/int_auction.hpp

@@ -4,9 +4,11 @@
 #ifndef 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);
 
 #endif /* INT_AUCTION_HPP */

+ 12 - 12
src/char/int_clan.cpp

@@ -20,12 +20,12 @@
 #include "char_mapif.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;
 
 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 ) ){
 		Sql_ShowDebug( sql_handle );
 		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;
 	size_t len;
-	int i;
+	int32 i;
 
 	if( clan_id <= 0 )
 		return nullptr;
@@ -98,7 +98,7 @@ std::shared_ptr<struct clan> inter_clan_fromsql(int clan_id){
 	return clan;
 }
 
-int mapif_clan_info( int fd ){
+int32 mapif_clan_info( int32 fd ){
 	size_t offset = 4;
 	size_t length = offset + clan_db.size() * sizeof( struct clan );
 
@@ -118,13 +118,13 @@ int mapif_clan_info( int fd ){
 	return 0;
 }
 
-static int mapif_parse_clan_request( int fd ){
+static int32 mapif_parse_clan_request( int32 fd ){
 	mapif_clan_info( fd );
 
 	return 0;
 }
 
-static int mapif_parse_clan_message( int fd ){
+static int32 mapif_parse_clan_message( int32 fd ){
 	unsigned char buf[500];
 	uint16 len;
 
@@ -138,7 +138,7 @@ static int mapif_parse_clan_message( int fd ){
 	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];
 
 	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 );
 }
 
-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 ) ) );
 
 	// 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 ) ) );
 
 	// Unknown clan
@@ -183,7 +183,7 @@ static void mapif_parse_clan_member_joined( int fd ){
 // Must Return
 //	1 : ok
 //  0 : error
-int inter_clan_parse_frommap( int fd ){
+int32 inter_clan_parse_frommap( int32 fd ){
 	RFIFOHEAD(fd);
 	switch(RFIFOW(fd,0)) {
 		case 0x30A0:
@@ -204,7 +204,7 @@ int inter_clan_parse_frommap( int fd ){
 }
 
 // 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 ) ){
 		Sql_ShowDebug(sql_handle);
 		return 1;

+ 4 - 2
src/char/int_clan.hpp

@@ -4,8 +4,10 @@
 #ifndef 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);
 
 #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;
 }
 
-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;
 
 	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;
 }
 
-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) ) {
 		Sql_ShowDebug(sql_handle);
 		return false;
@@ -92,8 +92,8 @@ bool mapif_elemental_delete(int ele_id) {
 	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);
 	WFIFOW(fd,0) = 0x387c;
@@ -103,37 +103,37 @@ void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) {
 	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);
 	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;
 	bool result = mapif_elemental_load(ele_id, char_id, &ele);
 	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);
 	WFIFOW(fd,0) = 0x387d;
 	WFIFOB(fd,2) = flag;
 	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);
 	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);
 	WFIFOW(fd,0) = 0x387e;
 	WFIFOB(fd,2) = flag;
 	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);
 	mapif_elemental_saved(fd, result);
 }
@@ -148,7 +148,7 @@ void inter_elemental_sql_final(void) {
 /*==========================================
  * Inter Packets
  *------------------------------------------*/
-int inter_elemental_parse_frommap(int fd) {
+int32 inter_elemental_parse_frommap(int32 fd) {
 	unsigned short cmd = RFIFOW(fd,0);
 
 	switch( cmd ) {

+ 4 - 2
src/char/int_elemental.hpp

@@ -4,12 +4,14 @@
 #ifndef INT_ELEMENTAL_HPP
 #define INT_ELEMENTAL_HPP
 
+#include <common/cbasetypes.hpp>
+
 struct s_elemental;
 
 void inter_elemental_sql_init(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 */

+ 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'};
 
-// 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<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 );
-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){
-	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.
 		state = 1;
@@ -91,7 +91,7 @@ TIMER_FUNC(guild_save_timer){
 	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) )
 		Sql_ShowDebug(sql_handle);
@@ -101,7 +101,7 @@ int inter_guild_removemember_tosql(uint32 char_id)
 }
 
 // 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)
 	// GS_EMBLEM `emblem_len`,`emblem_id`,`emblem_data`
 	// 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_master[NAME_LENGTH*2+1];
 	char new_guild = 0;
-	int i=0;
+	int32 i=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;
 	size_t len;
 	char* p;
-	int i;
+	int32 i;
 
 	if( guild_id <= 0 ){
 		return nullptr;
@@ -458,7 +458,7 @@ std::shared_ptr<CharGuild> inter_guild_fromsql( int32 guild_id ){
 	}
 	while( SQL_SUCCESS == Sql_NextRow(sql_handle) )
 	{
-		int position;
+		int32 position;
 		struct guild_position* gpos;
 
 		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) )
 	{
-		int id;
+		int32 id;
 		Sql_GetData(sql_handle, 0, &data, nullptr); id = atoi(data) - GD_SKILLBASE;
 		if( id < 0 || id >= MAX_GUILDSKILL )
 			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
  * @return Guild storage max size
  */
-uint16 inter_guild_storagemax(int guild_id)
+uint16 inter_guild_storagemax(int32 guild_id)
 {
 #ifdef OFFICIAL_GUILD_STORAGE
 	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`)
-int inter_guildcastle_tosql( std::shared_ptr<struct guild_castle> gc ){
+int32 inter_guildcastle_tosql( std::shared_ptr<struct guild_castle> gc ){
 	StringBuf buf;
-	int i;
+	int32 i;
 
 	StringBuf_Init(&buf);
 	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
-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;
-	int i;
+	int32 i;
 	StringBuf buf;
 
 	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) {
 		//Get guild_id from the database
@@ -688,9 +688,9 @@ int inter_guild_CharOnline(uint32 char_id, int guild_id)
 	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)
 	{
@@ -824,9 +824,9 @@ void inter_guild_sql_final(void)
 }
 
 // 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];
 
 	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
 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 );
 	//Let the calling function handle the guild removal in case they need
 	//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);
 }
 
-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;
 }
 
-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
 
 	if(g->guild.guild_lv<=0)
@@ -934,7 +934,7 @@ int guild_calcinfo( std::shared_ptr<CharGuild> g ){
 //-------------------------------------------------------------------
 // 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);
 	WFIFOW(fd,0)=0x3830;
 	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
-int mapif_guild_noinfo(int fd,int guild_id)
+int32 mapif_guild_noinfo(int32 fd,int32 guild_id)
 {
 	unsigned char buf[12];
 	WBUFW(buf,0)=0x3831;
@@ -965,7 +965,7 @@ int mapif_guild_noinfo(int fd,int guild_id)
 }
 
 // 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)];
 	WBUFW(buf,0)=0x3831;
 	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
-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);
 	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
-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];
 	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
-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];
 	WBUFW(buf, 0)=0x3835;
 	WBUFL(buf, 2)=g.guild_id;
@@ -1021,7 +1021,7 @@ int mapif_guild_memberinfoshort( const struct mmo_guild &g, int idx ){
 }
 
 // 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];
 	WBUFW(buf,0)=0x3836;
@@ -1033,7 +1033,7 @@ int mapif_guild_broken(int guild_id,int flag)
 }
 
 // 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];
 	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
-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];
 	if (len > 2038)
@@ -1063,7 +1063,7 @@ int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len)
 }
 
 // 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];
 	if (len > 2030)
@@ -1080,7 +1080,7 @@ int mapif_guild_memberinfochanged(int guild_id,uint32 account_id,uint32 char_id,
 }
 
 // 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];
 	WBUFW(buf, 0)=0x383c;
@@ -1092,7 +1092,7 @@ int mapif_guild_skillupack(int guild_id,uint16 skill_id,uint32 account_id)
 }
 
 // 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];
 	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
-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)];
 	WBUFW(buf,0)=0x383b;
 	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
-int mapif_guild_notice( const struct mmo_guild &g ){
+int32 mapif_guild_notice( const struct mmo_guild &g ){
 	unsigned char buf[256];
 	WBUFW(buf,0)=0x383e;
 	WBUFL(buf,2)=g.guild_id;
@@ -1131,7 +1131,7 @@ int mapif_guild_notice( const struct mmo_guild &g ){
 }
 
 // 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)];
 	WBUFW(buf,0)=0x383f;
 	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)
-int mapif_guild_emblem_version( const struct mmo_guild &g ){
+int32 mapif_guild_emblem_version( const struct mmo_guild &g ){
 	unsigned char buf[10];
 	WBUFW(buf, 0) = 0x3841;
 	WBUFL(buf, 2) = g.guild_id;
@@ -1153,7 +1153,7 @@ int mapif_guild_emblem_version( const struct mmo_guild &g ){
 	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];
 	WBUFW(buf,0)=0x3843;
 	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;
 }
 
-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);
 	WFIFOW(fd, 0) = 0x3840;
@@ -1186,9 +1186,9 @@ int mapif_guild_castle_dataload(int fd, int sz, int *castle_ids)
 
 
 // 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
 	ShowInfo("Creating Guild (%s)\n", name);
 #endif
@@ -1262,7 +1262,7 @@ int mapif_parse_CreateGuild(int fd,uint32 account_id,char *name,struct guild_mem
 }
 
 // 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 );
 
@@ -1275,7 +1275,7 @@ int mapif_parse_GuildInfo(int fd,int guild_id)
 }
 
 // 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 );
 
@@ -1286,7 +1286,7 @@ int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m)
 	}
 
 	// 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)
 		{
 			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
-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 );
 
@@ -1333,7 +1333,7 @@ int mapif_parse_GuildLeave(int fd, int guild_id, uint32 account_id, uint32 char_
 	if( flag )
 	{	// Write expulsion reason
 		// Find an empty slot
-		int j;
+		int32 j;
 		ARR_FIND( 0, MAX_GUILDEXPULSION, j, g->guild.expulsion[j].account_id == 0 );
 		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
-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
-	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 );
 
@@ -1421,7 +1421,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id,uint32 account_id
 }
 
 // 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 );
 
@@ -1471,13 +1471,13 @@ int mapif_parse_BreakGuild(int fd,int guild_id)
 }
 
 // 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);
 }
 
 // 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 );
 
@@ -1517,10 +1517,10 @@ int mapif_parse_GuildBasicInfoChange(int fd,int guild_id,int type,const char *da
  * @param len : Size of value
  * @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
-	int i;
+	int32 i;
 
 	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;
 }
 
-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));
 }
 
-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 );
 
@@ -1663,7 +1663,7 @@ int inter_guild_charname_changed(int guild_id,uint32 account_id, uint32 char_id,
 }
 
 // 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
 	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
-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 );
 
@@ -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]
-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];
 
 	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
  * @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
 	std::shared_ptr<CharGuild> g[2];
-	int j,i;
+	int32 j,i;
 	g[0] = inter_guild_fromsql(guild_id1);
 	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
-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 );
 
@@ -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);
 }
 
-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 );
 
@@ -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);
 }
 
-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);
 }
 
-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 );
 
@@ -1835,7 +1835,7 @@ int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value)
 	switch (index) {
 		case CD_GUILD_ID:
 			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 );
 				inter_log("guild %s (id=%d) %s castle id=%d\n",
 				          (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;
 }
 
-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;
-	int pos;
+	int32 pos;
 
 	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);
 }
 
-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 );
 
@@ -1925,7 +1925,7 @@ int mapif_parse_GuildEmblemVersion(int fd, int guild_id, int version)
 // Must Return
 //	1 : ok
 //  0 : error
-int inter_guild_parse_frommap(int fd)
+int32 inter_guild_parse_frommap(int32 fd)
 {
 	RFIFOHEAD(fd);
 	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 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 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 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)
-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 **");
 }
 
-int inter_guild_broken(int guild_id)
+int32 inter_guild_broken(int32 guild_id)
 {
 	return mapif_guild_broken(guild_id, 0);
 }

+ 9 - 9
src/char/int_guild.hpp

@@ -54,16 +54,16 @@ public:
 	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_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 */

+ 17 - 17
src/char/int_homun.cpp

@@ -16,7 +16,7 @@
 #include "char.hpp"
 #include "inter.hpp"
 
-int inter_homunculus_sql_init(void)
+int32 inter_homunculus_sql_init(void)
 {
 	return 0;
 }
@@ -25,7 +25,7 @@ void inter_homunculus_sql_final(void)
 	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);
 	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));
 }
 
-void mapif_homunculus_deleted(int fd, int flag)
+void mapif_homunculus_deleted(int32 fd, int32 flag)
 {
 	WFIFOHEAD(fd, 3);
 	WFIFOW(fd, 0) = 0x3893;
@@ -44,7 +44,7 @@ void mapif_homunculus_deleted(int fd, int flag)
 	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);
 	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);
 }
 
-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);
 	WFIFOW(fd,0) = 0x3892;
@@ -72,7 +72,7 @@ void mapif_homunculus_saved(int fd, uint32 account_id, bool flag)
 	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);
 	WFIFOW(fd, 0) = 0x3894;
@@ -118,7 +118,7 @@ bool mapif_homunculus_save(struct s_homunculus* hd)
 		else
 		{
 			SqlStmt* stmt;
-			int i;
+			int32 i;
 
 			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) )
@@ -148,7 +148,7 @@ bool mapif_homunculus_save(struct s_homunculus* hd)
 
 
 // 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;
 	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) )
 	{
-		int i;
+		int32 i;
 		// id
 		Sql_GetData(sql_handle, 0, &data, nullptr);
 		i = atoi(data);
@@ -231,7 +231,7 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd)
 	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)
 	||	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)
 {
-	int i;
+	int32 i;
 
 	// Check Authorised letters/symbols in the name of the homun
 	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);
 	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);
 	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;
 	bool result = mapif_homunculus_load(homun_id, &hd);
 	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);
 	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);
 	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
  *------------------------------------------*/
-int inter_homunculus_parse_frommap(int fd)
+int32 inter_homunculus_parse_frommap(int32 fd)
 {
 	unsigned short cmd = RFIFOW(fd,0);
 

+ 4 - 4
src/char/int_homun.hpp

@@ -8,13 +8,13 @@
 
 struct s_homunculus;
 
-int inter_homunculus_sql_init(void);
+int32 inter_homunculus_sql_init(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_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);
 
 #endif /* INT_HOMUN_HPP */

+ 39 - 39
src/char/int_mail.cpp

@@ -20,13 +20,13 @@
 
 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;
 
 	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.
 /// 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;
 	SqlStmt* stmt;
-	int i, j;
+	int32 i, j;
 	bool found = false;
 
 	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.
 /// 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;
 	char* data;
 
@@ -252,7 +252,7 @@ bool mail_loadmessage(int mail_id, struct mail_message* msg)
 	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
 	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 );
@@ -260,10 +260,10 @@ int mail_timer_sub( int limit, enum mail_inbox_type type ){
 	}
 
 	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];
 
 	if( limit <= 0 ){
@@ -288,7 +288,7 @@ int mail_timer_sub( int limit, enum mail_inbox_type type ){
 		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;
 
 		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);
 
-	for( int i = 0; i < MAIL_ITERATION_SIZE; i++ ){
+	for( int32 i = 0; i < MAIL_ITERATION_SIZE; i++ ){
 		if( mails[i].mail_id == 0 ){
 			break;
 		}
@@ -328,7 +328,7 @@ TIMER_FUNC(mail_delete_timer){
 /*==========================================
  * 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;
 	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));
 }
 
-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));
 }
@@ -352,9 +352,9 @@ void mapif_parse_Mail_requestinbox(int fd)
 /*==========================================
  * 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) )
 		Sql_ShowDebug(sql_handle);
 }
@@ -362,7 +362,7 @@ void mapif_parse_Mail_read(int fd)
 /*==========================================
  * 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 ) ){
 		Sql_ShowDebug(sql_handle);
 		return false;
@@ -371,7 +371,7 @@ bool mail_DeleteAttach(int mail_id){
 	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;
 
@@ -400,7 +400,7 @@ void mapif_Mail_getattach(int fd, uint32 char_id, int mail_id, int type)
 	}
 
 	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);
 
@@ -435,7 +435,7 @@ void mapif_Mail_getattach(int fd, uint32 char_id, int mail_id, int type)
 	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));
 }
@@ -443,7 +443,7 @@ void mapif_parse_Mail_getattach(int fd)
 /*==========================================
  * 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;
 
 	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;
 }
 
-void mapif_parse_Mail_delete(int fd)
+void mapif_parse_Mail_delete(int32 fd)
 {
 	mapif_Mail_delete( fd, RFIFOL( fd, 2 ), RFIFOL( fd, 6 ) );
 }
@@ -512,7 +512,7 @@ void mapif_Mail_new(struct mail_message *msg)
 /*==========================================
  * 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;
 
 	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( fd <= 0 && !charserv_config.mail_return_empty ){
-		int i;
+		int32 i;
 
 		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.timestamp = time( nullptr );
 
-	int new_mail = mail_savemessage( &msg );
+	int32 new_mail = mail_savemessage( &msg );
 	mapif_Mail_new( &msg );
 
 	// 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);
 }
 
-void mapif_parse_Mail_return(int fd)
+void mapif_parse_Mail_return(int32 fd)
 {
 	mapif_Mail_return(fd, RFIFOL(fd,2), RFIFOL(fd,6));
 }
@@ -592,9 +592,9 @@ void mapif_parse_Mail_return(int fd)
 /*==========================================
  * 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);
 	WFIFOW(fd,0) = 0x384d;
@@ -603,7 +603,7 @@ void mapif_Mail_send(int fd, struct mail_message* msg)
 	WFIFOSET(fd,len);
 }
 
-void mapif_parse_Mail_send(int fd)
+void mapif_parse_Mail_send(int32 fd)
 {
 	struct mail_message msg;
 	char esc_name[NAME_LENGTH*2+1];
@@ -664,7 +664,7 @@ void mapif_parse_Mail_send(int fd)
 	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;
 	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);
 	msg.zeny = zeny;
 	if( item != nullptr ){
-		int i;
+		int32 i;
 
 		for( i = 0; i < amount && i < MAIL_MAX_ITEM; i++ ){
 			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;
 }
 
-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);
 	WFIFOW(fd,0) = 0x384e;
 	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);
 }
 
-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];
 	uint32 char_id = 0;
 	uint16 class_ = 0, base_level = 0;
@@ -733,7 +733,7 @@ void mapif_parse_Mail_receiver_check( int fd ){
 /*==========================================
  * Packets From Map Server
  *------------------------------------------*/
-int inter_mail_parse_frommap(int fd)
+int32 inter_mail_parse_frommap(int32 fd)
 {
 	switch(RFIFOW(fd,0))
 	{
@@ -750,7 +750,7 @@ int inter_mail_parse_frommap(int fd)
 	return 1;
 }
 
-int inter_mail_sql_init(void)
+int32 inter_mail_sql_init(void)
 {
 	return 1;
 }

+ 4 - 4
src/char/int_mail.hpp

@@ -12,13 +12,13 @@ struct mail_message;
 TIMER_FUNC(mail_return_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);
 
-int mail_savemessage(struct mail_message* msg);
+int32 mail_savemessage(struct mail_message* msg);
 void mapif_Mail_new(struct mail_message *msg);
 
 #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;
 }
 
-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;
 
@@ -125,7 +125,7 @@ bool mapif_mercenary_load(int merc_id, uint32 char_id, struct s_mercenary *merc)
 	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) )
 	{
@@ -136,9 +136,9 @@ bool mapif_mercenary_delete(int merc_id)
 	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);
 	WFIFOW(fd,0) = 0x3870;
@@ -148,20 +148,20 @@ void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag)
 	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);
 	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;
 	bool result = mapif_mercenary_load(merc_id, char_id, &merc);
 	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);
 	WFIFOW(fd,0) = 0x3871;
@@ -169,13 +169,13 @@ void mapif_mercenary_deleted(int fd, unsigned char flag)
 	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);
 	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);
 	WFIFOW(fd,0) = 0x3872;
@@ -183,13 +183,13 @@ void mapif_mercenary_saved(int fd, unsigned char flag)
 	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);
 	mapif_mercenary_saved(fd, result);
 }
 
-int inter_mercenary_sql_init(void)
+int32 inter_mercenary_sql_init(void)
 {
 	return 0;
 }
@@ -201,7 +201,7 @@ void inter_mercenary_sql_final(void)
 /*==========================================
  * Inter Packets
  *------------------------------------------*/
-int inter_mercenary_parse_frommap(int fd)
+int32 inter_mercenary_parse_frommap(int32 fd)
 {
 	unsigned short cmd = RFIFOW(fd,0);
 

+ 3 - 3
src/char/int_mercenary.hpp

@@ -6,16 +6,16 @@
 
 #include <common/cbasetypes.hpp>
 
-int inter_mercenary_sql_init(void);
+int32 inter_mercenary_sql_init(void);
 void inter_mercenary_sql_final(void);
-int inter_mercenary_parse_frommap(int fd);
+int32 inter_mercenary_parse_frommap(int32 fd);
 
 // Mercenary Owner Database
 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_delete(uint32 char_id);
 
-bool mapif_mercenary_delete(int merc_id);
+bool mapif_mercenary_delete(int32 merc_id);
 
 
 #endif /* INT_MERCENARY_HPP */

+ 56 - 56
src/char/int_party.cpp

@@ -26,23 +26,23 @@ using namespace rathena;
 struct party_data {
 	struct party party;
 	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.
 };
 
-// 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;
 
-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.
-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;
 	p->min_lv = UINT_MAX;
 	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.
 void int_party_calc_state( std::shared_ptr<struct party_data> p ){
-	int i;
+	int32 i;
 	p->min_lv = UINT_MAX;
 	p->max_lv = 0;
 	p->party.count =
@@ -115,7 +115,7 @@ void int_party_calc_state( std::shared_ptr<struct party_data> p ){
 }
 
 // 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')
 	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
-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;
 	char* data;
 	size_t len;
-	int i;
+	int32 i;
 
 #ifdef NOISY
 	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;
 }
 
-int inter_party_sql_init(void)
+int32 inter_party_sql_init(void)
 {
 	// Remove parties with no members on startup from party_db. [Skotlex]
 	if (charserv_config.clear_parties) {
@@ -297,8 +297,8 @@ std::shared_ptr<struct party_data> search_partyname( char* str ){
 	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;
 	if (!p->family)
 		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.
-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));
 }
 
 // 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 ){
 		return 1;
@@ -362,7 +362,7 @@ int party_check_empty( std::shared_ptr<struct party_data> p ){
 
 
 // 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);
 	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
-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);
 	WFIFOW(fd,0) = 0x3821;
@@ -396,7 +396,7 @@ void mapif_party_noinfo(int fd, int party_id, uint32 char_id)
 }
 
 //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)];
 	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
-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);
 	WFIFOW(fd,0) = 0x3822;
 	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
-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];
 	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
-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];
 
 	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
-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];
 
@@ -473,7 +473,7 @@ int mapif_party_membermoved(struct party *p,int idx)
 }
 
 //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];
 	WBUFW(buf,0)=0x3826;
@@ -485,7 +485,7 @@ int mapif_party_broken(int party_id,int flag)
 }
 
 //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];
 	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
-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 );
 
@@ -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
 	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( name[i] == '"' ) { /* client-special-char */
 					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
-		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) {
 				mapif_party_created(fd,leader->account_id,leader->char_id,nullptr);
 				return 0;
@@ -559,7 +559,7 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part
 }
 
 // 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 );
 
@@ -571,9 +571,9 @@ void mapif_parse_PartyInfo(int fd, int party_id, uint32 char_id)
 }
 
 // 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 );
 
@@ -609,9 +609,9 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member
 }
 
 //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 );
 
@@ -631,9 +631,9 @@ int mapif_parse_PartyChangeOption(int fd,int party_id,uint32 account_id,int exp,
 }
 
 //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 );
 
@@ -683,8 +683,8 @@ int mapif_parse_PartyLeave(int fd, int party_id, uint32 account_id, uint32 char_
 	return 0;
 }
 // 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 );
 
@@ -741,7 +741,7 @@ int mapif_parse_PartyChangeMap( int fd, int party_id, uint32 account_id, uint32
 }
 
 //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 );
 
@@ -753,19 +753,19 @@ int mapif_parse_BreakParty(int fd,int party_id)
 }
 
 //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);
 }
 
-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 );
 
 	if(!p)
 		return 0;
 
-	for( int i = 0; i < MAX_PARTY; i++ ){
+	for( int32 i = 0; i < MAX_PARTY; i++ ){
 		if(p->party.member[i].leader)
 			p->party.member[i].leader = 0;
 		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
  * @return 
  */
-int mapif_parse_PartyShareLevel(int fd,uint32 share_lvl)
+int32 mapif_parse_PartyShareLevel(int32 fd,uint32 share_lvl)
 {
 	party_share_level = share_lvl;
 
@@ -808,7 +808,7 @@ int mapif_parse_PartyShareLevel(int fd,uint32 share_lvl)
 // Return :
 // 	0 : error
 //	1 : ok
-int inter_party_parse_frommap(int fd)
+int32 inter_party_parse_frommap(int32 fd)
 {
 	RFIFOHEAD(fd);
 	switch(RFIFOW(fd,0)) {
@@ -829,14 +829,14 @@ int inter_party_parse_frommap(int fd)
 }
 
 //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);
 }
 
-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 )
 	{// Get party_id from the database
@@ -881,8 +881,8 @@ int inter_party_CharOnline(uint32 char_id, int party_id)
 	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 )
 	{// Get guild_id from the database
@@ -932,9 +932,9 @@ int inter_party_CharOffline(uint32 char_id, int party_id) {
 	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 );
 

+ 6 - 6
src/char/int_party.hpp

@@ -18,12 +18,12 @@ enum e_PartySaveWhatFlag {
 
 //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);
-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 */

+ 20 - 20
src/char/int_pet.cpp

@@ -18,10 +18,10 @@
 #include "inter.hpp"
 
 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`)
 	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;
 }
 
-int inter_pet_fromsql(int pet_id, struct s_pet* p)
+int32 inter_pet_fromsql(int32 pet_id, struct s_pet* p)
 {
 	char* data;
 	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
 	pet_pt = (struct s_pet*)aCalloc(sizeof(struct s_pet), 1);
 	return 0;
@@ -115,7 +115,7 @@ void inter_pet_sql_final(void){
 	return;
 }
 //----------------------------------
-int inter_pet_delete(int pet_id){
+int32 inter_pet_delete(int32 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) )
@@ -123,7 +123,7 @@ int inter_pet_delete(int pet_id){
 	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);
 	WFIFOW(fd, 0) = 0x3880;
@@ -141,7 +141,7 @@ int mapif_pet_created(int fd, uint32 account_id, struct s_pet *p)
 	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);
 	WFIFOW(fd, 0) =0x3881;
 	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;
 }
 
-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);
 	WFIFOW(fd, 0) =0x3881;
 	WFIFOW(fd, 2) =sizeof(struct s_pet) + 9;
@@ -165,7 +165,7 @@ int mapif_pet_noinfo(int fd, uint32 account_id){
 	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);
 	WFIFOW(fd, 0) =0x3882;
 	WFIFOL(fd, 2) =account_id;
@@ -175,7 +175,7 @@ int mapif_save_pet_ack(int fd, uint32 account_id, int flag){
 	return 0;
 }
 
-int mapif_delete_pet_ack(int fd, int flag){
+int32 mapif_delete_pet_ack(int32 fd, int32 flag){
 	WFIFOHEAD(fd, 3);
 	WFIFOW(fd, 0) =0x3883;
 	WFIFOB(fd, 2) =flag;
@@ -184,7 +184,7 @@ int mapif_delete_pet_ack(int fd, int flag){
 	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));
 	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;
 }
 
-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));
 
 	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;
 }
 
-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.
-	int len;
+	int32 len;
 	RFIFOHEAD(fd);
 	len=RFIFOW(fd, 2);
 	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;
 }
 
-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));
 
 	return 0;
 }
 
-int mapif_parse_CreatePet(int fd){
+int32 mapif_parse_CreatePet(int32 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),
 		RFIFOW(fd, 24), RFIFOB(fd, 26), RFIFOB(fd, 27), RFIFOCP(fd, 28));
 	return 0;
 }
 
-int mapif_parse_LoadPet(int fd){
+int32 mapif_parse_LoadPet(int32 fd){
 	RFIFOHEAD(fd);
 	mapif_load_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOL(fd, 10));
 	return 0;
 }
 
-int mapif_parse_SavePet(int fd){
+int32 mapif_parse_SavePet(int32 fd){
 	RFIFOHEAD(fd);
 	mapif_save_pet(fd, RFIFOL(fd, 4), (struct s_pet *) RFIFOP(fd, 8));
 	return 0;
 }
 
-int mapif_parse_DeletePet(int fd){
+int32 mapif_parse_DeletePet(int32 fd){
 	RFIFOHEAD(fd);
 	mapif_delete_pet(fd, RFIFOL(fd, 2));
 	return 0;
 }
 
-int inter_pet_parse_frommap(int fd){
+int32 inter_pet_parse_frommap(int32 fd){
 	RFIFOHEAD(fd);
 	switch(RFIFOW(fd, 0)){
 	case 0x3080: mapif_parse_CreatePet(fd); break;

+ 6 - 6
src/char/int_pet.hpp

@@ -8,15 +8,15 @@
 
 struct s_pet;
 
-int inter_pet_init(void);
+int32 inter_pet_init(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];
 
-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 */

+ 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
  * @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) )
 	{
 		Sql_ShowDebug(sql_handle);
@@ -136,7 +136,7 @@ bool mapif_quest_update(uint32 char_id, struct quest qd) {
  *
  * @see inter_parse_frommap
  */
-int mapif_parse_quest_save(int fd) {
+int32 mapif_parse_quest_save(int32 fd) {
 	uint32 char_id = RFIFOL(fd,4);
 	struct quest *old_qd = nullptr, *new_qd = nullptr;
 	bool success = true;
@@ -193,7 +193,7 @@ int mapif_parse_quest_save(int fd) {
  *
  * @see inter_parse_frommap
  */
-int mapif_parse_quest_load(int fd) {
+int32 mapif_parse_quest_load(int32 fd) {
 	uint32 char_id = RFIFOL(fd,2);
 	size_t 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
  */
-int inter_quest_parse_frommap(int fd) {
+int32 inter_quest_parse_frommap(int32 fd) {
 	switch(RFIFOW(fd,0)) {
 		case 0x3060: mapif_parse_quest_load(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
 #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 */

+ 24 - 24
src/char/int_storage.cpp

@@ -23,7 +23,7 @@
  * @param id: Storage ID
  * @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 );
 
 	if( storage != nullptr ){
@@ -69,7 +69,7 @@ const char *inter_premiumStorage_getPrintableName(uint8 id) {
  * @param p: Inventory entries
  * @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);
 }
@@ -80,7 +80,7 @@ int inventory_tosql(uint32 char_id, struct s_storage* p)
  * @param p: Storage entries
  * @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);
 }
@@ -91,7 +91,7 @@ int storage_tosql(uint32 account_id, struct s_storage* p)
  * @param p: Cart entries
  * @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);
 }
@@ -136,7 +136,7 @@ bool storage_fromsql(uint32 account_id, struct s_storage* p)
  * @param p: Guild Storage entries
  * @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);
 	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
  * @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 );
 }
@@ -193,7 +193,7 @@ void inter_storage_sql_final(void)
  * @param flag: Additional parameters
  * @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) )
 		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;
 }
 
-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);
 	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
 
-void mapif_parse_LoadGuildStorage(int fd)
+void mapif_parse_LoadGuildStorage(int32 fd)
 {
 	RFIFOHEAD(fd);
 	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
  * @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);
 	guild_id = RFIFOL(fd,8);
@@ -279,7 +279,7 @@ bool mapif_parse_SaveGuildStorage(int fd)
  * IZ 0x3856 <account_id>.L <guild_id>.W
  * 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);
 	WFIFOW(fd,0) = 0x3856;
@@ -301,8 +301,8 @@ void mapif_itembound_ack(int fd, int account_id, int guild_id)
  * @param count
  * @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);
 	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
  * @author [Akinari]
  */
-bool mapif_parse_itembound_retrieve(int fd)
+bool mapif_parse_itembound_retrieve(int32 fd)
 {
 	StringBuf buf;
 	SqlStmt* stmt;
 	unsigned short i = 0, count = 0;
 	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);
 
 	StringBuf_Init(&buf);
@@ -470,7 +470,7 @@ bool mapif_parse_itembound_retrieve(int fd)
  * @param entries Inventory/cart/storage entries
  * @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;
 	
 	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 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);
 	WFIFOW(fd, 0) = 0x388b;
 	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
  * @param fd
  */
-bool mapif_parse_StorageLoad(int fd) {
+bool mapif_parse_StorageLoad(int32 fd) {
 	uint32 aid, cid;
-	int type;
+	int32 type;
 	uint8 stor_id, mode;
 	struct s_storage stor;
 	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
  * @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;
 
 	RFIFOHEAD(fd);
@@ -585,7 +585,7 @@ bool mapif_parse_StorageSave(int fd) {
 /*==========================================
  * Parse packet from map-server
  *------------------------------------------*/
-bool inter_storage_parse_frommap(int fd)
+bool inter_storage_parse_frommap(int32 fd)
 {
 	RFIFOHEAD(fd);
 	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_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_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 */

+ 54 - 54
src/char/inter.cpp

@@ -46,7 +46,7 @@ InterServerDatabase interServerDb;
 
 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_id = "ragnarok";
 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;
 
 /// 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-
 	 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
@@ -74,16 +74,16 @@ int inter_recv_packet_length[] = {
 #endif
 
 struct WisData {
-	int id, fd, count, len, gmlvl;
+	int32 id, fd, count, len, gmlvl;
 	t_tick tick;
 	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;
 
 /* 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_) {
 		case JOB_NOVICE:
 		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",
 		"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",
-		"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",
 		"Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives",
 		"Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua",
 		"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",
-		"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",
 		"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",
 		"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;
 void geoip_readdb(void){
 	struct stat bufa;
@@ -415,7 +415,7 @@ void geoip_readdb(void){
 /* [Dekamaster/Nightroad] */
 /* There are millions of entries in GeoIP and it has its own algorithm to go quickly through them */
 const char* geoip_getcountry(uint32 ipnum){
-	int depth;
+	int32 depth;
 	uint32 x;
 	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 */
 /* 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];
 	va_list ap;
-	int len = 1;/* yes we start at 1 */
+	int32 len = 1;/* yes we start at 1 */
 
 	va_start(ap,msg);
 		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_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);
 	WFIFOW(fd,0) = 0x3808;
 	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]
  * @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 query[NAME_LENGTH], query_esq[NAME_LENGTH*2+1];
 	uint32 account_id = 0;
@@ -517,7 +517,7 @@ void mapif_parse_accinfo(int fd) {
 			} else {// more than one, listing... [Dekamaster/Nightroad]
 				inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(214),(int)Sql_NumRows(sql_handle));
 				while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
-					int class_;
+					int32 class_;
 					short base_level, job_level, online;
 					char name[NAME_LENGTH];
 
@@ -546,8 +546,8 @@ void mapif_parse_accinfo(int fd) {
 /**
  * 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)
 {
 	
@@ -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)
-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;
 	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, 8) = char_id;
 	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
 	plen = 16;
 
 	/**
 	 * Vessel!
 	 *
-	 * int type
+	 * int32 type
 	 * { keyLength(B), key(<keyLength>), index(L), value(L) }
 	 **/
 	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, 8) = char_id;
 			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 */
 			plen = 16;
 		}
@@ -831,7 +831,7 @@ int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type)
 /*==========================================
  * read config file
  *------------------------------------------*/
-int inter_config_read(const char* cfgName)
+int32 inter_config_read(const char* cfgName)
 {
 	char line[1024];
 	FILE* fp;
@@ -880,7 +880,7 @@ int inter_config_read(const char* cfgName)
 }
 
 // Save interlog into sql
-int inter_log(const char* fmt, ...)
+int32 inter_log(const char* fmt, ...)
 {
 	char str[255];
 	char esc_str[sizeof(str)*2+1];// escaped str
@@ -974,7 +974,7 @@ uint64 InterServerDatabase::parseBodyNode( const ryml::NodeRef& node ){
 }
 
 // initialize
-int inter_init_sql(const char *file)
+int32 inter_init_sql(const char *file)
 {
 	inter_config_read(file);
 
@@ -1037,7 +1037,7 @@ void inter_final(void)
  * Sends storage information to map-server
  * @param fd
  **/
-void inter_Storage_sendInfo(int fd) {
+void inter_Storage_sendInfo(int32 fd) {
 	size_t offset = 4;
 	size_t size = sizeof( struct s_storage_table );
 	size_t len = offset + interServerDb.size() * size;
@@ -1054,7 +1054,7 @@ void inter_Storage_sendInfo(int fd) {
 	WFIFOSET(fd, len);
 }
 
-int inter_mapif_init(int fd)
+int32 inter_mapif_init(int32 fd)
 {
 	inter_Storage_sendInfo(fd);
 	return 0;
@@ -1064,7 +1064,7 @@ int inter_mapif_init(int fd)
 //--------------------------------------------------------
 
 // 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));
 
@@ -1083,9 +1083,9 @@ int mapif_broadcast(unsigned char *mes, int len, unsigned long fontColor, short
 }
 
 // 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];
-	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]
 
@@ -1102,14 +1102,14 @@ int mapif_wis_message( std::shared_ptr<struct WisData> wd ){
 }
 
 // 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);
 	return 0;
 }
 
 //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))
 	{
@@ -1143,7 +1143,7 @@ void check_ttl_wisdata(){
 //--------------------------------------------------------
 
 // 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);
 	return 0;
@@ -1156,7 +1156,7 @@ int mapif_parse_broadcast(int fd)
  * @param fd
  * @return
  **/
-int mapif_parse_broadcast_item(int fd) {
+int32 mapif_parse_broadcast_item(int32 fd) {
 	unsigned char buf[11 + NAME_LENGTH*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
 // 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];
 
 	WBUFW(buf, 0) = 0x3802;
@@ -1179,13 +1179,13 @@ int mapif_wis_reply( int mapserver_fd, char* target, uint8 flag ){
 }
 
 // Wisp/page request to send
-int mapif_parse_WisRequest(int fd)
+int32 mapif_parse_WisRequest(int32 fd)
 {
 	char name[NAME_LENGTH];
 	char esc_name[NAME_LENGTH*2+1];// escaped name
 	char* data;
 	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
@@ -1222,7 +1222,7 @@ int mapif_parse_WisRequest(int fd)
 		}
 		else
 		{
-			static int wisid = 0;
+			static int32 wisid = 0;
 
 			// Whether the failure of previous wisp/page transmission (timeout)
 			check_ttl_wisdata();
@@ -1250,7 +1250,7 @@ int mapif_parse_WisRequest(int fd)
 
 
 // Wisp/page transmission result
-int mapif_parse_WisReply(int fd)
+int32 mapif_parse_WisReply(int32 fd)
 {
 	int32 id;
 	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)
-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
 
@@ -1284,13 +1284,13 @@ int mapif_parse_WisToGM(int fd)
 }
 
 // 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);
 	uint16 count = RFIFOW(fd, 12);
 
 	if( count ) {
-		int cursor = 14, i;
+		int32 cursor = 14, i;
 		bool isLoginActive = session_isActive(login_fd);
 
 		if( isLoginActive )
@@ -1306,7 +1306,7 @@ int mapif_parse_Registry(int fd)
 			cursor += 4;
 
 			switch (RFIFOB(fd, cursor++)) {
-				// int
+				// int32
 				case 0:
 					inter_savereg( account_id, char_id, key.c_str(), index, RFIFOQ( fd, cursor ), nullptr, false );
 					cursor += 8;
@@ -1341,7 +1341,7 @@ int mapif_parse_Registry(int fd)
 }
 
 // Request the value of all registries.
-int mapif_parse_RegistryRequest(int fd)
+int32 mapif_parse_RegistryRequest(int32 fd)
 {
 	//Load Char Registry
 	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;
 }
 
-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);
 	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);
 }
 
-int mapif_parse_NameChangeRequest(int fd)
+int32 mapif_parse_NameChangeRequest(int32 fd)
 {
 	uint32 account_id, char_id;
-	int type;
+	int32 type;
 	char* name;
-	int i;
+	int32 i;
 
 	account_id = RFIFOL(fd,2);
 	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.
 ///
 /// @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 )
 	{// variable-length packet
@@ -1420,10 +1420,10 @@ int inter_check_length(int fd, int 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);
 	// Check is valid packet entry
 	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;
 
-int inter_init_sql(const char *file);
+int32 inter_init_sql(const char *file);
 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);
 
-int inter_log(const char *fmt,...);
+int32 inter_log(const char *fmt,...);
 
 extern uint32 party_share_level;
 
 extern Sql* sql_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 */

+ 2 - 2
src/common/cbasetypes.hpp

@@ -380,7 +380,7 @@ void SET_FUNCPOINTER(T1& var, T2 p)
 #endif
 
 #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
 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; }
@@ -398,7 +398,7 @@ static inline size_t zmax(size_t a, size_t b){ return (a > b) ? a : b; } //cause
 #endif
 
 #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
 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; }

+ 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
  *   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) {
 		ShowWarning("Missing value for option '%s'.\n", option);
 		return false;
@@ -85,8 +85,8 @@ void display_versionscreen(bool do_exit)
  * @param argv: arguments values (from main)
  * @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++) {
 		const char* arg = argv[i];
 

+ 3 - 3
src/common/cli.hpp

@@ -29,9 +29,9 @@
 extern void display_helpscreen(bool exit);
 bool cli_hasevent();
 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);
-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 */

+ 4 - 4
src/common/conf.cpp

@@ -5,7 +5,7 @@
 
 #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);
 	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_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);
-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)
 {
@@ -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)
 {
 	config_setting_t *newAgg;
-	int i, n;
+	int32 i, n;
 
 	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))
 		return CONFIG_FALSE;

+ 2 - 2
src/common/conf.hpp

@@ -8,7 +8,7 @@
 
 #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 */

+ 7 - 7
src/common/core.cpp

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

+ 5 - 5
src/common/core.hpp

@@ -19,7 +19,7 @@
 #endif
 
 #if defined(BUILDBOT)
-	extern int buildbotflag;
+	extern int32 buildbotflag;
 #endif
 
 #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 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_git_hash(void);
 
@@ -65,7 +65,7 @@ namespace rathena{
 				bool m_crashed;
 
 			protected:
-				virtual bool initialize( int argc, char* argv[] );
+				virtual bool initialize( int32 argc, char* argv[] );
 				virtual void handle_main( t_tick next );
 				virtual void finalize();
 				virtual void handle_crash();
@@ -87,14 +87,14 @@ namespace rathena{
 				void set_run_once( bool run_once );
 				void signal_crash();
 				void signal_shutdown();
-				int start( int argc, char* argv[] );
+				int32 start( int32 argc, char* argv[] );
 		};
 	}
 }
 
 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 = {};
 
 	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
 	ShowMessage( CL_CLL );
-	// Print the actual error
+	// Print32 the actual error
 	_vShowMessage( MSG_ERROR, fmt, ap );
 
 	va_end(ap);

+ 40 - 39
src/common/db.cpp

@@ -73,6 +73,7 @@
 #include <cstdio>
 #include <cstdlib>
 
+#include "cbasetypes.hpp"
 #include "ers.hpp"
 #include "malloc.hpp"
 #include "mmo.hpp"
@@ -184,7 +185,7 @@ typedef struct DBMap_impl {
 	struct DBMap vtable;
 	// File and line of allocation
 	const char *alloc_file;
-	int alloc_line;
+	int32 alloc_line;
 	// Lock system
 	struct db_free *free_list;
 	uint32 free_count;
@@ -219,7 +220,7 @@ typedef struct DBIterator_impl {
 	// Iterator interface
 	struct DBIterator vtable;
 	DBMap_impl* db;
-	int ht_index;
+	int32 ht_index;
 	DBNode *node;
 } 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_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);
 	switch (type) {
@@ -870,7 +871,7 @@ static void db_free_unlock(DBMap_impl* db)
  * @see #DBComparator
  * @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
 	DB_COUNTSTAT(db_int_cmp);
@@ -892,7 +893,7 @@ static int db_int_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
  * @see #DBComparator
  * @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
 	DB_COUNTSTAT(db_uint_cmp);
@@ -913,7 +914,7 @@ static int db_uint_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
  * @see #DBComparator
  * @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);
 	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 #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);
 	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 #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
 	DB_COUNTSTAT(db_int64_cmp);
@@ -972,7 +973,7 @@ static int db_int64_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
  * @see #DBComparator
  * @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
 	DB_COUNTSTAT(db_uint64_cmp);
@@ -1439,11 +1440,11 @@ bool dbit_obj_exists(DBIterator* self)
  * @see DBMap#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;
 	DBNode *node;
-	int retval = 0;
+	int32 retval = 0;
 
 	DB_COUNTSTAT(dbit_remove);
 	node = it->node;
@@ -1543,7 +1544,7 @@ static bool db_obj_exists(DBMap* self, DBKey key)
 	db_free_lock(db);
 	node = db->ht[db->hash(key, db->maxlen)%HASH_SIZE];
 	while (node) {
-		int c = db->cmp(key, node->key, db->maxlen);
+		int32 c = db->cmp(key, node->key, db->maxlen);
 		if (c == 0) {
 			if (!(node->deleted)) {
 				db->cache = node;
@@ -1594,7 +1595,7 @@ static DBData* db_obj_get(DBMap* self, DBKey key)
 	db_free_lock(db);
 	node = db->ht[db->hash(key, db->maxlen)%HASH_SIZE];
 	while (node) {
-		int c = db->cmp(key, node->key, db->maxlen);
+		int32 c = db->cmp(key, node->key, db->maxlen);
 		if (c == 0) {
 			if (!(node->deleted)) {
 				data = &node->data;
@@ -1731,7 +1732,7 @@ static DBData* db_obj_vensure(DBMap* self, DBKey key, DBCreateData create, va_li
 	DBNode *node;
 	DBNode *parent = nullptr;
 	uint32 hash;
-	int c = 0;
+	int32 c = 0;
 	DBData *data = nullptr;
 
 	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?
  *        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;
 	DBNode *node;
 	DBNode *parent = nullptr;
-	int c = 0, retval = 0;
+	int32 c = 0, retval = 0;
 	uint32 hash;
 
 	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 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;
 	DBNode *node;
 	uint32 hash;
-	int retval = 0;
+	int32 retval = 0;
 
 	DB_COUNTSTAT(db_remove);
 	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);
 	hash = db->hash(key, db->maxlen)%HASH_SIZE;
 	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 (!(node->deleted)) {
 				if (db->cache == node)
@@ -2014,11 +2015,11 @@ static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data)
  * @protected
  * @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;
 	uint32 i;
-	int sum = 0;
+	int32 sum = 0;
 	DBNode *node;
 	DBNode *parent;
 
@@ -2074,10 +2075,10 @@ static int db_obj_vforeach(DBMap* self, DBApply func, va_list args)
  * @see DBMap#vforeach
  * @see DBMap#foreach
  */
-static int db_obj_foreach(DBMap* self, DBApply func, ...)
+static int32 db_obj_foreach(DBMap* self, DBApply func, ...)
 {
 	va_list args;
-	int ret;
+	int32 ret;
 
 	DB_COUNTSTAT(db_foreach);
 	if (self == nullptr) return 0; // nullpo candidate
@@ -2100,10 +2101,10 @@ static int db_obj_foreach(DBMap* self, DBApply func, ...)
  * @protected
  * @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;
-	int sum = 0;
+	int32 sum = 0;
 	uint32 i;
 	DBNode *node;
 	DBNode *parent;
@@ -2174,10 +2175,10 @@ static int db_obj_vclear(DBMap* self, DBApply func, va_list args)
  * @see DBMap#vclear
  * @see DBMap#clear
  */
-static int db_obj_clear(DBMap* self, DBApply func, ...)
+static int32 db_obj_clear(DBMap* self, DBApply func, ...)
 {
 	va_list args;
-	int ret;
+	int32 ret;
 
 	DB_COUNTSTAT(db_clear);
 	if (self == nullptr) return 0; // nullpo candidate
@@ -2201,10 +2202,10 @@ static int db_obj_clear(DBMap* self, DBApply func, ...)
  * @protected
  * @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;
-	int sum;
+	int32 sum;
 
 	DB_COUNTSTAT(db_vdestroy);
 	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#destroy
  */
-static int db_obj_destroy(DBMap* self, DBApply func, ...)
+static int32 db_obj_destroy(DBMap* self, DBApply func, ...)
 {
 	va_list args;
-	int ret;
+	int32 ret;
 
 	DB_COUNTSTAT(db_destroy);
 	if (self == nullptr) return 0; // nullpo candidate
@@ -2518,7 +2519,7 @@ DBReleaser db_custom_release(DBRelease which)
  * @see #DBMap_impl
  * @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;
 	uint32 i;
 	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
  * @public
  */
-DBKey db_i2key(int key)
+DBKey db_i2key(int32 key)
 {
 	DBKey ret;
 
@@ -2666,7 +2667,7 @@ DBKey db_ui642key(uint64 key)
  * @return The data as a DBData struct
  * @public
  */
-DBData db_i2data(int data)
+DBData db_i2data(int32 data)
 {
 	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
  * @return Integer value of the data.
  * @public
  */
-int db_data2i(DBData *data)
+int32 db_data2i(DBData *data)
 {
 	DB_COUNTSTAT(db_data2i);
 	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)
 {
-	int n = 0;
+	int32 n = 0;
 	struct linkdb_node *node;
 	if( head == nullptr ) return nullptr;
 	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 )
 {
-	int n = 0;
+	int32 n = 0;
 	struct linkdb_node *node;
 	if( head == nullptr ) return ;
 	node = *head;

+ 21 - 21
src/common/db.hpp

@@ -149,7 +149,7 @@ typedef enum DBOptions {
  * @see DBMap#remove
  */
 typedef union DBKey {
-	int i;
+	int32 i;
 	uint32 ui;
 	const char *str;
 	int64 i64;
@@ -175,7 +175,7 @@ typedef enum DBDataType {
  * Struct for data types used by the database.
  * @param type Type of data
  * @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.ptr Data of void* type
  * @param u.i64 Data of int64 type
@@ -184,7 +184,7 @@ typedef enum DBDataType {
 typedef struct DBData {
 	DBDataType type;
 	union {
-		int i;
+		int32 i;
 		uint32 ui;
 		void *ptr;
 		int64 i64;
@@ -218,7 +218,7 @@ typedef DBData (*DBCreateData)(DBKey key, va_list args);
  * @see DBMap#vdestroy
  * @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.
@@ -231,7 +231,7 @@ typedef int (*DBApply)(DBKey key, DBData *data, va_list args);
  * @public
  * @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.
@@ -245,7 +245,7 @@ typedef int (*DBMatcher)(DBKey key, DBData data, va_list args);
  * @public
  * @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.
@@ -357,7 +357,7 @@ struct DBIterator
 	 * @protected
 	 * @see DBMap#remove
 	 */
-	int (*remove)(DBIterator* self, DBData *out_data);
+	int32 (*remove)(DBIterator* self, DBData *out_data);
 
 	/**
 	 * Destroys this iterator and unlocks the database.
@@ -482,7 +482,7 @@ struct DBMap {
 	 * @return 1 if if the entry already exists, 0 otherwise
 	 * @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.
@@ -494,7 +494,7 @@ struct DBMap {
 	 * @return 1 if if the entry already exists, 0 otherwise
 	 * @protected
 	 */
-	int (*remove)(DBMap* self, DBKey key, DBData *out_data);
+	int32 (*remove)(DBMap* self, DBKey key, DBData *out_data);
 
 	/**
 	 * Just calls {@link DBMap#vforeach}.
@@ -507,7 +507,7 @@ struct DBMap {
 	 * @protected
 	 * @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.
@@ -519,7 +519,7 @@ struct DBMap {
 	 * @protected
 	 * @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}.
@@ -534,7 +534,7 @@ struct DBMap {
 	 * @protected
 	 * @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.
@@ -548,7 +548,7 @@ struct DBMap {
 	 * @protected
 	 * @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}.
@@ -565,7 +565,7 @@ struct DBMap {
 	 * @protected
 	 * @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.
@@ -580,7 +580,7 @@ struct DBMap {
 	 * @protected
 	 * @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).
@@ -826,7 +826,7 @@ DBReleaser db_custom_release(DBRelease which);
  * @see #db_default_release(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.
@@ -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
  * @public
  */
-DBKey db_i2key(int key);
+DBKey db_i2key(int32 key);
 
 /**
  * Manual cast from 'uint32' to the union DBKey.
@@ -874,7 +874,7 @@ DBKey db_ui642key(uint64 key);
  * @return The data as a DBData struct
  * @public
  */
-DBData db_i2data(int data);
+DBData db_i2data(int32 data);
 
 /**
  * Manual cast from 'uint32' to the struct DBData.
@@ -901,13 +901,13 @@ DBData db_ptr2data(void *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
  * @return Integer value of the data.
  * @public
  */
-int db_data2i(DBData *data);
+int32 db_data2i(DBData *data);
 
 /**
  * Gets uint32 type data from struct DBData.

+ 1 - 1
src/common/des.hpp

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

+ 1 - 1
src/common/ers.cpp

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

+ 38 - 38
src/common/grfio.cpp

@@ -18,11 +18,11 @@
 //	file entry table struct
 //----------------------------
 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	fn[128-4*5];		// file name
 	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
 FILELIST* filelist		= nullptr;
-int filelist_entrys		= 0;
-int filelist_maxentry	= 0;
+int32 filelist_entrys		= 0;
+int32 filelist_maxentry	= 0;
 
 // stores grf file names
 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
 char data_dir[1024] = "";
 
 
-// little endian char array to uint conversion
+// little endian char array to uint32 conversion
 static uint32 getlong(unsigned char* p)
 {
 	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 )
 	{
@@ -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;
 	size_t nblocks = len / sizeof(BIT64);
-	int dcycle, scycle;
+	int32 dcycle, scycle;
 	size_t i, j;
 
 	// 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 entry_type flags associated with 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 )
 	{// fully encrypted
-		int digits;
-		int cycle;
-		int i;
+		int32 digits;
+		int32 cycle;
+		int32 i;
 
 		// compute number of digits of the entry length
 		digits = 1;
@@ -242,14 +242,14 @@ unsigned long grfio_crc32(const unsigned char* buf, uint32 len)
 
 
 /// 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);
 }
 
 
 /// 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);
 }
@@ -259,18 +259,18 @@ int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned
  ***                File List Subroutines                ***
  ***********************************************************/
 // file list hash table
-int filelist_hash[256];
+int32 filelist_hash[256];
 
 // initializes the table that holds the first elements of all hash chains
 static void hashinit(void)
 {
-	int i;
+	int32 i;
 	for (i = 0; i < 256; i++)
 		filelist_hash[i] = -1;
 }
 
 // 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;
 	while(*fname) {
@@ -283,7 +283,7 @@ static int filehash(const char* fname)
 // finds a FILELIST entry with the specified file name
 static FILELIST* filelist_find(const char* fname)
 {
-	int hash, index;
+	int32 hash, index;
 
 	if (!filelist)
 		return nullptr;
@@ -307,7 +307,7 @@ char* grfio_find_file(const char* fname)
 // adds a FILELIST entry into the list of loaded files
 static FILELIST* filelist_add(FILELIST* entry)
 {
-	int hash;
+	int32 hash;
 
 	#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);
 	if (fentry != nullptr) {
-		int tmp = fentry->next;
+		int32 tmp = fentry->next;
 		memcpy(fentry, entry, sizeof(FILELIST));
 		fentry->next = tmp;
 	} else {
@@ -494,9 +494,9 @@ int32 grfio_read_rsw_water_level( const char* fname ){
 }
 
 /// 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) {
 		NibbleSwap(&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.
 /// @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;
 	unsigned char grf_header[0x2e];
-	int entry,entrys,ofs,grf_version;
+	int32 entry,entrys,ofs,grf_version;
 	unsigned char *grf_filelist;
 
 	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 ) {
 			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];
 			if( type & FILELIST_TYPE_FILE ) {
 				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 ) {
 					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;
 
 			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 ) {
 				ShowFatalError("GRF file name %s is too long\n", fname);
@@ -716,7 +716,7 @@ static void grfio_resourcecheck(void)
 	char *buf;
 	size_t size;
 	FILE* fp;
-	int i = 0;
+	int32 i = 0;
 
 	// read resnametable from data directory and return if successful
 	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.
-static int grfio_add(const char* fname)
+static int32 grfio_add(const char* fname)
 {
 	if( gentry_entrys >= gentry_maxentry )
 	{
@@ -782,7 +782,7 @@ static int grfio_add(const char* fname)
 void grfio_final(void)
 {
 	if (filelist != nullptr) {
-		int i;
+		int32 i;
 		for (i = 0; i < filelist_entrys; i++)
 			if (filelist[i].fnd != nullptr)
 				aFree(filelist[i].fnd);
@@ -793,7 +793,7 @@ void grfio_final(void)
 	filelist_entrys = filelist_maxentry = 0;
 
 	if (gentry_table != nullptr) {
-		int i;
+		int32 i;
 		for (i = 0; i < gentry_entrys; i++)
 			if (gentry_table[i] != nullptr)
 				aFree(gentry_table[i]);
@@ -809,7 +809,7 @@ void grfio_final(void)
 void grfio_init(const char* fname)
 {
 	FILE* data_conf;
-	int grf_num = 0;
+	int32 grf_num = 0;
 
 	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 );
 
 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 */

+ 13 - 13
src/common/malloc.cpp

@@ -72,7 +72,7 @@
 
 #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);
 	// 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;
 }
-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);
 	// 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;
 }
-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);
 	// 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;
 }
-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);
 	// 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;
 }
-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);
 	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;
 	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);
 }
 
-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);
 	memset(p,0,num * size);
 	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;
 	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) {
 		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;
 
@@ -451,7 +451,7 @@ static struct block* block_malloc(unsigned short hash)
 		p = hash_unfill[0];
 		hash_unfill[0] = hash_unfill[0]->unfill_next;
 	} else {
-		int i;
+		int32 i;
 		/* Newly allocated space for the block */
 		p = (struct block*)MALLOC(sizeof(struct block) * (BLOCK_ALLOC), __FILE__, __LINE__, __func__ );
 		if(p == nullptr) {
@@ -605,12 +605,12 @@ static void memmgr_final (void)
 	struct unit_head_large *large = unit_head_large_first;
 
 #ifdef LOG_MEMMGR
-	int count = 0;
+	int32 count = 0;
 #endif /* LOG_MEMMGR */
 
 	while (block) {
 		if (block->unit_used) {
-			int i;
+			int32 i;
 			for (i = 0; i < block->unit_maxused; i++) {
 				struct unit_head *head = block2unit(block, i);
 				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 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
 
@@ -67,11 +67,11 @@
 #	define aStrdup2(p,file,line,func)		aStrdup_(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
 

+ 6 - 6
src/common/mapindex.cpp

@@ -15,7 +15,7 @@ struct _indexes {
 	char name[MAP_NAME_LENGTH]; //Stores map name
 } indexes[MAX_MAPINDEX];
 
-int max_index = 0;
+int32 max_index = 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
 /// 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];
 	if (index == -1){ //autogive index
 		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) {
-	int i;
+	int32 i;
 	char map_name[MAP_NAME_LENGTH];
 	mapindex_getmapname(name, map_name);
 
@@ -131,8 +131,8 @@ const char* mapindex_idx2name(unsigned short id, const char *func) {
 void mapindex_init(void) {
 	FILE *fp;
 	char line[1024];
-	int last_index = -1;
-	int index;
+	int32 last_index = -1;
+	int32 index;
 	char map_name[MAP_NAME_LENGTH];
 	char path[255];
 	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';
 	return 0;
 }

+ 3 - 2
src/common/mapindex.hpp

@@ -4,6 +4,7 @@
 #ifndef MAPINDEX_HPP
 #define MAPINDEX_HPP
 
+#include "cbasetypes.hpp"
 #include "mmo.hpp"
 
 #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);
 #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);
 

+ 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.
 	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)
 	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],
                 *C = &msg_digest[2],
                 *D = &msg_digest[3];
-	int i;
+	int32 i;
 
 //prog
    //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
 struct quest {
-	int quest_id;                    ///< Quest ID
+	int32 quest_id;                    ///< Quest ID
 	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
 };
 
 /// Achievement log entry
 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 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
@@ -311,7 +311,7 @@ struct s_item_randomoption {
 } __attribute__((packed));
 
 struct item {
-	int id;
+	int32 id;
 	t_itemid nameid;
 	short amount;
 	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 {
 	uint32 account_id;
 	uint32 char_id;
-	int pet_id;
+	int32 pet_id;
 	short class_;
 	short level;
 	t_itemid egg_id;//pet egg id
@@ -493,7 +493,7 @@ struct s_pet {
 
 struct s_homunculus {	//[orn]
 	char name[NAME_LENGTH];
-	int hom_id;
+	int32 hom_id;
 	uint32 char_id;
 	short class_;
 	short prev_class;
@@ -506,39 +506,39 @@ struct s_homunculus {	//[orn]
 	t_exp exp;
 	short rename_flag;
 	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]
 	bool autofeed;
 };
 
 struct s_mercenary {
-	int mercenary_id;
+	int32 mercenary_id;
 	uint32 char_id;
 	short class_;
-	int hp, sp;
+	int32 hp, sp;
 	uint32 kill_count;
 	t_tick life_time;
 };
 
 struct s_elemental {
-	int elemental_id;
+	int32 elemental_id;
 	uint32 char_id;
 	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;
 	t_tick life_time;
 };
@@ -566,22 +566,22 @@ struct mmo_charstatus {
 	uint32 child;
 
 	t_exp base_exp,job_exp;
-	int zeny;
+	int32 zeny;
 
 	short class_; ///< Player's JobID
 	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;
 	short manner; // Defines how many minutes a char will be muted, each negative point is equivalent to a minute.
 	unsigned char karma;
 	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
-	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 shield; // view-id
@@ -650,7 +650,7 @@ enum mail_attachment_type {
 };
 
 struct mail_message {
-	int id;
+	int32 id;
 	uint32 send_id;                 //hold char_id of sender
 	char send_name[NAME_LENGTH];    //sender nickname
 	uint32 dest_id;                 //hold char_id of receiver
@@ -676,9 +676,9 @@ struct mail_data {
 
 struct auction_data {
 	uint32 auction_id;
-	int seller_id;
+	int32 seller_id;
 	char seller_name[NAME_LENGTH];
-	int buyer_id;
+	int32 buyer_id;
 	char buyer_name[NAME_LENGTH];
 
 	struct item item;
@@ -687,9 +687,9 @@ struct auction_data {
 	short type;
 
 	unsigned short hours;
-	int price, buynow;
+	int32 price, buynow;
 	time_t timestamp; // auction's end time
-	int auction_end_timer;
+	int32 auction_end_timer;
 };
 
 struct party_member {
@@ -704,7 +704,7 @@ struct party_member {
 };
 
 struct party {
-	int party_id;
+	int32 party_id;
 	char name[NAME_LENGTH];
 	unsigned char count; //Count of online characters.
 	unsigned exp : 1,
@@ -726,14 +726,14 @@ struct guild_member {
 
 struct guild_position {
 	char name[NAME_LENGTH];
-	int mode;
-	int exp_mode;
+	int32 mode;
+	int32 exp_mode;
 	unsigned char modified;
 };
 
 struct guild_alliance {
-	int opposition;
-	int guild_id;
+	int32 opposition;
+	int32 guild_id;
 	char name[NAME_LENGTH];
 };
 
@@ -745,21 +745,21 @@ struct guild_expulsion {
 };
 
 struct guild_skill {
-	int id,lv;
+	int32 id,lv;
 };
 
 struct Channel;
 struct mmo_guild {
-	int guild_id;
+	int32 guild_id;
 	short guild_lv, connect_member, max_member, average_lv;
 	t_exp exp;
 	t_exp next_exp;
-	int skill_point;
+	int32 skill_point;
 	char name[NAME_LENGTH],master[NAME_LENGTH];
 	struct guild_member member[MAX_GUILD];
 	struct guild_position position[MAX_GUILDPOSITION];
 	char mes1[MAX_GUILDMES1],mes2[MAX_GUILDMES2];
-	int emblem_len,emblem_id;
+	int32 emblem_len,emblem_id;
 	char emblem_data[2048];
 	struct guild_alliance alliance[MAX_GUILDALLIANCE];
 	struct guild_expulsion expulsion[MAX_GUILDEXPULSION];
@@ -775,8 +775,8 @@ enum e_woe_type{
 };
 
 struct guild_castle {
-	int castle_id;
-	int mapindex;
+	int32 castle_id;
+	int32 mapindex;
 	char castle_name[NAME_LENGTH];
 	char castle_event[NPC_NAME_LENGTH];
 	e_woe_type type;
@@ -786,21 +786,21 @@ struct guild_castle {
 	uint16 warp_y;
 	uint32 zeny;
 	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 {
 		unsigned visible : 1;
-		int id; // object id
+		int32 id; // object id
 	} guardian[MAX_GUARDIANS];
 	int* temp_guardians; // ids of temporary guardians (mobs)
-	int temp_guardians_max;
+	int32 temp_guardians_max;
 };
 
 /// Enum for guild castle data script commands
@@ -834,8 +834,8 @@ enum e_guild_permission {
 };
 
 struct fame_list {
-	int id;
-	int fame;
+	int32 id;
+	int32 fame;
 	char name[NAME_LENGTH];
 };
 
@@ -1137,13 +1137,13 @@ enum e_rank {
 };
 
 struct clan_alliance {
-	int opposition;
-	int clan_id;
+	int32 opposition;
+	int32 clan_id;
 	char name[NAME_LENGTH];
 };
 
 struct clan{
-	int id;
+	int32 id;
 	char name[NAME_LENGTH];
 	char master[NAME_LENGTH];
 	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]
  * (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 &&
 		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
  */
-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;
 	char line[1024], w1[8], w2[512];
 	FILE *fp;
-	static int called = 1;
+	static int32 called = 1;
 
 	if ((fp = fopen(cfgName, "r")) == nullptr) {
 		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)
  */
-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++)
 		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
  * 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;
 	else if (!strncmpi(langtype, "rus",2)) lang = 1;
 	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
  * return ?? if not found
  */
-const char* msg_langtype2langstr(int langtype){
+const char* msg_langtype2langstr(int32 langtype){
 	switch(langtype){
 		case 0: return "English (ENG)";
 		case 1: return "Russkiy (RUS)"; //transliteration
@@ -129,7 +129,7 @@ const char* msg_langtype2langstr(int langtype){
  * -1 : false range
  * -2 : disable
  */
-int msg_checklangtype(int lang, bool display){
+int32 msg_checklangtype(int32 lang, bool display){
 	uint16 test= (1<<(lang-1));
 	if(!lang) return 1; //default english
 	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
 
 //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
-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
-void _do_final_msg(int size, char ** msg_table);
+void _do_final_msg(int32 size, char ** msg_table);
 //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.
-int msg_checklangtype(int lang, bool display);
+int32 msg_checklangtype(int32 lang, bool display);
 
 #endif	/* MSG_CONF_HPP */

+ 8 - 8
src/common/nullpo.cpp

@@ -9,13 +9,13 @@
 
 #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
  *--------------------------------------*/
-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, ...)
 {
 	va_list ap;
@@ -29,7 +29,7 @@ int nullpo_chk_f(const char *file, int line, const char *func, const void *targe
 	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)
 		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)
  *--------------------------------------*/
-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, ...)
 {
 	va_list ap;
@@ -51,12 +51,12 @@ void nullpo_info_f(const char *file, int line, const char *func,
 	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);
 }
 
-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)
 		file = "??";
 	
@@ -72,7 +72,7 @@ static void nullpo_info_core_(const char *file, int line, const char *func){
 /*======================================
  * 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)
 {
 	nullpo_info_core_(file,line,func);

+ 4 - 4
src/common/nullpo.hpp

@@ -171,7 +171,7 @@
  * @param target: Target to check
  * @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.
@@ -182,7 +182,7 @@ int nullpo_chk(const char *file, int line, const char *func, const void *target)
  * @param fmt: Passed to vprintf
  * @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, ...)
                  __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 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.
@@ -203,7 +203,7 @@ void nullpo_info(const char *file, int line, const char *func);
  * @param target: Target to check
  * @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, ...)
                    __attribute__((format(printf,4,5)));
 

+ 3 - 3
src/common/packets.hpp

@@ -224,13 +224,13 @@ private:
 	struct s_packet_info{
 		bool fixed;
 		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;
 
 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( size < 2 ){
 				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;
 	}
 
-	bool handle( int fd, sessiontype& sd ){
+	bool handle( int32 fd, sessiontype& sd ){
 		int16 remaining =  static_cast<int16>( RFIFOREST( fd ) );
 
 		if( remaining < 2 ){

+ 16 - 16
src/common/showmsg.cpp

@@ -45,10 +45,10 @@
 /// when redirecting output:
 /// if true prints 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";
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -190,7 +190,7 @@ Escape sequences for Select Character Set
 #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]
@@ -205,7 +205,7 @@ int	VFPRINTF(HANDLE handle, const char *fmt, va_list argptr)
 	if(!fmt || !*fmt)
 		return 0;
 
-	// Print everything to the buffer
+	// Print32 everything to the buffer
 	BUFVPRINTF(tempbuf,fmt,argptr);
 
 	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[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);
-					int cnt;
+					int32 cnt;
 					DWORD tmp;
 					COORD origin = {0,0};
 					if(num==1)
@@ -507,9 +507,9 @@ int	VFPRINTF(HANDLE handle, const char *fmt, va_list argptr)
 	return 0;
 }
 
-int	FPRINTF(HANDLE handle, const char *fmt, ...)
+int32	FPRINTF(HANDLE handle, const char *fmt, ...)
 {
-	int ret;
+	int32 ret;
 	va_list argptr;
 	va_start(argptr, fmt);
 	ret = VFPRINTF(handle,fmt,argptr);
@@ -528,7 +528,7 @@ int	FPRINTF(HANDLE handle, const char *fmt, ...)
 #define is_console(file) (0!=isatty(fileno(file)))
 
 //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;
 	NEWBUF(tempbuf); // temporary buffer
@@ -542,7 +542,7 @@ int	VFPRINTF(FILE *file, const char *fmt, va_list argptr)
 		return 0;
 	}
 
-	// Print everything to the buffer
+	// Print32 everything to the buffer
 	BUFVPRINTF(tempbuf,fmt,argptr);
 
 	// start with processing
@@ -643,9 +643,9 @@ int	VFPRINTF(FILE *file, const char *fmt, va_list argptr)
 	FREEBUF(tempbuf);
 	return 0;
 }
-int	FPRINTF(FILE *file, const char *fmt, ...)
+int32	FPRINTF(FILE *file, const char *fmt, ...)
 {
-	int ret;
+	int32 ret;
 	va_list argptr;
 	va_start(argptr, fmt);
 	ret = VFPRINTF(file,fmt,argptr);
@@ -662,7 +662,7 @@ int	FPRINTF(FILE *file, const char *fmt, ...)
 
 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;
 	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_DEBUG && msg_silent&32)
 	)
-		return 0; //Do not print it.
+		return 0; //Do not print32 it.
 
 	if (timestamp_format[0] && flag != MSG_NONE)
 	{	//Display time format. [Skotlex]
@@ -800,9 +800,9 @@ void ClearScreen(void)
 	ShowMessage(CL_CLS);	// to prevent empty string passed messages
 #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_start(ap, string);
 	ret = _vShowMessage(flag, string, ap);

+ 7 - 5
src/common/showmsg.hpp

@@ -6,6 +6,8 @@
 
 #include <libconfig.h>
 
+#include <common/cbasetypes.hpp>
+
 // for help with the console colors look here:
 // http://www.edoceo.com/liberum/?doc=printf-with-color
 // some code explanation (used here):
@@ -65,11 +67,11 @@
 #define CL_XXBL			"\033[0;44m"	// default on blue
 #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 timestamp_format[20]; //For displaying Timestamps [Skotlex]
 
@@ -86,7 +88,7 @@ enum msg_type {
 };
 
 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 ShowStatus(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
 
-typedef int socklen_t;
+typedef int32 socklen_t;
 
 #define sErrno WSAGetLastError()
 #define S_ENOTSOCK WSAENOTSOCK
@@ -71,7 +71,7 @@ typedef int socklen_t;
 // global array of sockets (emulating linux)
 // fd is the position in the array
 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.
 ///
@@ -84,9 +84,9 @@ static int sock_arr_len = 0;
 ///
 /// @param s Socket
 /// @return Fd or -1
-int sock2fd(SOCKET s)
+int32 sock2fd(SOCKET s)
 {
-	int fd;
+	int32 fd;
 
 	// search for the socket
 	for( fd = 1; fd < sock_arr_len; ++fd )
@@ -106,9 +106,9 @@ int sock2fd(SOCKET s)
 ///
 /// @param s Socket
 /// @return New fd or -1
-int sock2newfd(SOCKET s)
+int32 sock2newfd(SOCKET s)
 {
-	int fd;
+	int32 fd;
 
 	// find an empty position
 	for( fd = 1; fd < sock_arr_len; ++fd )
@@ -126,7 +126,7 @@ int sock2newfd(SOCKET s)
 	return fd;
 }
 
-int sAccept(int fd, struct sockaddr* addr, int* addrlen)
+int32 sAccept(int32 fd, struct sockaddr* addr, int* addrlen)
 {
 	SOCKET s;
 
@@ -137,14 +137,14 @@ int sAccept(int fd, struct sockaddr* addr, int* addrlen)
 	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;
 	return ret;
 }
 
-int sSocket(int af, int type, int protocol)
+int32 sSocket(int32 af, int32 type, int32 protocol)
 {
 	SOCKET s;
 
@@ -155,7 +155,7 @@ int sSocket(int af, int type, int protocol)
 	return sock2newfd(s);
 }
 
-char* sErr(int code)
+char* sErr(int32 code)
 {
 	static char sbuf[512];
 	// strerror does not handle socket codes
@@ -224,18 +224,18 @@ char* sErr(int code)
 	fd_set readfds;
 #else
 	// 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 *epevents = nullptr;
 #endif
 
-int fd_max;
+int32 fd_max;
 time_t last_tick;
 time_t stall_time = 60;
 
 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.
 // 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];
 
 #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
 uint32 send_shortlist_set[(MAXCONN+31)/32];// to know if specific fd's are already in the shortlist
 #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
-	int ip_rules = 1;
-	static int connect_check(uint32 ip);
+	int32 ip_rules = 1;
+	static int32 connect_check(uint32 ip);
 #endif
 
 const char* error_msg(void)
 {
 	static char buf[512];
-	int code = sErrno;
+	int32 code = sErrno;
 	snprintf(buf, sizeof(buf), "error %d: %s", code, sErr(code));
 	return buf;
 }
@@ -288,9 +288,9 @@ const char* error_msg(void)
 /*======================================
  *	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;
 
@@ -303,7 +303,7 @@ void set_defaultparse(ParseFunc defaultparse)
 /*======================================
  *	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.
 	// 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());
 }
 
-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)
 	// 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 defined(WIN32)
-		int timeout = delay_timeout * 1000;
+		int32 timeout = delay_timeout * 1000;
 #else
 		struct timeval timeout;
 		timeout.tv_sec = delay_timeout;
@@ -356,7 +356,7 @@ void setsocketopts(int fd,int delay_timeout){
 /*======================================
  *	CORE : Socket Sub Function
  *--------------------------------------*/
-void set_eof(int fd)
+void set_eof(int32 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) )
 		return -1;
@@ -405,9 +405,9 @@ int recv_to_fifo(int fd)
 	return 0;
 }
 
-int send_from_fifo(int fd)
+int32 send_from_fifo(int32 fd)
 {
-	int len;
+	int32 len;
 
 	if( !session_isValid(fd) )
 		return -1;
@@ -454,7 +454,7 @@ int send_from_fifo(int fd)
 }
 
 /// 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)
 		session[fd]->func_send(fd);
@@ -462,7 +462,7 @@ void flush_fifo(int fd)
 
 void flush_fifos(void)
 {
-	int i;
+	int32 i;
 	for(i = 1; i < fd_max; i++)
 		flush_fifo(i);
 }
@@ -470,9 +470,9 @@ void flush_fifos(void)
 /*======================================
  *	CORE : Connection functions
  *--------------------------------------*/
-int connect_client(int listen_fd)
+int32 connect_client(int32 listen_fd)
 {
-	int fd;
+	int32 fd;
 	struct sockaddr_in client_address;
 	socklen_t len;
 
@@ -529,11 +529,11 @@ int connect_client(int listen_fd)
 	return fd;
 }
 
-int make_listen_bind(uint32 ip, uint16 port)
+int32 make_listen_bind(uint32 ip, uint16 port)
 {
 	struct sockaddr_in server_address;
-	int fd;
-	int result;
+	int32 fd;
+	int32 result;
 
 	fd = sSocket(AF_INET, SOCK_STREAM, 0);
 
@@ -598,10 +598,10 @@ int make_listen_bind(uint32 ip, uint16 port)
 	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;
-	int fd;
-	int result;
+	int32 fd;
+	int32 result;
 
 	fd = sSocket(AF_INET, SOCK_STREAM, 0);
 
@@ -723,7 +723,7 @@ int make_connection(uint32 ip, uint16 port, bool silent,int timeout) {
 	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]->rdata, unsigned char, RFIFO_SIZE);
@@ -738,7 +738,7 @@ static int create_session(int fd, RecvFunc func_recv, SendFunc func_send, ParseF
 	return 0;
 }
 
-static void delete_session(int fd)
+static void delete_session(int32 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) )
 		return 0;
 
@@ -770,7 +770,7 @@ int _realloc_fifo( int fd, uint32 rfifo_size, uint32 wfifo_size, const char* fil
 	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;
 
 	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)
-int RFIFOSKIP(int fd, size_t len)
+int32 RFIFOSKIP(int32 fd, size_t len)
 {
     struct socket_data *s;
 
@@ -819,7 +819,7 @@ int RFIFOSKIP(int fd, size_t len)
 }
 
 /// 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;
 	struct socket_data* s = session[fd];
@@ -889,13 +889,13 @@ int WFIFOSET(int fd, size_t len)
 	return 0;
 }
 
-int do_sockets(t_tick next)
+int32 do_sockets(t_tick next)
 {
 #ifndef SOCKET_EPOLL
 	fd_set rfd;
 	struct timeval timeout;
 #endif
-	int ret,i;
+	int32 ret,i;
 
 	// 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.
@@ -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
 	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] )
 			session[fd]->func_recv(fd);
 	}
@@ -961,7 +961,7 @@ int do_sockets(t_tick next)
 
 	for( i = 0; i < ret; i++ ){
 		struct epoll_event *it = &epevents[i];
-		int fd = it->data.fd;
+		int32 fd = it->data.fd;
 		struct socket_data *sock = session[fd];
 
 		if( !sock ){
@@ -1065,7 +1065,7 @@ typedef struct _connect_history {
 	struct _connect_history* next;
 	uint32 ip;
 	t_tick tick;
-	int count;
+	int32 count;
 	unsigned ddos : 1;
 } ConnectHistory;
 
@@ -1082,24 +1082,24 @@ enum _aco {
 
 static AccessControl* access_allow = 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.
 /// The array's index for any ip is ip&0xFFFF
 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)
 /// @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 ) {
 		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.
 ///  0      : Connection Rejected
 ///  1 or 2 : Connection Accepted
-static int connect_check_(uint32 ip)
+static int32 connect_check_(uint32 ip)
 {
 	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
 	for( i=0; i < access_allownum; ++i ){
@@ -1212,9 +1212,9 @@ static int connect_check_(uint32 ip)
 /// Timer function.
 /// Deletes old connection history records.
 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* prev_hist;
 	ConnectHistory* hist;
@@ -1246,7 +1246,7 @@ static TIMER_FUNC(connect_check_clear){
 
 /// Parses the ip address and mask and puts it into acc.
 /// 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 mask;
@@ -1257,7 +1257,7 @@ int access_ipmask(const char* str, AccessControl* acc)
 	} else {
 		uint32 a[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
 				(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
@@ -1293,7 +1293,7 @@ int access_ipmask(const char* str, AccessControl* acc)
 #endif
 //////////////////////////////
 
-int socket_config_read(const char* cfgName)
+int32 socket_config_read(const char* cfgName)
 {
 	char line[1024],w1[1024],w2[1024];
 	FILE *fp;
@@ -1372,7 +1372,7 @@ int socket_config_read(const char* cfgName)
 
 void socket_final(void)
 {
-	int i;
+	int32 i;
 #ifndef MINICORE
 	ConnectHistory* hist;
 	ConnectHistory* next_hist;
@@ -1421,7 +1421,7 @@ void socket_final(void)
 }
 
 /// Closes a socket.
-void do_close(int fd)
+void do_close(int32 fd)
 {
 	if( fd <= 0 ||fd >= MAXCONN )
 		return;// invalid
@@ -1445,9 +1445,9 @@ void do_close(int fd)
 
 /// Retrieve local ips in host byte order.
 /// 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 )
 		return 0;
@@ -1481,7 +1481,7 @@ int socket_getips(uint32* ips, int max)
 	}
 #else // not WIN32
 	{
-		int fd;
+		int32 fd;
 		char buf[2*16*sizeof(struct ifreq)];
 		struct ifconf ic;
 		u_long ad;
@@ -1501,7 +1501,7 @@ int socket_getips(uint32* ips, int max)
 		}
 		else
 		{
-			int pos;
+			int32 pos;
 			for( pos=0; pos < ic.ifc_len && num < max; )
 			{
 				struct ifreq* ir = (struct ifreq*)(buf+pos);
@@ -1563,7 +1563,7 @@ void socket_init(void)
 				if( 0 != setrlimit(RLIMIT_NOFILE, &rlp) )
 				{// failed
 					const char *errmsg = error_msg();
-					int rlim_ori;
+					int32 rlim_ori;
 					// set to maximum allowed
 					getrlimit(RLIMIT_NOFILE, &rlp);
 					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 );
 }
 
-bool session_isActive(int fd)
+bool session_isActive(int32 fd)
 {
 	return ( session_isValid(fd) && !session[fd]->flag.eof );
 }
@@ -1667,10 +1667,10 @@ uint16 ntows(uint16 netshort)
 #ifdef SEND_SHORTLIST
 // Add a fd to the shortlist so that it'll be recognized as a fd that needs
 // 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) )
 		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.
 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
 		--send_shortlist_count;

+ 22 - 22
src/common/socket.hpp

@@ -86,9 +86,9 @@
 
 
 // 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
 {
@@ -119,36 +119,36 @@ struct socket_data
 
 extern struct socket_data* session[MAXCONN];
 
-extern int fd_max;
+extern int32 fd_max;
 
 extern time_t last_tick;
 extern time_t stall_time;
 
 //////////////////////////////////
 // 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
 
-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_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_final(void);
 
-extern void flush_fifo(int fd);
+extern void flush_fifo(int32 fd);
 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);
 
@@ -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 ) )
 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 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
 /// that have data to send or need eof handling.
@@ -195,7 +195,7 @@ void set_eof(int fd);
 #ifdef SEND_SHORTLIST
 // Add a fd to the shortlist so that it'll be recognized as a fd that needs
 // 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.
 void send_shortlist_do_sends();
 #endif
@@ -205,7 +205,7 @@ void send_shortlist_do_sends();
 extern int8 packet_buffer[UINT16_MAX];
 
 template <typename P>
-bool socket_send( int fd, P& packet ){
+bool socket_send( int32 fd, P& packet ){
 	if( !session_isActive( fd ) ){
 		return false;
 	}
@@ -218,7 +218,7 @@ bool socket_send( int fd, P& packet ){
 }
 
 template <typename P>
-bool socket_send( int fd, P* packet ){
+bool socket_send( int32 fd, P* packet ){
 	if( !session_isActive( fd ) ){
 		return false;
 	}

+ 28 - 28
src/common/sql.cpp

@@ -27,7 +27,7 @@
 
 void ra_mysql_error_handler(uint32 ecode);
 
-int mysql_reconnect_type;
+int32 mysql_reconnect_type;
 uint32 mysql_reconnect_count;
 
 /// Sql handle
@@ -38,7 +38,7 @@ struct Sql
 	MYSQL_RES* result;
 	MYSQL_ROW row;
 	unsigned long* lengths;
-	int keepalive;
+	int32 keepalive;
 };
 
 
@@ -102,7 +102,7 @@ uint32 Sql_GetError( Sql* self ){
 	return mysql_errno( &self->handle );
 }
 
-static int Sql_P_Keepalive(Sql* self);
+static int32 Sql_P_Keepalive(Sql* self);
 
 /**
  * Establishes a connection to schema
@@ -114,7 +114,7 @@ static int Sql_P_Keepalive(Sql* self);
  * @param db : schema name
  * @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 )
 		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.
-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'") )
 	{
@@ -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.
-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;
 	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.
-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 )
 		return SQL_SUCCESS;
@@ -210,7 +210,7 @@ int Sql_SetEncoding(Sql* self, const char* encoding)
 
 
 /// Pings the connection.
-int Sql_Ping(Sql* self)
+int32 Sql_Ping(Sql* self)
 {
 	if( self && mysql_ping(&self->handle) == 0 )
 		return SQL_SUCCESS;
@@ -235,7 +235,7 @@ static TIMER_FUNC(Sql_P_KeepaliveTimer){
 ///
 /// @return the keepalive timer id, or INVALID_TIMER
 /// @private
-static int Sql_P_Keepalive(Sql* self)
+static int32 Sql_P_Keepalive(Sql* self)
 {
 	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.
-int Sql_Query(Sql* self, const char* query, ...)
+int32 Sql_Query(Sql* self, const char* query, ...)
 {
-	int res;
+	int32 res;
 	va_list args;
 
 	va_start(args, query);
@@ -294,7 +294,7 @@ int Sql_Query(Sql* self, const char* 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 )
 		return SQL_ERROR;
@@ -321,7 +321,7 @@ int Sql_QueryV(Sql* self, const char* query, va_list args)
 
 
 /// Executes a query.
-int Sql_QueryStr(Sql* self, const char* query)
+int32 Sql_QueryStr(Sql* self, const char* query)
 {
 	if( self == nullptr )
 		return SQL_ERROR;
@@ -389,7 +389,7 @@ uint64 Sql_NumRowsAffected(Sql* self)
 
 
 /// Fetches the next row.
-int Sql_NextRow(Sql* self)
+int32 Sql_NextRow(Sql* self)
 {
 	if( self && self->result )
 	{
@@ -409,7 +409,7 @@ int Sql_NextRow(Sql* self)
 
 
 /// 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 )
 	{
@@ -487,7 +487,7 @@ void Sql_Free(Sql* self)
 /// Returns the mysql integer type for the target size.
 ///
 /// @private
-static enum enum_field_types Sql_P_SizeToMysqlIntType(int sz)
+static enum enum_field_types Sql_P_SizeToMysqlIntType(int32 sz)
 {
 	switch( sz )
 	{
@@ -506,7 +506,7 @@ static enum enum_field_types Sql_P_SizeToMysqlIntType(int sz)
 /// Binds a parameter/result.
 ///
 /// @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));
 	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).
 ///
 /// @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* type_string;
@@ -705,9 +705,9 @@ SqlStmt* SqlStmt_Malloc(Sql* sql)
 
 
 /// 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_start(args, query);
@@ -720,7 +720,7 @@ int SqlStmt_Prepare(SqlStmt* self, const char* query, ...)
 
 
 /// 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 )
 		return SQL_ERROR;
@@ -742,7 +742,7 @@ int SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args)
 
 
 /// Prepares the statement.
-int SqlStmt_PrepareStr(SqlStmt* self, const char* query)
+int32 SqlStmt_PrepareStr(SqlStmt* self, const char* query)
 {
 	if( self == nullptr )
 		return SQL_ERROR;
@@ -775,7 +775,7 @@ size_t SqlStmt_NumParams(SqlStmt* self)
 
 
 /// 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 )
 		return SQL_ERROR;
@@ -805,7 +805,7 @@ int SqlStmt_BindParam(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, v
 
 
 /// Executes the prepared statement.
-int SqlStmt_Execute(SqlStmt* self)
+int32 SqlStmt_Execute(SqlStmt* self)
 {
 	if( self == nullptr )
 		return SQL_ERROR;
@@ -854,7 +854,7 @@ size_t SqlStmt_NumColumns(SqlStmt* self)
 
 
 /// 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 )
 		return SQL_ERROR;
@@ -911,9 +911,9 @@ uint64 SqlStmt_NumRows(SqlStmt* self)
 
 
 /// Fetches the next row.
-int SqlStmt_NextRow(SqlStmt* self)
+int32 SqlStmt_NextRow(SqlStmt* self)
 {
-	int err;
+	int32 err;
 	size_t i;
 	size_t cols;
 
@@ -1074,7 +1074,7 @@ void Sql_inter_server_read(const char* cfgName, bool first) {
 	}
 
 	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)
 			continue;
 

+ 17 - 17
src/common/sql.hpp

@@ -76,7 +76,7 @@ uint32 Sql_GetError( Sql* self );
 /// Establishes a connection.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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.
 ///
 /// @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).
 ///
 /// @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.
 ///
 /// @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"
 
 // 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++) {
 		if (ISCNTRL(str[i])) {
@@ -60,7 +60,7 @@ char* normalize_name(char* str,const char* delims)
 {
 	char* in = str;
 	char* out = str;
-	int put_space = 0;
+	int32 put_space = 0;
 
 	if( str == nullptr || delims == nullptr )
 		return str;
@@ -154,11 +154,11 @@ size_t strnlen (const char* string, size_t maxlen)
 #endif
 
 #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;
-	int count;
-	int n;
+	int32 count;
+	int32 n;
 
 	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).
 //----------------------------------------------------
-int e_mail_check(char* email)
+int32 e_mail_check(char* email)
 {
 	char ch;
 	char* last_arobas;
@@ -236,7 +236,7 @@ int e_mail_check(char* email)
 // Return numerical value of a switch configuration
 // 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)
 		return 1;
@@ -282,10 +282,10 @@ size_t safestrnlen(const char* string, size_t maxlen)
 /// @param fmt Format string
 /// @param ... Format arguments
 /// @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;
-	int ret;
+	int32 ret;
 
 	va_start(ap,fmt);
 	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.
 /// Lines start at 1.
-int strline(const char* str, size_t pos)
+int32 strline(const char* str, size_t pos)
 {
 	const char* target;
-	int line;
+	int32 line;
 
 	if( str == nullptr || pos == 0 )
 		return 1;
@@ -349,7 +349,7 @@ bool bin2hex(char* output, unsigned char* input, size_t count)
 ///
 /// @param sv Parse state
 /// @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 {
 		START_OF_FIELD,
 		PARSING_FIELD,
@@ -361,7 +361,7 @@ int sv_parse_next( s_svstate& sv ){
 
 	const char* str = sv.str;
 	size_t len = sv.len;
-	int opt = sv.opt;
+	int32 opt = sv.opt;
 	char delim = sv.delim;
 
 	// check opt
@@ -512,7 +512,7 @@ int sv_parse_next( s_svstate& sv ){
 /// @param npos Size of the pos array
 /// @param opt Options that determine the parsing behaviour
 /// @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
 	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 opt Options that determine the parsing behaviour
 /// @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 ){
 		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 ){
 	FILE* fp;
-	int lines = 0;
+	int32 lines = 0;
 	size_t entries = 0;
 	char** fields; // buffer for fields ([0] is reserved)
 	char path[1024], *line;
@@ -974,7 +974,7 @@ bool sv_readdb( const char* directory, const char* filename, char delim, size_t
 // @author MouseJstr (original)
 
 /// 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;
 	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
-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->ptr_ = self->buf_ = (char*)aMalloc2(self->max_ + 1, file, line, func);
 }
 
 /// 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_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
-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(;;)
 	{
 		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_);
 		va_copy(apcopy, ap);
-		int n = vsnprintf( self->ptr_, size, fmt, apcopy );
+		int32 n = vsnprintf( self->ptr_, size, fmt, apcopy );
 		va_end(apcopy);
 		/* If that worked, return the length. */
 		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
-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 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
-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 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
-int StringBuf_Length(StringBuf* self)
+int32 StringBuf_Length(StringBuf* self)
 {
 	return (int)(self->ptr_ - self->buf_);
 }

+ 17 - 17
src/common/strlib.hpp

@@ -18,7 +18,7 @@
 #include "cbasetypes.hpp"
 #include "malloc.hpp"
 
-int remove_control_chars(char* str);
+int32 remove_control_chars(char* str);
 char* trim(char* str);
 char* normalize_name(char* str,const char* delims);
 const char *stristr(const char *haystack, const char *needle);
@@ -34,11 +34,11 @@ size_t strnlen (const char* string, size_t maxlen);
 #endif
 
 #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
 
-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
 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.
 /// Returns the size of the string (without nul-terminator)
 /// 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.
 /// 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.
 /// 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 start; //< where the field starts
 	size_t end; //< where the field ends
-	int opt; //< parse options
+	int32 opt; //< parse options
 	char delim; //< field delimiter
 	bool done; //< if all the text has been parsed
 };
@@ -98,14 +98,14 @@ struct s_svstate
 ///
 /// @param sv Parse state
 /// @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.
 /// 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.
 /// Other position pairs are the start and end of fields.
 /// 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.
 /// 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.
 /// Other entries are the start of fields (nul-teminated).
 /// 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.
 /// Returns the length of the escaped string.
@@ -143,19 +143,19 @@ struct 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)
-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)
-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__)
-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)
-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)
-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)
-int StringBuf_Length(StringBuf* self);
+int32 StringBuf_Length(StringBuf* self);
 char* StringBuf_Value(StringBuf* self);
 void StringBuf_Clear(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)
 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)
 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)
@@ -61,7 +61,7 @@ struct timer_func_list {
 } *tfl_root = nullptr;
 
 /// 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;
 
@@ -171,7 +171,7 @@ static t_tick tick(void)
 //////////////////////////////////////////////////////////////////////////
 // tick is cached for TICK_CACHE calls
 static t_tick gettick_cache;
-static int gettick_count = 1;
+static int32 gettick_count = 1;
 
 t_tick gettick_nocache(void)
 {
@@ -206,7 +206,7 @@ t_tick gettick(void)
  *--------------------------------------*/
 
 /// 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_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP);
@@ -217,9 +217,9 @@ static void push_timer_heap(int tid)
  *--------------------------*/
 
 /// Returns a free timer id.
-static int acquire_timer(void)
+static int32 acquire_timer(void)
 {
-	int tid;
+	int32 tid;
 
 	// select a free timer
 	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).
 /// 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();
 	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).
 /// 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 )
 	{
@@ -291,7 +291,7 @@ int add_timer_interval(t_tick tick, TimerFunc func, int id, intptr_t data, int i
 }
 
 /// 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;
 }
@@ -299,7 +299,7 @@ const struct TimerData* get_timer(int tid)
 /// Marks a timer specified by 'id' for immediate deletion once it expires.
 /// Param 'func' is used for debug/verification purposes.
 /// 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 )
 	{
@@ -320,14 +320,14 @@ int delete_timer(int tid, TimerFunc func)
 
 /// Adjusts a timer's expiration time.
 /// 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);
 }
 
 /// 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.
-t_tick settick_timer(int tid, t_tick tick)
+t_tick settick_timer(int32 tid, t_tick tick)
 {
 	size_t i;
 
@@ -361,7 +361,7 @@ t_tick do_timer(t_tick tick)
 	// process all timers one by one
 	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);
 		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
  */
-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;
 	timein -= *year*factor_year;
@@ -474,7 +474,7 @@ double solve_time(char* modif_p) {
 	nullpo_retr(0,modif_p);
 
 	while (modif_p[0] != '\0') {
-		int value = atoi(modif_p);
+		int32 value = atoi(modif_p);
 		if (value == 0)
 			modif_p++;
 		else {

+ 11 - 11
src/common/timer.hpp

@@ -30,7 +30,7 @@ enum {
 	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
 typedef TIMER_FUNC((*TimerFunc));
@@ -39,10 +39,10 @@ struct TimerData {
 	t_tick tick;
 	TimerFunc func;
 	uint32 type;
-	int interval;
+	int32 interval;
 
 	// general-purpose storage
-	int id;
+	int32 id;
 	intptr_t data;
 };
 
@@ -51,21 +51,21 @@ struct TimerData {
 t_tick gettick(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);
 
 //transform a timestamp to string
 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);
 
 t_tick do_timer(t_tick tick);

+ 5 - 3
src/common/utilities.cpp

@@ -9,6 +9,8 @@
 #include <numeric> //iota
 #include <string>
 
+#include "cbasetypes.hpp"
+
 #ifndef __has_builtin
 	#define __has_builtin(x) 0
 #endif
@@ -38,12 +40,12 @@ cScopeTimer::cScopeTimer()
  * @author http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#C.2B.2B
  * 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
 	// 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;
 	

+ 1 - 1
src/common/utilities.hpp

@@ -27,7 +27,7 @@ class 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 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
  *         3 = File but doesn't exist
  */
-int check_filepath(const char* filepath)
+int32 check_filepath(const char* filepath)
 {
 	DWORD Attribute;
 
@@ -179,7 +179,7 @@ int check_filepath(const char* filepath)
  *         2 = File
  *         3 = Neither a file or directory
  */
-int check_filepath(const char* filepath)
+int32 check_filepath(const char* filepath)
 {
 	struct stat s;
 
@@ -264,7 +264,7 @@ bool exists(const char* filename)
 	return !access(filename, F_OK);
 }
 
-uint8 GetByte(uint32 val, int idx)
+uint8 GetByte(uint32 val, int32 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 )
 	{

+ 3 - 3
src/common/utils.hpp

@@ -12,7 +12,7 @@
 void WriteDump(FILE* fp, 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*));
 bool exists(const char* filename);
 
@@ -33,8 +33,8 @@ uint32 get_percentage_exp(const uint64 a, const uint64 b);
 // 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 uint32 MakeDWord(uint16 word0, uint16 word1);
 

+ 1 - 1
src/config/core.hpp

@@ -105,7 +105,7 @@
 #endif
 
 /// 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
 
 /**

+ 10 - 10
src/login/account.cpp

@@ -41,7 +41,7 @@ typedef struct AccountDB_SQL {
 typedef struct AccountDBIterator_SQL {
 	AccountDBIterator vtable;    // public interface
 	AccountDB_SQL* db;
-	int last_account_id;
+	int32 last_account_id;
 } AccountDBIterator_SQL;
 
 /// internal functions
@@ -657,8 +657,8 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo
 			break;
 		}
 
-		const int MAX_RETRIES = 20;
-		int i = 0;
+		const int32 MAX_RETRIES = 20;
+		int32 i = 0;
 		bool success = false;
 
 		// 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;
 }
 
-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;
 	AccountDB_SQL* db = (AccountDB_SQL*)self;
 	uint16 count = RFIFOW(fd, 12);
 
 	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];
 
 		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;
 
 			switch (RFIFOB(fd, cursor++)) {
-				// int
+				// int32
 				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)) )
 						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;
 	AccountDB_SQL* db = (AccountDB_SQL*)self;
 	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, 8) = char_id;
 	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
 	plen = 16;
 
 	/**
 	 * Vessel!
 	 *
-	 * int type
+	 * int32 type
 	 * { keyLength(B), key(<keyLength>), index(L), value(L) }
 	 **/
 	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, 8) = char_id;
 			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
 
 			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
 	char web_auth_token[WEB_AUTH_TOKEN_LENGTH]; // web authentication token (randomized on each login)
 #ifdef VIP_ENABLE
-	int old_group;
+	int32 old_group;
 	time_t vip_time;
 #endif
 };
@@ -143,7 +143,7 @@ struct AccountDB {
 	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 */

+ 2 - 2
src/login/ipban.cpp

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

+ 21 - 21
src/login/login.cpp

@@ -51,9 +51,9 @@ struct s_subnet {
 	uint32 char_ip;
 	uint32 map_ip;
 } 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
 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]
 //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);
 }
 
@@ -80,7 +80,7 @@ struct online_login_data* login_get_online_user( uint32 account_id ){
  * @param account_id : aid connected
  * @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 );
 
 	if( p == nullptr ){
@@ -170,7 +170,7 @@ TIMER_FUNC(login_waiting_disconnect_timer){
 	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 ){
 		if( 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);
  *	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;
 	t_tick tick = gettick();
 	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
  *	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;
 
 	char ip[16];
@@ -328,7 +328,7 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) {
 				return 0; // unregistered id
 			}
 
-			int result;
+			int32 result;
 			// remove the _M/_F suffix
 			len -= 2;
 			sd->userid[len] = '\0';
@@ -388,7 +388,7 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) {
 
 		if( !match ) {
 			char smd5[33];
-			int i;
+			int32 i;
 
 			if( !sd->has_client_hash ) {
 				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;
 }
 
-int login_get_usercount( int users ){
+int32 login_get_usercount( int32 users ){
 #if PACKETVER >= 20170726
 	if( login_config.usercount_disable ){
 		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
  * @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) );
 	return ( i < subnet_count ) ? subnet[i].char_ip : 0;
 }
@@ -511,10 +511,10 @@ int lan_subnetcheck(uint32 ip) {
 
 
 /// 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);
 }
-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);
 }
 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)
  * @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;
-	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];
 
 	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"))
 			login_config.disable_webtoken_delay = cap_value(atoi(w2), 0, INT_MAX);
 		else if(!strcmpi(w1, "client_hash")) {
-			int group = 0;
+			int32 group = 0;
 			char md5[33];
 
 			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) {
 					nnode->hash[0] = '\0';
 				} else {
-					int i;
+					int32 i;
 					for (i = 0; i < 32; i += 2) {
 						char buf[3];
 						uint32 byte;
@@ -847,7 +847,7 @@ void LoginServer::handle_shutdown(){
 	flush_fifos();
 }
 
-bool LoginServer::initialize( int argc, char* argv[] ){
+bool LoginServer::initialize( int32 argc, char* argv[] ){
 	// Init default value
 	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;
 }
 
-int main( int argc, char *argv[] ){
+int32 main( int32 argc, char *argv[] ){
 	return main_core<LoginServer>( argc, argv );
 }

+ 26 - 26
src/login/login.hpp

@@ -21,7 +21,7 @@ namespace rathena{
 	namespace server_login{
 		class LoginServer : public Core{
 			protected:
-				bool initialize( int argc, char* argv[] ) override;
+				bool initialize( int32 argc, char* argv[] ) override;
 				void finalize() override;
 				void handle_shutdown() override;
 
@@ -45,7 +45,7 @@ struct login_session_data {
 
 	char userid[NAME_LENGTH];	/// account name
 	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)
 	uint16 md5keylen;		/// len of the md5 key
 
@@ -54,9 +54,9 @@ struct login_session_data {
 	uint8 clienttype;		/// ???
 
 	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
 };
@@ -65,7 +65,7 @@ struct login_session_data {
 ///Struct describing 1 char-serv attach to us
 struct mmo_char_server {
 	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
 	uint16 port;	///char-serv rt
 	uint16 users;	/// user count on this server
@@ -91,10 +91,10 @@ struct Login_Config {
 	bool new_account_flag;                          /// autoregistration via _M/_F ?
 	uint8 acc_name_min_length;                      /// minimum account name 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?
-	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 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 ?
 	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
 
 	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
 	struct {
 		uint32 group;								/// VIP group ID
@@ -123,7 +123,7 @@ struct Login_Config {
 	} vip_sys;
 #endif
 	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;
 
@@ -133,16 +133,16 @@ extern struct Login_Config login_config;
 #define msg_config_read(cfgName) login_msg_config_read(cfgName)
 #define msg_txt(msg_number) login_msg_txt(msg_number)
 #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);
 bool login_config_read(const char* cfgName, bool normal);
 
 /// Online User Database [Wizputer]
 struct online_login_data {
 	uint32 account_id;
-	int waiting_disconnect;
-	int char_server;
+	int32 waiting_disconnect;
+	int32 char_server;
 };
 
 /// Auth database
@@ -169,7 +169,7 @@ struct online_login_data* login_get_online_user( uint32 account_id );
  * @param account_id: the account identifier
  * @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.
@@ -197,14 +197,14 @@ void login_remove_auth_node( uint32 account_id );
  */
 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.
  * @param ip: ip to check if in auth network
  * @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);
  *	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.
@@ -235,8 +235,8 @@ int login_mmo_auth_new(const char* userid, const char* pass, const char sex, con
  *	6: banned
  *	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 */

+ 45 - 45
src/login/loginchrif.cpp

@@ -8,7 +8,7 @@
 
 #include <common/showmsg.hpp> //show notice
 #include <common/socket.hpp> //wfifo session
-#include <common/strlib.hpp> //safeprint
+#include <common/strlib.hpp> //safeprint32
 #include <common/timer.hpp> //difftick
 
 #include "account.hpp"
@@ -16,7 +16,7 @@
 #include "loginlog.hpp"
 
 //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)
@@ -25,10 +25,10 @@ void logchrif_on_disconnect(int id);
  * @param len: size of packet
  * @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 ) {
-		int fd = ch_server[i].fd;
+		int32 fd = ch_server[i].fd;
 		if( session_isValid(fd) && fd != sfd ){
 			WFIFOHEAD(fd,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)
  * @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 )
 		return 0;
 	else{
@@ -78,7 +78,7 @@ int logchrif_parse_reqauth(int fd, int id,char* ip){
 		uint32 login_id2 = RFIFOL(fd,10);
 		uint8 sex = RFIFOB(fd,14);
 		//uint32 ip_ = ntohl(RFIFOL(fd,15));
-		int request_id = RFIFOL(fd,19);
+		int32 request_id = RFIFOL(fd,19);
 		RFIFOSKIP(fd,23);
 
 		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
  * @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 )
 		return 0;
 	else{
-		int users = RFIFOL(fd,2);
+		int32 users = RFIFOL(fd,2);
 		RFIFOSKIP(fd,6);
 		// how many users on world? (update)
 		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)  
  * @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;
 	time_t expiration_time = 0;
 	char email[40] = "";
-	int group_id = 0;
+	int32 group_id = 0;
 	char birthdate[10+1] = "";
 	char pincode[PINCODE_LENGTH+1];
 	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 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
 	WFIFOHEAD(fd,19);
 	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)
  * @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 )
 		return 0;
 	else {
@@ -250,7 +250,7 @@ int logchrif_parse_reqaccdata(int fd, int id, char *ip){
  * @param fd: fd to parse from (char-serv)
  * @return 1 success
  */
-int logchrif_parse_keepalive(int fd){
+int32 logchrif_parse_keepalive(int32 fd){
 	RFIFOSKIP(fd,2);
 	WFIFOHEAD(fd,2);
 	WFIFOW(fd,0) = 0x2718;
@@ -266,7 +266,7 @@ int logchrif_parse_keepalive(int fd){
  * @param ip: char-serv ip (used for info)
  * @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)
 		return 0;
 	else{
@@ -308,7 +308,7 @@ int logchrif_parse_reqchangemail(int fd, int id, char* ip){
  * @return 0 not enough info transmitted, 1 success
  * 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)
 		return 0;
 	else{
@@ -353,7 +353,7 @@ int logchrif_parse_requpdaccstate(int fd, int id, char* ip){
  * @return 0 not enough info transmitted, 1 success
  * 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)
 		return 0;
 	else{
@@ -361,7 +361,7 @@ int logchrif_parse_reqbanacc(int fd, int id, char* ip){
 		AccountDB* accounts = login_get_accounts_db();
 
 		uint32 account_id = RFIFOL(fd,2);
-		int timediff = RFIFOL(fd,6);
+		int32 timediff = RFIFOL(fd,6);
 		RFIFOSKIP(fd,10);
 
 		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)
  * @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 )
 		return 0;
 	else{
@@ -447,7 +447,7 @@ int logchrif_parse_reqchgsex(int fd, int id, char* ip){
  * @param ip: char-serv ip (used for info)
  * @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) )
 		return 0;
 	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)
  * @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 )
 		return 0;
 	else{
@@ -501,7 +501,7 @@ int logchrif_parse_requnbanacc(int fd, int id, char* ip){
  * @param id: id of char-serv
  * @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 )
 		return 0;
 	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)
  * @return 0 not enough info transmitted, 1 success
  */
-int logchrif_parse_setaccoffline(int fd){
+int32 logchrif_parse_setaccoffline(int32 fd){
 	if( RFIFOREST(fd) < 6 )
 		return 0;
 	login_remove_online_user(RFIFOL(fd,2));
@@ -530,7 +530,7 @@ int logchrif_parse_setaccoffline(int fd){
  * @param id: id of char-serv
  * @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))
 		return 0;
 	else{
@@ -552,7 +552,7 @@ int logchrif_parse_updonlinedb(int fd, int id){
  * @param fd: fd to parse from (char-serv)
  * @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)
 		return 0;
 	else{
@@ -572,7 +572,7 @@ int logchrif_parse_req_global_accreg(int fd){
  * @param id: char-serv id
  * @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 )
 		return 0;
 	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)
  * @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);
 	login_online_db_setoffline( id );
 	RFIFOSKIP(fd,2);
@@ -600,7 +600,7 @@ int logchrif_parse_setalloffline(int fd, int id){
  * @param fd: fd to parse from (char-serv)
  * @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 )
 		return 0;
 	else{
@@ -622,7 +622,7 @@ int logchrif_parse_updpincode(int fd){
  * @param fd: fd to parse from (char-serv)
  * @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 )
 		return 0;
 	else{
@@ -653,17 +653,17 @@ int logchrif_parse_pincode_authfail(int fd){
  * @param fd link to charserv
  * @return 0 missing data, 1 succeeded
  */
-int logchrif_parse_reqvipdata(int fd) {
+int32 logchrif_parse_reqvipdata(int32 fd) {
 #ifdef VIP_ENABLE
 	if( RFIFOREST(fd) < 15 )
 		return 0;
 	else { //request vip info
 		struct mmo_account acc;
 		AccountDB* accounts = login_get_accounts_db();
-		int aid = RFIFOL(fd,2);
+		int32 aid = RFIFOL(fd,2);
 		int8 flag = RFIFOB(fd,6);
 		int32 timediff = RFIFOL(fd,7);
-		int mapfd = RFIFOL(fd,11);
+		int32 mapfd = RFIFOL(fd,11);
 		RFIFOSKIP(fd,15);
 		
 		if( accounts->load_num(accounts, &acc, aid ) ) {
@@ -716,11 +716,11 @@ int logchrif_parse_reqvipdata(int fd) {
 * IA 0x2720
 * 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 )
 		return 0;
 	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);
 		AccountDB* accounts = login_get_accounts_db();
 		struct mmo_account acc;
@@ -728,7 +728,7 @@ int logchrif_parse_accinfo(int fd) {
 
 		// Send back the result to char-server
 		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);
 			WFIFOHEAD(fd, len);
 			WFIFOW(fd, 0) = 0x2721;
@@ -768,8 +768,8 @@ int logchrif_parse_accinfo(int fd) {
  * @param fd: file descriptor to parse, (link to char-serv)
  * @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;
 	char ip[16];
 
@@ -792,7 +792,7 @@ int logchrif_parse(int fd){
 	ip2str(ipl, ip);
 
 	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);
 		switch( command ){
 			case 0x2712: next = logchrif_parse_reqauth(fd, cid, ip); break;
@@ -837,7 +837,7 @@ int logchrif_parse(int fd){
  * Initializes a server structure.
  * @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]));
 	ch_server[id].fd = -1;
 }
@@ -846,7 +846,7 @@ void logchrif_server_init(int id) {
  * Destroys a server structure.
  * @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 ) {
 		do_close(ch_server[id].fd);
 		ch_server[id].fd = -1;
@@ -858,7 +858,7 @@ void logchrif_server_destroy(int id){
  *  Actually destroys then recreates the struct.
  * @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.
 	logchrif_server_destroy(id);
 	logchrif_server_init(id);
@@ -868,7 +868,7 @@ void logchrif_server_reset(int id) {
  * Called when the connection to Char Server is disconnected.
  * @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);
 	logchrif_server_reset(id);
 }
@@ -878,7 +878,7 @@ void logchrif_on_disconnect(int id) {
  *  Initialisation, function called at start of the login-serv.
  */
 void do_init_loginchrif(void){
-	int i;
+	int32 i;
 	for( i = 0; i < ARRAYLENGTH(ch_server); ++i )
 		logchrif_server_init(i);
 
@@ -895,7 +895,7 @@ void do_init_loginchrif(void){
  *  current signal catch : SIGTERM, SIGINT
  */
 void do_shutdown_loginchrif(void){
-	int id;
+	int32 id;
 	for( id = 0; id < ARRAYLENGTH(ch_server); ++id )
 		logchrif_server_reset(id);
 }
@@ -905,7 +905,7 @@ void do_shutdown_loginchrif(void){
  *  dealloc..., function called at exit of the login-serv
  */
 void do_final_loginchrif(void){
-	int i;
+	int32 i;
 	for( i = 0; i < ARRAYLENGTH(ch_server); ++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)
  * @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)
@@ -21,7 +21,7 @@ int logchrif_parse(int fd);
  * @param len: size of packet
  * @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

+ 22 - 22
src/login/loginclif.cpp

@@ -12,7 +12,7 @@
 #include <common/random.hpp>
 #include <common/showmsg.hpp> //show notice
 #include <common/socket.hpp> //wfifo session
-#include <common/strlib.hpp> //safeprint
+#include <common/strlib.hpp> //safeprint32
 #include <common/timer.hpp> //difftick
 #include <common/utils.hpp>
 
@@ -31,7 +31,7 @@
  *  8 : already online
  * <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 = {};
 
 	p.packetType = HEADER_SC_NOTIFY_BAN;
@@ -45,12 +45,12 @@ static void logclif_sent_auth_result(int fd,char result){
  * @param sd: player session
  */
 static void logclif_auth_ok(struct login_session_data* sd) {
-	int fd = sd->fd;
+	int32 fd = sd->fd;
 	uint32 ip = session[fd]->client_addr;
 
 	uint8 server_num, n;
 	uint32 subnet_char_ip;
-	int i;
+	int32 i;
 
 	if( !global_core->is_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);
 }
 
-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 = {};
 
 	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
      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;
 
 	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)
  * @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
 	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)
  * @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 );
 
 	sd.has_client_hash = 1;
@@ -263,7 +263,7 @@ static bool logclif_parse_updclhash( int fd, struct login_session_data& sd ){
 }
 
 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 );
 
 	char ip[16];
@@ -282,7 +282,7 @@ static bool logclif_parse_reqauth_raw( int fd, login_session_data& sd ){
 
 	sd.passwdenc = 0;
 
-	int result = login_mmo_auth( &sd, false );
+	int32 result = login_mmo_auth( &sd, false );
 
 	if( result == -1 ){
 		logclif_auth_ok( &sd );
@@ -294,7 +294,7 @@ static bool logclif_parse_reqauth_raw( int fd, login_session_data& sd ){
 }
 
 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 );
 
 	char ip[16];
@@ -314,7 +314,7 @@ static bool logclif_parse_reqauth_md5( int fd, login_session_data& sd ){
 		return false;
 	}
 
-	int result = login_mmo_auth( &sd, false );
+	int32 result = login_mmo_auth( &sd, false );
 
 	if( result == -1 ){
 		logclif_auth_ok( &sd );
@@ -326,7 +326,7 @@ static bool logclif_parse_reqauth_md5( int fd, login_session_data& sd ){
 }
 
 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 );
 
 	char ip[16];
@@ -348,7 +348,7 @@ static bool logclif_parse_reqauth_sso( int fd, login_session_data& sd ){
 
 	sd.passwdenc = 0;
 
-	int result = login_mmo_auth( &sd, false );
+	int32 result = login_mmo_auth( &sd, false );
 
 	if( result == -1 ){
 		logclif_auth_ok( &sd );
@@ -359,7 +359,7 @@ static bool logclif_parse_reqauth_sso( int fd, login_session_data& sd ){
 	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;
 
 	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
  * @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 );
 
 	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)
  * @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)
 		return 0;
 	else {
-		int result;
+		int32 result;
 		char server_name[20];
 		char message[256];
 		uint32 server_ip;
@@ -460,7 +460,7 @@ static int logclif_parse_reqcharconnec(int fd, struct login_session_data *sd, ch
 	return 1;
 }
 
-static void logclif_otp_result( int fd ){
+static void logclif_otp_result( int32 fd ){
 	PACKET_TC_RESULT p = {};
 
 	p.packetType = HEADER_TC_RESULT;
@@ -472,7 +472,7 @@ static void logclif_otp_result( int fd ){
 	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 );
 
 	logclif_otp_result( fd );
@@ -503,7 +503,7 @@ public:
  * @param fd: file descriptor to parse, (link to client)
  * @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;
 
 	char ip[16];

+ 3 - 1
src/login/loginclif.hpp

@@ -4,13 +4,15 @@
 #ifndef LOGINCLIF_HPP
 #define LOGINCLIF_HPP
 
+#include <common/cbasetypes.hpp>
+
 /**
  * Entry point from client to log-server.
  * Function that checks incoming command, then splits it to the correct handler.
  * @param fd: file descriptor to parse, (link to client)
  * @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.

+ 2 - 2
src/login/logincnslif.cpp

@@ -42,10 +42,10 @@ void display_helpscreen(bool do_exit) {
  * @param buf: buffer to parse, (from console)
  * @return 1=success
  */
-int cnslif_parse(const char* buf){
+int32 cnslif_parse(const char* buf){
 	char type[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, "%63[^\n]", type))<1) return -1; //nothing to do no arg

+ 3 - 1
src/login/logincnslif.hpp

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

+ 2 - 2
src/login/loginlog.cpp

@@ -60,10 +60,10 @@ unsigned long loginlog_failedattempts(uint32 ip, uint32 minutes) {
  * @param rcode:
  * @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_message[255*2+1];
-	int retcode;
+	int32 retcode;
 
 	if( !enabled )
 		return;

+ 1 - 1
src/login/loginlog.hpp

@@ -23,7 +23,7 @@ unsigned long loginlog_failedattempts(uint32 ip, uint32 minutes);
  * @param rcode:
  * @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.

+ 31 - 31
src/map/achievement.cpp

@@ -439,9 +439,9 @@ AchievementLevelDatabase achievement_level_db;
  * @param achievement_id: Achievement to add
  * @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);
 
@@ -485,10 +485,10 @@ struct achievement *achievement_add(map_session_data *sd, int achievement_id)
  * @param achievement_id: Achievement to remove
  * @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;
-	int i;
+	int32 i;
 
 	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
  * @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)
 			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
  * @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);
 
@@ -573,9 +573,9 @@ bool achievement_check_dependent(map_session_data *sd, int achievement_id)
  * @param sd: Achievement to compare for completed dependents
  * @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)
 		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
  * @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);
 
@@ -658,9 +658,9 @@ bool achievement_update_achievement(map_session_data *sd, int achievement_id, bo
  * @param sd: Player getting the reward
  * @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);
 
@@ -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 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);
 
@@ -741,7 +741,7 @@ void achievement_get_titles(uint32 char_id)
 		sd->titles.clear();
 
 		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 );
 
 				// 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
  * @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);
 
@@ -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
  * @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);
 
 	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)
 			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++ ){
 		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[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;
 
-	int value = 0;
+	int32 value = 0;
 
 	if( st != nullptr ){
 		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;
 	bool isNew = false, changed = false, complete = false;
 	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);
 	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( !hasCounter ){
 			// Check if it has a counter
-			for( int counter : current_count ){
+			for( int32 counter : current_count ){
 				if( counter != 0 ){
 					hasCounter = true;
 					break;
@@ -1097,7 +1097,7 @@ void achievement_update_objective(map_session_data *sd, enum e_achievement_group
 		std::array<int, MAX_ACHIEVEMENT_OBJECTIVES> 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);
 
 			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);
 
 		// 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);
 
 			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.
  * @see map_foreachinrange
  * @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;
-	int mob_id, party_id;
+	int32 mob_id, party_id;
 
 	nullpo_ret(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 {
-	int mob;
-	int count;
+	int32 mob;
+	int32 count;
 };
 
 struct s_achievement_db {
@@ -90,8 +90,8 @@ struct s_achievement_db {
 		ach_reward();
 		~ach_reward();
 	} 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();
@@ -134,18 +134,18 @@ public:
 
 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);
-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);
 void achievement_get_titles(uint32 char_id);
 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_db_reload(void);
 

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 127 - 127
src/map/atcommand.cpp


+ 5 - 5
src/map/atcommand.hpp

@@ -12,16 +12,16 @@ class map_session_data;
 //global var
 extern char atcommand_symbol;
 extern char charcommand_symbol;
-extern int atcmd_binding_count;
+extern int32 atcmd_binding_count;
 
 enum AtCommandType : uint8 {
 	COMMAND_ATCOMMAND = 1,
 	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_final_atcommand(void);
@@ -33,8 +33,8 @@ bool atcommand_exists(const char* name);
 struct atcmd_binding_data {
 	char command[50];
 	char npc_event[EVENT_NAME_LENGTH];
-	int level;
-	int level2;
+	int32 level;
+	int32 level2;
 };
 extern struct atcmd_binding_data** atcmd_binding;
 struct atcmd_binding_data* get_atcommandbind_byname(const char* name);

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 132 - 132
src/map/battle.cpp


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 615 - 615
src/map/battle.hpp


+ 25 - 25
src/map/battleground.cpp

@@ -31,7 +31,7 @@ using namespace rathena;
 BattlegroundDatabase battleground_db;
 std::unordered_map<int, std::shared_ptr<s_battleground_data>> bg_team_db;
 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() {
 	return std::string(db_path) + "/battleground_db.yml";
@@ -70,7 +70,7 @@ uint64 BattlegroundDatabase::parseBodyNode(const ryml::NodeRef& node) {
 	}
 
 	if (this->nodeExists(node, "MinPlayers")) {
-		int min;
+		int32 min;
 
 		if (!this->asInt32(node, "MinPlayers", min))
 			return 0;
@@ -92,7 +92,7 @@ uint64 BattlegroundDatabase::parseBodyNode(const ryml::NodeRef& node) {
 	}
 
 	if (this->nodeExists(node, "MaxPlayers")) {
-		int max;
+		int32 max;
 
 		if (!this->asInt32(node, "MaxPlayers", max))
 			return 0;
@@ -114,7 +114,7 @@ uint64 BattlegroundDatabase::parseBodyNode(const ryml::NodeRef& node) {
 	}
 
 	if (this->nodeExists(node, "MinLevel")) {
-		int min;
+		int32 min;
 
 		if (!this->asInt32(node, "MinLevel", min))
 			return 0;
@@ -131,7 +131,7 @@ uint64 BattlegroundDatabase::parseBodyNode(const ryml::NodeRef& node) {
 	}
 
 	if (this->nodeExists(node, "MaxLevel")) {
-		int max;
+		int32 max;
 
 		if (!this->asInt32(node, "MaxLevel", max))
 			return 0;
@@ -244,7 +244,7 @@ uint64 BattlegroundDatabase::parseBodyNode(const ryml::NodeRef& node) {
 	}
 
 	if (this->nodeExists(node, "Locations")) {
-		int count = 0;
+		int32 count = 0;
 
 		for (const auto& location : node["Locations"]) {
 			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
  * @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) {
 		if (queue_id == queue->queue_id)
@@ -456,7 +456,7 @@ map_session_data* bg_getavailablesd(s_battleground_data *bg)
  * @param bg_id: Battleground ID
  * @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);
 
@@ -482,7 +482,7 @@ bool bg_team_delete(int bg_id)
  * @param y: Y coordinate
  * @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);
 
@@ -516,7 +516,7 @@ void bg_send_dot_remove(map_session_data *sd)
  * @param is_queue: Joined from queue
  * @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)
 		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
  * @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)
 		return -1;
 
 	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);
 
 	sd->bg_id = 0;
@@ -652,9 +652,9 @@ bool bg_member_respawn(map_session_data *sd)
  * @param dev: Death NPC Event
  * @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())
 		bg_team_counter++;
@@ -679,7 +679,7 @@ int bg_create(uint16 mapindex, s_battleground_team* team)
  * @param bl: Object
  * @return Battleground ID
  */
-int bg_team_get_id(struct block_list *bl)
+int32 bg_team_get_id(struct block_list *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
  * @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;
 
@@ -780,7 +780,7 @@ TIMER_FUNC(bg_send_xy_timer)
  */
 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);
 
 	if (queue == nullptr) {
@@ -808,7 +808,7 @@ static TIMER_FUNC(bg_on_ready_loopback)
  */
 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);
 
 	if (queue == nullptr) {
@@ -841,7 +841,7 @@ static TIMER_FUNC(bg_on_ready_expire)
  */
 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);
 
 	if (queue == nullptr) {
@@ -1046,7 +1046,7 @@ void bg_queue_join_party(const char *name, map_session_data *sd)
 			return;
 		}
 
-		int p_online = 0;
+		int32 p_online = 0;
 
 		for (const auto &it : p->party.member) {
 			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.
 
-	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);
 
 	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;
 	}
 
-	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);
 
 	for (auto &pl_sd : queue->teamb_members) {
@@ -1547,8 +1547,8 @@ void bg_queue_start_battleground(std::shared_ptr<s_battleground_queue> queue)
 		return;
 
 	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) {
 		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
  * @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>();
 

+ 22 - 22
src/map/battleground.hpp

@@ -22,7 +22,7 @@ struct s_battleground_member_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
 	struct point cemetery; ///< Respawn point for players who die
 	std::string logout_event; ///< NPC Event to call on log out events
@@ -39,7 +39,7 @@ struct s_battleground_team {
 };
 
 struct s_battleground_map {
-	int id; ///< Battleground ID
+	int32 id; ///< Battleground ID
 	uint16 mapindex; ///< Index of the map
 	s_battleground_team team1, team2; ///< Team data
 	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]
 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 *> 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
-	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
 };
 
 struct s_battleground_type {
-	int id; ///< Battlegrounds database ID
+	int32 id; ///< Battlegrounds database ID
 	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
 	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)
@@ -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;
 
 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);
-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);
 
 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_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_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);

+ 15 - 15
src/map/buyingstore.cpp

@@ -24,7 +24,7 @@
 //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 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)
 #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
 * @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;
 	char message_sql[MESSAGE_SIZE*2];
 	StringBuf buf;
@@ -179,7 +179,7 @@ int8 buyingstore_create( map_session_data* sd, int zenylimit, unsigned char resu
 			break;
 		}
 
-		int idx = pc_search_inventory( sd, item->itemId );
+		int32 idx = pc_search_inventory( sd, item->itemId );
 
 		// At least one must be owned
 		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
 */
 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;
 	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;
 
 	// 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];
 
 		// 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
 			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 );
@@ -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
 		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;
 		}
 
-		int listidx;
+		int32 listidx;
 
 		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
-	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];
-		int listidx;
+		int32 listidx;
 
 		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;
 
-		int index = item->index - 2; // TODO: clif::server_index
+		int32 index = item->index - 2; // TODO: clif::server_index
 
 		// move item
 		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
-	int i;
+	int32 i;
 	ARR_FIND( 0, pl_sd->buyingstore.slots, i, pl_sd->buyingstore.items[i].amount != 0 );
 	if( i == pl_sd->buyingstore.slots )
 	{// 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->amount = it->amount;
 		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->refine = 0;
@@ -609,7 +609,7 @@ void buyingstore_reopen( map_session_data* sd ){
 		// Init buyingstore data for autotrader
 		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].amount = at->entries[j]->amount;
 			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
 * @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);
 	if (at)
 		buyingstore_autotrader_remove(at, false);

+ 4 - 4
src/map/buyingstore.hpp

@@ -15,7 +15,7 @@ class map_session_data;
 
 struct s_buyingstore_item
 {
-	int price;
+	int32 price;
 	unsigned short amount;
 	t_itemid nameid;
 };
@@ -23,7 +23,7 @@ struct s_buyingstore_item
 struct s_buyingstore
 {
 	struct s_buyingstore_item items[MAX_BUYINGSTORE_SLOTS];
-	int zenylimit;
+	int32 zenylimit;
 	unsigned char slots;
 };
 
@@ -41,7 +41,7 @@ struct s_autotrader {
 	uint32 id; ///< vendor/buyer id
 	uint32 account_id; ///< Account ID
 	uint32 char_id; ///< Char ID
-	int m; ///< Map location
+	int32 m; ///< Map location
 	uint16 x, ///< X location
 		y; ///< Y location
 	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_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_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);

+ 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;
 
 #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);
-	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);
 	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) ){
 		char* str[4];
 		char dummy[256] = "";
-		int i;
+		int32 i;
 
 		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 ){
 	struct sale_item_data* sale_item;
-	int i;
+	int32 i;
 
 	// Check if there is an entry for this item id
 	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 ){
-	int i;
+	int32 i;
 	struct sale_item_data* sale_item;
 	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 ){
-	int i;
+	int32 i;
 
 	for( i = 0; i < sale_items.count; i++ ){
 		if( sale_items.item[i]->timer_end != INVALID_TIMER ){
@@ -406,7 +406,7 @@ static void cashshop_read_db( void ){
 	cash_shop_db.load();
 
 #if PACKETVER_SUPPORTS_SALES
-	int i;
+	int32 i;
 	time_t now = time(nullptr);
 
 	sale_read_db_sql();
@@ -438,10 +438,10 @@ static void cashshop_read_db( void ){
  * @param item_list Array of item ID
  * @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 totalweight = 0;
-	int i,new_;
+	int32 i,new_;
 
 	if( sd == nullptr || item_list == nullptr ){
 		clif_cashshop_result( sd, 0, CASHSHOP_RESULT_ERROR_UNKNOWN );
@@ -640,7 +640,7 @@ void do_final_cashshop( void ){
 
 #if PACKETVER_SUPPORTS_SALES
 	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];
 
 			if( it->timer_start != INVALID_TIMER ){

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio