diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-02 21:11:50 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-02 21:11:50 +0000 |
commit | 792b211d40f10e938b1041974b04e911bd5e4ba4 (patch) | |
tree | 9dcb8e7613cc5e28e4f7bc12d4f85e773d3dc2b3 /src/map | |
parent | b8cecabe98a2d0762d945a08d52f6a37587ce83d (diff) | |
download | hercules-792b211d40f10e938b1041974b04e911bd5e4ba4.tar.gz hercules-792b211d40f10e938b1041974b04e911bd5e4ba4.tar.bz2 hercules-792b211d40f10e938b1041974b04e911bd5e4ba4.tar.xz hercules-792b211d40f10e938b1041974b04e911bd5e4ba4.zip |
- 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
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/chrif.c | 6 | ||||
-rw-r--r-- | src/map/clif.c | 23 | ||||
-rw-r--r-- | src/map/pc.c | 12 | ||||
-rw-r--r-- | src/map/pc.h | 6 |
4 files changed, 32 insertions, 15 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c index 52cb3ef05..122ee42a7 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1122,21 +1122,21 @@ int chrif_recvfamelist(int fd) memset (taekwon_fame_list, 0, sizeof(taekwon_fame_list));
size = RFIFOW(fd,6); //Blacksmith block size
- for (num = 0; len < size && num < 10; num++) {
+ for (num = 0; len < size && num < MAX_FAME_LIST; num++) {
memcpy(&smith_fame_list[num], RFIFOP(fd,len), sizeof(struct fame_list));
len += sizeof(struct fame_list);
}
total += num;
size = RFIFOW(fd,4); //Alchemist block size
- for (num = 0; len < size && num < 10; num++) {
+ for (num = 0; len < size && num < MAX_FAME_LIST; num++) {
memcpy(&chemist_fame_list[num], RFIFOP(fd,len), sizeof(struct fame_list));
len += sizeof(struct fame_list);
}
total += num;
size = RFIFOW(fd,2); //Total packet length
- for (num = 0; len < size && num < 10; num++) {
+ for (num = 0; len < size && num < MAX_FAME_LIST; num++) {
memcpy(&taekwon_fame_list[num], RFIFOP(fd,len), sizeof(struct fame_list));
len += sizeof(struct fame_list);
}
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]);
}
diff --git a/src/map/pc.c b/src/map/pc.c index 4b73572eb..ea04ce8a2 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -55,9 +55,9 @@ int night_timer_tid; static int dirx[8]={0,-1,-1,-1,0,1,1,1};
static int diry[8]={1,1,0,-1,-1,-1,0,1};
-struct fame_list smith_fame_list[10];
-struct fame_list chemist_fame_list[10];
-struct fame_list taekwon_fame_list[10];
+struct fame_list smith_fame_list[MAX_FAME_LIST];
+struct fame_list chemist_fame_list[MAX_FAME_LIST];
+struct fame_list taekwon_fame_list[MAX_FAME_LIST];
static unsigned int equip_pos[11]={0x0080,0x0008,0x0040,0x0004,0x0001,0x0200,0x0100,0x0010,0x0020,0x0002,0x8000};
@@ -272,19 +272,19 @@ int pc_istop10fame(int char_id,int job) { int i;
switch(job){
case MAPID_BLACKSMITH: // Blacksmith
- for(i=0;i<10;i++){
+ for(i=0;i<MAX_FAME_LIST;i++){
if(smith_fame_list[i].id==char_id)
return smith_fame_list[i].fame;
}
break;
case MAPID_ALCHEMIST: // Alchemist
- for(i=0;i<10;i++){
+ for(i=0;i<MAX_FAME_LIST;i++){
if(chemist_fame_list[i].id==char_id)
return chemist_fame_list[i].fame;
}
break;
case MAPID_TAEKWON: // Taekwon
- for(i=0;i<10;i++){
+ for(i=0;i<MAX_FAME_LIST;i++){
if(taekwon_fame_list[i].id==char_id)
return taekwon_fame_list[i].fame;
}
diff --git a/src/map/pc.h b/src/map/pc.h index 9c0fe20ab..78830b6d9 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -225,9 +225,9 @@ int pc_eventtimer(int tid,unsigned int tick,int id,int data); // for npc_dequeue int pc_run(struct map_session_data *sd, int skilllv, int dir);
-extern struct fame_list smith_fame_list[10];
-extern struct fame_list chemist_fame_list[10];
-extern struct fame_list taekwon_fame_list[10];
+extern struct fame_list smith_fame_list[MAX_FAME_LIST];
+extern struct fame_list chemist_fame_list[MAX_FAME_LIST];
+extern struct fame_list taekwon_fame_list[MAX_FAME_LIST];
int pc_readdb(void);
int do_init_pc(void);
|