summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-11 09:31:32 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-11 09:31:32 +0000
commit044ca381f50daa43b09fad43c9a671c276fc2f2f (patch)
tree77a59efa67e8a5c4375f8f8a1165fe3e37beb5bb /src
parent222c9602a0802e12810af0bdbc09a186154f8b96 (diff)
downloadhercules-044ca381f50daa43b09fad43c9a671c276fc2f2f.tar.gz
hercules-044ca381f50daa43b09fad43c9a671c276fc2f2f.tar.bz2
hercules-044ca381f50daa43b09fad43c9a671c276fc2f2f.tar.xz
hercules-044ca381f50daa43b09fad43c9a671c276fc2f2f.zip
The max_account_id packetver detection mechanism will never cause any connection problems ever again. (bugreport:388)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12563 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c19
-rw-r--r--src/char/inter.c11
-rw-r--r--src/char/inter.h1
-rw-r--r--src/char_sql/char.c14
-rw-r--r--src/char_sql/inter.c11
-rw-r--r--src/char_sql/inter.h1
-rw-r--r--src/common/mmo.h8
-rw-r--r--src/map/chrif.c5
-rw-r--r--src/map/clif.c18
-rw-r--r--src/map/clif.h1
10 files changed, 5 insertions, 84 deletions
diff --git a/src/char/char.c b/src/char/char.c
index ccf19cad9..13da079ab 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -147,9 +147,6 @@ int online_display_option = 1; // display options: to know which columns must be
int online_refresh_html = 20; // refresh time (in sec) of the html file in the explorer
int online_gm_display_min_level = 20; // minimum GM level to display 'GM' when we want to display it
-//These are used to aid the map server in identifying valid clients. [Skotlex]
-static int max_account_id = DEFAULT_MAX_ACCOUNT_ID, max_char_id = DEFAULT_MAX_CHAR_ID;
-
int console = 0;
//-----------------------------------------------------
@@ -200,17 +197,6 @@ void set_char_online(int map_id, int char_id, int account_id)
{
struct online_char_data* character;
- if ( char_id != 99 ) {
- if (max_account_id < account_id || max_char_id < char_id)
- { //Notify map-server of the new max IDs [Skotlex]
- if (account_id > max_account_id)
- max_account_id = account_id;
- if (char_id > max_char_id)
- max_char_id = char_id;
- mapif_send_maxid(max_account_id, max_char_id);
- }
- }
-
character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data);
if (online_check && character->char_id != -1 && character->server > -1 && character->server != map_id && map_id != -3)
{
@@ -2668,9 +2654,6 @@ int parse_frommap(int fd)
char_log("Map-Server %d connected: %d maps, from IP %d.%d.%d.%d port %d. Map-server %d loading complete.\n",
id, j, CONVIP(server[id].ip), server[id].port, id);
- if (max_account_id != DEFAULT_MAX_ACCOUNT_ID || max_char_id != DEFAULT_MAX_CHAR_ID)
- mapif_send_maxid(max_account_id, max_char_id); //Send the current max ids to the server to keep in sync [Skotlex]
-
// send name for wisp to player
WFIFOHEAD(fd, 3 + NAME_LENGTH);
WFIFOW(fd,0) = 0x2afb;
@@ -3436,8 +3419,6 @@ int parse_char(int fd)
node->expiration_time = sd->expiration_time;
node->ip = ipl;
idb_put(auth_db, sd->account_id, node);
-
- set_char_online(i, cd->char_id, cd->account_id);
}
break;
diff --git a/src/char/inter.c b/src/char/inter.c
index 6c4b1e3e2..c987ce8f2 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -294,17 +294,6 @@ int inter_mapif_init(int fd) {
//--------------------------------------------------------
// sended packets to map-server
-//Sends the current max account/char id to map server [Skotlex]
-void mapif_send_maxid(int account_id, int char_id)
-{
- unsigned char buf[12];
-
- WBUFW(buf,0) = 0x2b07;
- WBUFL(buf,2) = account_id;
- WBUFL(buf,6) = char_id;
- mapif_sendall(buf, 10);
-}
-
// GMメッセージ送信
int mapif_GMmessage(unsigned char *mes, int len, unsigned long color, int sfd) {
unsigned char buf[2048];
diff --git a/src/char/inter.h b/src/char/inter.h
index c9843965e..4752f600c 100644
--- a/src/char/inter.h
+++ b/src/char/inter.h
@@ -11,7 +11,6 @@ void inter_final(void);
int inter_save(void);
int inter_parse_frommap(int fd);
int inter_mapif_init(int fd);
-void mapif_send_maxid(int, int);
int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason);
int inter_check_length(int fd,int length);
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index ee602d9d9..d15888b5d 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -117,8 +117,6 @@ int save_log = 0; //Have the logs be off by default when converting
int save_log = 1;
#endif
-//These are used to aid the map server in identifying valid clients. [Skotlex]
-static int max_account_id = DEFAULT_MAX_ACCOUNT_ID, max_char_id = DEFAULT_MAX_CHAR_ID;
static int online_check = 1; //If one, it won't let players connect when their account is already registered online and will send the relevant map server a kick user request. [Skotlex]
// Advanced subnet check [LuzZza]
@@ -221,15 +219,6 @@ void set_char_online(int map_id, int char_id, int account_id)
if ( char_id != 99 ) {
if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d'", char_db, char_id) )
Sql_ShowDebug(sql_handle);
-
- if (max_account_id < account_id || max_char_id < char_id)
- { //Notify map-server of the new max IDs [Skotlex]
- if (account_id > max_account_id)
- max_account_id = account_id;
- if (char_id > max_char_id)
- max_char_id = char_id;
- mapif_send_maxid(max_account_id, max_char_id);
- }
}
character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data);
@@ -2318,9 +2307,6 @@ int parse_frommap(int fd)
id, j, CONVIP(server[id].ip), server[id].port);
ShowStatus("Map-server %d loading complete.\n", id);
- if (max_account_id != DEFAULT_MAX_ACCOUNT_ID || max_char_id != DEFAULT_MAX_CHAR_ID)
- mapif_send_maxid(max_account_id, max_char_id); //Send the current max ids to the server to keep in sync [Skotlex]
-
// send name for wisp to player
WFIFOHEAD(fd, 3 + NAME_LENGTH);
WFIFOW(fd,0) = 0x2afb;
diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c
index 00c29568b..72c88a3f2 100644
--- a/src/char_sql/inter.c
+++ b/src/char_sql/inter.c
@@ -552,17 +552,6 @@ int mapif_send_gmaccounts()
return 0;
}
-//Sends the current max account/char id to map server [Skotlex]
-void mapif_send_maxid(int account_id, int char_id)
-{
- unsigned char buf[12];
-
- WBUFW(buf,0) = 0x2b07;
- WBUFL(buf,2) = account_id;
- WBUFL(buf,6) = char_id;
- mapif_sendall(buf, 10);
-}
-
//Request to kick char from a certain map server. [Skotlex]
int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason)
{
diff --git a/src/char_sql/inter.h b/src/char_sql/inter.h
index c79290c80..a44ce77e1 100644
--- a/src/char_sql/inter.h
+++ b/src/char_sql/inter.h
@@ -12,7 +12,6 @@ void inter_final(void);
int inter_parse_frommap(int fd);
int inter_mapif_init(int fd);
int mapif_send_gmaccounts(void);
-void mapif_send_maxid(int, int);
int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason);
int inter_check_length(int fd,int length);
diff --git a/src/common/mmo.h b/src/common/mmo.h
index a1147d783..b3e5f6e48 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -86,17 +86,11 @@
//Size of the fame list arrays.
#define MAX_FAME_LIST 10
-//These max values can be exceeded and the char/map servers will update them with no problems
-//These are just meant to minimize the updating needed between char/map servers as players login.
-//Room for initial 10K accounts
-#define DEFAULT_MAX_ACCOUNT_ID 2010000
+//Limits to avoid ID collision with other game objects
#define START_ACCOUNT_NUM 2000000
#define END_ACCOUNT_NUM 100000000
-//Room for initial 100k characters
-#define DEFAULT_MAX_CHAR_ID 250000
-
//Base Homun skill.
#define HM_SKILLBASE 8001
#define MAX_HOMUNSKILL 16
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 18c648627..c4fe9dd67 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -33,7 +33,7 @@ static DBMap* auth_db; // int id -> struct auth_node*
static const int packet_len_table[0x3d] = { // U - used, F - free
60, 3,-1,27,10,-1, 6,-1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff
- 6,-1,18, 7,-1,35,30,10, // 2b00-2b07: U->2b00, U->2b01, U->2b02, U->2b03, U->2b04, U->2b05, U->2b06, U->2b07
+ 6,-1,18, 7,-1,35,30,-1, // 2b00-2b07: U->2b00, U->2b01, U->2b02, U->2b03, U->2b04, U->2b05, U->2b06, F->2b07
6,30,-1,-1,86, 7,44,34, // 2b08-2b0f: U->2b08, U->2b09, F->2b0a, F->2b0b, U->2b0c, U->2b0d, U->2b0e, U->2b0f
11,10,10, 6,11,-1,266,10, // 2b10-2b17: U->2b10, U->2b11, U->2b12, U->2b13, U->2b14, U->2b15, U->2b16, U->2b17
2,10, 2,-1,-1,-1, 2, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, U->2b1e, U->2b1f
@@ -56,7 +56,7 @@ static const int packet_len_table[0x3d] = { // U - used, F - free
//2b04: Incoming, chrif_recvmap -> 'getting maps from charserver of other mapserver's'
//2b05: Outgoing, chrif_changemapserver -> 'Tell the charserver the mapchange / quest for ok...'
//2b06: Incoming, chrif_changemapserverack -> 'awnser of 2b05, ok/fail, data: dunno^^'
-//2b07: Incoming, clif_updatemaxid -> Received when updating the max account/char known
+//2b07: FREE
//2b08: Outgoing, chrif_searchcharid -> '...'
//2b09: Incoming, map_addchariddb -> 'Adds a name to the nick db'
//2b0a: FREE
@@ -1427,7 +1427,6 @@ int chrif_parse(int fd)
case 0x2b03: clif_charselectok(RFIFOL(fd,2)); break;
case 0x2b04: chrif_recvmap(fd); break;
case 0x2b06: chrif_changemapserverack(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), RFIFOW(fd,18), RFIFOW(fd,20), RFIFOW(fd,22), RFIFOL(fd,24), RFIFOW(fd,28)); break;
- case 0x2b07: clif_updatemaxid(RFIFOL(fd,2), RFIFOL(fd,6)); break;
case 0x2b09: map_addnickdb(RFIFOL(fd,2), (char*)RFIFOP(fd,6)); break;
case 0x2b0d: chrif_changedsex(fd); break;
case 0x2b0f: chrif_char_ask_name_answer(RFIFOL(fd,2), (char*)RFIFOP(fd,6), RFIFOW(fd,30), RFIFOW(fd,32)); break;
diff --git a/src/map/clif.c b/src/map/clif.c
index 01417b2dd..ea2a10b4c 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -92,11 +92,6 @@ static uint32 bind_ip = INADDR_ANY;
static uint16 map_port = 5121;
int map_fd;
-//These two will be used to verify the incoming player's validity.
-//It helps identify their client packet version correctly. [Skotlex]
-static int max_account_id = DEFAULT_MAX_ACCOUNT_ID;
-static int max_char_id = DEFAULT_MAX_CHAR_ID;
-
int clif_parse (int fd);
/*==========================================
@@ -541,15 +536,6 @@ int clif_authfail_fd(int fd, int type)
}
/*==========================================
- * Used to know which is the max valid account/char id [Skotlex]
- *------------------------------------------*/
-void clif_updatemaxid(int account_id, int char_id)
-{
- max_account_id = account_id;
- max_char_id = char_id;
-}
-
-/*==========================================
*
*------------------------------------------*/
int clif_charselectok(int id)
@@ -7617,9 +7603,9 @@ static int clif_guess_PacketVer(int fd, int get_previous, int *error)
#define CHECK_PACKET_VER() \
if( cmd != clif_config.connect_cmd[packet_ver] || packet_len != packet_db[packet_ver][cmd].len )\
;/* not wanttoconnection or wrong length */\
- else if( (value=(int)RFIFOL(fd, packet_db[packet_ver][cmd].pos[0])) < START_ACCOUNT_NUM || value > max_account_id )\
+ else if( (value=(int)RFIFOL(fd, packet_db[packet_ver][cmd].pos[0])) < START_ACCOUNT_NUM || value > END_ACCOUNT_NUM )\
{ SET_ERROR(2); }/* invalid account_id */\
- else if( (value=(int)RFIFOL(fd, packet_db[packet_ver][cmd].pos[1])) <= 0 || value > max_char_id )\
+ else if( (value=(int)RFIFOL(fd, packet_db[packet_ver][cmd].pos[1])) <= 0 )\
{ SET_ERROR(3); }/* invalid char_id */\
/* RFIFOL(fd, packet_db[packet_ver][cmd].pos[2]) - don't care about login_id1 */\
/* RFIFOL(fd, packet_db[packet_ver][cmd].pos[3]) - don't care about client_tick */\
diff --git a/src/map/clif.h b/src/map/clif.h
index 832829a04..8516b05f8 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -96,7 +96,6 @@ uint16 clif_getport(void);
int clif_authok(struct map_session_data *);
int clif_authfail_fd(int fd,int type);
-void clif_updatemaxid(int, int);
int clif_charselectok(int);
int clif_dropflooritem(struct flooritem_data *);
int clif_clearflooritem(struct flooritem_data *,int);