summaryrefslogtreecommitdiff
path: root/src/char_sql/int_storage.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-11-24 12:41:38 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-11-24 12:41:38 +0000
commit16d301eb02e84f03df387db15750e4cb52beaf9f (patch)
treef45264671d0eaf0af9d8d5ea00b2c74af36dffa9 /src/char_sql/int_storage.c
parent269579a5d2ec5df0841c94158102228bc1634d97 (diff)
downloadhercules-16d301eb02e84f03df387db15750e4cb52beaf9f.tar.gz
hercules-16d301eb02e84f03df387db15750e4cb52beaf9f.tar.bz2
hercules-16d301eb02e84f03df387db15750e4cb52beaf9f.tar.xz
hercules-16d301eb02e84f03df387db15750e4cb52beaf9f.zip
- Added all the missing FIFOHEADs in the login/sql servers (required for TURBO support)
- Fixed the fact that the TURBO code breaks when you attempt to handle more than one connection at a time within the same function. However this broke map-server compilation, therefore, don't use TURBO yet! It needs more fixing (and I need more time to fix it) - While at it, cleaned a few packet implementations in the char/login servers which were not only ugly, but had some really stupid flaws within (stuff like escaping a string, and then using the non-escaped variable to insert to SQL? T_T) And will someone explain me why the TXT servers are coded much more cleanly, and without such horribly broken code as I find in the SQL ones? T_T; git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9307 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql/int_storage.c')
-rw-r--r--src/char_sql/int_storage.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/char_sql/int_storage.c b/src/char_sql/int_storage.c
index 3ed0c2aa9..578de6bc8 100644
--- a/src/char_sql/int_storage.c
+++ b/src/char_sql/int_storage.c
@@ -223,6 +223,7 @@ int inter_guild_storage_delete(int guild_id)
// recive packet about storage data
int mapif_load_storage(int fd,int account_id){
//load from DB
+ WFIFOHEAD(fd, sizeof(struct storage)+8);
storage_fromsql(account_id, storage_pt);
WFIFOW(fd,0)=0x3810;
WFIFOW(fd,2)=sizeof(struct storage)+8;
@@ -233,6 +234,7 @@ int mapif_load_storage(int fd,int account_id){
}
// send ack to map server which is "storage data save ok."
int mapif_save_storage_ack(int fd,int account_id){
+ WFIFOHEAD(fd, 7);
WFIFOW(fd,0)=0x3811;
WFIFOL(fd,2)=account_id;
WFIFOB(fd,6)=0;
@@ -243,6 +245,7 @@ int mapif_save_storage_ack(int fd,int account_id){
int mapif_load_guild_storage(int fd,int account_id,int guild_id)
{
int guild_exist=1;
+ WFIFOHEAD(fd, sizeof(struct guild_storage)+12);
WFIFOW(fd,0)=0x3818;
#if 0 // innodb guilds should render this check unnecessary [Aru]
@@ -279,6 +282,7 @@ int mapif_load_guild_storage(int fd,int account_id,int guild_id)
}
int mapif_save_guild_storage_ack(int fd,int account_id,int guild_id,int fail)
{
+ WFIFOHEAD(fd,11);
WFIFOW(fd,0)=0x3819;
WFIFOL(fd,2)=account_id;
WFIFOL(fd,6)=guild_id;
@@ -292,14 +296,17 @@ int mapif_save_guild_storage_ack(int fd,int account_id,int guild_id,int fail)
// recive request about storage data
int mapif_parse_LoadStorage(int fd){
+ RFIFOHEAD(fd);
mapif_load_storage(fd,RFIFOL(fd,2));
return 0;
}
// storage data recive and save
int mapif_parse_SaveStorage(int fd){
- int account_id=RFIFOL(fd,4);
- int len=RFIFOW(fd,2);
-
+ int account_id;
+ int len;
+ RFIFOHEAD(fd);
+ account_id=RFIFOL(fd,4);
+ len=RFIFOW(fd,2);
if(sizeof(struct storage)!=len-8){
ShowError("inter storage: data size error %d %d\n",sizeof(struct storage),len-8);
}else{
@@ -312,6 +319,7 @@ int mapif_parse_SaveStorage(int fd){
int mapif_parse_LoadGuildStorage(int fd)
{
+ RFIFOHEAD(fd);
mapif_load_guild_storage(fd,RFIFOL(fd,2),RFIFOL(fd,6));
return 0;
}
@@ -319,8 +327,11 @@ int mapif_parse_LoadGuildStorage(int fd)
int mapif_parse_SaveGuildStorage(int fd)
{
int guild_exist=1;
- int guild_id=RFIFOL(fd,8);
- int len=RFIFOW(fd,2);
+ int guild_id;
+ int len;
+ RFIFOHEAD(fd);
+ guild_id=RFIFOL(fd,8);
+ len=RFIFOW(fd,2);
if(sizeof(struct guild_storage)!=len-12){
ShowError("inter storage: data size error %d %d\n",sizeof(struct guild_storage),len-12);
}
@@ -354,6 +365,7 @@ int mapif_parse_SaveGuildStorage(int fd)
int inter_storage_parse_frommap(int fd){
+ RFIFOHEAD(fd);
switch(RFIFOW(fd,0)){
case 0x3010: mapif_parse_LoadStorage(fd); break;
case 0x3011: mapif_parse_SaveStorage(fd); break;