Procházet zdrojové kódy

* Fixed @reloadgmdb in SQL

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1344 54d463be-8e91-2dee-dedb-b68131a5f0ec
celest před 20 roky
rodič
revize
52668d1fc1
5 změnil soubory, kde provedl 29 přidání a 12 odebrání
  1. 2 0
      Changelog-SVN.txt
  2. 3 12
      src/char_sql/char.c
  3. 2 0
      src/char_sql/char.h
  4. 21 0
      src/char_sql/inter.c
  5. 1 0
      src/char_sql/inter.h

+ 2 - 0
Changelog-SVN.txt

@@ -2,6 +2,8 @@
 Date	Added
 
 03/30
+	* Fixed @reloadgmdb in SQL -- after reloading ask the char to forward the new
+	  accounts back to the map [celest]
 	* Added base code for loading Ser's UPNP plugin [celest]
 	* Added 'idle_no_share' to battle_athena.conf [celest]
 	* updated map server to jA1137~1159

+ 3 - 12
src/char_sql/char.c

@@ -267,6 +267,7 @@ void read_gm_account(void) {
 	}
 
 	mysql_free_result(lsql_res);
+	mapif_send_gmaccounts();
 }
 
 // Insert friends list
@@ -1750,7 +1751,6 @@ int parse_tologin(int fd) {
 			if (RFIFOREST(fd) < 7)
 				return 0;
 			{
-				unsigned char buf[32000];
 				int new_level = 0;
 				for(i = 0; i < GM_num; i++)
 					if (gm_account[i].account_id == RFIFOL(fd,2)) {
@@ -1779,20 +1779,11 @@ int parse_tologin(int fd) {
 					}
 				}
 				if (new_level == 1) {
-					int len;
 					printf("From login-server: receiving a GM account information (%d: level %d).\n", RFIFOL(fd,2), (int)RFIFOB(fd,6));
+					mapif_send_gmaccounts();
+
 					//create_online_files(); // not change online file for only 1 player (in next timer, that will be done
 					// send gm acccounts level to map-servers
-					len = 4;
-					WBUFW(buf,0) = 0x2b15;
-				
-					for(i = 0; i < GM_num; i++) {
-						WBUFL(buf, len) = gm_account[i].account_id;
-						WBUFB(buf, len+4) = (unsigned char)gm_account[i].level;
-						len += 5;
-					}
-					WBUFW(buf, 2) = len;
-					mapif_sendall(buf, len);
 				}
 			}
 			RFIFOSKIP(fd,7);

+ 2 - 0
src/char_sql/char.h

@@ -76,6 +76,8 @@ extern char login_db_level[32];
 extern char login_db_account_id[32];
 
 extern int lowest_gm_level;
+extern int GM_num;
+extern struct gm_account *gm_account;
 
 extern int debug_mysql_query(char *file, int line, void *mysql, const char *q);
 

+ 21 - 0
src/char_sql/inter.c

@@ -395,6 +395,27 @@ int mapif_account_reg_reply(int fd,int account_id)
 	return 0;
 }
 
+int mapif_send_gmaccounts()
+{
+	int i, len = 4;
+	unsigned char buf[32000];
+
+	// forward the gm accounts to the map server
+	len = 4;
+	WBUFW(buf,0) = 0x2b15;
+				
+	for(i = 0; i < GM_num; i++) {
+		WBUFL(buf, len) = gm_account[i].account_id;
+		WBUFB(buf, len+4) = (unsigned char)gm_account[i].level;
+		len += 5;
+	}
+	WBUFW(buf, 2) = len;
+	mapif_sendall(buf, len);
+
+	return 0;
+}
+
+
 //--------------------------------------------------------
 
 // Existence check of WISP data

+ 1 - 0
src/char_sql/inter.h

@@ -5,6 +5,7 @@ int inter_init(const char *file);
 void inter_final();
 int inter_parse_frommap(int fd);
 int inter_mapif_init(int fd);
+int mapif_send_gmaccounts();
 
 int inter_check_length(int fd,int length);