summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-05-15 05:30:25 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-05-15 05:30:25 +0000
commita7c1a55bb6f3c3236ba02722e948a52c645a4918 (patch)
tree15c41cc68bb37051f7fb94bac03055875e25fe5d /src/common
parentec4acd7b1d7f180af5929239ef0706d98d4b6bfc (diff)
downloadhercules-a7c1a55bb6f3c3236ba02722e948a52c645a4918.tar.gz
hercules-a7c1a55bb6f3c3236ba02722e948a52c645a4918.tar.bz2
hercules-a7c1a55bb6f3c3236ba02722e948a52c645a4918.tar.xz
hercules-a7c1a55bb6f3c3236ba02722e948a52c645a4918.zip
* Merged changes from trunk [14784:14819/trunk].
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/renewal@14821 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r--src/common/grfio.c71
-rw-r--r--src/common/grfio.h5
-rw-r--r--src/common/mapindex.c10
-rw-r--r--src/common/mapindex.h3
-rw-r--r--src/common/mmo.h3
5 files changed, 8 insertions, 84 deletions
diff --git a/src/common/grfio.c b/src/common/grfio.c
index 3c0960f30..e7549ecb4 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -7,7 +7,6 @@
#include <sys/stat.h>
#include "grfio.h"
-#include <zlib.h>
#include "../common/cbasetypes.h"
#include "../common/showmsg.h"
@@ -216,70 +215,6 @@ static void decode_des_etc(unsigned char* buf, size_t len, int type, int cycle)
}
}
}
-/*==========================================
- * Grf data decode sub : zip
- *------------------------------------------*/
-int decode_zip(unsigned char* dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen)
-{
- z_stream stream;
- int err;
-
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-
- stream.next_out = (Bytef*) dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
-
- err = inflateInit(&stream);
- if (err != Z_OK) return err;
-
- err = inflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- inflateEnd(&stream);
- return err == Z_OK ? Z_BUF_ERROR : err;
- }
- *destLen = stream.total_out;
-
- err = inflateEnd(&stream);
- return err;
-}
-
-int encode_zip(unsigned char* dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen)
-{
- z_stream stream;
- int err;
- memset(&stream, 0, sizeof(stream));
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-
- stream.next_out = (Bytef*) dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
-
- err = deflateInit(&stream,Z_DEFAULT_COMPRESSION);
- if (err != Z_OK) return err;
-
- err = deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- deflateEnd(&stream);
- return err == Z_OK ? Z_BUF_ERROR : err;
- }
- *destLen = stream.total_out;
-
- err = deflateEnd(&stream);
- return err;
-}
unsigned long grfio_crc32 (const unsigned char* buf, unsigned int len)
{
@@ -496,9 +431,9 @@ void* grfio_reads(char* fname, int* size)
if (entry->cycle >= 0)
decode_des_etc(buf, entry->srclen_aligned, entry->cycle == 0, entry->cycle);
len = entry->declen;
- decode_zip(buf2, &len, buf, entry->srclen);
+ uncompress(buf2, &len, buf, entry->srclen);
if (len != (uLong)entry->declen) {
- ShowError("decode_zip size mismatch err: %d != %d\n", (int)len, entry->declen);
+ ShowError("uncompress size mismatch err: %d != %d\n", (int)len, entry->declen);
aFree(buf);
aFree(buf2);
return NULL;
@@ -645,7 +580,7 @@ static int grfio_entryread(char* grfname, int gentry)
grf_filelist = (unsigned char *)aMallocA(eSize); // Get a Extend Size
fread(rBuf,1,rSize,fp);
fclose(fp);
- decode_zip(grf_filelist, &eSize, rBuf, rSize); // Decode function
+ uncompress(grf_filelist, &eSize, rBuf, rSize); // Decode function
list_size = eSize;
aFree(rBuf);
diff --git a/src/common/grfio.h b/src/common/grfio.h
index 57439b16d..d5334ccf3 100644
--- a/src/common/grfio.h
+++ b/src/common/grfio.h
@@ -4,6 +4,8 @@
#ifndef _GRFIO_H_
#define _GRFIO_H_
+#include <zlib.h>
+
void grfio_init(char*); // GRFIO Initialize
void grfio_final(void); // GRFIO Finalize
void* grfio_reads(char*,int*); // GRFIO data file read & size get
@@ -14,7 +16,4 @@ char *grfio_find_file(char *fname);
int grfio_size(char*); // GRFIO data file size get
unsigned long grfio_crc32(const unsigned char *buf, unsigned int len);
-int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen);
-int encode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen);
-
#endif /* _GRFIO_H_ */
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index a1c86af97..be2913c69 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -128,18 +128,8 @@ unsigned short mapindex_name2id(const char* name)
if (strcmp(indexes[i].name,map_name)==0)
return i;
}
-#ifdef MAPINDEX_AUTOADD
- if( mapindex_addmap(i,map_name) )
- {
- ShowDebug("mapindex_name2id: Auto-added map \"%s\" to position %d\n", map_name, i);
- return i;
- }
- ShowWarning("mapindex_name2id: Failed to auto-add map \"%s\" to position %d!\n", map_name, i);
- return 0;
-#else
ShowDebug("mapindex_name2id: Map \"%s\" not found in index list!\n", map_name);
return 0;
-#endif
}
const char* mapindex_id2name(unsigned short id)
diff --git a/src/common/mapindex.h b/src/common/mapindex.h
index 06131d0a4..854669ea6 100644
--- a/src/common/mapindex.h
+++ b/src/common/mapindex.h
@@ -7,9 +7,6 @@
//File in charge of assigning a numberic ID to each map in existance for space saving when passing map info between servers.
extern char mapindex_cfgfile[80];
-//whether to enable auto-adding of maps during run. Not so secure as the map indexes will vary!
-//#define MAPINDEX_AUTOADD
-
#define MAX_MAPINDEX 2000
//Some definitions for the mayor city maps.
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 024008b7b..0bc30ea47 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -39,6 +39,8 @@
// 20100721 - 2010-07-21aRagexeRE+ - 0x6b, 0x6d
// 20100727 - 2010-07-27aRagexeRE+ - 0x6b, 0x6d
// 20100803 - 2010-08-03aRagexeRE+ - 0x6b, 0x6d, 0x827, 0x828, 0x829, 0x82a, 0x82b, 0x82c, 0x842, 0x843
+// 20101124 - 2010-11-24aRagexeRE+ - 0x856, 0x857, 0x858
+// 20110111 - 2011-01-11aRagexeRE+ - 0x6b, 0x6d
#ifndef PACKETVER
#define PACKETVER 20081126
@@ -329,6 +331,7 @@ struct mmo_charstatus {
short weapon; // enum weapon_type
short shield; // view-id
short head_top,head_mid,head_bottom;
+ short robe;
char name[NAME_LENGTH];
unsigned int base_level,job_level;