diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-10-11 16:11:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-10-11 16:11:43 +0300 |
commit | 6c0f05b05e9bf09f40df3e3fe7f768f7435abcec (patch) | |
tree | 6973517e1821f128b36955fc258419131b98f7fc /src/map/chrif.c | |
parent | d70d9d4d19f0deae2a2aceb047872611d5047ae0 (diff) | |
parent | 845139091f0305d264800491ce25152856c20374 (diff) | |
download | hercules-6c0f05b05e9bf09f40df3e3fe7f768f7435abcec.tar.gz hercules-6c0f05b05e9bf09f40df3e3fe7f768f7435abcec.tar.bz2 hercules-6c0f05b05e9bf09f40df3e3fe7f768f7435abcec.tar.xz hercules-6c0f05b05e9bf09f40df3e3fe7f768f7435abcec.zip |
Merge pull request #760 from HerculesWS/738-vectors
Change several variable-size array to VECTOR (common, char)
Diffstat (limited to 'src/map/chrif.c')
-rw-r--r-- | src/map/chrif.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c index 1e376e3bc..a27038ff7 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1351,7 +1351,7 @@ void chrif_skillid2idx(int fd) { * *------------------------------------------*/ int chrif_parse(int fd) { - int packet_len, cmd, r; + int packet_len, cmd; // only process data from the char-server if ( fd != chrif->fd ) { @@ -1375,22 +1375,22 @@ int chrif_parse(int fd) { } } - while ( RFIFOREST(fd) >= 2 ) { - - if( HPM->packetsc[hpChrif_Parse] ) { - if( (r = HPM->parse_packets(fd,hpChrif_Parse)) ) { - if( r == 1 ) continue; - if( r == 2 ) return 0; - } + while (RFIFOREST(fd) >= 2) { + if (VECTOR_LENGTH(HPM->packets[hpChrif_Parse]) > 0) { + int result = HPM->parse_packets(fd,hpChrif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; } cmd = RFIFOW(fd,0); if (cmd < 0x2af8 || cmd >= 0x2af8 + ARRAYLENGTH(chrif->packet_len_table) || chrif->packet_len_table[cmd-0x2af8] == 0) { - r = intif->parse(fd); // Passed on to the intif + int result = intif->parse(fd); // Passed on to the intif - if (r == 1) continue; // Treated in intif - if (r == 2) return 0; // Didn't have enough data (len==-1) + if (result == 1) continue; // Treated in intif + if (result == 2) return 0; // Didn't have enough data (len==-1) ShowWarning("chrif_parse: session #%d, intif->parse failed (unrecognized command 0x%.4x).\n", fd, cmd); sockt->eof(fd); |