浏览代码

another cool multi-map-server ancient bugfix:
- added a 'changing_mapservers' state, so the map server receiving the player knows he doesn't have to do certain things, in this case not display motd and use the aurafix.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15445 54d463be-8e91-2dee-dedb-b68131a5f0ec

shennetsind 13 年之前
父节点
当前提交
68589fc68e
共有 4 个文件被更改,包括 27 次插入20 次删除
  1. 5 2
      src/char_sql/char.c
  2. 5 4
      src/map/chrif.c
  3. 16 13
      src/map/pc.c
  4. 1 1
      src/map/pc.h

+ 5 - 2
src/char_sql/char.c

@@ -177,6 +177,7 @@ struct auth_node {
 	int sex;
 	time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
 	int gmlevel;
+	unsigned changing_mapservers : 1;
 };
 
 static DBMap* auth_db; // int account_id -> struct auth_node*
@@ -2767,6 +2768,7 @@ int parse_frommap(int fd)
 				node->expiration_time = 0; // FIXME (this thing isn't really supported we could as well purge it instead of fixing)
 				node->ip = ntohl(RFIFOL(fd,31));
 				node->gmlevel = RFIFOL(fd,35);
+				node->changing_mapservers = 1;
 				idb_put(auth_db, RFIFOL(fd,2), node);
 
 				data = (struct online_char_data*)idb_ensure(online_char_db, RFIFOL(fd,2), create_online_char_data);
@@ -3121,13 +3123,14 @@ int parse_frommap(int fd)
 
 				WFIFOHEAD(fd,24 + sizeof(struct mmo_charstatus));
 				WFIFOW(fd,0) = 0x2afd;
-				WFIFOW(fd,2) = 24 + sizeof(struct mmo_charstatus);
+				WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus);
 				WFIFOL(fd,4) = account_id;
 				WFIFOL(fd,8) = node->login_id1;
 				WFIFOL(fd,12) = node->login_id2;
 				WFIFOL(fd,16) = (uint32)node->expiration_time; // FIXME: will wrap to negative after "19-Jan-2038, 03:14:07 AM GMT"
 				WFIFOL(fd,20) = node->gmlevel;
-				memcpy(WFIFOP(fd,24), cd, sizeof(struct mmo_charstatus));
+				WFIFOB(fd,24) = node->changing_mapservers;
+				memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus));
 				WFIFOSET(fd, WFIFOW(fd,2));
 
 				// only use the auth once and mark user online

+ 5 - 4
src/map/chrif.c

@@ -587,10 +587,11 @@ void chrif_authok(int fd)
 	struct mmo_charstatus* status;
 	int char_id;
 	struct auth_node *node;
+	bool changing_mapservers;
 	TBL_PC* sd;
 
 	//Check if both servers agree on the struct's size
-	if( RFIFOW(fd,2) - 24 != sizeof(struct mmo_charstatus) )
+	if( RFIFOW(fd,2) - 25 != sizeof(struct mmo_charstatus) )
 	{
 		ShowError("chrif_authok: Data size mismatch! %d != %d\n", RFIFOW(fd,2) - 24, sizeof(struct mmo_charstatus));
 		return;
@@ -601,8 +602,8 @@ void chrif_authok(int fd)
 	login_id2 = RFIFOL(fd,12);
 	expiration_time = (time_t)(int32)RFIFOL(fd,16);
 	gmlevel = RFIFOL(fd,20);
-	status = (struct mmo_charstatus*)RFIFOP(fd,24);
-
+	changing_mapservers = (RFIFOB(fd,24));
+	status = (struct mmo_charstatus*)RFIFOP(fd,25);
 	char_id = status->char_id;
 
 	//Check if we don't already have player data in our server
@@ -633,7 +634,7 @@ void chrif_authok(int fd)
 		node->char_id == char_id &&
 		node->login_id1 == login_id1 )
 	{ //Auth Ok
-		if (pc_authok(sd, login_id2, expiration_time, gmlevel, status))
+		if (pc_authok(sd, login_id2, expiration_time, gmlevel, status, changing_mapservers))
 			return;
 	} else { //Auth Failed
 		pc_authfail(sd);

+ 16 - 13
src/map/pc.c

@@ -884,7 +884,7 @@ int pc_isequip(struct map_session_data *sd,int n)
  * session idに問題無し
  * char鯖から送られてきたステ?タスを設定
  *------------------------------------------*/
-bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int gmlevel, struct mmo_charstatus *st)
+bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int gmlevel, struct mmo_charstatus *st, bool changing_mapservers)
 {
 	int i;
 	unsigned long tick = gettick();
@@ -1031,18 +1031,20 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
 	// Send friends list
 	clif_friendslist_send(sd);
 
-	if (battle_config.display_version == 1){
-		char buf[256];
-		sprintf(buf, "SVN version: %s", get_svn_revision());
-		clif_displaymessage(sd->fd, buf);
-	}
+	if( !changing_mapservers ) {
+		if (battle_config.display_version == 1){
+			char buf[256];
+			sprintf(buf, "SVN version: %s", get_svn_revision());
+			clif_displaymessage(sd->fd, buf);
+		}
 
-	// Message of the Day [Valaris]
-	for(i=0; motd_text[i][0] && i < MOTD_LINE_SIZE; i++) {
-		if (battle_config.motd_type)
-			clif_disp_onlyself(sd,motd_text[i],strlen(motd_text[i]));
-		else
-			clif_displaymessage(sd->fd, motd_text[i]);
+		// Message of the Day [Valaris]
+		for(i=0; motd_text[i][0] && i < MOTD_LINE_SIZE; i++) {
+			if (battle_config.motd_type)
+				clif_disp_onlyself(sd,motd_text[i],strlen(motd_text[i]));
+			else
+				clif_displaymessage(sd->fd, motd_text[i]);
+		}
 	}
 
 	// message of the limited time of the account
@@ -1067,7 +1069,8 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
 	/**
 	 * Fixes login-without-aura glitch (the screen won't blink at this point, don't worry :P)
 	 **/
-	clif_changemap(sd,sd->mapindex,sd->bl.x,sd->bl.y);
+	if( !changing_mapservers )
+		clif_changemap(sd,sd->mapindex,sd->bl.x,sd->bl.y);
 
 	// Request all registries (auth is considered completed whence they arrive)
 	intif_request_registry(sd,7);

+ 1 - 1
src/map/pc.h

@@ -615,7 +615,7 @@ int pc_setrestartvalue(struct map_session_data *sd,int type);
 int pc_makesavestatus(struct map_session_data *);
 void pc_respawn(struct map_session_data* sd, clr_type clrtype);
 int pc_setnewpc(struct map_session_data*,int,int,int,unsigned int,int,int);
-bool pc_authok(struct map_session_data* sd, int, time_t, int gmlevel, struct mmo_charstatus* status);
+bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int gmlevel, struct mmo_charstatus *st, bool changing_mapservers);
 void pc_authfail(struct map_session_data *);
 int pc_reg_received(struct map_session_data *sd);