From 792b211d40f10e938b1041974b04e911bd5e4ba4 Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 2 Mar 2006 21:11:50 +0000 Subject: - Fame list size is now defined by MAX_FAME_LIST constant (mmo.h) - Char server can now specify the max size for blacksmith/alchemist/taekwon rankers. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5435 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 636dc37f8..227e42049 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11568,7 +11568,8 @@ void clif_parse_Blacksmith(int fd,struct map_session_data *sd) WFIFOHEAD(fd,packet_len_table[0x219]); WFIFOW(fd,0) = 0x219; - for (i = 0; i < 10; i++) { + //Packet size limits this list to 10 elements. [Skotlex] + for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) { if (smith_fame_list[i].id > 0) { if (strcmp(smith_fame_list[i].name, "-") == 0 && (name = map_charid2nick(smith_fame_list[i].id)) != NULL) @@ -11580,6 +11581,11 @@ void clif_parse_Blacksmith(int fd,struct map_session_data *sd) strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), "None", 5); WFIFOL(fd, 242 + i * 4) = smith_fame_list[i].fame; } + for(;i < 10; i++) { //In case the MAX is less than 10. + strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), "Unavailable", 12); + WFIFOL(fd, 242 + i * 4) = 0; + } + WFIFOSET(fd, packet_len_table[0x219]); } @@ -11606,7 +11612,8 @@ void clif_parse_Alchemist(int fd,struct map_session_data *sd) WFIFOHEAD(fd,packet_len_table[0x21a]); WFIFOW(fd,0) = 0x21a; - for (i = 0; i < 10; i++) { + //Packet size limits this list to 10 elements. [Skotlex] + for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) { if (chemist_fame_list[i].id > 0) { if (strcmp(chemist_fame_list[i].name, "-") == 0 && (name = map_charid2nick(chemist_fame_list[i].id)) != NULL) @@ -11618,6 +11625,11 @@ void clif_parse_Alchemist(int fd,struct map_session_data *sd) memcpy(WFIFOP(fd, 2 + 24 * i), "None", NAME_LENGTH); WFIFOL(fd, 242 + i * 4) = chemist_fame_list[i].fame; } + for(;i < 10; i++) { //In case the MAX is less than 10. + memcpy(WFIFOP(fd, 2 + 24 * i), "Unavailable", NAME_LENGTH); + WFIFOL(fd, 242 + i * 4) = 0; + } + WFIFOSET(fd, packet_len_table[0x21a]); } @@ -11644,7 +11656,8 @@ void clif_parse_Taekwon(int fd,struct map_session_data *sd) WFIFOHEAD(fd,packet_len_table[0x226]); WFIFOW(fd,0) = 0x226; - for (i = 0; i < 10; i++) { + //Packet size limits this list to 10 elements. [Skotlex] + for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) { if (taekwon_fame_list[i].id > 0) { if (strcmp(taekwon_fame_list[i].name, "-") == 0 && (name = map_charid2nick(taekwon_fame_list[i].id)) != NULL) @@ -11656,6 +11669,10 @@ void clif_parse_Taekwon(int fd,struct map_session_data *sd) memcpy(WFIFOP(fd, 2 + 24 * i), "None", NAME_LENGTH); WFIFOL(fd, 242 + i * 4) = taekwon_fame_list[i].fame; } + for(;i < 10; i++) { //In case the MAX is less than 10. + memcpy(WFIFOP(fd, 2 + 24 * i), "Unavailable", NAME_LENGTH); + WFIFOL(fd, 242 + i * 4) = 0; + } WFIFOSET(fd, packet_len_table[0x226]); } -- cgit v1.2.3-70-g09d2