From 52668d1fc192488ad768d9a855f92ccc2a72837e Mon Sep 17 00:00:00 2001 From: celest Date: Wed, 30 Mar 2005 17:47:54 +0000 Subject: [PATCH] * Fixed @reloadgmdb in SQL git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1344 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-SVN.txt | 2 ++ src/char_sql/char.c | 15 +++------------ src/char_sql/char.h | 2 ++ src/char_sql/inter.c | 21 +++++++++++++++++++++ src/char_sql/inter.h | 1 + 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index 28da82c4b1..6de6a0c76a 100644 --- a/Changelog-SVN.txt +++ b/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 diff --git a/src/char_sql/char.c b/src/char_sql/char.c index f8f083e85b..673065fe59 100644 --- a/src/char_sql/char.c +++ b/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); diff --git a/src/char_sql/char.h b/src/char_sql/char.h index ddd8733742..6ade96c36d 100644 --- a/src/char_sql/char.h +++ b/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); diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c index 1a2a2d751f..83fcc967fe 100644 --- a/src/char_sql/inter.c +++ b/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 diff --git a/src/char_sql/inter.h b/src/char_sql/inter.h index 1e6a26dced..9265a8d82c 100644 --- a/src/char_sql/inter.h +++ b/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);