summaryrefslogtreecommitdiff
path: root/src/tool
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool')
-rw-r--r--src/tool/CMakeLists.txt45
-rw-r--r--src/tool/Makefile.in33
-rw-r--r--src/tool/mapcache.c73
3 files changed, 32 insertions, 119 deletions
diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt
deleted file mode 100644
index a54ffa0e2..000000000
--- a/src/tool/CMakeLists.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-
-#
-# mapcache
-#
-if( WITH_ZLIB )
- option( BUILD_MAPCACHE "build mapcache executable" ON )
-else()
- message( STATUS "Disabled mapcache target (required ZLIB)" )
-endif()
-if( BUILD_MAPCACHE )
-message( STATUS "Creating target mapcache" )
-set( COMMON_HEADERS
- ${COMMON_MINI_HEADERS}
- "${COMMON_SOURCE_DIR}/des.h"
- "${COMMON_SOURCE_DIR}/grfio.h"
- "${COMMON_SOURCE_DIR}/utils.h"
- )
-set( COMMON_SOURCES
- ${COMMON_MINI_SOURCES}
- "${COMMON_SOURCE_DIR}/des.c"
- "${COMMON_SOURCE_DIR}/grfio.c"
- "${COMMON_SOURCE_DIR}/utils.c"
- )
-set( MAPCACHE_SOURCES
- "${CMAKE_CURRENT_SOURCE_DIR}/mapcache.c"
- )
-set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} )
-set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_MINI_INCLUDE_DIRS} )
-set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS}" )
-set( SOURCE_FILES ${COMMON_HEADERS} ${COMMON_SOURCES} ${MAPCACHE_SOURCES} )
-source_group( common FILES ${COMMON_HEADERS} ${COMMON_SOURCES} )
-source_group( mapcache FILES ${MAPCACHE_SOURCES} )
-add_executable( mapcache ${SOURCE_FILES} )
-include_directories( ${INCLUDE_DIRS} )
-target_link_libraries( mapcache ${LIBRARIES} )
-set_target_properties( mapcache PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
-if( INSTALL_COMPONENT_RUNTIME )
- cpack_add_component( Runtime_mapcache DESCRIPTION "mapcache generator" DISPLAY_NAME "mapcache" GROUP Runtime )
- install( TARGETS mapcache
- DESTINATION "."
- COMPONENT Runtime_mapcache )
-endif( INSTALL_COMPONENT_RUNTIME )
-set( TARGET_LIST ${TARGET_LIST} mapcache CACHE INTERNAL "" )
-message( STATUS "Creating target mapcache - done" )
-endif( BUILD_MAPCACHE )
diff --git a/src/tool/Makefile.in b/src/tool/Makefile.in
index 3d0de1122..127d3841b 100644
--- a/src/tool/Makefile.in
+++ b/src/tool/Makefile.in
@@ -1,12 +1,14 @@
+# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+# See the LICENSE file
+
+# @configure_input@
CONFIG_D = ../config
CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h)
COMMON_D = ../common
-COMMON_OBJ = $(addprefix $(COMMON_D)/obj_all/, des.o grfio.o malloc.o \
- nullpo.o miniconsole.o minicore.o showmsg.o strlib.o utils.o)
-COMMON_H = $(addprefix $(COMMON_D)/, cbasetypes.h console.h core.h des.h \
- grfio.h malloc.h mmo.h nullpo.h showmsg.h strlib.h utils.h)
+COMMON_H = $(wildcard $(COMMON_D)/*.h)
+SYSINFO_INC = $(COMMON_D)/sysinfo.inc
LIBCONFIG_D = ../../3rdparty/libconfig
LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \
@@ -16,6 +18,9 @@ LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \
LIBCONFIG_INCLUDE = -I$(LIBCONFIG_D)
MAPCACHE_OBJ = obj_all/mapcache.o
+MAPCACHE_C = mapcache.c
+MAPCACHE_H =
+MAPCACHE_DEPENDS = $(MAPCACHE_OBJ) $(COMMON_D)/obj_all/common_mini.a $(LIBCONFIG_OBJ $(SYSINFO_INC))
@SET_MAKE@
@@ -29,9 +34,9 @@ all: mapcache Makefile
mapcache: ../../mapcache@EXEEXT@
-../../mapcache@EXEEXT@: $(MAPCACHE_OBJ) $(COMMON_OBJ) $(LIBCONFIG_OBJ) Makefile
+../../mapcache@EXEEXT@: $(MAPCACHE_DEPENDS) Makefile
@echo " LD $(notdir $@)"
- @$(CC) @LDFLAGS@ $(LIBCONFIG_INCLUDE) -o ../../mapcache@EXEEXT@ $(MAPCACHE_OBJ) $(COMMON_OBJ) $(LIBCONFIG_OBJ) @LIBS@
+ @$(CC) @LDFLAGS@ -o ../../mapcache@EXEEXT@ $(MAPCACHE_DEPENDS) @LIBS@
buildclean:
@echo " CLEAN tool (build temp files)"
@@ -55,22 +60,22 @@ help:
Makefile: Makefile.in
@$(MAKE) -C ../.. src/tool/Makefile
+$(SYSINFO_INC): $(MAPCACHE_C) $(MAPCACHE_H) $(COMMON_H) $(CONFIG_H) $(LIBCONFIG_H)
+ @echo " MAKE $@"
+ @$(MAKE) -C ../.. sysinfo
+
obj_all:
@echo " MKDIR obj_all"
@-mkdir obj_all
-obj_all/%.o: %.c $(COMMON_H) $(CONFIG_H) $(LIBCONFIG_H) | obj_all
+obj_all/%.o: %.c $(MAPCACHE_H) $(COMMON_H) $(CONFIG_H) $(LIBCONFIG_H) | obj_all
@echo " CC $<"
- @$(CC) @CFLAGS@ $(LIBCONFIG_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
+ @$(CC) @CFLAGS@ @DEFS@ $(LIBCONFIG_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing common object files
-$(COMMON_D)/obj_all/%.o:
- @echo " MAKE $@"
- @$(MAKE) -C $(COMMON_D) sql
-
-$(COMMON_D)/obj_all/mini%.o:
+$(COMMON_D)/obj_all/common_mini.a:
@echo " MAKE $@"
- @$(MAKE) -C $(COMMON_D) sql
+ @$(MAKE) -C $(COMMON_D) common_mini
$(LIBCONFIG_OBJ):
@echo " MAKE $@"
diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c
index caa55c87a..96d51aec6 100644
--- a/src/tool/mapcache.c
+++ b/src/tool/mapcache.c
@@ -1,18 +1,21 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include "../common/cbasetypes.h"
-#include "../common/grfio.h"
-#include "../common/malloc.h"
-#include "../common/mmo.h"
-#include "../common/showmsg.h"
+#define HERCULES_CORE
-#include "../config/renewal.h"
+#include "../config/core.h" // RENEWAL
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "../common/cbasetypes.h"
+#include "../common/grfio.h"
+#include "../common/malloc.h"
+#include "../common/mmo.h"
+#include "../common/showmsg.h"
+#include "../common/utils.h"
+
#ifndef _WIN32
#include <unistd.h>
#endif
@@ -49,60 +52,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)