From a61cd3b0211d4804013bbd94110f1de9a93e1fac Mon Sep 17 00:00:00 2001 From: jeefo Date: Sun, 13 Mar 2016 19:20:25 +0300 Subject: [PATCH] now load waypoints from memory as well changed versioning scheme updated linux makefiles --- include/core.h | 2 +- include/engine/eiface.h | 9 ++------- include/engine/meta_api.h | 8 ++++---- include/resource.h | 4 ++-- project/makefile | 29 +++++------------------------ source/Android.mk | 4 ++-- source/engine.cpp | 2 +- source/interface.cpp | 4 ++-- source/waypoint.cpp | 2 +- 9 files changed, 20 insertions(+), 44 deletions(-) diff --git a/include/core.h b/include/core.h index 2ea6343..268ee58 100644 --- a/include/core.h +++ b/include/core.h @@ -469,7 +469,7 @@ enum WaypointFlag // defines for waypoint connection flags field (16 bits are available) enum PathFlag { - PATHFLAG_JUMP = (1 << 0), // must jump for this connection + PATHFLAG_JUMP = (1 << 0) // must jump for this connection }; // enum pathfind search type diff --git a/include/engine/eiface.h b/include/engine/eiface.h index a0632b0..aafa72d 100644 --- a/include/engine/eiface.h +++ b/include/engine/eiface.h @@ -69,20 +69,15 @@ typedef enum { print_console, print_center, - print_chat, + print_chat } PRINT_TYPE; -typedef enum -{ - print_withtag = print_console | 0x3ff, -} PRINT_TYPE_EX; // (dz): added for bots needs - // For integrity checking of content on clients typedef enum { force_exactfile, // File on client must exactly match server's file force_model_samebounds, // For model files only, the geometry must fit in the same bbox - force_model_specifybounds, // For model files only, the geometry must fit in the specified bbox + force_model_specifybounds // For model files only, the geometry must fit in the specified bbox } FORCE_TYPE; // Returned by TraceLine diff --git a/include/engine/meta_api.h b/include/engine/meta_api.h index 733339f..f1f6788 100644 --- a/include/engine/meta_api.h +++ b/include/engine/meta_api.h @@ -31,7 +31,7 @@ typedef enum PT_STARTUP, PT_CHANGELEVEL, PT_ANYTIME, - PT_ANYPAUSE, + PT_ANYPAUSE } PLUG_LOADTIME; @@ -64,7 +64,7 @@ typedef enum PNL_DELAYED, PNL_PLUGIN, PNL_PLG_FORCED, - PNL_RELOAD, + PNL_RELOAD } PL_UNLOAD_REASON; typedef enum @@ -73,7 +73,7 @@ typedef enum MRES_IGNORED, MRES_HANDLED, MRES_OVERRIDE, - MRES_SUPERCEDE, + MRES_SUPERCEDE } META_RES; typedef struct meta_globals_s @@ -121,7 +121,7 @@ typedef enum GINFO_GAMEDIR, GINFO_DLL_FULLPATH, GINFO_DLL_FILENAME, - GINFO_REALDLL_FULLPATH, + GINFO_REALDLL_FULLPATH } ginfo_t; // Meta Utility Function table type. diff --git a/include/resource.h b/include/resource.h index b702fbe..561fa3d 100644 --- a/include/resource.h +++ b/include/resource.h @@ -11,7 +11,7 @@ // general product information #define PRODUCT_NAME "Yet Another POD-Bot" -#define PRODUCT_VERSION "2.7.3" +#define PRODUCT_VERSION "2.73" #define PRODUCT_AUTHOR "YaPB Dev Team" #define PRODUCT_URL "https://yapb.jeefo.net" #define PRODUCT_EMAIL "dmitry@jeefo.net" @@ -21,7 +21,7 @@ #define PRODUCT_LEGAL "Half-Life, Counter-Strike, Counter-Strike: Condition Zero, Steam, Valve is a trademark of Valve Corporation" #define PRODUCT_ORIGINAL_NAME "yapb.dll" #define PRODUCT_INTERNAL_NAME "skybot" -#define PRODUCT_VERSION_DWORD_INTERNAL 2,7,3 +#define PRODUCT_VERSION_DWORD_INTERNAL 2,73 #define PRODUCT_VERSION_DWORD PRODUCT_VERSION_DWORD_INTERNAL,0 #define PRODUCT_SUPPORT_VERSION "1.0 - CZ" #define PRODUCT_COMMENTS "http://github.com/jeefo/yapb/" diff --git a/project/makefile b/project/makefile index 6a95e79..c66778b 100644 --- a/project/makefile +++ b/project/makefile @@ -22,7 +22,7 @@ OBJECTS = $(SRC_DIR)/basecode.cpp \ $(SRC_DIR)/support.cpp \ $(SRC_DIR)/waypoint.cpp \ -C_OPT_FLAGS = -O3 -DNDEBUG=1 -fno-exceptions -fno-rtti -funroll-loops -fomit-frame-pointer -pipe +C_OPT_FLAGS = -O3 -DNDEBUG=1 -fno-exceptions -fno-rtti -funroll-loops -fomit-frame-pointer -pipe -mtune=native C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3 C_GCC4_FLAGS = -fvisibility=hidden CPP_GCC4_FLAGS = -fvisibility-inlines-hidden @@ -50,10 +50,10 @@ else LINK += -shared endif -LINK += -m32 -lm -ldl +LINK += -m32 -lm -ldl -lsupc++ -CFLAGS += -DHAVE_STDINT_H -D__extern_always_inline=inline -D_strdup=strdup -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp -fno-strict-aliasing -m32 -Wall -Werror -Wno-uninitialized -Wno-unused -Wno-switch -Wno-c++11-compat-deprecated-writable-strings -CPPFLAGS += -Wno-invalid-offsetof -fno-exceptions -fno-rtti +CFLAGS += -DHAVE_STDINT_H -D__extern_always_inline=inline -D_strdup=strdup -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp -fno-strict-aliasing -m32 -Wall -Werror -Wextra -pedantic -Wno-c++11-long-long +CPPFLAGS += -fno-exceptions -fno-rtti -fno-builtin BINARY = $(PROJECT).$(LIB_EXT) @@ -72,30 +72,10 @@ endif IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0") ifeq "$(IS_CLANG)" "1" - CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/") - CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/") -else - CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1) - CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3) -endif - -# Clang || GCC >= 4 -ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1" CFLAGS += $(C_GCC4_FLAGS) CPPFLAGS += $(CPP_GCC4_FLAGS) endif -ifeq "$(IS_CLANG)" "1" - CFLAGS += -Wno-logical-op-parentheses -else - CFLAGS += -Wno-parentheses -endif - -# Clang >= 3 || GCC >= 4.7 -ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1" - CFLAGS += -Wno-delete-non-virtual-dtor -endif - # OS is Linux and not using clang ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1" LINK += -static-libgcc @@ -142,3 +122,4 @@ default: all clean: rm -rf release rm -rf debug + diff --git a/source/Android.mk b/source/Android.mk index 1df9193..671dcf4 100644 --- a/source/Android.mk +++ b/source/Android.mk @@ -28,7 +28,7 @@ LOCAL_SRC_FILES := \ support.cpp \ waypoint.cpp \ -LOCAL_CFLAGS += -O2 -DLINUX -D_LINUX -DPOSIX -DHAVE_STDINT_H -D__extern_always_inline=inline -D_strdup=strdup -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp -fno-strict-aliasing -Wall -Werror -Wno-uninitialized -Wno-unused -Wno-switch -Wno-c++11-compat-deprecated-writable-strings -LOCAL_CPPFLAGS += -w -Wno-invalid-offsetof -fno-exceptions -fno-rtti +LOCAL_CFLAGS += -O2 -DLINUX -D_LINUX -DPOSIX -DHAVE_STDINT_H -D__extern_always_inline=inline -D_strdup=strdup -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp -fno-strict-aliasing -Wall -Werror +LOCAL_CPPFLAGS += -w -fno-exceptions -fno-rtti include $(BUILD_SHARED_LIBRARY) diff --git a/source/engine.cpp b/source/engine.cpp index f05e5c6..f77db7d 100644 --- a/source/engine.cpp +++ b/source/engine.cpp @@ -59,8 +59,8 @@ void Engine::Printf (const char *fmt, ...) vsnprintf (string, SIZEOF_CHAR (string), TraslateMessage (fmt), ap); va_end (ap); + strcat (string, "\n"); g_engfuncs.pfnServerPrint (string); - g_engfuncs.pfnServerPrint ("\n"); } void Engine::ChatPrintf (const char *fmt, ...) diff --git a/source/interface.cpp b/source/interface.cpp index 05754cc..75671b4 100644 --- a/source/interface.cpp +++ b/source/interface.cpp @@ -485,12 +485,12 @@ MemoryFile::MF_Unloader MemoryFile::Unloader = NULL; void InitConfig (void) { - // assign engine loaders to memoryfile handler - if (MemoryFile::Loader == NULL || MemoryFile::Unloader == NULL) + if (!MemoryFile::Loader && !MemoryFile::Unloader) { MemoryFile::Loader = reinterpret_cast (g_engfuncs.pfnLoadFileForMe); MemoryFile::Unloader = reinterpret_cast (g_engfuncs.pfnFreeFile); } + MemoryFile fp; char line[512]; diff --git a/source/waypoint.cpp b/source/waypoint.cpp index 1f8040d..3e2f9da 100644 --- a/source/waypoint.cpp +++ b/source/waypoint.cpp @@ -1056,7 +1056,7 @@ void Waypoint::InitTypes (void) bool Waypoint::Load (void) { - File fp (CheckSubfolderFile (), "rb"); + MemoryFile fp (CheckSubfolderFile ()); WaypointHeader header; memset (&header, 0, sizeof (header));