diff options
284 files changed, 993 insertions, 551 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7f73ecab0..b2a9b639c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -160,19 +160,19 @@ variables: 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 -gcc-8: +gcc-9: stage: prebuild only: - master - image: debian:buster + image: debian:bullseye script: - ./tools/ci/scripts/patchsdl1.sh - - ./tools/ci/jobs/gcc8.sh + - ./tools/ci/jobs/gcc9.sh - ./tools/ci/scripts/runtests.sh - ./tools/ci/scripts/rundyecmd.sh <<: *job-push variables: - PACKAGES: gcc-8 g++-8 + PACKAGES: gcc-9 g++-9 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 @@ -203,7 +203,7 @@ gcc-10_default: image: debian:bullseye script: - ./tools/ci/scripts/patchsdl1.sh - - ./tools/ci/jobs/any_compiler.sh --enable-werror + - time ./tools/ci/jobs/any_compiler.sh --enable-werror - ./tools/ci/scripts/runtests.sh - ./tools/ci/scripts/rundyecmd.sh <<: *job-push @@ -306,17 +306,17 @@ gcc-5_sdl2: 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 -gcc-8_unittestsbin: +gcc-9_unittestsbin: stage: prebuild only: - master - image: debian:buster + image: debian:bullseye script: - ./tools/ci/scripts/patchsdl1.sh - - ./tools/ci/jobs/gcc8_silent.sh --enable-unittestsbin --without-gameclient --without-dyecmd + - ./tools/ci/jobs/gcc9_silent.sh --enable-unittestsbin --without-gameclient --without-dyecmd <<: *job-push variables: - PACKAGES: gcc-8 g++-8 + PACKAGES: gcc-9 g++-9 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 @@ -405,7 +405,7 @@ gcc-5_h_all: doxygen: stage: build - image: debian:buster + image: debian:bullseye script: - ./tools/ci/scripts/patchsdl1.sh - ./tools/ci/jobs/doxygen.sh @@ -423,7 +423,7 @@ pages: stage: deploy tags: - lightweight - image: debian:buster + image: debian:bullseye script: - mkdir -p public - cp -r doxygen/html/ public/doxygen/ diff --git a/CMakeLists.txt b/CMakeLists.txt index c5dd2987d..aaca9b88d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,7 @@ SET(CPACK_PACKAGE_VERSION_MAJOR ${VER_MAJOR}) SET(CPACK_PACKAGE_VERSION_MINOR ${VER_MINOR}) SET(CPACK_PACKAGE_VERSION_PATCH ${VER_RELEASE}) IF(WIN32) - SET(CPACK_NSIS_DISPLAY_NAME "ManaPlus") + SET(CPACK_NSIS_DISPLAY_NAME "ManaVerse") SET(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/data/icons/manaplus.ico") SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/packaging/windows/setup_welcome.bmp") SET(CPACK_NSIS_URL_INFO_ABOUT "https://manaverse.germantmw.de") @@ -1656,7 +1656,7 @@ add: monsters offset sort parameters. 2012-09-16 New release 1.2.9.16 fix: non cycle player select. fix: color in equipment window. -fix: fix hair color palete switching (evol). +fix: fix hair color palette switching (evol). fix: horizontal lines draw in software mode. fix: navigation commands. fix: partial items load in player selection dialog. @@ -1757,7 +1757,7 @@ fix: keys conflict in login dialog. fix: kill stats on levelup. fix: stay animation in beings without dead animation. add: player relations to whisper chat context menu. -add: per hair style own palete (evol). +add: per hair style own palette (evol). add: sittop animation (evol). add: ground top collision flag (evol). add: hide botchecker button by default. @@ -2,7 +2,7 @@ THE MANA VERSE CLIENT ===================== Builds: - ManaVerse CI: https://git.themanaworld.org/mana/plus/-/pipelines + ManaVerse CI: https://git.themanaworld.org/mana/verse/-/pipelines Windows: https://git.themanaworld.org/mana/docker-windows-builder/-/jobs/artifacts/master/browse?job=mxe_gcc5 AppImg: https://git.themanaworld.org/mana/appimg-builder/-/jobs/artifacts/master/browse?job=x86_64-AppImage deb: https://git.themanaworld.org/mana/appimg-builder/-/jobs/artifacts/master/browse?job=deb_pkg @@ -152,7 +152,7 @@ Other: Please report any issues you are having with this client. You can report them at: -- bugtracker: https://git.themanaworld.org/mana/plus/issues/ +- bugtracker: https://git.themanaworld.org/mana/verse/-/issues/ - forum: http://forums.themanaworld.org/viewforum.php?f=56 - IRC: https://web.libera.chat/?channels=themanaworld-irc - Discord https://shields.io/discord/775612630836445206.svg?label=Discord @@ -10,7 +10,7 @@ [](https://git.themanaworld.org/mana/appimg-builder/-/jobs/artifacts/master/browse?job=x86_64-AppImage) [](https://git.themanaworld.org/mana/appimg-builder/-/jobs/artifacts/master/browse?job=deb_pkg) - [](https://git.themanaworld.org/mana/plus/-/pipelines) + [](https://git.themanaworld.org/mana/verse/-/pipelines) <!-- Cicle CI: [](https://circleci.com/gh/ManaPlus/ManaPlus/tree/master) @@ -26,7 +26,7 @@ Azure CI: [ + - Coverage:  - Doxygen:  diff --git a/README.txt b/README.txt index 37efd32bd..e83a4251a 100644 --- a/README.txt +++ b/README.txt @@ -7,11 +7,11 @@ THE MANA VERSE CLIENT - See AUTHORS file for a list
Build status:
- ManaVerse CI: https://git.themanaworld.org/mana/plus/badges/master/pipeline.svg
+ ManaVerse CI: https://git.themanaworld.org/mana/verse/badges/master/pipeline.svg
Windows: https://git.themanaworld.org/mana/docker-windows-builder/badges/master/pipeline.svg
AppImg: https://git.themanaworld.org/mana/appimg-builder/badges/master/pipeline.svg
deb: https://git.themanaworld.org/mana/appimg-builder/badges/master/pipeline.svg
- Coverage: https://git.themanaworld.org/mana/plus/badges/master/coverage.svg
+ Coverage: https://git.themanaworld.org/mana/verse/badges/master/coverage.svg
Doxygen: http://stats.manaplus.org/docs/index.html
Coverity: https://scan.coverity.com/projects/manaplus
@@ -157,7 +157,7 @@ Other: If you're having issues with this client, feel free to report them to us.
You can report on forum (http://forums.themanaworld.org/viewforum.php?f=12),
-bugtracker (https://git.themanaworld.org/mana/plus/issues/) or other project
+bugtracker (https://git.themanaworld.org/mana/verse/-/issues/) or other project
networks such as IRC.
If you have feedback about a specific game that uses the ManaPlus client, be sure
diff --git a/configure.ac b/configure.ac index b6adac16b..e0d53b324 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.69]) -AC_INIT([ManaPlus], [1.0], [], [manaplus], [https://manaverse.germantmw.de]) +AC_INIT([ManaVerse], [1.0], [], [manaplus], [https://manaverse.germantmw.de]) AM_INIT_AUTOMAKE([1.9]) AC_LANG([C++]) @@ -248,7 +248,7 @@ CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags libpng`" # Checks for internationalization support AM_GNU_GETTEXT([external],[need-ngettext]) -AM_GNU_GETTEXT_VERSION([0.16.1]) +AM_GNU_GETTEXT_VERSION([0.18.2]) case "$host" in (*mingw*) @@ -367,7 +367,7 @@ if test "x$with_internalsdlgfx" = "xno"; then AC_CHECK_HEADERS(SDL2_rotozoom.h, ,) else with_internalsdlgfx=yes - AC_DEFINE(USE_INTERNALSDLGFX, 1, [Defines if ManaPlus should use internal sdlgfx2]) + AC_DEFINE(USE_INTERNALSDLGFX, 1, [Defines if ManaVerse should use internal sdlgfx2]) fi AM_CONDITIONAL(USE_INTERNALSDLGFX, test "x$with_internalsdlgfx" = xyes) diff --git a/data/translations/test/test1.po b/data/translations/test/test1.po index bc7fc452e..92736d68d 100644 --- a/data/translations/test/test1.po +++ b/data/translations/test/test1.po @@ -6434,7 +6434,7 @@ msgstr "пустой заголовок" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "Просмотр почтового сообщения" #. TRANSLATORS: mail view window button diff --git a/docs/example.manaplus b/docs/example.manaplus index 2a580463f..e39ab42d3 100644 --- a/docs/example.manaplus +++ b/docs/example.manaplus @@ -9,7 +9,7 @@ filename / path as a command line parameter --> <configuration> - <option name="appName" value="ManaPlus"/> + <option name="appName" value="ManaVerse"/> <option name="appShort" value="mana"/> <option name="appIcon" value="icons/manaplus"/> <option name="loginMusic" value="Magick - Real.ogg"/> diff --git a/manaplus.desktop b/manaplus.desktop index d225ab3b5..dd7d8069e 100644 --- a/manaplus.desktop +++ b/manaplus.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Version=1.0 -Name=ManaPlus +Name=ManaVerse Comment=A 2D MMORPG client Exec=manaplus StartupNotify=false diff --git a/manaplus.metainfo.xml b/manaplus.metainfo.xml index 1e5f5eead..54836cd97 100644 --- a/manaplus.metainfo.xml +++ b/manaplus.metainfo.xml @@ -18,7 +18,7 @@ interactive world. </p> </description> - <url type="homepage">http://manaplus.org/</url> + <url type="homepage">https://manaverse.germantmw.de/</url> <screenshots> <screenshot type="default">http://manaplus.org/_media/manaplus_screenshot_8.png</screenshot> <screenshot>http://manaplus.org/_media/manaplus_screenshot_11.png</screenshot> diff --git a/packaging/debian/copyright b/packaging/debian/copyright index 9ba604638..c9348f49b 100644 --- a/packaging/debian/copyright +++ b/packaging/debian/copyright @@ -1,6 +1,6 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: manaplus -Source: http://download.evolonline.org/manaplus/download/ +Upstream-Name: manaverse +Source: https://manaverse.germantmw.de/ Files: * Copyright: 2004-2009 The Mana World Development Team diff --git a/packaging/debian/manaplus.menu b/packaging/debian/manaplus.menu index df633b0e9..1c23f6cf5 100644 --- a/packaging/debian/manaplus.menu +++ b/packaging/debian/manaplus.menu @@ -1,5 +1,6 @@ -?package(manaplus):needs="X11" section="Games/Adventure" \ - title="ManaPlus" \ - longtitle="ManaPlus is a 2D MMORPG client." \ +?package(manaplus): \ + needs="X11" section="Games/Adventure" \ + title="ManaVerse" \ + longtitle="ManaVerse is a 2D MMORPG client." \ command="/usr/games/manaplus" \ icon="/usr/share/pixmaps/manaplus.xpm" diff --git a/packaging/openSUSE Build Service/manaplus.spec b/packaging/openSUSE Build Service/manaplus.spec index 852f6422c..434f43a45 100644 --- a/packaging/openSUSE Build Service/manaplus.spec +++ b/packaging/openSUSE Build Service/manaplus.spec @@ -4,8 +4,8 @@ Release: 1 Summary: A client for Evol Online and The Mana World: 2D MMORPG Group: Games/Other License: GPLv2+ -Url: http://manaplus.evolonline.org/ -Source0: http://download.evolonline.org/manaplus/download/%{version}/%{name}-%{version}.tar.bz2 +Url: https://manaverse.germantmw.de/ +Source0: https://git.themanaworld.org/mana/plus/-/tree/v%{version}/ BuildRoot: %{_topdir}/%{name}-%{version}-root BuildRequires: gcc-c++ diff --git a/packaging/switch/CMakeLists.txt.switch b/packaging/switch/CMakeLists.txt.switch index c3d9ef8d4..bfb0b8832 100644 --- a/packaging/switch/CMakeLists.txt.switch +++ b/packaging/switch/CMakeLists.txt.switch @@ -39,9 +39,9 @@ endforeach (DIR) set(INCLUDES src src/sdl2gfx) -set(FLAGS -DPACKAGE_NAME=\"ManaPlus\" -DPACKAGE_TARNAME=\"manaplus\" -DPACKAGE_VERSION=\"1.9.3.23\" - -DPACKAGE_STRING=\"ManaPlus\ 1.9.3.23\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"https://manaverse.germantmw.de\" - -DPACKAGE=\"manaplus\" -DVERSION=\"1.9.3.23\" -DTIME_WITH_SYS_TIME=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 +set(FLAGS -DPACKAGE_NAME=\"ManaVerse\" -DPACKAGE_TARNAME=\"manaplus\" -DPACKAGE_VERSION=\"1.0\" + -DPACKAGE_STRING=\"ManaVerse\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"https://manaverse.germantmw.de\" + -DPACKAGE=\"manaplus\" -DVERSION=\"1.0\" -DTIME_WITH_SYS_TIME=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SOCKET_H=1 -DSELECT_TYPE_ARG1=int -DSELECT_TYPE_ARG234=\(fd_set\ \\*\) -DSELECT_TYPE_ARG5=\(struct\ timeval\ \\*\) diff --git a/packaging/windows/make-translations.sh b/packaging/windows/make-translations.sh index 1d4132397..de8fff283 100755 --- a/packaging/windows/make-translations.sh +++ b/packaging/windows/make-translations.sh @@ -2,5 +2,5 @@ for i in `grep -v ^# ../../po/LINGUAS`; do mkdir -p ../../translations/$i/LC_MESSAGES - msgfmt -c -o ../../translations/$i/LC_MESSAGES/manaplus.mo ../../po/$i.po + msgfmt -c -o ../../translations/$i/LC_MESSAGES/manaverse.mo ../../po/$i.po done diff --git a/packaging/windows/setup.nsi b/packaging/windows/setup.nsi index f5ca57644..9eaf66346 100644 --- a/packaging/windows/setup.nsi +++ b/packaging/windows/setup.nsi @@ -53,12 +53,12 @@ RequestExecutionLevel admin !include "MultiUser.nsh" ; HM NIS Edit helper defines -!define PRODUCT_NAME "ManaPlus" +!define PRODUCT_NAME "ManaVerse" !ifndef PRODUCT_VERSION !define PRODUCT_VERSION "1.1" !endif -!define PRODUCT_PUBLISHER "ManaPlus Development Team" -!define PRODUCT_WEB_SITE "http://manaplus.evolonline.org/" +!define PRODUCT_PUBLISHER "ManaVerse Development Team" +!define PRODUCT_WEB_SITE "http://manaverse.germantmw.de" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\manaplus.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "SHCTX" @@ -101,8 +101,8 @@ RequestExecutionLevel admin !define MUI_FINISHPAGE_RUN_FUNCTION RunMana !define MUI_FINISHPAGE_SHOWREADME 'notepad.exe "$\"$INSTDIR\README$\""' !define MUI_PAGE_CUSTOMFUNCTION_PRE changeFinishImage -!define MUI_FINISHPAGE_LINK "Visit ManaPlus website for the latest news, FAQs and support" -!define MUI_FINISHPAGE_LINK_LOCATION "http://manaplus.evolonline.org/" +!define MUI_FINISHPAGE_LINK "Visit ManaVerse website for the latest news, FAQs and support" +!define MUI_FINISHPAGE_LINK_LOCATION "http://manaverse.germantmw.de/" !insertmacro MUI_PAGE_FINISH Function RunMana diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 068757ac1..ef28b5be6 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -4,7 +4,7 @@ FIND_PACKAGE(Gettext REQUIRED) # we need our own version because the upstream one contains # a call to msgmerge (updating po files) which can't be # disabled -MACRO(MANAPLUS_GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) +MACRO(MANAVERSE_GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) # make it a real variable, so we can modify it here SET(_firstPoFile "${_firstPoFileArg}") @@ -38,12 +38,12 @@ MACRO(MANAPLUS_GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles}) ENDMACRO() -MACRO(MANAPLUS_GETTEXT_UPDATE_PO _potFile _languages) +MACRO(MANAVERSE_GETTEXT_UPDATE_PO _potFile _languages) GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) ADD_CUSTOM_TARGET( update-pot - COMMAND xgettext --files-from=translatable-files --directory=. --output=${_potFile} -d manaplus --keyword=_ --keyword=N_ + COMMAND xgettext --files-from=translatable-files --directory=. --output=${_potFile} -d manaverse --keyword=_ --keyword=N_ ) ADD_CUSTOM_TARGET( @@ -78,5 +78,5 @@ ENDFOREACH() ADD_CUSTOM_TARGET(update-po) -MANAPLUS_GETTEXT_CREATE_TRANSLATIONS(manaplus.pot ALL ${POFILES}) -MANAPLUS_GETTEXT_UPDATE_PO(manaplus.pot "${languages}") +MANAVERSE_GETTEXT_CREATE_TRANSLATIONS(manaverse.pot ALL ${POFILES}) +MANAVERSE_GETTEXT_UPDATE_PO(manaverse.pot "${languages}") diff --git a/po/Makevars b/po/Makevars index 2cd1a43b5..588deb93f 100644 --- a/po/Makevars +++ b/po/Makevars @@ -1,7 +1,7 @@ # Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. -DOMAIN = manaplus +DOMAIN = manaverse # These two variables depend on the location of this directory. subdir = po @@ -18,7 +18,7 @@ XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. -COPYRIGHT_HOLDER = The ManaPlus Developers +COPYRIGHT_HOLDER = The ManaVerse Developers # This is the email address or URL to which the translators shall report # bugs in the untranslated strings: @@ -7151,7 +7151,7 @@ msgstr "Sense assumpte" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "Visualitza correu electrònic" #. TRANSLATORS: mail view attach / items button @@ -7019,7 +7019,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button @@ -7194,7 +7194,7 @@ msgstr "leerer Betreff" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "Nachricht anschauen" #. TRANSLATORS: mail view attach / items button @@ -7125,7 +7125,7 @@ msgstr "malplena temo" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "Montri poŝton" #. TRANSLATORS: mail view attach / items button @@ -7180,7 +7180,7 @@ msgstr "asunto vacío" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "Ver correo" #. TRANSLATORS: mail view attach / items button @@ -6997,7 +6997,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button @@ -7198,7 +7198,7 @@ msgstr "sujet vide" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "Lire tes mails" #. TRANSLATORS: mail view attach / items button @@ -6995,7 +6995,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button @@ -7017,7 +7017,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button @@ -7000,7 +7000,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button diff --git a/po/manaplus.pot b/po/manaverse.pot index f4256aca5..f319337d3 100644 --- a/po/manaplus.pot +++ b/po/manaverse.pot @@ -6991,7 +6991,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button @@ -7003,7 +7003,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button diff --git a/po/nl_BE.po b/po/nl_BE.po index e6bd42068..301691072 100644 --- a/po/nl_BE.po +++ b/po/nl_BE.po @@ -7003,7 +7003,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button @@ -7018,7 +7018,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button @@ -7012,7 +7012,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button diff --git a/po/pt_BR.po b/po/pt_BR.po index e161cacb1..3de33316b 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -7168,7 +7168,7 @@ msgstr "assunto vazio" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "Exibir e-mail" #. TRANSLATORS: mail view attach / items button @@ -7098,7 +7098,7 @@ msgstr "пустой заголовок" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "Просмотр почтового сообщения" #. TRANSLATORS: mail view attach / items button @@ -6999,7 +6999,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button @@ -7004,7 +7004,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button diff --git a/po/sv_SE.po b/po/sv_SE.po index 26d5887bd..a816fc7ad 100644 --- a/po/sv_SE.po +++ b/po/sv_SE.po @@ -7004,7 +7004,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button @@ -7001,7 +7001,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button @@ -7014,7 +7014,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button diff --git a/po/unused/ar.po b/po/unused/ar.po index df4996e58..3a425f3f0 100644 --- a/po/unused/ar.po +++ b/po/unused/ar.po @@ -6375,7 +6375,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/bg.po b/po/unused/bg.po index 3a0e86031..e4be09933 100644 --- a/po/unused/bg.po +++ b/po/unused/bg.po @@ -6363,7 +6363,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/en_GB.po b/po/unused/en_GB.po index 8fa42eb8f..183214df6 100644 --- a/po/unused/en_GB.po +++ b/po/unused/en_GB.po @@ -6364,7 +6364,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/et.po b/po/unused/et.po index 832f58a6b..e80a97c6d 100644 --- a/po/unused/et.po +++ b/po/unused/et.po @@ -6363,7 +6363,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/fa.po b/po/unused/fa.po index 2abd6d112..65538f508 100644 --- a/po/unused/fa.po +++ b/po/unused/fa.po @@ -6360,7 +6360,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/he.po b/po/unused/he.po index c7610d4c8..d5c110506 100644 --- a/po/unused/he.po +++ b/po/unused/he.po @@ -6363,7 +6363,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/hr.po b/po/unused/hr.po index d7b8be32b..37a6b95bd 100644 --- a/po/unused/hr.po +++ b/po/unused/hr.po @@ -6366,7 +6366,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/hu.po b/po/unused/hu.po index 1de0c7224..c3e97b6f0 100644 --- a/po/unused/hu.po +++ b/po/unused/hu.po @@ -6363,7 +6363,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/ka.po b/po/unused/ka.po index a48d5e1fe..8443d217e 100644 --- a/po/unused/ka.po +++ b/po/unused/ka.po @@ -6360,7 +6360,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/nb.po b/po/unused/nb.po index 2a87bd9fa..ae3789783 100644 --- a/po/unused/nb.po +++ b/po/unused/nb.po @@ -6363,7 +6363,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/sk.po b/po/unused/sk.po index d92c93c4f..db1313a95 100644 --- a/po/unused/sk.po +++ b/po/unused/sk.po @@ -6366,7 +6366,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/sq.po b/po/unused/sq.po index e355832ac..a3a5773e4 100644 --- a/po/unused/sq.po +++ b/po/unused/sq.po @@ -6363,7 +6363,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/te.po b/po/unused/te.po index 076d4221f..ed08d2a56 100644 --- a/po/unused/te.po +++ b/po/unused/te.po @@ -6363,7 +6363,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/th.po b/po/unused/th.po index 1a592db94..98d9018b4 100644 --- a/po/unused/th.po +++ b/po/unused/th.po @@ -6360,7 +6360,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/vls.po b/po/unused/vls.po index c0f4eeb89..c3083de3e 100644 --- a/po/unused/vls.po +++ b/po/unused/vls.po @@ -6362,7 +6362,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/unused/zh_TW.po b/po/unused/zh_TW.po index 3ff926002..945f44974 100644 --- a/po/unused/zh_TW.po +++ b/po/unused/zh_TW.po @@ -6360,7 +6360,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:53 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view window button diff --git a/po/zh_CN.po b/po/zh_CN.po index 00632acd5..d3b2dd7b7 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -6996,7 +6996,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button diff --git a/po/zh_HK.po b/po/zh_HK.po index 0113c95c5..1178e4440 100644 --- a/po/zh_HK.po +++ b/po/zh_HK.po @@ -6990,7 +6990,7 @@ msgstr "" #. TRANSLATORS: mail view window name #: src/gui/windows/mailviewwindow.cpp:52 -msgid "View mail" +msgid "View Mail" msgstr "" #. TRANSLATORS: mail view attach / items button diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6195f9260..64c62002f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,7 +26,8 @@ IF (POLICY CMP0015) CMAKE_POLICY(SET CMP0015 OLD) ENDIF() -SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"") +SET(FLAGS "-DPACKAGE_NAME=\\\"${PROJECT_NAME}\\\"") +SET(FLAGS "${FLAGS} -DPACKAGE_VERSION=\\\"${VERSION}\\\"") SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"") SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"") SET(DYE_FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\" -DDYECMD") @@ -971,8 +972,8 @@ SET(SRCS utils/parameters.h fs/paths.cpp fs/paths.h - utils/perfomance.cpp - utils/perfomance.h + utils/performance.cpp + utils/performance.h utils/perfstat.cpp utils/perfstat.h utils/pnglib.cpp @@ -1520,6 +1521,8 @@ SET(SRCS listeners/guitableactionlistener.h listeners/inputactionremotelistener.cpp listeners/inputactionremotelistener.h + listeners/inputactionreplayconfirmlistener.cpp + listeners/inputactionreplayconfirmlistener.h listeners/inputactionreplaylistener.cpp listeners/inputactionreplaylistener.h listeners/insertcardlistener.h diff --git a/src/Makefile.am b/src/Makefile.am index 418503b78..141e4897b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -643,8 +643,8 @@ BASE_SRC += client.h \ utils/parameters.h \ fs/paths.cpp \ fs/paths.h \ - utils/perfomance.cpp \ - utils/perfomance.h \ + utils/performance.cpp \ + utils/performance.h \ utils/perfstat.cpp \ utils/perfstat.h \ utils/pnglib.cpp \ @@ -1386,6 +1386,8 @@ SRC = ${BASE_SRC} \ listeners/playerpostdeathlistener.h \ listeners/inputactionremotelistener.cpp \ listeners/inputactionremotelistener.h \ + listeners/inputactionreplayconfirmlistener.cpp \ + listeners/inputactionreplayconfirmlistener.h \ listeners/inputactionreplaylistener.cpp \ listeners/inputactionreplaylistener.h \ listeners/insertcardlistener.h \ diff --git a/src/actormanager.cpp b/src/actormanager.cpp index b1ed604d5..db5e8313f 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -48,6 +48,7 @@ #include "utils/foreach.h" #include "utils/mathutils.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "net/beinghandler.h" #include "net/charserverhandler.h" diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index 18b93842c..6c79488a1 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -46,6 +46,7 @@ #include "utils/checkutils.h" #include "utils/delete2.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/timer.h" #include "debug.h" diff --git a/src/being/being.cpp b/src/being/being.cpp index 7886f99d6..980bec103 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -117,6 +117,7 @@ #include "utils/foreach.h" #include "utils/gettext.h" #include "utils/likely.h" +#include "utils/performance.h" #include "utils/stdmove.h" #include "utils/timer.h" @@ -4343,7 +4344,7 @@ void Being::drawHpBar(Graphics *restrict const graphics, #ifdef TMWA_SUPPORT // TODO: this is support for pre-2015 TMWAthena, remove in 2025? - // See mana/plus!68. + // See mana/verse!68. if (!serverFeatures->haveServerHp()) { // old servers if ((damage == 0 && (this != localPlayer || hp == maxHP)) diff --git a/src/being/being.h b/src/being/being.h index d8ce29027..320faa5e2 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -192,7 +192,7 @@ class Being notfinal : public ActorSprite, * Puts a damage bubble above this being. * * @param attacker the attacking being - * @param amount the amount of damage recieved (0 means miss) + * @param amount the amount of damage received (0 means miss) * @param type the attack type * @param attackId the attack id * @param level the skill level diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp index 821980dfd..054da503c 100644 --- a/src/being/compoundsprite.cpp +++ b/src/being/compoundsprite.cpp @@ -39,6 +39,7 @@ #include "utils/dtor.h" #include "utils/foreach.h" #include "utils/likely.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #ifndef USE_SDL2 diff --git a/src/being/flooritem.cpp b/src/being/flooritem.cpp index 31c331329..fbfcf2e83 100644 --- a/src/being/flooritem.cpp +++ b/src/being/flooritem.cpp @@ -43,6 +43,8 @@ #endif // TMWA_SUPPORT #include "net/serverfeatures.h" +#include "utils/performance.h" + #include "debug.h" extern volatile time_t cur_time; diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index e4285d991..218a77ce2 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -91,6 +91,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "utils/timer.h" #ifdef USE_MUMBLE @@ -1367,6 +1368,7 @@ void LocalPlayer::moveToTarget(int dist) ServerType::TMWATHENA); switch (dist) { + case 10: // range case 11: // archer dist = mAttackRange; if (dist == 1 && broken) diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp index 7bede5777..3e6c7490b 100644 --- a/src/chatlogger.cpp +++ b/src/chatlogger.cpp @@ -32,12 +32,12 @@ #include <dirent.h> #include <iostream> -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> #include <sys/time.h> #elif defined __APPLE__ #include <Carbon/Carbon.h> -#endif // WIN32 +#endif // _WIN32 #include "debug.h" diff --git a/src/commandline.cpp b/src/commandline.cpp index 4270d6322..2d8d48254 100644 --- a/src/commandline.cpp +++ b/src/commandline.cpp @@ -51,7 +51,7 @@ static void printHelp() _(" used to set custom parameters") << std::endl << // TRANSLATORS: command line help - _(" to the manaplus client.") << + _(" to the manaverse client.") << std::endl << std::endl << // TRANSLATORS: command line help _("Options:") << diff --git a/src/configmanager.cpp b/src/configmanager.cpp index 4417bfe16..b0de0d5b2 100644 --- a/src/configmanager.cpp +++ b/src/configmanager.cpp @@ -109,7 +109,7 @@ void ConfigManager::initConfiguration() config.setValue("opengl", CAST_S32(RENDER_NORMAL_OPENGL)); #elif (defined ANDROID) config.setValue("opengl", CAST_S32(RENDER_GLES_OPENGL)); -#elif (defined WIN32) +#elif (defined _WIN32) config.setValue("opengl", CAST_S32(RENDER_SAFE_OPENGL)); #else // (defined __APPLE__) diff --git a/src/configuration.cpp b/src/configuration.cpp index b4f71b94b..3ceab1d3e 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -35,6 +35,7 @@ #include "utils/cast.h" #include "utils/checkutils.h" #include "utils/foreach.h" +#include "utils/performance.h" #ifdef DEBUG_CONFIG #include "utils/stringmap.h" #endif // DEBUG_CONFIG diff --git a/src/defaults.cpp b/src/defaults.cpp index 354393946..5513dc74c 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -311,12 +311,12 @@ void setConfigDefaults(Configuration &cfg) AddDEF("downloadProxyType", 0); AddDEF("downloadProxyTunnel", false); AddDEF("blur", false); -#if defined(WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) AddDEF("centerwindow", true); -#else // defined(WIN32) || defined(__APPLE__) +#else // defined(_WIN32) || defined(__APPLE__) AddDEF("centerwindow", false); -#endif // defined(WIN32) || defined(__APPLE__) +#endif // defined(_WIN32) || defined(__APPLE__) AddDEF("audioFrequency", 44100); AddDEF("audioChannels", 2); diff --git a/src/dirs.cpp b/src/dirs.cpp index 131e8a090..394815a83 100644 --- a/src/dirs.cpp +++ b/src/dirs.cpp @@ -42,6 +42,7 @@ #include "utils/cast.h" #include "utils/gettext.h" +#include "utils/performance.h" #ifdef ANDROID #ifdef USE_SDL2 @@ -55,14 +56,14 @@ #include <CoreFoundation/CFBundle.h> #endif // __APPLE__ -#ifdef WIN32 +#ifdef _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_syswm.h> PRAGMA48(GCC diagnostic pop) #include "fs/specialfolder.h" #undef ERROR -#endif // WIN32 +#endif // _WIN32 #include <sys/stat.h> @@ -244,7 +245,7 @@ void Dirs::mountDataDir() Append_false); #endif // defined __native_client__ -#ifndef WIN32 +#ifndef _WIN32 // Add branding/data to VirtFS search path if (!settings.options.brandingPath.empty()) { @@ -260,7 +261,7 @@ void Dirs::mountDataDir() Append_false); } } -#endif // WIN32 +#endif // _WIN32 } void Dirs::initRootDir() @@ -348,7 +349,7 @@ void Dirs::initLocalDataDir() #elif defined __HAIKU__ settings.localDataDir = pathJoin(VirtFs::getUserDir(), "config/cache/Mana"); -#elif defined WIN32 +#elif defined _WIN32 settings.localDataDir = getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); if (settings.localDataDir.empty()) settings.localDataDir = VirtFs::getUserDir(); @@ -376,7 +377,7 @@ void Dirs::initLocalDataDir() "Exiting."), settings.localDataDir.c_str())); } #ifdef USE_PROFILER - Perfomance::init(pathJoin(settings.localDataDir, "profiler.log")); + Performance::init(pathJoin(settings.localDataDir, "profiler.log")); #endif // USE_PROFILER } @@ -406,7 +407,7 @@ void Dirs::initConfigDir() settings.configDir = pathJoin(VirtFs::getUserDir(), "config/settings/Mana", branding.getValue("appName", "ManaPlus")); -#elif defined WIN32 +#elif defined _WIN32 settings.configDir = getSpecialFolderLocation(CSIDL_APPDATA); if (settings.configDir.empty()) { @@ -498,10 +499,10 @@ void Dirs::initUpdatesDir() settings.updatesDir = updates.str(); } -#ifdef WIN32 +#ifdef _WIN32 if (settings.updatesDir.find(":") != std::string::npos) replaceAll(settings.updatesDir, ":", "_"); -#endif // WIN32 +#endif // _WIN32 const std::string updateDir("/" + settings.updatesDir); @@ -510,7 +511,7 @@ void Dirs::initUpdatesDir() { if (!VirtFs::mkdir(updateDir)) { -#if defined WIN32 +#if defined _WIN32 std::string newDir = pathJoin(settings.localDataDir, settings.updatesDir); if (!CreateDirectory(newDir.c_str(), nullptr) && @@ -522,7 +523,7 @@ void Dirs::initUpdatesDir() errorMessage = _("Error creating updates directory!"); client->setState(State::ERROR); } -#else // defined WIN32 +#else // defined _WIN32 logger->log("Error: %s/%s can't be made, but doesn't exist!", settings.localDataDir.c_str(), @@ -530,7 +531,7 @@ void Dirs::initUpdatesDir() // TRANSLATORS: update server initialisation error errorMessage = _("Error creating updates directory!"); client->setState(State::ERROR); -#endif // defined WIN32 +#endif // defined _WIN32 } } const std::string updateLocal = pathJoin(updateDir, "local"); diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index 7ca1aa754..e88681c4a 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -29,6 +29,7 @@ #include "being/being.h" #include "utils/checkutils.h" +#include "utils/performance.h" #include "particle/particle.h" diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 5abfd9d14..0ca6512f1 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -26,10 +26,10 @@ #include "enums/simpletypes/enumdefines.h" -#ifdef WIN32 +#ifdef _WIN32 #undef ERROR #undef IGNORE -#endif // WIN32 +#endif // _WIN32 /** * All the key functions. diff --git a/src/enums/state.h b/src/enums/state.h index 4784428dc..5471897c8 100644 --- a/src/enums/state.h +++ b/src/enums/state.h @@ -26,9 +26,9 @@ #include "enums/simpletypes/enumdefines.h" -#ifdef WIN32 +#ifdef _WIN32 #undef ERROR -#endif // WIN32 +#endif // _WIN32 enumStart(State) { @@ -61,6 +61,7 @@ enumStart(State) CHANGEEMAIL_SUCCESS, SWITCH_SERVER, SWITCH_LOGIN, + SWITCH_WORLD, // Technically 'Switch World or Logout' SWITCH_CHARACTER, // 30 LOGOUT_ATTEMPT, WAIT, diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp index b62301400..c6d72b44a 100644 --- a/src/eventsmanager.cpp +++ b/src/eventsmanager.cpp @@ -44,6 +44,7 @@ #include "logger.h" #endif // USE_SDL2 +#include "utils/performance.h" #include "utils/process.h" #include "utils/sdlhelper.h" #ifdef USE_X11 diff --git a/src/fs/files.cpp b/src/fs/files.cpp index 5a041b698..5134520ce 100644 --- a/src/fs/files.cpp +++ b/src/fs/files.cpp @@ -60,7 +60,7 @@ void Files::extractLocale() const std::string dir = pathJoin("locale", *i); if (VirtFs::isDirectory(dir)) { - const std::string moFile = dir + "/LC_MESSAGES/manaplus.mo"; + const std::string moFile = dir + "/LC_MESSAGES/manaverse.mo"; if (VirtFs::exists((moFile))) { const std::string localFile = pathJoin(localDir, moFile); @@ -209,7 +209,7 @@ int Files::copyFile(const std::string &restrict srcName, bool Files::existsLocal(const std::string &path) { struct stat statbuf; -#ifdef WIN32 +#ifdef _WIN32 // in windows path\file.ext\ by default detected as exists // if file.ext is not directory, need return false const bool res = (stat(path.c_str(), &statbuf) == 0); @@ -221,9 +221,9 @@ bool Files::existsLocal(const std::string &path) return false; } return true; -#else // WIN32 +#else // _WIN32 return stat(path.c_str(), &statbuf) == 0; -#endif // WIN32 +#endif // _WIN32 } bool Files::loadTextFileLocal(const std::string &fileName, @@ -303,7 +303,7 @@ void Files::enumFiles(StringVect &files, const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (skipSymlinks == true) { struct stat statbuf; @@ -313,7 +313,7 @@ void Files::enumFiles(StringVect &files, continue; } } -#endif // WIN32 +#endif // _WIN32 files.push_back(file); } closedir(dir); diff --git a/src/fs/mkdir.cpp b/src/fs/mkdir.cpp index ee344324c..45a025c6a 100644 --- a/src/fs/mkdir.cpp +++ b/src/fs/mkdir.cpp @@ -24,16 +24,16 @@ #include "utils/cast.h" -#if defined WIN32 +#if defined _WIN32 #include <limits.h> #include <windows.h> -#endif // defined WIN32 +#endif // defined _WIN32 #include <sys/stat.h> #include "debug.h" -#if defined WIN32 +#if defined _WIN32 int mkdir_r(const char *const pathname) { if (!pathname) @@ -103,7 +103,7 @@ int mkdir_r(const char *const pathname) } return 0; } -#else // WIN32 +#else // _WIN32 /// Create a directory, making leading components first if necessary int mkdir_r(const char *const pathname) @@ -164,4 +164,4 @@ int mkdir_r(const char *const pathname) delete []tmp; return 0; } -#endif // WIN32 +#endif // _WIN32 diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp index 897d2ff41..492f5a449 100644 --- a/src/fs/paths.cpp +++ b/src/fs/paths.cpp @@ -42,22 +42,22 @@ #define realpath(N, R) strcpy(R, N) #endif // __native_client__ -#ifdef WIN32 +#ifdef _WIN32 #include "fs/specialfolder.h" #define realpath(N, R) _fullpath((R), (N), _MAX_PATH) -#endif +#endif // _WIN32 #if defined __OpenBSD__ #include <limits> #else #include <climits> -#endif // WIN32 +#endif // __OpenBSD__ -#ifndef WIN32 +#ifndef _WIN32 #include <unistd.h> #include <sys/types.h> #include <pwd.h> -#endif // WIN32 +#endif // _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") @@ -148,7 +148,7 @@ void prepareFsPath(std::string &path) std::string &fixDirSeparators(std::string &str) { -#ifdef WIN32 +#ifdef _WIN32 return replaceAll(str, "/", "\\"); #else return str; @@ -169,7 +169,7 @@ std::string removeLast(const std::string &str) return str; } -#ifdef WIN32 +#ifdef _WIN32 std::string getSelfName() { return "manaplus.exe"; @@ -195,18 +195,18 @@ std::string getSelfName() return ""; } -#else // WIN32 +#else // _WIN32 std::string getSelfName() { return ""; } -#endif // WIN32 +#endif // _WIN32 std::string getPicturesDir() { -#ifdef WIN32 +#ifdef _WIN32 std::string dir = getSpecialFolderLocation(CSIDL_MYPICTURES); if (dir.empty()) dir = getSpecialFolderLocation(CSIDL_DESKTOP); @@ -244,7 +244,7 @@ std::string getPicturesDir() } } } -#endif // WIN32 +#endif // _WIN32 return pathJoin(VirtFs::getUserDir(), "Desktop"); } @@ -257,11 +257,11 @@ std::string getHomePath() dir += dirSeparator; return dir; #else // defined(UNITTESTS) && defined(UNITESTSDIR) -#ifdef WIN32 +#ifdef _WIN32 return getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); #elif defined(__SWITCH__) return VirtFs::getBaseDir(); -#else +#else // _WIN32 const char *path = getenv("HOME"); if (path == nullptr) { @@ -279,7 +279,7 @@ std::string getHomePath() if (findLast(dir, std::string(dirSeparator)) == false) dir += dirSeparator; return dir; -#endif // WIN32 +#endif // _WIN32 #endif // defined(UNITTESTS) && defined(UNITESTSDIR) } diff --git a/src/fs/specialfolder.cpp b/src/fs/specialfolder.cpp index 807ea093b..34e37aec6 100644 --- a/src/fs/specialfolder.cpp +++ b/src/fs/specialfolder.cpp @@ -20,7 +20,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifdef WIN32 +#ifdef _WIN32 #include "fs/specialfolder.h" #include <windows.h> @@ -57,4 +57,4 @@ std::string getSpecialFolderLocation(const int folderId) return ret; } -#endif // WIN32 +#endif // _WIN32 diff --git a/src/fs/specialfolder.h b/src/fs/specialfolder.h index 618a2d90d..832750768 100644 --- a/src/fs/specialfolder.h +++ b/src/fs/specialfolder.h @@ -23,12 +23,12 @@ #ifndef UTILS_SPECIALFOLDER_H #define UTILS_SPECIALFOLDER_H -#ifdef WIN32 +#ifdef _WIN32 #include <shlobj.h> #include <string> #include "localconsts.h" std::string getSpecialFolderLocation(const int folderId) A_WARN_UNUSED; -#endif // WIN32 +#endif // _WIN32 #endif // UTILS_SPECIALFOLDER_H diff --git a/src/fs/virtfs/fs.cpp b/src/fs/virtfs/fs.cpp index 42b93188e..13d15eb09 100644 --- a/src/fs/virtfs/fs.cpp +++ b/src/fs/virtfs/fs.cpp @@ -64,11 +64,11 @@ namespace VirtFs void updateDirSeparator() { -#ifdef WIN32 +#ifdef _WIN32 dirSeparator = "\\"; -#else // WIN32 +#else // _WIN32 dirSeparator = "/"; -#endif // WIN32 +#endif // _WIN32 } const char *getDirSeparator() diff --git a/src/fs/virtfs/fsdir.cpp b/src/fs/virtfs/fsdir.cpp index 7832dcce6..c623638ca 100644 --- a/src/fs/virtfs/fsdir.cpp +++ b/src/fs/virtfs/fsdir.cpp @@ -204,7 +204,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { struct stat statbuf; @@ -214,7 +214,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 bool found(false); FOR_EACH (StringVectCIter, itn, names) @@ -256,7 +256,7 @@ namespace FsDir name.c_str()) return false; } -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) return false; @@ -265,7 +265,7 @@ namespace FsDir S_ISLNK(statbuf.st_mode) != 0; #else return false; -#endif // WIN32 +#endif // _WIN32 } void freeList(List *restrict const handle) @@ -549,7 +549,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { if (lstat(path.c_str(), &statbuf) == 0 && @@ -558,7 +558,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 const std::string filePath = pathJoin(path, file); if (stat(filePath.c_str(), &statbuf) == 0) @@ -599,7 +599,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { if (lstat(path.c_str(), &statbuf) == 0 && @@ -608,7 +608,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 const std::string filePath = pathJoin(path, file); if (stat(filePath.c_str(), &statbuf) == 0) @@ -649,7 +649,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { if (lstat(path.c_str(), &statbuf) == 0 && @@ -658,7 +658,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 const std::string filePath = pathJoin(path, file); if (stat(filePath.c_str(), &statbuf) == 0) diff --git a/src/fs/virtfs/rwops.cpp b/src/fs/virtfs/rwops.cpp index f4984b547..d710dc1d7 100644 --- a/src/fs/virtfs/rwops.cpp +++ b/src/fs/virtfs/rwops.cpp @@ -52,6 +52,7 @@ #include "utils/checkutils.h" #include "utils/fuzzer.h" +#include "utils/performance.h" PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") diff --git a/src/game.cpp b/src/game.cpp index 65f0fc2c0..d9df74ddc 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -128,6 +128,7 @@ #include "utils/gettext.h" #include "utils/perfstat.h" #include "utils/pnglib.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "utils/timer.h" @@ -146,10 +147,10 @@ #include "mumblemanager.h" #endif // USE_MUMBLE -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> #undef ERROR -#endif // WIN32 +#endif // _WIN32 #include <fstream> @@ -587,13 +588,13 @@ bool Game::saveScreenshot(SDL_Surface *const screenshot, if (serverName.empty()) { screenShortStr = strprintf("%s_Screenshot_%s_", - branding.getValue("appName", "ManaPlus").c_str(), + branding.getValue("appName", "ManaVerse").c_str(), buffer); } else { screenShortStr = strprintf("%s_Screenshot_%s_%s_", - branding.getValue("appName", "ManaPlus").c_str(), + branding.getValue("appName", "ManaVerse").c_str(), serverName.c_str(), buffer); } diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 81d01496d..16375b8a4 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -22,7 +22,7 @@ #include "graphicsmanager.h" #ifdef USE_OPENGL -#ifndef WIN32 +#ifndef _WIN32 #ifdef ANDROID #include <GLES2/gl2.h> @@ -43,7 +43,7 @@ PRAGMA48(GCC diagnostic pop) #include <GL/glx.h> #endif // USE_X11 #endif // ANDROID -#endif // WIN32 +#endif // _WIN32 #endif // USE_OPENGL #include "settings.h" @@ -682,7 +682,7 @@ void GraphicsManager::updatePlanformExtensions() SDL_VERSION(&info.version) if (SDL::getWindowWMInfo(mainGraphics->getWindow(), &info)) { -#ifdef WIN32 +#ifdef _WIN32 if (!mwglGetExtensionsString) return; @@ -755,7 +755,7 @@ void GraphicsManager::updatePlanformExtensions() } logger->log("width=%d", DisplayWidth(display, screenNum)); } -#endif // WIN32 +#endif // _WIN32 } } @@ -1398,9 +1398,9 @@ void GraphicsManager::initOpenGLFunctions() logger->log1("shaders not supported"); } -#ifdef WIN32 +#ifdef _WIN32 assignFunctionARB(wglGetExtensionsString) -#endif // WIN32 +#endif // _WIN32 #endif // __native_client__ } @@ -1670,7 +1670,7 @@ void GraphicsManager::detectPixelSize() SDL_VERSION(&info.version) if (SDL::getWindowWMInfo(mainGraphics->getWindow(), &info)) { -#ifdef WIN32 +#ifdef _WIN32 #ifdef USE_SDL2 HDC hdc = GetDC(info.info.win.window); #else @@ -1698,7 +1698,7 @@ void GraphicsManager::detectPixelSize() mWidthMM = DisplayWidthMM(display, screenNum); mHeightMM = DisplayHeightMM(display, screenNum); } -#endif // WIN32 +#endif // _WIN32 } #if defined ANDROID #ifdef USE_SDL2 diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp index 2383d2bb0..a33872e5e 100644 --- a/src/gui/dialogsmanager.cpp +++ b/src/gui/dialogsmanager.cpp @@ -26,6 +26,8 @@ #include "configuration.h" #include "settings.h" +#include "being/localplayer.h" + #include "being/playerinfo.h" #include "const/sound.h" @@ -55,9 +57,9 @@ #include "debug.h" -#ifdef WIN32 +#ifdef _WIN32 #undef ERROR -#endif // WIN32 +#endif // _WIN32 Window *deathNotice = nullptr; DialogsManager *dialogsManager = nullptr; @@ -192,6 +194,11 @@ void DialogsManager::attributeChanged(const AttributesT id, const int total = CAST_S32(oldVal); if (newVal >= max && total < max) { + const std::string overweightMessage( + // TRANSLATORS: overweight message in speech bubble + _("Warning: You are overburdened," + " you have difficulty regenerating.")); + /* weightNoticeTime = cur_time + 5; CREATEWIDGETV(weightNotice, OkDialog, std::string(), @@ -208,9 +215,17 @@ void DialogsManager::attributeChanged(const AttributesT id, 260); weightNotice->addActionListener( &weightListener); + */ + if (localPlayer != nullptr) + localPlayer->setSpeech(overweightMessage); } else if (newVal < max && total >= max) { + const std::string underweightMessage( + // TRANSLATORS: overweight message in speech bubble + _("You are no longer overburdened," + " regeneration back to normal.")); + /* weightNoticeTime = cur_time + 5; CREATEWIDGETV(weightNotice, OkDialog, std::string(), @@ -227,6 +242,9 @@ void DialogsManager::attributeChanged(const AttributesT id, 260); weightNotice->addActionListener( &weightListener); + */ + if (localPlayer != nullptr) + localPlayer->setSpeech(underweightMessage); } } } diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp index c39b74f16..acf6ec95d 100644 --- a/src/gui/fonts/font.cpp +++ b/src/gui/fonts/font.cpp @@ -85,6 +85,7 @@ #include "utils/checkutils.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "utils/stringutils.h" #include "utils/timer.h" diff --git a/src/gui/fonts/textchunk.cpp b/src/gui/fonts/textchunk.cpp index 0256315c1..d88e175f8 100644 --- a/src/gui/fonts/textchunk.cpp +++ b/src/gui/fonts/textchunk.cpp @@ -33,6 +33,7 @@ #include "resources/image/image.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "utils/stringutils.h" diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 5b767048c..85d2d47a7 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -101,6 +101,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" #include "utils/langs.h" +#include "utils/performance.h" #include "utils/sdlsharedhelper.h" #include "utils/timer.h" diff --git a/src/gui/models/colorlistmodel.h b/src/gui/models/colorlistmodel.h index 53844b8a2..9bec07b5c 100644 --- a/src/gui/models/colorlistmodel.h +++ b/src/gui/models/colorlistmodel.h @@ -71,7 +71,7 @@ class ColorListModel final : public ListModel int getNumberOfElements() override final { - return 14; + return NUM_ELEMENTS(COLOR_NAME); } std::string getElementAt(int i) override final diff --git a/src/gui/models/magicschoolmodel.h b/src/gui/models/magicschoolmodel.h index 05b71b2c8..96a433cf6 100644 --- a/src/gui/models/magicschoolmodel.h +++ b/src/gui/models/magicschoolmodel.h @@ -30,8 +30,6 @@ #include "localconsts.h" -#define NUM_ELEMENTS(a) sizeof(a) / sizeof(a[0]) - const char *MAGIC_SCHOOL_TEXT[] = { // TRANSLATORS: magic school diff --git a/src/gui/models/sortlistmodelbuy.h b/src/gui/models/sortlistmodelbuy.h index 573452a1d..8d5b316ae 100644 --- a/src/gui/models/sortlistmodelbuy.h +++ b/src/gui/models/sortlistmodelbuy.h @@ -28,9 +28,7 @@ #include "utils/gettext.h" -#define NUM_ELEMENTS(a) sizeof(a) / sizeof(a[0]) - -static const char *const SORT_NAME_BUY[8] = +static const char *const SORT_NAME_BUY[] = { // TRANSLATORS: buy dialog sort type. N_("unsorted"), @@ -47,7 +45,7 @@ static const char *const SORT_NAME_BUY[8] = // TRANSLATORS: buy dialog sort type. N_("by amount"), // TRANSLATORS: buy dialog sort type. - N_("by type") + N_("by type & slot"), }; class SortListModelBuy final : public ListModel diff --git a/src/gui/models/sortlistmodelinv.h b/src/gui/models/sortlistmodelinv.h index eaf5c323b..fdd6cdb50 100644 --- a/src/gui/models/sortlistmodelinv.h +++ b/src/gui/models/sortlistmodelinv.h @@ -27,9 +27,7 @@ #include "utils/gettext.h" -#define NUM_ELEMENTS(a) sizeof(a) / sizeof(a[0]) - -static const char *const SORT_NAME_INVENTORY[7] = +static const char *const SORT_NAME_INVENTORY[] = { // TRANSLATORS: inventory sort mode N_("default"), @@ -44,7 +42,7 @@ static const char *const SORT_NAME_INVENTORY[7] = // TRANSLATORS: inventory sort mode N_("by amount"), // TRANSLATORS: inventory sort mode - N_("by type") + N_("by type & slot"), }; class SortListModelInv final : public ListModel diff --git a/src/gui/models/targettypemodel.h b/src/gui/models/targettypemodel.h index 4453b6e45..837801600 100644 --- a/src/gui/models/targettypemodel.h +++ b/src/gui/models/targettypemodel.h @@ -48,7 +48,7 @@ class TargetTypeModel final : public ListModel int getNumberOfElements() override final { - return 3; + return NUM_ELEMENTS(TARGET_TYPE_TEXT); } std::string getElementAt(int i) override final diff --git a/src/gui/models/typelistmodel.h b/src/gui/models/typelistmodel.h index d32db564b..78ad39bfa 100644 --- a/src/gui/models/typelistmodel.h +++ b/src/gui/models/typelistmodel.h @@ -33,6 +33,16 @@ #define SERVER_TYPE_INDEX_OFFSET 1 #endif // TMWA_SUPPORT +// No translations here. +const char *SERVER_TYPE_TEXT[] = +{ +#ifdef TMWA_SUPPORT + "TMW Athena", +#endif // defined(TMWA_SUPPORT) + "Hercules", + "Evol2 Hercules", +}; + /** * Server Type List Model */ @@ -49,27 +59,19 @@ class TypeListModel final : public ListModel * Used to get number of line in the list */ int getNumberOfElements() override final A_WARN_UNUSED -#if defined(TMWA_SUPPORT) - { return 3; } -#else // defined(TMWA_SUPPORT) - { return 2; } -#endif // defined(TMWA_SUPPORT) + { + return NUM_ELEMENTS(SERVER_TYPE_TEXT); + } /** * Used to get an element from the list */ - std::string getElementAt(int elementIndex) + std::string getElementAt(int index) override final A_WARN_UNUSED { - switch (elementIndex) - { -#ifdef TMWA_SUPPORT - case 0: return "TMW Athena"; break; -#endif // defined(TMWA_SUPPORT) - case 1 - SERVER_TYPE_INDEX_OFFSET: return "Hercules"; break; - case 2 - SERVER_TYPE_INDEX_OFFSET: return "Evol2 Hercules"; break; - default: return "Unknown"; break; - } + if (0 <= index && index < getNumberOfElements()) + return SERVER_TYPE_TEXT[index]; + return "Unknown"; } }; diff --git a/src/gui/models/updatetypemodel.h b/src/gui/models/updatetypemodel.h index b30160133..5f111a2bd 100644 --- a/src/gui/models/updatetypemodel.h +++ b/src/gui/models/updatetypemodel.h @@ -47,7 +47,7 @@ class UpdateTypeModel final : public ListModel int getNumberOfElements() override final { - return 3; + return NUM_ELEMENTS(UPDATE_TYPE_TEXT); } std::string getElementAt(int i) override final diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index c98a9416e..f0f97b6f1 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -33,6 +33,11 @@ #include "debug.h" +// required by MSYS2 / Windows +#ifndef M_PI +#define M_PI 3.1415926535897932384626433832795 +#endif + const Color Palette::BLACK = Color(0, 0, 0, 255); Palette::Palettes Palette::mInstances; diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp index caffcadad..639871ba9 100644 --- a/src/gui/popups/beingpopup.cpp +++ b/src/gui/popups/beingpopup.cpp @@ -40,6 +40,7 @@ #include "utils/gettext.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "debug.h" @@ -141,13 +142,13 @@ void BeingPopup::show(const int x, const int y, Being *const b) { ptr = mLabels[num]; // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Hungry: %d"), + ptr->setCaption(strprintf(_("Satiation: %d"), info->hungry)); ptr->adjustSize(); num ++; ptr = mLabels[num]; // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Intimacy: %d"), + ptr->setCaption(strprintf(_("Loyalty: %d"), info->intimacy)); ptr->adjustSize(); num ++; @@ -160,13 +161,13 @@ void BeingPopup::show(const int x, const int y, Being *const b) { ptr = mLabels[num]; // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Hungry: %d"), + ptr->setCaption(strprintf(_("Satiation: %d"), info->hungry)); ptr->adjustSize(); num ++; ptr = mLabels[num]; // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Intimacy: %d"), + ptr->setCaption(strprintf(_("Loyalty: %d"), info->intimacy)); ptr->adjustSize(); num ++; diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 7eb0746ea..0f176258f 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -90,6 +90,8 @@ PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_timer.h> PRAGMA48(GCC diagnostic pop) +#include "utils/performance.h" + #include "debug.h" #ifdef __SWITCH__ diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index c3c1dfd7f..95890c36b 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -48,6 +48,8 @@ #include "resources/map/map.h" +#include "utils/performance.h" + #include "debug.h" int AvatarListBox::instances = 0; diff --git a/src/gui/widgets/basiccontainer.cpp b/src/gui/widgets/basiccontainer.cpp index a3e140d5f..ec4c5c2d6 100644 --- a/src/gui/widgets/basiccontainer.cpp +++ b/src/gui/widgets/basiccontainer.cpp @@ -66,6 +66,7 @@ #include "utils/checkutils.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "render/graphics.h" diff --git a/src/gui/widgets/basiccontainer2.cpp b/src/gui/widgets/basiccontainer2.cpp index 63c98b42a..ab1457744 100644 --- a/src/gui/widgets/basiccontainer2.cpp +++ b/src/gui/widgets/basiccontainer2.cpp @@ -70,6 +70,8 @@ #include "render/graphics.h" +#include "utils/performance.h" + #include "debug.h" BasicContainer2::BasicContainer2(const Widget2 *const widget) : diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 8503bda75..9b402bb89 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -47,6 +47,7 @@ #include "utils/browserboxtools.h" #include "utils/checkutils.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "utils/timer.h" #include "utils/translation/podict.h" diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 7642a122f..62d615dc9 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -83,6 +83,7 @@ #include "render/vertexes/imagecollection.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index ce5ac28b0..d1bee3665 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -79,6 +79,8 @@ #include "resources/image/image.h" +#include "utils/performance.h" + #include "debug.h" int CheckBox::instances = 0; diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp index 5ed2fb8a0..dfa8b8258 100644 --- a/src/gui/widgets/colorpage.cpp +++ b/src/gui/widgets/colorpage.cpp @@ -29,6 +29,8 @@ #include "render/graphics.h" +#include "utils/performance.h" + #include "debug.h" ColorPage::ColorPage(const Widget2 *const widget, diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 4d21c9983..c68b3bea2 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -44,6 +44,8 @@ #include "render/graphics.h" +#include "utils/performance.h" + #include "debug.h" Desktop *desktop = nullptr; diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index e66bdafbe..48433320a 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -39,6 +39,8 @@ #include "resources/imagerect.h" +#include "utils/performance.h" + #include "debug.h" int DropDown::instances = 0; diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index 33cc1cdc3..ea461356f 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -31,6 +31,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 789a3bed5..c086c828a 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -45,6 +45,7 @@ #include "resources/sprite/animatedsprite.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "debug.h" diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index 20c13e519..6f6c01fce 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -29,6 +29,8 @@ #include "render/graphics.h" +#include "utils/performance.h" + #include "debug.h" ExtendedListBox::ExtendedListBox(const Widget2 *const widget, diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index d3aff69f7..47e00ccc1 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -35,6 +35,7 @@ #include "utils/delete2.h" #include "utils/dtor.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index f5430a69c..5fd16af1b 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -31,6 +31,8 @@ #include "resources/loaders/imageloader.h" +#include "utils/performance.h" + #include "debug.h" Icon::Icon(const Widget2 *const widget, diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 3b8f349e4..0e1bfda59 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -57,6 +57,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "render/vertexes/imagecollection.h" @@ -863,7 +864,7 @@ void ItemContainer::mouseReleased(MouseEvent &event) if (index == mSelectedIndex || mSelectedIndex == -1) return; if (inventoryWindow != nullptr) - inventoryWindow->combineItems(index, mSelectedIndex); + inventoryWindow->combineItems(mSelectedIndex, index); return; } else if (src == DragDropSource::Cart && diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 774cb92e6..888cb7e61 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -51,6 +51,7 @@ #include "const/resources/skill.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "debug.h" diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 9ab506ac0..4e10d8819 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -70,6 +70,8 @@ #include "gui/fonts/font.h" +#include "utils/performance.h" + #include "debug.h" Skin *Label::mSkin = nullptr; diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 04c02f1ca..6b08174ce 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -79,6 +79,7 @@ #include "listeners/selectionlistener.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "render/graphics.h" diff --git a/src/gui/widgets/passwordfield.cpp b/src/gui/widgets/passwordfield.cpp index c24c1c41c..893a830c0 100644 --- a/src/gui/widgets/passwordfield.cpp +++ b/src/gui/widgets/passwordfield.cpp @@ -25,6 +25,8 @@ #include "gui/skin.h" +#include "utils/performance.h" + #include "debug.h" PasswordField::PasswordField(const Widget2 *const widget, diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index b02798a1b..75060e9be 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -34,6 +34,8 @@ #include "resources/image/image.h" +#include "utils/performance.h" + #include "debug.h" PlayerBox::PlayerBox(Widget2 *const widget, diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index c217bd0b7..2bd8f922e 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -30,6 +30,7 @@ #include "gui/widgets/windowcontainer.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "render/graphics.h" diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 8c7afe1cc..070488bf9 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -31,6 +31,7 @@ #include "gui/fonts/font.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "render/graphics.h" diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index 8dbe2b3b1..1fa579665 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -30,6 +30,7 @@ #include "resources/animation/simpleanimation.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index d313d9035..586695665 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -79,6 +79,8 @@ #include "resources/image/image.h" +#include "utils/performance.h" + #include "debug.h" int RadioButton::instances = 0; diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index e054d461d..9e3b60466 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -72,6 +72,7 @@ #include "gui/skin.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "render/graphics.h" diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 043b1b5bb..95ba47175 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -45,6 +45,8 @@ #include "resources/item/shopitem.h" +#include "utils/performance.h" + #include "debug.h" const int ITEM_ICON_SIZE = 32; diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 8ff7ac5c7..674be268e 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -73,6 +73,7 @@ #include "gui/gui.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "resources/imagerect.h" diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index a1b76cd28..178996d6c 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -30,6 +30,8 @@ #include "gui/widgets/button.h" #include "gui/widgets/label.h" +#include "utils/performance.h" + #include "debug.h" static const int buttonWidth = 27; diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 14ac43597..1e3b02796 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -39,6 +39,8 @@ #include "gui/windows/shortcutwindow.h" +#include "utils/performance.h" + #include "debug.h" SpellShortcutContainer::SpellShortcutContainer(Widget2 *const widget, diff --git a/src/gui/widgets/staticbrowserbox.cpp b/src/gui/widgets/staticbrowserbox.cpp index 070cd5947..4501a4e70 100644 --- a/src/gui/widgets/staticbrowserbox.cpp +++ b/src/gui/widgets/staticbrowserbox.cpp @@ -47,6 +47,7 @@ #include "utils/browserboxtools.h" #include "utils/checkutils.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/stdmove.h" #include "utils/stringutils.h" #include "utils/translation/podict.h" diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index c56e114c1..3f053de39 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -74,6 +74,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index b1847cde1..b09e57585 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -38,6 +38,7 @@ #include "gui/windows/chatwindow.h" #include "gui/windows/helpwindow.h" +#include "gui/widgets/browserbox.h" #include "gui/widgets/scrollarea.h" #include "gui/widgets/itemlinkhandler.h" #include "gui/widgets/tabbedarea.h" @@ -51,9 +52,9 @@ #include "utils/delete2.h" #include "utils/gettext.h" -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#endif // WIN32 +#endif // _WIN32 #include <sstream> @@ -437,6 +438,16 @@ void ChatTab::clearText() mTextOutput->clearRows(); } +const std::list<std::string> &ChatTab::getRows() const +{ + return mTextOutput->getRows(); +} + +bool ChatTab::hasRows() const +{ + return mTextOutput->hasRows(); +} + void ChatTab::handleInput(const std::string &msg) { if (chatHandler) diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h index a08429b24..3cab5f54d 100644 --- a/src/gui/widgets/tabs/chat/chattab.h +++ b/src/gui/widgets/tabs/chat/chattab.h @@ -31,12 +31,11 @@ #include "enums/simpletypes/online.h" #include "enums/simpletypes/tryremovecolors.h" -#include "gui/widgets/browserbox.h" - #include "gui/widgets/tabs/tab.h" #include "localconsts.h" +class BrowserBox; class ScrollArea; #define debugMsg(str) \ @@ -115,10 +114,23 @@ class ChatTab notfinal : public Tab /** * Clears the text from the tab + * @see BrowserBox::clearRows */ void clearText(); /** + * Returns lines of text from the widget, + * @see BrowserBox::getRows + */ + const std::list<std::string> &getRows() const A_WARN_UNUSED; + + /** + * true if the widget has any lines + * @see BrowserBox::hasRows + */ + bool hasRows() const A_WARN_UNUSED; + + /** * Handle special commands. Allows a tab to handle commands it * defines itself. * @@ -147,12 +159,6 @@ class ChatTab notfinal : public Tab void saveToLogFile(const std::string &msg) const; - const std::list<std::string> &getRows() const A_WARN_UNUSED - { return mTextOutput->getRows(); } - - bool hasRows() const A_WARN_UNUSED - { return mTextOutput->hasRows(); } - void loadFromLogFile(const std::string &name, const unsigned maxLines); diff --git a/src/gui/widgets/tabs/mapdebugtab.cpp b/src/gui/widgets/tabs/mapdebugtab.cpp index 4084115e5..6589f1a39 100644 --- a/src/gui/widgets/tabs/mapdebugtab.cpp +++ b/src/gui/widgets/tabs/mapdebugtab.cpp @@ -42,6 +42,7 @@ #include "resources/map/map.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "utils/timer.h" diff --git a/src/gui/widgets/tabs/netdebugtab.cpp b/src/gui/widgets/tabs/netdebugtab.cpp index 3f14f1cdd..bbee16d1e 100644 --- a/src/gui/widgets/tabs/netdebugtab.cpp +++ b/src/gui/widgets/tabs/netdebugtab.cpp @@ -30,6 +30,7 @@ #include "net/packetcounters.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "debug.h" diff --git a/src/gui/widgets/tabs/setup_misc.cpp b/src/gui/widgets/tabs/setup_misc.cpp index ea159e8cf..f874497b7 100644 --- a/src/gui/widgets/tabs/setup_misc.cpp +++ b/src/gui/widgets/tabs/setup_misc.cpp @@ -563,13 +563,13 @@ Setup_Misc::Setup_Misc(const Widget2 *const widget) : MainConfig_true); #endif // ANDROID -#ifndef WIN32 +#ifndef _WIN32 // TRANSLATORS: settings option new SetupItemTextField(_("Screenshot directory"), "", "screenshotDirectory3", this, "screenshotDirectory3Event", MainConfig_true, UseBase64_true); -#endif // WIN32 +#endif // _WIN32 // TRANSLATORS: settings option new SetupItemIntTextField(_("Network delay between sub servers"), diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index c980280e8..662e6f356 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -239,11 +239,11 @@ void Setup_Video::apply() * See http://libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode */ -#if defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#if defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) // checks for opengl usage if (intToRenderType(config.getIntValue("opengl")) == RENDER_SOFTWARE) { -#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#endif // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) if (!WindowManager::setFullScreen(fullscreen)) { fullscreen = !fullscreen; @@ -267,7 +267,7 @@ void Setup_Video::apply() logger->safeError(errorMsg.str()); } } -#if defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#if defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) } else { @@ -284,7 +284,7 @@ void Setup_Video::apply() nullptr, 260); } -#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#endif // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) config.setValue("screen", fullscreen); } @@ -415,7 +415,7 @@ void Setup_Video::action(const ActionEvent &event) if (width != mainGraphics->mActualWidth || height != mainGraphics->mActualHeight) { -#if defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#if defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) if (intToRenderType(config.getIntValue("opengl")) == RENDER_SOFTWARE) { @@ -459,11 +459,11 @@ void Setup_Video::action(const ActionEvent &event) 260); } } -#else // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#else // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) mainGraphics->setWindowSize(width, height); WindowManager::doResizeVideo(width, height, false); -#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#endif // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) } config.setValue("oldscreen", config.getBoolValue("screen")); diff --git a/src/gui/widgets/tabs/setup_visual.cpp b/src/gui/widgets/tabs/setup_visual.cpp index 7f0dcdae9..4ddf7ef71 100644 --- a/src/gui/widgets/tabs/setup_visual.cpp +++ b/src/gui/widgets/tabs/setup_visual.cpp @@ -230,12 +230,12 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) : "vsyncEvent", mVSyncList, 100, MainConfig_true); -#if defined(WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) // TRANSLATORS: settings option new SetupItemCheckBox(_("Center game window"), "", "centerwindow", this, "centerwindowEvent", MainConfig_true); -#endif // defined(WIN32) || defined(__APPLE__) +#endif // defined(_WIN32) || defined(__APPLE__) // TRANSLATORS: settings option new SetupItemCheckBox(_("Allow screensaver to run"), @@ -269,7 +269,7 @@ void Setup_Visual::apply() { SetupTabScroll::apply(); WindowManager::applyGrabMode(); -#ifndef WIN32 +#ifndef _WIN32 WindowManager::applyScale(); -#endif // WIN32 +#endif // _WIN32 } diff --git a/src/gui/widgets/tabs/socialplayerstab.h b/src/gui/widgets/tabs/socialplayerstab.h index 029a24746..c3f9b4f1c 100644 --- a/src/gui/widgets/tabs/socialplayerstab.h +++ b/src/gui/widgets/tabs/socialplayerstab.h @@ -33,6 +33,7 @@ #include "utils/gettext.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "localconsts.h" diff --git a/src/gui/widgets/tabs/statdebugtab.cpp b/src/gui/widgets/tabs/statdebugtab.cpp index 63ce8aee8..f6d741a3f 100644 --- a/src/gui/widgets/tabs/statdebugtab.cpp +++ b/src/gui/widgets/tabs/statdebugtab.cpp @@ -31,6 +31,7 @@ #include "gui/windows/chatwindow.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "utils/perfstat.h" #include "utils/stringutils.h" #include "utils/timer.h" diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 6e750b2cb..70e348b4c 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -81,6 +81,7 @@ #include "resources/image/image.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/widgets/tabs/targetdebugtab.cpp b/src/gui/widgets/tabs/targetdebugtab.cpp index 4c43d2b29..5db850d5d 100644 --- a/src/gui/widgets/tabs/targetdebugtab.cpp +++ b/src/gui/widgets/tabs/targetdebugtab.cpp @@ -28,6 +28,7 @@ #include "gui/widgets/layouthelper.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "debug.h" diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index e1f41855c..9a949a8b1 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -72,6 +72,8 @@ #include "render/graphics.h" +#include "utils/performance.h" + #include <sstream> #include "debug.h" diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 4fd7403d2..d8e9b0268 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -85,6 +85,7 @@ #include "input/inputmanager.h" #include "utils/copynpaste.h" +#include "utils/performance.h" #include "utils/stringutils.h" #ifndef USE_SDL2 diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index c1fec888d..4b1187205 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -32,6 +32,8 @@ #include "render/graphics.h" +#include "utils/performance.h" + #include "debug.h" int TextPreview::instances = 0; diff --git a/src/gui/widgets/virtshortcutcontainer.cpp b/src/gui/widgets/virtshortcutcontainer.cpp index a78feae65..fbc18976c 100644 --- a/src/gui/widgets/virtshortcutcontainer.cpp +++ b/src/gui/widgets/virtshortcutcontainer.cpp @@ -39,6 +39,7 @@ #include "gui/windows/inventorywindow.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "debug.h" diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 46bb313e0..003044fcc 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -98,6 +98,7 @@ #include "utils/checkutils.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp index feb0745db..ac3bf67d6 100644 --- a/src/gui/widgets/windowcontainer.cpp +++ b/src/gui/widgets/windowcontainer.cpp @@ -28,6 +28,7 @@ #include "utils/checkutils.h" #include "utils/dtor.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index a198efe8f..d6f7bedbb 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -91,9 +91,9 @@ PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_image.h> -#ifdef WIN32 +#ifdef _WIN32 #include <SDL_syswm.h> -#endif // WIN32 +#endif // _WIN32 PRAGMA48(GCC diagnostic pop) #include "debug.h" @@ -419,17 +419,17 @@ void WindowManager::setIcon() { #if !defined(ANDROID) && !defined(__SWITCH__) std::string iconFile = branding.getValue("appIcon", "icons/manaplus"); -#ifdef WIN32 +#ifdef _WIN32 iconFile.append(".ico"); -#else // WIN32 +#else // _WIN32 iconFile.append(".png"); -#endif // WIN32 +#endif // _WIN32 iconFile = VirtFs::getPath(iconFile); logger->log("Loading icon from file: %s", iconFile.c_str()); -#ifdef WIN32 +#ifdef _WIN32 static SDL_SysWMinfo pInfo; if (mainGraphics) SDL::getWindowWMInfo(mainGraphics->getWindow(), &pInfo); @@ -458,17 +458,17 @@ void WindowManager::setIcon() if (icon) { -#ifdef WIN64 +#ifdef _WIN64 SetClassLongPtr(windowRef, GCLP_HICON, reinterpret_cast<LONG_PTR>(icon)); -#else // WIN64 +#else // _WIN64 SetClassLong(windowRef, GCL_HICON, reinterpret_cast<LONG>(icon)); -#endif // WIN64 +#endif // _WIN64 } -#else // WIN32 +#else // _WIN32 mIcon = MIMG_Load(iconFile.c_str()); if (mIcon != nullptr) @@ -482,7 +482,7 @@ void WindowManager::setIcon() SDL::SetWindowIcon(mainGraphics->getWindow(), mIcon); } -#endif // WIN32 +#endif // _WIN32 #endif // ANDROID } diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 1f0d71096..64a70ea58 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -43,6 +43,7 @@ #include "utils/dtor.h" #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "resources/imageset.h" @@ -149,7 +150,7 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : 11, // TRANSLATORS: long button name for cart window. _("Cart"), x, h, InputAction::WINDOW_CART, - Visible_true); + Visible_false); // TRANSLATORS: short button name for map window. addButton(N_("MAP"), 19, @@ -232,7 +233,7 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : 4, // TRANSLATORS: long button name for clan window. _("Clan"), x, h, InputAction::WINDOW_CLAN, - Visible_true); + Visible_false); // TRANSLATORS: short button name for server info window. addButton(N_("SI"), 8, @@ -489,6 +490,8 @@ void WindowMenu::updateButtons() void WindowMenu::loadButtons() { + // windowmenu<N> -> <button text> config keys tell which buttons are + // hidden. This overrides default visibility set in constructor. if (!mSmallWindow) { if (config.getValue("windowmenu0", "").empty()) diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index f35eb0874..9dd872bd7 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -51,6 +51,7 @@ #include "utils/delete2.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 66e7a886d..c7a2e0eef 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -47,6 +47,7 @@ #include "net/character.h" #include "net/charserverhandler.h" #include "net/logindata.h" +#include "net/loginhandler.h" #ifdef TMWA_SUPPORT #include "net/net.h" #endif // TMWA_SUPPORT @@ -71,9 +72,13 @@ CharSelectDialog::CharSelectDialog(LoginData &data) : ActionListener(), KeyListener(), mLoginData(&data), - // TRANSLATORS: char select dialog. button. - mSwitchLoginButton(new Button(this, _("Switch"), "switch", - BUTTON_SKIN, this)), + mSwitchLoginButton(new Button(this, + (loginHandler != nullptr && loginHandler->getWorlds().size() > 1) + // TRANSLATORS: char select dialog. button. + ? _("Switch World") : _("Logout"), + "switch", + BUTTON_SKIN, + this)), // TRANSLATORS: char select dialog. button. mChangePasswordButton(new Button(this, _("Password"), "change_password", BUTTON_SKIN, this)), @@ -102,11 +107,11 @@ CharSelectDialog::CharSelectDialog(LoginData &data) : placer = getPlacer(0, 0); // disable logout using -S - int row = 0; + int column = 0; if (!settings.options.uniqueSession) - placer(row++, 0, mSwitchLoginButton, 1, 1); - placer(row++, 0, mChangePasswordButton, 1, 1); - placer(row++, 0, mDeleteButton, 1, 1); + placer(column++, 0, mSwitchLoginButton, 1, 1); + placer(column++, 0, mChangePasswordButton, 1, 1); + placer(column++, 0, mDeleteButton, 1, 1); #ifdef TMWA_SUPPORT if (Net::getNetworkType() != ServerType::TMWATHENA) #endif @@ -117,7 +122,7 @@ CharSelectDialog::CharSelectDialog(LoginData &data) : "rename", BUTTON_SKIN, this); - placer(row++, 0, mRenameButton, 1, 1); + placer(column++, 0, mRenameButton, 1, 1); } #ifdef TMWA_SUPPORT if (serverFeatures->havePincode()) @@ -129,9 +134,9 @@ CharSelectDialog::CharSelectDialog(LoginData &data) : "changepin", BUTTON_SKIN, this); - placer(row++, 0, mChangePinButton, 1, 1); + placer(column++, 0, mChangePinButton, 1, 1); } - placer(row++, 0, mInfoButton, 1, 1); + placer(column++, 0, mInfoButton, 1, 1); for (int i = 0; i < CAST_S32(mLoginData->characterSlots); i++) { @@ -307,12 +312,16 @@ void CharSelectDialog::action(const ActionEvent &event) return; if ((mDeleteDialog != nullptr) && mDeleteIndex != -1) { + const Net::Character *const character + = mCharacterEntries[mDeleteIndex]->getCharacter(); if (serverFeatures->haveEmailOnDelete()) { attemptCharacterDelete(mDeleteIndex, mDeleteDialog->getText()); mDeleteDialog = nullptr; } - else if (mDeleteDialog->getText() == LoginDialog::savedPassword) + else if (character != nullptr && + character->dummy != nullptr && + mDeleteDialog->getText() == character->dummy->getName()) { attemptCharacterDelete(mDeleteIndex, ""); mDeleteDialog = nullptr; @@ -323,7 +332,7 @@ void CharSelectDialog::action(const ActionEvent &event) // TRANSLATORS: error header _("Error"), // TRANSLATORS: error message - _("Incorrect password"), + _("Incorrect character name"), // TRANSLATORS: ok dialog button _("OK"), DialogType::ERROR, @@ -497,11 +506,11 @@ void CharSelectDialog::askPasswordForDeletion(const int index) { CREATEWIDGETV(mDeleteDialog, TextDialog, // TRANSLATORS: char deletion question. - _("Enter password for deleting character"), + _("Enter character name to confirm deleting the character"), // TRANSLATORS: email label. - _("Enter password:"), + _("Enter character name:"), this, - true); + false); } mDeleteDialog->setActionEventId("try delete character"); mDeleteDialog->addActionListener(this); @@ -616,7 +625,7 @@ bool CharSelectDialog::selectByName(const std::string &name, void CharSelectDialog::close() { - client->setState(State::SWITCH_LOGIN); + client->setState(State::SWITCH_WORLD); Window::close(); } diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 8c445adb4..71e94adc6 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -52,6 +52,7 @@ #include "gui/windows/setupwindow.h" #include "gui/windows/whoisonline.h" +#include "gui/widgets/browserbox.h" #include "gui/widgets/button.h" #include "gui/widgets/chatinput.h" #include "gui/widgets/createwidget.h" @@ -77,6 +78,7 @@ #include "utils/copynpaste.h" #include "utils/delete2.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/translation/podict.h" diff --git a/src/gui/windows/clanwindow.cpp b/src/gui/windows/clanwindow.cpp index 3cd88b0c2..c64c81bb8 100644 --- a/src/gui/windows/clanwindow.cpp +++ b/src/gui/windows/clanwindow.cpp @@ -32,6 +32,7 @@ #include "utils/delete2.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/windows/connectiondialog.cpp b/src/gui/windows/connectiondialog.cpp index df13c6cc9..61392d914 100644 --- a/src/gui/windows/connectiondialog.cpp +++ b/src/gui/windows/connectiondialog.cpp @@ -29,6 +29,7 @@ #include "gui/widgets/progressindicator.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "client.h" diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp index f750f5500..7a875efa5 100644 --- a/src/gui/windows/debugwindow.cpp +++ b/src/gui/windows/debugwindow.cpp @@ -37,6 +37,7 @@ #include "utils/delete2.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 7aabce1db..f6c3cc643 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -51,6 +51,7 @@ #include "utils/dtor.h" #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "net/inventoryhandler.h" diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index ef6cee215..5681e8e04 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -1137,38 +1137,53 @@ void InventoryWindow::attributeChanged(const AttributesT id, } } -void InventoryWindow::combineItems(const int index1, - const int index2) +void InventoryWindow::combineItems(const int srcIndex, + const int dstIndex) { if (mInventory == nullptr) return; - const Item *item1 = mInventory->getItem(index1); - if (item1 == nullptr) + const Item *srcItem = mInventory->getItem(srcIndex); + if (srcItem == nullptr) return; - const Item *item2 = mInventory->getItem(index2); - if (item2 == nullptr) + const Item *dstItem = mInventory->getItem(dstIndex); + if (dstItem == nullptr) return; - if (item1->getType() != ItemType::Card) - { - const Item *tmpItem = item1; - item1 = item2; - item2 = tmpItem; - } + // Build up a total all-that-could-go-wrong list of messages. (note: + // this is a small subset of all the checks that hercules does). + // This way insertion will continue to work even if server removes + // some checks (I would prefer if the server sent failure messages + // itself, but it fails silently). + std::string question + = strprintf( + // TRANSLATORS: question dialog message + _("Insert %s into %s?"), + srcItem->getName().c_str(), + dstItem->getName().c_str()); + + if (srcItem->getType() != ItemType::Card) + // TRANSLATORS: failure reason appended to card insert question + (question += ' ') += _(" Item to be inserted may not be insertable."); + + if (dstItem->isEquipped() == Equipped_true) + // TRANSLATORS: failure reason appended to card insert question + (question += ' ') += _(" Destination item is equipped."); + + if (dstItem->isEquipment() == Equipm_false) + // TRANSLATORS: failure reason appended to card insert question + (question += " ") += _("Inserting into non-equipment items may fail."); ConfirmDialog *const confirmDlg = CREATEWIDGETR(ConfirmDialog, // TRANSLATORS: question dialog title _("Insert card request"), - // TRANSLATORS: question dialog message - strprintf(_("Insert %s into %s?"), - item1->getName().c_str(), - item2->getName().c_str()), + question, SOUND_REQUEST, false, Modal_true, nullptr); - insertCardListener.itemIndex = item2->getInvIndex(); - insertCardListener.cardIndex = item1->getInvIndex(); + + insertCardListener.itemIndex = dstItem->getInvIndex(); + insertCardListener.cardIndex = srcItem->getInvIndex(); confirmDlg->addActionListener(&insertCardListener); } diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index 96698d72f..0f4c13b46 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -158,8 +158,10 @@ class InventoryWindow final : public Window, const int64_t oldVal, const int64_t newVal) override final; - void combineItems(const int index1, - const int index2); + /* + * Attempt inserting one item (card) into another + */ + void combineItems(const int srcIndex, const int dstIndex); void moveItemToCraft(const int craftSlot); diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index cfe6886be..210c0d2bc 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -36,10 +36,11 @@ #include "being/playerinfo.h" #include "utils/gettext.h" +#include "utils/performance.h" -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#endif // WIN32 +#endif // _WIN32 #include "debug.h" diff --git a/src/gui/windows/maileditwindow.cpp b/src/gui/windows/maileditwindow.cpp index e7fad6aab..bd47710dc 100644 --- a/src/gui/windows/maileditwindow.cpp +++ b/src/gui/windows/maileditwindow.cpp @@ -67,7 +67,7 @@ MailEditWindow::MailEditWindow() : // TRANSLATORS: mail edit window label mMoneyLabel(new Label(this, _("Money:"))), // TRANSLATORS: mail edit window label - mItemLabel(new Label(this, _("Item:"))), + mItemLabel(new Label(this, _("Items:"))), // TRANSLATORS: mail edit window label mMessageLabel(new Label(this, _("Message:"))), mToField(new TextField(this, std::string(), LoseFocusOnTab_true, diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp index e534ce4b4..bddd03f74 100644 --- a/src/gui/windows/mailviewwindow.cpp +++ b/src/gui/windows/mailviewwindow.cpp @@ -50,7 +50,7 @@ MailViewWindow *mailViewWindow = nullptr; MailViewWindow::MailViewWindow(MailMessage *const message, const int itemsCount) : // TRANSLATORS: mail view window name - Window(_("View mail"), Modal_false, nullptr, "mailview.xml"), + Window(_("View Mail"), Modal_false, nullptr, "mailview.xml"), ActionListener(), mMessage(message), mGetAttachButton(new Button(this, @@ -153,6 +153,8 @@ MailViewWindow::~MailViewWindow() { if (mUseMail2) { + if (mDeleted) + delete mMessage; mMessage = nullptr; } else @@ -282,3 +284,16 @@ void MailViewWindow::removeMoney(const int64_t mailId) if (mailWindow != nullptr) mailWindow->refreshMailNames(); } + +bool MailViewWindow::notifyDeleteAndTransferOwnership(const int64_t mailId) +{ + if (mailId != mMessage->id) + return false; + setCaption("View Mail (DELETED)"); + mDeleted = true; + // this mail's ID no longer exists, so it no longer has a defined + // predecessor or successor. + mPrevButton->setEnabled(false); + mNextButton->setEnabled(false); + return true; +} diff --git a/src/gui/windows/mailviewwindow.h b/src/gui/windows/mailviewwindow.h index e275a55ed..edb939b33 100644 --- a/src/gui/windows/mailviewwindow.h +++ b/src/gui/windows/mailviewwindow.h @@ -55,6 +55,13 @@ class MailViewWindow final : public Window, void removeMoney(const int64_t mailId); + /** + * notify view window that mail has been deleted. + * MailViewWindow will delete the message when it is destroyed. + * returns true if mailId is the one being viewed (and thus ownership + * was transfered). + */ + bool notifyDeleteAndTransferOwnership(const int64_t mailId); private: void updateAttachButton(); @@ -75,6 +82,7 @@ class MailViewWindow final : public Window, ItemContainer *mItemContainer; ScrollArea *mItemScrollArea; bool mUseMail2; + bool mDeleted = false; }; extern MailViewWindow *mailViewWindow; diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp index 4f5f9cac5..cd3c8c6cf 100644 --- a/src/gui/windows/mailwindow.cpp +++ b/src/gui/windows/mailwindow.cpp @@ -92,25 +92,38 @@ MailWindow::MailWindow() : if (setupWindow != nullptr) setupWindow->registerWindowForReset(this); - setDefaultSize(310, 180, ImagePosition::CENTER, 0, 0); - setMinWidth(310); - setMinHeight(250); - center(); - + // use line wrapping of mail subjects, instead. mListScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); - - ContainerPlacer placer(nullptr, nullptr); - placer = getPlacer(0, 0); - - placer(0, 0, mListScrollArea, 4, 5).setPadding(3); - placer(4, 0, mRefreshButton, 1, 1); - placer(4, 1, mOpenButton, 1, 1); - placer(4, 2, mNewButton, 1, 1); - placer(4, 3, mDeleteButton, 1, 1); - placer(4, 4, mReturnButton, 1, 1); + // set reasonable minimum width for calculations below + mListScrollArea->setWidth(200); + + // at 0,0 and spawns/spans 4 columns and 6 rows + place(0, 0, mListScrollArea, 1, 6).setPadding(3); + // at column 5 and row 0... + place(1, 0, mRefreshButton, 1, 1); + place(1, 1, mOpenButton, 1, 1); + place(1, 2, mNewButton, 1, 1); + // Leave intentional gap in grid so that the button column (and thus, + // the whole window) can be resized without resizing any of the buttons. + // note: the empty cell still seems to enforce some padding, but this + // is fine. + place(1, 4, mDeleteButton, 1, 1); + place(1, 5, mReturnButton, 1, 1); Layout &layout = getLayout(); - layout.setRowHeight(0, LayoutType::SET); + // scrollarea column and 4th row eat all remaining available screen space. + layout.setColWidth(0, LayoutType::SET); + layout.setRowHeight(3, LayoutType::SET); + + // Enforce a minimum size. + int width = 0; + int height = 0; + layout.reflow(width, height); + setContentSize(width, height); + setMinWidth(getWidth()); + setMinHeight(getHeight()); + setDefaultSize(getWidth(), getHeight(), ImagePosition::CENTER, 0, 0); + center(); loadWindowState(); enableVisibleSound(true); @@ -244,7 +257,14 @@ void MailWindow::removeMail(const int64_t id) if ((message != nullptr) && message->id == id) { mMessages.erase(it); - delete message; + // passes ownership of message pointer to mailViewWindow, + // which will signal to reader that the mail is deleted and + // will do the final delete of the message upon destruction. + if (mailViewWindow == nullptr || + !mailViewWindow->notifyDeleteAndTransferOwnership(id)) + { + delete message; + } break; } } @@ -255,6 +275,13 @@ void MailWindow::removeMail(const int64_t id) if (message != nullptr) mMailModel->add(getMailHeader(message)); } + + // if player deleted the selected mail, then selection does not change + // (selects next one in list). However, if they deleted the last one, + // then we go to the previous one in list. + const auto lastIndex = mMailModel->getNumberOfElements() - 1; + if (mListBox->getSelected() > lastIndex) + mListBox->setSelected(lastIndex); } void MailWindow::showMessage(MailMessage *const mail, diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 40f650807..85e2c9dbf 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -54,6 +54,7 @@ #include "utils/gettext.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "utils/stdmove.h" diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 7e12aac0c..8b5159333 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -50,6 +50,7 @@ #include "utils/dtor.h" #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 2d4b58593..2061439af 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -76,6 +76,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #include <sstream> diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index 42d689802..0f9761a92 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -48,6 +48,7 @@ #include "gui/widgets/layout.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "resources/inventory/inventory.h" diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 1b6f3ae73..c28032404 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -49,12 +49,13 @@ #include "utils/delete2.h" #include "utils/foreach.h" #include "utils/langs.h" +#include "utils/performance.h" #include "debug.h" -#ifdef WIN32 +#ifdef _WIN32 #undef ERROR -#endif // WIN32 +#endif // _WIN32 static const int MAX_SERVERLIST = 15; diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index 43c5c2b29..cc48d4806 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -82,6 +82,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #ifdef TMWA_SUPPORT #include "resources/iteminfo.h" diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp index 5a0e83755..93afda6ad 100644 --- a/src/gui/windows/shortcutwindow.cpp +++ b/src/gui/windows/shortcutwindow.cpp @@ -38,6 +38,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index c7556e58f..0c9f16f5c 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -44,6 +44,8 @@ #include "net/tmwa/guildmanager.h" #endif // TMWA_SUPPORT +#include "utils/performance.h" + #include "debug.h" SocialWindow *socialWindow = nullptr; diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 55d0ba2b0..f15263d09 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -53,6 +53,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #include <sys/stat.h> @@ -430,11 +431,11 @@ void UpdaterWindow::loadNews() mScrollArea->setVerticalScrollAmount(0); } -void UpdaterWindow::loadPatch() +void UpdaterWindow::checkClientVersion() { if (mMemoryBuffer == nullptr) { - logger->log1("Couldn't load patch"); + logger->log1("Couldn't check client version: null buffer"); return; } @@ -443,13 +444,17 @@ void UpdaterWindow::loadPatch() realloc(mMemoryBuffer, mDownloadedBytes + 1)); if (mMemoryBuffer == nullptr) { - logger->log1("Couldn't load patch"); + logger->log1("Couldn't check client version: null buffer"); return; } mMemoryBuffer[mDownloadedBytes] = '\0'; std::string version; + // The version check file (latest.txt) is composed of two lines: + // first, the "machine readable" version (for alphanumeric comparison) + // and second, the human readable version, to be displayed. + // Tokenize and add each line separately char *line = strtok(mMemoryBuffer, "\n"); if (line != nullptr) @@ -460,6 +465,8 @@ void UpdaterWindow::loadPatch() line = strtok(nullptr, "\n"); if (line != nullptr) { + // if you wonder why this line is above the one below, it's + // because add to top is true. mBrowserBox->addRow(strprintf("##9 Latest client version: " "##6ManaVerse %s##0", line), true); } @@ -470,7 +477,7 @@ void UpdaterWindow::loadPatch() #if defined(ANDROID) const std::string url = "androidDownloadUrl"; const std::string text = "androidDownloadUrl"; -#elif defined(WIN32) +#elif defined(_WIN32) const std::string url = "windowsDownloadUrl"; const std::string text = "windowsDownloadUrl"; #else // defined(ANDROID) @@ -588,15 +595,16 @@ void UpdaterWindow::download() if (mDownloadStatus == UpdateDownloadStatus::UPDATE_PATCH) { mDownload = new Net::Download(this, - branding.getStringValue("updateMirror1") + mCurrentFile, + urlJoin(branding.getStringValue("updateMirror1"), mCurrentFile), &updateProgress, true, false, mValidateXml); + for (int f = 2; f < 8; f ++) { const std::string url = branding.getStringValue( "updateMirror" + toString(f)); if (!url.empty()) - mDownload->addMirror(url + mCurrentFile); + mDownload->addMirror(urlJoin(url, mCurrentFile)); } } else @@ -610,9 +618,9 @@ void UpdaterWindow::download() mDownloadStatus == UpdateDownloadStatus::UPDATE_RESOURCES2) { const std::string str = urlJoin(mUpdateServerPath, mCurrentFile); - mDownload->addMirror(updateServer3 + str); - mDownload->addMirror(updateServer4 + str); - mDownload->addMirror(updateServer5 + str); + mDownload->addMirror(urlJoin(updateServer3, str)); + mDownload->addMirror(urlJoin(updateServer4, str)); + mDownload->addMirror(urlJoin(updateServer5, str)); } else { @@ -824,10 +832,9 @@ void UpdaterWindow::logic() case UpdateDownloadStatus::UPDATE_PATCH: if (mDownloadComplete) { - // Parse current memory buffer as news and dispose of the data - loadPatch(); + checkClientVersion(); - mUpdateHost = updateServer2 + mUpdateServerPath; + mUpdateHost = urlJoin(updateServer2, mUpdateServerPath); mUpdatesDir = pathJoin(mUpdatesDir, "fix"); mCurrentFile = xmlUpdateFile; mValidateXml = true; diff --git a/src/gui/windows/updaterwindow.h b/src/gui/windows/updaterwindow.h index d08870e0e..7c5cc114c 100644 --- a/src/gui/windows/updaterwindow.h +++ b/src/gui/windows/updaterwindow.h @@ -106,7 +106,7 @@ class UpdaterWindow final : public Window, */ void loadNews(); - void loadPatch(); + void checkClientVersion(); void action(const ActionEvent &event) override final; diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index ca939df47..2cb1c1e16 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -62,6 +62,7 @@ #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "utils/sdlhelper.h" #ifdef TMWA_SUPPORT @@ -250,33 +251,22 @@ void WhoIsOnline::updateWindow(size_t numOnline) std::sort(mFriends.begin(), mFriends.end(), nameCompare); std::sort(mNeutral.begin(), mNeutral.end(), nameCompare); std::sort(mDisregard.begin(), mDisregard.end(), nameCompare); - bool addedFromSection(false); FOR_EACH (STD_VECTOR<OnlinePlayer*>::const_iterator, it, mFriends) - { mBrowserBox->addRow((*it)->getText(), false); - addedFromSection = true; - } - if (addedFromSection == true) - { + + if (!mFriends.empty()) mBrowserBox->addRow("---", false); - addedFromSection = false; - } + FOR_EACH (STD_VECTOR<OnlinePlayer*>::const_iterator, it, mEnemy) - { mBrowserBox->addRow((*it)->getText(), false); - addedFromSection = true; - } - if (addedFromSection == true) - { + + if (!mEnemy.empty()) mBrowserBox->addRow("---", false); - addedFromSection = false; - } + FOR_EACH (STD_VECTOR<OnlinePlayer*>::const_iterator, it, mNeutral) - { mBrowserBox->addRow((*it)->getText(), false); - addedFromSection = true; - } - if (addedFromSection == true && !mDisregard.empty()) + + if (!mNeutral.empty() && !mDisregard.empty()) mBrowserBox->addRow("---", false); FOR_EACH (STD_VECTOR<OnlinePlayer*>::const_iterator, it, mDisregard) diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index cf5d522e8..fd850637c 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -57,6 +57,7 @@ #include "utils/checkutils.h" #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "utils/stdmove.h" #include "utils/timer.h" diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp index 923288d35..b6bfe9a74 100644 --- a/src/input/joystick.cpp +++ b/src/input/joystick.cpp @@ -31,6 +31,7 @@ #include "input/inputmanager.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/timer.h" PRAGMA48(GCC diagnostic push) diff --git a/src/input/keyboardconfig.cpp b/src/input/keyboardconfig.cpp index 83a240cb6..a530e81ef 100644 --- a/src/input/keyboardconfig.cpp +++ b/src/input/keyboardconfig.cpp @@ -32,6 +32,7 @@ #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/listeners/actionlistener.h b/src/listeners/actionlistener.h index 3e07bb363..257556c54 100644 --- a/src/listeners/actionlistener.h +++ b/src/listeners/actionlistener.h @@ -87,7 +87,7 @@ class ActionListener notfinal { } /** - * Called when an action is recieved from a widget. It is used + * Called when an action is received from a widget. It is used * to be able to recieve a notification that an action has * occured. * diff --git a/src/listeners/inputactionreplayconfirmlistener.cpp b/src/listeners/inputactionreplayconfirmlistener.cpp new file mode 100644 index 000000000..0ac28677b --- /dev/null +++ b/src/listeners/inputactionreplayconfirmlistener.cpp @@ -0,0 +1,68 @@ +/* + * The ManaVerse Client + * Copyright (C) 2024-2025 The ManaVerse Developers + * + * This file is part of The ManaVerse Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "listeners/inputactionreplayconfirmlistener.h" + +#include "gui/windows/confirmdialog.h" + +#include "gui/widgets/createwidget.h" + +#include "input/inputmanager.h" + +#include "const/sound.h" + +#include "debug.h" + +InputActionReplayConfirmListener inputActionReplayConfirmListener; + +InputActionReplayConfirmListener::InputActionReplayConfirmListener() : + ActionListener(), + mDialog(nullptr), + mAction(InputAction::NO_VALUE) +{ +} + +void InputActionReplayConfirmListener::openDialog( + const std::string &title, + const std::string &text, + const InputActionT action0) +{ + CREATEWIDGETV(mDialog, ConfirmDialog, + title, text, + SOUND_REQUEST, + false, + Modal_true, + nullptr); + + mDialog->addActionListener(this); + mAction = action0; +} + +void InputActionReplayConfirmListener::action(const ActionEvent &event) +{ + if (mDialog != nullptr) + { + const std::string &eventId = event.getId(); + inputManager.executeChatCommand(mAction, eventId, nullptr); + // the dialog deletes itself with scheduleDelete() + mDialog = nullptr; + } + mAction = InputAction::NO_VALUE; +} diff --git a/src/listeners/inputactionreplayconfirmlistener.h b/src/listeners/inputactionreplayconfirmlistener.h new file mode 100644 index 000000000..c7c60e2ff --- /dev/null +++ b/src/listeners/inputactionreplayconfirmlistener.h @@ -0,0 +1,52 @@ +/* + * The ManaVerse Client + * Copyright (C) 2024-2025 The ManaVerse Developers + * + * This file is part of The ManaVerse Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef LISTENERS_INPUTACTIONREPLAYCONFIRMLISTENER_H +#define LISTENERS_INPUTACTIONREPLAYCONFIRMLISTENER_H + +#include "enums/input/inputaction.h" + +#include "listeners/actionlistener.h" + +#include "localconsts.h" + +class ConfirmDialog; + +class InputActionReplayConfirmListener final : public ActionListener +{ + public: + InputActionReplayConfirmListener(); + + A_DELETE_COPY(InputActionReplayConfirmListener) + + void action(const ActionEvent &event) override final; + + void openDialog(const std::string &title, + const std::string &text, + const InputActionT action0); + + protected: + ConfirmDialog *mDialog; + InputActionT mAction; +}; + +extern InputActionReplayConfirmListener inputActionReplayConfirmListener; + +#endif // LISTENERS_INPUTACTIONREPLAYCONFIRMLISTENER_H diff --git a/src/listeners/weightlistener.h b/src/listeners/weightlistener.h index 43eaf2f86..e87d3e852 100644 --- a/src/listeners/weightlistener.h +++ b/src/listeners/weightlistener.h @@ -31,7 +31,7 @@ extern OkDialog *weightNotice; /** - * Listener used for handling the overweigth message. + * Listener used for handling the overweight message. */ struct WeightListener final : public ActionListener { diff --git a/src/localconsts.h b/src/localconsts.h index 63a015cb5..174e3442d 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -24,6 +24,11 @@ #define ENABLEDEBUGLOG 1 +/* + * compile-time number of array elements + */ +#define NUM_ELEMENTS(array) (sizeof(array) / sizeof(array[0])) + #ifndef GCC_VERSION #define GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ @@ -396,8 +401,7 @@ PRAGMA45(GCC diagnostic pop) #ifdef DYECMD #undef USE_FUZZER #endif // DYECMD -#include "utils/perfomance.h" -UTILS_PERFOMANCE_H // guard for protect previous include + #ifdef HAVE_CONFIG_H #include "config.h" #endif // HAVE_CONFIG_H diff --git a/src/logger.cpp b/src/logger.cpp index 7c37ecdf4..b695948fb 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -33,11 +33,11 @@ #include <iostream> -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> #elif defined __APPLE__ #include <Carbon/Carbon.h> -#endif // WIN32 +#endif // _WIN32 #include <sys/time.h> @@ -441,7 +441,7 @@ void Logger::safeError(const std::string &error_text) error_text.c_str(), nullptr); #else // USE_SDL2 -#ifdef WIN32 +#ifdef _WIN32 MessageBox(nullptr, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); #elif defined __APPLE__ // Str255 msg; @@ -459,10 +459,10 @@ void Logger::safeError(const std::string &error_text) error_text).append("\""); if (system(msg.c_str()) == -1) std::cerr << "Error: " << error_text << std::endl; -#else // WIN32 +#else // _WIN32 std::cerr << "Error: " << error_text << std::endl; -#endif // WIN32 +#endif // _WIN32 #endif // USE_SDL2 exit(1); @@ -478,7 +478,7 @@ void Logger::error(const std::string &error_text) error_text.c_str(), nullptr); #else // USE_SDL2 -#ifdef WIN32 +#ifdef _WIN32 MessageBox(nullptr, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); #elif defined __APPLE__ // Str255 msg; @@ -496,10 +496,10 @@ void Logger::error(const std::string &error_text) "Please see log file for more information.\""); if (system(msg.c_str()) == -1) std::cerr << "Error: " << error_text << std::endl; -#else // WIN32 +#else // _WIN32 std::cerr << "Error: " << error_text << std::endl; -#endif // WIN32 +#endif // _WIN32 #endif // USE_SDL2 exit(1); diff --git a/src/main.cpp b/src/main.cpp index 58525134c..4b858c541 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,12 +23,12 @@ #include "maingui.h" -#ifdef WIN32 +#ifdef _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL.h> PRAGMA48(GCC diagnostic pop) -#endif // WIN32 +#endif // _WIN32 #include "debug.h" diff --git a/src/main.h b/src/main.h index 330c34069..7750af3b0 100644 --- a/src/main.h +++ b/src/main.h @@ -120,8 +120,8 @@ #define PACKAGE_OS "GNU Hurd" #elif defined __HAIKU__ #define PACKAGE_OS "Haiku" -#elif defined WIN32 || defined _WIN32 || defined __WIN32__ || defined __NT__ \ - || defined WIN64 || defined _WIN64 || defined __WIN64__ \ +#elif defined _WIN32 || defined __WIN32__ || defined __NT__ \ + || defined _WIN64 || defined __WIN64__ \ || defined __MINGW32__ || defined _MSC_VER #define PACKAGE_OS "Windows" #elif defined __native_client__ @@ -158,10 +158,12 @@ #define SIMD_NAME "" #endif // SIMD_SUPPORTED -#define PACKAGE_EXTENDED_VERSION "ManaPlus (" PACKAGE_OS \ -"; %s; " SDL_NAME ", " XML_NAME SIMD_NAME ", %s; 4144 v" SMALL_VERSION ")" +#define PACKAGE_EXTENDED_VERSION \ + PACKAGE_NAME " (" PACKAGE_OS "; %s; " \ + SDL_NAME ", " XML_NAME SIMD_NAME ", %s; v" SMALL_VERSION ")" -#define FULL_VERSION "ManaPlus " SMALL_VERSION " " PACKAGE_OS ", " \ +#define FULL_VERSION \ + PACKAGE_NAME " " SMALL_VERSION " " PACKAGE_OS ", " \ SDL_NAME ", " XML_NAME SIMD_NAME #ifdef ANDROID diff --git a/src/maingui.cpp b/src/maingui.cpp index 56a1658c8..8afc78a1d 100644 --- a/src/maingui.cpp +++ b/src/maingui.cpp @@ -133,8 +133,6 @@ void NxDeinit() } #endif -char *selfName = nullptr; - #ifndef UNITTESTS #ifdef ANDROID int main(int argc, char *argv[]) @@ -152,8 +150,6 @@ int mainGui(int argc, char *argv[]) LoadLibrary("exchndl.dll"); #endif // defined(__MINGW32__) - selfName = argv[0]; - parseOptions(argc, argv); std::ios::sync_with_stdio(false); @@ -171,9 +167,9 @@ int mainGui(int argc, char *argv[]) Mix_Init(MIX_INIT_OGG); #endif // SDL_MIXER_VERSION_ATLEAST(1, 2, 11) -#ifdef WIN32 +#ifdef _WIN32 SetCurrentDirectory(VirtFs::getBaseDir()); -#endif // WIN32 +#endif // _WIN32 setPriority(true); client = new Client; diff --git a/src/mumblemanager.cpp b/src/mumblemanager.cpp index f24df7242..fe8da60c4 100644 --- a/src/mumblemanager.cpp +++ b/src/mumblemanager.cpp @@ -32,9 +32,9 @@ PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_syswm.h> PRAGMA48(GCC diagnostic pop) -#ifndef WIN32 +#ifndef _WIN32 #include <sys/mman.h> -#endif // WIN32 +#endif // _WIN32 #include "debug.h" @@ -54,13 +54,13 @@ MumbleManager::~MumbleManager() { if (mLinkedMem) { -#ifdef WIN32 +#ifdef _WIN32 UnmapViewOfFile(mLinkedMem); #elif defined BSD4_4 -#else // WIN32 +#else // _WIN32 munmap(mLinkedMem, sizeof(LinkedMem)); -#endif // WIN32 +#endif // _WIN32 mLinkedMem = nullptr; } @@ -100,7 +100,7 @@ void MumbleManager::init() return; logger->log1("MumbleManager::init"); -#ifdef WIN32 +#ifdef _WIN32 HANDLE hMapObject = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, L"MumbleLink"); if (!hMapObject) @@ -120,7 +120,7 @@ void MumbleManager::init() return; } #elif defined BSD4_4 -#else // WIN32 +#else // _WIN32 char memName[256]; snprintf(memName, sizeof(memName), "/MumbleLink.%u", getuid()); @@ -145,7 +145,7 @@ void MumbleManager::init() return; } -#endif // WIN32 +#endif // _WIN32 wcsncpy(mLinkedMemCache.name, L"ManaVerse", 256); wcsncpy(mLinkedMemCache.description, L"ManaVerse Plugin", 2048); diff --git a/src/net/download.cpp b/src/net/download.cpp index eb6d0baac..fe3fda202 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -29,6 +29,7 @@ #include "fs/files.h" #include "utils/cast.h" +#include "utils/performance.h" #include "utils/sdlhelper.h" #include <zlib.h> diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp index c2cae22fe..0add2550b 100644 --- a/src/net/ea/beingrecv.cpp +++ b/src/net/ea/beingrecv.cpp @@ -42,6 +42,7 @@ #include "gui/windows/socialwindow.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "resources/map/map.h" diff --git a/src/net/ea/charserverrecv.cpp b/src/net/ea/charserverrecv.cpp index b80416287..44f67af91 100644 --- a/src/net/ea/charserverrecv.cpp +++ b/src/net/ea/charserverrecv.cpp @@ -35,6 +35,7 @@ #include "net/messagein.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/ea/chatrecv.cpp b/src/net/ea/chatrecv.cpp index 0a7f7d60f..d30cc767a 100644 --- a/src/net/ea/chatrecv.cpp +++ b/src/net/ea/chatrecv.cpp @@ -38,6 +38,7 @@ #include "net/messagein.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 947c1d795..7de5c5578 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -27,6 +27,7 @@ #include "net/ea/inventoryrecv.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/ea/inventoryrecv.cpp b/src/net/ea/inventoryrecv.cpp index 412f3cfda..8de2c23ab 100644 --- a/src/net/ea/inventoryrecv.cpp +++ b/src/net/ea/inventoryrecv.cpp @@ -40,6 +40,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "listeners/arrowslistener.h" diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index f6fb6cc9f..67df55f64 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -170,7 +170,7 @@ void LoginHandler::loginOrRegister(LoginData *const data) const serverConfig.setValue("remember", remember); // Clear the password, avoids auto login when returning to login - data->password.clear(); + //data->password.clear(); } void LoginHandler::logout() const diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp index 0c6203540..183facf00 100644 --- a/src/net/ea/network.cpp +++ b/src/net/ea/network.cpp @@ -31,6 +31,7 @@ #include "utils/cast.h" #include "utils/delete2.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "utils/sdlhelper.h" #include <sstream> diff --git a/src/net/ea/playerrecv.cpp b/src/net/ea/playerrecv.cpp index dc22c5204..ab588e95d 100644 --- a/src/net/ea/playerrecv.cpp +++ b/src/net/ea/playerrecv.cpp @@ -45,6 +45,7 @@ #include "net/playerhandler.h" +#include "utils/performance.h" #include "utils/stdmove.h" #include "utils/stringutils.h" diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index 314a89edd..2dbefbee5 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -69,6 +69,7 @@ #include "utils/checkutils.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/timer.h" #include "debug.h" diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp index 28805f51d..d6f66e739 100644 --- a/src/net/eathena/charserverrecv.cpp +++ b/src/net/eathena/charserverrecv.cpp @@ -53,6 +53,7 @@ #include "utils/dtor.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/eathena/chatrecv.cpp b/src/net/eathena/chatrecv.cpp index 2945c61ae..6c32dd46d 100644 --- a/src/net/eathena/chatrecv.cpp +++ b/src/net/eathena/chatrecv.cpp @@ -47,6 +47,7 @@ #include "resources/chatobject.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "debug.h" diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index e6b105f49..aa3979e81 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -61,6 +61,7 @@ #include "utils/checkutils.h" #include "utils/gettext.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/stringutils.h" #include "debug.h" diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index 8af8d85f4..f84b8cf2f 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -47,6 +47,7 @@ #include "net/playerhandler.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/net.cpp b/src/net/net.cpp index 377da5426..fbfb2dd12 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -34,6 +34,7 @@ #include "net/eathena/generalhandler.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/packetcounters.cpp b/src/net/packetcounters.cpp index 809e42bb7..2cc601871 100644 --- a/src/net/packetcounters.cpp +++ b/src/net/packetcounters.cpp @@ -24,6 +24,7 @@ #include "net/packetcounters.h" #include "utils/cast.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp index 04c2562d5..bb26e4612 100644 --- a/src/net/tmwa/beingrecv.cpp +++ b/src/net/tmwa/beingrecv.cpp @@ -53,6 +53,7 @@ #include "resources/db/itemdb.h" #include "utils/timer.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp index 8f80deec4..d67f76870 100644 --- a/src/net/tmwa/charserverrecv.cpp +++ b/src/net/tmwa/charserverrecv.cpp @@ -50,6 +50,7 @@ #include "utils/dtor.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/tmwa/chatrecv.cpp b/src/net/tmwa/chatrecv.cpp index 47f38a1fa..0a546666f 100644 --- a/src/net/tmwa/chatrecv.cpp +++ b/src/net/tmwa/chatrecv.cpp @@ -46,6 +46,7 @@ #include "net/tmwa/guildmanager.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 215793e44..aeed2c04d 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -36,6 +36,8 @@ #include "net/tmwa/network.h" #include "net/tmwa/protocolout.h" +#include "utils/performance.h" + #include "debug.h" namespace TmwAthena diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index f41963011..5662357d4 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -75,6 +75,7 @@ #include "utils/delete2.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/tmwa/inventoryrecv.cpp b/src/net/tmwa/inventoryrecv.cpp index da7f59c84..0ce7be70d 100644 --- a/src/net/tmwa/inventoryrecv.cpp +++ b/src/net/tmwa/inventoryrecv.cpp @@ -41,6 +41,8 @@ #include "net/ea/equipbackend.h" #include "net/ea/inventoryrecv.h" +#include "utils/performance.h" + #include "debug.h" namespace TmwAthena diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index edeef2102..48b808592 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -61,6 +61,7 @@ #include "net/tmwa/messagein.h" #include "utils/cast.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/net/tmwa/playerrecv.cpp b/src/net/tmwa/playerrecv.cpp index ecdfcc8bc..dd0e64ec1 100644 --- a/src/net/tmwa/playerrecv.cpp +++ b/src/net/tmwa/playerrecv.cpp @@ -36,6 +36,8 @@ #include "net/messagein.h" +#include "utils/performance.h" + #include "debug.h" extern unsigned int tmwServerVersion; diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp index aed5dd9f8..af7720911 100644 --- a/src/notifymanager.cpp +++ b/src/notifymanager.cpp @@ -83,11 +83,9 @@ namespace NotifyManager void notify(const unsigned int message) { - if (message >= NotifyTypes::TYPE_END || - localChatTab == nullptr) - { + if (message >= NotifyTypes::TYPE_END) return; - } + const NotificationInfo &info = notifications[message]; if (*info.text == 0) { @@ -98,10 +96,7 @@ namespace NotifyManager switch (info.flags) { case NotifyFlags::EMPTY: - localChatTab->chatLog(gettext(info.text), - ChatMsgType::BY_SERVER, - IgnoreRecord_false, - TryRemoveColors_true); + chatLog(localChatTab, gettext(info.text)); break; case NotifyFlags::GUILD: @@ -139,31 +134,22 @@ namespace NotifyManager void notify(const unsigned int message, const int num) { - if (message >= NotifyTypes::TYPE_END || - localChatTab == nullptr) - { + if (message >= NotifyTypes::TYPE_END) return; - } + const NotificationInfo &info = notifications[message]; if (info.flags == NotifyFlags::INT && *info.text != 0) { - localChatTab->chatLog( - strprintf(gettext(info.text), num), - ChatMsgType::BY_SERVER, - IgnoreRecord_false, - TryRemoveColors_true); + chatLog(localChatTab, strprintf(gettext(info.text), num)); } soundManager.playSfx(SoundDB::getSound(message), 0, 0); } void notify(const unsigned int message, const std::string &str) { - if (message >= NotifyTypes::TYPE_END || - localChatTab == nullptr) - { + if (message >= NotifyTypes::TYPE_END) return; - } soundManager.playSfx(SoundDB::getSound(message), 0, 0); @@ -182,14 +168,9 @@ namespace NotifyManager switch (info.flags) { case NotifyFlags::STRING: - { - localChatTab->chatLog( - strprintf(gettext(info.text), str.c_str()), - ChatMsgType::BY_SERVER, - IgnoreRecord_false, - TryRemoveColors_true); + chatLog(localChatTab, + strprintf(gettext(info.text), str.c_str())); break; - } case NotifyFlags::GUILD_STRING: { ChatTab *const tab = getGuildTab(); diff --git a/src/particle/imageparticle.cpp b/src/particle/imageparticle.cpp index 5dde7a622..cf2411e9a 100644 --- a/src/particle/imageparticle.cpp +++ b/src/particle/imageparticle.cpp @@ -27,6 +27,8 @@ #include "resources/image/image.h" +#include "utils/performance.h" + #include "debug.h" StringIntMap ImageParticle::imageParticleCountByName; diff --git a/src/particle/particleemitterprop.h b/src/particle/particleemitterprop.h index d82f188ac..0d1f9e5cb 100644 --- a/src/particle/particleemitterprop.h +++ b/src/particle/particleemitterprop.h @@ -30,6 +30,11 @@ #include "localconsts.h" +// required by MSYS2 / Windows +#ifndef M_PI +#define M_PI 3.1415926535897932384626433832795 +#endif + template <typename T> struct ParticleEmitterProp final { ParticleEmitterProp() : diff --git a/src/particle/textparticle.cpp b/src/particle/textparticle.cpp index 1d699cc0f..15517e018 100644 --- a/src/particle/textparticle.cpp +++ b/src/particle/textparticle.cpp @@ -29,6 +29,8 @@ #include "render/graphics.h" +#include "utils/performance.h" + #include "debug.h" TextParticle::TextParticle(const std::string &restrict text, diff --git a/src/progs/dyecmd/client.cpp b/src/progs/dyecmd/client.cpp index a892b758c..a1d69fd30 100644 --- a/src/progs/dyecmd/client.cpp +++ b/src/progs/dyecmd/client.cpp @@ -65,6 +65,7 @@ #include "utils/gettext.h" #include "utils/gettexthelper.h" #include "utils/mrand.h" +#include "utils/performance.h" #ifdef ANDROID #include "fs/paths.h" #endif // ANDROID @@ -78,7 +79,7 @@ #include "net/ipc.h" -#ifdef WIN32 +#ifdef _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_syswm.h> @@ -86,9 +87,9 @@ PRAGMA48(GCC diagnostic pop) #include <sys/time.h> #include "fs/specialfolder.h" #undef ERROR -#else // WIN32 +#else // _WIN32 #include <ctime> -#endif // WIN32 +#endif // _WIN32 #ifdef ANDROID #ifndef USE_SDL2 @@ -260,9 +261,10 @@ void Client::gameInit() eventsManager.init(); eventsManager.enableEvents(); -#ifdef WIN32 +#ifdef _WIN32 Dirs::mountDataDir(); -#endif // WIN32 +#endif // _WIN32 + #ifndef USE_SDL2 WindowManager::setIcon(); #endif // USE_SDL2 @@ -286,10 +288,10 @@ void Client::gameInit() SDL::allowScreenSaver(config.getBoolValue("allowscreensaver")); initGraphics(); -#ifndef WIN32 +#ifndef _WIN32 Dirs::extractDataDir(); Dirs::mountDataDir(); -#endif // WIN32 +#endif // _WIN32 Dirs::updateDataPath(); @@ -507,7 +509,7 @@ void Client::gameClear() logger->log1("Quitting11"); #ifdef USE_PROFILER - Perfomance::clear(); + Performance::clear(); #endif // USE_PROFILER #ifdef DEBUG_OPENGL_LEAKS @@ -775,7 +777,7 @@ void Client::moveButtons(const int width) { int x = width - mSetupButton->getWidth() - mButtonPadding; mSetupButton->setPosition(x, mButtonPadding); -#ifndef WIN32 +#ifndef _WIN32 x -= mPerfomanceButton->getWidth() + mButtonSpacing; mPerfomanceButton->setPosition(x, mButtonPadding); @@ -794,7 +796,7 @@ void Client::moveButtons(const int width) x -= mCloseButton->getWidth() + mButtonSpacing; mCloseButton->setPosition(x, mButtonPadding); #endif // ANDROID -#endif // WIN32 +#endif // _WIN32 } } diff --git a/src/progs/dyecmd/gui/viewport.cpp b/src/progs/dyecmd/gui/viewport.cpp index 7c6594ccc..574f0b19e 100644 --- a/src/progs/dyecmd/gui/viewport.cpp +++ b/src/progs/dyecmd/gui/viewport.cpp @@ -31,6 +31,8 @@ #include "render/graphics.h" +#include "utils/performance.h" + #include "debug.h" Viewport *viewport = nullptr; diff --git a/src/progs/manaverse/actions/commands.cpp b/src/progs/manaverse/actions/commands.cpp index 9a622b627..668c54b80 100644 --- a/src/progs/manaverse/actions/commands.cpp +++ b/src/progs/manaverse/actions/commands.cpp @@ -58,6 +58,7 @@ #include "input/inputactionoperators.h" #include "listeners/inputactionreplaylistener.h" +#include "listeners/inputactionreplayconfirmlistener.h" #include "net/adminhandler.h" #include "net/chathandler.h" @@ -966,7 +967,22 @@ impHandler(setHomunculusName) impHandler0(fireHomunculus) { - if (homunculusHandler != nullptr) + const HomunculusInfo *const info = PlayerInfo::getHomunculus(); + if (info == nullptr) + return false; + + const std::string &args = event.args; + if (args.empty()) + { + inputActionReplayConfirmListener.openDialog( + // TRANSLATORS: dialog title + _("Really?"), + // TRANSLATORS: dialog question + _("Really kill your homunculous? This is irreversible!"), + InputAction::HOMUNCULUS_FIRE); + return true; + } + else if (args == "yes" && homunculusHandler != nullptr) { homunculusHandler->fire(); return true; diff --git a/src/progs/manaverse/client.cpp b/src/progs/manaverse/client.cpp index ece3c9d8d..980ffdc91 100644 --- a/src/progs/manaverse/client.cpp +++ b/src/progs/manaverse/client.cpp @@ -128,6 +128,7 @@ #ifdef ANDROID #include "fs/paths.h" #endif // ANDROID +#include "utils/performance.h" #include "utils/perfstat.h" #include "utils/sdlcheckutils.h" #include "utils/sdlhelper.h" @@ -145,14 +146,14 @@ #include "configuration.h" #endif // USE_OPENGL -#ifdef WIN32 +#ifdef _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_syswm.h> PRAGMA48(GCC diagnostic pop) #include "fs/specialfolder.h" #undef ERROR -#endif // WIN32 +#endif // _WIN32 #ifdef ANDROID #ifndef USE_SDL2 @@ -392,9 +393,9 @@ void Client::gameInit() eventsManager.init(); eventsManager.enableEvents(); -#ifdef WIN32 +#ifdef _WIN32 Dirs::mountDataDir(); -#endif // WIN32 +#endif // _WIN32 #ifndef USE_SDL2 WindowManager::setIcon(); #endif // USE_SDL2 @@ -424,10 +425,10 @@ void Client::gameInit() touchManager.init(); -#ifndef WIN32 +#ifndef _WIN32 Dirs::extractDataDir(); Dirs::mountDataDir(); -#endif // WIN32 +#endif // _WIN32 Dirs::updateDataPath(); @@ -754,7 +755,7 @@ void Client::gameClear() logger->log1("Quitting11"); #ifdef USE_PROFILER - Perfomance::clear(); + Performance::clear(); #endif // USE_PROFILER #ifdef DEBUG_OPENGL_LEAKS @@ -1579,6 +1580,34 @@ int Client::gameExec() BLOCK_END("Client::gameExec State::SWITCH_SERVER") break; + case State::SWITCH_WORLD: + BLOCK_START("Client::gameExec State::SWITCH_WORLD") + logger->log1("State: SWITCH WORLD"); + + if (loginHandler != nullptr) + { + loginHandler->logout(); + loginHandler->disconnect(); + } + if (gameHandler != nullptr) + gameHandler->disconnect(); + if (loginHandler != nullptr) + loginHandler->connect(); + + if (loginHandler != nullptr && + loginHandler->getWorlds().size() > 1) + { + mState = State::LOGIN_ATTEMPT; + } + else + { + settings.login.clear(); + WindowManager::updateTitle(); + mState = State::LOGIN; + } + BLOCK_END("Client::gameExec State::SWITCH_WORLD") + break; + case State::SWITCH_LOGIN: BLOCK_START("Client::gameExec State::SWITCH_LOGIN") logger->log1("State: SWITCH LOGIN"); @@ -1880,7 +1909,7 @@ void Client::moveButtons(const int width) { int x = width - mSetupButton->getWidth() - mButtonPadding; mSetupButton->setPosition(x, mButtonPadding); -#ifndef WIN32 +#ifndef _WIN32 x -= mPerfomanceButton->getWidth() + mButtonSpacing; mPerfomanceButton->setPosition(x, mButtonPadding); @@ -1899,7 +1928,7 @@ void Client::moveButtons(const int width) x -= mCloseButton->getWidth() + mButtonSpacing; mCloseButton->setPosition(x, mButtonPadding); #endif // ANDROID -#endif // WIN32 +#endif // _WIN32 } } diff --git a/src/progs/manaverse/gui/viewport.cpp b/src/progs/manaverse/gui/viewport.cpp index 4902b7175..654559967 100644 --- a/src/progs/manaverse/gui/viewport.cpp +++ b/src/progs/manaverse/gui/viewport.cpp @@ -53,6 +53,7 @@ #include "utils/checkutils.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "resources/map/map.h" #include "resources/map/mapitem.h" diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp index 199e547aa..df4814bc1 100644 --- a/src/render/mobileopengl2graphics.cpp +++ b/src/render/mobileopengl2graphics.cpp @@ -43,6 +43,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "debug.h" diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index d99f8b2a3..23163247c 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -41,6 +41,7 @@ #include "resources/image/image.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "debug.h" diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp index e5b8a7bce..a1237e130 100644 --- a/src/render/modernopenglgraphics.cpp +++ b/src/render/modernopenglgraphics.cpp @@ -45,6 +45,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "utils/sdlhelper.h" diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index 06a765580..9fff18311 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -41,6 +41,7 @@ #include "resources/image/image.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "debug.h" diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp index e09f13b6b..470d35b83 100644 --- a/src/render/nullopenglgraphics.cpp +++ b/src/render/nullopenglgraphics.cpp @@ -36,6 +36,8 @@ #include "resources/image/image.h" +#include "utils/performance.h" + #include "debug.h" GLuint NullOpenGLGraphics::mTextureBinded = 0; diff --git a/src/render/opengl/mgl.hpp b/src/render/opengl/mgl.hpp index 9dce907a4..4599c3855 100644 --- a/src/render/opengl/mgl.hpp +++ b/src/render/opengl/mgl.hpp @@ -140,6 +140,6 @@ defName(glTextureSubImage2D); defName(glTextureSubImage2DEXT); defName(glClearTexImage); defName(glClearTexSubImage); -#ifdef WIN32 +#ifdef _WIN32 defName(wglGetExtensionsString); -#endif +#endif // _WIN32 diff --git a/src/render/opengl/mglfunctions.h b/src/render/opengl/mglfunctions.h index b583e3625..dfc31718b 100644 --- a/src/render/opengl/mglfunctions.h +++ b/src/render/opengl/mglfunctions.h @@ -28,7 +28,7 @@ LOGGER_H -#ifdef WIN32 +#ifdef _WIN32 #define getFunction(name) wglGetProcAddress(name) #elif defined ANDROID #define getFunction(name) eglGetProcAddress(name) @@ -38,10 +38,10 @@ LOGGER_H #define getFunction(name) glGetProcAddressREGAL(name) #elif defined(__SWITCH__) #define getFunction(name) SDL_GL_GetProcAddress(name) -#else // WIN32 +#else // _WIN32 #define getFunction(name) glXGetProcAddress(\ reinterpret_cast<const GLubyte*>(name)) -#endif // WIN32 +#endif // _WIN32 #define assignFunction(func) \ { \ diff --git a/src/render/opengl/mgltypes.h b/src/render/opengl/mgltypes.h index 2d8759796..e3954aa1b 100644 --- a/src/render/opengl/mgltypes.h +++ b/src/render/opengl/mgltypes.h @@ -231,11 +231,11 @@ typedef void (APIENTRY *glDebugMessageCallback_t) (GLDEBUGPROC_t callback, const void *userParam); -#ifdef WIN32 +#ifdef _WIN32 typedef const char* (APIENTRY * wglGetExtensionsString_t) (HDC hdc); -#else // WIN32 +#else // _WIN32 #define CALLBACK -#endif // WIN32 +#endif // _WIN32 #endif // USE_OPENGL #endif // RENDER_OPENGL_MGLTYPES_H diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp index 4605a4e95..2c3d1f2bb 100644 --- a/src/render/safeopenglgraphics.cpp +++ b/src/render/safeopenglgraphics.cpp @@ -33,6 +33,7 @@ #include "resources/image/image.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "debug.h" diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp index f44901469..f25a5ef74 100644 --- a/src/render/sdl2graphics.cpp +++ b/src/render/sdl2graphics.cpp @@ -77,6 +77,7 @@ #include "resources/image/image.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "debug.h" diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp index 35b7b7539..4f5e275f4 100644 --- a/src/render/sdl2softwaregraphics.cpp +++ b/src/render/sdl2softwaregraphics.cpp @@ -34,8 +34,8 @@ #include "resources/image/image.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" - #include "utils/sdlpixel.h" #include "debug.h" diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index 558fbc734..910c511ee 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -27,16 +27,16 @@ #include "graphicsmanager.h" -#include "utils/sdlcheckutils.h" - -#include "utils/sdlpixel.h" - #include "render/vertexes/imagecollection.h" #include "resources/imagerect.h" #include "resources/image/image.h" +#include "utils/performance.h" +#include "utils/sdlcheckutils.h" +#include "utils/sdlpixel.h" + #include "debug.h" #ifndef SDL_BIG_ENDIAN diff --git a/src/render/surfacegraphics.cpp b/src/render/surfacegraphics.cpp index 87676a37c..de539ffe8 100644 --- a/src/render/surfacegraphics.cpp +++ b/src/render/surfacegraphics.cpp @@ -29,6 +29,8 @@ #include "resources/image/image.h" +#include "utils/performance.h" + #include "debug.h" SurfaceGraphics::SurfaceGraphics() : diff --git a/src/resources/animation/simpleanimation.cpp b/src/resources/animation/simpleanimation.cpp index 818830383..98f8dbfab 100644 --- a/src/resources/animation/simpleanimation.cpp +++ b/src/resources/animation/simpleanimation.cpp @@ -37,6 +37,7 @@ #include "utils/checkutils.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/resources/atlas/atlasmanager.cpp b/src/resources/atlas/atlasmanager.cpp index a2a4b112f..c9ea324dd 100644 --- a/src/resources/atlas/atlasmanager.cpp +++ b/src/resources/atlas/atlasmanager.cpp @@ -31,9 +31,6 @@ #include "fs/virtfs/rwops.h" -#include "utils/mathutils.h" -#include "utils/sdlcheckutils.h" - #include "resources/openglimagehelper.h" #include "resources/atlas/atlasresource.h" @@ -51,6 +48,9 @@ PRAGMA48(GCC diagnostic ignored "-Wshadow") PRAGMA48(GCC diagnostic pop) #include "utils/checkutils.h" +#include "utils/mathutils.h" +#include "utils/performance.h" +#include "utils/sdlcheckutils.h" #include "debug.h" diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 1370b7950..1280f8b79 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -349,7 +349,7 @@ void ItemDB::loadXmlFile(const std::string &fileName, if (iconColors.empty()) iconColors = colors; - // check for empty hair palete + // check for empty hair palette if (id <= -1 && id > -100) { if (colors.empty()) diff --git a/src/resources/delayedmanager.cpp b/src/resources/delayedmanager.cpp index 6276665bb..997715dd8 100644 --- a/src/resources/delayedmanager.cpp +++ b/src/resources/delayedmanager.cpp @@ -24,6 +24,7 @@ #include "resources/sprite/animationdelayload.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/timer.h" #include "debug.h" diff --git a/src/resources/dye/dye.cpp b/src/resources/dye/dye.cpp index ff40545fc..a72bf8419 100644 --- a/src/resources/dye/dye.cpp +++ b/src/resources/dye/dye.cpp @@ -148,9 +148,9 @@ void Dye::instantiate(std::string &restrict target, int Dye::getType() const restrict2 noexcept2 { - if (mDyePalettes[sPaleteIndex] != nullptr) + if (mDyePalettes[sPaletteIndex] != nullptr) return 1; - if (mDyePalettes[aPaleteIndex] != nullptr) + if (mDyePalettes[aPaletteIndex] != nullptr) return 2; return 0; } diff --git a/src/resources/dye/dye.h b/src/resources/dye/dye.h index c359c9b24..442721c6a 100644 --- a/src/resources/dye/dye.h +++ b/src/resources/dye/dye.h @@ -31,8 +31,8 @@ class DyePalette; const int dyePalateSize = 9; -const int sPaleteIndex = 7; -const int aPaleteIndex = 8; +const int sPaletteIndex = 7; +const int aPaletteIndex = 8; /** * Class for dispatching pixel-recoloring amongst several palettes. @@ -62,16 +62,16 @@ class Dye final const std::string &restrict palettes); /** - * Return special dye palete (S) + * Return special dye palette (S) */ - const DyePalette *getSPalete() const restrict2 noexcept2 A_WARN_UNUSED - { return mDyePalettes[sPaleteIndex]; } + const DyePalette *getSPalette() const restrict2 noexcept2 A_WARN_UNUSED + { return mDyePalettes[sPaletteIndex]; } /** - * Return special dye palete (A) + * Return special dye palette (A) */ - const DyePalette *getAPalete() const restrict2 noexcept2 A_WARN_UNUSED - { return mDyePalettes[aPaleteIndex]; } + const DyePalette *getAPalette() const restrict2 noexcept2 A_WARN_UNUSED + { return mDyePalettes[aPaletteIndex]; } /** * Return dye type for S - 1, for A - 2, 0 for other diff --git a/src/resources/dye/dyepalette.h b/src/resources/dye/dyepalette.h index 7f57e3c5f..cffa985d1 100644 --- a/src/resources/dye/dyepalette.h +++ b/src/resources/dye/dyepalette.h @@ -51,7 +51,7 @@ class DyePalette final * The string is either a file name or a sequence of hexadecimal RGB * values separated by ',' and starting with '#'. */ - DyePalette(const std::string &restrict pallete, + DyePalette(const std::string &restrict description, const uint8_t blockSize); A_DELETE_COPY(DyePalette) diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp index b400dd1f9..71f3cc5a9 100644 --- a/src/resources/imagehelper.cpp +++ b/src/resources/imagehelper.cpp @@ -28,6 +28,7 @@ #include "resources/dye/dye.h" #include "resources/dye/dyepalette.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" PRAGMA48(GCC diagnostic push) @@ -105,14 +106,14 @@ Image *ImageHelper::load(SDL_RWops *const rw, Dye const &dye) { case 1: { - const DyePalette *const pal = dye.getSPalete(); + const DyePalette *const pal = dye.getSPalette(); if (pal != nullptr) DYEPALETTEP(pal, SColor)(pixels, surf->w * surf->h); break; } case 2: { - const DyePalette *const pal = dye.getAPalete(); + const DyePalette *const pal = dye.getAPalette(); if (pal != nullptr) DYEPALETTEP(pal, AColor)(pixels, surf->w * surf->h); break; diff --git a/src/resources/loaders/imageloader.cpp b/src/resources/loaders/imageloader.cpp index a24e63e36..48100dce6 100644 --- a/src/resources/loaders/imageloader.cpp +++ b/src/resources/loaders/imageloader.cpp @@ -34,6 +34,7 @@ #include "resources/dye/dye.h" #include "utils/checkutils.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index bfc7c7534..8b4196092 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -70,6 +70,7 @@ #include "utils/delete2.h" #include "utils/dtor.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/timer.h" #include <sys/stat.h> diff --git a/src/resources/map/mapitem.cpp b/src/resources/map/mapitem.cpp index 5041165c3..27c3617db 100644 --- a/src/resources/map/mapitem.cpp +++ b/src/resources/map/mapitem.cpp @@ -34,6 +34,8 @@ #include "render/graphics.h" +#include "utils/performance.h" + #include "debug.h" MapItem::MapItem() : diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp index 44c71b0c9..d910edd1d 100644 --- a/src/resources/map/maplayer.cpp +++ b/src/resources/map/maplayer.cpp @@ -35,6 +35,7 @@ #ifdef USE_OPENGL #include "utils/foreach.h" #endif // USE_OPENGL +#include "utils/performance.h" #include "render/graphics.h" diff --git a/src/resources/map/speciallayer.cpp b/src/resources/map/speciallayer.cpp index 597d53141..b42302099 100644 --- a/src/resources/map/speciallayer.cpp +++ b/src/resources/map/speciallayer.cpp @@ -29,6 +29,7 @@ #include "utils/delete2.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 88bd312d8..5b0dbc080 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -61,8 +61,8 @@ #include "utils/base64.h" #include "utils/checkutils.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "utils/stringmap.h" - #include "utils/translation/podict.h" #include <zlib.h> diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index 9f3b1fcd4..2221ffb05 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -45,6 +45,7 @@ #include "resources/image/image.h" #include "utils/checkutils.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "debug.h" @@ -86,14 +87,14 @@ Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye) { case 1: { - const DyePalette *const pal = dye.getSPalete(); + const DyePalette *const pal = dye.getSPalette(); if (pal != nullptr) DYEPALETTEP(pal, SOGLColor)(pixels, surf->w * surf->h); break; } case 2: { - const DyePalette *const pal = dye.getAPalete(); + const DyePalette *const pal = dye.getAPalette(); if (pal != nullptr) DYEPALETTEP(pal, AOGLColor)(pixels, surf->w * surf->h); break; diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index ea3bb9133..45a17565e 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -36,6 +36,7 @@ #include "utils/cast.h" #include "utils/checkutils.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/stringutils.h" #if !defined(DEBUG_DUMP_LEAKS) && !defined(UNITTESTS) diff --git a/src/resources/safeopenglimagehelper.cpp b/src/resources/safeopenglimagehelper.cpp index 7c273829e..962d1434a 100644 --- a/src/resources/safeopenglimagehelper.cpp +++ b/src/resources/safeopenglimagehelper.cpp @@ -41,6 +41,7 @@ #include "resources/image/image.h" +#include "utils/performance.h" #include "utils/sdlcheckutils.h" #include "debug.h" @@ -83,14 +84,14 @@ Image *SafeOpenGLImageHelper::load(SDL_RWops *const rw, { case 1: { - const DyePalette *const pal = dye.getSPalete(); + const DyePalette *const pal = dye.getSPalette(); if (pal != nullptr) DYEPALETTEP(pal, SOGLColor)(pixels, surf->w * surf->h); break; } case 2: { - const DyePalette *const pal = dye.getAPalete(); + const DyePalette *const pal = dye.getAPalette(); if (pal != nullptr) DYEPALETTEP(pal, AOGLColor)(pixels, surf->w * surf->h); break; diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp index ab780cd33..d9a5e27dd 100644 --- a/src/resources/sdlimagehelper.cpp +++ b/src/resources/sdlimagehelper.cpp @@ -109,14 +109,14 @@ Image *SDLImageHelper::load(SDL_RWops *const rw, Dye const &dye) { case 1: { - const DyePalette *const pal = dye.getSPalete(); + const DyePalette *const pal = dye.getSPalette(); if (pal != nullptr) DYEPALETTEP(pal, SColor)(pixels, surf->w * surf->h); break; } case 2: { - const DyePalette *const pal = dye.getAPalete(); + const DyePalette *const pal = dye.getAPalette(); if (pal != nullptr) DYEPALETTEP(pal, AColor)(pixels, surf->w * surf->h); break; diff --git a/src/resources/sprite/animatedsprite.cpp b/src/resources/sprite/animatedsprite.cpp index 60a42e6ef..b443fcedb 100644 --- a/src/resources/sprite/animatedsprite.cpp +++ b/src/resources/sprite/animatedsprite.cpp @@ -43,6 +43,7 @@ #include "utils/delete2.h" #include "utils/likely.h" #include "utils/mrand.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/resources/sprite/imagesprite.cpp b/src/resources/sprite/imagesprite.cpp index 3e866ea9c..bbee6dba0 100644 --- a/src/resources/sprite/imagesprite.cpp +++ b/src/resources/sprite/imagesprite.cpp @@ -24,6 +24,8 @@ #include "render/graphics.h" +#include "utils/performance.h" + #include "debug.h" ImageSprite::ImageSprite(Image *const image) : diff --git a/src/resources/sprite/spritedef.cpp b/src/resources/sprite/spritedef.cpp index 2bf1cf0a9..b317465dd 100644 --- a/src/resources/sprite/spritedef.cpp +++ b/src/resources/sprite/spritedef.cpp @@ -32,6 +32,7 @@ #include "utils/checkutils.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "resources/action.h" #include "resources/imageset.h" diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index 14dc07ae9..57229de5d 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -35,11 +35,11 @@ #include <algorithm> -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#else // WIN32 +#else // _WIN32 #include <ctime> -#endif // WIN32 +#endif // _WIN32 #include "debug.h" diff --git a/src/sdl2gfx/SDL2_rotozoom.cpp b/src/sdl2gfx/SDL2_rotozoom.cpp index a37e1c51e..597678318 100644 --- a/src/sdl2gfx/SDL2_rotozoom.cpp +++ b/src/sdl2gfx/SDL2_rotozoom.cpp @@ -29,9 +29,9 @@ Changed for ManaPlus (C) 2013-2017 ManaPlus developers */ -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> -#endif +#endif // _WIN32 #include <stdlib.h> #include <string.h> diff --git a/src/sdl2gfx/SDL2_rotozoom.h b/src/sdl2gfx/SDL2_rotozoom.h index ffab24fbc..abf1305f5 100644 --- a/src/sdl2gfx/SDL2_rotozoom.h +++ b/src/sdl2gfx/SDL2_rotozoom.h @@ -40,6 +40,7 @@ extern "C" { #endif +// required by MSYS2 / Windows #ifndef M_PI #define M_PI 3.1415926535897932384626433832795 #endif diff --git a/src/soundmanager.cpp b/src/soundmanager.cpp index 47122b266..6a66010e2 100644 --- a/src/soundmanager.cpp +++ b/src/soundmanager.cpp @@ -43,6 +43,7 @@ #include "utils/cast.h" #endif #include "utils/checkutils.h" +#include "utils/performance.h" #include "utils/sdlmusichelper.h" PRAGMA48(GCC diagnostic push) diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index b4f67f373..7ef221880 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -64,10 +64,10 @@ PRAGMA48(GCC diagnostic pop) #include <unistd.h> -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> #define sleep(seconds) Sleep((seconds) * 1000) -#endif // WIN32 +#endif // _WIN32 #include <sys/time.h> diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h index efb149439..f5b30428e 100644 --- a/src/test/testlauncher.h +++ b/src/test/testlauncher.h @@ -26,9 +26,9 @@ #include <fstream> -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#endif // WIN32 +#endif // _WIN32 #ifdef __native_client__ #include <sys/time.h> diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp index 853731349..3a7559d71 100644 --- a/src/test/testmain.cpp +++ b/src/test/testmain.cpp @@ -37,7 +37,6 @@ #include "debug.h" std::string fileName; -extern char *selfName; TestMain::TestMain() : log(new Logger), diff --git a/src/text.cpp b/src/text.cpp index 9446c7f34..9ab8cb1e5 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -37,6 +37,7 @@ #include "resources/image/image.h" #include "utils/delete2.h" +#include "utils/performance.h" #include "debug.h" diff --git a/src/textmanager.cpp b/src/textmanager.cpp index 80a861d3e..21334dc38 100644 --- a/src/textmanager.cpp +++ b/src/textmanager.cpp @@ -25,6 +25,7 @@ #include "text.h" #include "utils/foreach.h" +#include "utils/performance.h" #include <cstring> diff --git a/src/unittests/catch.hpp b/src/unittests/catch.hpp index 64d1cafc4..f51e1ab35 100644 --- a/src/unittests/catch.hpp +++ b/src/unittests/catch.hpp @@ -1999,7 +1999,7 @@ namespace Catch { #define CATCH_PLATFORM_MAC #elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED) #define CATCH_PLATFORM_IPHONE -#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) +#elif defined(_WIN32) || defined(__WIN32__) || defined(_MSC_VER) #define CATCH_PLATFORM_WINDOWS #endif @@ -3940,7 +3940,7 @@ namespace Tbc { #include <stdexcept> #include <memory> -#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) +#if defined(_WIN32) || defined(__WIN32__) || defined(_MSC_VER) #define CLARA_PLATFORM_WINDOWS #endif diff --git a/src/unittests/doctest.h b/src/unittests/doctest.h index c7a745bb0..02d187480 100644 --- a/src/unittests/doctest.h +++ b/src/unittests/doctest.h @@ -264,6 +264,7 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26444) // Avoid unnamed objects with custom constr #if !defined(_WIN32) && !defined(__QNX__) && !defined(DOCTEST_CONFIG_POSIX_SIGNALS) #define DOCTEST_CONFIG_POSIX_SIGNALS #endif // _WIN32 + #if defined(DOCTEST_CONFIG_NO_POSIX_SIGNALS) && defined(DOCTEST_CONFIG_POSIX_SIGNALS) #undef DOCTEST_CONFIG_POSIX_SIGNALS #endif // DOCTEST_CONFIG_NO_POSIX_SIGNALS @@ -294,10 +295,10 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26444) // Avoid unnamed objects with custom constr #if DOCTEST_MSVC #define DOCTEST_SYMBOL_EXPORT __declspec(dllexport) #define DOCTEST_SYMBOL_IMPORT __declspec(dllimport) -#else // MSVC +#else // DOCTEST_MSVC #define DOCTEST_SYMBOL_EXPORT __attribute__((dllexport)) #define DOCTEST_SYMBOL_IMPORT __attribute__((dllimport)) -#endif // MSVC +#endif // DOCTEST_MSVC #else // _WIN32 #define DOCTEST_SYMBOL_EXPORT __attribute__((visibility("default"))) #define DOCTEST_SYMBOL_IMPORT diff --git a/src/unittests/fs/files.cc b/src/unittests/fs/files.cc index 767c4b5e8..9255195ca 100644 --- a/src/unittests/fs/files.cc +++ b/src/unittests/fs/files.cc @@ -116,12 +116,12 @@ TEST_CASE("Files saveTextFile", "") Files::saveTextFile(dir, "tempfile.txt", "test line\ntext line2"); std::string data = VirtFs::loadTextFileString("test/tempfile.txt"); ::remove((dir + "/tempfile.txt").c_str()); -#ifdef WIN32 +#ifdef _WIN32 REQUIRE(data == "test line\r\ntext line2\r\n"); -#else // WIN32 +#else // _WIN32 REQUIRE(data == "test line\ntext line2\n"); -#endif // WIN32 +#endif // _WIN32 ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); diff --git a/src/unittests/resources/resourcemanager/resourcemanager.cc b/src/unittests/resources/resourcemanager/resourcemanager.cc index c536a7186..984c25103 100644 --- a/src/unittests/resources/resourcemanager/resourcemanager.cc +++ b/src/unittests/resources/resourcemanager/resourcemanager.cc @@ -40,6 +40,7 @@ #include "utils/env.h" #include "utils/delete2.h" +#include "utils/performance.h" #include <unistd.h> diff --git a/src/unittests/utils/dumplibs.cc b/src/unittests/utils/dumplibs.cc index 594c90501..f23b2b7ec 100644 --- a/src/unittests/utils/dumplibs.cc +++ b/src/unittests/utils/dumplibs.cc @@ -57,7 +57,12 @@ TEST_CASE("dumplibs tests", "") #ifdef ENABLE_LIBXML SECTION("libxml2") { - const char *const *xmlVersion = __xmlParserVersion(); + const char *const *xmlVersion +#if LIBXML_VERSION > 21200 + = &xmlParserVersion; +#else + = __xmlParserVersion(); +#endif REQUIRE(xmlVersion != nullptr); REQUIRE(*xmlVersion != nullptr); REQUIRE(std::string(*xmlVersion) == diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 73e857da2..7bbc5176c 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -63,7 +63,7 @@ PRAGMA48(GCC diagnostic pop) #include <unistd.h> #elif defined __native_client__ #include "utils/naclmessages.h" -#elif defined WIN32 +#elif defined _WIN32 #include "utils/cast.h" PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") @@ -94,7 +94,7 @@ bool sendBuffer(const std::string &restrict text) #else // USE_SDL2 -#ifdef WIN32 +#ifdef _WIN32 bool retrieveBuffer(std::string& text, size_t& pos) { bool ret = false; @@ -508,7 +508,7 @@ bool sendBuffer(const std::string &restrict text) naclPostMessage("clipboard-copy", text); return true; } -#else // WIN32 +#else // _WIN32 bool retrieveBuffer(std::string &text A_UNUSED, size_t &pos A_UNUSED) { @@ -519,5 +519,5 @@ bool sendBuffer(const std::string &restrict text A_UNUSED) { return false; } -#endif // WIN32 +#endif // _WIN32 #endif // USE_SDL2 diff --git a/src/utils/dumplibs.cpp b/src/utils/dumplibs.cpp index 66fe62798..7efa3704a 100644 --- a/src/utils/dumplibs.cpp +++ b/src/utils/dumplibs.cpp @@ -140,7 +140,13 @@ void dumpLibs() LIBXML_TEST_VERSION #endif // LIBXML_TEST_VERSION #ifdef ENABLE_LIBXML - const char *const *xmlVersion = __xmlParserVersion(); + const char *const *xmlVersion +#if LIBXML_VERSION > 21200 + = &xmlParserVersion; +#else + = __xmlParserVersion(); +#endif + if (xmlVersion != nullptr) logger->log(" libxml2: %s", *xmlVersion); #endif // ENABLE_LIBXML diff --git a/src/utils/env.cpp b/src/utils/env.cpp index 10feebca7..5ecbda7b9 100644 --- a/src/utils/env.cpp +++ b/src/utils/env.cpp @@ -29,14 +29,14 @@ void updateEnv() { -#if defined(WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) if (config.getBoolValue("centerwindow")) setEnv("SDL_VIDEO_CENTERED", "1"); else setEnv("SDL_VIDEO_CENTERED", "0"); -#endif // defined(WIN32) || defined(__APPLE__) +#endif // defined(_WIN32) || defined(__APPLE__) -#ifndef WIN32 +#ifndef _WIN32 const int vsync = settings.options.test.empty() ? config.getIntValue("vsync") : 1; // __GL_SYNC_TO_VBLANK is nvidia variable. @@ -54,20 +54,20 @@ void updateEnv() default: break; } -#endif // WIN32 +#endif // _WIN32 } void setEnv(const char *const name, const char *const value) { if ((name == nullptr) || (value == nullptr)) return; -#ifdef WIN32 +#ifdef _WIN32 if (putenv(const_cast<char*>((std::string(name) + "=" + value).c_str()))) -#else // WIN32 +#else // _WIN32 if (setenv(name, value, 1) != 0) -#endif // WIN32 +#endif // _WIN32 { logger->log("setenv failed: %s=%s", name, value); } diff --git a/src/utils/gettexthelper.cpp b/src/utils/gettexthelper.cpp index 0069b0bfd..84a6e8602 100644 --- a/src/utils/gettexthelper.cpp +++ b/src/utils/gettexthelper.cpp @@ -34,10 +34,10 @@ #include <libintl.h> #include <locale.h> -#ifdef WIN32 +#ifdef _WIN32 #include <string> extern "C" char const *_nl_locale_name_default(void); -#endif // WIN32 +#endif // _WIN32 #elif defined(ENABLE_CUSTOMNLS) #include "utils/translation/podict.h" #ifdef __native_client__ @@ -45,9 +45,9 @@ extern "C" char const *_nl_locale_name_default(void); #endif // __native_client__ #endif // ENABLE_NLS -#if defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) && !defined(WIN32) +#if defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) #include "utils/env.h" -#endif // defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) && !defined(WIN32) +#endif // defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) #include "debug.h" @@ -55,7 +55,7 @@ extern "C" char const *_nl_locale_name_default(void); static std::string setLangEnv() { std::string lang = config.getStringValue("lang"); -#if defined(ENABLE_NLS) && defined(WIN32) +#if defined(ENABLE_NLS) && defined(_WIN32) if (lang.empty()) lang = std::string(_nl_locale_name_default()); #elif defined(ENABLE_CUSTOMNLS) && defined(__native_client__) @@ -66,18 +66,12 @@ static std::string setLangEnv() naclPostMessage("get-uilanguage", ""); lang = naclWaitForMessage(handle); } -#endif // defined(ENABLE_NLS) && defined(WIN32) +#endif // defined(ENABLE_NLS) && defined(_WIN32) if (!lang.empty()) { -#ifdef WIN32 - putenv(const_cast<char*>(("LANG=" + lang).c_str())); - putenv(const_cast<char*>(("LANGUAGE=" + lang).c_str())); -#else // WIN32 - - setEnv("LANG", lang.c_str()); + setEnv("LANG", lang.c_str()); setEnv("LANGUAGE", lang.c_str()); -#endif // WIN32 } return lang; @@ -88,11 +82,11 @@ void GettextHelper::initLang() { #ifdef ENABLE_NLS const std::string lang = setLangEnv(); -#ifdef WIN32 +#ifdef _WIN32 // mingw doesn't like LOCALEDIR to be defined for some reason if (lang != "C") bindTextDomain("translations/"); -#else // WIN32 +#else // _WIN32 #ifdef ANDROID #ifdef USE_SDL2 bindTextDomain((std::string(getenv("APPDIR")).append("/locale")).c_str()); @@ -115,7 +109,7 @@ void GettextHelper::initLang() #endif // __APPLE__ #endif // ENABLE_PORTABLE #endif // ANDROID -#endif // WIN32 +#endif // _WIN32 char *locale = setlocale(LC_MESSAGES, lang.c_str()); if (locale) @@ -130,8 +124,8 @@ void GettextHelper::initLang() else logger->log("locale empty"); } - bind_textdomain_codeset("manaplus", "UTF-8"); - textdomain("manaplus"); + bind_textdomain_codeset("manaverse", "UTF-8"); + textdomain("manaverse"); #elif defined(ENABLE_CUSTOMNLS) mainTranslator = new PoDict("en"); setLangEnv(); @@ -141,7 +135,7 @@ void GettextHelper::initLang() #ifdef ENABLE_NLS void GettextHelper::bindTextDomain(const char *const path) { - const char *const dir = bindtextdomain("manaplus", path); + const char *const dir = bindtextdomain("manaverse", path); if (dir) logger->log("bindtextdomain: %s", dir); else diff --git a/src/utils/perfomance.cpp b/src/utils/performance.cpp index 3633041a3..e18e848e4 100644 --- a/src/utils/perfomance.cpp +++ b/src/utils/performance.cpp @@ -23,11 +23,12 @@ #ifdef USE_PROFILER -#include "utils/perfomance.h" +#include "utils/performance.h" #include "configuration.h" #include "game.h" +#include "utils/cast.h" #include "utils/timer.h" #include <algorithm> @@ -41,10 +42,10 @@ static const clockid_t clockType = CLOCK_MONOTONIC; -#define timeData ((static_cast<long long int>(time.tv_sec) * 1000000000LL \ - + static_cast<long long int>(time.tv_nsec)) / 1) +#define timeData \ + (CAST_U64(time.tv_sec) * 1000000000LL + CAST_U64(time.tv_nsec)) -namespace Perfomance +namespace Performance { std::ofstream file; std::string temp; @@ -69,24 +70,26 @@ namespace Perfomance { timespec time; clock_gettime(clockType, &time); - temp.append(toString(timeData - startTime)).append( - " __init__\n"); + temp.append(toString(CAST_U64(timeData - startTime))) + .append(" __init__\n"); } void blockStart(const std::string &name) { timespec time; clock_gettime(clockType, &time); - temp.append(toString(timeData - startTime)).append( - " start: ").append(name).append("\n"); + temp.append(toString(CAST_U64(timeData - startTime))) + .append(" start: ") + .append(name).append("\n"); } void blockEnd(const std::string &name) { timespec time; clock_gettime(clockType, &time); - temp.append(toString(timeData - startTime)).append( - " end: ").append(name).append("\n"); + temp.append(toString(CAST_U64(timeData - startTime))) + .append(" end: ") + .append(name).append("\n"); } void flush() @@ -96,6 +99,6 @@ namespace Perfomance temp.clear(); // file.flush(); } -} // namespace Perfomance +} // namespace Performance #endif // USE_PROFILER diff --git a/src/utils/perfomance.h b/src/utils/performance.h index 5da4756ee..4c52b12fe 100644 --- a/src/utils/perfomance.h +++ b/src/utils/performance.h @@ -19,26 +19,22 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef UTILS_PERFOMANCE_H -#define UTILS_PERFOMANCE_H +#ifndef UTILS_PERFORMANCE_H +#define UTILS_PERFORMANCE_H #ifdef USE_PROFILER -#include "utils/vector.h" #include <string> -#include <sstream> -#include <list> -#include <set> #include "localconsts.h" -#define PROFILER_START() Perfomance::start(); -#define PROFILER_END() Perfomance::flush(); -#define BLOCK_START(name) Perfomance::blockStart(name); -#define BLOCK_END(name) Perfomance::blockEnd(name); -#define FUNC_BLOCK(name, id) Perfomance::Func PerfomanceFunc##id(name); +#define PROFILER_START() Performance::start(); +#define PROFILER_END() Performance::flush(); +#define BLOCK_START(name) Performance::blockStart(name); +#define BLOCK_END(name) Performance::blockEnd(name); +#define FUNC_BLOCK(name, id) Performance::Func PerformanceFunc##id(name); -namespace Perfomance +namespace Performance { void start(); @@ -70,7 +66,7 @@ namespace Perfomance std::string name; }; -} // namespace Perfomance +} // namespace Performance #else // USE_PROFILER @@ -81,4 +77,4 @@ namespace Perfomance #define FUNC_BLOCK(name, id) #endif // USE_PROFILER -#endif // UTILS_PERFOMANCE_H +#endif // UTILS_PERFORMANCE_H diff --git a/src/utils/process.cpp b/src/utils/process.cpp index 11cdf1c53..10ee5581f 100644 --- a/src/utils/process.cpp +++ b/src/utils/process.cpp @@ -36,13 +36,13 @@ PRAGMA48(GCC diagnostic pop) #include "debug.h" -#if defined(WIN32) || defined(__linux__) || \ +#if defined(_WIN32) || defined(__linux__) || \ defined(__linux) || defined(__APPLE__) const int timeOut = 10; -#endif // defined(WIN32) || defined(__linux__) || +#endif // defined(_WIN32) || defined(__linux__) || // defined(__linux) || defined(__APPLE__) -#ifdef WIN32 +#ifdef _WIN32 #include "utils/stringutils.h" @@ -245,16 +245,16 @@ bool execFile(const std::string &pathName A_UNUSED, return false; } -#endif // WIN32 +#endif // _WIN32 -#if defined WIN64 +#if defined _WIN64 bool openBrowser(std::string url) { return reinterpret_cast<int64_t>(ShellExecute(nullptr, "open", replaceAll(url, " ", "").c_str(), nullptr, nullptr, SW_SHOWNORMAL)) > 32; } -#elif defined WIN32 +#elif defined _WIN32 bool openBrowser(std::string url) { return reinterpret_cast<int32_t>(ShellExecute(nullptr, "open", @@ -312,9 +312,9 @@ bool openBrowser(std::string url A_UNUSED) return false; } -#endif // WIN32 +#endif // _WIN32 -#ifdef WIN32 +#ifdef _WIN32 void setPriority(const bool big) { HANDLE hCurrentProcess = GetCurrentProcess(); @@ -323,9 +323,9 @@ void setPriority(const bool big) else SetPriorityClass(hCurrentProcess, BELOW_NORMAL_PRIORITY_CLASS); } -#else // WIN32 +#else // _WIN32 void setPriority(const bool big A_UNUSED) { } -#endif // WIN32 +#endif // _WIN32 diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index cc9e830b8..446d9d234 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -38,9 +38,9 @@ #include <algorithm> #include <sstream> -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#endif // WIN32 +#endif // _WIN32 #include "debug.h" @@ -1027,7 +1027,7 @@ std::string escapeString(std::string str) void sanitizePath(std::string &path) { -#ifdef WIN32 +#ifdef _WIN32 const char sepStr = '\\'; const std::string sep2Str = "\\\\"; const std::string sepWrongStr = "/"; @@ -1043,7 +1043,7 @@ void sanitizePath(std::string &path) std::string pathJoin(std::string str1, const std::string &str2) { -#ifdef WIN32 +#ifdef _WIN32 const char sep = '\\'; std::string sepStr = "\\"; #else @@ -1082,7 +1082,7 @@ std::string pathJoin(std::string str1, const std::string &str2, const std::string &str3) { -#ifdef WIN32 +#ifdef _WIN32 const char sep = '\\'; std::string sepStr = "\\"; #else diff --git a/src/utils/xml/libxml.cpp b/src/utils/xml/libxml.cpp index bb414aa06..9bff3f877 100644 --- a/src/utils/xml/libxml.cpp +++ b/src/utils/xml/libxml.cpp @@ -30,8 +30,8 @@ #include "utils/cast.h" #include "utils/checkutils.h" #include "utils/fuzzer.h" +#include "utils/performance.h" #include "utils/stringutils.h" - #include "utils/translation/podict.h" #include <fstream> diff --git a/src/utils/xml/pugixml.cpp b/src/utils/xml/pugixml.cpp index c67f3c195..ebad1548a 100644 --- a/src/utils/xml/pugixml.cpp +++ b/src/utils/xml/pugixml.cpp @@ -31,8 +31,8 @@ #include "utils/checkutils.h" #include "utils/delete2.h" #include "utils/fuzzer.h" +#include "utils/performance.h" #include "utils/stringutils.h" - #include "utils/translation/podict.h" #include <fstream> diff --git a/src/utils/xml/tinyxml2.cpp b/src/utils/xml/tinyxml2.cpp index 9f044e69b..6646f136c 100644 --- a/src/utils/xml/tinyxml2.cpp +++ b/src/utils/xml/tinyxml2.cpp @@ -30,8 +30,8 @@ #include "utils/cast.h" #include "utils/checkutils.h" #include "utils/fuzzer.h" +#include "utils/performance.h" #include "utils/stringutils.h" - #include "utils/translation/podict.h" #include <fstream> diff --git a/tools/ci/scripts/runtest.sh b/tools/ci/scripts/runtest.sh index 622e04da0..7b522b88a 100755 --- a/tools/ci/scripts/runtest.sh +++ b/tools/ci/scripts/runtest.sh @@ -52,7 +52,7 @@ function wait_for_servers_list { function run { ./src/manaplus --hide-cursor --enable-ipc --renderer=0 >logs/run.log 2>&1 & export PID=$! - echo "manaplus PID: ${PID}" + echo "manaverse PID: ${PID}" sleep 15 echo "pause after run" wait_for_servers_list @@ -233,7 +233,7 @@ imagesdiff new_server.png about.png send_command "/sendmousekey 500 20 1" send_command "/screenshot about.png" -# open about manaplus page +# open about manaverse page send_command "/sendmousekey 300 ${ABOUTYOFFSET} 1" send_command "/screenshot about2.png" imagesdiff about.png about2.png diff --git a/tools/doxygen/doxygen.conf b/tools/doxygen/doxygen.conf index 76ca1ea11..8b9578d2e 100644 --- a/tools/doxygen/doxygen.conf +++ b/tools/doxygen/doxygen.conf @@ -4,7 +4,7 @@ c# Doxyfile 1.8.8 # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "ManaPlus" +PROJECT_NAME = "ManaVerse" PROJECT_NUMBER = PROJECT_BRIEF = PROJECT_LOGO = data/icons/manaplus.png |