summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-23 01:51:17 +0000
committeramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-23 01:51:17 +0000
commit726dfead1497c0c01c9725ab0a83d1b339226498 (patch)
tree77b7a10baf9406503ab75eb2acfc9f1e12133fee
parent12a4dd862878f261de8863b81b1c5aecf4729d21 (diff)
downloadhercules-726dfead1497c0c01c9725ab0a83d1b339226498.tar.gz
hercules-726dfead1497c0c01c9725ab0a83d1b339226498.tar.bz2
hercules-726dfead1497c0c01c9725ab0a83d1b339226498.tar.xz
hercules-726dfead1497c0c01c9725ab0a83d1b339226498.zip
Rewrite inter server messaging
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@740 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog.txt10
-rw-r--r--src/char/int_guild.c6
-rw-r--r--src/char/int_party.c6
-rw-r--r--src/char/inter.c6
-rw-r--r--src/char_sql/int_guild.c6
-rw-r--r--src/char_sql/int_party.c6
-rw-r--r--src/char_sql/inter.c6
-rw-r--r--src/map/atcommand.c16
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/intif.c4
-rw-r--r--src/map/party.c1
11 files changed, 35 insertions, 34 deletions
diff --git a/Changelog.txt b/Changelog.txt
index 17c88f6f7..e7aca8df0 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,5 +1,15 @@
Date Added
12/22
+ * Rearranged how guild messages, gm messages, and party messages
+ are moved back and forth between the inter server and the
+ map server.. eliminating unneeded round trips to eliminate
+ lag on a loaded char-server. [MouseJstr]
+
+ src\char_sql\int_party.c src\char_sql\int_guild.c
+ src\char_sql\inter.c src\map\atcommand.c src\map\guild.c
+ src\map\intif.c src\map\party.c src\char\int_guild.c
+ src\char\inter.c src\char\int_party.c
+
* Reverted npc.c back to before jA 1081. This fixes warp portals missing and other npc bugs [Ajarn]
* Added conditional SHOW_DEBUG_MSG for displaying ShowDebug()'s output, it was missing before [MC Cameri]
* Added #zeny, removed @charzeny [MC Cameri]
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 5a6775cff..3229453f8 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -786,7 +786,7 @@ int mapif_guild_broken(int guild_id, int flag) {
}
// ギルド内発言
-int mapif_guild_message(int guild_id, int account_id, char *mes, int len) {
+int mapif_guild_message(int guild_id, int account_id, char *mes, int len, int sfd) {
unsigned char buf[len+12];
WBUFW(buf,0) = 0x3837;
@@ -794,7 +794,7 @@ int mapif_guild_message(int guild_id, int account_id, char *mes, int len) {
WBUFL(buf,4) = guild_id;
WBUFL(buf,8) = account_id;
memcpy(WBUFP(buf,12), mes, len);
- mapif_sendall(buf, len + 12);
+ mapif_sendallwos(sfd, buf, len + 12);
return 0;
}
@@ -1152,7 +1152,7 @@ int mapif_parse_BreakGuild(int fd, int guild_id) {
// ギルドメッセージ送信
int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, char *mes, int len) {
- return mapif_guild_message(guild_id, account_id, mes, len);
+ return mapif_guild_message(guild_id, account_id, mes, len, fd);
}
// ギルド基本データ変更要求
diff --git a/src/char/int_party.c b/src/char/int_party.c
index 0fd58fa14..194e96707 100644
--- a/src/char/int_party.c
+++ b/src/char/int_party.c
@@ -356,7 +356,7 @@ int mapif_party_broken(int party_id, int flag) {
}
// パーティ内発言
-int mapif_party_message(int party_id, int account_id, char *mes, int len) {
+int mapif_party_message(int party_id, int account_id, char *mes, int len, int sfd) {
unsigned char buf[len+12];
WBUFW(buf,0) = 0x3827;
@@ -364,7 +364,7 @@ int mapif_party_message(int party_id, int account_id, char *mes, int len) {
WBUFL(buf,4) = party_id;
WBUFL(buf,8) = account_id;
memcpy(WBUFP(buf,12), mes, len);
- mapif_sendall(buf,len + 12);
+ mapif_sendallwos(sfd, buf,len + 12);
return 0;
}
@@ -558,7 +558,7 @@ int mapif_parse_BreakParty(int fd, int party_id) {
// パーティメッセージ送信
int mapif_parse_PartyMessage(int fd, int party_id, int account_id, char *mes, int len) {
- return mapif_party_message(party_id, account_id, mes, len);
+ return mapif_party_message(party_id, account_id, mes, len, fd);
}
// パーティチェック要求
int mapif_parse_PartyCheck(int fd, int party_id, int account_id, char *nick) {
diff --git a/src/char/inter.c b/src/char/inter.c
index bf7bdcccf..a6e2a4199 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -272,13 +272,13 @@ int inter_mapif_init(int fd) {
// sended packets to map-server
// GMメッセージ送信
-int mapif_GMmessage(unsigned char *mes, int len) {
+int mapif_GMmessage(unsigned char *mes, int len, int sfd) {
unsigned char buf[len];
WBUFW(buf,0) = 0x3800;
WBUFW(buf,2) = len;
memcpy(WBUFP(buf,4), mes, len - 4);
- mapif_sendall(buf, len);
+ mapif_sendallwos(sfd, buf, len);
// printf("inter server: GM:%d %s\n", len, mes);
return 0;
@@ -383,7 +383,7 @@ int check_ttl_wisdata() {
// GMメッセージ送信
int mapif_parse_GMmessage(int fd) {
- mapif_GMmessage(RFIFOP(fd,4), RFIFOW(fd,2));
+ mapif_GMmessage(RFIFOP(fd,4), RFIFOW(fd,2), fd);
return 0;
}
diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c
index 744465625..df3ec4d81 100644
--- a/src/char_sql/int_guild.c
+++ b/src/char_sql/int_guild.c
@@ -902,7 +902,7 @@ int mapif_guild_broken(int guild_id,int flag)
}
// ギルド内発言
-int mapif_guild_message(int guild_id,int account_id,char *mes,int len)
+int mapif_guild_message(int guild_id,int account_id,char *mes,int len, int sfd)
{
unsigned char buf[512];
WBUFW(buf,0)=0x3837;
@@ -910,7 +910,7 @@ int mapif_guild_message(int guild_id,int account_id,char *mes,int len)
WBUFL(buf,4)=guild_id;
WBUFL(buf,8)=account_id;
memcpy(WBUFP(buf,12),mes,len);
- mapif_sendall(buf,len+12);
+ mapif_sendallwos(sfd, buf,len+12);
return 0;
}
@@ -1329,7 +1329,7 @@ int mapif_parse_BreakGuild(int fd,int guild_id)
// ギルドメッセージ送信
int mapif_parse_GuildMessage(int fd,int guild_id,int account_id,char *mes,int len)
{
- return mapif_guild_message(guild_id,account_id,mes,len);
+ return mapif_guild_message(guild_id,account_id,mes,len, fd);
}
// ギルド基本データ変更要求
int mapif_parse_GuildBasicInfoChange(int fd,int guild_id,
diff --git a/src/char_sql/int_party.c b/src/char_sql/int_party.c
index ddcc8bb8d..84cb49d6a 100644
--- a/src/char_sql/int_party.c
+++ b/src/char_sql/int_party.c
@@ -435,7 +435,7 @@ int mapif_party_broken(int party_id,int flag)
return 0;
}
// パーティ内発言
-int mapif_party_message(int party_id,int account_id,char *mes,int len)
+int mapif_party_message(int party_id,int account_id,char *mes,int len, int sfd)
{
unsigned char buf[512];
WBUFW(buf,0)=0x3827;
@@ -443,7 +443,7 @@ int mapif_party_message(int party_id,int account_id,char *mes,int len)
WBUFL(buf,4)=party_id;
WBUFL(buf,8)=account_id;
memcpy(WBUFP(buf,12),mes,len);
- mapif_sendall(buf,len+12);
+ mapif_sendallwos(sfd, buf,len+12);
return 0;
}
@@ -711,7 +711,7 @@ int mapif_parse_BreakParty(int fd,int party_id)
// パーティメッセージ送信
int mapif_parse_PartyMessage(int fd,int party_id,int account_id,char *mes,int len)
{
- return mapif_party_message(party_id,account_id,mes,len);
+ return mapif_party_message(party_id,account_id,mes,len, fd);
}
// パーティチェック要求
int mapif_parse_PartyCheck(int fd,int party_id,int account_id,char *nick)
diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c
index 7dc76e0f6..52a53f702 100644
--- a/src/char_sql/inter.c
+++ b/src/char_sql/inter.c
@@ -306,13 +306,13 @@ int inter_mapif_init(int fd) {
//--------------------------------------------------------
// GM message sending
-int mapif_GMmessage(unsigned char *mes, int len) {
+int mapif_GMmessage(unsigned char *mes, int len, int sfd) {
unsigned char buf[len];
WBUFW(buf, 0) = 0x3800;
WBUFW(buf, 2) = len;
memcpy(WBUFP(buf, 4), mes, len-4);
- mapif_sendall(buf, len);
+ mapif_sendallwos(sfd, buf, len);
printf("\033[1;34m inter server: GM[len:%d] - '%s' \033[0m\n", len, mes);
return 0;
}
@@ -414,7 +414,7 @@ int check_ttl_wisdata() {
// GM message sending
int mapif_parse_GMmessage(int fd)
{
- mapif_GMmessage(RFIFOP(fd, 4), RFIFOW(fd, 2));
+ mapif_GMmessage(RFIFOP(fd, 4), RFIFOW(fd, 2), fd);
return 0;
}
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index b530376a1..ea457ed47 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -136,11 +136,7 @@ ACMD_FUNC(agitend);
ACMD_FUNC(reloaditemdb);
ACMD_FUNC(reloadmobdb);
ACMD_FUNC(reloadskilldb);
-#ifndef TXT_ONLY
-ACMD_FUNC(rehash);// by Fr3DBr
-#else /* TXT_ONLY */
ACMD_FUNC(reloadscript);
-#endif /* TXT_ONLY */
ACMD_FUNC(reloadgmdb); // by Yor
ACMD_FUNC(mapexit);
ACMD_FUNC(idsearch);
@@ -369,11 +365,7 @@ static AtCommandInfo atcommand_info[] = {
{ AtCommand_ReloadItemDB, "@reloaditemdb", 99, atcommand_reloaditemdb }, // admin command
{ AtCommand_ReloadMobDB, "@reloadmobdb", 99, atcommand_reloadmobdb }, // admin command
{ AtCommand_ReloadSkillDB, "@reloadskilldb", 99, atcommand_reloadskilldb }, // admin command
-#ifndef TXT_ONLY
- { AtCommand_Rehash, "@rehash", 99, atcommand_rehash }, // admin command
-#else /* TXT_ONLY */
{ AtCommand_ReloadScript, "@reloadscript", 99, atcommand_reloadscript }, // admin command
-#endif /* TXT_ONLY */
{ AtCommand_ReloadGMDB, "@reloadgmdb", 99, atcommand_reloadgmdb }, // admin command
{ AtCommand_CharModel, "@charmodel", 50, atcommand_charmodel },
{ AtCommand_CharSKPoint, "@charskpoint", 60, atcommand_charskpoint },
@@ -812,7 +804,6 @@ static int atkillmonster_sub(struct block_list *bl, va_list ap) {
return 0;
}
-#ifndef TXT_ONLY
static int atkillnpc_sub(struct block_list *bl, va_list ap)
{
int flag = va_arg(ap,int);
@@ -842,7 +833,6 @@ void rehash( const int fd, struct map_session_data* sd )
}
}
-#endif /* not TXT_ONLY */
/*==========================================
* Read Message Data
*------------------------------------------
@@ -5590,23 +5580,17 @@ int atcommand_reloadskilldb(
*
*------------------------------------------
*/
-#ifndef TXT_ONLY
-int atcommand_rehash(
-#else /* TXT_ONLY */
int atcommand_reloadscript(
-#endif /* TXT_ONLY */
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
nullpo_retr(-1, sd);
-#ifndef TXT_ONLY
atcommand_broadcast( fd, sd, "@broadcast", "eAthena SQL Server is Rehashing..." );
atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
rehash( fd, sd );
atcommand_broadcast( fd, sd, "@broadcast", "Reloading NPCs..." );
-#endif /* not TXT_ONLY */
do_init_npc();
do_init_script();
diff --git a/src/map/guild.c b/src/map/guild.c
index 7d73692c9..7369757a7 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -802,6 +802,8 @@ int guild_send_message(struct map_session_data *sd,char *mes,int len)
if(sd->status.guild_id==0)
return 0;
intif_guild_message(sd->status.guild_id,sd->status.account_id,mes,len);
+ guild_recv_message(sd->status.guild_id,sd->status.account_id,mes,len);
+
return 0;
}
// ギルド会話受信
diff --git a/src/map/intif.c b/src/map/intif.c
index cf9d8ccee..fd79acc0c 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -130,6 +130,9 @@ int intif_GMmessage(char* mes,int len,int flag)
memcpy(WFIFOP(inter_fd,lp), mes, len);
WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
+ // Send to the local players
+ clif_GMmessage(NULL, mes, len, 0);
+
return 0;
}
@@ -482,6 +485,7 @@ int intif_guild_message(int guild_id,int account_id,char *mes,int len)
WFIFOL(inter_fd,8)=account_id;
memcpy(WFIFOP(inter_fd,12),mes,len);
WFIFOSET(inter_fd,len+12);
+
return 0;
}
// ギルド競合チェック要求
diff --git a/src/map/party.c b/src/map/party.c
index 1e5a3dbd1..075209f7e 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -481,6 +481,7 @@ int party_send_message(struct map_session_data *sd,char *mes,int len)
if(sd->status.party_id==0)
return 0;
intif_party_message(sd->status.party_id,sd->status.account_id,mes,len);
+ party_recv_message(sd->status.party_id,sd->status.account_id,mes,len);
return 0;
}