diff options
author | LuzZza <LuzZza@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-20 16:39:21 +0000 |
---|---|---|
committer | LuzZza <LuzZza@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-20 16:39:21 +0000 |
commit | c8c69e4d07918f4936ff380b06cecd988f7e5444 (patch) | |
tree | f977a3d5bedfab848013d3b91d81e7ac5a85cd47 /src/map | |
parent | 1765cd3f72d20ce81c8b21115242028775a0497e (diff) | |
download | hercules-c8c69e4d07918f4936ff380b06cecd988f7e5444.tar.gz hercules-c8c69e4d07918f4936ff380b06cecd988f7e5444.tar.bz2 hercules-c8c69e4d07918f4936ff380b06cecd988f7e5444.tar.xz hercules-c8c69e4d07918f4936ff380b06cecd988f7e5444.zip |
Cleaned up some guild functions:
-Now guild leaving/explusion packets sends correctly.
-Fix to prevent creation alliance/opposition with same guilds.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5684 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/guild.c | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/src/map/guild.c b/src/map/guild.c index 792cb821b..9158c876d 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -813,55 +813,58 @@ int guild_explusion(struct map_session_data *sd,int guild_id, if( g->member[i].account_id==account_id &&
g->member[i].char_id==char_id ){
intif_guild_leave(g->guild_id,account_id,char_id,1,mes);
- memset(&g->member[i],0,sizeof(struct guild_member));
+ //It's wrong way, member info will erased later
+ //see guild_member_leaved [LuzZza]
+ //memset(&g->member[i],0,sizeof(struct guild_member));
return 0;
}
}
return 0;
}
-// ギルドメンバが脱退した
+
int guild_member_leaved(int guild_id,int account_id,int char_id,int flag,
- const char *name,const char *mes)
+ const char *name,const char *mes) // rewrote [LuzZza]
{
- struct map_session_data *sd=map_charid2sd(char_id);
- struct guild *g=guild_search(guild_id);
+ 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;
- if(g!=NULL){
- int i;
- for(i=0;i<g->max_member;i++) {
- if( g->member[i].account_id==account_id &&
- g->member[i].char_id==char_id ){
- struct map_session_data *sd2=sd;
- if(sd2==NULL)
- sd2=guild_getavailablesd(g);
+ if(g == NULL)
+ 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 ){
+
+ if((online_member_sd = guild_getavailablesd(g)) == NULL)
+ return 0;
+
+ if(!flag)
+ clif_guild_leave(online_member_sd, name, mes);
else
- {
- if(flag==0)
- clif_guild_leave(sd2,name,mes);
- else
- clif_guild_explusion(sd2,name,mes,account_id);
- }
+ clif_guild_explusion(online_member_sd, name, mes, account_id);
+
memset(&g->member[i],0,sizeof(struct guild_member));
- }
- // メンバーリストを全員に再通知
- for(i=0;i<g->max_member;i++){
- if( g->member[i].sd!=NULL )
- clif_guild_memberlist(g->member[i].sd);
- }
- }
- }
- if(sd!=NULL) {
- if (sd->status.guild_id==guild_id){
- 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]
+ clif_guild_memberlist(online_member_sd);
+
+ if(sd != NULL && sd->status.guild_id == guild_id) {
+
+ 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;
}
+
}
-
+
return 0;
}
+
// ギルドメンバのオンライン状態/Lv更新送信
int guild_send_memberinfoshort(struct map_session_data *sd,int online)
{
@@ -1269,6 +1272,10 @@ int guild_reqalliance(struct map_session_data *sd,int account_id) if(g[0]==NULL || g[1]==NULL)
return 0;
+ // Prevent creation alliance with same guilds [LuzZza]
+ if(sd->status.guild_id == tsd->status.guild_id)
+ return 0;
+
if( guild_get_alliance_count(g[0],0)>=3 ) // 同盟数確認
clif_guild_allianceack(sd,4);
if( guild_get_alliance_count(g[1],0)>=3 )
@@ -1374,6 +1381,10 @@ int guild_opposition(struct map_session_data *sd,int char_id) if(g==NULL || tsd==NULL)
return 0;
+ // Prevent creation opposition with same guilds [LuzZza]
+ if(sd->status.guild_id == tsd->status.guild_id)
+ return 0;
+
if( guild_get_alliance_count(g,1)>=3 ) // 敵対数確認
clif_guild_oppositionack(sd,1);
|