Browse Source

Character deletion fix

Fixed a problem where the client froze in a "Please wait" state because it got a packet it was not meant to get.
Also fixed wrong deletion times.

Fixes:
http://rathena.org/board/tracker/issue-8456-delete-character-delay-bug/
http://rathena.org/board/tracker/issue-8601-character-deletion-bug/
http://rathena.org/board/tracker/issue-8399-character-deletion-bug/

Minor follow up to 996ee3d:
Forgotten import, which got ignored by Visual Studio.
Lemongrass3110 11 years ago
parent
commit
27d270d641
2 changed files with 14 additions and 12 deletions
  1. 12 12
      src/char/char.c
  2. 2 0
      src/map/buyingstore.c

+ 12 - 12
src/char/char.c

@@ -1922,7 +1922,7 @@ int mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p)
 	offset += MAP_NAME_LENGTH_EXT;
 #endif
 #if PACKETVER >= 20100803
-#if PACKETVER > 201300000
+#if PACKETVER > 20130000
 	WBUFL(buf,124) = (p->delete_date?TOL(p->delete_date-time(NULL)):0);
 #else
 	WBUFL(buf,124) = TOL(p->delete_date);
@@ -4009,20 +4009,20 @@ void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date)
 /// Any (0x718): An unknown error has occurred.
 void char_delete2_accept_ack(int fd, int char_id, uint32 result)
 {// HC: <082a>.W <char id>.L <Msg:0-5>.L
-	 if(result == 1)
-	{
+	if(result == 1 ){
 		struct char_session_data* sd;
 		sd = (struct char_session_data*)session[fd]->session_data;
-		mmo_char_send(fd, sd);
-	}
-	else
-	{
-		WFIFOHEAD(fd,10);
-		WFIFOW(fd,0) = 0x82a;
-		WFIFOL(fd,2) = char_id;
-		WFIFOL(fd,6) = result;
-		WFIFOSET(fd,10);
+
+		if( sd->version >= date2version(20130000) ){
+			mmo_char_send(fd, sd);
+		}
 	}
+	
+	WFIFOHEAD(fd,10);
+	WFIFOW(fd,0) = 0x82a;
+	WFIFOL(fd,2) = char_id;
+	WFIFOL(fd,6) = result;
+	WFIFOSET(fd,10);
 }
 
 

+ 2 - 0
src/map/buyingstore.c

@@ -15,6 +15,8 @@
 #include "pc.h"  // struct map_session_data
 #include "chrif.h"
 
+#include <stdlib.h> // atoi
+
 /// Struct for buyingstore entry of autotrader
 struct s_autotrade_entry {
 	uint16 amount;