diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 15 | ||||
-rw-r--r-- | src/map/packets_struct.h | 6 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 3af7a09d2..0e2424618 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -20358,21 +20358,21 @@ static const char *clif_get_bl_name(const struct block_list *bl) */ static void clif_clan_basicinfo(struct map_session_data *sd) { -#if PACKETVER >= 20120716 +#if PACKETVER_MAIN_NUM >= 20130626 || PACKETVER_RE_NUM >= 20130605 || defined(PACKETVER_ZERO) int len, i, fd; struct clan *c, *ally, *antagonist; struct PACKET_ZC_CLANINFO *packet = NULL; - nullpo_retv(sd); nullpo_retv(c = sd->clan); len = sizeof(struct PACKET_ZC_CLANINFO); fd = sd->fd; - WFIFOHEAD(fd, len); + const int maxEntries = 100; // max entries with clan names + WFIFOHEAD(fd, len + maxEntries * 24); packet = WFIFOP(fd, 0); - packet->PacketType = clanBasicInfo; + packet->PacketType = HEADER_ZC_CLANINFO; packet->ClanID = c->clan_id; safestrncpy(packet->ClanName, c->name, NAME_LENGTH); @@ -20383,24 +20383,27 @@ static void clif_clan_basicinfo(struct map_session_data *sd) packet->AllyCount = VECTOR_LENGTH(c->allies); packet->AntagonistCount = VECTOR_LENGTH(c->antagonists); + int cnt = 0; // All allies and antagonists are assumed as valid entries // since it only gets inside the vector after the validation // on clan->config_read - for (i = 0; i < VECTOR_LENGTH(c->allies); i++) { + for (i = 0; i < VECTOR_LENGTH(c->allies) && cnt < maxEntries; i++) { struct clan_relationship *al = &VECTOR_INDEX(c->allies, i); if ((ally = clan->search(al->clan_id)) != NULL) { safestrncpy(WFIFOP(fd, len), ally->name, NAME_LENGTH); len += NAME_LENGTH; + cnt ++; } } - for (i = 0; i < VECTOR_LENGTH(c->antagonists); i++) { + for (i = 0; i < VECTOR_LENGTH(c->antagonists) && cnt < maxEntries; i++) { struct clan_relationship *an = &VECTOR_INDEX(c->antagonists, i); if ((antagonist = clan->search(an->clan_id)) != NULL) { safestrncpy(WFIFOP(fd, len), antagonist->name, NAME_LENGTH); len += NAME_LENGTH; + cnt ++; } } diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 622ec235a..9ea5dc8a1 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -371,9 +371,6 @@ enum packet_headers { partymemberinfo = 0x01e9, partyinfo = 0x00fb, #endif -#if PACKETVER >= 20120702 - clanBasicInfo = 0x098A, ///< ZC_CLANINFO -#endif #if PACKETVER >= 20120716 clanOnlineCount = 0x0988, ///< ZC_NOTIFY_CLAN_CONNECTINFO clanLeave = 0x0989, ///< ZC_ACK_CLAN_LEAVE @@ -1800,6 +1797,7 @@ struct PACKET_ZC_GROUP_LIST { struct PACKET_ZC_GROUP_LIST_SUB members[]; } __attribute__((packed)); +#if PACKETVER_MAIN_NUM >= 20130626 || PACKETVER_RE_NUM >= 20130605 || defined(PACKETVER_ZERO) struct PACKET_ZC_CLANINFO { int16 PacketType; int16 PacketLength; @@ -1810,6 +1808,8 @@ struct PACKET_ZC_CLANINFO { uint8 AllyCount; uint8 AntagonistCount; } __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_CLANINFO, 0x098a); +#endif struct PACKET_ZC_NOTIFY_CLAN_CONNECTINFO { int16 PacketType; |