diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-05-26 13:01:10 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-05-26 13:01:10 +0000 |
commit | 2ea1a0100b05dcf1f8001159485c57c76e4a5ae6 (patch) | |
tree | b5e2155521f5b1487ad536d543e403862f7b6c4b /src/map/guild.c | |
parent | 54385260051f2b09138aed6c57b1f889ce766c7a (diff) | |
download | hercules-2ea1a0100b05dcf1f8001159485c57c76e4a5ae6.tar.gz hercules-2ea1a0100b05dcf1f8001159485c57c76e4a5ae6.tar.bz2 hercules-2ea1a0100b05dcf1f8001159485c57c76e4a5ae6.tar.xz hercules-2ea1a0100b05dcf1f8001159485c57c76e4a5ae6.zip |
- Fixed guild emblem not showing when you log in (caused by r5359)
- Fixed server not sending party/guild info when you enter a map
- Fixed server not removing member minimap dot when you leave a guild
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10624 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/guild.c')
-rw-r--r-- | src/map/guild.c | 90 |
1 files changed, 48 insertions, 42 deletions
diff --git a/src/map/guild.c b/src/map/guild.c index c6dbe7515..57582b470 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -715,10 +715,10 @@ int guild_reply_invite(struct map_session_data *sd,int guild_id,int flag) return 0; } - //interIΦΗΑv guild_makemember(&m,sd); intif_guild_addmember( sd->guild_invite, &m ); + //TODO: send a minimap update to this player return 0; }else{ // Ϋ sd->guild_invite=0; @@ -756,8 +756,10 @@ int guild_member_added(int guild_id,int account_id,int char_id,int flag) } // ¬χ - sd->state.guild_sent=0; - sd->status.guild_id=guild_id; + sd->state.guild_sent = 0; + sd->status.guild_id = g->guild_id; + sd->guild_emblem_id = g->emblem_id; + //TODO: send new emblem info to others if( sd2!=NULL ) clif_guild_inviteack(sd2,2); @@ -770,8 +772,7 @@ int guild_member_added(int guild_id,int account_id,int char_id,int flag) } // MhEήv -int guild_leave(struct map_session_data *sd,int guild_id, - int account_id,int char_id,const char *mes) +int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes) { struct guild *g; @@ -790,9 +791,9 @@ int guild_leave(struct map_session_data *sd,int guild_id, intif_guild_leave(sd->status.guild_id, sd->status.account_id, sd->status.char_id,0,mes); return 0; } + // MhΗϊv -int guild_expulsion(struct map_session_data *sd,int guild_id, - int account_id,int char_id,const char *mes) +int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes) { struct map_session_data *tsd; struct guild *g; @@ -829,47 +830,51 @@ int guild_expulsion(struct map_session_data *sd,int guild_id, return 0; } -int guild_member_leaved(int guild_id,int account_id,int char_id,int flag, - const char *name,const char *mes) // rewrote [LuzZza] +int guild_member_leaved(int guild_id, int account_id, int char_id, int flag, const char* name, const char* mes) { int i; - struct guild *g = guild_search(guild_id); - struct map_session_data *sd = map_charid2sd(char_id); - struct map_session_data *online_member_sd; + struct guild* g = guild_search(guild_id); + struct map_session_data* sd = map_charid2sd(char_id); + struct map_session_data* online_member_sd; if(g == NULL) - return 0; + return 0; // no such guild (error!) - for(i=0;i<g->max_member;i++) { - if( g->member[i].account_id == account_id && - g->member[i].char_id == char_id ){ - - if((online_member_sd = guild_getavailablesd(g)) == NULL) - return 0; - - if(!flag) - clif_guild_leave(online_member_sd, name, mes); - else - clif_guild_expulsion(online_member_sd, name, mes, account_id); - - memset(&g->member[i],0,sizeof(struct guild_member)); - clif_guild_memberlist(online_member_sd); - - if(sd != NULL && sd->status.guild_id == guild_id) { - if (sd->state.storage_flag == 2) //Close the guild storage. - storage_guild_storageclose(sd); - sd->status.guild_id=0; - sd->guild_emblem_id=0; - sd->state.guild_sent=0; - - guild_send_dot_remove(sd); - clif_charnameupdate(sd); //Update display name [Skotlex] - } - return 0; - } - - } + for(i = 0; i < g->max_member; i++) + if( g->member[i].account_id == account_id && g->member[i].char_id == char_id ) + break; + + if (i == g->max_member) + return 0; // not a member (inconsistency!) + + online_member_sd = guild_getavailablesd(g); + if(online_member_sd == NULL) + return 0; // noone online to inform + + if(!flag) + clif_guild_leave(online_member_sd, name, mes); + else + clif_guild_expulsion(online_member_sd, name, mes, account_id); + + // remove member from guild + memset(&g->member[i],0,sizeof(struct guild_member)); + clif_guild_memberlist(online_member_sd); + // update char, if online + if(sd != NULL && sd->status.guild_id == guild_id) + { + // do stuff that needs the guild_id first, BEFORE we wipe it + if (sd->state.storage_flag == 2) //Close the guild storage. + storage_guild_storageclose(sd); + guild_send_dot_remove(sd); + + sd->status.guild_id = 0; + sd->guild_emblem_id = 0; + sd->state.guild_sent = 0; + + clif_charnameupdate(sd); //Update display name [Skotlex] + //TODO: send emblem update to self and people around + } return 0; } @@ -975,6 +980,7 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin continue; clif_guild_xy_single(g->member[idx].sd->fd, g->member[i].sd); + clif_guild_xy_single(g->member[i].sd->fd, g->member[idx].sd); } return 0; |