Browse Source

* Added defines for guild notice sizes (MAX_GUILDMES1 and MAX_GUILDMES2).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14544 54d463be-8e91-2dee-dedb-b68131a5f0ec
ai4rei 14 years ago
parent
commit
f9bdaf5426
7 changed files with 21 additions and 16 deletions
  1. 1 0
      Changelog-Trunk.txt
  2. 4 4
      src/char/int_guild.c
  3. 4 4
      src/char_sql/int_guild.c
  4. 5 1
      src/common/mmo.h
  5. 3 3
      src/map/clif.c
  6. 2 2
      src/map/guild.c
  7. 2 2
      src/map/intif.c

+ 1 - 0
Changelog-Trunk.txt

@@ -1,6 +1,7 @@
 Date	Added
 
 2010/12/02
+	* Added defines for guild notice sizes (MAX_GUILDMES1 and MAX_GUILDMES2). [Ai4rei]
 	* Added clif_starskill (packet 0x20e, ZC_STARSKILL) to host the packet previously implemented by clif_feel_info, clif_hate_info, clif_mission_info and clif_feel_hate_reset (related r4352, r4375 and r9162). [Ai4rei]
 	- This also fixes sd->bl.id being sometimes supplied for monster_id in this packet.
 	* Various additions and updates to the comments and documentation of packets in clif. [Ai4rei]

+ 4 - 4
src/char/int_guild.c

@@ -865,8 +865,8 @@ int mapif_guild_notice(struct guild *g)
 
 	WBUFW(buf,0) = 0x383e;
 	WBUFL(buf,2) = g->guild_id;
-	memcpy(WBUFP(buf,6), g->mes1, 60);
-	memcpy(WBUFP(buf,66), g->mes2, 120);
+	memcpy(WBUFP(buf,6), g->mes1, MAX_GUILDMES1);
+	memcpy(WBUFP(buf,66), g->mes2, MAX_GUILDMES2);
 	mapif_sendall(buf, 186);
 
 	return 0;
@@ -1404,8 +1404,8 @@ int mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const char *
 	g = (struct guild*)idb_get(guild_db, guild_id);
 	if (g == NULL)
 		return 0;
-	memcpy(g->mes1, mes1, 60);
-	memcpy(g->mes2, mes2, 120);
+	memcpy(g->mes1, mes1, MAX_GUILDMES1);
+	memcpy(g->mes2, mes2, MAX_GUILDMES2);
 
 	return mapif_guild_notice(g);
 }

+ 4 - 4
src/char_sql/int_guild.c

@@ -1131,8 +1131,8 @@ int mapif_guild_notice(struct guild *g)
 	unsigned char buf[256];
 	WBUFW(buf,0)=0x383e;
 	WBUFL(buf,2)=g->guild_id;
-	memcpy(WBUFP(buf,6),g->mes1,60);
-	memcpy(WBUFP(buf,66),g->mes2,120);
+	memcpy(WBUFP(buf,6),g->mes1,MAX_GUILDMES1);
+	memcpy(WBUFP(buf,66),g->mes2,MAX_GUILDMES2);
 	mapif_sendall(buf,186);
 	return 0;
 }
@@ -1826,8 +1826,8 @@ int mapif_parse_GuildNotice(int fd,int guild_id,const char *mes1,const char *mes
 	if(g==NULL)
 		return 0;
 
-	memcpy(g->mes1,mes1,60);
-	memcpy(g->mes2,mes2,120);
+	memcpy(g->mes1,mes1,MAX_GUILDMES1);
+	memcpy(g->mes2,mes2,MAX_GUILDMES2);
 	g->save_flag |= GS_MES;	//Change mes of guild
 	return mapif_guild_notice(g);
 }

+ 5 - 1
src/common/mmo.h

@@ -147,6 +147,10 @@
 #define END_ACCOUNT_NUM 100000000
 #define START_CHAR_NUM 150000
 
+//Guilds
+#define MAX_GUILDMES1 60
+#define MAX_GUILDMES2 120
+
 //Base Homun skill.
 #define HM_SKILLBASE 8001
 #define MAX_HOMUNSKILL 16
@@ -474,7 +478,7 @@ struct guild {
 	char name[NAME_LENGTH],master[NAME_LENGTH];
 	struct guild_member member[MAX_GUILD];
 	struct guild_position position[MAX_GUILDPOSITION];
-	char mes1[60],mes2[120];
+	char mes1[MAX_GUILDMES1],mes2[MAX_GUILDMES2];
 	int emblem_len,emblem_id;
 	char emblem_data[2048];
 	struct guild_alliance alliance[MAX_GUILDALLIANCE];

+ 3 - 3
src/map/clif.c

@@ -7077,8 +7077,8 @@ int clif_guild_notice(struct map_session_data* sd, struct guild* g)
 
 	WFIFOHEAD(fd,packet_len(0x16f));
 	WFIFOW(fd,0) = 0x16f;
-	memcpy(WFIFOP(fd,2), g->mes1, 60);
-	memcpy(WFIFOP(fd,62), g->mes2, 120);
+	memcpy(WFIFOP(fd,2), g->mes1, MAX_GUILDMES1);
+	memcpy(WFIFOP(fd,62), g->mes2, MAX_GUILDMES2);
 	WFIFOSET(fd,packet_len(0x16f));
 	return 0;
 }
@@ -11169,7 +11169,7 @@ void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd)
 	// compensate for some client defects when using multilanguage mode
 	if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; // skip duplicate marker
 	if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; // skip duplicate marker
-	if (msg2[0] == '|') msg2[strnlen(msg2, 120)-1] = '\0'; // delete extra space at the end of string
+	if (msg2[0] == '|') msg2[strnlen(msg2, MAX_GUILDMES2)-1] = '\0'; // delete extra space at the end of string
 
 	guild_change_notice(sd, guild_id, msg1, msg2);
 }

+ 2 - 2
src/map/guild.c

@@ -1068,8 +1068,8 @@ int guild_notice_changed(int guild_id,const char *mes1,const char *mes2)
 	if(g==NULL)
 		return 0;
 
-	memcpy(g->mes1,mes1,60);
-	memcpy(g->mes2,mes2,120);
+	memcpy(g->mes1,mes1,MAX_GUILDMES1);
+	memcpy(g->mes2,mes2,MAX_GUILDMES2);
 
 	for(i=0;i<g->max_member;i++){
 		if((sd=g->member[i].sd)!=NULL)

+ 2 - 2
src/map/intif.c

@@ -698,8 +698,8 @@ int intif_guild_notice(int guild_id,const char *mes1,const char *mes2)
 	WFIFOHEAD(inter_fd,186);
 	WFIFOW(inter_fd,0)=0x303e;
 	WFIFOL(inter_fd,2)=guild_id;
-	memcpy(WFIFOP(inter_fd,6),mes1,60);
-	memcpy(WFIFOP(inter_fd,66),mes2,120);
+	memcpy(WFIFOP(inter_fd,6),mes1,MAX_GUILDMES1);
+	memcpy(WFIFOP(inter_fd,66),mes2,MAX_GUILDMES2);
 	WFIFOSET(inter_fd,186);
 	return 0;
 }