diff options
author | panikon <panikon@zoho.com> | 2014-05-06 21:14:46 -0300 |
---|---|---|
committer | panikon <panikon@zoho.com> | 2014-05-06 21:14:46 -0300 |
commit | 9a425c11b61fb6f4e299013c7d8d9841129b8f45 (patch) | |
tree | b8e8bc56c6e51679c23fe2de0e268f49b29f7288 /src/tool/mapcache.c | |
parent | 9cf6b362a0d5e2f52c017d747c0fa8f69a1a273f (diff) | |
download | hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.tar.gz hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.tar.bz2 hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.tar.xz hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.zip |
Bug fixes and other changes
#Fixed issue where a corrupted map cache would lead to a crash
*Moved Big-endian compatibility functions to common/utils.h
#Fixed issue 8162
*http://hercules.ws/board/tracker/issue-8162-loadnpc-doesnt-trigger-oninit-of-duplicate-npcs/
*Added options to npc_parse_duplicate
#Fixed issue 8169
*http://hercules.ws/board/tracker/issue-8169-script-command-guildskill-skill-idlevel-not-working-as-intended/
*Changed *guildskill behavior, now it behaves exactly as depicted in the documentation
*Updated *guildskill documentation
#Added missing GBI types to mapif_parse_GuildBasicInfoChange now it's possible to change guild exp, lv, skill point and skill information
#GeoIP revamp
*GeoIP module was partially rewritten
*Added several data checks to prevent corruption and crashes
*Updated GeoIP database
*See https://github.com/maxmind/geoip-api-c/blob/master/libGeoIP/GeoIP.c for more information
#Added packetver checks regarding NST_MARKET
*Now *tradertype warns if user is trying to use this feature with older clients
Diffstat (limited to 'src/tool/mapcache.c')
-rw-r--r-- | src/tool/mapcache.c | 59 |
1 files changed, 5 insertions, 54 deletions
diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c index caa55c87a..85d5fb548 100644 --- a/src/tool/mapcache.c +++ b/src/tool/mapcache.c @@ -6,6 +6,7 @@ #include "../common/malloc.h" #include "../common/mmo.h" #include "../common/showmsg.h" +#include "../common/utils.h" #include "../config/renewal.h" @@ -49,60 +50,10 @@ struct map_info { int32 len; }; - -/************************************* -* Big-endian compatibility functions * -*************************************/ - -// Converts an int16 from current machine order to little-endian -int16 MakeShortLE(int16 val) -{ - unsigned char buf[2]; - buf[0] = (unsigned char)( (val & 0x00FF) ); - buf[1] = (unsigned char)( (val & 0xFF00) >> 0x08 ); - return *((int16*)buf); -} - -// Converts an int32 from current machine order to little-endian -int32 MakeLongLE(int32 val) -{ - unsigned char buf[4]; - buf[0] = (unsigned char)( (val & 0x000000FF) ); - buf[1] = (unsigned char)( (val & 0x0000FF00) >> 0x08 ); - buf[2] = (unsigned char)( (val & 0x00FF0000) >> 0x10 ); - buf[3] = (unsigned char)( (val & 0xFF000000) >> 0x18 ); - return *((int32*)buf); -} - -// Reads an uint16 in little-endian from the buffer -uint16 GetUShort(const unsigned char* buf) -{ - return ( ((uint16)(buf[0])) ) - |( ((uint16)(buf[1])) << 0x08 ); -} - -// Reads an uint32 in little-endian from the buffer -uint32 GetULong(const unsigned char* buf) -{ - return ( ((uint32)(buf[0])) ) - |( ((uint32)(buf[1])) << 0x08 ) - |( ((uint32)(buf[2])) << 0x10 ) - |( ((uint32)(buf[3])) << 0x18 ); -} - -// Reads an int32 in little-endian from the buffer -int32 GetLong(const unsigned char* buf) -{ - return (int32)GetULong(buf); -} - -// Reads a float (32 bits) from the buffer -float GetFloat(const unsigned char* buf) -{ - uint32 val = GetULong(buf); - return *((float*)(void*)&val); -} - + /************************************* + * Big-endian compatibility functions * + * Moved to utils.h * + *************************************/ // Reads a map from GRF's GAT and RSW files int read_map(char *name, struct map_data *m) |