summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-04-28 16:17:09 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-04-28 16:17:09 +0000
commitb6666e976aa42fa01aef323ceb87fed7603f2a9d (patch)
tree647b425d9fe7a36714a24573825efb25bb7f6fe8
parent6a4e61e18f15172c80b60c46133862a36b576bb0 (diff)
downloadhercules-b6666e976aa42fa01aef323ceb87fed7603f2a9d.tar.gz
hercules-b6666e976aa42fa01aef323ceb87fed7603f2a9d.tar.bz2
hercules-b6666e976aa42fa01aef323ceb87fed7603f2a9d.tar.xz
hercules-b6666e976aa42fa01aef323ceb87fed7603f2a9d.zip
* Code cleaning and reformatting in functions responsible for sending guild expel information packets (follow up to r14718 and r14804).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14805 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/clif.c49
-rw-r--r--src/map/clif.h2
2 files changed, 27 insertions, 24 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 7a2a00332..a1b617b83 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7013,7 +7013,7 @@ int clif_guild_leave(struct map_session_data *sd,const char *name,const char *me
/*==========================================
* ギルドメンバ追放通知
*------------------------------------------*/
-int clif_guild_expulsion(struct map_session_data *sd,const char *name,const char *mes,int account_id)
+void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id)
{
unsigned char buf[128];
#if PACKETVER < 20100803
@@ -7022,55 +7022,58 @@ int clif_guild_expulsion(struct map_session_data *sd,const char *name,const char
const unsigned short cmd = 0x839;
#endif
- nullpo_ret(sd);
+ nullpo_retv(sd);
WBUFW(buf,0) = cmd;
- safestrncpy((char*)WBUFP(buf, 2),name,NAME_LENGTH);
- safestrncpy((char*)WBUFP(buf,26),mes,40);
+ safestrncpy((char*)WBUFP(buf,2), name, NAME_LENGTH);
+ safestrncpy((char*)WBUFP(buf,26), mes, 40);
#if PACKETVER < 20100803
- safestrncpy((char*)WBUFP(buf,66),"",NAME_LENGTH); // account name (not used for security reasons)
+ memset(WBUFP(buf,66), 0, NAME_LENGTH); // account name (not used for security reasons)
#endif
- clif_send(buf,packet_len(cmd),&sd->bl,GUILD_NOBG);
- return 0;
+ clif_send(buf, packet_len(cmd), &sd->bl, GUILD_NOBG);
}
/*==========================================
* ギルド追放メンバリスト
*------------------------------------------*/
-int clif_guild_expulsionlist(struct map_session_data *sd)
+void clif_guild_expulsionlist(struct map_session_data* sd)
{
#if PACKETVER < 20100803
- const int offset = NAME_LENGTH+64;
+ const int offset = NAME_LENGTH*2+40;
#else
const int offset = NAME_LENGTH+40;
#endif
- int fd;
- int i,c;
- struct guild *g;
+ int fd, i, c = 0;
+ struct guild* g;
+
+ nullpo_retv(sd);
- nullpo_ret(sd);
if( (g = guild_search(sd->status.guild_id)) == NULL )
- return 0;
+ return;
fd = sd->fd;
+
WFIFOHEAD(fd,4 + MAX_GUILDEXPULSION * offset);
- WFIFOW(fd,0)=0x163;
- for(i=c=0;i<MAX_GUILDEXPULSION;i++){
- struct guild_expulsion *e=&g->expulsion[i];
- if(e->account_id>0){
- safestrncpy((char*)WFIFOP(fd,4 + c*offset),e->name,NAME_LENGTH);
+ WFIFOW(fd,0) = 0x163;
+
+ for( i = 0; i < MAX_GUILDEXPULSION; i++ )
+ {
+ struct guild_expulsion* e = &g->expulsion[i];
+
+ if( e->account_id > 0 )
+ {
+ memcpy(WFIFOP(fd,4 + c*offset), e->name, NAME_LENGTH);
#if PACKETVER < 20100803
- safestrncpy((char*)WFIFOP(fd,4 + c*offset+24),"",24); // account name (not used for security reasons)
- safestrncpy((char*)WFIFOP(fd,4 + c*offset+48),e->mes,40);
+ memset(WFIFOP(fd,4 + c*offset+24), 0, NAME_LENGTH); // account name (not used for security reasons)
+ memcpy(WFIFOP(fd,4 + c*offset+48), e->mes, 40);
#else
- safestrncpy((char*)WFIFOP(fd,4 + c*offset+24),e->mes,40);
+ memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40);
#endif
c++;
}
}
WFIFOW(fd,2) = 4 + c*offset;
WFIFOSET(fd,WFIFOW(fd,2));
- return 0;
}
/*==========================================
diff --git a/src/map/clif.h b/src/map/clif.h
index 6be84709e..70a7fdce8 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -430,7 +430,7 @@ int clif_guild_memberlogin_notice(struct guild *g,int idx,int flag);
int clif_guild_invite(struct map_session_data *sd,struct guild *g);
int clif_guild_inviteack(struct map_session_data *sd,int flag);
int clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes);
-int clif_guild_expulsion(struct map_session_data *sd,const char *name,const char *mes,int account_id);
+void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id);
int clif_guild_positionchanged(struct guild *g,int idx);
int clif_guild_memberpositionchanged(struct guild *g,int idx);
int clif_guild_emblem(struct map_session_data *sd,struct guild *g);