summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-15 13:23:34 +0200
committerHaru <haru@dotalux.com>2015-10-11 00:24:21 +0200
commit437dc70ac6a19fe9a32c095ada8205dce173beb3 (patch)
tree7a8fc2106458439fc283a22157f6b0ed8ee31f8a /src/char/char.c
parentf17add758aa067f3b643e008dc42ec918b358528 (diff)
downloadhercules-437dc70ac6a19fe9a32c095ada8205dce173beb3.tar.gz
hercules-437dc70ac6a19fe9a32c095ada8205dce173beb3.tar.bz2
hercules-437dc70ac6a19fe9a32c095ada8205dce173beb3.tar.xz
hercules-437dc70ac6a19fe9a32c095ada8205dce173beb3.zip
Changed HPM->packets[] into an array of VECTOR
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 3cc8853a4..1226a03cd 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -2626,10 +2626,12 @@ int char_parse_fromlogin(int fd) {
while(RFIFOREST(fd) >= 2) {
uint16 command = RFIFOW(fd,0);
- if( HPM->packetsc[hpParse_FromLogin] ) {
- int success = HPM->parse_packets(fd,hpParse_FromLogin);
- if( success == 1 ) continue;
- else if( success == 2 ) return 0;
+ if (VECTOR_LENGTH(HPM->packets[hpParse_FromLogin]) > 0) {
+ int result = HPM->parse_packets(fd,hpParse_FromLogin);
+ if (result == 1)
+ continue;
+ if (result == 2)
+ return 0;
}
switch (command) {
@@ -3896,7 +3898,6 @@ void char_parse_frommap_scdata_delete(int fd)
int char_parse_frommap(int fd)
{
- int i;
int id;
ARR_FIND( 0, ARRAYLENGTH(chr->server), id, chr->server[id].fd == fd );
@@ -3913,11 +3914,12 @@ int char_parse_frommap(int fd)
}
while(RFIFOREST(fd) >= 2) {
- if( HPM->packetsc[hpParse_FromMap] ) {
- if( (i = HPM->parse_packets(fd,hpParse_FromMap)) ) {
- if( i == 1 ) continue;
- if( i == 2 ) return 0;
- }
+ if (VECTOR_LENGTH(HPM->packets[hpParse_FromMap]) > 0) {
+ int result = HPM->parse_packets(fd,hpParse_FromMap);
+ if (result == 1)
+ continue;
+ if (result == 2)
+ return 0;
}
switch(RFIFOW(fd,0)) {
@@ -5095,10 +5097,12 @@ int char_parse_char(int fd)
//For use in packets that depend on an sd being present [Skotlex]
#define FIFOSD_CHECK(rest) do { if(RFIFOREST(fd) < (rest)) return 0; if (sd==NULL || !sd->auth) { RFIFOSKIP(fd,(rest)); return 0; } } while (0)
- if( HPM->packetsc[hpParse_Char] ) {
- int success = HPM->parse_packets(fd,hpParse_Char);
- if( success == 1 ) continue;
- else if( success == 2 ) return 0;
+ if (VECTOR_LENGTH(HPM->packets[hpParse_Char]) > 0) {
+ int result = HPM->parse_packets(fd,hpParse_Char);
+ if (result == 1)
+ continue;
+ if (result == 2)
+ return 0;
}
cmd = RFIFOW(fd,0);