summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-05-29 19:24:42 +0200
committerHaru <haru@dotalux.com>2014-05-29 19:24:42 +0200
commita1df5eec5dc3c36838dbcf78128a83cf98a9b1ac (patch)
tree46eee6a2262848609f0420a53cf3055f4600d09f /src/map
parent407502abc921bb4cf06ff462ab6e2f23a327e950 (diff)
downloadhercules-a1df5eec5dc3c36838dbcf78128a83cf98a9b1ac.tar.gz
hercules-a1df5eec5dc3c36838dbcf78128a83cf98a9b1ac.tar.bz2
hercules-a1df5eec5dc3c36838dbcf78128a83cf98a9b1ac.tar.xz
hercules-a1df5eec5dc3c36838dbcf78128a83cf98a9b1ac.zip
Fixed a bug causing players to see unrelated guilds' #ally channels
- The issue would only happen if the #ally channel is on auto-join, when a guild is first loaded. - Follow-up to cd2f5e4a687b2abbdb9d795e5c91b874aa0d2546 - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/guild.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/map/guild.c b/src/map/guild.c
index 042a6e801..4bf9c9da0 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -487,21 +487,27 @@ int guild_recv_info(struct guild *sg) {
}
for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) {
- if( sd->status.guild_id ) {
- if( sd->status.guild_id == sg->guild_id ) {
- clif->chsys_join(channel,sd);
- sd->guild = g;
- }
-
+ if (!sd->status.guild_id)
+ continue; // Not interested in guildless users
+
+ if (sd->status.guild_id == sg->guild_id) {
+ // Guild member
+ clif->chsys_join(channel,sd);
+ sd->guild = g;
+
for (i = 0; i < MAX_GUILDALLIANCE; i++) {
- if( sg->alliance[i].opposition == 0 && sg->alliance[i].guild_id ) {
- if( sg->alliance[i].guild_id == sd->status.guild_id ) {
- clif->chsys_join(channel,sd);
- } else if( tg[i] != NULL ) {
- if( !(tg[i]->channel->banned && idb_exists(tg[i]->channel->banned, sd->status.account_id)))
- clif->chsys_join(tg[i]->channel,sd);
- }
- }
+ // Join channels from allied guilds
+ if (tg[i] && !(tg[i]->channel->banned && idb_exists(tg[i]->channel->banned, sd->status.account_id)))
+ clif->chsys_join(tg[i]->channel, sd);
+ }
+ continue;
+ }
+
+ for (i = 0; i < MAX_GUILDALLIANCE; i++) {
+ if (tg[i] && sd->status.guild_id == tg[i]->guild_id) { // Shortcut to skip the alliance checks again
+ // Alliance member
+ if( !(channel->banned && idb_exists(channel->banned, sd->status.account_id)))
+ clif->chsys_join(channel, sd);
}
}
}