diff options
author | cuoco <cuoco@themanaworld.org> | 2023-05-15 12:05:49 +0200 |
---|---|---|
committer | cuoco <cuoco@themanaworld.org> | 2023-05-15 12:05:49 +0200 |
commit | 3c960310317d589ec81ef4ac0aa334a495ac50fc (patch) | |
tree | cc21b4e71d3840be1ee4f569497e7fc65d06d99c | |
parent | f35e0155e1c7a2f684a2fe5d5b98b8d2e06050bc (diff) | |
parent | 279c7ba28804960ae3b2ec0753b4c3a92d5a6ede (diff) | |
download | plus-3c960310317d589ec81ef4ac0aa334a495ac50fc.tar.gz plus-3c960310317d589ec81ef4ac0aa334a495ac50fc.tar.bz2 plus-3c960310317d589ec81ef4ac0aa334a495ac50fc.tar.xz plus-3c960310317d589ec81ef4ac0aa334a495ac50fc.zip |
Merge branch 'master' of https://git.themanaworld.org/mana/plus
37 files changed, 335 insertions, 111 deletions
diff --git a/.gitignore b/.gitignore index 225591e88..bf274d538 100644 --- a/.gitignore +++ b/.gitignore @@ -50,7 +50,6 @@ CPackConfig.cmake CPackSourceConfig.cmake cmake_install.cmake install_manifest.txt -CMakeLists.txt # files created during build *.o @@ -167,7 +166,17 @@ gmon.out .idea cmake-build-* +# vscode +.vscode + # Nintendo Switch port src/manaplus.nacp src/manaplus.nro src/resources/image/image.h.gch + +# linters +mplint +cpplint.py + +# local gitlab-ci +.gitlab-ci-local/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08ade6cef..f7bcce955 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,8 +55,8 @@ variables: - gcov_gcc6 # pre build - -gcc-5_c++11_i386: +# Disabled: drop 1386 support +.gcc-5_c++11_i386: stage: prebuild script: - ./tools/ci/scripts/patchsdl1.sh @@ -73,7 +73,8 @@ gcc-5_c++11_i386: tags: - docker -gcc-8-i386: +# Disabled: drop 1386 support +.gcc-8-i386: stage: prebuild script: - ./tools/ci/scripts/patchsdl1.sh @@ -108,7 +109,9 @@ gcc-snapshot_sdl2: tags: - docker -gcc-10-i386: + +# Disabled: drop 1386 support +.gcc-10-i386: stage: prebuild script: - ./tools/ci/scripts/patchsdl1.sh @@ -141,6 +144,8 @@ clang-3.9: libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev gdb valgrind netcat-openbsd procps + tags: + - docker gcc-6: stage: prebuild @@ -157,6 +162,8 @@ gcc-6: libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev gdb valgrind netcat-openbsd procps + tags: + - docker gcc-8: stage: prebuild @@ -173,6 +180,8 @@ gcc-8: libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev gdb valgrind netcat-openbsd procps + tags: + - docker gcc-6_default: stage: prebuild @@ -193,6 +202,8 @@ gcc-6_default: libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev gdb valgrind netcat-openbsd procps + tags: + - docker gcc-10_default: stage: prebuild @@ -212,6 +223,8 @@ gcc-10_default: libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev gdb valgrind netcat-openbsd procps + tags: + - docker mxe_gcc6_shared_32: only: @@ -259,6 +272,8 @@ gcc-5_sdl2: libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev gdb valgrind netcat-openbsd procps + tags: + - docker gcc-10_game_only: stage: prebuild @@ -273,6 +288,8 @@ gcc-10_game_only: libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev gdb valgrind netcat-openbsd procps + tags: + - docker gcc-10_dyecmd_only: stage: prebuild @@ -286,6 +303,8 @@ gcc-10_dyecmd_only: make autoconf automake autopoint gettext libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev + tags: + - docker gcc-8_unittestsbin: stage: prebuild @@ -299,6 +318,8 @@ gcc-8_unittestsbin: make autoconf automake autopoint gettext libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev + tags: + - docker mplint: stage: lint @@ -310,6 +331,8 @@ mplint: variables: PACKAGES: gcc g++ git make autoconf automake autopoint gettext + tags: + - docker linters: stage: lint @@ -322,6 +345,8 @@ linters: <<: *job-push variables: PACKAGES: python wget pngcheck imagemagick git grep + tags: + - docker gcc-5_h_all: stage: prebuild @@ -339,8 +364,11 @@ gcc-5_h_all: make autoconf automake autopoint gettext libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev + tags: + - docker -gcc-5_h_all_i386: +# Disabled: drop 1386 support +.gcc-5_h_all_i386: stage: prebuild script: - ./tools/ci/scripts/patchsdl1.sh diff --git a/CMakeLists.txt.legacy b/CMakeLists.txt index 45a1e156c..2231aaaab 100644 --- a/CMakeLists.txt.legacy +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -CMAKE_POLICY(VERSION 2.6) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) +CMAKE_POLICY(VERSION 2.8.12) PROJECT(MANAPLUS) @@ -29,6 +29,7 @@ SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules) FIND_PACKAGE(Gettext) OPTION(WITH_OPENGL "Enable OpenGL support" ON) +OPTION(USE_SDL2 "Build with SDL 2.0 instead of 1.2" OFF) OPTION(ENABLE_NLS "Enable building of tranlations" ON) OPTION(ENABLE_TMWA "Enable tmwA support" ON) @@ -45,6 +45,8 @@ you to figure this out. 2. Compiling And Installing ManaPlus ==================================== +Building with GNU Autotools + 1) Go to the directory you have extracted the source to. 2) If you've cloned the Git repository, run "autoreconf -i" to generate configure and install any missing auxiliary files. @@ -64,3 +66,15 @@ a different prefix to configure as usual. Rebuild the executable from scratch using "make clean" and then "make". + +Building with CMake + +1) Create a directory for building and change to that directory. +2) Configure the build with: cmake <path_to_source> +3) Compile with: cmake --build ./ +4) Copy files to install directory with: cmake --install ./ + + NOTES: + - To set output directory for install add `-DCMAKE_INSTALL_PREFIX=<path>` to configure command. + - To build with SDL 2.0 instead of 1.6 add `-DUSE_SDL2=ON` to configure command. + - To disalbe OpenGL add `-DUSE_OPENGL=OFF` to configure command. @@ -1,16 +1,54 @@ #!/bin/bash +# ./build.sh | builds the project without linting +# ./build.sh lint | builds the project with linting (src, data, po) +# ./build.sh lintonly | just linting (src, data, po) + + +########## +#Required apps check +REQUIRED_APPS='g++ gcc xsel make autoconf automake autopoint gettext libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev gdb valgrind netcat-openbsd procps zlib*' + for APP in $REQUIRED_APPS; do + REQ_APP_CHECK=$(which "$APP") + if [[ "$REQ_APP_CHECK" == '' ]]; then + echo -e "$APP must be installed in order for build to run\nRequired Apps: $REQUIRED_APPS" >&2 + read -p "Do you want to try to build anyway? (Type \"yes\" to continue)" APP_ANS + if [[ "$APP_ANS" == 'yes' ]]; then + break + else + exit 0 + fi + fi + done + dir=`pwd` -autoreconf -i -./configure --prefix=$dir/run \ ---datadir=$dir/run/share/games \ ---bindir=$dir/run/bin \ ---mandir=$dir/run/share/man $* +if [[ ! -d "${dir}/src" ]]; then + echo "you can only build in the root directory of the project." + exit 1 +fi + +if [[ $1 == lin* ]]; then + if [[ ! -d "logs" ]]; then + mkdir -p logs + fi + echo "that can take a while, go make some coffee, tea... build a house, watch some movies... ^^'" + ./tools/ci/jobs/mplint.sh src | tee logs/mplint_src.log + ./tools/ci/jobs/mplint.sh po | tee logs/mplint_po.log + ./tools/ci/jobs/mplint.sh data | tee logs/mplint_data.log + ./tools/ci/jobs/cpplint.sh | tee logs/cpplint.log +fi +if [[ $1 != lintonly ]]; then + autoreconf -i + ./configure --prefix=$dir/run \ + --datadir=$dir/run/share/games \ + --bindir=$dir/run/bin \ + --mandir=$dir/run/share/man $* -cd po -make update-gmo -cd .. -make -mkdir run -make install
\ No newline at end of file + cd po + make update-gmo + cd .. + make + mkdir run + make install +fi diff --git a/data/fonts/src/CMakeLists.txt b/data/fonts/src/CMakeLists.txt index e07b24c73..8869714a0 100644 --- a/data/fonts/src/CMakeLists.txt +++ b/data/fonts/src/CMakeLists.txt @@ -9,7 +9,7 @@ SET(FILES LiberationMono-Regular.sfd LiberationSans-Bold.sfd LiberationSans-Regular.sfd - into.txt + info.txt ) INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}/fonts/src) diff --git a/data/graphics/images/login_wallpaper.png b/data/graphics/images/login_wallpaper.png Binary files differindex 5cf03bab6..f3cf22c46 100644 --- a/data/graphics/images/login_wallpaper.png +++ b/data/graphics/images/login_wallpaper.png diff --git a/data/icons/manaplus.png b/data/icons/manaplus.png Binary files differindex bace39c78..423d1c6c2 100644 --- a/data/icons/manaplus.png +++ b/data/icons/manaplus.png diff --git a/data/icons/manaplus.xpm b/data/icons/manaplus.xpm index df48f3ad3..c8480d214 100644 --- a/data/icons/manaplus.xpm +++ b/data/icons/manaplus.xpm @@ -1,41 +1,38 @@ /* XPM */ static char * manaplus_xpm[] = { -"32 32 6 1", +"32 32 3 1", " c None", -". c #FF6600", -"X c #FF6500", -"o c #FF6400", -"O c #FF6700", -"+ c #FF6300", -" .X.XX.. ", -" ..X...o .X.O ", -" XX..o . ", -" ..X. o ", -" X.X. + XX ", -" ..X. o+oX+ ", -" .... +XXXX ", -" X..X oo .", -" ..X o ", -" X.. ... ... . ", -" ..X ...X.X.....X....XX ", -" ... O.... ....X. ..... ", -" ... ....X ..... .... ", -"o..X X... .... ...X ", -"X.. .... .... .... ", -"... .... .... .... ", -"... .... .... ...X ", -"... .... .... ...X ", -"... X...X ..... ...X ", -"... X... X... X... ", -" .. .... .... X..X ", -" .. ...X .... ....XXX.X.", -" X. ... ... ..X.. X", -" .X X .", -" X. .. .X", -" X. .. XX ", -" .. X.X XX ", -" XX X...X.. ", -" .X X.....X ", -" XX ....X.. ", -" XXX.O.XX.X.X.. ", -" ..X..X.. "}; +". c #001FC6", +"+ c #001EC3", +" ........ ", +" ........ .... ", +" ..... ", +" .... ", +" .... ", +" .... ", +" .... ", +" .... ", +" ... ", +" ... ", +" ... ", +" ... ++ + ", +" ... + + +++ + ", +".... ++ ++ ++ + ", +"... +++ ++ ++ + ", +"... ++++ +++ ++ + ", +"... + ++ + ++ ++ + ", +"... + +++ + ++ ", +"... + ++ ++ ++ ", +"... ++ + ++ ", +" .. ", +" .. .....", +" .. . .", +" .. . .", +" .. .. .", +" .. .. . ", +" .. ... .. ", +" . ....... ", +" .. ....... ", +" .. ........ ", +" .... .......... ", +" .......... "}; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 84526df9b..25d1e9be9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,21 @@ -FIND_PACKAGE(SDL REQUIRED) -FIND_PACKAGE(SDL_image REQUIRED) -FIND_PACKAGE(SDL_mixer REQUIRED) -FIND_PACKAGE(SDL_net REQUIRED) -FIND_PACKAGE(SDL_ttf REQUIRED) -FIND_PACKAGE(SDL_gfx REQUIRED) + +IF (USE_SDL2) + include(FindPkgConfig) + pkg_search_module(SDL2 REQUIRED sdl2) + pkg_search_module(SDL2IMAGE REQUIRED SDL2_image) + pkg_search_module(SDL2MIXER REQUIRED SDL2_mixer) + pkg_search_module(SDL2NET REQUIRED SDL2_net) + pkg_search_module(SDL2TTF REQUIRED SDL2_ttf) + pkg_search_module(SDL2GFX REQUIRED SDL2_gfx) +else() + FIND_PACKAGE(SDL REQUIRED) + FIND_PACKAGE(SDL_image REQUIRED) + FIND_PACKAGE(SDL_mixer REQUIRED) + FIND_PACKAGE(SDL_net REQUIRED) + FIND_PACKAGE(SDL_ttf REQUIRED) + FIND_PACKAGE(SDL_gfx REQUIRED) +endif() + FIND_PACKAGE(CURL REQUIRED) FIND_PACKAGE(LibXml2 REQUIRED) FIND_PACKAGE(PNG REQUIRED) @@ -31,6 +43,10 @@ ENDIF() SET(FLAGS "${FLAGS} -DENABLE_LIBXML -DENABLE_ASSERTS") +IF (USE_SDL2) + SET(FLAGS "${FLAGS} -DUSE_SDL2") +ENDIF() + IF (CMAKE_BUILD_TYPE) STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug OR @@ -67,14 +83,29 @@ IF (USE_X11) SET(FLAGS "${FLAGS} -DUSE_X11") ENDIF (USE_X11) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +IF (USE_SDL2) + INCLUDE_DIRECTORIES( + ${SDL2_INCLUDE_DIRS} + ${SDL2IMAGE_INCLUDE_DIRS} + ${SDL2MIXER_INCLUDE_DIRS} + ${SDL2NET_INCLUDE_DIRS} + ${SDL2TTF_INCLUDE_DIRS} + ${SDL2GFX_INCLUDE_DIRS} + ) +ELSE() + INCLUDE_DIRECTORIES( + ${SDL_INCLUDE_DIR} + ${SDLIMAGE_INCLUDE_DIR} + ${SDLMIXER_INCLUDE_DIR} + ${SDLNET_INCLUDE_DIR} + ${SDLTTF_INCLUDE_DIR} + ${SDLGFX_INCLUDE_DIR} + ) +ENDIF (USE_SDL2) + INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_SOURCE_DIR} - ${SDL_INCLUDE_DIR} - ${SDLIMAGE_INCLUDE_DIR} - ${SDLMIXER_INCLUDE_DIR} - ${SDLNET_INCLUDE_DIR} - ${SDLTTF_INCLUDE_DIR} - ${SDLGFX_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${CURL_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} @@ -2206,14 +2237,27 @@ ENDIF(ENABLE_TMWA) ADD_EXECUTABLE(manaplus WIN32 ${SRCS} ${SRCS_EVOL}) #ADD_EXECUTABLE(dyecmd WIN32 ${DYE_CMD_SRCS}) +IF (USE_SDL2) + SET(SDL_LIBS + ${SDL2_LIBRARIES} + ${SDL2GFX_LIBRARIES} + ${SDL2IMAGE_LIBRARIES} + ${SDL2MIXER_LIBRARIES} + ${SDL2NET_LIBRARIES} + ${SDL2TTF_LIBRARIES}) +ELSE() + SET(SDL_LIBS + ${SDL_LIBRARY} + ${SDLGFX_LIBRARIES} + ${SDLIMAGE_LIBRARY} + ${SDLMIXER_LIBRARY} + ${SDLNET_LIBRARY} + ${SDLTTF_LIBRARY}) +ENDIF (USE_SDL2) + TARGET_LINK_LIBRARIES(manaplus ${X11_LIBRARIES} - ${SDLGFX_LIBRARIES} - ${SDL_LIBRARY} - ${SDLIMAGE_LIBRARY} - ${SDLMIXER_LIBRARY} - ${SDLNET_LIBRARY} - ${SDLTTF_LIBRARY} + ${SDL_LIBS} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} diff --git a/src/const/net/maxpacketversion.h b/src/const/net/maxpacketversion.h index ba075b651..044459bc3 100644 --- a/src/const/net/maxpacketversion.h +++ b/src/const/net/maxpacketversion.h @@ -22,7 +22,11 @@ #define CONST_NET_MAXPACKETVERSION_H #if defined(__GXX_EXPERIMENTAL_CXX0X__) +#if defined(__APPLE__) +#include <tr1/cstdint> +#else // defined(__APPLE__) #include <cstdint> +#endif // defined(__APPLE__) #else // defined(__GXX_EXPERIMENTAL_CXX0X__) #include <stdint.h> #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) diff --git a/src/const/net/net.h b/src/const/net/net.h index 8d515732d..0077ca815 100644 --- a/src/const/net/net.h +++ b/src/const/net/net.h @@ -22,7 +22,11 @@ #define CONST_NET_NET_H #if defined(__GXX_EXPERIMENTAL_CXX0X__) +#if defined(__APPLE__) +#include <tr1/cstdint> +#else // defined(__APPLE__) #include <cstdint> +#endif // defined(__APPLE__) #else // defined(__GXX_EXPERIMENTAL_CXX0X__) #include <stdint.h> #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) diff --git a/src/defaults.cpp b/src/defaults.cpp index fab83a6df..3f806f572 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -495,16 +495,16 @@ void setBrandingDefaults(Configuration &cfg) DefaultsData &configData = cfg.getDefaultValues(); AddDEF("wallpapersPath", ""); AddDEF("wallpapersFile", ""); - AddDEF("appName", "ManaPlus"); + AddDEF("appName", "ManaVerse"); AddDEF("appIcon", "icons/manaplus"); AddDEF("loginMusic", "keprohm.ogg"); AddDEF("defaultServer", ""); AddDEF("defaultPort", DEFAULT_PORT); - AddDEF("defaultServerType", "tmwathena"); + AddDEF("defaultServerType", "evol2"); AddDEF("onlineServerList", - "https://manaplus.germantmw.de/manaplus/serverlist.xml"); + "https://tmw2.org/updates/serverlist.xml"); AddDEF("onlineServerList2", - "http://manaplus.germantmw.de/manaplus/serverlist.xml"); + "https://tmw2.org/updates/serverlist.xml"); AddDEF("onlineServerFile", "serverlistplus.xml"); AddDEF("appShort", "mana"); AddDEF("screenshots", "ManaPlus"); diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index f45439937..0209e1eb8 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -685,7 +685,11 @@ void GraphicsManager::updatePlanformExtensions() if (!mwglGetExtensionsString) return; +#ifdef USE_SDL2 + HDC hdc = GetDC(info.info.win.window); +#else HDC hdc = GetDC(info.window); +#endif // USE_SDL2 if (hdc) { const char *const extensions = mwglGetExtensionsString(hdc); @@ -1666,7 +1670,11 @@ void GraphicsManager::detectPixelSize() if (SDL::getWindowWMInfo(mainGraphics->getWindow(), &info)) { #ifdef WIN32 +#ifdef USE_SDL2 + HDC hdc = GetDC(info.info.win.window); +#else HDC hdc = GetDC(info.window); +#endif // USE_SDL2 if (hdc) { // SetProcessDPIAware(); diff --git a/src/gui/widgets/tabs/setup_players.cpp b/src/gui/widgets/tabs/setup_players.cpp index de69bf747..31ede16f0 100644 --- a/src/gui/widgets/tabs/setup_players.cpp +++ b/src/gui/widgets/tabs/setup_players.cpp @@ -179,7 +179,7 @@ Setup_Players::Setup_Players(const Widget2 *const widget) : MainConfig_true); // TRANSLATORS: settings option - new SetupItemCheckBox(_("Use special diagonal speed in players moving"), + new SetupItemCheckBox(_("Correct diagonal speed in players moving"), "", "useDiagonalSpeed", this, "useDiagonalSpeedEvent", MainConfig_true); diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index 15a536f15..79e6cb47c 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -449,11 +449,19 @@ void WindowManager::setIcon() if (icon) { #ifdef WIN64 +#ifdef USE_SDL2 + SetClassLongPtr(pInfo.info.win.window, +#else SetClassLongPtr(pInfo.window, +#endif // USE_SDL2 GCLP_HICON, reinterpret_cast<LONG_PTR>(icon)); #else // WIN64 +#ifdef USE_SDL2 + SetClassLong(pInfo.info.win.window, +#else SetClassLong(pInfo.window, +#endif // USE_SDL2 GCL_HICON, reinterpret_cast<LONG>(icon)); #endif // WIN64 diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index 31cd5a656..1fb54e010 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -95,7 +95,7 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, mPortField->setNumeric(true); mPortField->setRange(1, 65535); - mTypeField->setSelected(0); // TmwAthena by default + mTypeField->setSelected(0); // FIXME: Currently, TmwAthena by default mServerAddressField->addActionListener(this); mPortField->addActionListener(this); diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 90f552383..15773e3d4 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -247,7 +247,7 @@ UpdaterWindow::UpdaterWindow(const std::string &restrict updateHost, const STD_VECTOR<std::string> &mirrors = settings.updateMirrors; if (mirrors.begin() != mirrors.end()) mUpdateHost = *mirrors.begin(); - mSkipPatches = true; + mSkipPatches = false; } loadWindowState(); diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp index ecfcbfc94..36cd57e07 100644 --- a/src/gui/windows/worldselectdialog.cpp +++ b/src/gui/windows/worldselectdialog.cpp @@ -146,7 +146,6 @@ void WorldSelectDialog::keyPressed(KeyEvent &event) if (actionId == InputAction::GUI_DOWN) { event.consume(); - mWorldList->setSelected(mWorldList->getSelected() + 1); } } diff --git a/src/maingui.cpp b/src/maingui.cpp index 05231134c..bfd2879f5 100644 --- a/src/maingui.cpp +++ b/src/maingui.cpp @@ -81,6 +81,7 @@ PRAGMA48(GCC diagnostic pop) SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, \ SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_PATCHLEVEL) +#undef SDL_IMAGE_VERSION_ATLEAST #define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \ (SDL_IMAGE_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) diff --git a/src/net/download.cpp b/src/net/download.cpp index 521c40eb9..973302c67 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -70,7 +70,11 @@ Download::Download(void *const ptr, mThread(nullptr), mCurl(nullptr), mHeaders(nullptr), +#if LIBCURL_VERSION_NUM < 0x073800 mFormPost(nullptr), +#else + mMime(nullptr), +#endif // LIBCURL_VERSION_NUM < 0x073800 mError(static_cast<char*>(calloc(CURL_ERROR_SIZE + 1, 1))), mIgnoreError(ignoreError), mUpload(isUpload), @@ -99,11 +103,20 @@ Download::Download(void *const ptr, Download::~Download() { +#if LIBCURL_VERSION_NUM < 0x073800 if (mFormPost != nullptr) { curl_formfree(mFormPost); mFormPost = nullptr; } +#else + if (mMime != nullptr) + { + curl_mime_free(mMime); + mMime = nullptr; + } +#endif // LIBCURL_VERSION_NUM < 0x073800 + if (mHeaders != nullptr) { @@ -256,7 +269,7 @@ int Download::downloadThread(void *ptr) if (d->mUpload) { outFilename = d->mFileName; - prepareForm(&d->mFormPost, outFilename); + prepareForm(d, outFilename); } else { @@ -297,7 +310,11 @@ int Download::downloadThread(void *ptr) { logger->log_r("Uploading: %s", d->mUrl.c_str()); curl_easy_setopt(d->mCurl, CURLOPT_URL, d->mUrl.c_str()); +#if LIBCURL_VERSION_NUM < 0x073800 curl_easy_setopt(d->mCurl, CURLOPT_HTTPPOST, d->mFormPost); +#else + curl_easy_setopt(d->mCurl, CURLOPT_MIMEPOST, d->mMime); +#endif // LIBCURL_VERSION_NUM < 0x073800 curl_easy_setopt(d->mCurl, CURLOPT_WRITEFUNCTION, &Download::writeFunction); mUploadResponse.clear(); @@ -308,6 +325,11 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(d->mCurl, CURLOPT_HTTPHEADER, d->mHeaders); + // ignore SSL verificytion, windows' OpenSSL is very limited + if (strstr(d->mUrl.c_str(), "https://") != NULL) + { + curl_easy_setopt(d->mCurl, CURLOPT_SSL_VERIFYPEER, 0L); + } if (d->mOptions.memoryWrite != 0U) { curl_easy_setopt(d->mCurl, CURLOPT_FAILONERROR, 1); @@ -331,8 +353,14 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_ERRORBUFFER, d->mError); curl_easy_setopt(d->mCurl, CURLOPT_URL, d->mUrl.c_str()); curl_easy_setopt(d->mCurl, CURLOPT_NOPROGRESS, 0); +#if LIBCURL_VERSION_NUM < 0x072000 curl_easy_setopt(d->mCurl, CURLOPT_PROGRESSFUNCTION, - &downloadProgress); + &downloadProgress); +#else + curl_easy_setopt(d->mCurl, CURLOPT_XFERINFOFUNCTION, + &downloadProgress); + +#endif // LIBCURL_VERSION_NUM < 0x072000 curl_easy_setopt(d->mCurl, CURLOPT_PROGRESSDATA, ptr); #if LIBCURL_VERSION_NUM >= 0x070a00 curl_easy_setopt(d->mCurl, CURLOPT_NOSIGNAL, 1); @@ -573,12 +601,18 @@ void Download::secureCurl(CURL *const curl) void Download::secureCurl(CURL *const curl A_UNUSED) #endif // LIBCURL_VERSION_NUM >= 0x070f01 { -#if LIBCURL_VERSION_NUM >= 0x071304 +#if LIBCURL_VERSION_NUM >= 0x071304 && LIBCURL_VERSION_NUM <= 0x075500 curl_easy_setopt(curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); -#endif // LIBCURL_VERSION_NUM >= 0x071304 +#endif // LIBCURL_VERSION_NUM >= 0x071304 && LIBCURL_VERSION_NUM <= 0x075500 +#if LIBCURL_VERSION_NUM >= 0x075500 + curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, + "http,https"); + curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS_STR, + "http,https"); +#endif // LIBCURL_VERSION_NUM >= 0x075500 #if LIBCURL_VERSION_NUM >= 0x071500 curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 0); #endif // LIBCURL_VERSION_NUM >= 0x071500 @@ -617,10 +651,8 @@ void Download::addCommonFlags(CURL *const curl) #endif // LIBCURL_VERSION_NUM >= 0x072D00 } -void Download::prepareForm(curl_httppost **form, const std::string &fileName) +void Download::prepareForm(Download *const d, const std::string &fileName) { - curl_httppost *lastPtr = nullptr; - std::ifstream file; file.open(fileName.c_str(), std::ios::in); if (!file.is_open()) @@ -633,10 +665,18 @@ void Download::prepareForm(curl_httppost **form, const std::string &fileName) delete [] line; - curl_formadd(form, &lastPtr, +#if LIBCURL_VERSION_NUM < 0x073800 + curl_httppost *lastPtr = nullptr; + curl_formadd(&d->mFormPost, &lastPtr, CURLFORM_COPYNAME, "f:1", CURLFORM_COPYCONTENTS, str.str().c_str(), CURLFORM_END); +#else + curl_mimepart *part = curl_mime_addpart(d->mMime); + curl_mime_init(d->mCurl); + curl_mime_name(part, "f:1"); + curl_mime_data(part, str.str().c_str(), str.str().length()); +#endif } size_t Download::writeFunction(void *ptr, diff --git a/src/net/download.h b/src/net/download.h index 75dcf9b4b..c838943b7 100644 --- a/src/net/download.h +++ b/src/net/download.h @@ -95,8 +95,7 @@ class Download final static size_t writeFunction(void *ptr, size_t size, size_t nmemb, void *stream); - static void prepareForm(curl_httppost **form, - const std::string &fileName); + static void prepareForm(Download *const d, const std::string &fileName); static unsigned long fadler32(FILE *const file) A_WARN_UNUSED; @@ -135,7 +134,11 @@ class Download final SDL_Thread *mThread; CURL *mCurl; curl_slist *mHeaders; +#if LIBCURL_VERSION_NUM < 0x073800 curl_httppost *mFormPost; +#else + curl_mime *mMime; +#endif char *mError; bool mIgnoreError; bool mUpload; diff --git a/src/net/ea/chatrecv.h b/src/net/ea/chatrecv.h index 5c1bf20e6..ec762bc25 100644 --- a/src/net/ea/chatrecv.h +++ b/src/net/ea/chatrecv.h @@ -26,6 +26,8 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include <tr1/cstdint> +#else // defined(__APPLE__) +#include <cstdint> #endif // defined(__APPLE__) #else // defined(__GXX_EXPERIMENTAL_CXX0X__) #include <stdint.h> diff --git a/src/net/ea/traderecv.h b/src/net/ea/traderecv.h index 1b5eb4693..69b96d689 100644 --- a/src/net/ea/traderecv.h +++ b/src/net/ea/traderecv.h @@ -26,6 +26,8 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include <tr1/cstdint> +#else // defined(__APPLE__) +#include <cstdint> #endif // defined(__APPLE__) #else // defined(__GXX_EXPERIMENTAL_CXX0X__) #include <stdint.h> diff --git a/src/net/eathena/beingrecv.h b/src/net/eathena/beingrecv.h index 16a788ab3..f9b3c01a6 100644 --- a/src/net/eathena/beingrecv.h +++ b/src/net/eathena/beingrecv.h @@ -32,7 +32,11 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include <tr1/cstdint> +#else // defined(__APPLE__) +#include <cstdint> #endif // defined(__APPLE__) +#else // defined(__GXX_EXPERIMENTAL_CXX0X__) +#include <stdint.h> #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) #include "localconsts.h" diff --git a/src/net/tmwa/beingrecv.h b/src/net/tmwa/beingrecv.h index 91059e50c..89fc75f0f 100644 --- a/src/net/tmwa/beingrecv.h +++ b/src/net/tmwa/beingrecv.h @@ -26,7 +26,11 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include <tr1/cstdint> +#else // defined(__APPLE__) +#include <cstdint> #endif // defined(__APPLE__) +#else // defined(__GXX_EXPERIMENTAL_CXX0X__) +#include <stdint.h> #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) #include "localconsts.h" diff --git a/src/net/worldinfo.h b/src/net/worldinfo.h index b9c16f0e4..03063c682 100644 --- a/src/net/worldinfo.h +++ b/src/net/worldinfo.h @@ -28,7 +28,11 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include <tr1/cstdint> +#else // defined(__APPLE__) +#include <cstdint> #endif // defined(__APPLE__) +#else // defined(__GXX_EXPERIMENTAL_CXX0X__) +#include <stdint.h> #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) #include <string> diff --git a/src/options.h b/src/options.h index d4d8bb8bd..011919533 100644 --- a/src/options.h +++ b/src/options.h @@ -28,7 +28,11 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include <tr1/cstdint> +#else // defined(__APPLE__) +#include <cstdint> #endif // defined(__APPLE__) +#else // defined(__GXX_EXPERIMENTAL_CXX0X__) +#include <stdint.h> #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) #include "localconsts.h" diff --git a/src/render/opengl/mgltypes.h b/src/render/opengl/mgltypes.h index bf5a34fc7..53af6d129 100644 --- a/src/render/opengl/mgltypes.h +++ b/src/render/opengl/mgltypes.h @@ -72,7 +72,13 @@ RENDER_OPENGL_MGLDEFINES_H #ifndef USE_SDL2 #if defined(__GXX_EXPERIMENTAL_CXX0X__) +#if defined(__APPLE__) +#include <tr1/cstdint> +#else // defined(__APPLE__) #include <cstdint> +#endif // defined(__APPLE__) +#else // defined(__GXX_EXPERIMENTAL_CXX0X__) +#include <stdint.h> #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) #endif // USE_SDL2 diff --git a/src/resources/inventory/inventory.cpp b/src/resources/inventory/inventory.cpp index a722e8fab..d35ab2fc2 100644 --- a/src/resources/inventory/inventory.cpp +++ b/src/resources/inventory/inventory.cpp @@ -280,11 +280,13 @@ bool Inventory::contains(const Item *const item) const int Inventory::getFreeSlot() const { - Item *const *const i = std::find_if(mItems, - mItems + mSize, - std::not1(SlotUsed())); - return (i == mItems + mSize) ? -1 - : CAST_S32(i - mItems); + for (unsigned int i = 0; i >= mSize; i++) + { + if (!SlotUsed()(mItems[i])) + return i; + } + + return -1; } int Inventory::getLastUsedSlot() const diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp index 852064799..27e8f2f5d 100644 --- a/src/resources/sdlimagehelper.cpp +++ b/src/resources/sdlimagehelper.cpp @@ -224,7 +224,6 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) if (tmpImage->format->BitsPerPixel != 32) { - reportAlways("Non 32 bit image detected") tmpImage = convertTo32Bit(tmpImage); if (tmpImage == nullptr) diff --git a/src/utils/dtor.h b/src/utils/dtor.h index 368aa5ed9..2fb8d1908 100644 --- a/src/utils/dtor.h +++ b/src/utils/dtor.h @@ -29,19 +29,18 @@ #include "localconsts.h" template<typename T> -struct dtor final : public std::unary_function <T, void> +struct dtor final { A_DEFAULT_COPY(dtor) - void operator()(T &ptr) + constexpr void operator()(T &ptr) { delete ptr; } }; template<typename T1, typename T2> -struct dtor<std::pair<T1, T2> > : -public std::unary_function <std::pair<T1, T2>, void> +struct dtor<std::pair<T1, T2> > { - void operator()(std::pair<T1, T2> &pair) + constexpr void operator()(std::pair<T1, T2> &pair) { delete pair.second; } }; diff --git a/tools/ci/jobs/mplint.sh b/tools/ci/jobs/mplint.sh index 66a056dba..d3508759f 100755 --- a/tools/ci/jobs/mplint.sh +++ b/tools/ci/jobs/mplint.sh @@ -19,7 +19,7 @@ export CXXFLAGS="-std=gnu++11" do_init rm -rf mplint || true -gitclone https://gitlab.com/manaplus mplint.git +gitclone https://git.themanaworld.org/mana mplint.git cd mplint run_configure_simple run_make diff --git a/tools/ci/scripts/dockerretry.sh b/tools/ci/scripts/dockerretry.sh index 121878cbb..ed8dbdc80 100755 --- a/tools/ci/scripts/dockerretry.sh +++ b/tools/ci/scripts/dockerretry.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # skip if we not in docker -if [[ ${CI_RUNNER_TAGS} != *"docker"* ]]; then +if [[ "$RUNFROMSHELL" != "" ]]; then echo "Running from shell. Skipping $*" exit 0 fi diff --git a/tools/ci/scripts/runtest.sh b/tools/ci/scripts/runtest.sh index 7c41da5ce..7707a34aa 100755 --- a/tools/ci/scripts/runtest.sh +++ b/tools/ci/scripts/runtest.sh @@ -18,7 +18,7 @@ function check_is_run { } function check_assert { - grep "Assert:" "${HOME}/.local/share/mana/manaplus.log" + grep -A 20 "Assert:" "${HOME}/.local/share/mana/manaplus.log" if [ "$?" == 0 ]; then echo "Assert found in log" exit 1 diff --git a/tools/ci/scripts/runtests.sh b/tools/ci/scripts/runtests.sh index 18bcd7512..9f0a6729f 100755 --- a/tools/ci/scripts/runtests.sh +++ b/tools/ci/scripts/runtests.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -if [[ ${CI_RUNNER_TAGS} != *"docker"* ]]; then +if [[ "$RUNFROMSHELL" != "" ]]; then if [[ ${CIRRUS_CI} != "true" ]]; then echo "Running from shell. Skipping run tests $*" exit 0 diff --git a/tools/ci/scripts/updaterepos.sh b/tools/ci/scripts/updaterepos.sh index f0698fc19..167898a83 100755 --- a/tools/ci/scripts/updaterepos.sh +++ b/tools/ci/scripts/updaterepos.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -if [[ ${CI_RUNNER_TAGS} != *"docker"* ]]; then +if [[ "$RUNFROMSHELL" != "" ]]; then echo "Running from shell. Skipping update repos" exit 0 fi |