From 6125b6bc5204a618e6fc8976600332a423bd0fc0 Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 23 Nov 2006 15:33:51 +0000 Subject: - Made WFIFOHEAD() check for available buffer size remaining on the connection, and when there's not enough space, it will increase it. - Added define TURBO to the Makefile. It enables MouseJstr's socket access optimization which should speed up the code when accessing the write/read buffers repeatedly within a function. - Fixed the functions where the RFIFOHEAD/WFIFOHEAD functions were used incorrectly (prevents TURBO enabled compilations from finishing) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9297 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/char/char.c | 2 ++ src/char/int_homun.c | 8 ++++++-- src/char/int_pet.c | 2 ++ src/char/inter.c | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/char') diff --git a/src/char/char.c b/src/char/char.c index d1ed13596..b043809aa 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -2433,6 +2433,7 @@ int parse_tologin(int fd) { new_ip = resolve_hostbyname(char_ip_str, NULL, NULL); if (new_ip && new_ip != char_ip) { //Update ip. + WFIFOHEAD(fd,6); char_ip = new_ip; ShowInfo("Updating IP for [%s].\n",char_ip_str); WFIFOW(fd,0) = 0x2736; @@ -2454,6 +2455,7 @@ int parse_tologin(int fd) { int request_accreg2(int account_id, int char_id) { if (login_fd > 0) { + WFIFOHEAD(login_fd, 10); WFIFOW(login_fd, 0) = 0x272e; WFIFOL(login_fd, 2) = account_id; WFIFOL(login_fd, 6) = char_id; diff --git a/src/char/int_homun.c b/src/char/int_homun.c index c71cd7792..3de472d74 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -241,6 +241,7 @@ int mapif_delete_homun_ack(int fd,int flag) } int mapif_rename_homun_ack(int fd, int account_id, int char_id, int flag, char *name){ + WFIFOHEAD(fd, NAME_LENGTH+12); WFIFOW(fd, 0) =0x3894; WFIFOL(fd, 2) =account_id; WFIFOL(fd, 6) =char_id; @@ -254,6 +255,7 @@ int mapif_rename_homun_ack(int fd, int account_id, int char_id, int flag, char * int mapif_create_homun(int fd) { struct s_homunculus *p; + RFIFOHEAD(fd); p= (struct s_homunculus *) aCalloc(sizeof(struct s_homunculus), 1); if(p==NULL){ ShowFatalError("int_homun: out of memory !\n"); @@ -271,7 +273,9 @@ int mapif_create_homun(int fd) int mapif_load_homun(int fd) { struct s_homunculus *p; - int account_id = RFIFOL(fd,2); + int account_id; + RFIFOHEAD(fd); + account_id = RFIFOL(fd,2); p= idb_get(homun_db,RFIFOL(fd,6)); if(p==NULL) { @@ -292,7 +296,6 @@ int mapif_save_homun(int fd,int account_id,struct s_homunculus *data) { struct s_homunculus *p; int hom_id; - RFIFOHEAD(fd); if (data->hom_id == 0) data->hom_id = homun_newid++; @@ -346,6 +349,7 @@ int mapif_parse_DeleteHomun(int fd) } int mapif_parse_RenameHomun(int fd){ + RFIFOHEAD(fd); mapif_rename_homun(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOP(fd, 10)); return 0; } diff --git a/src/char/int_pet.c b/src/char/int_pet.c index 6e1b8ad83..3ab48c8ae 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -222,6 +222,7 @@ int mapif_delete_pet_ack(int fd,int flag) } int mapif_rename_pet_ack(int fd, int account_id, int char_id, int flag, char *name){ + WFIFOHEAD(fd, NAME_LENGTH+12); WFIFOW(fd, 0) =0x3884; WFIFOL(fd, 2) =account_id; WFIFOL(fd, 6) =char_id; @@ -394,6 +395,7 @@ int mapif_parse_DeletePet(int fd) } int mapif_parse_RenamePet(int fd){ + RFIFOHEAD(fd); mapif_rename_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOP(fd, 10)); return 0; } diff --git a/src/char/inter.c b/src/char/inter.c index 74ea3a956..ab97c6512 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -614,7 +614,8 @@ int mapif_parse_Registry(int fd) { // Request the value of all registries. int mapif_parse_RegistryRequest(int fd) -{ +{ + RFIFOHEAD(fd); //Load Char Registry if (RFIFOB(fd,12)) char_account_reg_reply(fd,RFIFOL(fd,2),RFIFOL(fd,6)); -- cgit v1.2.3-70-g09d2