diff --git a/CMakeLists.txt b/CMakeLists.txt index 61826a163c9..10223edf5a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -497,7 +497,7 @@ if(TARGET_OS STREQUAL "android") find_package(Android) endif() find_package(ZLIB) -find_package(Crypto) +# find_package(Crypto) find_package(Curl) if(CLIENT AND VIDEORECORDER) find_package(FFMPEG) @@ -2621,7 +2621,7 @@ if(SERVER) ) # twbl start - set(TWBL_ROOT src/external/TeeworldsBotLib) + set(TWBL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/src/external/TeeworldsBotLib) add_subdirectory(${TWBL_ROOT}) include_directories(${TWBL_ROOT}/src) FILE(GLOB TWBL_SRC @@ -2631,8 +2631,50 @@ if(SERVER) ${TWBL_ROOT}/src/bots/*.h ) - add_library(twbl_bottick SHARED ${TWBL_SRC}) + add_library(twbl_bottick_lite SHARED ${TWBL_SRC}) set(SERVER_SRC ${SERVER_SRC} ${TWBL_SRC}) + # set(SERVER_SRC ${SERVER_SRC} + # ${TWBL_ROOT}/src/shared/hotreload.cpp + # ${TWBL_ROOT}/src/shared/hotreload.h + # ${TWBL_ROOT}/src/shared/types.h + # ${TWBL_ROOT}/src/bots/base.cpp + # ${TWBL_ROOT}/src/bots/base.h + # ) + + + add_library(twbl_bottick SHARED + ${SERVER_SRC} + ${TWBL_SRC} + ${ANTIBOT_SRC} + ${GAME_GENERATED_SHARED} + src/base/hash_ctxt.h + src/engine/external/md5/md5.h) + + # add_library(md5 EXCLUDE_FROM_ALL OBJECT ${DEP_MD5_SRC}) + target_link_libraries(twbl_bottick + PRIVATE + ${CRYPTO_LIBRARIES} + ${DEP_MD5_SRC} +PUBLIC + ssl + ) + + target_include_directories(twbl_bottick SYSTEM PRIVATE ${CRYPTO_INCLUDE_DIRS}) + +target_compile_definitions(twbl_bottick PRIVATE TWBL_SHARED_OBJECT=1) + + target_include_directories(twbl_bottick PRIVATE src) + target_include_directories(twbl_bottick PRIVATE ${PROJECT_BINARY_DIR}/src) + target_include_directories(twbl_bottick PRIVATE src/rust-bridge) + add_cxx_compiler_flag_if_supported(OUR_FLAGS_LINK -rdynamic) + add_cxx_compiler_flag_if_supported(OUT_FLAGS_LINK -fno-gnu-unique) + add_cxx_compiler_flag_if_supported(OUT_FLAGS_LINK -fPIC) + add_cxx_compiler_flag_if_supported(OUT_FLAGS -fno-gnu-unique) + add_cxx_compiler_flag_if_supported(OUT_FLAGS -fPIC) + target_compile_options(twbl_bottick PUBLIC -fPIC) + + # set_own_rpath(game-server) + # twbl end # Target diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index fcae2f26a20..36efa60bbaf 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -680,3 +680,4 @@ MACRO_CONFIG_INT(ClVideoRecorderFPS, cl_video_recorder_fps, 60, 1, 1000, CFGFLAG /* * Add config variables for mods below this comment to avoid merge conflicts. */ + diff --git a/src/external/TeeworldsBotLib b/src/external/TeeworldsBotLib index 3a68dfafd0d..493a6dfad7f 160000 --- a/src/external/TeeworldsBotLib +++ b/src/external/TeeworldsBotLib @@ -1 +1 @@ -Subproject commit 3a68dfafd0da75fce0c5974a2afe6e6664b57792 +Subproject commit 493a6dfad7f2a359892abd24191f38b1ef18846a diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index d2920001a0d..f622ba41f8d 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -1,12 +1,14 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ #include "character.h" +#include "base/system.h" #include "laser.h" #include "pickup.h" #include "projectile.h" #include +#include #include #include @@ -770,10 +772,16 @@ void CCharacter::Tick() if(pHandle) { BotTick(&State, &Bot); - dlclose(pHandle); + int Err = dlclose(pHandle); + if(Err) { + dbg_msg("twbl", "failed to close err=%d", Err); + } + dlerror(); } else Twbl_SampleTick(&State, &Bot); + + BotTick = nullptr; m_SavedInput.m_Direction = Bot.m_Direction;