diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 21992268b6d..da7033e6d00 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ env: MYSQL_USER: 'ragnarok' MYSQL_PASSWORD: 'ragnarok' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' - DEBIAN_COMMON_PACKAGES: make git python3 libzstd-dev python3-venv cmake g++ + DEBIAN_COMMON_PACKAGES: make git python3 libzstd-dev python3-venv cmake defaults: run: @@ -20,7 +20,7 @@ jobs: strategy: matrix: # Testing the oldest and newest supported version of gcc/clang on our supported platofrms - CC: ["clang", "gcc"] + CC: ["clang-21", "gcc-15"] RENEWAL: [""] CLIENT_TYPE: ["", "-DENABLE_PACKETVER_RE=ON", "-DENABLE_PACKETVER_ZERO=ON"] HTTPLIB: ["", "-DWITH_HTTP_PARSER=llhttp"] @@ -30,6 +30,11 @@ jobs: exclude: - PACKET_VERSION: "-DPACKETVER=20100105" CLIENT_TYPE: "-DENABLE_PACKETVER_ZERO=ON" + include: + - CXX: 'g++-15' + CC: 'gcc-15' + - CXX: 'clang++-21' + CC: 'clang-21' # github.head_ref will stop previous runs in the same PR (if in a PR) # github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop) @@ -55,10 +60,11 @@ jobs: --health-timeout=2s --health-retries=3 env: - INSTALL_PACKAGES: ${{ matrix.CC }} mariadb-client + INSTALL_PACKAGES: ${{ matrix.CC }} ${{ matrix.CXX }} mariadb-client SQLHOST: mariadb CC: ${{ matrix.CC }} - CONFIGURE_FLAGS: -DCMAKE_C_COMPILER=${{ matrix.CC }} -DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=ON -DENABLE_BUILDBOT=ON ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} -DENABLE_EPOLL=ON -DBUILD_HPMHOOKING=ON + CXX: ${{ matrix.CXX }} + CONFIGURE_FLAGS: -DCMAKE_C_COMPILER=${{ matrix.CC }} -DCMAKE_CXX_COMPILER=${{ matrix.CXX }} -DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=ON -DENABLE_BUILDBOT=ON ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} -DENABLE_EPOLL=ON -DBUILD_HPMHOOKING=ON steps: - uses: actions/checkout@v6 with: @@ -68,6 +74,13 @@ jobs: run: | uname -a + - uses: actions/cache/restore@v6 + name: restore conan cache + id: cache + with: + path: ~/.conan2 + key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }} + - name: install packages run: | ./tools/ci/retry.sh apt-get update diff --git a/.github/workflows/controller.yml b/.github/workflows/controller.yml index 6be0953eb74..5e24e7f7011 100644 --- a/.github/workflows/controller.yml +++ b/.github/workflows/controller.yml @@ -15,6 +15,10 @@ jobs: needs: hwsapibot if: ${{ !failure() && !cancelled() }} uses: ./.github/workflows/tools.yml + tools-windows: + needs: hwsapibot + if: ${{ !failure() && !cancelled() }} + uses: ./.github/workflows/tools-windows.yml build: needs: tools if: ${{ !failure() && !cancelled() }} @@ -47,7 +51,7 @@ jobs: # needs: build # if: ${{ !failure() && !cancelled() }} # uses: ./.github/workflows/macos_m1.yml -# windows: -# needs: build -# if: ${{ !failure() && !cancelled() }} -# uses: ./.github/workflows/windows.yml + windows: + needs: tools-windows + if: ${{ !failure() && !cancelled() }} + uses: ./.github/workflows/windows.yml diff --git a/.github/workflows/mariadb.yml b/.github/workflows/mariadb.yml index 0207f73965a..7f00c65706e 100644 --- a/.github/workflows/mariadb.yml +++ b/.github/workflows/mariadb.yml @@ -19,13 +19,16 @@ jobs: timeout-minutes: 30 strategy: matrix: - CC: [gcc] + CC: [gcc-15] RENEWAL: [""] CLIENT_TYPE: [""] HTTPLIB: ["", "-DWITH_HTTP_PARSER=llhttp"] SANITIZER: ["-DMEMORY_MANAGER=none", "-DMEMORY_MANAGER=none -DENABLE_SANITIZE=ON"] PACKET_VERSION: ["-DPACKETVER=20221024"] MYSQL: ["10.11", "11.8", "latest"] + include: + - CXX: 'g++-15' + CC: 'gcc-15' # github.head_ref will stop previous runs in the same PR (if in a PR) # github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop) @@ -51,10 +54,11 @@ jobs: --health-timeout=2s --health-retries=3 env: - INSTALL_PACKAGES: ${{ matrix.CC }} mariadb-client + INSTALL_PACKAGES: ${{ matrix.CC }} ${{ matrix.CXX }} mariadb-client SQLHOST: mysql CC: ${{ matrix.CC }} - CONFIGURE_FLAGS: -DCMAKE_C_COMPILER=${{ matrix.CC }} -DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=ON -DENABLE_BUILDBOT=ON ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} -DBUILD_HPMHOOKING=ON + CXX: ${{ matrix.CXX }} + CONFIGURE_FLAGS: -DCMAKE_C_COMPILER=${{ matrix.CC }} -DCMAKE_CXX_COMPILER=${{ matrix.CXX }} -DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=ON -DENABLE_BUILDBOT=ON ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} -DBUILD_HPMHOOKING=ON PACKET_VERSION: ${{ matrix.PACKET_VERSION }} steps: - uses: actions/checkout@v6 @@ -65,6 +69,13 @@ jobs: run: | uname -a + - uses: actions/cache/restore@v6 + name: restore conan cache + id: cache + with: + path: ~/.conan2 + key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }} + - name: install packages run: | ./tools/ci/retry.sh apt-get update diff --git a/.github/workflows/sanitizer.yml b/.github/workflows/sanitizer.yml index d314cb96607..30e5590a80e 100644 --- a/.github/workflows/sanitizer.yml +++ b/.github/workflows/sanitizer.yml @@ -7,7 +7,7 @@ env: MYSQL_USER: 'ragnarok' MYSQL_PASSWORD: 'ragnarok' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' - DEBIAN_COMMON_PACKAGES: cmake make git python3 python3-venv libzstd-dev g++ + DEBIAN_COMMON_PACKAGES: cmake make git python3 python3-venv libzstd-dev defaults: run: @@ -19,7 +19,7 @@ jobs: timeout-minutes: 30 strategy: matrix: - CC: [gcc] + CC: [gcc-15] RENEWAL: ["", "-DENABLE_RENEWAL=OFF"] CLIENT_TYPE: ["", "-DENABLE_PACKETVER_RE=ON", "-DENABLE_PACKETVER_ZERO=ON"] HTTPLIB: ["", "-DWITH_HTTP_PARSER=llhttp"] @@ -32,6 +32,9 @@ jobs: - PACKET_VERSION: "-DPACKETVER=20130724" RENEWAL: "" CLASSIC_AUTOSPELL_LIST: "-DENABLE_CLASSIC_AUTOSPELL=ON" + - CXX: 'g++-15' + CC: 'gcc-15' + exclude: - PACKET_VERSION: "-DPACKETVER=20130724" CLIENT_TYPE: "-DENABLE_PACKETVER_ZERO=ON" @@ -43,7 +46,7 @@ jobs: cancel-in-progress: true container: - image: ubuntu:24.04 + image: ubuntu:26.04 services: mariadb: image: mariadb:latest @@ -60,10 +63,11 @@ jobs: --health-timeout=2s --health-retries=3 env: - INSTALL_PACKAGES: ${{ matrix.CC }} mariadb-client + INSTALL_PACKAGES: ${{ matrix.CC }} ${{ matrix.CXX }} mariadb-client SQLHOST: mariadb CC: ${{ matrix.CC }} - CONFIGURE_FLAGS: -DCMAKE_C_COMPILER=${{ matrix.CC }} -DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=ON -DENABLE_BUILDBOT=ON ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} -DENABLE_LTO=ON ${{ matrix.CLASSIC_AUTOSPELL_LIST }} -DBUILD_HPMHOOKING=ON + CXX: ${{ matrix.CXX }} + CONFIGURE_FLAGS: -DCMAKE_C_COMPILER=${{ matrix.CC }} -DCMAKE_CXX_COMPILER=${{ matrix.CXX }} -DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=ON -DENABLE_BUILDBOT=ON ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} -DENABLE_LTO=ON ${{ matrix.CLASSIC_AUTOSPELL_LIST }} -DBUILD_HPMHOOKING=ON PACKET_VERSION: ${{ matrix.PACKET_VERSION }} steps: - uses: actions/checkout@v6 @@ -74,6 +78,13 @@ jobs: run: | uname -a + - uses: actions/cache/restore@v6 + name: restore conan cache + id: cache + with: + path: ~/.conan2 + key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }} + - name: install packages run: | ./tools/ci/retry.sh apt-get update diff --git a/.github/workflows/tools-windows.yml b/.github/workflows/tools-windows.yml new file mode 100644 index 00000000000..82c2cd302b4 --- /dev/null +++ b/.github/workflows/tools-windows.yml @@ -0,0 +1,43 @@ +name: tools-windows + +on: workflow_call + +jobs: + build: + runs-on: windows-2025 + timeout-minutes: 30 + strategy: + matrix: + CC: [msvc] + + # github.head_ref will stop previous runs in the same PR (if in a PR) + # github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop) + concurrency: + group: tools-windows-${{ github.head_ref || github.run_id }}_${{ matrix.CC }} + cancel-in-progress: true + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 1 + + - uses: actions/cache/restore@v6 # We're restoring first so if a cache already exists from previous CI run, it's used and step finishes quicker. + name: restore conan cache + id: cache-restore + with: + path: ~/.conan2 + key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }} + + - name: run cmake first run + if: steps.cache-restore.outputs.cache-hit != 'true' + run: | + ./setup_env.ps1 + + - uses: actions/cache/save@v6 + if: steps.cache-restore.outputs.cache-hit != 'true' + name: save conan cache + id: cache_save + with: + path: ~/.conan2 + key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }} + diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 9d19bdfc5b3..f9dbb6fa914 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -7,20 +7,31 @@ env: MYSQL_USER: 'ragnarok' MYSQL_PASSWORD: 'ragnarok' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' - DEBIAN_COMMON_PACKAGES: python3 python3-pip + DEBIAN_COMMON_PACKAGES: python3 python3-pip python3-venv cmake make git gcc g++ jobs: build: runs-on: ubuntu-latest + defaults: + run: + shell: bash + strategy: + matrix: + CC: ["clang-21", "gcc-15"] + include: + - CXX: 'g++-15' + CC: 'gcc-15' + - CXX: 'clang++-21' + CC: 'clang-21' # github.head_ref will stop previous runs in the same PR (if in a PR) # github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop) concurrency: - group: tools-${{ github.head_ref || github.run_id }} + group: tools-linux-${{ github.head_ref || github.run_id }}_${{ matrix.CC }} cancel-in-progress: true container: - image: debian:unstable + image: ubuntu:26.04 steps: - uses: actions/checkout@v6 with: @@ -33,9 +44,31 @@ jobs: - name: install packages run: | ./tools/ci/retry.sh apt-get update - ./tools/ci/retry.sh apt-get install -y -qq $INSTALL_PACKAGES $DEBIAN_COMMON_PACKAGES + ./tools/ci/retry.sh apt-get install -y -qq $INSTALL_PACKAGES $DEBIAN_COMMON_PACKAGES ${{ matrix.CC }} ${{ matrix.CXX }} pip3 install sqlfluff --break-system-packages + - uses: actions/cache/restore@v6 # We're restoring first so if a cache already exists from previous CI run, it's used and step finishes quicker. + name: restore conan cache + id: cache-restore + with: + path: ~/.conan2 + key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }} + + - name: run cmake first run + if: steps.cache-restore.outputs.cache-hit != 'true' + run: | + ./tools/ci/travis.sh prepareenv + source .venv/bin/activate + cmake -S . -B build -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake_modules/conan_provider.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${{ matrix.CC }} -DCMAKE_CXX_COMPILER=${{ matrix.CXX }} + + - uses: actions/cache/save@v6 + if: steps.cache-restore.outputs.cache-hit != 'true' + name: save conan cache + id: cache_save + with: + path: ~/.conan2 + key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }} + - name: check sql syntax run: | ./tools/ci/retry.sh python3 tools/validate_sql-files.py diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index a263c4e9d0a..2e2a7e8f5f6 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,4 +1,4 @@ -name: windows +name: build windows on: workflow_call @@ -10,22 +10,30 @@ env: jobs: build: - runs-on: windows-latest + runs-on: windows-2025 timeout-minutes: 30 strategy: matrix: - CC: [msbuild] - RENEWAL: ["", "DISABLE_RENEWAL"] - CLIENT_TYPE: ["", "ENABLE_PACKETVER_RE", "ENABLE_PACKETVER_ZERO"] - PACKET_VERSION: ["PACKETVER=20221024", "PACKETVER=20130724"] + CC: [msvc] + RENEWAL: ["", "-DENABLE_RENEWAL=OFF"] + CLIENT_TYPE: ["", "-DENABLE_PACKETVER_RE=ON", "-DENABLE_PACKETVER_ZERO=ON"] + HTTPLIB: ["", "-DWITH_HTTP_PARSER=llhttp"] + PACKET_VERSION: ["-DPACKETVER=20221024", "-DPACKETVER=20130724"] + include: + # Empty CLASSIC_AUTOSPELL_LIST for every other flow + - CLASSIC_AUTOSPELL_LIST: "" + # Use "-DCLASSIC_AUTOSPELL_LIST" for 20130724 RE or we will get warnings due to the list being too small + - PACKET_VERSION: "-DPACKETVER=20130724" + RENEWAL: "" + CLASSIC_AUTOSPELL_LIST: "-DENABLE_CLASSIC_AUTOSPELL=ON" exclude: - - PACKET_VERSION: "PACKETVER=20130724" - CLIENT_TYPE: "ENABLE_PACKETVER_ZERO" + - PACKET_VERSION: "-DPACKETVER=20130724" + CLIENT_TYPE: "-DENABLE_PACKETVER_ZERO=ON" # github.head_ref will stop previous runs in the same PR (if in a PR) # github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop) concurrency: - group: msbuild-${{ github.head_ref || github.run_id }}_${{ matrix.CC }}_${{ matrix.RENEWAL }}_${{ matrix.CLIENT_TYPE }}_${{ matrix.PACKET_VERSION}} + group: build_windows-${{ github.head_ref || github.run_id }}_${{ matrix.CC }}_${{ matrix.RENEWAL }}_${{ matrix.CLIENT_TYPE }}_${{ matrix.HTTPLIB }}_${{ matrix.PACKET_VERSION}} cancel-in-progress: true steps: @@ -33,8 +41,16 @@ jobs: with: fetch-depth: 1 - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v2 +# - name: install packages +# run: | +# winget install Ninja-build.Ninja cmake python3 --accept-source-agreements --accept-package-agreements --disable-interactivity --silent + + - uses: actions/cache/restore@v6 + name: restore conan cache + id: cache + with: + path: ~/.conan2 + key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }} - uses: shogo82148/actions-setup-mysql@v1 with: @@ -51,13 +67,13 @@ jobs: - name: build run: | - .\tools\ci\windows.ps1 build ${{ matrix.CLIENT_TYPE }} ${{ matrix.PACKET_VERSION}} ${{ matrix.RENEWAL }} + .\tools\ci\windows.ps1 build ${{ matrix.CLIENT_TYPE }} ${{ matrix.PACKET_VERSION}} ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLASSIC_AUTOSPELL_LIST }} -DENABLE_WERROR=ON -DENABLE_BUILDBOT=ON -DBUILD_HPMHOOKING=ON - name: run run: | .\tools\ci\windows.ps1 run - name: test - if: matrix.PACKET_VERSION != 'PACKETVER=20130724' + if: matrix.PACKET_VERSION != '-DPACKETVER=20130724' run: | .\tools\ci\windows.ps1 test diff --git a/3rdparty/http-parser/CMakeLists.txt b/3rdparty/http-parser/CMakeLists.txt index 999210a45ea..1b612876419 100644 --- a/3rdparty/http-parser/CMakeLists.txt +++ b/3rdparty/http-parser/CMakeLists.txt @@ -41,4 +41,6 @@ add_library(hercules-http_parser STATIC if(NOT MSVC) target_compile_options(hercules-http_parser PRIVATE -Wno-shadow -Wno-switch-enum) +else() + target_compile_options(hercules-http_parser PRIVATE /wd4456) endif() diff --git a/3rdparty/libconfig/CMakeLists.txt b/3rdparty/libconfig/CMakeLists.txt index 3806a59acda..34a8d2a537c 100644 --- a/3rdparty/libconfig/CMakeLists.txt +++ b/3rdparty/libconfig/CMakeLists.txt @@ -50,5 +50,11 @@ add_library(hercules-libconfig STATIC ) if(NOT MSVC) - target_compile_options(hercules-libconfig PRIVATE -Wno-null-dereference) + target_compile_options(hercules-libconfig PRIVATE -Wno-null-dereference -Wno-deprecated-non-prototype -Wno-unused-but-set-variable) +else() + target_compile_options(hercules-libconfig + PRIVATE + /wd4245 + /wd4702 # Suppress unreachable code warnings in autogenerated code in grammar.c + ) endif() diff --git a/3rdparty/llhttp/CMakeLists.txt b/3rdparty/llhttp/CMakeLists.txt index 775a1204ab8..edaddc7b6cf 100644 --- a/3rdparty/llhttp/CMakeLists.txt +++ b/3rdparty/llhttp/CMakeLists.txt @@ -43,4 +43,6 @@ add_library(hercules-llhttp STATIC if(NOT MSVC) target_compile_options(hercules-llhttp PRIVATE -Wno-error -Wno-format -Wno-format-y2k -Wno-format-security -Wno-redundant-decls -Wno-undef -Wno-switch-enum) +else() + target_compile_options(hercules-llhttp PRIVATE /wd4702) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index fe89736ef0c..e1a362a14d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,11 +157,11 @@ test_function_def(setrlimit) if(MSVC) # Warnings - add_compile_options(/W3 /wd4100 /wd4800) - add_compile_options(/wd4090) # Disable const qualifier mismatch because msvs doesn't like const passed to our aFree + add_compile_options(/W4) + add_compile_options(/wd4127) # Silence constant expression warning as we need them sometimes and they're heavily used + add_compile_options(/wd4200 /wd4152) # Silence warning of non-standard extension being used in our code add_compile_options(/wd4244 /wd4267) # Disable int conversion possible lose of data - add_compile_options(/wd4018) # Disable signed/unsigned arthmatic mismatch - add_compile_options(/wd5287) # Disable enum conversion warning + add_compile_options(/wd4100) # Disable unused parameter warning mostly due to BUILDIN and similar functions having unused parameters add_compile_options(/wd4312) # Disable conversion to greater size warning (see 0xdeadbeef pointers) # Definations add_compile_definitions(WIN32 _WIN32 __WIN32 _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE FD_SETSIZE=4096 WIN32_LEAN_AND_MEAN) @@ -179,12 +179,10 @@ else() # Warnings we explictily require or disable testadd_warning_compiler_flag(all REQUIRED) testadd_warning_compiler_flag(extra REQUIRED) - testadd_warning_compiler_flag(no-sign-compare REQUIRED) testadd_warning_compiler_flag(no-unused-parameter) testadd_warning_compiler_flag(no-clobbered) testadd_warning_compiler_flag(empty-body) testadd_warning_compiler_flag(newline-eof) - testadd_warning_compiler_flag(int-conversion) testadd_warning_compiler_flag(init-self) testadd_warning_compiler_flag(pointer-arith) testadd_warning_compiler_flag(switch-bool) @@ -206,8 +204,6 @@ else() testadd_warning_compiler_flag(undef) #testadd_warning_compiler_flag(cast-align) #testadd_warning_compiler_flag(logical-op) # some useless warnings - testadd_warning_compiler_flag(nested-externs) - testadd_warning_compiler_flag(old-style-definition) testadd_warning_compiler_flag(overlength-strings) testadd_warning_compiler_flag(redundant-decls) # testadd_warning_compiler_flag(cast-qual) @@ -222,21 +218,13 @@ else() testadd_warning_compiler_flag(stringop-overread) testadd_warning_compiler_flag(string-compare) testadd_warning_compiler_flag(zero-length-bounds) - testadd_warning_compiler_flag(absolute-value) testadd_warning_compiler_flag(shift-overflow=2) - testadd_warning_compiler_flag(enum-int-mismatch) #testadd_warning_compiler_flag(unreachable-code) #testadd_warning_compiler_flag(unused-const-variable=2) #testadd_warning_compiler_flag(write-strings) #testadd_warning_compiler_flag(no-format-nonliteral) testadd_warning_compiler_flag(no-switch) - testadd_warning_compiler_flag(no-missing-field-initializers) # testadd_warning_compiler_flag(no-suggest-attribute=format) - testadd_warning_compiler_flag(no-incompatible-pointer-types-discards-qualifiers) - testadd_warning_compiler_flag(no-discarded-qualifiers) - testadd_warning_compiler_flag(no-deprecated-non-prototype) - testadd_warning_compiler_flag(no-unused-but-set-variable) - testadd_warning_compiler_flag(no-enum-enum-conversion) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") testadd_warning_compiler_flag(no-deprecated-declarations) diff --git a/conanfile.py b/conanfile.py index be608b39498..fbd644f67d6 100644 --- a/conanfile.py +++ b/conanfile.py @@ -15,10 +15,14 @@ class HerculesRecipe(ConanFile): } def requirements(self): + ssl_lib = "openssl" + if self.settings.os == "Windows": + ssl_lib = "schannel" + if self.options.with_libbacktrace: self.requires("libbacktrace/cci.20240730") self.requires("cjson/1.7.19") - self.requires("mariadb-connector-c/3.4.8", options={"shared": True}) + self.requires("mariadb-connector-c/3.4.8", options={"shared": True, "with_ssl": ssl_lib}) self.requires("pcre/8.45") self.requires("zlib/1.3.2") self.requires("giflib/5.2.2") diff --git a/script-checker b/script-checker index d7c579a2dee..6badd5afab5 100755 --- a/script-checker +++ b/script-checker @@ -23,7 +23,7 @@ ORIG_CWD="$(pwd)" BASEDIR="$(dirname "$0")" -EXECUTABLE="./map-server" +EXECUTABLE="./bin/map-server" cd "${BASEDIR}" if [ -z "$1" ]; then diff --git a/setup_env.ps1 b/setup_env.ps1 index 60725ca9a79..a93addc5d49 100644 --- a/setup_env.ps1 +++ b/setup_env.ps1 @@ -50,8 +50,8 @@ if ($PSVersionTable.PSVersion.Major -lt 3) { } # differentiate between right click -> run with powershell and execution from within a shell -$exe_path = $(gwmi win32_process -Filter "processid='$PID'").ExecutablePath -$cmd_line = $(gwmi win32_process -Filter "processid='$PID'").CommandLine +$exe_path = $(gcim win32_process -Filter "processid='$PID'").ExecutablePath +$cmd_line = $(gcim win32_process -Filter "processid='$PID'").CommandLine $script_path = $MyInvocation.MyCommand.Path if ($cmd_line -match "`"$([regex]::escape($exe_path)).*$([regex]::escape($script_path))\s*`"") { $is_cli = $False diff --git a/src/api/aclif.c b/src/api/aclif.c index c8ef3ce028c..b2d5d6331ba 100644 --- a/src/api/aclif.c +++ b/src/api/aclif.c @@ -236,7 +236,7 @@ static bool aclif_socket_secure_check(int fd) int count = 0; const int max_count = api->ip_connections_limit; - const int client_addr = sockt->session[fd]->client_addr; + const uint32 client_addr = sockt->session[fd]->client_addr; for (int fd2 = 0; fd2 < sockt->fd_max; fd2 ++) { if (!sockt->session_is_valid(fd2)) continue; @@ -1138,7 +1138,8 @@ static void aclif_remove_remove_timer(struct online_api_login_data *user) static const char *aclif_get_first_world_name(void) { struct DBIterator *iter = db_iterator(aclif->char_servers_db); - for (struct char_server_data *data = dbi_first(iter); dbi_exists(iter); data = dbi_next(iter)) { + struct char_server_data *data = dbi_first(iter); + if (dbi_exists(iter)) { dbi_destroy(iter); return data->world_name; } diff --git a/src/api/apisessiondata.h b/src/api/apisessiondata.h index d43ec12d9aa..2f839a5e324 100644 --- a/src/api/apisessiondata.h +++ b/src/api/apisessiondata.h @@ -76,7 +76,7 @@ struct api_session_data { int post_headers_count; bool has_errors; // used for partial data to flag something went wrong. char *body; - char *world_name; + const char *world_name; size_t body_size; struct fifo_chunk_buf data; JsonW *json; diff --git a/src/api/httpparser.c b/src/api/httpparser.c index ca38c234947..9d60769e19c 100644 --- a/src/api/httpparser.c +++ b/src/api/httpparser.c @@ -438,26 +438,16 @@ static bool httpparser_parse(int fd) int idx = httpparser->search_request_line_end(sd); if (idx >= 0) { // in headers found separator and need parse them - Assert_retr(false, sd->request_temp_size >= idx + 2); + Assert_retr(false, sd->request_temp_size >= (size_t)idx + 2); // We know idx is a positive integer so it's safe to cast const bool res = httpparser->parse_real(fd, sd, sd->request_temp, idx + 2); if (!res) return false; sd->request_temp_size -= idx + 2; memmove(sd->request_temp, sd->request_temp + idx + 2, sd->request_temp_size); return true; - } else { - // data cached, but no yet separator - return true; - } - if (sd->flag.headers_complete != 0) { - // header was complete in previous parse. try to parse additional data - const bool res = httpparser->parse_real(fd, sd, sd->request_temp, sd->request_temp_size); - aFree(sd->request_temp); - sd->request_temp = NULL; - sd->request_temp_size = 0; - sd->request_temp_alloc_size = 0; - return res; } + + return true; } else { // parse received non headers data const bool res = httpparser->parse_real(fd, sd, data, data_size); diff --git a/src/api/imageparser.c b/src/api/imageparser.c index 38ae76a12bf..d25cc21c34e 100644 --- a/src/api/imageparser.c +++ b/src/api/imageparser.c @@ -74,13 +74,13 @@ static bool imageparser_validate_bmp_emblem(const char *emblem, uint64 emblem_le #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) #endif // not NetBSD < 6 / Solaris - if (emblem_len > extraconf->emblems->max_bmp_guild_emblem_size + if ((int)emblem_len > extraconf->emblems->max_bmp_guild_emblem_size // Safe to conver it to int, we check if it's not negative || extraconf->emblems->max_bmp_guild_emblem_size < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE || RBUFW(buf, 0) != 0x4d42 // BITMAPFILEHEADER.bfType (signature) || RBUFL(buf, 2) != emblem_len // BITMAPFILEHEADER.bfSize (file size) || RBUFL(buf, 14) != BITMAPINFOHEADER_SIZE // BITMAPINFOHEADER.biSize (other headers are not supported) - || RBUFL(buf, 18) != extraconf->emblems->guild_emblem_width // BITMAPINFOHEADER.biWidth - || RBUFL(buf, 22) != extraconf->emblems->guild_emblem_height // BITMAPINFOHEADER.biHeight (top-down bitmaps (-24) are not supported) + || RBUFSL(buf, 18) != extraconf->emblems->guild_emblem_width // BITMAPINFOHEADER.biWidth + || RBUFSL(buf, 22) != extraconf->emblems->guild_emblem_height // BITMAPINFOHEADER.biHeight (top-down bitmaps (-24) are not supported) || RBUFL(buf, 30) != 0 // BITMAPINFOHEADER.biCompression == BI_RGB (compression not supported) ) { // Invalid data @@ -148,7 +148,7 @@ static bool imageparser_validate_gif_emblem(const char *emblem, uint64 emblem_le { nullpo_retr(false, emblem); - if (emblem_len > extraconf->emblems->max_gif_guild_emblem_size) { + if (emblem_len > (uint64)extraconf->emblems->max_gif_guild_emblem_size) { #ifdef DEBUG_ERRORS ShowError("Error: gif image file size too big: %"PRIu64"\n", emblem_len); #endif diff --git a/src/char/char.c b/src/char/char.c index ce7e0fcdb24..4199583e658 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -243,7 +243,7 @@ static void char_set_char_charselect(int account_id) character->pincode_enable = pincode->charselect + pincode->enabled; if(character->waiting_disconnect != INVALID_TIMER) { - timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + timer->delete_(character->waiting_disconnect, chr->waiting_disconnect); character->waiting_disconnect = INVALID_TIMER; } @@ -275,7 +275,7 @@ static void char_set_char_online(bool is_initializing, int char_id, int account_ //Get rid of disconnect timer if(character->waiting_disconnect != INVALID_TIMER) { - timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + timer->delete_(character->waiting_disconnect, chr->waiting_disconnect); character->waiting_disconnect = INVALID_TIMER; } @@ -324,7 +324,7 @@ static void char_set_char_offline(int char_id, int account_id) } if(character->waiting_disconnect != INVALID_TIMER){ - timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + timer->delete_(character->waiting_disconnect, chr->waiting_disconnect); character->waiting_disconnect = INVALID_TIMER; } @@ -532,7 +532,7 @@ static int char_mmo_char_tosql(int char_id, struct mmo_charstatus *p) if ( (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || - (p->class != cp->class) || + (p->class_ != cp->class_) || (p->partner_id != cp->partner_id) || (p->father != cp->father) || (p->mother != cp->mother) || (p->child != cp->child) || (p->karma != cp->karma) || (p->manner != cp->manner) || @@ -544,7 +544,7 @@ static int char_mmo_char_tosql(int char_id, struct mmo_charstatus *p) "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," "`karma`='%d', `manner`='%d', `fame`='%d'" " WHERE `account_id`='%d' AND `char_id` = '%d'", - char_db, p->class, + char_db, p->class_, p->hair, p->hair_color, p->clothes_color, p->body, p->partner_id, p->father, p->mother, p->child, p->karma, p->manner, p->fame, @@ -1107,7 +1107,7 @@ static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf, int || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, sizeof p.char_id, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, sizeof p.slot, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof p.name, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_INT, &p.class, sizeof p.class, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_INT, &p.class_, sizeof p.class_, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &p.base_level, sizeof p.base_level, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p.job_level, sizeof p.job_level, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT64, &p.base_exp, sizeof p.base_exp, NULL, NULL) @@ -1230,7 +1230,7 @@ static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool loa || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, sizeof p->account_id, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, sizeof p->slot, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof p->name, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &p->class, sizeof p->class, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &p->class_, sizeof p->class_, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p->base_level, sizeof p->base_level, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_INT, &p->job_level, sizeof p->job_level, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT64, &p->base_exp, sizeof p->base_exp, NULL, NULL) @@ -1602,7 +1602,7 @@ static int char_rename_char_sql(struct char_session_data *sd, int char_id) " '%d', '%d'" ")", charlog_db, - sd->account_id, char_dat.char_id, char_dat.slot, char_dat.class, esc_name, + sd->account_id, char_dat.char_id, char_dat.slot, char_dat.class_, esc_name, char_dat.str, char_dat.agi, char_dat.vit, char_dat.int_, char_dat.dex, char_dat.luk, char_dat.hair, char_dat.hair_color )) @@ -2083,7 +2083,7 @@ static int char_mmo_char_tobuf(uint8 *buffer, struct mmo_charstatus *p) WBUFW(buf, 48) = min(p->max_sp, INT16_MAX); #endif // PACKETVER_MAIN_NUM >= 20201007 || PACKETVER_RE_NUM >= 20211103 || PACKETVER_ZERO_NUM >= 20221024 WBUFW(buf,50) = DEFAULT_WALK_SPEED; // p->speed; - WBUFW(buf,52) = p->class; + WBUFW(buf,52) = p->class_; WBUFW(buf,54) = p->hair; #if PACKETVER >= 20141022 WBUFW(buf,56) = p->body; @@ -2452,8 +2452,8 @@ static void char_parse_fromlogin_auth_state(int fd) { struct char_session_data* sd = NULL; int account_id = RFIFOL(fd,2); - uint32 login_id1 = RFIFOL(fd,6); - uint32 login_id2 = RFIFOL(fd,10); + int32 login_id1 = RFIFOSL(fd,6); + int32 login_id2 = RFIFOSL(fd,10); uint8 sex = RFIFOB(fd,14); uint8 result = RFIFOB(fd,15); int request_id = RFIFOL(fd,16); @@ -2495,7 +2495,7 @@ static void char_parse_fromlogin_account_data(int fd) struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; int i; // find the authenticated session with this account id - ARR_FIND( 0, sockt->fd_max, i, sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2) ); + ARR_FIND(0, sockt->fd_max, i, sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOSL(fd,2)); if( i < sockt->fd_max ) { memcpy(sd->email, RFIFOP(fd,6), 40); sd->expiration_time = (time_t)RFIFOL(fd,46); @@ -2554,11 +2554,11 @@ static void char_changesex(int account_id, int sex) * @param sex The character's new gender (SEX_MALE or SEX_FEMALE). * @param acc The character's account ID. * @param char_id The character ID. - * @param class The character's current job class. + * @param class_ The character's current job class. * @param guild_id The character's guild ID. * **/ -static void char_change_sex_sub(int sex, int acc, int char_id, int class, int guild_id) +static void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) { struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); @@ -2580,22 +2580,22 @@ static void char_change_sex_sub(int sex, int acc, int char_id, int class, int gu } /** Correct the job class for gender specific jobs according to the passed gender. **/ - if (class == JOB_BARD || class == JOB_DANCER) - class = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); - else if (class == JOB_CLOWN || class == JOB_GYPSY) - class = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); - else if (class == JOB_BABY_BARD || class == JOB_BABY_DANCER) - class = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); - else if (class == JOB_MINSTREL || class == JOB_WANDERER) - class = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); - else if (class == JOB_MINSTREL_T || class == JOB_WANDERER_T) - class = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); - else if (class == JOB_BABY_MINSTREL || class == JOB_BABY_WANDERER) - class = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); - else if (class == JOB_KAGEROU || class == JOB_OBORO) - class = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); - else if (class == JOB_BABY_KAGEROU || class == JOB_BABY_OBORO) - class = (sex == SEX_MALE ? JOB_BABY_KAGEROU : JOB_BABY_OBORO); + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + else if (class_ == JOB_BABY_KAGEROU || class_ == JOB_BABY_OBORO) + class_ = (sex == SEX_MALE ? JOB_BABY_KAGEROU : JOB_BABY_OBORO); #if PACKETVER >= 20141016 char gender = (sex == SEX_MALE) ? 'M' : ((sex == SEX_FEMALE) ? 'F' : 'U'); @@ -2608,7 +2608,7 @@ static void char_change_sex_sub(int sex, int acc, int char_id, int class, int gu /** Don't update guild data if changing gender fails to prevent data de-synchronisation. **/ if (SQL_ERROR == SQL->StmtPrepare(stmt, query_char, char_db) - || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT32, &class, sizeof(class)) + || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT32, &class_, sizeof(class_)) || SQL_ERROR == SQL->StmtBindParam(stmt, 1, SQLDT_ENUM, &gender, sizeof(gender)) || SQL_ERROR == SQL->StmtBindParam(stmt, 2, SQLDT_INT32, &char_id, sizeof(char_id)) || SQL_ERROR == SQL->StmtExecute(stmt)) { @@ -2626,7 +2626,7 @@ static void char_change_sex_sub(int sex, int acc, int char_id, int class, int gu static int char_parse_fromlogin_changesex_reply(int fd) { - int char_id = 0, class = 0, guild_id = 0; + int char_id = 0, class_ = 0, guild_id = 0; int i; struct char_auth_node *node; struct SqlStmt *stmt; @@ -2651,7 +2651,7 @@ static int char_parse_fromlogin_changesex_reply(int fd) if (SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) || SQL_ERROR == SQL->StmtExecute(stmt) || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, sizeof char_id, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class, sizeof class, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, sizeof class_, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, sizeof guild_id, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); @@ -2659,7 +2659,7 @@ static int char_parse_fromlogin_changesex_reply(int fd) } for (i = 0; i < MAX_CHARS && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i) { - chr->change_sex_sub(sex, acc, char_id, class, guild_id); + chr->change_sex_sub(sex, acc, char_id, class_, guild_id); } SQL->StmtFree(stmt); @@ -3467,7 +3467,7 @@ static int char_changecharsex(int char_id, int sex) const char *query = "SELECT `account_id`, `class`, `guild_id` FROM `%s` WHERE `char_id`=?"; int account_id = 0; - int class = 0; + int class_ = 0; int guild_id = 0; /** Abort changing gender if there was an error while loading the data. **/ @@ -3475,7 +3475,7 @@ static int char_changecharsex(int char_id, int sex) || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT32, &char_id, sizeof(char_id)) || SQL_ERROR == SQL->StmtExecute(stmt) || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT32, &account_id, sizeof(account_id), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT32, &class, sizeof(class), NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT32, &class_, sizeof(class_), NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_INT32, &guild_id, sizeof(guild_id), NULL, NULL)) { SqlStmt_ShowDebug(stmt); SQL->StmtFree(stmt); @@ -3504,7 +3504,7 @@ static int char_changecharsex(int char_id, int sex) } SQL->StmtFree(stmt); - chr->change_sex_sub(sex, account_id, char_id, class, guild_id); + chr->change_sex_sub(sex, account_id, char_id, class_, guild_id); chr->disconnect_player(account_id); // Disconnect player if online on char-server. chr->changesex(account_id, sex); // Notify all mapservers about this change. @@ -4399,14 +4399,14 @@ static void char_send_account_id(int fd, int account_id) static void char_parse_char_connect(int fd, struct char_session_data *sd, uint32 ipl) { int account_id = RFIFOL(fd,2); - uint32 login_id1 = RFIFOL(fd,6); - uint32 login_id2 = RFIFOL(fd,10); + int32 login_id1 = RFIFOSL(fd,6); + int32 login_id2 = RFIFOSL(fd,10); int sex = RFIFOB(fd,16); struct char_auth_node* node; RFIFOSKIP(fd,17); - ShowInfo("request connect - account_id:%d/login_id1:%u/login_id2:%u\n", account_id, login_id1, login_id2); + ShowInfo("request connect - account_id:%d/login_id1:%d/login_id2:%d\n", account_id, login_id1, login_id2); if (sd) { //Received again auth packet for already authenticated account?? Discard it. @@ -4613,7 +4613,7 @@ static void char_parse_char_select(int fd, struct char_session_data *sd, uint32 " '%d', '%d', '%d', '%d', '%d', '%d'," " '%d', '%d')", charlog_db, - sd->account_id, cd->char_id, slot, char_dat.class, esc_name, + sd->account_id, cd->char_id, slot, char_dat.class_, esc_name, char_dat.str, char_dat.agi, char_dat.vit, char_dat.int_, char_dat.dex, char_dat.luk, char_dat.hair, char_dat.hair_color )) @@ -4992,7 +4992,7 @@ static void char_parse_char_login_map_server(int fd, uint32 ipl) static void char_parse_char_pincode_check(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); static void char_parse_char_pincode_check(int fd, struct char_session_data *sd) { - if (RFIFOL(fd,2) == sd->account_id) + if (RFIFOSL(fd,2) == sd->account_id) pincode->check(fd, sd); RFIFOSKIP(fd, 10); @@ -5001,7 +5001,7 @@ static void char_parse_char_pincode_check(int fd, struct char_session_data *sd) static void char_parse_char_pincode_window(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); static void char_parse_char_pincode_window(int fd, struct char_session_data *sd) { - if (RFIFOL(fd,2) == sd->account_id) + if (RFIFOSL(fd,2) == sd->account_id) pincode->loginstate(fd, sd, PINCODE_LOGIN_NOTSET); RFIFOSKIP(fd, 6); @@ -5010,7 +5010,7 @@ static void char_parse_char_pincode_window(int fd, struct char_session_data *sd) static void char_parse_char_pincode_change(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); static void char_parse_char_pincode_change(int fd, struct char_session_data *sd) { - if (RFIFOL(fd,2) == sd->account_id) + if (RFIFOSL(fd,2) == sd->account_id) pincode->change(fd, sd); RFIFOSKIP(fd, 14); @@ -5019,7 +5019,7 @@ static void char_parse_char_pincode_change(int fd, struct char_session_data *sd) static void char_parse_char_pincode_first_pin(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); static void char_parse_char_pincode_first_pin(int fd, struct char_session_data *sd) { - if (RFIFOL(fd,2) == sd->account_id) + if (RFIFOSL(fd,2) == sd->account_id) pincode->setnew (fd, sd); RFIFOSKIP(fd, 10); } diff --git a/src/char/char.h b/src/char/char.h index 6581e4ab838..02816292f18 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -101,8 +101,8 @@ enum inventory_table_type { struct char_auth_node { int account_id; int char_id; - uint32 login_id1; - uint32 login_id2; + int32 login_id1; + int32 login_id2; uint32 ip; int sex; time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) @@ -291,7 +291,7 @@ struct char_interface { int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); - void (*change_sex_sub) (int sex, int acc, int char_id, int class, int guild_id); + void (*change_sex_sub) (int sex, int acc, int char_id, int class_, int guild_id); void (*online_char_destroy) (struct online_char_data *character); int (*online_char_destroy_sub) (union DBKey key, struct DBData *data, va_list ap); void (*ensure_online_char_data) (struct online_char_data *character); diff --git a/src/char/geoip.c b/src/char/geoip.c index 37aa16233a7..d33d6ca8761 100644 --- a/src/char/geoip.c +++ b/src/char/geoip.c @@ -158,7 +158,7 @@ static void geoip_init(void) return; } geoip->data->cache = aMalloc(sizeof(unsigned char) * bufa.st_size); - if (fread(geoip->data->cache, sizeof(unsigned char), bufa.st_size, db) != bufa.st_size) { + if (fread(geoip->data->cache, sizeof(unsigned char), bufa.st_size, db) != (size_t)bufa.st_size) { ShowError("geoip_cache: Couldn't read all elements!\n"); fclose(db); geoip->final(false); diff --git a/src/char/int_adventurer_agency.c b/src/char/int_adventurer_agency.c index ffeae689de0..cf266d0a287 100644 --- a/src/char/int_adventurer_agency.c +++ b/src/char/int_adventurer_agency.c @@ -84,7 +84,7 @@ static void inter_adventurer_agency_parse_joinParty(int fd) member.account_id = cp->account_id; member.char_id = cp->char_id; safestrncpy(member.name, cp->name, NAME_LENGTH); - member.class = cp->class; + member.class_ = cp->class_; member.map = map_index; member.lv = cp->base_level; member.online = 1; diff --git a/src/char/int_auction.c b/src/char/int_auction.c index 2a5b3c3cb02..952c77787d3 100644 --- a/src/char/int_auction.c +++ b/src/char/int_auction.c @@ -182,7 +182,7 @@ static void inter_auction_delete(struct auction_data *auction) Sql_ShowDebug(inter->sql_handle); if( auction->auction_end_timer != INVALID_TIMER ) - timer->delete(auction->auction_end_timer, inter_auction->end_timer); + timer->delete_(auction->auction_end_timer, inter_auction->end_timer); idb_remove(inter_auction->db, auction_id); } diff --git a/src/char/int_guild.c b/src/char/int_guild.c index b1e3a177d66..3d085782cda 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -72,11 +72,9 @@ static int inter_guild_save_timer(int tid, int64 tick, int id, intptr_t data) { if (!g) continue; - if( state == 0 && g->guild_id == last_id ) + if (state == 0 && g->guild_id == last_id) { state++; //Save next guild in the list. - else - if( state == 1 && g->save_flag&GS_MASK ) - { + } else if(state == 1 && g->save_flag&GS_MASK) { inter_guild->tosql(g, g->save_flag&GS_MASK); g->save_flag &= ~GS_MASK; @@ -264,7 +262,7 @@ static bool inter_guild_tosql(struct guild *g, int flag) "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%"PRIu64"','%d','%d','%d','%s')", guild_member_db, g->guild_id, m->account_id, m->char_id, m->hair, m->hair_color, m->gender, - m->class, m->lv, m->exp, m->exp_payper, m->online, m->position, esc_name) ) + m->class_, m->lv, m->exp, m->exp_payper, m->online, m->position, esc_name) ) Sql_ShowDebug(inter->sql_handle); if (m->modified&GS_MEMBER_NEW || new_guild == 1) { @@ -458,7 +456,7 @@ static struct guild *inter_guild_fromsql(int guild_id) SQL->GetData(inter->sql_handle, 2, &data, NULL); m->hair = atoi(data); SQL->GetData(inter->sql_handle, 3, &data, NULL); m->hair_color = atoi(data); SQL->GetData(inter->sql_handle, 4, &data, NULL); m->gender = atoi(data); - SQL->GetData(inter->sql_handle, 5, &data, NULL); m->class = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); m->class_ = atoi(data); SQL->GetData(inter->sql_handle, 6, &data, NULL); m->lv = atoi(data); SQL->GetData(inter->sql_handle, 7, &data, NULL); m->exp = strtoull(data, NULL, 10); SQL->GetData(inter->sql_handle, 8, &data, NULL); m->exp_payper = (unsigned int)atoi(data); @@ -1116,7 +1114,7 @@ static bool inter_guild_leave(int guild_id, int account_id, int char_id, int fla } // Change member info -static bool inter_guild_update_member_info_short(int guild_id, int account_id, int char_id, int online, int lv, int class) +static bool inter_guild_update_member_info_short(int guild_id, int account_id, int char_id, int online, int lv, int class_) { // Could speed up by manipulating only guild_member struct guild *g; @@ -1131,7 +1129,7 @@ static bool inter_guild_update_member_info_short(int guild_id, int account_id, i if (i < g->max_member) { g->member[i].online = online; g->member[i].lv = lv; - g->member[i].class = class; + g->member[i].class_ = class_; g->member[i].last_login = (uint32)time(NULL); g->member[i].modified = GS_MEMBER_MODIFIED; mapif->guild_memberinfoshort(g, i); @@ -1232,7 +1230,7 @@ static bool inter_guild_update_basic_info(int guild_id, enum guild_basic_info ty switch (type) { case GBI_EXP: value = *((const int16 *)data); - if( value < 0 && abs(value) > g->exp ) + if( value < 0 && (uint64)abs(value) > g->exp ) return 0; g->exp += value; inter_guild->calcinfo(g); @@ -1360,7 +1358,7 @@ static bool inter_guild_update_member_info(int guild_id, int account_id, int cha } case GMI_CLASS: { - g->member[i].class = *(const int16 *)data; + g->member[i].class_ = *(const int16 *)data; g->member[i].modified = GS_MEMBER_MODIFIED; mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); g->save_flag |= GS_MEMBER; //Save new data. diff --git a/src/char/int_guild.h b/src/char/int_guild.h index c6df04fc3b1..c8c12833127 100644 --- a/src/char/int_guild.h +++ b/src/char/int_guild.h @@ -72,7 +72,7 @@ struct inter_guild_interface { struct guild *(*create) (const char *name, const struct guild_member *master); bool (*add_member) (int guild_id, const struct guild_member *member); bool (*leave) (int guild_id, int account_id, int char_id, int flag, const char *mes); - bool (*update_member_info_short) (int guild_id, int account_id, int char_id, int online, int lv, int class); + bool (*update_member_info_short) (int guild_id, int account_id, int char_id, int online, int lv, int class_); bool (*update_member_info) (int guild_id, int account_id, int char_id, enum guild_member_info type, const char *data, int len); bool (*disband) (int guild_id); bool (*update_basic_info) (int guild_id, enum guild_basic_info type, const void *data, int len); diff --git a/src/char/int_homun.c b/src/char/int_homun.c index 5aae16edd41..61ec91899cf 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -226,14 +226,13 @@ static bool inter_homunculus_rename(const char *name) nullpo_ret(name); // Check Authorized letters/symbols in the name of the homun - if( char_name_option == 1 ) - {// only letters/symbols in char_name_letters are authorized + if (char_name_option == 1) { + // only letters/symbols in char_name_letters are authorized for( i = 0; i < NAME_LENGTH && name[i]; i++ ) if( strchr(char_name_letters, name[i]) == NULL ) return false; - } else - if( char_name_option == 2 ) - {// letters/symbols in char_name_letters are forbidden + } else if (char_name_option == 2) { + // letters/symbols in char_name_letters are forbidden for( i = 0; i < NAME_LENGTH && name[i]; i++ ) if( strchr(char_name_letters, name[i]) != NULL ) return false; diff --git a/src/char/int_party.c b/src/char/int_party.c index c67f2b84849..3b08851fd22 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -343,7 +343,7 @@ static struct party_data *inter_party_fromsql(int party_id) SQL->GetData(inter->sql_handle, 3, &data, NULL); m->lv = atoi(data); SQL->GetData(inter->sql_handle, 4, &data, NULL); m->map = mapindex->name2id(data); SQL->GetData(inter->sql_handle, 5, &data, NULL); m->online = (atoi(data) ? 1 : 0); - SQL->GetData(inter->sql_handle, 6, &data, NULL); m->class = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); m->class_ = atoi(data); m->leader = (m->account_id == leader_id && m->char_id == leader_char ? 1 : 0); } SQL->FreeResult(inter->sql_handle); @@ -619,7 +619,7 @@ static bool inter_party_change_map(int party_id, int account_id, int char_id, un if (i == MAX_PARTY) /// Character not found in party. return false; - if (p->party.member[i].online != online) + if (p->party.member[i].online != (unsigned int)online) p->party.member[i].online = online; if (p->party.member[i].lv != lv) diff --git a/src/char/inter.c b/src/char/inter.c index 4065500afb1..fa8c1ec1082 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -150,9 +150,9 @@ static void inter_do_final_msg(void) aFree(msg_table[i]); } -static const char *inter_job_name(int class) +static const char *inter_job_name(int class_) { - switch (class) { + switch (class_) { #define JOB_ENUM_VALUE(name, id, msgtbl) case JOB_ ## name: return inter->msg_txt(MSGTBL_ ## msgtbl); #include "common/class.h" #include "common/class_hidden.h" @@ -242,18 +242,18 @@ static void inter_accinfo(int u_fd, int aid, int castergroup, const char *query, } else {// more than one, listing... [Dekamaster/Nightroad] inter->msg_to_fd(map_fd, u_fd, aid, "Your query returned the following %d results, please be more specific...",(int)SQL->NumRows(inter->sql_handle)); while ( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { - int class; + int class_; int base_level, job_level, online; char name[NAME_LENGTH]; SQL->GetData(inter->sql_handle, 0, &data, NULL); account_id = atoi(data); SQL->GetData(inter->sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name)); - SQL->GetData(inter->sql_handle, 2, &data, NULL); class = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); class_ = atoi(data); SQL->GetData(inter->sql_handle, 3, &data, NULL); base_level = atoi(data); SQL->GetData(inter->sql_handle, 4, &data, NULL); job_level = atoi(data); SQL->GetData(inter->sql_handle, 5, &data, NULL); online = atoi(data); - inter->msg_to_fd(map_fd, u_fd, aid, "[AID: %d] %s | %s | Level: %d/%d | %s", account_id, name, inter->job_name(class), base_level, job_level, online?"Online":"Offline"); + inter->msg_to_fd(map_fd, u_fd, aid, "[AID: %d] %s | %s | Level: %d/%d | %s", account_id, name, inter->job_name(class_), base_level, job_level, online?"Online":"Offline"); } SQL->FreeResult(inter->sql_handle); return; @@ -318,19 +318,19 @@ static void inter_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int ac } else { while ( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { char *data; - int char_id, class; + int char_id, class_; int char_num, base_level, job_level, online; char name[NAME_LENGTH]; SQL->GetData(inter->sql_handle, 0, &data, NULL); char_id = atoi(data); SQL->GetData(inter->sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name)); SQL->GetData(inter->sql_handle, 2, &data, NULL); char_num = atoi(data); - SQL->GetData(inter->sql_handle, 3, &data, NULL); class = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); class_ = atoi(data); SQL->GetData(inter->sql_handle, 4, &data, NULL); base_level = atoi(data); SQL->GetData(inter->sql_handle, 5, &data, NULL); job_level = atoi(data); SQL->GetData(inter->sql_handle, 6, &data, NULL); online = atoi(data); - inter->msg_to_fd(map_fd, u_fd, u_aid, "[Slot/CID: %d/%d] %s | %s | Level: %d/%d | %s", char_num, char_id, name, inter->job_name(class), base_level, job_level, online?"On":"Off"); + inter->msg_to_fd(map_fd, u_fd, u_aid, "[Slot/CID: %d/%d] %s | %s | Level: %d/%d | %s", char_num, char_id, name, inter->job_name(class_), base_level, job_level, online?"On":"Off"); } } SQL->FreeResult(inter->sql_handle); diff --git a/src/char/inter.h b/src/char/inter.h index 047297877a6..c7b08dd18ca 100644 --- a/src/char/inter.h +++ b/src/char/inter.h @@ -40,7 +40,7 @@ struct inter_interface { const char* (*msg_txt) (int msg_number); bool (*msg_config_read) (const char *cfg_name, bool allow_override); void (*do_final_msg) (void); - const char* (*job_name) (int class); + const char* (*job_name) (int class_); void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap) __attribute__((format(printf, 4, 0))); void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string); diff --git a/src/char/mapif.c b/src/char/mapif.c index 5fa3a41a6f1..50630bdb9be 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -555,7 +555,7 @@ static int mapif_guild_memberinfoshort(struct guild *g, int idx) WBUFL(buf, 10) = g->member[idx].char_id; WBUFB(buf, 14) = (unsigned char)g->member[idx].online; WBUFW(buf, 15) = g->member[idx].lv; - WBUFL(buf, 17) = g->member[idx].class; + WBUFL(buf, 17) = g->member[idx].class_; WBUFL(buf, 21) = g->member[idx].last_login; mapif->send(buf, 25); return 0; @@ -766,9 +766,9 @@ static int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char } // Change member info -static int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class) +static int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_) { - inter_guild->update_member_info_short(guild_id, account_id, char_id, online, lv, class); + inter_guild->update_member_info_short(guild_id, account_id, char_id, online, lv, class_); return 0; } @@ -829,7 +829,7 @@ static int mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const static int mapif_parse_GuildEmblem(int fd) { - struct PACKET_MAPCHAR_GUILD_EMBLEM *p = RFIFOP(fd, 0); + const struct PACKET_MAPCHAR_GUILD_EMBLEM *p = RFIFOP(fd, 0); RFIFO_CHUNKED_INIT(p, p->packetLength - sizeof(struct PACKET_MAPCHAR_GUILD_EMBLEM), mapif->emblem_tmp); RFIFO_CHUNKED_ERROR(p) { diff --git a/src/char/mapif.h b/src/char/mapif.h index 13b98b7afde..5c658655111 100644 --- a/src/char/mapif.h +++ b/src/char/mapif.h @@ -89,7 +89,7 @@ struct mapif_interface { int (*parse_GuildInfo) (int fd, int guild_id); int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); - int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); int (*parse_BreakGuild) (int fd, int guild_id); int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); diff --git a/src/common/HPM.c b/src/common/HPM.c index 7e4d886cd4b..1e32eb2c321 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -161,7 +161,7 @@ static struct hplugin *hplugin_create(void) return plugin; } -static bool hplugins_addpacket(unsigned short cmd, unsigned short length, void (*receive) (int fd), unsigned int point, unsigned int pluginID) +static bool hplugins_addpacket(unsigned short cmd, int length, void (*receive) (int fd), unsigned int point, unsigned int pluginID) { struct HPluginPacket *packet; int i; @@ -185,7 +185,7 @@ static bool hplugins_addpacket(unsigned short cmd, unsigned short length, void ( packet->pluginID = pluginID; packet->cmd = cmd; - packet->len = length; + packet->len = (short)length; packet->receive = receive; if (cmd <= MAX_PACKET_DB && cmd >= MIN_PACKET_DB) { diff --git a/src/common/HPMi.h b/src/common/HPMi.h index 7efc6a1cd40..1f19a74a477 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -239,7 +239,7 @@ struct HPMi_interface { void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); /* packet */ - bool (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + bool (*addPacket) (unsigned short cmd, int length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); /* program --arg/-a */ bool (*addArg) (unsigned int pluginID, char *name, bool has_param, CmdlineExecFunc func, const char *help); /* battle-config recv param */ diff --git a/src/common/console.h b/src/common/console.h index bf06c5a7d54..061d1398795 100644 --- a/src/common/console.h +++ b/src/common/console.h @@ -75,7 +75,11 @@ struct console_input_interface { /* vars */ struct spin_lock *ptlock; ///< parse thread lock. struct thread_handle *pthread; ///< parse thread. +#ifdef WIN32 + volatile long ptstate; ///< parse thread state. +#else volatile int32 ptstate; ///< parse thread state. +#endif struct mutex_data *ptmutex; ///< parse thread mutex. struct cond_data *ptcond; ///< parse thread conditional variable. /* */ diff --git a/src/common/core.c b/src/common/core.c index 7c4c2d9682d..185cfcb1ecd 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -277,7 +277,7 @@ static bool get_executable_path(char *buf, size_t length) return true; #elif defined(__linux) || defined(__linux__) ssize_t len = readlink("/proc/self/exe", buf, length); - if (len <= 0 || len == length) + if (len <= 0 || len == (ssize_t)length) return false; buf[len] = '\0'; return true; @@ -301,8 +301,9 @@ static bool get_executable_path(char *buf, size_t length) if (sysctl(mib, 4, buf, &length, NULL, 0) != 0) return false; return true; -#endif +#else return false; +#endif } static void core_defaults(void) diff --git a/src/common/db.c b/src/common/db.c index 042bbdc19db..ed50b12a3c5 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -2616,7 +2616,7 @@ static struct DBMap *db_alloc(const char *file, const char *func, int line, enum db->free_lock = 0; /* Other */ snprintf(ers_name, 50, "db_alloc:nodes:%s:%s:%d",func,file,line); - db->nodes = ers_new(sizeof(struct DBNode),ers_name,ERS_OPT_WAIT|ERS_OPT_FREE_NAME|ERS_OPT_CLEAN); + db->nodes = ers_new(sizeof(struct DBNode),ers_name,(enum ERSOptions)(ERS_OPT_WAIT|ERS_OPT_CLEAN)); // FIXME: change this to a flag type db->cmp = DB->default_cmp(type); db->hash = DB->default_hash(type); db->release = DB->default_release(type, options); @@ -2810,8 +2810,8 @@ static void *db_data2ptr(struct DBData *data) */ static void db_init(void) { - db_iterator_ers = ers_new(sizeof(struct DBIterator_impl),"db.c::db_iterator_ers",ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK); - db_alloc_ers = ers_new(sizeof(struct DBMap_impl),"db.c::db_alloc_ers",ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK); + db_iterator_ers = ers_new(sizeof(struct DBIterator_impl),"db.c::db_iterator_ers", (enum ERSOptions)(ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK)); // FIXME: change this to a flag type + db_alloc_ers = ers_new(sizeof(struct DBMap_impl),"db.c::db_alloc_ers",(enum ERSOptions)(ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK)); // FIXME: change this to a flag type ers_chunk_size(db_alloc_ers, 50); ers_chunk_size(db_iterator_ers, 10); DB_COUNTSTAT(db_init); diff --git a/src/common/ers.c b/src/common/ers.c index f00aa616a31..ca1fba55475 100644 --- a/src/common/ers.c +++ b/src/common/ers.c @@ -303,9 +303,7 @@ static void ers_obj_destroy(ERS *self) else InstanceList = instance->Next; - if( instance->Options & ERS_OPT_FREE_NAME ) - aFree(instance->Name); - + aFree(instance->Name); aFree(instance); } @@ -322,7 +320,7 @@ static void ers_cache_size(ERS *self, unsigned int new_size) instance->Cache->ChunkSize = new_size; } -ERS *ers_new(uint32 size, char *name, enum ERSOptions options) +ERS *ers_new(uint32 size, const char *name, enum ERSOptions options) // FIXME: change this to a flag type { struct ers_instance_t *instance; @@ -342,7 +340,7 @@ ERS *ers_new(uint32 size, char *name, enum ERSOptions options) instance->VTable.destroy = ers_obj_destroy; instance->VTable.chunk_size = ers_cache_size; - instance->Name = ( options & ERS_OPT_FREE_NAME ) ? aStrdup(name) : name; + instance->Name = aStrdup(name); instance->Options = options; instance->Cache = ers_find_cache(size,instance->Options); diff --git a/src/common/ers.h b/src/common/ers.h index a1ff35edb5d..c26ce28ce33 100644 --- a/src/common/ers.h +++ b/src/common/ers.h @@ -92,7 +92,7 @@ enum ERSOptions { ERS_OPT_NONE = 0x00, ERS_OPT_CLEAR = 0x01,/* silently clears any entries left in the manager upon destruction */ ERS_OPT_WAIT = 0x02,/* wait for entries to come in order to list! */ - ERS_OPT_FREE_NAME = 0x04,/* name is dynamic memory, and should be freed */ + // ERS_OPT_FREE_NAME = 0x04,/* name is dynamic memory, and should be freed */ // UNUSED ERS_OPT_CLEAN = 0x08,/* clears used memory upon ers_free so that its all new to be reused on the next alloc */ ERS_OPT_FLEX_CHUNK = 0x10,/* signs that it should look for its own cache given it'll have a dynamic chunk size, so that it doesn't affect the other ERS it'd otherwise be sharing */ @@ -177,7 +177,7 @@ typedef struct eri { * @param The requested size of the entry in bytes * @return Interface of the object */ -ERS *ers_new(uint32 size, char *name, enum ERSOptions options); +ERS *ers_new(uint32 size, const char *name, enum ERSOptions options); /** * Print a report about the current state of the Entry Reusage System. diff --git a/src/common/extraconf.c b/src/common/extraconf.c index 688a2d20854..d9409f6fb5c 100644 --- a/src/common/extraconf.c +++ b/src/common/extraconf.c @@ -153,7 +153,7 @@ static bool extraconf_read_vars(const char *filename, bool imported, struct conf return retval; } -static bool extraconf_set_var(struct config_data *conf_var, int value) +static bool extraconf_set_var(const struct config_data *conf_var, int value) { nullpo_retr(false, conf_var); @@ -174,7 +174,7 @@ static bool extraconf_set_var(struct config_data *conf_var, int value) return true; } -static bool extraconf_set_var_str(struct config_data *conf_var, const char *val) +static bool extraconf_set_var_str(const struct config_data *conf_var, const char *val) { nullpo_retr(false, conf_var); nullpo_retr(false, val); diff --git a/src/common/extraconf.h b/src/common/extraconf.h index a87ee1be7c3..facad997d5a 100644 --- a/src/common/extraconf.h +++ b/src/common/extraconf.h @@ -75,8 +75,8 @@ struct extraconf_interface { bool (*read_conf_file) (const char *filename, bool imported, const char *node, const struct config_data *conf_vars); bool (*read_conf) (const char *filename, bool imported, struct config_t *config, const char *node, const struct config_data *conf_vars); bool (*read_vars) (const char *filename, bool imported, struct config_t *config, const char *node, const struct config_data *conf_vars); - bool (*set_var) (struct config_data *conf_var, int val); - bool (*set_var_str) (struct config_data *conf_var, const char *val); + bool (*set_var) (const struct config_data *conf_var, int val); + bool (*set_var_str) (const struct config_data *conf_var, const char *val); bool (*read_emblems) (void); }; diff --git a/src/common/memmgr.c b/src/common/memmgr.c index 0af3f1997bb..43e5cc67179 100644 --- a/src/common/memmgr.c +++ b/src/common/memmgr.c @@ -620,7 +620,7 @@ static void mfree_(void *ptr, const char *file, int line, const char *func) } else { /* Release unit */ struct block *block = head->block; - if( (char*)head - (char*)block > sizeof(struct block) ) { + if( (char*)head - (char*)block > (ssize_t)sizeof(struct block) ) { ShowError("Memory manager: args of aFree 0x%p is invalid pointer %s line %d\n", ptr, file, line); } else if(head->block == NULL) { ShowError("Memory manager: args of aFree 0x%p is freed pointer %s:%d@%s\n", ptr, file, line, func); diff --git a/src/common/mmo.h b/src/common/mmo.h index edb4ed7ad48..a7cf5ea2664 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -781,7 +781,7 @@ struct mmo_charstatus { int zeny; int bank_vault; - int class; + int class_; int status_point, skill_point; int hp,max_hp,sp,max_sp; unsigned int option; @@ -907,7 +907,7 @@ struct party_member { int account_id; int char_id; char name[NAME_LENGTH]; - int class; + int class_; int lv; unsigned short map; unsigned leader : 1, @@ -927,7 +927,7 @@ struct map_session_data; struct guild_member { int account_id, char_id; short hair,hair_color,gender; - int class; + int class_; short lv; uint64 exp; int exp_payper; diff --git a/src/common/socket.c b/src/common/socket.c index b4ce0e58be1..9c6fafd512e 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -846,8 +846,8 @@ static int rfifoskip(int fd, size_t len) Assert_report(0); len = RFIFOREST(fd); } else { - const size_t lenRest = RFIFOREST(fd); - if (s->flag.validate == 1 && len == lenRest) { + const ssize_t lenRest = RFIFOREST(fd); + if (s->flag.validate == 1 && (ssize_t)len == lenRest) { if (lenRest >= 2) { const uint32 cmd = (uint32)RFIFOW(fd, 0); if (cmd < MIN_PACKET_DB || cmd > MAX_PACKET_DB) { @@ -862,12 +862,12 @@ static int rfifoskip(int fd, size_t len) } else { packet_len = RFIFOW(fd, 2); if (packet_len != lenRest) { - ShowError("Skip packet 0x%04X with dynamic size %"PRIuS", but must be size %d\n", cmd, lenRest, packet_len); + ShowError("Skip packet 0x%04X with dynamic size %"PRIdS", but must be size %d\n", cmd, lenRest, packet_len); Assert_report(0); } } } else if (packet_len != lenRest) { - ShowError("Skip packet 0x%04X with size %"PRIuS", but must be size %d\n", cmd, lenRest, packet_len); + ShowError("Skip packet 0x%04X with size %"PRIdS", but must be size %d\n", cmd, lenRest, packet_len); Assert_report(0); } } diff --git a/src/common/socket.h b/src/common/socket.h index 81667ee413a..4003eaf33ea 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -47,13 +47,21 @@ struct config_setting_t; #define WFIFOP(fd,pos) ((void *)(sockt->session[fd]->wdata + sockt->session[fd]->wdata_size + (pos))) #define RFIFOB(fd,pos) (*(const uint8*)RFIFOP((fd),(pos))) +#define RFIFOSB(fd,pos) (*(const int8*)RFIFOP((fd),(pos))) #define WFIFOB(fd,pos) (*(uint8*)WFIFOP((fd),(pos))) +#define WFIFOSB(fd,pos) (*(int8*)WFIFOP((fd),(pos))) #define RFIFOW(fd,pos) (*(const uint16*)RFIFOP((fd),(pos))) +#define RFIFOSW(fd,pos) (*(const int16*)RFIFOP((fd),(pos))) #define WFIFOW(fd,pos) (*(uint16*)WFIFOP((fd),(pos))) +#define WFIFOSW(fd,pos) (*(int16*)WFIFOP((fd),(pos))) #define RFIFOL(fd,pos) (*(const uint32*)RFIFOP((fd),(pos))) +#define RFIFOSL(fd,pos) (*(const int32*)RFIFOP((fd),(pos))) #define WFIFOL(fd,pos) (*(uint32*)WFIFOP((fd),(pos))) +#define WFIFOSL(fd,pos) (*(int32*)WFIFOP((fd),(pos))) #define RFIFOQ(fd,pos) (*(const uint64*)RFIFOP((fd),(pos))) +#define RFIFOSQ(fd,pos) (*(const int64*)RFIFOP((fd),(pos))) #define WFIFOQ(fd,pos) (*(uint64*)WFIFOP((fd),(pos))) +#define WFIFOSQ(fd,pos) (*(int64*)WFIFOP((fd),(pos))) #define RFIFOSPACE(fd) (sockt->session[fd]->max_rdata - sockt->session[fd]->rdata_size) #define WFIFOSPACE(fd) (sockt->session[fd]->max_wdata - sockt->session[fd]->wdata_size) @@ -92,6 +100,10 @@ static inline const void *RBUFP_(const void *p, int pos) #define RBUFW(p,pos) (*(const uint16 *)RBUFP((p),(pos))) #define RBUFL(p,pos) (*(const uint32 *)RBUFP((p),(pos))) #define RBUFQ(p,pos) (*(const uint64 *)RBUFP((p),(pos))) +#define RBUFSB(p,pos) (*(const int8 *)RBUFP((p),(pos))) +#define RBUFSW(p,pos) (*(const int16 *)RBUFP((p),(pos))) +#define RBUFSL(p,pos) (*(const int32 *)RBUFP((p),(pos))) +#define RBUFSQ(p,pos) (*(const int64 *)RBUFP((p),(pos))) static inline void *WBUFP_(void *p, int pos) __attribute__((const, unused)); static inline void *WBUFP_(void *p, int pos) @@ -103,6 +115,10 @@ static inline void *WBUFP_(void *p, int pos) #define WBUFW(p,pos) (*(uint16*)WBUFP((p),(pos))) #define WBUFL(p,pos) (*(uint32*)WBUFP((p),(pos))) #define WBUFQ(p,pos) (*(uint64*)WBUFP((p),(pos))) +#define WBUFSB(p,pos) (*(int8*)WBUFP((p),(pos))) +#define WBUFSW(p,pos) (*(int16*)WBUFP((p),(pos))) +#define WBUFSL(p,pos) (*(int32*)WBUFP((p),(pos))) +#define WBUFSQ(p,pos) (*(int64*)WBUFP((p),(pos))) #define TOB(n) ((uint8)((n)&UINT8_MAX)) #define TOW(n) ((uint16)((n)&UINT16_MAX)) diff --git a/src/common/spinlock.h b/src/common/spinlock.h index d437d5fbc95..9d278ed089e 100644 --- a/src/common/spinlock.h +++ b/src/common/spinlock.h @@ -37,11 +37,18 @@ #endif #ifdef WIN32 +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable: 4324) +#endif struct __declspec(align(64)) spin_lock { volatile LONG lock; volatile LONG nest; volatile LONG sync_lock; }; +#ifdef _MSC_VER +#pragma warning (pop) +#endif #else struct spin_lock { volatile int32 lock; diff --git a/src/common/sql.c b/src/common/sql.c index 655f59c772f..293b086d53a 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -429,7 +429,7 @@ static void Sql_Free(struct Sql *self) { SQL->FreeResult(self); StrBuf->Destroy(&self->buf); - if( self->keepalive != INVALID_TIMER ) timer->delete(self->keepalive, Sql_P_KeepaliveTimer); + if( self->keepalive != INVALID_TIMER ) timer->delete_(self->keepalive, Sql_P_KeepaliveTimer); mysql_close(&self->handle); aFree(self); } @@ -729,8 +729,8 @@ static size_t SqlStmt_NumParams(struct SqlStmt *self) /// Binds a parameter to a buffer. static int SqlStmt_BindParam(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len) { - if( self == NULL ) - return SQL_ERROR; + if (self == NULL) + return SQL_ERROR; if( !self->bind_params ) {// initialize the bindings diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c index 1b2e09fe53a..0010ef41143 100644 --- a/src/common/sysinfo.c +++ b/src/common/sysinfo.c @@ -49,15 +49,15 @@ /// Private interface fields struct sysinfo_private { const char *platform; - const char *osversion; - const char *cpu; + char *osversion; + char *cpu; int cpucores; - const char *arch; + char *arch; const char *compiler; const char *cflags; char *vcstype_name; int vcstype; - const char *vcsrevision_src; + char *vcsrevision_src; char *vcsrevision_scripts; bool (*git_get_revision) (char **out); diff --git a/src/common/timer.c b/src/common/timer.c index 32f61c1a13d..cd9f9b45fcd 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -109,7 +109,7 @@ static int timer_add_func_list(TimerFunc func, char *name) } /// Returns the name of the timer function. -static char *search_timer_func_list(TimerFunc func) +static const char *search_timer_func_list(TimerFunc func) { struct timer_func_list* tfl; @@ -549,7 +549,8 @@ static void timer_final(void) for( tfl=tfl_root; tfl != NULL; tfl = next ) { next = tfl->next; // copy next pointer - aFree(tfl->name); // free structures + // free structures + aFree((char *)tfl->name); // FIXME: we shouldn't pass const to aFree aFree(tfl); } @@ -654,7 +655,7 @@ void timer_defaults(void) timer->add_interval = timer_add_interval; timer->add_func_list = timer_add_func_list; timer->get = timer_get; - timer->delete = timer_do_delete; + timer->delete_ = timer_do_delete; timer->addtick = timer_addtick; timer->settick = timer_settick; timer->get_uptime = timer_get_uptime; diff --git a/src/common/timer.h b/src/common/timer.h index ada42390dca..7c007e9257f 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -65,7 +65,7 @@ struct timer_interface { int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); const struct TimerData *(*get) (int tid); - int (*delete) (int tid, TimerFunc func); + int (*delete_) (int tid, TimerFunc func); int64 (*addtick) (int tid, int64 tick); int64 (*settick) (int tid, int64 tick); diff --git a/src/common/utils.c b/src/common/utils.c index 23214b58b3d..207f5cfb639 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -232,7 +232,7 @@ void findfile(const char *p, const char *pat, void (func)(const char *, void *co if (strcmp(entry->d_name, "..") == 0) continue; - if (snprintf(tmppath, sizeof(tmppath), "%s%c%s", path, PATHSEP, entry->d_name) >= sizeof(tmppath)) { + if (snprintf(tmppath, sizeof(tmppath), "%s%c%s", path, PATHSEP, entry->d_name) >= (ssize_t)sizeof(tmppath)) { ShowError("findfile: too long path would be truncated: '%s' - skipping\n", tmppath); continue; } diff --git a/src/login/ipban.c b/src/login/ipban.c index da1a366d622..412072770fb 100644 --- a/src/login/ipban.c +++ b/src/login/ipban.c @@ -75,7 +75,7 @@ static void ipban_final(void) if (login->config->ipban_cleanup_interval > 0) // release data - timer->delete(ipban->cleanup_timer_id, ipban->cleanup); + timer->delete_(ipban->cleanup_timer_id, ipban->cleanup); ipban->cleanup(0,0,0,0); // always clean up on login-server stop diff --git a/src/login/lapiif.c b/src/login/lapiif.c index 6ce53e4bc75..80424e047a1 100644 --- a/src/login/lapiif.c +++ b/src/login/lapiif.c @@ -220,8 +220,9 @@ static int lapiif_parse_fromapi_api_proxy(int fd) return 0; } - RFIFOSKIP(fd, packet->packet_len); - return 0; + // Uncomment if any new cases are added to the above switch that can break out of it + // RFIFOSKIP(fd, packet->packet_len); + // return 0; } static void lapiif_parse_proxy_api_to_char(int fd) diff --git a/src/login/login.c b/src/login/login.c index 4b7f682da75..549181d531c 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -94,7 +94,7 @@ static struct online_login_data* login_add_online_user(int char_server, int acco p->char_server = char_server; if( p->waiting_disconnect != INVALID_TIMER ) { - timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + timer->delete_(p->waiting_disconnect, login->waiting_disconnect_timer); p->waiting_disconnect = INVALID_TIMER; } return p; @@ -106,7 +106,7 @@ static void login_remove_online_user(int account_id) if (p == NULL) return; if (p->waiting_disconnect != INVALID_TIMER) - timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + timer->delete_(p->waiting_disconnect, login->waiting_disconnect_timer); idb_remove(login->online_db, account_id); @@ -138,7 +138,7 @@ static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_l p->char_server = -1; if( p->waiting_disconnect != INVALID_TIMER ) { - timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + timer->delete_(p->waiting_disconnect, login->waiting_disconnect_timer); p->waiting_disconnect = INVALID_TIMER; } } @@ -692,7 +692,7 @@ static void login_fromchar_parse_online_accounts(int fd, int id) login_data->char_server = id; if (login_data->waiting_disconnect != INVALID_TIMER) { - timer->delete(login_data->waiting_disconnect, login->waiting_disconnect_timer); + timer->delete_(login_data->waiting_disconnect, login->waiting_disconnect_timer); login_data->waiting_disconnect = INVALID_TIMER; } } diff --git a/src/login/packets_ca_struct.h b/src/login/packets_ca_struct.h index 9ea52f0129e..4d11c488a80 100644 --- a/src/login/packets_ca_struct.h +++ b/src/login/packets_ca_struct.h @@ -230,7 +230,7 @@ struct PACKET_CA_CHARSERVERCONNECT { char name[MAX_CHARSERVER_NAME_SIZE]; ///< Charserver name int16 unknown2; int16 type; ///< Charserver type - int16 new; ///< Whether charserver is to be marked as new + int16 new_; ///< Whether charserver is to be marked as new } __attribute__((packed)); /** diff --git a/src/map/achievement.c b/src/map/achievement.c index 7f2d0095bde..29f7bb08f0e 100644 --- a/src/map/achievement.c +++ b/src/map/achievement.c @@ -179,7 +179,7 @@ static void achievement_progress_add(struct map_session_data *sd, const struct a nullpo_retv(ad); Assert_retv(progress != 0); - Assert_retv(obj_idx < VECTOR_LENGTH(ad->objective)); + Assert_retv(obj_idx < (size_t)VECTOR_LENGTH(ad->objective)); if ((ach = achievement->ensure(sd, ad)) == NULL) return; @@ -220,7 +220,7 @@ static void achievement_progress_set(struct map_session_data *sd, const struct a nullpo_retv(ad); Assert_retv(progress != 0); - Assert_retv(obj_idx < VECTOR_LENGTH(ad->objective)); + Assert_retv(obj_idx < (size_t)VECTOR_LENGTH(ad->objective)); if (progress >= VECTOR_INDEX(ad->objective, obj_idx).goal) { @@ -468,7 +468,7 @@ static void achievement_validate_pc_kill(struct map_session_data *sd, struct map /* */ VECTOR_INIT(criteria.jobid); VECTOR_ENSURE(criteria.jobid, 1, 1); - VECTOR_PUSH(criteria.jobid, dstsd->status.class); + VECTOR_PUSH(criteria.jobid, dstsd->status.class_); /* Job class */ achievement->validate_type(sd, ACH_KILL_PC_JOB, &criteria, true); @@ -528,7 +528,7 @@ static void achievement_validate_jobchange(struct map_session_data *sd) VECTOR_INIT(criteria.jobid); VECTOR_ENSURE(criteria.jobid, 1, 1); - VECTOR_PUSH(criteria.jobid, sd->status.class); + VECTOR_PUSH(criteria.jobid, sd->status.class_); criteria.goal = 1; @@ -570,7 +570,7 @@ static void achievement_validate_stats(struct map_session_data *sd, enum status_ VECTOR_INIT(criteria.jobid); VECTOR_ENSURE(criteria.jobid, 1, 1); - VECTOR_PUSH(criteria.jobid, sd->status.class); + VECTOR_PUSH(criteria.jobid, sd->status.class_); /* Stat and Job class */ achievement->validate_type(sd, ACH_STATUS_BY_JOB, &criteria, false); @@ -770,7 +770,7 @@ static void achievement_validate_refine(struct map_session_data *sd, unsigned in struct item_data *id = NULL; nullpo_retv(sd); - Assert_retv(idx < sd->status.inventorySize); + Assert_retv((int)idx < sd->status.inventorySize); id = itemdb->exists(sd->status.inventory[idx].nameid); @@ -912,9 +912,9 @@ static void achievement_validate_achieve(struct map_session_data *sd, int achid) * Validates taming type objectives. * @type ACH_PET_CREATE * @param[in] sd pointer to session data. - * @param[in] class (criteria) class of the monster tamed. + * @param[in] class_ (criteria) class of the monster tamed. */ -static void achievement_validate_taming(struct map_session_data *sd, int class) +static void achievement_validate_taming(struct map_session_data *sd, int class_) { struct achievement_objective criteria = { 0 }; @@ -923,10 +923,10 @@ static void achievement_validate_taming(struct map_session_data *sd, int class) if (sd->achievements_received == false) return; - Assert_retv(class > 0); - Assert_retv(mob->db(class) != mob->dummy); + Assert_retv(class_ > 0); + Assert_retv(mob->db(class_) != mob->dummy); - criteria.mobid = class; + criteria.mobid = class_; criteria.goal = 1; achievement->validate_type(sd, ACH_PET_CREATE, &criteria, true); diff --git a/src/map/achievement.h b/src/map/achievement.h index 1d59d9dc717..fdaf91d94ba 100644 --- a/src/map/achievement.h +++ b/src/map/achievement.h @@ -270,7 +270,7 @@ struct achievement_interface { void (*validate_item_get) (struct map_session_data *sd, int nameid, int amount); void (*validate_item_sell) (struct map_session_data *sd, int nameid, int amount); void (*validate_achieve) (struct map_session_data *sd, int achid); - void (*validate_taming) (struct map_session_data *sd, int class); + void (*validate_taming) (struct map_session_data *sd, int class_); void (*validate_achievement_rank) (struct map_session_data *sd, int rank); /* */ bool (*type_requires_criteria) (enum achievement_types type); diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 890c4a2e609..d990432473f 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -662,7 +662,7 @@ ACMD(who) if (pc_get_group_id(pl_sd) > 0) // Player title, if exists StrBuf->Printf(&buf, msg_fd(fd, MSGTBL_WHO_TITLE_FORMAT), pcg->get_name(pl_sd->group)); // "(%s) " StrBuf->Printf(&buf, msg_fd(fd, MSGTBL_WHO_LEVEL_JOB_FORMAT), pl_sd->status.base_level, pl_sd->status.job_level, - pc->job_name(pl_sd->status.class)); // "| Lv:%d/%d | Job: %s" + pc->job_name(pl_sd->status.class_)); // "| Lv:%d/%d | Job: %s" break; } case 3: { @@ -771,7 +771,7 @@ ACMD(whogm) snprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, MSGTBL_WHOGM_BLEVEL_JLEVEL), // BLvl: %d | Job: %s (Lvl: %d) pl_sd->status.base_level, - pc->job_name(pl_sd->status.class), pl_sd->status.job_level); + pc->job_name(pl_sd->status.class_), pl_sd->status.job_level); clif->message(fd, atcmd_output); p = party->search(pl_sd->status.party_id); @@ -889,7 +889,7 @@ ACMD(storage) return false; } - struct storage_settings *stst = storage->get_settings(storage_id); + const struct storage_settings *stst = storage->get_settings(storage_id); if (stst == NULL) { clif->message(fd, msg_fd(fd, MSGTBL_STORAGE_INVALID)); return false; @@ -1626,7 +1626,7 @@ static int atcommand_pvpoff_sub(struct block_list *bl, va_list ap) clif->pvpset(sd, 0, 0, 2); if (sd->pvp_timer != INVALID_TIMER) { - timer->delete(sd->pvp_timer, pc->calc_pvprank_timer); + timer->delete_(sd->pvp_timer, pc->calc_pvprank_timer); sd->pvp_timer = INVALID_TIMER; } return 0; @@ -3031,7 +3031,7 @@ ACMD(petrename) int i; ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET - && pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); + && pd->pet.pet_id == (int)MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); if (i != sd->status.inventorySize) sd->status.inventory[i].card[3] = pet->get_card4_value(pd->pet.rename_flag, pd->pet.intimate); @@ -3611,30 +3611,27 @@ ACMD(guild) ACMD(breakguild) { - if (sd->status.guild_id) { // Check if the player has a guild - struct guild *g = sd->guild; // Search the guild - if (g) { // Check if guild was found - if (sd->state.gmaster_flag) { // Check if player is guild master - int ret = 0; - ret = guild->dobreak(sd, g->name); // Break guild - if (ret) { // Check if anything went wrong - return true; // Guild was broken - } else { - return false; // Something went wrong - } - } else { // Not guild master - clif->message(fd, msg_fd(fd, MSGTBL_CHANGEGM_GM_REQUIRED)); // You need to be a Guild Master to use this command. - return false; - } - } else { // Guild was not found. HOW? - clif->message(fd, msg_fd(fd, MSGTBL_NOT_IN_A_GUILD2)); // You are not in a guild. - return false; - } - } else { // Player does not have a guild + if (sd->status.guild_id == 0) { + // Player does not have a guild clif->message(fd, msg_fd(fd, MSGTBL_NOT_IN_A_GUILD2)); // You are not in a guild. return false; } - return true; + struct guild *g = sd->guild; // Search the guild + if (g == NULL) { + // Guild was not found. HOW? + clif->message(fd, msg_fd(fd, MSGTBL_NOT_IN_A_GUILD2)); // You are not in a guild. + return false; + } + if (sd->state.gmaster_flag == 0) { + // Not guild master + clif->message(fd, msg_fd(fd, MSGTBL_CHANGEGM_GM_REQUIRED)); // You need to be a Guild Master to use this command. + return false; + } + int ret = guild->dobreak(sd, g->name); // Break guild + if (ret == 0) { + return false; // Something went wrong + } + return true; // Guild was broken } /*========================================== @@ -4150,7 +4147,7 @@ ACMD(mapinfo) if (map->list[m_id].flag.town != 0) clif->message(fd, msg_fd(fd, MSGTBL_MAPINFO_TOWN_MAP)); // Town Map - if (battle_config.autotrade_mapflag == map->list[m_id].flag.autotrade) + if ((unsigned int)battle_config.autotrade_mapflag == map->list[m_id].flag.autotrade) clif->message(fd, msg_fd(fd, MSGTBL_MAPINFO_AUTOTRADE_ENABLED)); // Autotrade Enabled else clif->message(fd, msg_fd(fd, MSGTBL_MAPINFO_AUTOTRADE_DISABLED)); // Autotrade Disabled @@ -5685,7 +5682,7 @@ ACMD(storeall) return false; } - struct storage_settings *stst = storage->get_settings(storage_id); + const struct storage_settings *stst = storage->get_settings(storage_id); if (stst == NULL) { clif->message(fd, msg_fd(fd, MSGTBL_STORAGE_INVALID)); return false; @@ -5749,7 +5746,7 @@ ACMD(clearstorage) return false; } - struct storage_settings *stst = storage->get_settings(storage_id); + const struct storage_settings *stst = storage->get_settings(storage_id); if (stst == NULL) { clif->message(fd, msg_fd(fd, MSGTBL_STORAGE_INVALID)); return false; @@ -6136,7 +6133,7 @@ ACMD(changelook) *------------------------------------------*/ ACMD(autotrade) { - if( map->list[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag ) { + if (map->list[sd->bl.m].flag.autotrade != (unsigned int)battle_config.autotrade_mapflag) { clif->message(fd, msg_fd(fd, MSGTBL_AUTOTRADE_NOT_ALLOWED)); // Autotrade is not allowed in this map. return false; } @@ -6234,7 +6231,7 @@ ACMD(changeleader) ACMD(partyoption) { struct party_data *p; - int mi, option; + int mi; char w1[16], w2[16]; if (sd->status.party_id == 0 || (p = party->search(sd->status.party_id)) == NULL) @@ -6259,7 +6256,7 @@ ACMD(partyoption) return false; } - option = (config_switch(w1)?1:0)|(config_switch(w2)?2:0); // TODO: Add documentation for these values + unsigned int option = (config_switch(w1) ? 1 : 0) | (config_switch(w2) ? 2 : 0); // TODO: Add documentation for these values //Change item share type. if (option != p->party.item) @@ -6408,7 +6405,7 @@ ACMD(autoloottype) { uint8 action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset enum item_types type = -1; - int ITEM_NONE = 0; + unsigned int ITEM_NONE = 0; if (*message) { if (message[0] == '+') { @@ -7314,9 +7311,9 @@ ACMD(mobinfo) // stats if (monster->mexp) - snprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, MSGTBL_MOBINFO_MVP), monster->name, monster->jname, monster->sprite, monster->vd.class); // MVP Monster: '%s'/'%s'/'%s' (%d) + snprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, MSGTBL_MOBINFO_MVP), monster->name, monster->jname, monster->sprite, monster->vd.class_); // MVP Monster: '%s'/'%s'/'%s' (%d) else - snprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, MSGTBL_MOBINFO_NORMAL), monster->name, monster->jname, monster->sprite, monster->vd.class); // Monster: '%s'/'%s'/'%s' (%d) + snprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, MSGTBL_MOBINFO_NORMAL), monster->name, monster->jname, monster->sprite, monster->vd.class_); // Monster: '%s'/'%s'/'%s' (%d) clif->message(fd, atcmd_output); snprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, MSGTBL_MOBINFO_STATS), monster->lv, monster->status.max_hp, base_exp, job_exp, MOB_HIT(monster), MOB_FLEE(monster)); // Lv:%d HP:%d Base EXP:%u Job EXP:%u HIT:%d FLEE:%d @@ -8093,7 +8090,7 @@ ACMD(sizeall) iter = mapit_getallusers(); for (pl_sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); pl_sd = BL_UCAST(BL_PC, mapit->next(iter))) { - if (pl_sd->state.size != size) { + if (pl_sd->state.size != (unsigned int)size) { if (pl_sd->state.size) { pl_sd->state.size = SZ_SMALL; pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT); @@ -8134,7 +8131,7 @@ ACMD(sizeguild) size = cap_value(size,SZ_SMALL,SZ_BIG); for (i = 0; i < g->max_member; i++) { - if ((pl_sd = g->member[i].sd) && pl_sd->state.size != size) { + if ((pl_sd = g->member[i].sd) && pl_sd->state.size != (unsigned int)size) { if( pl_sd->state.size ) { pl_sd->state.size = SZ_SMALL; pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT); @@ -8558,7 +8555,7 @@ ACMD(duel) struct map_session_data *target_sd = map->nick2sd(message, true); if (target_sd != NULL) { unsigned int newduel; - if ((newduel = duel->create(sd, 2)) != -1) { + if ((newduel = duel->create(sd, 2)) != 0) { if (target_sd->duel_group > 0 || target_sd->duel_invite > 0) { clif->message(fd, msg_fd(fd, MSGTBL_DUEL_PLAYER_IN_DUEL)); // "Duel: Player already in duel." return false; @@ -8900,7 +8897,7 @@ ACMD(itemlist) return false; } - struct storage_settings *stst = storage->get_settings(storage_id); + const struct storage_settings *stst = storage->get_settings(storage_id); if (stst == NULL) { clif->message(fd, msg_fd(fd, MSGTBL_STORAGE_INVALID)); return false; @@ -9095,7 +9092,7 @@ ACMD(stats) output_table[14].value = sd->change_level_2nd; output_table[15].value = sd->change_level_3rd; - sprintf(job_jobname, "Job - %s %s", pc->job_name(sd->status.class), "(level %d)"); + sprintf(job_jobname, "Job - %s %s", pc->job_name(sd->status.class_), "(level %d)"); sprintf(output, msg_fd(fd, MSGTBL_TARGET_STATS), sd->status.name); // '%s' stats: clif->message(fd, output); @@ -10399,7 +10396,7 @@ ACMD(cddebug) if( cd ) {//reset for(i = 0; i < cd->cursor; i++) { if( !cd->entry[i] ) continue; - timer->delete(cd->entry[i]->timer,skill->blockpc_end); + timer->delete_(cd->entry[i]->timer,skill->blockpc_end); ers_free(skill->cd_entry_ers, cd->entry[i]); } @@ -11435,10 +11432,10 @@ static void atcommand_db_load_groups(GroupSettings **groups, struct config_setti nullpo_retv(groups); nullpo_retv(commands_); for (atcmd = dbi_first(iter); dbi_exists(iter); atcmd = dbi_next(iter)) { - int i; CREATE(atcmd->at_groups, char, sz); CREATE(atcmd->char_groups, char, sz); - for (i = 0; i < sz; i++) { + + for (size_t i = 0; i < sz; i++) { GroupSettings *group = groups[i]; struct config_setting_t *commands = commands_[i]; int result = 0; @@ -11450,7 +11447,7 @@ static void atcommand_db_load_groups(GroupSettings **groups, struct config_setti } idx = pcg->get_idx(group); - if (idx < 0 || idx >= sz) { + if (idx < 0 || (size_t)idx >= sz) { ShowError("atcommand_db_load_groups: index (%d) out of bounds [0,%"PRIuS"]\n", idx, sz - 1); continue; } diff --git a/src/map/battle.c b/src/map/battle.c index 7f9566cfff3..3def366fd49 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6530,7 +6530,7 @@ static void battle_reflect_damage(struct block_list *target, struct block_list * trdamage -= rdamage;/* wont count towards total */ - enum autocast_type ac_type; + enum autocast_type ac_type = AUTOCAST_NONE; if (sd != NULL) { ac_type = sd->auto_cast_current.type; @@ -6821,7 +6821,7 @@ static enum damage_lv battle_weapon_attack(struct block_list *src, struct block_ { GUARD_MAP_LOCK - struct map_session_data *sd = NULL, *tsd = NULL; + struct map_session_data *sd = NULL; struct status_data *sstatus, *tstatus; struct status_change *sc, *tsc; int64 damage; @@ -6835,7 +6835,6 @@ static enum damage_lv battle_weapon_attack(struct block_list *src, struct block_ return ATK_NONE; sd = BL_CAST(BL_PC, src); - tsd = BL_CAST(BL_PC, target); sstatus = status->get_status_data(src); tstatus = status->get_status_data(target); diff --git a/src/map/battleground.c b/src/map/battleground.c index 8309af214df..7c055105f88 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -576,7 +576,7 @@ static void bg_queue_ready_ack(struct bg_arena *arena, struct map_session_data * } /* check if all are ready then cancel timer, and start game */ if (count == VECTOR_LENGTH(queue->entries)) { - timer->delete(arena->begin_timer,bg->begin_timer); + timer->delete_(arena->begin_timer,bg->begin_timer); arena->begin_timer = INVALID_TIMER; bg->begin(arena); } @@ -755,7 +755,7 @@ static void bg_queue_check(struct bg_arena *arena) count = VECTOR_LENGTH(queue->entries); if( count == arena->max_players ) { if( arena->fillup_timer != INVALID_TIMER ) { - timer->delete(arena->fillup_timer,bg->fillup_timer); + timer->delete_(arena->fillup_timer,bg->fillup_timer); arena->fillup_timer = INVALID_TIMER; } bg->queue_pregame(arena); @@ -853,11 +853,9 @@ static void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, en static enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type) { - int tick; - unsigned int tsec; - nullpo_retr(BGQA_FAIL_TYPE_INVALID, sd); nullpo_retr(BGQA_FAIL_TYPE_INVALID, arena); + if( !(arena->allowed_types & type) ) return BGQA_FAIL_TYPE_INVALID; @@ -867,7 +865,8 @@ static enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, str if ((sd->job & JOBL_2) == 0) /* TODO: maybe make this a per-arena setting, so users may make custom arenas like baby-only,whatever. */ return BGQA_FAIL_CLASS_INVALID; - tsec = (unsigned int)time(NULL); + int tick; + time_t tsec = time(NULL); if ( ( tick = pc_readglobalreg(sd, script->add_variable(bg->gdelay_var)) ) && tsec < tick ) { char response[100]; diff --git a/src/map/channel.h b/src/map/channel.h index 9dbb89219ca..75fd80b4a44 100644 --- a/src/map/channel.h +++ b/src/map/channel.h @@ -90,7 +90,7 @@ struct channel_data { struct DBMap *banned; char handlers[MAX_EVENTQUEUE][EVENT_NAME_LENGTH]; unsigned int options; - unsigned int owner; + int owner; enum channel_types type; uint16 m; unsigned char msg_delay; diff --git a/src/map/chat.h b/src/map/chat.h index 38bb6897c79..77e28f39398 100644 --- a/src/map/chat.h +++ b/src/map/chat.h @@ -40,7 +40,7 @@ struct chat_data { uint8 users; ///< current user count uint8 limit; ///< join limit uint8 trigger; ///< number of users needed to trigger event - uint32 zeny; ///< required zeny to join + int zeny; ///< required zeny to join int min_level; ///< minimum base level to join int max_level; ///< maximum base level allowed to join struct map_session_data* usersd[MAX_CHAT_USERS]; diff --git a/src/map/chrif.c b/src/map/chrif.c index fe65981a47a..69a3c63681e 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -498,7 +498,7 @@ static void chrif_authreq(struct map_session_data *sd, bool hstandalone) static void chrif_authok(int fd) { int account_id, group_id, char_id; - uint32 login_id1,login_id2; + int32 login_id1,login_id2; time_t expiration_time; const struct mmo_charstatus *charstatus; struct auth_node *node; @@ -512,8 +512,8 @@ static void chrif_authok(int fd) } account_id = RFIFOL(fd,4); - login_id1 = RFIFOL(fd,8); - login_id2 = RFIFOL(fd,12); + login_id1 = RFIFOSL(fd,8); + login_id2 = RFIFOSL(fd,12); expiration_time = (time_t)(int32)RFIFOL(fd,16); group_id = RFIFOL(fd,20); changing_mapservers = (RFIFOB(fd,24)); @@ -562,13 +562,13 @@ static void chrif_authfail(int fd) { /* HELLO WORLD. ip in RFIFOL 15 is not being used (but is available) */ int account_id, char_id; - uint32 login_id1; + int32 login_id1; char sex; struct auth_node* node; account_id = RFIFOL(fd,2); char_id = RFIFOL(fd,6); - login_id1 = RFIFOL(fd,10); + login_id1 = RFIFOSL(fd,10); sex = RFIFOB(fd,14); node = chrif->search(account_id); diff --git a/src/map/clan.c b/src/map/clan.c index 1bacdfa2039..39a6eaef3a5 100644 --- a/src/map/clan.c +++ b/src/map/clan.c @@ -940,7 +940,7 @@ static bool clan_config_read(bool reload) script->free_code(c_clear->buff.script); } if (c_clear->tid != INVALID_TIMER) { - timer->delete(c_clear->tid, clan->inactivity_kick); + timer->delete_(c_clear->tid, clan->inactivity_kick); } VECTOR_CLEAR(c_clear->allies); VECTOR_CLEAR(c_clear->antagonists); @@ -1025,7 +1025,7 @@ static void do_final_clan(void) script->free_code(c->buff.script); } if (c->tid != INVALID_TIMER) { - timer->delete(c->tid, clan->inactivity_kick); + timer->delete_(c->tid, clan->inactivity_kick); } VECTOR_CLEAR(c->allies); VECTOR_CLEAR(c->antagonists); diff --git a/src/map/clif.c b/src/map/clif.c index 20eb66cfe8e..beaa8a89209 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -296,7 +296,7 @@ static unsigned char clif_bl_type(struct block_list *bl) vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); - if (clif->isdisguised(bl) && !pc->db_checkid(vd->class)) + if (clif->isdisguised(bl) && !pc->db_checkid(vd->class_)) return CLUT_NPC; return CLUT_PC; case BL_ITEM: @@ -308,19 +308,19 @@ static unsigned char clif_bl_type(struct block_list *bl) case BL_MOB: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); - return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_MOB; + return pc->db_checkid(vd->class_) ? CLUT_PC : CLUT_MOB; case BL_NPC: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); #if PACKETVER >= 20170726 return CLUT_EVENT; #else - return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_EVENT; + return pc->db_checkid(vd->class_) ? CLUT_PC : CLUT_EVENT; #endif case BL_PET: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); - return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_PET; + return pc->db_checkid(vd->class_) ? CLUT_PC : CLUT_PET; case BL_HOM: return CLUT_HOMNUCLUS; case BL_MER: @@ -329,7 +329,6 @@ static unsigned char clif_bl_type(struct block_list *bl) return CLUT_ELEMENTAL; case BL_NUL: case BL_ALL: - default: return CLUT_NPC; } #endif @@ -1067,14 +1066,14 @@ static void clif_set_unit_idle2(struct block_list *bl, struct map_session_data * p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class; + p.job = vd->class_; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; p.shield = vd->shield; p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + if (bl->type == BL_NPC && vd->class_ == FLAG_CLASS) { // The hell, why flags work like this? p.shield = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); @@ -1115,7 +1114,7 @@ static void clif_set_unit_idle(struct block_list *bl, struct map_session_data *t nullpo_retv(vd); #if PACKETVER < 20091103 - if (!pc->db_checkid(vd->class)) { + if (!pc->db_checkid(vd->class_)) { clif->set_unit_idle2(bl,tsd,target); return; } @@ -1138,7 +1137,7 @@ static void clif_set_unit_idle(struct block_list *bl, struct map_session_data *t p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class; + p.job = vd->class_; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; @@ -1147,7 +1146,7 @@ static void clif_set_unit_idle(struct block_list *bl, struct map_session_data *t #endif p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + if (bl->type == BL_NPC && vd->class_ == FLAG_CLASS) { // The hell, why flags work like this? p.accessory = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); @@ -1198,7 +1197,7 @@ static void clif_set_unit_idle(struct block_list *bl, struct map_session_data *t if (clif->isdisguised(bl)) { #if PACKETVER >= 20091103 - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE #if PACKETVER >= 20131223 p.AID = -bl->id; #else @@ -1238,11 +1237,11 @@ static void clif_spawn_unit2(struct block_list *bl, enum send_target target) p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; - p.job = vd->class; + p.job = vd->class_; p.shield = vd->shield; p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + if (bl->type == BL_NPC && vd->class_ == FLAG_CLASS) { // The hell, why flags work like this? p.shield = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); @@ -1274,7 +1273,7 @@ static void clif_spawn_unit(struct block_list *bl, enum send_target target) nullpo_retv(vd); #if PACKETVER < 20091103 - if (!pc->db_checkid(vd->class)) { + if (!pc->db_checkid(vd->class_)) { clif->spawn_unit2(bl,target); return; } @@ -1297,7 +1296,7 @@ static void clif_spawn_unit(struct block_list *bl, enum send_target target) p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class; + p.job = vd->class_; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; @@ -1306,7 +1305,7 @@ static void clif_spawn_unit(struct block_list *bl, enum send_target target) #endif p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + if (bl->type == BL_NPC && vd->class_ == FLAG_CLASS) { // The hell, why flags work like this? p.accessory = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); @@ -1354,10 +1353,10 @@ static void clif_spawn_unit(struct block_list *bl, enum send_target target) #endif if (clif->isdisguised(bl)) { nullpo_retv(sd); - if (sd->status.class != sd->disguise) + if (sd->status.class_ != sd->disguise) clif->send(&p,sizeof(p),bl,target); #if PACKETVER >= 20091103 - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE #if PACKETVER >= 20131223 p.AID = -bl->id; #else @@ -1406,7 +1405,7 @@ static void clif_set_unit_walking(struct block_list *bl, struct map_session_data p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class; + p.job = vd->class_; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; @@ -1461,7 +1460,7 @@ static void clif_set_unit_walking(struct block_list *bl, struct map_session_data if (clif->isdisguised(bl)) { #if PACKETVER >= 20091103 - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE #if PACKETVER >= 20131223 p.AID = -bl->id; #else @@ -1587,7 +1586,7 @@ static bool clif_spawn(struct block_list *bl) if( !vd ) return false; - if (vd->class == INVISIBLE_CLASS) + if (vd->class_ == INVISIBLE_CLASS) return true; // Doesn't need to be spawned, so everything is alright if (bl->type == BL_NPC) { @@ -1983,7 +1982,7 @@ static void clif_move(struct unit_data *ud) bl = ud->bl; nullpo_retv(bl); vd = status->get_viewdata(bl); - if (vd == NULL || vd->class == INVISIBLE_CLASS) + if (vd == NULL || vd->class_ == INVISIBLE_CLASS) return; //This performance check is needed to keep GM-hidden objects from being notified to bots. if (bl->type == BL_NPC) { @@ -3536,10 +3535,10 @@ static void clif_guild_xy_remove(struct map_session_data *sd) nullpo_retv(sd); - WBUFW(buf,0)=0x1eb; - WBUFL(buf,2)=sd->status.account_id; - WBUFW(buf,6)=-1; - WBUFW(buf,8)=-1; + WBUFW(buf,0) = 0x1eb; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = UINT16_MAX; + WBUFW(buf,8) = UINT16_MAX; clif->send(buf,packet_len(0x1eb),&sd->bl,GUILD_SAMEMAP_WOS); } @@ -4998,7 +4997,7 @@ static void clif_getareachar_unit(struct map_session_data *sd, struct block_list nullpo_retv(bl); vd = status->get_viewdata(bl); - if (vd == NULL || vd->class == INVISIBLE_CLASS) + if (vd == NULL || vd->class_ == INVISIBLE_CLASS) return; if (bl->type == BL_NPC) { @@ -5497,7 +5496,7 @@ static int clif_outsight(struct block_list *bl, va_list ap) switch(bl->type){ case BL_PC: nullpo_ret(sd); - if (sd->vd.class != INVISIBLE_CLASS) + if (sd->vd.class_ != INVISIBLE_CLASS) clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); if (sd->chat_id != 0) { struct chat_data *cd = map->id2cd(sd->chat_id); @@ -5528,7 +5527,7 @@ static int clif_outsight(struct block_list *bl, va_list ap) case BL_HOM: case BL_ALL: default: - if ((vd=status->get_viewdata(bl)) && vd->class != INVISIBLE_CLASS) + if ((vd=status->get_viewdata(bl)) && vd->class_ != INVISIBLE_CLASS) clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); break; } @@ -5537,7 +5536,7 @@ static int clif_outsight(struct block_list *bl, va_list ap) nullpo_ret(tbl); if (tbl->type == BL_SKILL) //Trap knocked out of sight clif->clearchar_skillunit(BL_UCAST(BL_SKILL, tbl), sd->fd); - else if ((vd = status->get_viewdata(tbl)) != NULL && vd->class != INVISIBLE_CLASS + else if ((vd = status->get_viewdata(tbl)) != NULL && vd->class_ != INVISIBLE_CLASS && !(tbl->type == BL_NPC && (BL_UCAST(BL_NPC, tbl)->option&OPTION_INVISIBLE))) clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); } @@ -5614,7 +5613,7 @@ static void clif_playerSkillToPacket(struct map_session_data *sd, struct SKILLDA safestrncpy(skillData->name, skill->get_name(skillId), NAME_LENGTH); #endif if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) - skillData->upFlag = (skill_lv < skill->tree_get_max(skillId, sd->status.class)) ? 1 : 0; + skillData->upFlag = (skill_lv < skill->tree_get_max(skillId, sd->status.class_)) ? 1 : 0; else skillData->upFlag = 0; } @@ -5740,7 +5739,7 @@ static void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill WFIFOW(fd, 6) = skill->get_sp(skill_id, skill_lv); WFIFOW(fd, 8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); if( flag ) - WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class)) ? 1 : 0; + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; else WFIFOB(fd,10) = 1; @@ -5775,7 +5774,7 @@ static void clif_skillinfo(struct map_session_data *sd, int skill_id, int inf) p->level2 = skill_lv; #endif if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) - p->upFlag = (skill_lv < skill->tree_get_max(skill_id, sd->status.class)) ? 1 : 0; + p->upFlag = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; else p->upFlag = 0; WFIFOSET(fd, sizeof(struct PACKET_ZC_SKILLINFO_UPDATE2)); @@ -5921,7 +5920,7 @@ static void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, un /// Skill attack effect and damage. /// 0114 .W .L .L .L .L .L .W .W
.W .B (ZC_NOTIFY_SKILL) /// 01de .W .L .L .L .L .L .L .W
.W .B (ZC_NOTIFY_SKILL2) -static int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, enum battle_dmg_type type) +static int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, int skill_lv, enum battle_dmg_type type) { nullpo_ret(src); nullpo_ret(dst); @@ -5957,7 +5956,7 @@ static int clif_skill_damage(struct block_list *src, struct block_list *dst, int } else { p.damage = damage; } - p.level = skill_lv; + p.level = (int16)skill_lv; p.count = div; p.action = type; @@ -7385,7 +7384,7 @@ static void clif_party_member_info(struct party_data *p, struct map_session_data #endif packet.leader = (p->party.member[i].leader) ? 0 : 1; #if PACKETVER_MAIN_NUM >= 20170524 || PACKETVER_RE_NUM >= 20170502 || defined(PACKETVER_ZERO) - packet.class = sd->status.class; + packet.class_ = sd->status.class_; packet.baseLevel = sd->status.base_level; #endif packet.x = sd->bl.x; @@ -7436,7 +7435,7 @@ static void clif_party_info(struct party_data *p, struct map_session_data *sd) packet->members[c].leader = (m->leader) ? 0 : 1; packet->members[c].offline = (m->online) ? 0 : 1; #if PACKETVER_MAIN_NUM >= 20170524 || PACKETVER_RE_NUM >= 20170502 || defined(PACKETVER_ZERO) - packet->members[c].class = m->class; + packet->members[c].class_ = m->class_; packet->members[c].baseLevel = m->lv; #endif c++; @@ -7460,7 +7459,7 @@ static void clif_party_job_and_level(struct map_session_data *sd) struct PACKET_ZC_NOTIFY_MEMBERINFO_TO_GROUPM p = {0}; p.PacketType = HEADER_ZC_NOTIFY_MEMBERINFO_TO_GROUPM; p.AID = sd->status.account_id; - p.job = sd->status.class; + p.job = sd->status.class_; p.level = sd->status.base_level; clif->send(&p, sizeof(struct PACKET_ZC_NOTIFY_MEMBERINFO_TO_GROUPM), &sd->bl, PARTY); @@ -8547,7 +8546,7 @@ static void clif_guild_memberlist(struct map_session_data *sd) p->guildMemberInfo[c].head = m->hair; p->guildMemberInfo[c].headPalette = m->hair_color; p->guildMemberInfo[c].sex = m->gender; - p->guildMemberInfo[c].job = m->class; + p->guildMemberInfo[c].job = m->class_; p->guildMemberInfo[c].level = m->lv; p->guildMemberInfo[c].contributionExp = (int)cap_value(m->exp, 0, INT32_MAX); p->guildMemberInfo[c].currentState = m->online; @@ -8980,7 +8979,7 @@ static void clif_guild_message(struct guild *g, int account_id, const char *mes, if (len == 0) return; - if (len > sizeof(buf)-5) { + if ((size_t)len > sizeof(buf)-5) { ShowWarning("clif_guild_message: Truncated message '%s' (len=%d, max=%"PRIuS", guild_id=%d).\n", mes, len, sizeof(buf)-5, g->guild_id); len = sizeof(buf)-5; } @@ -10408,10 +10407,10 @@ static void clif_party_xy_remove(struct map_session_data *sd) { unsigned char buf[16]; nullpo_retv(sd); - WBUFW(buf,0)=0x107; - WBUFL(buf,2)=sd->status.account_id; - WBUFW(buf,6)=-1; - WBUFW(buf,8)=-1; + WBUFW(buf,0) = 0x107; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = 0xFFFF; + WBUFW(buf,8) = 0xFFFF; clif->send(buf,packet_len(0x107),&sd->bl,PARTY_SAMEMAP_WOS); } @@ -10604,7 +10603,7 @@ static void clif_viewequip_ack(struct map_session_data *sd, struct map_session_d safestrncpy(packet->characterName, tsd->status.name, NAME_LENGTH); - packet->job = tsd->status.class; + packet->job = tsd->status.class_; packet->head = tsd->vd.hair_style; packet->accessory = tsd->vd.head_bottom; packet->accessory2 = tsd->vd.head_mid; @@ -10775,7 +10774,7 @@ static void clif_msgtable_color(struct map_session_data *sd, enum clif_messages clif->send(&p, sizeof(p), &sd->bl, SELF); } -static bool clif_validate_message(struct map_session_data *sd, char *message) +static bool clif_validate_message(struct map_session_data *sd, const char *message) { nullpo_retr(false, message); @@ -11970,7 +11969,7 @@ static int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) struct map_session_data * sd; if( (sd = map->id2sd(id)) ) { sd->fontcolor_tid = INVALID_TIMER; - if (sd->fontcolor && sd->disguise == sd->status.class) + if (sd->fontcolor && sd->disguise == sd->status.class_) pc->disguise(sd,-1); } return 0; @@ -12021,12 +12020,12 @@ static void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) if (sd->disguise == -1) { sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); - pc->disguise(sd,sd->status.class); + pc->disguise(sd,sd->status.class_); if (pc_isdead(sd)) clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); if (unit->is_walking(&sd->bl)) clif->move(&sd->ud); - } else if (sd->disguise == sd->status.class && sd->fontcolor_tid != INVALID_TIMER) { + } else if (sd->disguise == sd->status.class_ && sd->fontcolor_tid != INVALID_TIMER) { const struct TimerData *td; if ((td = timer->get(sd->fontcolor_tid)) != NULL) timer->settick(sd->fontcolor_tid, td->tick+5000); @@ -13253,7 +13252,7 @@ static void clif_parse_PutItemToCart(int fd, struct map_session_data *sd) if (!pc_iscarton(sd)) return; - struct PACKET_CZ_MOVE_ITEM_FROM_BODY_TO_CART *p = RFIFOP(fd, 0); + const struct PACKET_CZ_MOVE_ITEM_FROM_BODY_TO_CART *p = RFIFOP(fd, 0); const int index = p->index - 2; const int flag = pc->putitemtocart(sd, index, p->count); @@ -13377,7 +13376,7 @@ static void clif_parse_SelectCart(int fd, struct map_session_data *sd) #if PACKETVER >= 20150805 // RagexeRE int type; - if (!sd || !pc->checkskill(sd, MC_CARTDECORATE) || RFIFOL(fd, 2) != sd->status.account_id) + if (!sd || !pc->checkskill(sd, MC_CARTDECORATE) || RFIFOSL(fd, 2) != sd->status.account_id) return; type = RFIFOB(fd, 6); @@ -14144,7 +14143,7 @@ static void clif_parse_NpcStringInput(int fd, struct map_session_data *sd) if (len < 9) return; - npcid = (sd->state.using_megaphone == 0) ? RFIFOL(fd, 4) : sd->npc_id; + npcid = (sd->state.using_megaphone == 0) ? RFIFOSL(fd, 4) : sd->npc_id; message = RFIFOP(fd, 8); safestrncpy(sd->npc_str, message, min(message_len,CHATBOX_SIZE)); @@ -15237,7 +15236,7 @@ static void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *s nullpo_retv(sd); WBUFW(buf, 0) = 0x8f2; WBUFL(buf, 2) = sd->status.account_id; - WBUFL(buf, 6) = sd->status.class; + WBUFL(buf, 6) = sd->status.class_; WBUFW(buf, 10) = sd->status.base_level; memcpy(WBUFP(buf, 12), sd->status.name, NAME_LENGTH); @@ -15684,24 +15683,26 @@ static bool clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) #endif // not NetBSD < 6 / Solaris uint8 buf[1800]; // no well-formed emblem bitmap is larger than 1782 (24 bit) / 1654 (8 bit) bytes unsigned long buf_len = sizeof(buf); - int header = 0, bitmap = 0, offbits = 0, palettesize = 0; nullpo_retr(false, emblem); if (grfio->decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE - || buf_len > extraconf->emblems->max_bmp_guild_emblem_size + || (int)buf_len > extraconf->emblems->max_bmp_guild_emblem_size || RBUFW(buf,0) != 0x4d42 // BITMAPFILEHEADER.bfType (signature) || RBUFL(buf,2) != buf_len // BITMAPFILEHEADER.bfSize (file size) || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE // BITMAPINFOHEADER.biSize (other headers are not supported) - || RBUFL(buf,18) != extraconf->emblems->guild_emblem_width // BITMAPINFOHEADER.biWidth - || RBUFL(buf,22) != extraconf->emblems->guild_emblem_height // BITMAPINFOHEADER.biHeight (top-down bitmaps (-24) are not supported) + || RBUFSL(buf,18) != extraconf->emblems->guild_emblem_width // BITMAPINFOHEADER.biWidth + || RBUFSL(buf,22) != extraconf->emblems->guild_emblem_height // BITMAPINFOHEADER.biHeight (top-down bitmaps (-24) are not supported) || RBUFL(buf,30) != 0 // BITMAPINFOHEADER.biCompression == BI_RGB (compression not supported) ) { // Invalid data return false; } - offbits = RBUFL(buf,10); // BITMAPFILEHEADER.bfOffBits (offset to bitmap bits) + uint32 offbits = RBUFL(buf,10); // BITMAPFILEHEADER.bfOffBits (offset to bitmap bits) + size_t bitmap = 0; + uint32 header = 0; + uint32 palettesize = 0; switch( RBUFW(buf,28) ) { // BITMAPINFOHEADER.biBitCount case 8: @@ -16197,7 +16198,7 @@ static void clif_parse_pet_evolution(int fd, struct map_session_data *sd) int inv_index; ARR_FIND(0, sd->status.inventorySize, inv_index, sd->status.inventory[inv_index].card[0] == CARD0_PET - && sd->status.pet_id == MakeDWord(sd->status.inventory[inv_index].card[1], + && sd->status.pet_id == (int)MakeDWord(sd->status.inventory[inv_index].card[1], sd->status.inventory[inv_index].card[2])); if (inv_index == sd->status.inventorySize) { // No pet egg. @@ -16227,7 +16228,7 @@ static void clif_parse_pet_evolution(int fd, struct map_session_data *sd) for (int i = 0; i < VECTOR_LENGTH(pet->db[pet_index].evolve_data); i++) { struct pet_evolve_data *ped = &VECTOR_INDEX(pet->db[pet_index].evolve_data, i); - if (ped->petEggId == p->EvolvedPetEggID) { + if (ped->petEggId == (int32)p->EvolvedPetEggID) { if (VECTOR_LENGTH(ped->items) == 0) { clif->petEvolutionResult(fd, PET_EVOL_NO_RECIPE); return; @@ -17582,9 +17583,9 @@ static void clif_parse_HomAttack(int fd, struct map_session_data *sd) struct block_list *bl = NULL; const struct PACKET_CZ_REQUEST_ACTNPC *p = RP2PTR(fd); - if (homun_alive(sd->hd) && sd->hd->bl.id == p->GID) + if (homun_alive(sd->hd) && sd->hd->bl.id == (int32)p->GID) bl = &sd->hd->bl; - else if (sd->md && sd->md->bl.id == p->GID) + else if (sd->md && sd->md->bl.id == (int32)p->GID) bl = &sd->md->bl; else return; @@ -18726,7 +18727,7 @@ static void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) struct itemlist item_list = { 0 }; int i; - if (len < sizeof(struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM)) { + if ((size_t)len < sizeof(struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM)) { ShowWarning("Player %d sent incorrect cash shop buy packet (len %d)!\n", sd->status.char_id, len); return; } @@ -19610,7 +19611,7 @@ static void clif_bg_xy(struct map_session_data *sd) WBUFW(buf,0)=0x2df; WBUFL(buf,2)=sd->status.account_id; memcpy(WBUFP(buf,6), sd->status.name, NAME_LENGTH); - WBUFW(buf,30)=sd->status.class; + WBUFW(buf,30)=sd->status.class_; WBUFW(buf,32)=sd->bl.x; WBUFW(buf,34)=sd->bl.y; @@ -19625,9 +19626,9 @@ static void clif_bg_xy_remove(struct map_session_data *sd) WBUFW(buf,0)=0x2df; WBUFL(buf,2)=sd->status.account_id; memset(WBUFP(buf,6), 0, NAME_LENGTH); - WBUFW(buf,30)=0; - WBUFW(buf,32)=-1; - WBUFW(buf,34)=-1; + WBUFW(buf,30) = 0; + WBUFW(buf,32) = UINT16_MAX; + WBUFW(buf,34) = UINT16_MAX; clif->send(buf, packet_len(0x2df), &sd->bl, BG_SAMEMAP_WOS); } @@ -20119,7 +20120,7 @@ static void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data *sd) packet_len = p->packetLength; // TODO: Make this check global for all variable length packets. - if (packet_len < sizeof(struct PACKET_CZ_REQ_OPEN_BUYING_STORE)) + if ((size_t)packet_len < sizeof(struct PACKET_CZ_REQ_OPEN_BUYING_STORE)) {// minimum packet length ShowError("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%d, account_id=%d).\n", (uint32)sizeof(struct PACKET_CZ_REQ_OPEN_BUYING_STORE), packet_len, sd->bl.id); return; @@ -20326,7 +20327,7 @@ static void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data *sd) const struct PACKET_CZ_REQ_TRADE_BUYING_STORE *p = RFIFOP(fd, 0); packet_len = p->packetLength; - if (packet_len < sizeof(struct PACKET_CZ_REQ_TRADE_BUYING_STORE)) + if ((size_t)packet_len < sizeof(struct PACKET_CZ_REQ_TRADE_BUYING_STORE)) {// minimum packet length ShowError("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%d, account_id=%d).\n", (uint32)sizeof(struct PACKET_CZ_REQ_TRADE_BUYING_STORE), packet_len, sd->bl.id); return; @@ -20462,12 +20463,12 @@ static void clif_parse_SearchStoreInfo(int fd, struct map_session_data *sd) int packet_len, count, item_count, card_count; int i; const struct PACKET_CZ_SEARCH_STORE_INFO *p = RFIFOP(fd, 0); - uint32 *items_list; - uint32 *cards_list; + int32 *items_list; + int32 *cards_list; packet_len = p->packetLength; - if (packet_len < sizeof(struct PACKET_CZ_SEARCH_STORE_INFO)) + if ((size_t)packet_len < sizeof(struct PACKET_CZ_SEARCH_STORE_INFO)) {// minimum packet length ShowError("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%d, account_id=%d).\n", (uint32)sizeof(struct PACKET_CZ_SEARCH_STORE_INFO), packet_len, sd->bl.id); return; @@ -20504,8 +20505,8 @@ static void clif_parse_SearchStoreInfo(int fd, struct map_session_data *sd) cardlist = RFIFOP(fd, sizeof(struct PACKET_CZ_SEARCH_STORE_INFO) + blocksize * item_count); - items_list = aMalloc(sizeof(uint32) * item_count); - cards_list = aMalloc(sizeof(uint32) * card_count); + items_list = aMalloc(sizeof(int32) * item_count); + cards_list = aMalloc(sizeof(int32) * card_count); for (i = 0; i < item_count; i ++) { items_list[i] = itemlist[i].itemId; } @@ -21317,7 +21318,7 @@ static void clif_parse_cashShopBuy(int fd, struct map_session_data *sd) return; unsigned short limit = RFIFOW(fd, 4); - unsigned int kafra_pay = RFIFOL(fd, 6); // [Ryuuzaki] - These are free cash points (strangely #CASH = main cash currently for us, confusing) + int kafra_pay = RFIFOSL(fd, 6); // [Ryuuzaki] - These are free cash points (strangely #CASH = main cash currently for us, confusing) int count = (len - 10) / 10; if (count != limit) { ShowError("Wrong cash shop limit: %d\n", limit); @@ -21340,7 +21341,7 @@ static void clif_parse_cashShopBuy(int fd, struct map_session_data *sd) } if(j < clif->cs.item_count[tab]) { struct item_data *data; - if(sd->kafraPoints < kafra_pay) { + if(kafra_pay < 0 || sd->kafraPoints < kafra_pay) { result = CSBR_SHORTTAGE_CASH; } else if((sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty)) { result = CSBR_SHORTTAGE_CASH; @@ -22266,7 +22267,11 @@ static void clif_parse_RouletteOpen(int fd, struct map_session_data *sd) p.Serial = 0; p.Step = sd->roulette.stage - 1; p.Idx = (char)sd->roulette.prizeIdx; - p.AdditionItemID = -1; /** TODO **/ +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 + p.AdditionItemID = UINT32_MAX; /** TODO **/ +#else + p.AdditionItemID = UINT16_MAX; /** TODO **/ +#endif p.BronzePoint = pc_readglobalreg(sd, script->add_variable("TmpRouletteBronze")); p.GoldPoint = pc_readglobalreg(sd, script->add_variable("TmpRouletteGold")); p.SilverPoint = pc_readglobalreg(sd, script->add_variable("TmpRouletteSilver")); @@ -22919,7 +22924,7 @@ static void clif_clan_message(struct clan *c, const char *mes, int len) #if PACKETVER >= 20120716 struct map_session_data *sd; struct PACKET_ZC_NOTIFY_CLAN_CHAT *p; - unsigned int max_len = CHAT_SIZE_MAX - 5 - NAME_LENGTH; + int max_len = CHAT_SIZE_MAX - 5 - NAME_LENGTH; int packet_length; nullpo_retv(c); @@ -22928,7 +22933,7 @@ static void clif_clan_message(struct clan *c, const char *mes, int len) if (len == 0) { return; } else if (len > max_len) { - ShowWarning("clif_clan_message: Truncated message '%s' (len=%d, max=%u, clan_id=%d).\n", mes, len, max_len, c->clan_id); + ShowWarning("clif_clan_message: Truncated message '%s' (len=%d, max=%d, clan_id=%d).\n", mes, len, max_len, c->clan_id); len = max_len; } @@ -23362,12 +23367,12 @@ static void clif_parse_rodex_checkname1(int fd, struct map_session_data *sd) #if PACKETVER >= 20140423 const struct PACKET_CZ_CHECKNAME1 *rPacket = RFIFOP(fd, 0); int char_id = 0, base_level = 0; - int class = 0; + int class_ = 0; char name[NAME_LENGTH]; safestrncpy(name, rPacket->Name, NAME_LENGTH); - rodex->check_player(sd, name, &base_level, &char_id, &class); + rodex->check_player(sd, name, &base_level, &char_id, &class_); #endif // PACKETVER >= 20140423 } @@ -23377,12 +23382,12 @@ static void clif_parse_rodex_checkname2(int fd, struct map_session_data *sd) #if PACKETVER_MAIN_NUM >= 20201104 || PACKETVER_RE_NUM >= 20211103 || PACKETVER_ZERO_NUM >= 20201118 const struct PACKET_CZ_CHECKNAME2 *rPacket = RFIFOP(fd, 0); int char_id = 0, base_level = 0; - int class = 0; + int class_ = 0; char name[NAME_LENGTH]; safestrncpy(name, rPacket->Name, NAME_LENGTH); - rodex->check_player(sd, name, &base_level, &char_id, &class); + rodex->check_player(sd, name, &base_level, &char_id, &class_); #endif // PACKETVER_MAIN_NUM >= 20201104 || PACKETVER_RE_NUM >= 20211103 || PACKETVER_ZERO_NUM >= 20201118 } @@ -23405,7 +23410,7 @@ static void clif_rodex_checkname_result(struct map_session_data *sd, int char_id return; } sPacket->CharId = char_id; - sPacket->Class = class_; + sPacket->Class_ = class_; sPacket->BaseLevel = base_level; #if PACKETVER >= 20160316 safestrncpy(sPacket->Name, name, NAME_LENGTH); @@ -23423,7 +23428,7 @@ static void clif_parse_rodex_send_mail(int fd, struct map_session_data *sd) const struct PACKET_CZ_SEND_MAIL *rPacket = RFIFOP(fd, 0); int8 result; - if (rPacket->TextcontentsLength + rPacket->Titlelength > rPacket->PacketLength - sizeof(*rPacket)) { + if (rPacket->TextcontentsLength + rPacket->Titlelength > rPacket->PacketLength - (int)sizeof(*rPacket)) { result = RODEX_SEND_MAIL_FATAL_ERROR; } else if (rPacket->TextcontentsLength > RODEX_BODY_LENGTH || rPacket->Titlelength > RODEX_TITLE_LENGTH) { result = RODEX_SEND_MAIL_FATAL_ERROR; @@ -24205,11 +24210,10 @@ static void clif_open_ui_send(struct map_session_data *sd, enum zc_ui_types ui_t static void clif_open_ui(struct map_session_data *sd, enum cz_ui_types uiType) { nullpo_retv(sd); - +#if PACKETVER >= 20150128 enum zc_ui_types send_ui_type; switch (uiType) { -#if PACKETVER >= 20150128 case CZ_BANK_UI: send_ui_type = ZC_BANK_UI; break; @@ -24222,7 +24226,6 @@ static void clif_open_ui(struct map_session_data *sd, enum cz_ui_types uiType) case CZ_MACRO_DETECTOR_UI: send_ui_type = ZC_MACRO_UI; break; -#endif #if PACKETVER >= 20171122 case CZ_ATTENDANCE_UI: send_ui_type = ZC_ATTENDANCE_UI; @@ -24235,6 +24238,10 @@ static void clif_open_ui(struct map_session_data *sd, enum cz_ui_types uiType) } clif->open_ui_send(sd, send_ui_type); +#else + ShowWarning("clif_open_ui: Requested UI (%u) is not implemented yet.\n", uiType); + return; +#endif } static void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); @@ -24724,7 +24731,7 @@ static void clif_npc_expanded_barter_open(struct map_session_data *sd, struct np buf_left -= ptr_size; items_count ++; int count = shop[i].value2; - if (buf_left < sizeof(struct PACKET_ZC_NPC_EXPANDED_BARTER_MARKET_ITEMINFO_sub2) * count) { + if ((size_t)buf_left < sizeof(struct PACKET_ZC_NPC_EXPANDED_BARTER_MARKET_ITEMINFO_sub2) * count) { NEXT_EXPANDED_BARTER_ITEM(item, 0); break; } @@ -25079,7 +25086,7 @@ static void clif_parse_lapineDdukDdak_ack(int fd, struct map_session_data *sd) if (pc->search_inventory(sd, it->nameid) == INDEX_NOT_FOUND) return; - if (((p->packetLength - sizeof(struct PACKET_CZ_REQ_RANDOM_COMBINE_ITEM)) / sizeof(struct PACKET_CZ_REQ_RANDOM_COMBINE_ITEM_sub)) != it->lapineddukddak->NeedCount) + if (((p->packetLength - (int)sizeof(struct PACKET_CZ_REQ_RANDOM_COMBINE_ITEM)) / (int)sizeof(struct PACKET_CZ_REQ_RANDOM_COMBINE_ITEM_sub)) != it->lapineddukddak->NeedCount) return; for (int i = 0; i < it->lapineddukddak->NeedCount; ++i) { @@ -26026,7 +26033,7 @@ static void clif_adventurerAgencyJoinReq(struct map_session_data *sd, struct map packet->AID = sd->bl.id; safestrncpy(packet->groupName, p->party.name, NAME_LENGTH); packet->level = sd->status.base_level; - packet->job = sd->status.class; + packet->job = sd->status.class_; WFIFOSET(fd, sizeof(struct PACKET_ZC_ADVENTURER_AGENCY_JOIN_REQ)); #endif } @@ -26095,8 +26102,7 @@ static void clif_format_itemlink(StringBuf *buf, const struct item *it) // Client-versions that doesn't support , return the item name and ends. StrBuf->Printf(buf, "%s", itd->jname); return; -#endif // PACKETVER_MAIN_NUM < 20150923 && PACKETVER_RE_NUM < 20150819 && !defined(PACKETVER_ZERO) - +#else // Separators that didn't change along the time static const char ref_sep = '%'; #if PACKETVER >= 20161116 @@ -26174,6 +26180,7 @@ static void clif_format_itemlink(StringBuf *buf, const struct item *it) StrBuf->Printf(buf, "", tag_name); #undef get_padded_value +#endif // PACKETVER_MAIN_NUM < 20150923 && PACKETVER_RE_NUM < 20150819 && !defined(PACKETVER_ZERO) } /** diff --git a/src/map/clif.h b/src/map/clif.h index a8a73c49e81..cce9c0af297 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -745,7 +745,7 @@ struct s_packet_db { struct hCSData { int id; - unsigned int price; + int price; }; struct cdelayed_damage { @@ -933,7 +933,7 @@ struct clif_interface { /* Cash Shop [Ind/Hercules] */ struct { struct hCSData **data[CASHSHOP_TAB_MAX]; - unsigned int item_count[CASHSHOP_TAB_MAX]; + int item_count[CASHSHOP_TAB_MAX]; } cs; /* roulette data */ struct { @@ -1203,7 +1203,7 @@ struct clif_interface { void (*wedding_effect) (struct block_list *bl); void (*divorced) (struct map_session_data* sd, const char* name); void (*callpartner) (struct map_session_data *sd); - int (*skill_damage) (struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 damage, int div, uint16 skill_id, uint16 skill_lv, enum battle_dmg_type type); + int (*skill_damage) (struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 damage, int div, uint16 skill_id, int skill_lv, enum battle_dmg_type type); #if 0 int (*skill_damage2) (struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int damage, int div, uint16 skill_id, uint16 skill_lv, enum battle_dmg_type type); #endif @@ -1272,7 +1272,7 @@ struct clif_interface { void (*messages) (const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); const char *(*process_chat_message) (struct map_session_data *sd, const struct packet_chat_message *packet, char *out_buf, int out_buflen); bool (*process_whisper_message) (struct map_session_data *sd, const struct packet_whisper_message *packet, char *out_name, char *out_message, int out_messagelen); - bool (*validate_message) (struct map_session_data *sd, char *message); + bool (*validate_message) (struct map_session_data *sd, const char *message); void (*wisexin) (struct map_session_data *sd,int type,int flag); void (*wisall) (struct map_session_data *sd,int type,int flag); void (*PMIgnoreList) (struct map_session_data* sd); diff --git a/src/map/duel.c b/src/map/duel.c index ba2446e4baf..54200e95669 100644 --- a/src/map/duel.c +++ b/src/map/duel.c @@ -86,13 +86,13 @@ static void duel_showinfo(const unsigned int did, struct map_session_data *sd) map->foreachpc(duel_showinfo_sub, sd, &p); } -static int duel_create(struct map_session_data *sd, const unsigned int maxpl) +static unsigned int duel_create(struct map_session_data *sd, const unsigned int maxpl) { - int i=1; char output[256]; nullpo_ret(sd); + unsigned int i = 1; while(i < MAX_DUEL && duel->list[i].members_count > 0) i++; if(i == MAX_DUEL) return 0; diff --git a/src/map/duel.h b/src/map/duel.h index 5f5d60e626f..15c5a7f7554 100644 --- a/src/map/duel.h +++ b/src/map/duel.h @@ -46,7 +46,7 @@ struct duel_interface { /* funcs */ //Duel functions // [LuzZza] - int (*create) (struct map_session_data* sd, const unsigned int maxpl); + unsigned int (*create) (struct map_session_data* sd, const unsigned int maxpl); void (*invite) (const unsigned int did, struct map_session_data* sd, struct map_session_data* target_sd); void (*accept) (const unsigned int did, struct map_session_data* sd); void (*reject) (const unsigned int did, struct map_session_data* sd); diff --git a/src/map/elemental.c b/src/map/elemental.c index 30e3a96fa07..d743cdbba03 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -228,7 +228,7 @@ static void elemental_summon_stop(struct elemental_data *ed) { nullpo_retv(ed); if( ed->summon_timer != INVALID_TIMER ) - timer->delete(ed->summon_timer, elemental->summon_end_timer); + timer->delete_(ed->summon_timer, elemental->summon_end_timer); ed->summon_timer = INVALID_TIMER; } @@ -499,7 +499,7 @@ static int elemental_action(struct elemental_data *ed, struct block_list *bl, in struct map_session_data *sd = BL_CAST(BL_PC, battle->get_master(&ed->bl)); if( sd ){ if( sd->skill_id_old != SO_EL_ACTION && //regardless of remaining HP/SP it can be cast - (status_get_hp(&ed->bl) < req.hp || status_get_sp(&ed->bl) < req.sp) ) + (status_get_hp(&ed->bl) < (unsigned int)req.hp || status_get_sp(&ed->bl) < (unsigned int)req.sp) ) return 1; else status_zap(&ed->bl, req.hp, req.sp); @@ -738,9 +738,9 @@ static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_ // Check if caster can sustain the summoned elemental if( DIFF_TICK(tick,ed->last_spdrain_time) >= 10000 ){// Drain SP every 10 seconds - int sp = 5; + unsigned int sp = 5; - switch (ed->vd->class) { + switch (ed->vd->class_) { case ELEID_EL_AGNI_M: case ELEID_EL_AQUA_M: case ELEID_EL_VENTUS_M: @@ -903,7 +903,7 @@ static int read_elementaldb(void) db->lv = atoi(str[3]); estatus = &db->status; - db->vd.class = db->class_; + db->vd.class_ = db->class_; estatus->max_hp = atoi(str[4]); estatus->max_sp = atoi(str[5]); @@ -1070,7 +1070,7 @@ void elemental_defaults(void) memset(elemental->db,0,sizeof(elemental->db)); /* funcs */ - elemental->class = elemental_class; + elemental->class_ = elemental_class; elemental->get_viewdata = elemental_get_viewdata; elemental->create = elemental_create; diff --git a/src/map/elemental.h b/src/map/elemental.h index 14932864ba9..6bb6dc79c0c 100644 --- a/src/map/elemental.h +++ b/src/map/elemental.h @@ -118,7 +118,7 @@ struct elemental_interface { int (*init) (bool minimal); void (*final) (void); /* funcs */ - bool (*class) (int class_); + bool (*class_) (int class_); struct view_data * (*get_viewdata) (int class_); int (*create) (struct map_session_data *sd, int class_, unsigned int lifetime); diff --git a/src/map/goldpc.c b/src/map/goldpc.c index 94e1961c1cd..9f692d7bf59 100644 --- a/src/map/goldpc.c +++ b/src/map/goldpc.c @@ -194,7 +194,7 @@ static void goldpc_start(struct map_session_data *sd) sd->goldpc.start_tick = 0; if (sd->goldpc.tid != INVALID_TIMER) { - timer->delete(sd->goldpc.tid, goldpc->timeout); + timer->delete_(sd->goldpc.tid, goldpc->timeout); sd->goldpc.tid = INVALID_TIMER; } @@ -279,7 +279,7 @@ static void goldpc_stop(struct map_session_data *sd) pc_setaccountreg(sd, script->add_variable(GOLDPC_PLAYTIME_VAR), playtime); } - timer->delete(sd->goldpc.tid, goldpc_timeout); + timer->delete_(sd->goldpc.tid, goldpc_timeout); sd->goldpc.tid = INVALID_TIMER; } } diff --git a/src/map/grader.c b/src/map/grader.c index 7012350122a..35e32951389 100644 --- a/src/map/grader.c +++ b/src/map/grader.c @@ -290,6 +290,7 @@ void grader_enchant_start(struct map_session_data *sd, int idx, int mat_idx, boo return; const struct s_grade_info *gi = grader->get_grade_info(sd->status.inventory[idx].grade); + nullpo_retv(gi); const struct grade_material *gmaterial = &gi->materials[mat_idx]; // Validate the grading material diff --git a/src/map/guild.c b/src/map/guild.c index b095a421163..52d370b00db 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -373,7 +373,7 @@ static void guild_makemember(struct guild_member *m, struct map_session_data *sd m->hair = sd->status.hair; m->hair_color = sd->status.hair_color; m->gender = sd->status.sex; - m->class = sd->status.class; + m->class_ = sd->status.class_; m->lv = sd->status.base_level; //m->exp = 0; //m->exp_payper = 0; @@ -1131,7 +1131,7 @@ static int guild_send_memberinfoshort(struct map_session_data *sd, int online) return 0; intif->guild_memberinfoshort(g->guild_id, - sd->status.account_id,sd->status.char_id,online,sd->status.base_level,sd->status.class); + sd->status.account_id,sd->status.char_id,online,sd->status.base_level,sd->status.class_); if(!online){ int i = guild->getindex(g,sd->status.account_id,sd->status.char_id); @@ -1151,7 +1151,7 @@ static int guild_send_memberinfoshort(struct map_session_data *sd, int online) } // cleaned up [LuzZza] -static int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class, uint32 last_login) +static int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class_, uint32 last_login) { int i, alv, c, idx = INDEX_NOT_FOUND, om = 0, oldonline = -1; struct guild *g = guild->search(guild_id); @@ -1166,7 +1166,7 @@ static int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, oldonline=m->online; m->online=online; m->lv=lv; - m->class = class; + m->class_ = class_; m->last_login = last_login; idx=i; } diff --git a/src/map/guild.h b/src/map/guild.h index e40b898d567..20c7f851e29 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -127,7 +127,7 @@ struct guild_interface { int (*check_alliance) (int guild_id1, int guild_id2, int flag); /* */ int (*send_memberinfoshort) (struct map_session_data *sd,int online); - int (*recv_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int class, uint32 last_login); + int (*recv_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int class_, uint32 last_login); int (*change_memberposition) (int guild_id,int account_id,int char_id,short idx); int (*memberposition_changed) (struct guild *g,int idx,int pos); bool (*change_position) (int guild_id, int idx, int mode, int exp_mode, const char *name); diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 32580bd1cc2..199dfce7768 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -752,7 +752,7 @@ static void homunculus_hunger_timer_delete(struct homun_data *hd) { nullpo_retv(hd); if(hd->hungry_timer != INVALID_TIMER) { - timer->delete(hd->hungry_timer,homun->hunger_timer); + timer->delete_(hd->hungry_timer,homun->hunger_timer); hd->hungry_timer = INVALID_TIMER; } } @@ -1465,7 +1465,7 @@ static void do_init_homunculus(bool minimal) //Stock view data for homuncs memset(homun->dbs->viewdb, 0, sizeof(homun->dbs->viewdb)); for (class_ = 0; class_ < MAX_HOMUNCULUS_CLASS; class_++) - homun->dbs->viewdb[class_].class = HM_CLASS_BASE + class_; + homun->dbs->viewdb[class_].class_ = HM_CLASS_BASE + class_; } static void do_final_homunculus(void) diff --git a/src/map/instance.c b/src/map/instance.c index 59e802603c3..2a0006cbeb5 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -492,7 +492,7 @@ static void instance_del_map(int16 m) map->foreachinmap(instance_cleanup_sub, m, BL_ALL); if( map->list[m].mob_delete_timer != INVALID_TIMER ) - timer->delete(map->list[m].mob_delete_timer, map->removemobs_timer); + timer->delete_(map->list[m].mob_delete_timer, map->removemobs_timer); mapindex->removemap(map_id2index(m)); @@ -637,9 +637,9 @@ static void instance_destroy(int instance_id) instance->list[instance_id].regs.arrays->destroy(instance->list[instance_id].regs.arrays, script->array_free_db); if( instance->list[instance_id].progress_timer != INVALID_TIMER ) - timer->delete( instance->list[instance_id].progress_timer, instance->destroy_timer); + timer->delete_( instance->list[instance_id].progress_timer, instance->destroy_timer); if( instance->list[instance_id].idle_timer != INVALID_TIMER ) - timer->delete( instance->list[instance_id].idle_timer, instance->destroy_timer); + timer->delete_( instance->list[instance_id].idle_timer, instance->destroy_timer); instance->list[instance_id].regs.vars = NULL; @@ -667,7 +667,7 @@ static void instance_check_idle(int instance_id) idle = false; if (instance->list[instance_id].idle_timer != INVALID_TIMER && !idle) { - timer->delete(instance->list[instance_id].idle_timer, instance->destroy_timer); + timer->delete_(instance->list[instance_id].idle_timer, instance->destroy_timer); instance->list[instance_id].idle_timer = INVALID_TIMER; instance->list[instance_id].idle_timeout = 0; @@ -695,9 +695,9 @@ static void instance_set_timeout(int instance_id, unsigned int progress_timeout, return; if( instance->list[instance_id].progress_timer != INVALID_TIMER ) - timer->delete( instance->list[instance_id].progress_timer, instance->destroy_timer); + timer->delete_( instance->list[instance_id].progress_timer, instance->destroy_timer); if( instance->list[instance_id].idle_timer != INVALID_TIMER ) - timer->delete( instance->list[instance_id].idle_timer, instance->destroy_timer); + timer->delete_( instance->list[instance_id].idle_timer, instance->destroy_timer); if( progress_timeout ) { instance->list[instance_id].progress_timeout = now + progress_timeout; diff --git a/src/map/intif.c b/src/map/intif.c index fc9ec5732e1..77ddac77785 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -705,7 +705,7 @@ static void intif_parse_RecvClanMemberAction(int fd) c->received = true; if (c->req_count_tid != INVALID_TIMER) { - timer->delete(c->req_count_tid, clan->request_membercount); + timer->delete_(c->req_count_tid, clan->request_membercount); c->req_count_tid = INVALID_TIMER; } @@ -713,7 +713,7 @@ static void intif_parse_RecvClanMemberAction(int fd) switch (c->req_state) { case CLAN_REQ_AFTER_KICK: if (c->req_kick_tid != INVALID_TIMER) { - timer->delete(c->req_kick_tid, clan->request_kickoffline); + timer->delete_(c->req_kick_tid, clan->request_kickoffline); c->req_kick_tid = INVALID_TIMER; } break; @@ -805,7 +805,7 @@ static int intif_guild_leave(int guild_id, int account_id, int char_id, int flag } //Update request / Lv online status of the guild members -static int intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class) +static int intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class_) { if (intif->CheckForCharServer()) return 0; @@ -816,7 +816,7 @@ static int intif_guild_memberinfoshort(int guild_id, int account_id, int char_id WFIFOL(inter_fd,10) = char_id; WFIFOB(inter_fd,14) = online; WFIFOL(inter_fd,15) = lv; - WFIFOL(inter_fd,19) = class; + WFIFOL(inter_fd,19) = class_; WFIFOSET(inter_fd,23); return 0; } @@ -1313,7 +1313,7 @@ static void intif_parse_GuildCreated(int fd) // ACK guild infos static void intif_parse_GuildInfoEmblem(int fd) { - struct PACKET_CHARMAP_GUILD_INFO_EMBLEM *p = RFIFOP(fd, 0); + const struct PACKET_CHARMAP_GUILD_INFO_EMBLEM *p = RFIFOP(fd, 0); RFIFO_CHUNKED_INIT(p, p->packetLength - sizeof(struct PACKET_CHARMAP_GUILD_INFO_EMBLEM), intif->emblem_tmp); @@ -1336,15 +1336,19 @@ static void intif_parse_GuildInfoEmblem(int fd) static void intif_parse_GuildInfo(int fd) { if (RFIFOW(fd, 2) == sizeof(struct PACKET_CHARMAP_GUILD_INFO_EMPTY)) { - struct PACKET_CHARMAP_GUILD_INFO_EMPTY *empty = RFIFOP(fd, 0); + const struct PACKET_CHARMAP_GUILD_INFO_EMPTY *empty = RFIFOP(fd, 0); ShowWarning("intif: guild noinfo %d\n", empty->guild_id); guild->recv_noinfo(empty->guild_id); return; } - struct PACKET_CHARMAP_GUILD_INFO *p = RFIFOP(fd, 0); + const struct PACKET_CHARMAP_GUILD_INFO *p = RFIFOP(fd, 0); if (p->packetLength != sizeof(struct PACKET_CHARMAP_GUILD_INFO)) ShowError("intif: guild info: data size mismatch - Gid: %d recv size: %d Expected size: %"PRIuS"\n", p->g.guild_id, p->packetLength, sizeof(struct PACKET_CHARMAP_GUILD_INFO)); +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable: 4366) +#endif if (intif->emblem_tmp_done == false || intif->emblem_tmp_guild_id != p->g.guild_id || intif->emblem_tmp_emblem_id != p->g.emblem_id) { @@ -1352,6 +1356,9 @@ static void intif_parse_GuildInfo(int fd) } else { guild->recv_info(&p->g, &intif->emblem_tmp); } +#ifdef _MSC_VER +#pragma warning (pop) +#endif intif->emblem_tmp_done = false; intif->emblem_tmp_guild_id = 0; intif->emblem_tmp_emblem_id = 0; @@ -1449,7 +1456,7 @@ static void intif_parse_GuildMemberInfoChanged(int fd) case GMI_HAIR: g->member[idx].hair = RFIFOW(fd,18); break; case GMI_HAIR_COLOR: g->member[idx].hair_color = RFIFOW(fd,18); break; case GMI_GENDER: g->member[idx].gender = RFIFOW(fd,18); break; - case GMI_CLASS: g->member[idx].class = RFIFOW(fd,18); break; + case GMI_CLASS: g->member[idx].class_ = RFIFOW(fd,18); break; case GMI_LEVEL: g->member[idx].lv = RFIFOW(fd,18); break; } } @@ -1484,7 +1491,7 @@ static void intif_parse_GuildNotice(int fd) // ACK change of guild emblem static void intif_parse_GuildEmblem(int fd) { - struct PACKET_CHARMAP_GUILD_EMBLEM *p = RFIFOP(fd, 0); + const struct PACKET_CHARMAP_GUILD_EMBLEM *p = RFIFOP(fd, 0); // reset tmp emblem fields always for avoid reuse emblem buffer for other things [4144] intif->emblem_tmp_done = false; @@ -1559,7 +1566,7 @@ static void intif_parse_ChangeNameOk(int fd) { struct map_session_data *sd = NULL; if((sd=map->id2sd(RFIFOL(fd,2)))==NULL || - sd->status.char_id != RFIFOL(fd,6)) + sd->status.char_id != RFIFOSL(fd,6)) return; switch (RFIFOB(fd,10)) { @@ -2548,7 +2555,6 @@ static void intif_parse_RequestRodexOpenInbox(int fd) #if PACKETVER >= 20170419 int64 mail_id = RFIFOQ(fd, 16); #endif - int i, j; sd = map->charid2sd(RFIFOL(fd, 4)); @@ -2565,7 +2571,7 @@ static void intif_parse_RequestRodexOpenInbox(int fd) else sd->rodex.total += count; - if (RFIFOW(fd, 2) - 24 != count * sizeof(struct rodex_message)) { + if (RFIFOW(fd, 2) - 24 != count * (int)sizeof(struct rodex_message)) { ShowError("intif_parse_RodexInboxOpenReceived: data size mismatch %d != %"PRIuS"\n", RFIFOW(fd, 2) - 24, count * sizeof(struct rodex_message)); return; } @@ -2573,7 +2579,7 @@ static void intif_parse_RequestRodexOpenInbox(int fd) if (flag == 0 && is_first) VECTOR_CLEAR(sd->rodex.messages); - for (i = 0, j = 24; i < count; ++i, j += sizeof(struct rodex_message)) { + for (int i = 0, j = 24; i < count; ++i, j += sizeof(struct rodex_message)) { struct rodex_message msg = { 0 }; VECTOR_ENSURE(sd->rodex.messages, 1, 1); memcpy(&msg, RFIFOP(fd, j), sizeof(struct rodex_message)); diff --git a/src/map/intif.h b/src/map/intif.h index 88fd47b5faf..8ae671b51ef 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -81,7 +81,7 @@ struct intif_interface { int (*guild_request_info) (int guild_id); int (*guild_addmember) (int guild_id, struct guild_member *m); int (*guild_leave) (int guild_id, int account_id, int char_id, int flag, const char *mes); - int (*guild_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int class); + int (*guild_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int class_); int (*guild_break) (int guild_id); int (*guild_change_gm) (int guild_id, const char *name, int len); int (*guild_change_basicinfo) (int guild_id, int type, const void *data, int len); diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index a0d73f30f0e..14feaaa4dd0 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -160,7 +160,7 @@ static int irc_parse(int fd) /// @copydoc ircbot_interface::parse_source() static void irc_parse_source(char *source, char *nick, char *ident, char *host) { - int i, pos = 0; + int pos = 0; size_t len; unsigned char stage = 0; @@ -169,10 +169,10 @@ static void irc_parse_source(char *source, char *nick, char *ident, char *host) nullpo_retv(nick); nullpo_retv(ident); nullpo_retv(host); - for(i = 0; i < len; i++) { + for(size_t i = 0; i < len; i++) { if( stage == 0 && source[i] == '!' ) { safestrncpy(nick, &source[0], min(i + 1, IRC_NICK_LENGTH)); - pos = i+1; + pos = (int)i + 1; stage = 1; } else if( stage == 1 && source[i] == '@' ) { safestrncpy(ident, &source[pos], min(i - pos + 1, IRC_IDENT_LENGTH)); @@ -519,7 +519,7 @@ static void ircbot_final(void) } if (ircbot->queue_tid != INVALID_TIMER) - timer->delete(ircbot->queue_tid, ircbot->queue_timer); + timer->delete_(ircbot->queue_tid, ircbot->queue_timer); while (ircbot->message_current != NULL) { struct message_flood *next = ircbot->message_current->next; diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h index f25af0d3d0a..6271bd2739c 100644 --- a/src/map/irc-bot.h +++ b/src/map/irc-bot.h @@ -65,7 +65,7 @@ struct ircbot_interface { /* */ struct { struct irc_func **list; - unsigned int size; + int size; } funcs; /** diff --git a/src/map/itemdb.c b/src/map/itemdb.c index bd206d82497..ea26ad6af82 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1269,7 +1269,7 @@ static void itemdb_read_packages(void) must[ i - 1 ] += 1; else { random[ i - 1 ] += 1; - if( rval > rgroup[i - 1] ) + if( (unsigned int)rval > rgroup[i - 1] ) rgroup[i - 1] = rval; if( rval > highest_gcount ) highest_gcount = rval; @@ -1284,7 +1284,7 @@ static void itemdb_read_packages(void) for(i = 0; i < libconfig->setting_length(item_packages_conf.root); i++ ) { rgroups[i] = aMalloc( rgroup[i] * sizeof(unsigned int) ); - for( c = 0; c < rgroup[i]; c++ ) { + for( c = 0; (unsigned int)c < rgroup[i]; c++ ) { rgroups[i][c] = 0; } } diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 1377bbab688..7e8d2995361 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -59,7 +59,7 @@ struct hplugin_data_store; #define CARD0_FORGE 0x00FF #define CARD0_CREATE 0x00FE -#define CARD0_PET ((short)0xFF00) +#define CARD0_PET ((short)(uint16)0xFF00) //Marks if the card0 given is "special" (non-item id used to mark pets/created items. [Skotlex] #define itemdb_isspecial(i) ((i) == CARD0_FORGE || (i) == CARD0_CREATE || (i) == CARD0_PET) diff --git a/src/map/macro.c b/src/map/macro.c index cd88b280958..4706e2feeba 100644 --- a/src/map/macro.c +++ b/src/map/macro.c @@ -175,7 +175,7 @@ static void macro_detector_process_answer(struct map_session_data *sd, const cha // Correct answer if (captcha_answer != NULL && strcmp(captcha_answer, cd->captcha_answer) == 0) { // Delete the timer - timer->delete(sd->macro_detect.timer, macro->detector_timeout); + timer->delete_(sd->macro_detect.timer, macro->detector_timeout); // Clear the macro detect data memset(&sd->macro_detect, 0, sizeof(sd->macro_detect)); @@ -216,7 +216,7 @@ static void macro_detector_disconnect(struct map_session_data *sd) // Delete the timeout timer if (sd->macro_detect.timer != INVALID_TIMER) { - timer->delete(sd->macro_detect.timer, macro->detector_timeout); + timer->delete_(sd->macro_detect.timer, macro->detector_timeout); sd->macro_detect.timer = INVALID_TIMER; } @@ -331,13 +331,13 @@ static bool macro_read_captcha_db_libconfig_sub(const struct config_setting_t *i return false; } - const unsigned long alen = strlen(answer); + const size_t alen = strlen(answer); if (alen < 4 || alen > 15) { ShowError("%s: Answer \"%s\" must be between 4~15 chars in len for entry %d in %s\n", __func__, answer, n, source); return false; } - for (int i = 0; i < alen; ++i) { + for (size_t i = 0; i < alen; ++i) { if (strchr(macro_allowed_answer_chars, answer[i]) == NULL) { ShowError("%s: Answer \"%s\" have an invalid character \"%c\" for entry %d in %s\n", __func__, answer, answer[i], n, source); return false; diff --git a/src/map/map.c b/src/map/map.c index fa6a7a9fc0b..ea8de40ae72 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1586,7 +1586,7 @@ static void map_clearflooritem(struct block_list *bl) nullpo_retv(fitem); if( fitem->cleartimer != INVALID_TIMER ) - timer->delete(fitem->cleartimer,map->clearflooritem_timer); + timer->delete_(fitem->cleartimer,map->clearflooritem_timer); clif->clearflooritem(fitem, 0); map->deliddb(&fitem->bl); @@ -2040,7 +2040,7 @@ static int map_quit(struct map_session_data *sd) } if( sd->expiration_tid != INVALID_TIMER ) - timer->delete(sd->expiration_tid,pc->expiration_timer); + timer->delete_(sd->expiration_tid,pc->expiration_timer); if (sd->npc_timer_id != INVALID_TIMER) //Cancel the event timer. npc->timerevent_quit(sd); @@ -2817,7 +2817,7 @@ static void map_spawnmobs(int16 m) int i, k=0; if (map->list[m].mob_delete_timer != INVALID_TIMER) { //Mobs have not been removed yet [Skotlex] - timer->delete(map->list[m].mob_delete_timer, map->removemobs_timer); + timer->delete_(map->list[m].mob_delete_timer, map->removemobs_timer); map->list[m].mob_delete_timer = INVALID_TIMER; return; } @@ -3706,7 +3706,7 @@ static void map_clean(int i) if (battle_config.dynamic_mobs != 0) { //Dynamic mobs flag by [random] if (map->list[i].mob_delete_timer != INVALID_TIMER) - timer->delete(map->list[i].mob_delete_timer, map->removemobs_timer); + timer->delete_(map->list[i].mob_delete_timer, map->removemobs_timer); for (int j = 0; j < MAX_MOB_LIST_PER_MAP; j++) { if (map->list[i].moblist[j] != NULL) aFree(map->list[i].moblist[j]); @@ -5505,7 +5505,7 @@ static bool map_zone_mf_cache(int m, char *flag, char *params) } } if (sscanf(params, "%d", &state) == 1) { - if (state != map->list[m].flag.nostorage) { + if ((unsigned int)state != map->list[m].flag.nostorage) { sprintf(rflag, "nostorage\t%d", state); map_zone_mf_cache_add(m, rflag); } @@ -5518,7 +5518,7 @@ static bool map_zone_mf_cache(int m, char *flag, char *params) } } if (sscanf(params, "%d", &state) == 1) { - if (state != map->list[m].flag.nogstorage) { + if ((unsigned int)state != map->list[m].flag.nogstorage) { sprintf(rflag, "nogstorage\t%d", state); map_zone_mf_cache_add(m, rflag); } @@ -5681,7 +5681,7 @@ static bool map_zone_mf_cache(int m, char *flag, char *params) } } if (sscanf(params, "%d", &state) == 1) { - if (state != map->list[m].invincible_time_inc) { + if ((unsigned int)state != map->list[m].invincible_time_inc) { sprintf(rflag, "invincible_time_inc\t%s", params); map_zone_mf_cache_add(m, rflag); } @@ -5759,7 +5759,7 @@ static bool map_zone_mf_cache(int m, char *flag, char *params) } } if (sscanf(params, "%d", &state) == 1) { - if (state != map->list[m].flag.nopet) { + if ((unsigned int)state != map->list[m].flag.nopet) { sprintf(rflag, "nopet\t%d", state); map_zone_mf_cache_add(m, rflag); } @@ -5797,10 +5797,9 @@ static void map_zone_apply(int m, struct map_zone_data *zone, const char *start, map->list[m].zone = zone; for(i = 0; i < zone->mapflags_count; i++) { size_t len = strlen(zone->mapflags[i]); - int k; params[0] = '\0'; memcpy(flag, zone->mapflags[i], MAP_ZONE_MAPFLAG_LENGTH); - for(k = 0; k < len; k++) { + for(size_t k = 0; k < len; k++) { if( flag[k] == '\t' ) { memcpy(params, &flag[k+1], len - k); flag[k] = '\0'; @@ -5820,7 +5819,7 @@ static void map_zone_init(void) char flag[MAP_ZONE_MAPFLAG_LENGTH], params[MAP_ZONE_MAPFLAG_LENGTH]; struct map_zone_data *zone; const char *empty = ""; - int i,k,j; + int i,j; zone = &map->zone_all; @@ -5828,7 +5827,7 @@ static void map_zone_init(void) size_t len = strlen(zone->mapflags[i]); params[0] = '\0'; memcpy(flag, zone->mapflags[i], MAP_ZONE_MAPFLAG_LENGTH); - for(k = 0; k < len; k++) { + for(size_t k = 0; k < len; k++) { if( flag[k] == '\t' ) { memcpy(params, &flag[k+1], len - k); flag[k] = '\0'; @@ -5851,7 +5850,7 @@ static void map_zone_init(void) size_t len = strlen(zone->mapflags[i]); params[0] = '\0'; memcpy(flag, zone->mapflags[i], MAP_ZONE_MAPFLAG_LENGTH); - for(k = 0; k < len; k++) { + for(size_t k = 0; k < len; k++) { if( flag[k] == '\t' ) { memcpy(params, &flag[k+1], len - k); flag[k] = '\0'; diff --git a/src/map/mercenary.c b/src/map/mercenary.c index e2f0bc35bf7..cb470abe3ac 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -303,7 +303,7 @@ static void merc_contract_stop(struct mercenary_data *md) { nullpo_retv(md); if( md->contract_timer != INVALID_TIMER ) - timer->delete(md->contract_timer, mercenary->contract_end_timer); + timer->delete_(md->contract_timer, mercenary->contract_end_timer); md->contract_timer = INVALID_TIMER; } @@ -451,7 +451,7 @@ static bool read_mercenarydb_sub(char *str[], int columns, int current) db->lv = atoi(str[3]); mstatus = &db->status; - db->vd.class = db->class_; + db->vd.class_ = db->class_; mstatus->max_hp = atoi(str[4]); mstatus->max_sp = atoi(str[5]); @@ -567,7 +567,7 @@ void mercenary_defaults(void) /* funcs */ mercenary->init = do_init_mercenary; - mercenary->class = merc_class; + mercenary->class_ = merc_class; mercenary->get_viewdata = merc_get_viewdata; mercenary->create = merc_create; diff --git a/src/map/mercenary.h b/src/map/mercenary.h index e1a36bdd289..85ff94b372c 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -126,7 +126,7 @@ struct mercenary_interface { void (*init) (bool minimal); - bool (*class) (int class_); + bool (*class_) (int class_); struct view_data * (*get_viewdata) (int class_); int (*create) (struct map_session_data *sd, int class_, unsigned int lifetime); diff --git a/src/map/mob.c b/src/map/mob.c index 4a6c7e74de9..43d59a0fec8 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -166,7 +166,7 @@ static void mvptomb_spawn_delayed(struct npc_data *nd) nullpo_retv(nd); if (nd->u.tomb.spawn_timer != INVALID_TIMER) - timer->delete(nd->u.tomb.spawn_timer, mob->mvptomb_delayspawn); + timer->delete_(nd->u.tomb.spawn_timer, mob->mvptomb_delayspawn); nd->u.tomb.spawn_timer = timer->add(timer->gettick() + battle_config.mvp_tomb_spawn_delay, mob->mvptomb_delayspawn, nd->bl.id, 0); } @@ -255,7 +255,7 @@ static void mvptomb_destroy(struct mob_data *md) } if (nd->u.tomb.spawn_timer != INVALID_TIMER) - timer->delete(nd->u.tomb.spawn_timer, mob->mvptomb_delayspawn); + timer->delete_(nd->u.tomb.spawn_timer, mob->mvptomb_delayspawn); map->deliddb(&nd->bl); @@ -1097,7 +1097,7 @@ static int mob_setdelayspawn(struct mob_data *md) spawntime = 5000; if( md->spawn_timer != INVALID_TIMER ) - timer->delete(md->spawn_timer, mob->delayspawn); + timer->delete_(md->spawn_timer, mob->delayspawn); md->spawn_timer = timer->add(timer->gettick()+spawntime, mob->delayspawn, md->bl.id, 0); return 0; } @@ -1146,14 +1146,14 @@ static int mob_spawn(struct mob_data *md) if (map->search_free_cell(&md->bl, -1, &md->bl.x, &md->bl.y, md->spawn->xs, md->spawn->ys, sfc_flag) != 0) { // retry again later if( md->spawn_timer != INVALID_TIMER ) - timer->delete(md->spawn_timer, mob->delayspawn); + timer->delete_(md->spawn_timer, mob->delayspawn); md->spawn_timer = timer->add(tick+5000,mob->delayspawn,md->bl.id,0); return 1; } } else if( battle_config.no_spawn_on_player > 99 && map->foreachinrange(mob->count_sub, &md->bl, AREA_SIZE, BL_PC) ) { // retry again later (players on sight) if( md->spawn_timer != INVALID_TIMER ) - timer->delete(md->spawn_timer, mob->delayspawn); + timer->delete_(md->spawn_timer, mob->delayspawn); md->spawn_timer = timer->add(tick+5000,mob->delayspawn,md->bl.id,0); return 1; } @@ -1169,7 +1169,7 @@ static int mob_spawn(struct mob_data *md) md->ud.dir = 0; if( md->spawn_timer != INVALID_TIMER ) { - timer->delete(md->spawn_timer, mob->delayspawn); + timer->delete_(md->spawn_timer, mob->delayspawn); md->spawn_timer = INVALID_TIMER; } @@ -1787,8 +1787,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, int64 tick) return true; } } - else - if( (abl = map->id2bl(md->attacked_id)) && (!tbl || mob->can_changetarget(md, abl, mode) || (md->sc.count && md->sc.data[SC__CHAOS]))) { + else if( (abl = map->id2bl(md->attacked_id)) && (!tbl || mob->can_changetarget(md, abl, mode) || (md->sc.count && md->sc.data[SC__CHAOS]))) { int dist; if( md->bl.m != abl->m || abl->prev == NULL || (dist = distance_bl(&md->bl, abl)) >= MAX_MINCHASE // Attacker longer than visual area @@ -1922,7 +1921,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, int64 tick) memmove(&md->lootitem[0], &md->lootitem[1], (LOOTITEM_SIZE-1)*sizeof(md->lootitem[0])); memcpy (&md->lootitem[LOOTITEM_SIZE-1], &fitem->item_data, sizeof(md->lootitem[0])); } - if (pc->db_checkid(md->vd->class)) { + if (pc->db_checkid(md->vd->class_)) { //Give them walk act/delay to properly mimic players. [Skotlex] clif->takeitem(&md->bl,tbl); md->ud.canact_tick = tick + md->status.amotion; @@ -2220,7 +2219,7 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str if( sd == NULL ) sd = map->charid2sd(dlist->third_charid); if( sd - && (drop_rate <= sd->state.autoloot || pc->isautolooting(sd, ditem->item_data.nameid)) + && ((unsigned int)drop_rate <= sd->state.autoloot || pc->isautolooting(sd, ditem->item_data.nameid)) && (!map->list[sd->bl.m].flag.noautoloot) && (battle_config.idle_no_autoloot == 0 || DIFF_TICK(sockt->last_tick, sd->idletime) < battle_config.idle_no_autoloot) && (battle_config.homunculus_autoloot?1:!flag) @@ -2299,7 +2298,8 @@ static int mob_respawn(int tid, int64 tick, int id, intptr_t data) static void mob_log_damage(struct mob_data *md, struct block_list *src, int damage) { - int char_id = 0, flag = MDLF_NORMAL; + int char_id = 0; + unsigned int flag = MDLF_NORMAL; nullpo_retv(md); nullpo_retv(src); @@ -3030,7 +3030,7 @@ static int mob_dead(struct mob_data *md, struct block_list *src, int type) } if(md->deletetimer != INVALID_TIMER) { - timer->delete(md->deletetimer,mob->timer_delete); + timer->delete_(md->deletetimer,mob->timer_delete); md->deletetimer = INVALID_TIMER; } /** @@ -3043,7 +3043,7 @@ static int mob_dead(struct mob_data *md, struct block_list *src, int type) if( !rebirth ) { - if (pc->db_checkid(md->vd->class)) { + if (pc->db_checkid(md->vd->class_)) { // Player mobs are not removed automatically by the client. /* first we set them dead, then we delay the out sight effect */ clif->clearunit_area(&md->bl,CLR_DEAD); @@ -3192,7 +3192,7 @@ static int mob_class_change(struct mob_data *md, int class_) mob_stop_walking(md, STOPWALKING_FLAG_NONE); unit->skillcastcancel(&md->bl, 0); status->set_viewdata(&md->bl, class_); - clif->class_change(&md->bl, md->vd->class, 1, NULL); + clif->class_change(&md->bl, md->vd->class_, 1, NULL); status_calc_mob(md, SCO_FIRST); md->ud.state.speed_changed = 1; //Speed change update. @@ -3493,7 +3493,7 @@ static struct block_list *mob_getmasterhpltmaxrate(struct mob_data *md, int rate { if( md && md->master_id > 0 ) { struct block_list *bl = map->id2bl(md->master_id); - if( bl && get_percentage(status_get_hp(bl), status_get_max_hp(bl)) < rate ) + if( bl && get_percentage(status_get_hp(bl), status_get_max_hp(bl)) < (unsigned int)rate ) return bl; } @@ -3814,11 +3814,12 @@ static int mob_use_skill(struct mob_data *md, int64 tick, int event) char temp[CHAT_SIZE_MAX + NAME_LENGTH + 10]; char name[NAME_LENGTH]; struct mob_chat *mc = mob->chat(ms[skill_idx].msg_id); - - snprintf(name, sizeof(name), "%s", md->name); - strtok(name, "#"); // Discard extra name identifier if present. [Daegaladh] - snprintf(temp, sizeof(temp), "%s : %s", name, mc->msg); - clif->messagecolor(&md->bl, mc->color, temp); + if (!nullpo_chk(mc)) { + snprintf(name, sizeof(name), "%s", md->name); + strtok(name, "#"); // Discard extra name identifier if present. [Daegaladh] + snprintf(temp, sizeof(temp), "%s : %s", name, mc->msg); + clif->messagecolor(&md->bl, mc->color, temp); + } } if ((battle_config.mob_ai & 0x200) == 0) { // Pass on delay to same skill. @@ -3964,8 +3965,8 @@ static int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 /// Go Backwards to give better priority to advanced skills. for (int i = 0, j = MAX_SKILL_TREE - 1; j >= 0 && i < MAX_MOBSKILL; j--) { - const int idx = pc->skill_tree[pc->class2idx(sd->status.class)][j].idx; - const int skill_id = pc->skill_tree[pc->class2idx(sd->status.class)][j].id; + const int idx = pc->skill_tree[pc->class2idx(sd->status.class_)][j].idx; + const int skill_id = pc->skill_tree[pc->class2idx(sd->status.class_)][j].id; if (skill_id == 0 || sd->status.skill[idx].lv < 1 || (skill->dbs->db[idx].inf2 & (INF2_WEDDING_SKILL | INF2_GUILD_SKILL)) > 0) @@ -4120,7 +4121,7 @@ static int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 if (duration > 0) { /// Auto delete after a while. if (md->deletetimer != INVALID_TIMER) - timer->delete(md->deletetimer, mob->timer_delete); + timer->delete_(md->deletetimer, mob->timer_delete); md->deletetimer = timer->add(timer->gettick() + duration, mob->timer_delete, md->bl.id, 0); } @@ -4532,7 +4533,7 @@ static void mob_read_db_viewdata_sub(struct mob_db *entry, struct config_setting int i32; if ((it = libconfig->setting_get_member(t, "SpriteId")) != NULL) - entry->vd.class = libconfig->setting_get_int(it); + entry->vd.class_ = libconfig->setting_get_int(it); if ((it = libconfig->setting_get_member(t, "WeaponId")) != NULL) entry->vd.weapon = libconfig->setting_get_int(it); if ((it = libconfig->setting_get_member(t, "ShieldId")) != NULL) @@ -5067,7 +5068,7 @@ static int mob_read_db_sub(struct config_setting_t *mobt, int n, const char *sou return 0; } md.mob_id = i32; - md.vd.class = md.mob_id; + md.vd.class_ = md.mob_id; if ((t = libconfig->setting_get_member(mobt, "Inherit")) && (inherit = libconfig->setting_get_bool(t))) { if (!mob->db_data[md.mob_id]) { diff --git a/src/map/npc.c b/src/map/npc.c index f9390feecb0..5e66e898f25 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -738,7 +738,7 @@ static int npc_timerevent_stop(struct npc_data *nd) const struct TimerData *td = timer->get(*tid); if (td && td->data) ers_free(npc->timer_event_ers, (void*)td->data); - timer->delete(*tid,npc->timerevent); + timer->delete_(*tid,npc->timerevent); *tid = INVALID_TIMER; } @@ -771,7 +771,7 @@ static void npc_timerevent_quit(struct map_session_data *sd) // Delete timer nd = map->id2nd(td->id); ted = (struct timer_event_data*)td->data; - timer->delete(sd->npc_timer_id, npc->timerevent); + timer->delete_(sd->npc_timer_id, npc->timerevent); sd->npc_timer_id = INVALID_TIMER; // Execute OnTimerQuit @@ -1703,7 +1703,7 @@ static void npc_market_fromsql(void) continue; } - int i; + unsigned int i; for (i = 0; i < nd->u.scr.shop->items; i++) { if( nd->u.scr.shop->item[i].nameid == itemid ) { nd->u.scr.shop->item[i].qty = amount; @@ -1725,7 +1725,7 @@ static void npc_market_fromsql(void) static void npc_market_tosql(struct npc_data *nd, int index) { nullpo_retv(nd); - Assert_retv(index >= 0 && index < nd->u.scr.shop->items); + Assert_retv(index >= 0 && (unsigned int)index < nd->u.scr.shop->items); if (SQL_ERROR == SQL->Query(map->mysql_handle, "REPLACE INTO `%s` VALUES ('%s','%d','%d')", map->npc_market_data_db, nd->exname, nd->u.scr.shop->item[index].nameid, nd->u.scr.shop->item[index].qty)) Sql_ShowDebug(map->mysql_handle); @@ -1750,7 +1750,7 @@ static void npc_market_delfromsql_sub(const char *npcname, int index) static void npc_market_delfromsql(struct npc_data *nd, int index) { nullpo_retv(nd); - Assert_retv(index == INT_MAX || (index >= 0 && index < nd->u.scr.shop->items)); + Assert_retv(index == INT_MAX || (index >= 0 && (unsigned int)index < nd->u.scr.shop->items)); npc->market_delfromsql_sub(nd->exname, index == INT_MAX ? index : nd->u.scr.shop->item[index].nameid); } @@ -1793,10 +1793,10 @@ static void npc_barter_fromsql(void) continue; } - int i; + unsigned int i; for (i = 0; i < nd->u.scr.shop->items; i++) { struct npc_item_list *const item = &nd->u.scr.shop->item[i]; - if (item->nameid == itemid && item->value == removeId && item->value2 == removeAmount) { + if (item->nameid == itemid && item->value == (unsigned int)removeId && item->value2 == removeAmount) { item->qty = amount; break; } @@ -1817,7 +1817,7 @@ static void npc_barter_fromsql(void) static void npc_barter_tosql(struct npc_data *nd, int index) { nullpo_retv(nd); - Assert_retv(index >= 0 && index < nd->u.scr.shop->items); + Assert_retv(index >= 0 && (unsigned int)index < nd->u.scr.shop->items); const struct npc_item_list *const item = &nd->u.scr.shop->item[index]; if (item->qty == -1) return; @@ -1853,7 +1853,7 @@ static void npc_barter_delfromsql(struct npc_data *nd, int index) if (index == INT_MAX) { npc->barter_delfromsql_sub(nd->exname, INT_MAX, 0, 0); } else { - Assert_retv(index >= 0 && index < nd->u.scr.shop->items); + Assert_retv(index >= 0 && (unsigned int)index < nd->u.scr.shop->items); const struct npc_item_list *const item = &nd->u.scr.shop->item[index]; npc->barter_delfromsql_sub(nd->exname, item->nameid, item->value, item->value2); } @@ -1912,10 +1912,10 @@ static void npc_expanded_barter_fromsql(void) continue; } - int i; + unsigned int i; for (i = 0; i < nd->u.scr.shop->items; i++) { struct npc_item_list *const item = &nd->u.scr.shop->item[i]; - if (item->nameid == itemid && item->value == zeny) { + if (item->nameid == itemid && item->value == (unsigned int)zeny) { int count = nd->u.scr.shop->item[i].value2; if (count > 10) count = 10; @@ -1952,7 +1952,7 @@ static void npc_expanded_barter_fromsql(void) static void npc_expanded_barter_tosql(struct npc_data *nd, int index) { nullpo_retv(nd); - Assert_retv(index >= 0 && index < nd->u.scr.shop->items); + Assert_retv(index >= 0 && (unsigned int)index < nd->u.scr.shop->items); const struct npc_item_list *const item = &nd->u.scr.shop->item[index]; if (item->qty == -1) return; @@ -2028,7 +2028,7 @@ static void npc_expanded_barter_delfromsql(struct npc_data *nd, int index) if (index == INT_MAX) { npc->expanded_barter_delfromsql_sub(nd->exname, INT_MAX, 0, 0, NULL); } else { - Assert_retv(index >= 0 && index < nd->u.scr.shop->items); + Assert_retv(index >= 0 && (unsigned int)index < nd->u.scr.shop->items); const struct npc_item_list *const item = &nd->u.scr.shop->item[index]; npc->expanded_barter_delfromsql_sub(nd->exname, item->nameid, item->value, item->value2, &item->currency[0]); } @@ -2050,7 +2050,7 @@ static bool npc_trader_open(struct map_session_data *sd, struct npc_data *nd) clif->npcbuysell(sd,nd->bl.id); return true;/* we skip sd->npc_shopid, npc->buysell will set it then when the player selects */ case NST_MARKET: { - int i; + unsigned int i; for(i = 0; i < nd->u.scr.shop->items; i++) { if( nd->u.scr.shop->item[i].qty ) @@ -2565,7 +2565,7 @@ static int npc_barter_buylist(struct map_session_data *sd, struct barteritemlist return 13; // no such item in shop if (entry->addId != shop[j].nameid && entry->addId != itemdb_viewid(shop[j].nameid)) return 13; // no such item in shop - if (removeId != shop[j].value && removeId != itemdb_viewid(shop[j].value)) + if ((unsigned int)removeId != shop[j].value && removeId != itemdb_viewid(shop[j].value)) return 13; // no such item in shop entry->addId = shop[j].nameid; // item_avail replacement removeId = shop[j].value; // item_avail replacement @@ -3174,7 +3174,7 @@ static int npc_unload(struct npc_data *nd, bool single, bool unload_mobs) if (td != NULL && td->data != 0) ers_free(npc->timer_event_ers, (void*)td->data); - timer->delete(sd->npc_timer_id, npc->timerevent); + timer->delete_(sd->npc_timer_id, npc->timerevent); sd->npc_timer_id = INVALID_TIMER; } } @@ -3187,7 +3187,7 @@ static int npc_unload(struct npc_data *nd, bool single, bool unload_mobs) if (td != NULL && td->data != 0) ers_free(npc->timer_event_ers, (void*)td->data); - timer->delete(nd->u.scr.timerid, npc->timerevent); + timer->delete_(nd->u.scr.timerid, npc->timerevent); } if (nd->u.scr.timer_event != NULL) @@ -3207,7 +3207,7 @@ static int npc_unload(struct npc_data *nd, bool single, bool unload_mobs) if (nd->u.scr.shop != NULL) { if (nd->u.scr.shop->item != NULL) { - for (int i = 0; i < nd->u.scr.shop->items; i ++) { + for (unsigned int i = 0; i < nd->u.scr.shop->items; i ++) { if (nd->u.scr.shop->item[i].currency != NULL) aFree(nd->u.scr.shop->item[i].currency); } @@ -3649,7 +3649,7 @@ static const char *npc_parse_shop(const char *w1, const char *w2, const char *w3 size_t items_count = 40; // Starting items size const char *p; - int x, y, dir, m, i, class_; + int x, y, dir, m, class_; struct npc_data *nd; enum npc_subtype type; @@ -3692,6 +3692,8 @@ static const char *npc_parse_shop(const char *w1, const char *w2, const char *w3 items = aMalloc(sizeof(items[0])*items_count); p = strchr(w4,','); + unsigned int i = 0; + for( i = 0; p; ++i ) { int nameid, value; struct item_data* id; @@ -5800,7 +5802,7 @@ static int npc_reload(void) } if (map->list[m].mob_delete_timer != INVALID_TIMER) { /// Mobs were removed anyway, so delete the timer. [Inkfish] - timer->delete(map->list[m].mob_delete_timer, map->removemobs_timer); + timer->delete_(map->list[m].mob_delete_timer, map->removemobs_timer); map->list[m].mob_delete_timer = INVALID_TIMER; } } @@ -6003,11 +6005,11 @@ static int do_init_npc(bool minimal) //Stock view data for normal npcs. memset(&npc_viewdb, 0, sizeof(npc_viewdb)); - npc_viewdb[0].class = INVISIBLE_CLASS; //Invisible class is stored here. + npc_viewdb[0].class_ = INVISIBLE_CLASS; //Invisible class is stored here. for( i = 1; i < MAX_NPC_CLASS; i++ ) - npc_viewdb[i].class = i; + npc_viewdb[i].class_ = i; for( i = MAX_NPC_CLASS2_START; i < MAX_NPC_CLASS2_END; i++ ) - npc_viewdb2[i - MAX_NPC_CLASS2_START].class = i; + npc_viewdb2[i - MAX_NPC_CLASS2_START].class_ = i; npc->ev_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, EVENT_NAME_LENGTH); npc->ev_label_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, NAME_LENGTH); npc->name_db = strdb_alloc(DB_OPT_BASE, NAME_LENGTH); diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c index 46d2a802b9e..3d93253e4de 100644 --- a/src/map/npc_chat.c +++ b/src/map/npc_chat.c @@ -124,7 +124,7 @@ static struct pcrematch_set *lookup_pcreset(struct npc_data *nd, int setid) while (pcreset != NULL) { if (pcreset->setid == setid) - break; + break; pcreset = pcreset->next; } if (pcreset == NULL) @@ -132,7 +132,7 @@ static struct pcrematch_set *lookup_pcreset(struct npc_data *nd, int setid) while (pcreset != NULL) { if (pcreset->setid == setid) - break; + break; pcreset = pcreset->next; } diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index b987b8201a7..f043b9847f0 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -1870,7 +1870,7 @@ DEFINE_PACKET_HEADER(CZ_CHECKNAME2, 0x0b97) struct PACKET_ZC_CHECKNAME { int16 PacketType; int32 CharId; - int16 Class; + int16 Class_; int16 BaseLevel; char Name[24]; } __attribute__((packed)); @@ -1879,7 +1879,7 @@ DEFINE_PACKET_HEADER(ZC_CHECKNAME, 0x0a51) struct PACKET_ZC_CHECKNAME { int16 PacketType; int32 CharId; - int16 Class; + int16 Class_; int16 BaseLevel; } __attribute__((packed)); DEFINE_PACKET_HEADER(ZC_CHECKNAME, 0x0a14) @@ -2078,7 +2078,7 @@ struct PACKET_ZC_ADD_MEMBER_TO_GROUP { #endif uint32 leader; #if PACKETVER_MAIN_NUM >= 20170524 || PACKETVER_RE_NUM >= 20170502 || defined(PACKETVER_ZERO) - int16 class; + int16 class_; int16 baseLevel; #endif int16 x; @@ -2101,7 +2101,7 @@ struct PACKET_ZC_GROUP_LIST_SUB { uint8 leader; uint8 offline; #if PACKETVER_MAIN_NUM >= 20170524 || PACKETVER_RE_NUM >= 20170502 || defined(PACKETVER_ZERO) - int16 class; + int16 class_; int16 baseLevel; #endif } __attribute__((packed)); diff --git a/src/map/party.c b/src/map/party.c index 1d42c598806..49618343e19 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -68,7 +68,7 @@ static void party_fill_member(struct party_member *member, struct map_session_da member->account_id = sd->status.account_id; member->char_id = sd->status.char_id; safestrncpy(member->name, sd->status.name, NAME_LENGTH); - member->class = sd->status.class; + member->class_ = sd->status.class_; member->map = sd->mapindex; member->lv = sd->status.base_level; member->online = 1; @@ -247,7 +247,7 @@ static void party_check_state(struct party_data *p) memset(&p->state, 0, sizeof(p->state)); for (i = 0; i < MAX_PARTY; i++) { if (!p->party.member[i].online) continue; //Those not online shouldn't apart to skill usage and all that. - switch (p->party.member[i].class) { + switch (p->party.member[i].class_) { case JOB_MONK: case JOB_BABY_MONK: case JOB_CHAMPION: @@ -736,9 +736,9 @@ static int party_optionchanged(int party_id, int account_id, int exp, int item, return 0; //Flag&0x1: Exp change denied. Flag&0x10: Item change denied. - if(!(flag&0x01) && p->party.exp != exp) + if(!(flag&0x01) && p->party.exp != (unsigned int)exp) p->party.exp=exp; - if (p->party.item != item) + if (p->party.item != (unsigned int)item) p->party.item=item; if (account_id == 0) { diff --git a/src/map/path.c b/src/map/path.c index de4316a4726..b83f7d0b544 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -78,7 +78,7 @@ BHEAP_STRUCT_DECL(node_heap, struct path_node *); static const unsigned char walk_choices [3][3] = { {1,0,7}, - {2,-1,6}, + {2,UINT8_MAX,6}, {3,4,5}, }; @@ -317,114 +317,114 @@ static bool path_search(struct walkpath_data *wpd, struct block_list *bl, int16 } return false; // easy path unsuccessful - } else { // !(flag&1) - // A* (A-star) pathfinding - // We always use A* for finding walkpaths because it is what game client uses. - // Easy pathfinding cuts corners of non-walkable cells, but client always walks around it. - - BHEAP_STRUCT_VAR(node_heap, open_set); // 'Open' set - - // FIXME: This array is too small to ensure all paths shorter than MAX_WALKPATH - // can be found without node collision: calc_index(node1) = calc_index(node2). - // Figure out more proper size or another way to keep track of known nodes. - struct path_node tp[MAX_WALKPATH * MAX_WALKPATH]; - struct path_node *current, *it; - int xs = md->xs - 1; - int ys = md->ys - 1; - int len = 0; - int j; - memset(tp, 0, sizeof(tp)); - - // Start node - i = calc_index(x0, y0); - tp[i].parent = NULL; - tp[i].x = x0; - tp[i].y = y0; - tp[i].g_cost = 0; - tp[i].f_cost = heuristic(x0, y0, x1, y1); - tp[i].flag = SET_OPEN; - - heap_push_node(&open_set, &tp[i]); // Put start node to 'open' set - - for(;;) { - int e = 0; // error flag - - // Saves allowed directions for the current cell. Diagonal directions - // are only allowed if both directions around it are allowed. This is - // to prevent cutting corner of nearby wall. - // For example, you can only go NW from the current cell, if you can - // go N *and* you can go W. Otherwise you need to walk around the - // (corner of the) non-walkable cell. - int allowed_dirs = 0; - - int g_cost; - - if (BHEAP_LENGTH(open_set) == 0) { - BHEAP_CLEAR(open_set); - return false; - } + } + // !(flag&1) + + // A* (A-star) pathfinding + // We always use A* for finding walkpaths because it is what game client uses. + // Easy pathfinding cuts corners of non-walkable cells, but client always walks around it. + + BHEAP_STRUCT_VAR(node_heap, open_set); // 'Open' set + + // FIXME: This array is too small to ensure all paths shorter than MAX_WALKPATH + // can be found without node collision: calc_index(node1) = calc_index(node2). + // Figure out more proper size or another way to keep track of known nodes. + struct path_node tp[MAX_WALKPATH * MAX_WALKPATH]; + struct path_node *current, *it; + int xs = md->xs - 1; + int ys = md->ys - 1; + int len = 0; + int j; + memset(tp, 0, sizeof(tp)); + + // Start node + i = calc_index(x0, y0); + tp[i].parent = NULL; + tp[i].x = x0; + tp[i].y = y0; + tp[i].g_cost = 0; + tp[i].f_cost = heuristic(x0, y0, x1, y1); + tp[i].flag = SET_OPEN; + + heap_push_node(&open_set, &tp[i]); // Put start node to 'open' set + + for(;;) { + int e = 0; // error flag + + // Saves allowed directions for the current cell. Diagonal directions + // are only allowed if both directions around it are allowed. This is + // to prevent cutting corner of nearby wall. + // For example, you can only go NW from the current cell, if you can + // go N *and* you can go W. Otherwise you need to walk around the + // (corner of the) non-walkable cell. + int allowed_dirs = 0; + + int g_cost; + + if (BHEAP_LENGTH(open_set) == 0) { + BHEAP_CLEAR(open_set); + return false; + } - current = BHEAP_PEEK(open_set); // Look for the lowest f_cost node in the 'open' set - BHEAP_POP2(open_set, NODE_MINTOPCMP, swap_ptr); // Remove it from 'open' set + current = BHEAP_PEEK(open_set); // Look for the lowest f_cost node in the 'open' set + BHEAP_POP2(open_set, NODE_MINTOPCMP, swap_ptr); // Remove it from 'open' set - x = current->x; - y = current->y; - g_cost = current->g_cost; + x = current->x; + y = current->y; + g_cost = current->g_cost; - current->flag = SET_CLOSED; // Add current node to 'closed' set + current->flag = SET_CLOSED; // Add current node to 'closed' set - if (x == x1 && y == y1) { - BHEAP_CLEAR(open_set); - break; - } + if (x == x1 && y == y1) { + BHEAP_CLEAR(open_set); + break; + } - if (y < ys && !md->getcellp(md, bl, x, y+1, cell)) allowed_dirs |= DIR_NORTH; - if (y > 0 && !md->getcellp(md, bl, x, y-1, cell)) allowed_dirs |= DIR_SOUTH; - if (x < xs && !md->getcellp(md, bl, x+1, y, cell)) allowed_dirs |= DIR_EAST; - if (x > 0 && !md->getcellp(md, bl, x-1, y, cell)) allowed_dirs |= DIR_WEST; + if (y < ys && !md->getcellp(md, bl, x, y+1, cell)) allowed_dirs |= DIR_NORTH; + if (y > 0 && !md->getcellp(md, bl, x, y-1, cell)) allowed_dirs |= DIR_SOUTH; + if (x < xs && !md->getcellp(md, bl, x+1, y, cell)) allowed_dirs |= DIR_EAST; + if (x > 0 && !md->getcellp(md, bl, x-1, y, cell)) allowed_dirs |= DIR_WEST; #define chk_dir(d) ((allowed_dirs & (d)) == (d)) - // Process neighbors of current node - if (chk_dir(DIR_SOUTH|DIR_EAST) && !md->getcellp(md, bl, x+1, y-1, cell)) - e += add_path(&open_set, tp, x+1, y-1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x+1, y-1, x1, y1)); // (x+1, y-1) 5 - if (chk_dir(DIR_EAST)) - e += add_path(&open_set, tp, x+1, y, g_cost + MOVE_COST, current, heuristic(x+1, y, x1, y1)); // (x+1, y) 6 - if (chk_dir(DIR_NORTH|DIR_EAST) && !md->getcellp(md, bl, x+1, y+1, cell)) - e += add_path(&open_set, tp, x+1, y+1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x+1, y+1, x1, y1)); // (x+1, y+1) 7 - if (chk_dir(DIR_NORTH)) - e += add_path(&open_set, tp, x, y+1, g_cost + MOVE_COST, current, heuristic(x, y+1, x1, y1)); // (x, y+1) 0 - if (chk_dir(DIR_NORTH|DIR_WEST) && !md->getcellp(md, bl, x-1, y+1, cell)) - e += add_path(&open_set, tp, x-1, y+1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x-1, y+1, x1, y1)); // (x-1, y+1) 1 - if (chk_dir(DIR_WEST)) - e += add_path(&open_set, tp, x-1, y, g_cost + MOVE_COST, current, heuristic(x-1, y, x1, y1)); // (x-1, y) 2 - if (chk_dir(DIR_SOUTH|DIR_WEST) && !md->getcellp(md, bl, x-1, y-1, cell)) - e += add_path(&open_set, tp, x-1, y-1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x-1, y-1, x1, y1)); // (x-1, y-1) 3 - if (chk_dir(DIR_SOUTH)) - e += add_path(&open_set, tp, x, y-1, g_cost + MOVE_COST, current, heuristic(x, y-1, x1, y1)); // (x, y-1) 4 + // Process neighbors of current node + if (chk_dir(DIR_SOUTH|DIR_EAST) && !md->getcellp(md, bl, x+1, y-1, cell)) + e += add_path(&open_set, tp, x+1, y-1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x+1, y-1, x1, y1)); // (x+1, y-1) 5 + if (chk_dir(DIR_EAST)) + e += add_path(&open_set, tp, x+1, y, g_cost + MOVE_COST, current, heuristic(x+1, y, x1, y1)); // (x+1, y) 6 + if (chk_dir(DIR_NORTH|DIR_EAST) && !md->getcellp(md, bl, x+1, y+1, cell)) + e += add_path(&open_set, tp, x+1, y+1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x+1, y+1, x1, y1)); // (x+1, y+1) 7 + if (chk_dir(DIR_NORTH)) + e += add_path(&open_set, tp, x, y+1, g_cost + MOVE_COST, current, heuristic(x, y+1, x1, y1)); // (x, y+1) 0 + if (chk_dir(DIR_NORTH|DIR_WEST) && !md->getcellp(md, bl, x-1, y+1, cell)) + e += add_path(&open_set, tp, x-1, y+1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x-1, y+1, x1, y1)); // (x-1, y+1) 1 + if (chk_dir(DIR_WEST)) + e += add_path(&open_set, tp, x-1, y, g_cost + MOVE_COST, current, heuristic(x-1, y, x1, y1)); // (x-1, y) 2 + if (chk_dir(DIR_SOUTH|DIR_WEST) && !md->getcellp(md, bl, x-1, y-1, cell)) + e += add_path(&open_set, tp, x-1, y-1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x-1, y-1, x1, y1)); // (x-1, y-1) 3 + if (chk_dir(DIR_SOUTH)) + e += add_path(&open_set, tp, x, y-1, g_cost + MOVE_COST, current, heuristic(x, y-1, x1, y1)); // (x, y-1) 4 #undef chk_dir - if (e) { - BHEAP_CLEAR(open_set); - return false; - } - } - - for (it = current; it->parent != NULL; it = it->parent, len++); - if (len > (int)sizeof(wpd->path)) { + if (e) { + BHEAP_CLEAR(open_set); return false; } + } - // Recreate path - wpd->path_len = len; - wpd->path_pos = 0; - for (it = current, j = len-1; j >= 0; it = it->parent, j--) { - dx = it->x - it->parent->x; - dy = it->y - it->parent->y; - wpd->path[j] = walk_choices[-dy + 1][dx + 1]; - } - return true; - } // A* end + for (it = current; it->parent != NULL; it = it->parent, len++); + if (len > (int)sizeof(wpd->path)) { + return false; + } - return false; + // Recreate path + wpd->path_len = len; + wpd->path_pos = 0; + for (it = current, j = len-1; j >= 0; it = it->parent, j--) { + dx = it->x - it->parent->x; + dy = it->y - it->parent->y; + wpd->path[j] = walk_choices[-dy + 1][dx + 1]; + } + return true; + // A* end } //Distance functions, taken from http://www.flipcode.com/articles/article_fastdistance.shtml diff --git a/src/map/pc.c b/src/map/pc.c index 66d371a8d50..2b27936865e 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -87,13 +87,13 @@ static struct class_exp_tables exptables; //Converts a class to its array index for CLASS_COUNT defined arrays. //Note that it does not do a validity check for speed purposes, where parsing //player input make sure to use a pc->db_checkid first! -static int pc_class2idx(int class) +static int pc_class2idx(int class_) { - if (class >= JOB_NOVICE_HIGH) { - class += - JOB_NOVICE_HIGH + JOB_MAX_BASIC; + if (class_ >= JOB_NOVICE_HIGH) { + class_ += - JOB_NOVICE_HIGH + JOB_MAX_BASIC; } - Assert_ret(class >= 0 && class < CLASS_COUNT); - return class; + Assert_ret(class_ >= 0 && class_ < CLASS_COUNT); + return class_; } /** @@ -160,7 +160,7 @@ static void pc_setinvincibletimer(struct map_session_data *sd, int val) val += map->list[sd->bl.m].invincible_time_inc; if( sd->invincible_timer != INVALID_TIMER ) - timer->delete(sd->invincible_timer,pc->invincible_timer); + timer->delete_(sd->invincible_timer,pc->invincible_timer); sd->invincible_timer = timer->add(timer->gettick()+val,pc->invincible_timer,sd->bl.id,0); } @@ -170,7 +170,7 @@ static void pc_delinvincibletimer(struct map_session_data *sd) if( sd->invincible_timer != INVALID_TIMER ) { - timer->delete(sd->invincible_timer,pc->invincible_timer); + timer->delete_(sd->invincible_timer,pc->invincible_timer); sd->invincible_timer = INVALID_TIMER; skill->unit_move(&sd->bl,timer->gettick(),1); } @@ -244,7 +244,7 @@ static int pc_addspiritball(struct map_session_data *sd, int interval, int max) if( sd->spiritball && sd->spiritball >= max ) { if(sd->spirit_timer[0] != INVALID_TIMER) - timer->delete(sd->spirit_timer[0],pc->spiritball_timer); + timer->delete_(sd->spirit_timer[0],pc->spiritball_timer); sd->spiritball--; if( sd->spiritball != 0 ) memmove(sd->spirit_timer+0, sd->spirit_timer+1, (sd->spiritball)*sizeof(int)); @@ -293,7 +293,7 @@ static int pc_delspiritball(struct map_session_data *sd, int count, int type) for(i=0;ispirit_timer[i] != INVALID_TIMER) { - timer->delete(sd->spirit_timer[i],pc->spiritball_timer); + timer->delete_(sd->spirit_timer[i],pc->spiritball_timer); sd->spirit_timer[i] = INVALID_TIMER; } } @@ -613,7 +613,7 @@ static int pc_inventory_rental_clear(struct map_session_data *sd) nullpo_ret(sd); if( sd->rental_timer != INVALID_TIMER ) { - timer->delete(sd->rental_timer, pc->inventory_rental_end); + timer->delete_(sd->rental_timer, pc->inventory_rental_end); sd->rental_timer = INVALID_TIMER; } @@ -1000,7 +1000,7 @@ static bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data return false; } - if (!(b_sd->status.class >= JOB_NOVICE && b_sd->status.class <= JOB_THIEF) && b_sd->status.class != JOB_SUPER_NOVICE) + if (!(b_sd->status.class_ >= JOB_NOVICE && b_sd->status.class_ <= JOB_THIEF) && b_sd->status.class_ != JOB_SUPER_NOVICE) return false; return true; @@ -1011,7 +1011,7 @@ static bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *------------------------------------------*/ static bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd) { - int class, joblevel; + int class_, joblevel; uint64 jobexp; if( !pc->can_Adopt(p1_sd, p2_sd, b_sd) ) @@ -1022,8 +1022,8 @@ static bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data joblevel = b_sd->status.job_level; jobexp = b_sd->status.job_exp; - class = pc->mapid2jobid(b_sd->job | JOBL_BABY, b_sd->status.sex); - if (class != -1 && !pc->jobchange(b_sd, class, 0)) { + class_ = pc->mapid2jobid(b_sd->job | JOBL_BABY, b_sd->status.sex); + if (class_ != -1 && !pc->jobchange(b_sd, class_, 0)) { // Success, proceed to configure parents and baby skills p1_sd->status.child = b_sd->status.char_id; p2_sd->status.child = b_sd->status.char_id; @@ -1234,10 +1234,10 @@ static bool pc_authok(struct map_session_data *sd, int login_id2, time_t expirat //Set the map-server used job id. [Skotlex] { - int job = pc->jobid2mapid(sd->status.class); + int job = pc->jobid2mapid(sd->status.class_); if (job == -1) { - ShowError("pc_authok: Invalid class %d for player %s (%d:%d). Class was changed to novice.\n", sd->status.class, sd->status.name, sd->status.account_id, sd->status.char_id); - sd->status.class = JOB_NOVICE; + ShowError("pc_authok: Invalid class %d for player %s (%d:%d). Class was changed to novice.\n", sd->status.class_, sd->status.name, sd->status.account_id, sd->status.char_id); + sd->status.class_ = JOB_NOVICE; sd->job = MAPID_NOVICE; } else { sd->job = job; @@ -1324,7 +1324,7 @@ static bool pc_authok(struct map_session_data *sd, int login_id2, time_t expirat sd->sc.option = sd->status.option; //This is the actual option used in battle. //Set here because we need the inventory data for weapon sprite parsing. - status->set_viewdata(&sd->bl, sd->status.class); + status->set_viewdata(&sd->bl, sd->status.class_); unit->dataset(&sd->bl); sd->guild_x = -1; @@ -1607,13 +1607,13 @@ static int pc_reg_received(struct map_session_data *sd) } if (pc_isinvisible(sd)) { - sd->vd.class = INVISIBLE_CLASS; + sd->vd.class_ = INVISIBLE_CLASS; clif->message(sd->fd, msg_sd(sd, MSGTBL_INVISIBLE_ON)); // Invisible: On // decrement the number of pvp players on the map map->list[sd->bl.m].users_pvp--; if( map->list[sd->bl.m].flag.pvp && !map->list[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER ) {// unregister the player for ranking - timer->delete( sd->pvp_timer, pc->calc_pvprank_timer ); + timer->delete_( sd->pvp_timer, pc->calc_pvprank_timer ); sd->pvp_timer = INVALID_TIMER; } clif->changeoption(&sd->bl); @@ -1686,13 +1686,13 @@ static int pc_calc_skilltree(struct map_session_data *sd) { nullpo_ret(sd); uint32 job = pc->calc_skilltree_normalize_job(sd); - int class = pc->mapid2jobid(job, sd->status.sex); - if (class == -1) { + int class_ = pc->mapid2jobid(job, sd->status.sex); + if (class_ == -1) { //Unable to normalize job?? ShowError("pc_calc_skilltree: Unable to normalize job %u for character %s (%d:%d)\n", job, sd->status.name, sd->status.account_id, sd->status.char_id); return 1; } - int classidx = pc->class2idx(class); + int classidx = pc->class2idx(class_); pc->calc_skilltree_clear(sd); @@ -1843,7 +1843,7 @@ static void pc_calc_skilltree_bonus(struct map_session_data *sd, int classidx) sd->status.skill[idx].flag = SKILL_FLAG_REPLACED_LV_0 + sd->status.skill[idx].lv; // Remember original level } - sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class); + sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class_); } } } @@ -2049,40 +2049,40 @@ static int pc_updateweightstatus(struct map_session_data *sd) return 0; } -static int pc_disguise(struct map_session_data *sd, int class) +static int pc_disguise(struct map_session_data *sd, int class_) { nullpo_ret(sd); - if (class == -1 && sd->disguise == -1) + if (class_ == -1 && sd->disguise == -1) return 0; - if (class >= 0 && sd->disguise == class) + if (class_ >= 0 && sd->disguise == class_) return 0; if (pc_isinvisible(sd)) { //Character is invisible. Stealth class-change. [Skotlex] - sd->disguise = class; //viewdata is set on uncloaking. + sd->disguise = class_; //viewdata is set on uncloaking. return 2; } if (sd->bl.prev != NULL) { - if (class == -1 && sd->disguise == sd->status.class) { + if (class_ == -1 && sd->disguise == sd->status.class_) { clif->clearunit_single(-sd->bl.id,CLR_OUTSIGHT,sd->fd); - } else if (class != sd->status.class) { + } else if (class_ != sd->status.class_) { pc_stop_walking(sd, STOPWALKING_FLAG_NONE); clif->clearunit_area(&sd->bl, CLR_OUTSIGHT); } } - if (class == -1) { + if (class_ == -1) { sd->disguise = -1; - class = sd->status.class; + class_ = sd->status.class_; } else { - sd->disguise = class; + sd->disguise = class_; } - status->set_viewdata(&sd->bl, class); + status->set_viewdata(&sd->bl, class_); clif->changeoption(&sd->bl); // We need to update the client so it knows that a costume is being used if( sd->sc.option&OPTION_COSTUME ) { - clif->changelook(&sd->bl, LOOK_BASE, sd->vd.class); + clif->changelook(&sd->bl, LOOK_BASE, sd->vd.class_); clif->changelook(&sd->bl,LOOK_WEAPON,0); clif->changelook(&sd->bl,LOOK_SHIELD,0); clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color); @@ -2090,7 +2090,7 @@ static int pc_disguise(struct map_session_data *sd, int class) if (sd->bl.prev != NULL) { clif->spawn(&sd->bl); - if (class == sd->status.class && pc_iscarton(sd)) { + if (class_ == sd->status.class_ && pc_iscarton(sd)) { //It seems the cart info is lost on undisguise. clif->cartList(sd); clif->updatestatus(sd,SP_CARTINFO); @@ -2346,7 +2346,7 @@ static int pc_delautobonus(struct map_session_data *sd, struct s_autobonus *auto } else { // Logout / Unequipped an item with an activated bonus - timer->delete(autobonus[i].active,pc->endautobonus); + timer->delete_(autobonus[i].active,pc->endautobonus); autobonus[i].active = INVALID_TIMER; } } @@ -3516,31 +3516,31 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) case SP_SKILL_ATK: if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillatk), i, sd->skillatk[i].id == 0 || sd->skillatk[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillatk), i, sd->skillatk[i].id == 0 || sd->skillatk[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillatk)) { //Better mention this so the array length can be updated. [Skotlex] ShowDebug("script->run: bonus2 bSkillAtk reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillatk), type2, val); break; } - if (sd->skillatk[i].id == type2) + if (sd->skillatk[i].id == (unsigned int)type2) sd->skillatk[i].val += val; else { - sd->skillatk[i].id = type2; + sd->skillatk[i].id = (unsigned int)type2; sd->skillatk[i].val = val; } break; case SP_SKILL_HEAL: if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillheal), i, sd->skillheal[i].id == 0 || sd->skillheal[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillheal), i, sd->skillheal[i].id == 0 || sd->skillheal[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillheal)) { // Better mention this so the array length can be updated. [Skotlex] ShowDebug("script->run: bonus2 bSkillHeal reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillheal), type2, val); break; } - if (sd->skillheal[i].id == type2) + if (sd->skillheal[i].id == (unsigned int)type2) sd->skillheal[i].val += val; else { sd->skillheal[i].id = type2; @@ -3550,14 +3550,14 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) case SP_SKILL_HEAL2: if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillheal2), i, sd->skillheal2[i].id == 0 || sd->skillheal2[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillheal2), i, sd->skillheal2[i].id == 0 || sd->skillheal2[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillheal2)) { // Better mention this so the array length can be updated. [Skotlex] ShowDebug("script->run: bonus2 bSkillHeal2 reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillheal2), type2, val); break; } - if (sd->skillheal2[i].id == type2) + if (sd->skillheal2[i].id == (unsigned int)type2) sd->skillheal2[i].val += val; else { sd->skillheal2[i].id = type2; @@ -3567,14 +3567,14 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) case SP_ADD_SKILL_BLOW: if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillblown), i, sd->skillblown[i].id == 0 || sd->skillblown[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillblown), i, sd->skillblown[i].id == 0 || sd->skillblown[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillblown)) { //Better mention this so the array length can be updated. [Skotlex] ShowDebug("script->run: bonus2 bSkillBlown reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillblown), type2, val); break; } - if(sd->skillblown[i].id == type2) + if(sd->skillblown[i].id == (unsigned int)type2) sd->skillblown[i].val += val; else { sd->skillblown[i].id = type2; @@ -3587,7 +3587,7 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) case SP_CASTRATE: if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast[i].id == 0 || sd->skillcast[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast[i].id == 0 || sd->skillcast[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillcast)) { //Better mention this so the array length can be updated. [Skotlex] ShowDebug("script->run: bonus2 %s reached its limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", @@ -3595,7 +3595,7 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) ARRAYLENGTH(sd->skillcast), type2, val); break; } - if(sd->skillcast[i].id == type2) + if(sd->skillcast[i].id == (unsigned int)type2) sd->skillcast[i].val += val; else { sd->skillcast[i].id = type2; @@ -3607,7 +3607,7 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillfixcastrate), i, sd->skillfixcastrate[i].id == 0 || sd->skillfixcastrate[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillfixcastrate), i, sd->skillfixcastrate[i].id == 0 || sd->skillfixcastrate[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillfixcastrate)) { ShowDebug("script->run: bonus2 bFixedCastrate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", @@ -3615,7 +3615,7 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) break; } - if(sd->skillfixcastrate[i].id == type2) + if(sd->skillfixcastrate[i].id == (unsigned int)type2) sd->skillfixcastrate[i].val -= val; else { @@ -3800,13 +3800,13 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) case SP_SKILL_USE_SP_RATE: //bonus2 bSkillUseSPrate,n,x; if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillusesprate), i, sd->skillusesprate[i].id == 0 || sd->skillusesprate[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillusesprate), i, sd->skillusesprate[i].id == 0 || sd->skillusesprate[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillusesprate)) { ShowDebug("script->run: bonus2 bSkillUseSPrate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillusesprate), type2, val); break; } - if (sd->skillusesprate[i].id == type2) + if (sd->skillusesprate[i].id == (unsigned int)type2) sd->skillusesprate[i].val += val; else { sd->skillusesprate[i].id = type2; @@ -3816,13 +3816,13 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) case SP_SKILL_COOLDOWN: if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillcooldown), i, sd->skillcooldown[i].id == 0 || sd->skillcooldown[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillcooldown), i, sd->skillcooldown[i].id == 0 || sd->skillcooldown[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillcooldown)) { ShowDebug("script->run: bonus2 bSkillCoolDown reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillcooldown), type2, val); break; } - if (sd->skillcooldown[i].id == type2) + if (sd->skillcooldown[i].id == (unsigned int)type2) sd->skillcooldown[i].val += val; else { sd->skillcooldown[i].id = type2; @@ -3832,13 +3832,13 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) case SP_SKILL_FIXEDCAST: if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillfixcast), i, sd->skillfixcast[i].id == 0 || sd->skillfixcast[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillfixcast), i, sd->skillfixcast[i].id == 0 || sd->skillfixcast[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillfixcast)) { ShowDebug("script->run: bonus2 bSkillFixedCast reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillfixcast), type2, val); break; } - if (sd->skillfixcast[i].id == type2) + if (sd->skillfixcast[i].id == (unsigned int)type2) sd->skillfixcast[i].val += val; else { sd->skillfixcast[i].id = type2; @@ -3848,13 +3848,13 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) case SP_SKILL_VARIABLECAST: if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillvarcast), i, sd->skillvarcast[i].id == 0 || sd->skillvarcast[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillvarcast), i, sd->skillvarcast[i].id == 0 || sd->skillvarcast[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillvarcast)) { ShowDebug("script->run: bonus2 bSkillVariableCast reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillvarcast), type2, val); break; } - if (sd->skillvarcast[i].id == type2) + if (sd->skillvarcast[i].id == (unsigned int)type2) sd->skillvarcast[i].val += val; else { sd->skillvarcast[i].id = type2; @@ -3865,13 +3865,13 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) case SP_VARCASTRATE: if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast[i].id == 0 || sd->skillcast[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast[i].id == 0 || sd->skillcast[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillcast)) { ShowDebug("script->run: bonus2 bVariableCastrate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillcast), type2, val); break; } - if(sd->skillcast[i].id == type2) + if(sd->skillcast[i].id == (unsigned int)type2) sd->skillcast[i].val -= val; else { sd->skillcast[i].id = type2; @@ -3882,13 +3882,13 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) case SP_SKILL_USE_SP: //bonus2 bSkillUseSP,n,x; if(sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->skillusesp), i, sd->skillusesp[i].id == 0 || sd->skillusesp[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->skillusesp), i, sd->skillusesp[i].id == 0 || sd->skillusesp[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->skillusesp)) { ShowDebug("script->run: bonus2 bSkillUseSP reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillusesp), type2, val); break; } - if (sd->skillusesp[i].id == type2) + if (sd->skillusesp[i].id == (unsigned int)type2) sd->skillusesp[i].val += val; else { sd->skillusesp[i].id = type2; @@ -3924,13 +3924,13 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) case SP_SUB_SKILL: if (sd->state.lr_flag == 2) break; - ARR_FIND(0, ARRAYLENGTH(sd->subskill), i, sd->subskill[i].id == 0 || sd->subskill[i].id == type2); + ARR_FIND(0, ARRAYLENGTH(sd->subskill), i, sd->subskill[i].id == 0 || sd->subskill[i].id == (unsigned int)type2); if (i == ARRAYLENGTH(sd->subskill)) { ShowDebug("script->run: bonus2 bSubSkill reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->subskill), type2, val); break; } - if (sd->subskill[i].id == type2) { + if (sd->subskill[i].id == (unsigned int)type2) { sd->subskill[i].val += val; } else { sd->subskill[i].id = type2; @@ -6084,7 +6084,7 @@ static int pc_setpos(struct map_session_data *sd, unsigned short map_index, int struct status_change_entry *sce = sd->sc.data[SC_KNOWLEDGE]; if (sce->timer != INVALID_TIMER) - timer->delete(sce->timer, status->change_timer); + timer->delete_(sce->timer, status->change_timer); sce->timer = timer->add(timer->gettick() + skill->get_time(SG_KNOWLEDGE, sce->val1), status->change_timer, sd->bl.id, SC_KNOWLEDGE); @@ -6427,9 +6427,9 @@ int pc_get_skill_cooldown(struct map_session_data *sd, uint16 skill_id, uint16 s * Convert's from the client's lame Job ID system * to the map server's 'makes sense' system. [Skotlex] *------------------------------------------*/ -static int pc_jobid2mapid(int class) +static int pc_jobid2mapid(int class_) { - switch (class) { + switch (class_) { case JOB_KAGEROU: case JOB_OBORO: return MAPID_KAGEROUOBORO; case JOB_CLOWN: @@ -6458,9 +6458,9 @@ static int pc_jobid2mapid(int class) } //Reverts the map-style class id to the client-style one. -static int pc_mapid2jobid(unsigned int class, int sex) +static int pc_mapid2jobid(unsigned int class_, int sex) { - switch (class) { + switch (class_) { case MAPID_KAGEROUOBORO: return sex ? JOB_KAGEROU : JOB_OBORO; case MAPID_BARDDANCER: return sex ? JOB_BARD : JOB_DANCER; case MAPID_CLOWNGYPSY: return sex ? JOB_CLOWN : JOB_GYPSY; @@ -6480,9 +6480,9 @@ static int pc_mapid2jobid(unsigned int class, int sex) /*==================================================== * This function return the name of the job (by [Yor]) *----------------------------------------------------*/ -static const char *pc_job_name(int class) +static const char *pc_job_name(int class_) { - switch (class) { + switch (class_) { #define JOB_ENUM_VALUE(name, id, msgtbl) case JOB_ ## name: return msg_txt(MSGTBL_ ## msgtbl); #include "common/class.h" #include "common/class_hidden.h" @@ -6686,7 +6686,7 @@ static int pc_stop_following(struct map_session_data *sd) nullpo_ret(sd); if (sd->followtimer != INVALID_TIMER) { - timer->delete(sd->followtimer,pc->follow_timer); + timer->delete_(sd->followtimer,pc->follow_timer); sd->followtimer = INVALID_TIMER; } sd->followtarget = -1; @@ -6905,8 +6905,8 @@ static void pc_calcexp(struct map_session_data *sd, uint64 *base_exp, uint64 *jo bexp += apply_percentrate64(bexp, buff_ratio, 100); jexp += apply_percentrate64(jexp, buff_ratio + buff_job_ratio, 100); - *job_exp = cap_value(jexp, 1, UINT64_MAX); - *base_exp = cap_value(bexp, 1, UINT64_MAX); + *job_exp = cap_value(jexp, 1, INT64_MAX); + *base_exp = cap_value(bexp, 1, INT64_MAX); } /** @@ -7014,7 +7014,7 @@ static int pc_maxbaselv(const struct map_session_data *sd) { nullpo_ret(sd); - const struct class_exp_group *group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class)][CLASS_EXP_TABLE_BASE]; + const struct class_exp_group *group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class_)][CLASS_EXP_TABLE_BASE]; nullpo_ret(group); return group->max_level; } @@ -7023,7 +7023,7 @@ static int pc_maxjoblv(const struct map_session_data *sd) { nullpo_ret(sd); - const struct class_exp_group *group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class)][CLASS_EXP_TABLE_JOB]; + const struct class_exp_group *group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class_)][CLASS_EXP_TABLE_JOB]; nullpo_ret(group); return group->max_level; } @@ -7042,7 +7042,7 @@ static uint64 pc_nextbaseexp(const struct map_session_data *sd) if (sd->status.base_level >= pc->maxbaselv(sd) || sd->status.base_level <= 0) return 0; - exp_group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class)][CLASS_EXP_TABLE_BASE]; + exp_group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class_)][CLASS_EXP_TABLE_BASE]; nullpo_ret(exp_group); @@ -7059,7 +7059,7 @@ static uint64 pc_thisbaseexp(const struct map_session_data *sd) if (sd->status.base_level > pc->maxbaselv(sd) || sd->status.base_level <= 1) return 0; - exp_group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class)][CLASS_EXP_TABLE_BASE]; + exp_group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class_)][CLASS_EXP_TABLE_BASE]; nullpo_ret(exp_group); @@ -7083,7 +7083,7 @@ static uint64 pc_nextjobexp(const struct map_session_data *sd) if (sd->status.job_level >= pc->maxjoblv(sd) || sd->status.job_level <= 0) return 0; - exp_group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class)][CLASS_EXP_TABLE_JOB]; + exp_group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class_)][CLASS_EXP_TABLE_JOB]; nullpo_ret(exp_group); @@ -7100,7 +7100,7 @@ static uint64 pc_thisjobexp(const struct map_session_data *sd) if (sd->status.job_level > pc->maxjoblv(sd) || sd->status.job_level <= 1) return 0; - exp_group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class)][CLASS_EXP_TABLE_JOB]; + exp_group = pc->dbs->class_exp_table[pc->class2idx(sd->status.class_)][CLASS_EXP_TABLE_JOB]; nullpo_ret(exp_group); @@ -7339,7 +7339,7 @@ static int pc_skillup(struct map_session_data *sd, uint16 skill_id) if( sd->status.skill_point > 0 && sd->status.skill[index].id && sd->status.skill[index].flag == SKILL_FLAG_PERMANENT && //Don't allow raising while you have granted skills. [Skotlex] - sd->status.skill[index].lv < skill->tree_get_max(skill_id, sd->status.class) ) + sd->status.skill[index].lv < skill->tree_get_max(skill_id, sd->status.class_) ) { sd->status.skill[index].lv++; sd->status.skill_point--; @@ -7407,8 +7407,8 @@ static int pc_allskillup(struct map_session_data *sd) } } else { int id; - for (i = 0; i < MAX_SKILL_TREE && (id=pc->skill_tree[pc->class2idx(sd->status.class)][i].id) > 0; i++) { - int idx = pc->skill_tree[pc->class2idx(sd->status.class)][i].idx; + for (i = 0; i < MAX_SKILL_TREE && (id=pc->skill_tree[pc->class2idx(sd->status.class_)][i].id) > 0; i++) { + int idx = pc->skill_tree[pc->class2idx(sd->status.class_)][i].idx; int inf2 = skill->dbs->db[idx].inf2; if ( (inf2&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) || @@ -7418,7 +7418,7 @@ static int pc_allskillup(struct map_session_data *sd) continue; //Cannot be learned normally. sd->status.skill[idx].id = id; - sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class); // celest + sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class_); // celest } } status_calc_pc(sd,SCO_NONE); @@ -7455,7 +7455,7 @@ static int pc_resetlvl(struct map_session_data *sd, int type) sd->status.int_=1; sd->status.dex=1; sd->status.luk=1; - if (sd->status.class == JOB_NOVICE_HIGH) { + if (sd->status.class_ == JOB_NOVICE_HIGH) { sd->status.status_point=100; // not 88 [celest] // give platinum skills upon changing pc->skill(sd, NV_FIRSTAID, 1, SKILL_GRANT_PERMANENT); @@ -7587,7 +7587,7 @@ static int pc_resetstate(struct map_session_data *sd) *------------------------------------------*/ static int pc_resetskill(struct map_session_data *sd, int flag) { - int i, inf2, skill_point=0; + int inf2, skill_point=0; nullpo_ret(sd); if (flag&PCRESETSKILL_CHSEX && (sd->job & MAPID_UPPERMASK) != MAPID_BARDDANCER) @@ -7603,28 +7603,29 @@ static int pc_resetskill(struct map_session_data *sd, int flag) if( pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd) ) //Remove perma blindness due to skill-reset. [Skotlex] clif->sc_end(&sd->bl, sd->bl.id, SELF, status->get_sc_icon(SC_DEVIL1)); - i = sd->sc.option; - if( i&OPTION_RIDING && pc->checkskill(sd, KN_RIDING) ) - i &= ~OPTION_RIDING; - if( i&OPTION_FALCON && pc->checkskill(sd, HT_FALCON) ) - i &= ~OPTION_FALCON; - if( i&OPTION_DRAGON && pc->checkskill(sd, RK_DRAGONTRAINING) ) - i &= ~OPTION_DRAGON; - if( i&OPTION_WUG && pc->checkskill(sd, RA_WUGMASTERY) ) - i &= ~OPTION_WUG; - if( i&OPTION_WUGRIDER && pc->checkskill(sd, RA_WUGRIDER) ) - i &= ~OPTION_WUGRIDER; - if (i&OPTION_MADOGEAR && (sd->job & MAPID_THIRDMASK) == MAPID_MECHANIC) - i &= ~OPTION_MADOGEAR; + + unsigned int options = sd->sc.option; + if (options&OPTION_RIDING && pc->checkskill(sd, KN_RIDING)) + options &= ~OPTION_RIDING; + if (options&OPTION_FALCON && pc->checkskill(sd, HT_FALCON)) + options &= ~OPTION_FALCON; + if (options&OPTION_DRAGON && pc->checkskill(sd, RK_DRAGONTRAINING)) + options &= ~OPTION_DRAGON; + if (options&OPTION_WUG && pc->checkskill(sd, RA_WUGMASTERY)) + options &= ~OPTION_WUG; + if (options&OPTION_WUGRIDER && pc->checkskill(sd, RA_WUGRIDER)) + options &= ~OPTION_WUGRIDER; + if (options&OPTION_MADOGEAR && (sd->job & MAPID_THIRDMASK) == MAPID_MECHANIC) + options &= ~OPTION_MADOGEAR; #ifndef NEW_CARTS - if( i&OPTION_CART && pc->checkskill(sd, MC_PUSHCART) ) - i &= ~OPTION_CART; + if (options&OPTION_CART && pc->checkskill(sd, MC_PUSHCART)) + options &= ~OPTION_CART; #else if( sd->sc.data[SC_PUSH_CART] ) pc->setcart(sd, 0); #endif - if( i != sd->sc.option ) - pc->setoption(sd, i); + if( options != sd->sc.option ) + pc->setoption(sd, options); if( homun_alive(sd->hd) && pc->checkskill(sd, AM_CALLHOMUN) ) homun->vaporize(sd, HOM_ST_REST, true); @@ -7633,7 +7634,7 @@ static int pc_resetskill(struct map_session_data *sd, int flag) status_change_end(&sd->bl, SC_SPRITEMABLE, INVALID_TIMER); } - for (i = 1; i < MAX_SKILL_DB; i++) { + for (int i = 1; i < MAX_SKILL_DB; i++) { int lv = sd->status.skill[i].lv; if (lv < 1) continue; @@ -8369,7 +8370,7 @@ static int64 pc_readparam(const struct map_session_data *sd, int type) case SP_BANKVAULT: val = sd->status.bank_vault; break; case SP_BASELEVEL: val = sd->status.base_level; break; case SP_JOBLEVEL: val = sd->status.job_level; break; - case SP_CLASS: val = sd->status.class; break; + case SP_CLASS: val = sd->status.class_; break; case SP_BASEJOB: val = pc->mapid2jobid(sd->job & MAPID_UPPERMASK, sd->status.sex); break; //Base job, extracting upper type. case SP_UPPER: val = (sd->job & JOBL_UPPER) != 0 ? 1 : ((sd->job & JOBL_BABY) != 0 ? 2 : 0); break; case SP_BASECLASS: val = pc->mapid2jobid(sd->job & MAPID_BASEMASK, sd->status.sex); break; //Extract base class tree. [Skotlex] @@ -8861,18 +8862,18 @@ static int jobchange_killclone(struct block_list *bl, va_list ap) * Called when player changes job * Rewrote to make it tidider [Celest] *------------------------------------------*/ -static int pc_jobchange(struct map_session_data *sd, int class, int upper) +static int pc_jobchange(struct map_session_data *sd, int class_, int upper) { int i, fame_flag=0; int job = 0; nullpo_ret(sd); - if (class < 0) + if (class_ < 0) return 1; //Normalize job. - job = pc->jobid2mapid(class); + job = pc->jobid2mapid(class_); if (job == -1) return 1; switch (upper) { @@ -8885,8 +8886,8 @@ static int pc_jobchange(struct map_session_data *sd, int class, int upper) } //This will automatically adjust bard/dancer classes to the correct gender //That is, if you try to jobchange into dancer, it will turn you to bard. - class = pc->mapid2jobid(job, sd->status.sex); - if (class == -1) + class_ = pc->mapid2jobid(job, sd->status.sex); + if (class_ == -1) return 1; if ((uint16)job == sd->job) @@ -8907,7 +8908,7 @@ static int pc_jobchange(struct map_session_data *sd, int class, int upper) pc->clear_existing_reproduceskill(sd, true); if ((job & MAPID_UPPERMASK) != (sd->job & MAPID_UPPERMASK)) { //Things to remove when changing class tree. - const int class_idx = pc->class2idx(sd->status.class); + const int class_idx = pc->class2idx(sd->status.class_); short id; for (i = 0; i < MAX_SKILL_TREE && (id = pc->skill_tree[class_idx][i].id) > 0; i++) { //Remove status specific to your current tree skills. @@ -8922,7 +8923,7 @@ static int pc_jobchange(struct map_session_data *sd, int class, int upper) pc->resetfeel(sd); } - sd->status.class = class; + sd->status.class_ = class_; { int fame_list_type = pc->famelist_type(sd->job); if (fame_list_type != RANKTYPE_UNKNOWN) @@ -8964,8 +8965,8 @@ static int pc_jobchange(struct map_session_data *sd, int class, int upper) clif->changelook(&sd->bl, LOOK_BODY2, sd->vd.body_style); } - status->set_viewdata(&sd->bl, class); - clif->changelook(&sd->bl, LOOK_BASE, sd->vd.class); // move sprite update to prevent client crashes with incompatible equipment [Valaris] + status->set_viewdata(&sd->bl, class_); + clif->changelook(&sd->bl, LOOK_BASE, sd->vd.class_); // move sprite update to prevent client crashes with incompatible equipment [Valaris] if(sd->vd.cloth_color) clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color); if (sd->vd.body_style) @@ -8982,28 +8983,28 @@ static int pc_jobchange(struct map_session_data *sd, int class, int upper) map->foreachinmap(pc->jobchange_killclone, sd->bl.m, BL_MOB, sd->bl.id); //Remove peco/cart/falcon - i = sd->sc.option; - if (i&OPTION_RIDING && (!pc->checkskill(sd, KN_RIDING) || (sd->job & MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT)) - i&=~OPTION_RIDING; - if( i&OPTION_FALCON && !pc->checkskill(sd, HT_FALCON) ) - i&=~OPTION_FALCON; - if( i&OPTION_DRAGON && !pc->checkskill(sd,RK_DRAGONTRAINING) ) - i&=~OPTION_DRAGON; - if( i&OPTION_WUGRIDER && !pc->checkskill(sd,RA_WUGMASTERY) ) - i&=~OPTION_WUGRIDER; - if( i&OPTION_WUG && !pc->checkskill(sd,RA_WUGMASTERY) ) - i&=~OPTION_WUG; - if( i&OPTION_MADOGEAR ) //You do not need a skill for this. - i&=~OPTION_MADOGEAR; + unsigned int options = sd->sc.option; + if (options&OPTION_RIDING && (!pc->checkskill(sd, KN_RIDING) || (sd->job & MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT)) + options &= ~OPTION_RIDING; + if (options&OPTION_FALCON && !pc->checkskill(sd, HT_FALCON)) + options &= ~OPTION_FALCON; + if (options&OPTION_DRAGON && !pc->checkskill(sd,RK_DRAGONTRAINING)) + options &= ~OPTION_DRAGON; + if (options&OPTION_WUGRIDER && !pc->checkskill(sd,RA_WUGMASTERY)) + options &= ~OPTION_WUGRIDER; + if (options&OPTION_WUG && !pc->checkskill(sd,RA_WUGMASTERY)) + options &= ~OPTION_WUG; + if (options&OPTION_MADOGEAR) //You do not need a skill for this. + options &= ~OPTION_MADOGEAR; #ifndef NEW_CARTS - if( i&OPTION_CART && !pc->checkskill(sd, MC_PUSHCART) ) - i&=~OPTION_CART; + if (options&OPTION_CART && !pc->checkskill(sd, MC_PUSHCART)) + options &= ~OPTION_CART; #else if( sd->sc.data[SC_PUSH_CART] && !pc->checkskill(sd, MC_PUSHCART) ) pc->setcart(sd, 0); #endif - if(i != sd->sc.option) - pc->setoption(sd, i); + if (options != sd->sc.option) + pc->setoption(sd, options); if(homun_alive(sd->hd) && !pc->checkskill(sd, AM_CALLHOMUN)) homun->vaporize(sd, HOM_ST_REST, true); @@ -9068,7 +9069,7 @@ static int pc_changelook(struct map_session_data *sd, int type, int val) switch(type){ case LOOK_BASE: status->set_viewdata(&sd->bl, val); - clif->changelook(&sd->bl, LOOK_BASE, sd->vd.class); + clif->changelook(&sd->bl, LOOK_BASE, sd->vd.class_); clif->changelook(&sd->bl, LOOK_WEAPON, sd->status.look.weapon); if (sd->vd.cloth_color) clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color); @@ -9144,7 +9145,7 @@ static void pc_hide(struct map_session_data *sd, bool show_msg) clif->clearunit_area(&sd->bl, CLR_OUTSIGHT); sd->sc.option |= OPTION_INVISIBLE; - sd->vd.class = INVISIBLE_CLASS; + sd->vd.class_ = INVISIBLE_CLASS; if (show_msg) clif->message(sd->fd, atcommand->msgsd(sd, 11)); // Invisible: On @@ -9154,7 +9155,7 @@ static void pc_hide(struct map_session_data *sd, bool show_msg) if (map->list[sd->bl.m].flag.pvp != 0 && map->list[sd->bl.m].flag.pvp_nocalcrank == 0 && sd->pvp_timer != INVALID_TIMER) { // Unregister the player for ranking. - timer->delete(sd->pvp_timer, pc->calc_pvprank_timer); + timer->delete_(sd->pvp_timer, pc->calc_pvprank_timer); sd->pvp_timer = INVALID_TIMER; } @@ -9177,7 +9178,7 @@ static void pc_unhide(struct map_session_data *sd, bool show_msg) if (sd->disguise != -1) status->set_viewdata(&sd->bl, sd->disguise); else - status->set_viewdata(&sd->bl, sd->status.class); + status->set_viewdata(&sd->bl, sd->status.class_); if (show_msg) clif->message(sd->fd, atcommand->msgsd(sd, 10)); // Invisible: Off @@ -9286,8 +9287,8 @@ static int pc_setoption(struct map_session_data *sd, int type) return 0; //Disguises break sprite changes if (new_look < 0) { //Restore normal look. - status->set_viewdata(&sd->bl, sd->status.class); - new_look = sd->vd.class; + status->set_viewdata(&sd->bl, sd->status.class_); + new_look = sd->vd.class_; } pc_stop_attack(sd); //Stop attacking on new view change (to prevent wedding/santa attacks. @@ -9873,7 +9874,7 @@ static int pc_deleventtimer(struct map_session_data *sd, const char *name) if( i == MAX_EVENTTIMER ) return 0; // not found - timer->delete(sd->eventtimer[i],pc->eventtimer); + timer->delete_(sd->eventtimer[i],pc->eventtimer); sd->eventtimer[i] = INVALID_TIMER; sd->eventcount--; aFree(p); @@ -9915,7 +9916,7 @@ static int pc_cleareventtimer(struct map_session_data *sd) for(i=0;ieventtimer[i] != INVALID_TIMER ){ char *p = (char *)(timer->get(sd->eventtimer[i])->data); - timer->delete(sd->eventtimer[i],pc->eventtimer); + timer->delete_(sd->eventtimer[i],pc->eventtimer); sd->eventtimer[i] = INVALID_TIMER; sd->eventcount--; if (p) aFree(p); @@ -10835,10 +10836,10 @@ static int pc_calc_pvprank(struct map_session_data *sd) { nullpo_ret(sd); struct map_data *m = &map->list[sd->bl.m]; - int old = sd->pvp_rank; + unsigned int old = sd->pvp_rank; sd->pvp_rank = 1; map->foreachinmap(pc->calc_pvprank_sub, sd->bl.m, BL_PC, sd); - if (old != sd->pvp_rank || sd->pvp_lastusers != m->users_pvp) { + if (old != sd->pvp_rank || sd->pvp_lastusers != (unsigned int)m->users_pvp) { sd->pvp_lastusers = m->users_pvp; clif->pvpset(sd, sd->pvp_rank, sd->pvp_lastusers, 0); } @@ -11013,7 +11014,7 @@ static void pc_bleeding(struct map_session_data *sd, unsigned int diff_tick) hp += sd->hp_loss.value; sd->hp_loss.tick -= sd->hp_loss.rate; } - if(hp >= sd->battle_status.hp) + if((unsigned int)hp >= sd->battle_status.hp) hp = sd->battle_status.hp-1; //Script drains cannot kill you. } @@ -11120,7 +11121,7 @@ static int pc_autosave(int tid, int64 tick, int id, intptr_t data) static int pc_daynight_timer_sub(struct map_session_data *sd, va_list ap) { nullpo_ret(sd); - if (sd->state.night != map->night_flag && map->list[sd->bl.m].flag.nightenabled) { //Night/day state does not match. + if (sd->state.night != (unsigned int)map->night_flag && map->list[sd->bl.m].flag.nightenabled) { //Night/day state does not match. clif->status_change(&sd->bl, status->get_sc_icon(SC_SKE), status->get_sc_relevant_bl_types(SC_SKE), map->night_flag, 0, 0, 0, 0); //New night effect by dynamix [Skotlex] sd->state.night = map->night_flag; return 1; @@ -11305,7 +11306,7 @@ static void pc_add_charm(struct map_session_data *sd, int interval, int max, enu if (sd->charm_count && sd->charm_count >= max) { if (sd->charm_timer[0] != INVALID_TIMER) - timer->delete(sd->charm_timer[0],pc->charm_timer); + timer->delete_(sd->charm_timer[0],pc->charm_timer); sd->charm_count--; if (sd->charm_count != 0) memmove(sd->charm_timer+0, sd->charm_timer+1, sd->charm_count*sizeof(int)); @@ -11354,7 +11355,7 @@ static void pc_del_charm(struct map_session_data *sd, int count, enum spirit_cha for (i = 0; i < count; i++) { if(sd->charm_timer[i] != INVALID_TIMER) { - timer->delete(sd->charm_timer[i],pc->charm_timer); + timer->delete_(sd->charm_timer[i],pc->charm_timer); sd->charm_timer[i] = INVALID_TIMER; } } @@ -11747,12 +11748,13 @@ static void pc_read_level_penalty_db(void) static bool pc_read_exp_db_sub_class(struct config_setting_t *t, bool base) { - struct class_exp_group entry = { { 0 } }; + struct class_exp_group entry; struct config_setting_t *exp_t = NULL; int maxlv = 0; nullpo_retr(false, t); + memset(&entry, 0x0, sizeof(entry)); safestrncpy(entry.name, config_setting_name(t), SCRIPT_VARNAME_LENGTH); if (libconfig->setting_lookup_int(t, "MaxLevel", &maxlv) == 0 @@ -12312,7 +12314,7 @@ static void pc_autotrade_start(struct map_session_data *sd) if( amount ) { sd->vending[count].index = i; sd->vending[count].amount = amount; - sd->vending[count].value = cap_value(price, 0, (unsigned int)battle_config.vending_max_value); + sd->vending[count].value = cap_value(price, 0, battle_config.vending_max_value); count++; } @@ -12499,16 +12501,16 @@ static void pc_update_idle_time(struct map_session_data *sd, enum e_battle_confi //Checks if the given class value corresponds to a player class. [Skotlex] //JOB_NOVICE isn't checked for class is supposed to be unsigned -static bool pc_db_checkid(int class) -{ - return class < JOB_MAX_BASIC - || (class >= JOB_NOVICE_HIGH && class <= JOB_DARK_COLLECTOR ) - || (class >= JOB_RUNE_KNIGHT && class <= JOB_MECHANIC_T2 ) - || (class >= JOB_BABY_RUNE && class <= JOB_BABY_MECHANIC2 ) - || (class >= JOB_SUPER_NOVICE_E && class <= JOB_SUPER_BABY_E ) - || (class >= JOB_KAGEROU && class <= JOB_OBORO ) - || (class == JOB_REBELLION) - || (class >= JOB_SUMMONER && class < JOB_MAX ); +static bool pc_db_checkid(int class_) +{ + return class_ < JOB_MAX_BASIC + || (class_ >= JOB_NOVICE_HIGH && class_ <= JOB_DARK_COLLECTOR ) + || (class_ >= JOB_RUNE_KNIGHT && class_ <= JOB_MECHANIC_T2 ) + || (class_ >= JOB_BABY_RUNE && class_ <= JOB_BABY_MECHANIC2 ) + || (class_ >= JOB_SUPER_NOVICE_E && class_ <= JOB_SUPER_BABY_E ) + || (class_ >= JOB_KAGEROU && class_ <= JOB_OBORO ) + || (class_ == JOB_REBELLION) + || (class_ >= JOB_SUMMONER && class_ < JOB_MAX ); } /** diff --git a/src/map/pc.h b/src/map/pc.h index dbca1932a61..6a89f8e1c2a 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -758,12 +758,12 @@ END_ZEROED_BLOCK; #define pc_isfalcon(sd) ( (sd)->sc.option&OPTION_FALCON ) #define pc_isinvisible(sd) ( (sd)->sc.option&OPTION_INVISIBLE ) -#define pc_overhealweightrate(sd) ( status->dbs->unit_params[pc->class2idx((sd)->status.class)]->natural_heal_weight_rate ) -#define pc_isoverhealweight(sd) ( (sd)->weight * 100 >= (sd)->max_weight * status->dbs->unit_params[pc->class2idx((sd)->status.class)]->natural_heal_weight_rate ) +#define pc_overhealweightrate(sd) ( status->dbs->unit_params[pc->class2idx((sd)->status.class_)]->natural_heal_weight_rate ) +#define pc_isoverhealweight(sd) ( (sd)->weight * 100 >= (sd)->max_weight * status->dbs->unit_params[pc->class2idx((sd)->status.class_)]->natural_heal_weight_rate ) #define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 ) -#define pc_maxhp_cap(sd) ( status->get_maxhp_cap_entry(pc->class2idx((sd)->status.class), (sd)->status.base_level)->value ) -#define pc_max_aspd(sd) ( status->dbs->unit_params[pc->class2idx((sd)->status.class)]->max_aspd ) -#define pc_maxstats(sd) ( status->dbs->unit_params[pc->class2idx((sd)->status.class)]->max_stats ) +#define pc_maxhp_cap(sd) ( status->get_maxhp_cap_entry(pc->class2idx((sd)->status.class_), (sd)->status.base_level)->value ) +#define pc_max_aspd(sd) ( status->dbs->unit_params[pc->class2idx((sd)->status.class_)]->max_aspd ) +#define pc_maxstats(sd) ( status->dbs->unit_params[pc->class2idx((sd)->status.class_)]->max_stats ) /// Generic check for mounts #define pc_hasmount(sd) ( (sd)->sc.option&(OPTION_RIDING|OPTION_WUGRIDER|OPTION_DRAGON|OPTION_MADOGEAR) ) /// Knight classes Peco / Gryphon @@ -980,7 +980,7 @@ END_ZEROED_BLOCK; /* End */ void (*final) (void); struct map_session_data* (*get_dummy_sd) (void); - int (*class2idx) (int class); + int (*class2idx) (int class_); bool (*can_talk) (struct map_session_data *sd); bool (*can_attack) ( struct map_session_data *sd, int target_id ); @@ -1120,7 +1120,7 @@ END_ZEROED_BLOCK; /* End */ void (*heal) (struct map_session_data *sd,unsigned int hp,unsigned int sp, int type); int (*itemheal) (struct map_session_data *sd,int itemid, int hp,int sp); int (*percentheal) (struct map_session_data *sd,int hp,int sp); - int (*jobchange) (struct map_session_data *sd, int class, int upper); + int (*jobchange) (struct map_session_data *sd, int class_, int upper); void (*hide) (struct map_session_data *sd, bool show_msg); void (*unhide) (struct map_session_data *sd, bool show_msg); int (*setoption) (struct map_session_data *sd,int type); @@ -1167,10 +1167,10 @@ END_ZEROED_BLOCK; /* End */ void (*setstand) (struct map_session_data *sd); int (*candrop) (struct map_session_data *sd,struct item *item); - int (*jobid2mapid) (int class); // Skotlex + int (*jobid2mapid) (int class_); // Skotlex int (*mapid2jobid) (unsigned int class_, int sex); // Skotlex - const char * (*job_name) (int class); + const char * (*job_name) (int class_); void (*setinvincibletimer) (struct map_session_data* sd, int val); void (*delinvincibletimer) (struct map_session_data* sd); @@ -1204,7 +1204,7 @@ END_ZEROED_BLOCK; /* End */ int (*inventory_rental_clear) (struct map_session_data *sd); void (*inventory_rental_add) (struct map_session_data *sd, int seconds); - int (*disguise) (struct map_session_data *sd, int class); + int (*disguise) (struct map_session_data *sd, int class_); bool (*isautolooting) (struct map_session_data *sd, int nameid); void (*overheat) (struct map_session_data *sd, int val); @@ -1263,7 +1263,7 @@ END_ZEROED_BLOCK; /* End */ int (*global_expiration_timer) (int tid, int64 tick, int id, intptr_t data); void (*expire_check) (struct map_session_data *sd); - bool (*db_checkid) (int class); + bool (*db_checkid) (int class_); void (*validate_levels) (void); void (*update_job_and_level) (struct map_session_data *sd); diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c index 4d23048eca3..d0143baa44e 100644 --- a/src/map/pc_groups.c +++ b/src/map/pc_groups.c @@ -144,7 +144,7 @@ static void read_config(void) idb_put(pcg->db, id, group_settings); } group_count = libconfig->setting_length(groups); // Save number of groups - assert(group_count == db_size(pcg->db)); + assert((unsigned int)group_count == db_size(pcg->db)); // Check if all commands and permissions exist iter = db_iterator(pcg->db); diff --git a/src/map/pet.c b/src/map/pet.c index 88b142b0f7d..c10272514b8 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -153,7 +153,7 @@ static void pet_set_intimate(struct pet_data *pd, int value) int i; ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET - && pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); + && pd->pet.pet_id == (int)MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); if (i != sd->status.inventorySize) pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_EGG); @@ -414,7 +414,7 @@ static int pet_hungry_timer_delete(struct pet_data *pd) { nullpo_ret(pd); if(pd->pet_hungry_timer != INVALID_TIMER) { - timer->delete(pd->pet_hungry_timer,pet->hungry); + timer->delete_(pd->pet_hungry_timer,pet->hungry); pd->pet_hungry_timer = INVALID_TIMER; } @@ -459,7 +459,7 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) // Pet Evolution ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET && - pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); + pd->pet.pet_id == (int)MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); if (i != sd->status.inventorySize) { sd->status.inventory[i].attribute &= ~ATTR_BROKEN; @@ -650,7 +650,7 @@ static int pet_recv_petdata(int account_id, struct s_pet *p, int flag) int i; // Get Egg Index ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET && - p->pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); + p->pet_id == (int)MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); if(i == sd->status.inventorySize) { ShowError("pet_recv_petdata: Hatching pet (%d:%s) aborted, couldn't find egg in inventory for removal!\n",p->pet_id, p->name); @@ -970,12 +970,12 @@ static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) status_calc_pc(sd,SCO_NONE); } if (pd->s_skill && pd->s_skill->timer != INVALID_TIMER) { - timer->delete(pd->s_skill->timer, pet->skill_support_timer); + timer->delete_(pd->s_skill->timer, pet->skill_support_timer); pd->s_skill->timer = INVALID_TIMER; } if( pd->bonus && pd->bonus->timer != INVALID_TIMER ) { - timer->delete(pd->bonus->timer, pet->skill_bonus_timer); + timer->delete_(pd->bonus->timer, pet->skill_bonus_timer); pd->bonus->timer = INVALID_TIMER; } } @@ -1126,7 +1126,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int return 0; } - if (pd->status.speed != pd->petDB->speed) { // Reset speed to normal. + if (pd->status.speed != (uint32)pd->petDB->speed) { // Reset speed to normal. if (pd->ud.walktimer != INVALID_TIMER) return 0; // Wait until the pet finishes walking back to master. @@ -1346,7 +1346,7 @@ static int pet_skill_bonus_timer(int tid, int64 tick, int id, intptr_t data) return 1; } - int bonus; + unsigned int bonus; int duration; // Determine the time for the next timer. diff --git a/src/map/quest.c b/src/map/quest.c index 0f39efd6f0c..401dd50ef0c 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -858,7 +858,7 @@ static bool quest_questinfo_validate_job(struct map_session_data *sd, struct que { nullpo_retr(false, sd); nullpo_retr(false, qi); - if (sd->status.class == qi->job) + if (sd->status.class_ == qi->job) return true; return false; } diff --git a/src/map/quest.h b/src/map/quest.h index cee20e3403b..0368ab633f0 100644 --- a/src/map/quest.h +++ b/src/map/quest.h @@ -129,7 +129,7 @@ struct questinfo { unsigned short icon; unsigned char color; bool hasJob; - unsigned int job;/* perhaps a mapid mask would be most flexible? */ + int job;/* perhaps a mapid mask would be most flexible? */ bool sex_enabled; int sex; struct { diff --git a/src/map/rodex.c b/src/map/rodex.c index 7a9354e50f9..628c45d3e91 100644 --- a/src/map/rodex.c +++ b/src/map/rodex.c @@ -101,7 +101,7 @@ static void rodex_add_item(struct map_session_data *sd, int16 idx, int16 amount) } bool is_new = true; - int i; + int i = RODEX_MAX_ITEM; // stackable item, try to find it in the current list if (itemdb->isstackable(inv_item->nameid) == 1) { @@ -206,8 +206,8 @@ static void rodex_remove_item(struct map_session_data *sd, int16 idx, int16 amou /// @param name : The name of the character to check /// @param base_level : Reference to return the character base level, if he exists /// @param char_id : Reference to return the character id, if he exists -/// @param class : Reference to return the character class id, if he exists -static void rodex_check_player(struct map_session_data *sd, const char *name, int *base_level, int *char_id, int *class) +/// @param class_ : Reference to return the character class id, if he exists +static void rodex_check_player(struct map_session_data *sd, const char *name, int *base_level, int *char_id, int *class_) { intif->rodex_checkname(sd, name); } diff --git a/src/map/rodex.h b/src/map/rodex.h index cd17ae3a1e3..906ab0d89d3 100644 --- a/src/map/rodex.h +++ b/src/map/rodex.h @@ -65,7 +65,7 @@ struct rodex_interface { void (*refresh) (struct map_session_data *sd, int8 open_type, int64 first_mail_id); void (*add_item) (struct map_session_data *sd, int16 idx, int16 amount); void (*remove_item) (struct map_session_data *sd, int16 idx, int16 amount); - void (*check_player) (struct map_session_data *sd, const char *name, int *base_level, int *char_id, int *class); + void (*check_player) (struct map_session_data *sd, const char *name, int *base_level, int *char_id, int *class_); int (*send_mail) (struct map_session_data *sd, const char *receiver_name, const char *body, const char *title, int64 zeny); void (*send_mail_result) (struct map_session_data *ssd, struct map_session_data *rsd, bool result); struct rodex_message *(*get_mail) (struct map_session_data *sd, int64 mail_id); diff --git a/src/map/script.c b/src/map/script.c index 287f5a5754c..82f0b59520f 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -441,7 +441,7 @@ static unsigned int calc_hash_ci(const char *p) /// Looks up string using the provided id. static const char *script_get_str(int id) { - Assert_retr(NULL, id >= LABEL_START && id < script->str_size); + Assert_retr(NULL, id >= LABEL_START && (size_t)id < script->str_size); return script->str_buf+script->str_data[id].str; } @@ -613,7 +613,7 @@ static int script_add_str(const char *p) len=(int)strlen(p); // grow string buffer if neccessary - while( script->str_pos+len+1 >= script->str_size ) { + while ((size_t)(script->str_pos+len+1) >= script->str_size) { script->str_size += 10240; RECREATE(script->str_buf,char,script->str_size); memset(script->str_buf + (script->str_size - 10240), '\0', 10240); @@ -897,7 +897,7 @@ static const char *parse_callfunc(const char *p, int require_paren, int is_custo const char *p2; char *arg = NULL; char null_arg = '\0'; - int func; + int func = -1; bool lang_macro = false; nullpo_retr(NULL, p); @@ -1013,6 +1013,7 @@ static const char *parse_callfunc(const char *p, int require_paren, int is_custo p = script->skip_word(p); p = script->skip_space(p); + nullpo_ret(p); // Can't be NULL but silence gcc warnings script->syntax.curly[script->syntax.curly_count].type = TYPE_ARGLIST; script->syntax.curly[script->syntax.curly_count].count = 0; @@ -1135,7 +1136,8 @@ static void parse_variable_sub_push(int word, const char *p2) p3 = script->parse_subexpr(p2 + 1, 1); p3 = script->skip_space(p3); - if( *p3 != ']' ) {// closing parenthesis is required for this script + if (p3 == NULL /* Can't be NULL but silence gcc warnings */ || *p3 != ']' ) { + // closing parenthesis is required for this script disp_error_message("Missing closing ']' parenthesis for the variable assignment.", p3); } @@ -1168,23 +1170,25 @@ static const char *parse_variable(const char *p) // skip the variable where applicable p = script->skip_word(p); p = script->skip_space(p); - - if( p == NULL ) { - // end of the line or invalid buffer - return NULL; - } + nullpo_ret(p); // Can't be NULL but silence gcc warnings if (*p == '[') { - int i, j; // array variable so process the array as appropriate - for (p2 = p, i = 0, j = 1; p; ++ i) { - if( *p ++ == ']' && --(j) == 0 ) break; - if( *p == '[' ) ++ j; + p2 = p; + int open_brackets = 1; + while (*(++p) != '\0') { + if (*p == ']' && --open_brackets == 0) { + p++; + break; + } + if (*p == '[') + open_brackets++; } - if( !(p = script->skip_space(p)) ) { + p = script->skip_space(p); + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p == '\0') { // end of line or invalid characters remaining - disp_error_message("Missing right expression or closing bracket for variable.", p); + disp_error_message("Missing right expression or closing bracket for variable.", p2); } } @@ -1231,10 +1235,7 @@ static const char *parse_variable(const char *p) } PRAGMA_GCC46(GCC diagnostic pop) - if( p == NULL ) { - // end of line or invalid buffer - return NULL; - } + nullpo_ret(p); // Can't be NULL but silence gcc warnings // push the set function onto the stack script->syntax.nested_call++; @@ -1606,7 +1607,7 @@ static const char *parse_simpleexpr_name(const char *p) p = script->parse_subexpr(p + 1, -1); p = script->skip_space(p); - if (*p != ']') + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != ']') disp_error_message("parse_simpleexpr: unmatched ']'", p); ++p; script->addc(C_FUNC); @@ -1736,8 +1737,9 @@ static const char *script_parse_subexpr(const char *p, int limit) // B p = script->parse_subexpr(p, -1); p = script->skip_space(p); - if (*(p++) != ':') + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *(p++) != ':') { disp_error_message("parse_subexpr: need ':'", p - 1); + } // op_3 jmp (skip over C) script->addl(l2); script->addc(C_OP3_JMP); @@ -1838,6 +1840,10 @@ static const char *parse_line(const char *p) return p; } +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable: 4702) +#endif /** * parses a local function expression * @@ -1862,7 +1868,7 @@ static const char *parse_syntax_function (const char *p, bool is_public) const char *p2 = script->skip_space(p); - if (*p2 == ';') { + if (p2 != NULL /* Can't be NULL but silence gcc warnings */ && *p2 == ';') { // function ; // function declaration - just register the name int l = script->add_word(func_name); @@ -1877,7 +1883,8 @@ static const char *parse_syntax_function (const char *p, bool is_public) // Close condition of if, for, while p = script->parse_syntax_close(p2 + 1); return p; - } else if (*p2 == '{') { + } + if (p2 != NULL /* Can't be NULL but silence gcc warnings */ && *p2 == '{') { // function script->syntax.curly[script->syntax.curly_count].type = TYPE_USERFUNC; script->syntax.curly[script->syntax.curly_count].count = 1; @@ -1910,13 +1917,19 @@ static const char *parse_syntax_function (const char *p, bool is_public) } return script->skip_space(p); - } else { - disp_error_message("script:parse_syntax_function: expected ';' or '{' at function syntax", p); } + disp_error_message("script:parse_syntax_function: expected ';' or '{' at function syntax", p); return p; } +#ifdef _MSC_VER +#pragma warning (pop) +#endif +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable: 4702) +#endif // { ... } Closing process static const char *parse_curly_close(const char *p) { @@ -1924,12 +1937,14 @@ static const char *parse_curly_close(const char *p) if(script->syntax.curly_count <= 0) { disp_error_message("parse_curly_close: unexpected string",p); return p + 1; - } else if(script->syntax.curly[script->syntax.curly_count-1].type == TYPE_NULL) { + } + if (script->syntax.curly[script->syntax.curly_count-1].type == TYPE_NULL) { script->syntax.curly_count--; //Close decision if, for , while p = script->parse_syntax_close(p + 1); return p; - } else if(script->syntax.curly[script->syntax.curly_count-1].type == TYPE_SWITCH) { + } + if (script->syntax.curly[script->syntax.curly_count-1].type == TYPE_SWITCH) { //Closing switch() int pos = script->syntax.curly_count-1; char label[256]; @@ -1968,12 +1983,18 @@ static const char *parse_curly_close(const char *p) //Closing decision if, for , while p = script->parse_syntax_close(p + 1); return p; - } else { - disp_error_message("parse_curly_close: unexpected string",p); - return p + 1; } + disp_error_message("parse_curly_close: unexpected string",p); + return p + 1; } +#ifdef _MSC_VER +#pragma warning (pop) +#endif +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable: 4702) +#endif // Syntax-related processing // break, case, continue, default, do, for, function, // if, switch, while ? will handle this internally. @@ -2007,14 +2028,15 @@ static const char *parse_syntax(const char *p) } if(pos < 0) { disp_error_message("parse_syntax: unexpected 'break'",p); - } else { - script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; - script->parse_line(label); - script->syntax.curly_count--; } + script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; + script->parse_line(label); + script->syntax.curly_count--; + p = script->skip_space(p2); - if(*p != ';') + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != ';') { disp_error_message("parse_syntax: need ';'",p); + } // Closing decision if, for , while p = script->parse_syntax_close(p + 1); return p; @@ -2028,103 +2050,108 @@ static const char *parse_syntax(const char *p) if(pos < 0 || script->syntax.curly[pos].type != TYPE_SWITCH) { disp_error_message("parse_syntax: unexpected 'case' ",p); return p+1; - } else { - char label[256]; - int l,v; - char *np; - if(script->syntax.curly[pos].count != 1) { - //Jump for FALLTHRU - sprintf(label,"goto __SW%x_%xJ;", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); - script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; - script->parse_line(label); - script->syntax.curly_count--; - - // You are here labeled - sprintf(label,"__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); - l=script->add_str(label); - script->set_label(l, VECTOR_LENGTH(script->buf), p); - } - //Decision statement switch - p = script->skip_space(p2); - if(p == p2) { - disp_error_message("parse_syntax: expect space ' '",p); - } - // check whether case label is integer or not - if(is_number(p)) { - //Numeric value - v = (int)strtol(p,&np,0); - if((*p == '-' || *p == '+') && ISDIGIT(p[1])) // pre-skip because '-' can not skip_word - p++; - p = script->skip_word(p); - if(np != p) - disp_error_message("parse_syntax: 'case' label is not an integer",np); - } else { - //Check for constants - p2 = script->skip_word(p); - v = (int)(size_t) (p2-p); // length of word at p2 - memcpy(label,p,v); - label[v]='\0'; - if( !script->get_constant(label, &v) ) - disp_error_message("parse_syntax: 'case' label is not an integer",p); - p = script->skip_word(p); - } - p = script->skip_space(p); - if(*p != ':') - disp_error_message("parse_syntax: expect ':'",p); - sprintf(label,"if(%d != $@__SW%x_VAL) goto __SW%x_%x;", - v, (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count+1); - script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; - // Bad I do not parse twice - p2 = script->parse_line(label); - script->parse_line(p2); - script->syntax.curly_count--; - if(script->syntax.curly[pos].count != 1) { - // Label after the completion of FALLTHRU - sprintf(label, "__SW%x_%xJ", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); - l=script->add_str(label); - script->set_label(l, VECTOR_LENGTH(script->buf), p); - } - // check duplication of case label [Rayce] - if(linkdb_search(&script->syntax.curly[pos].case_label, (void*)h64BPTRSIZE(v)) != NULL) - disp_error_message("parse_syntax: dup 'case'",p); - linkdb_insert(&script->syntax.curly[pos].case_label, (void*)h64BPTRSIZE(v), (void*)1); - - sprintf(label, "__setr $@__SW%x_VAL,0;", (unsigned int)script->syntax.curly[pos].index); + } + char label[256]; + int l,v; + char *np; + if(script->syntax.curly[pos].count != 1) { + //Jump for FALLTHRU + sprintf(label,"goto __SW%x_%xJ;", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; - script->parse_line(label); script->syntax.curly_count--; - script->syntax.curly[pos].count++; + + // You are here labeled + sprintf(label,"__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); + l=script->add_str(label); + script->set_label(l, VECTOR_LENGTH(script->buf), p); } + //Decision statement switch + p = script->skip_space(p2); + if(p == p2) { + disp_error_message("parse_syntax: expect space ' '",p); + } + // check whether case label is integer or not + if(is_number(p)) { + //Numeric value + v = (int)strtol(p,&np,0); + if((*p == '-' || *p == '+') && ISDIGIT(p[1])) // pre-skip because '-' can not skip_word + p++; + p = script->skip_word(p); + if(np != p) + disp_error_message("parse_syntax: 'case' label is not an integer",np); + } else { + //Check for constants + p2 = script->skip_word(p); + v = (int)(size_t) (p2-p); // length of word at p2 + memcpy(label,p,v); + label[v]='\0'; + if( !script->get_constant(label, &v) ) + disp_error_message("parse_syntax: 'case' label is not an integer",p); + p = script->skip_word(p); + } + p = script->skip_space(p); + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != ':') { + disp_error_message("parse_syntax: expect ':'",p); + } + sprintf(label,"if(%d != $@__SW%x_VAL) goto __SW%x_%x;", + v, (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count+1); + script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; + // Bad I do not parse twice + p2 = script->parse_line(label); + script->parse_line(p2); + script->syntax.curly_count--; + if(script->syntax.curly[pos].count != 1) { + // Label after the completion of FALLTHRU + sprintf(label, "__SW%x_%xJ", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); + l=script->add_str(label); + script->set_label(l, VECTOR_LENGTH(script->buf), p); + } + // check duplication of case label [Rayce] + if(linkdb_search(&script->syntax.curly[pos].case_label, (void*)h64BPTRSIZE(v)) != NULL) + disp_error_message("parse_syntax: dup 'case'",p); + linkdb_insert(&script->syntax.curly[pos].case_label, (void*)h64BPTRSIZE(v), (void*)1); + + sprintf(label, "__setr $@__SW%x_VAL,0;", (unsigned int)script->syntax.curly[pos].index); + script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; + + script->parse_line(label); + script->syntax.curly_count--; + script->syntax.curly[pos].count++; + return p + 1; - } else if( p2 - p == 8 && strncmp(p, "continue", 8) == 0 ) { + } + if (p2 - p == 8 && strncmp(p, "continue", 8) == 0) { // Processing continue char label[256]; int pos = script->syntax.curly_count - 1; while(pos >= 0) { - if(script->syntax.curly[pos].type == TYPE_DO) { + if (script->syntax.curly[pos].type == TYPE_DO) { sprintf(label, "goto __DO%x_NXT;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[pos].flag = 1; //Flag put the link for continue break; - } else if(script->syntax.curly[pos].type == TYPE_FOR) { + } + if (script->syntax.curly[pos].type == TYPE_FOR) { sprintf(label, "goto __FR%x_NXT;", (unsigned int)script->syntax.curly[pos].index); break; - } else if(script->syntax.curly[pos].type == TYPE_WHILE) { + } + if (script->syntax.curly[pos].type == TYPE_WHILE) { sprintf(label, "goto __WL%x_NXT;", (unsigned int)script->syntax.curly[pos].index); break; } pos--; } - if(pos < 0) { + if (pos < 0) { disp_error_message("parse_syntax: unexpected 'continue'",p); - } else { - script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; - script->parse_line(label); - script->syntax.curly_count--; } + script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; + script->parse_line(label); + script->syntax.curly_count--; + p = script->skip_space(p2); - if(*p != ';') + if (p == NULL /* Never NULL but gcc-16 doesn't realize */ || *p != ';') { disp_error_message("parse_syntax: need ';'",p); + } //Closing decision if, for , while p = script->parse_syntax_close(p + 1); return p; @@ -2137,36 +2164,38 @@ static const char *parse_syntax(const char *p) int pos = script->syntax.curly_count-1; if(pos < 0 || script->syntax.curly[pos].type != TYPE_SWITCH) { disp_error_message("parse_syntax: unexpected 'default'",p); - } else if(script->syntax.curly[pos].flag) { + } + if(script->syntax.curly[pos].flag) { disp_error_message("parse_syntax: dup 'default'",p); - } else { - char label[256]; - int l; - // Put the label location - p = script->skip_space(p2); - if(*p != ':') { - disp_error_message("parse_syntax: need ':'",p); - } - sprintf(label, "__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); - l=script->add_str(label); - script->set_label(l, VECTOR_LENGTH(script->buf), p); + } + char label[256]; + int l; + // Put the label location + p = script->skip_space(p2); + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != ':') { + disp_error_message("parse_syntax: need ':'",p); + } + sprintf(label, "__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); + l=script->add_str(label); + script->set_label(l, VECTOR_LENGTH(script->buf), p); - // Skip to the next link w/o condition - sprintf(label, "goto __SW%x_%x;", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count + 1); - script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; - script->parse_line(label); - script->syntax.curly_count--; + // Skip to the next link w/o condition + sprintf(label, "goto __SW%x_%x;", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count + 1); + script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; + script->parse_line(label); + script->syntax.curly_count--; - // The default label - sprintf(label, "__SW%x_DEF", (unsigned int)script->syntax.curly[pos].index); - l=script->add_str(label); - script->set_label(l, VECTOR_LENGTH(script->buf), p); + // The default label + sprintf(label, "__SW%x_DEF", (unsigned int)script->syntax.curly[pos].index); + l=script->add_str(label); + script->set_label(l, VECTOR_LENGTH(script->buf), p); + + script->syntax.curly[script->syntax.curly_count - 1].flag = 1; + script->syntax.curly[pos].count++; - script->syntax.curly[script->syntax.curly_count - 1].flag = 1; - script->syntax.curly[pos].count++; - } return p + 1; - } else if( p2 - p == 2 && strncmp(p, "do", 2) == 0 ) { + } + if (p2 - p == 2 && strncmp(p, "do", 2) == 0) { int l; char label[256]; p=script->skip_space(p2); @@ -2197,8 +2226,9 @@ static const char *parse_syntax(const char *p) p=script->skip_space(p2); - if(*p != '(') + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != '(') { disp_error_message("parse_syntax: need '('",p); + } p++; // Execute the initialization statement @@ -2212,7 +2242,7 @@ static const char *parse_syntax(const char *p) script->set_label(l, VECTOR_LENGTH(script->buf), p); p=script->skip_space(p); - if(*p == ';') { + if (p == NULL /* Can't be NULL but silence gcc warnings */|| *p == ';') { // For (; Because the pattern of always true ;) ; } else { @@ -2225,8 +2255,9 @@ static const char *parse_syntax(const char *p) script->addl(script->add_str(label)); script->addc(C_FUNC); } - if(*p != ';') + if(p == NULL /* Can't be NULL but silence gcc warnings */ || *p != ';') { disp_error_message("parse_syntax: need ';'",p); + } p++; // Skip to the beginning of the loop @@ -2259,13 +2290,13 @@ static const char *parse_syntax(const char *p) l=script->add_str(label); script->set_label(l, VECTOR_LENGTH(script->buf), p); return p; - } else if( p2 - p == 8 && strncmp(p, "function", 8) == 0 ) { + } + if (p2 - p == 8 && strncmp(p, "function", 8) == 0) { // local function not marked as public or private if (script->config.functions_private_by_default) { return script->parse_syntax_function(p2, false); - } else { - return script->parse_syntax_function(p2, true); } + return script->parse_syntax_function(p2, true); } break; case 'i': @@ -2274,7 +2305,8 @@ static const char *parse_syntax(const char *p) // If process char label[256]; p=script->skip_space(p2); - if(*p != '(') { //Prevent if this {} non-c script->syntax. from Rayce (jA) + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != '(') { + //Prevent if this {} non-c script->syntax. from Rayce (jA) disp_error_message("need '('",p); } script->syntax.curly[script->syntax.curly_count].type = TYPE_IF; @@ -2318,7 +2350,7 @@ static const char *parse_syntax(const char *p) // Processing of switch () char label[256]; p=script->skip_space(p2); - if(*p != '(') { + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != '(') { disp_error_message("need '('",p); } script->syntax.curly[script->syntax.curly_count].type = TYPE_SWITCH; @@ -2332,7 +2364,7 @@ static const char *parse_syntax(const char *p) script->addl(script->add_str(label)); p=script->parse_expr(p); p=script->skip_space(p); - if(*p != '{') { + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != '{') { disp_error_message("parse_syntax: need '{'",p); } script->addc(C_FUNC); @@ -2345,7 +2377,7 @@ static const char *parse_syntax(const char *p) int l; char label[256]; p=script->skip_space(p2); - if(*p != '(') { + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != '(') { disp_error_message("need '('",p); } script->syntax.curly[script->syntax.curly_count].type = TYPE_WHILE; @@ -2372,6 +2404,9 @@ static const char *parse_syntax(const char *p) } return NULL; } +#ifdef _MSC_VER +#pragma warning (pop) +#endif static const char *parse_syntax_close(const char *p) { @@ -2385,6 +2420,10 @@ static const char *parse_syntax_close(const char *p) return p; } +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable: 4702) +#endif // Close judgment if, for, while, of do // flag == 1 : closed // flag == 0 : not closed @@ -2426,7 +2465,7 @@ static const char *parse_syntax_close_sub(const char *p, int *flag) if( p2 - p == 2 && strncmp(p, "if", 2) == 0 ) { // else - if p=script->skip_space(p2); - if(*p != '(') { + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != '(') { disp_error_message("need '('",p); } sprintf(label, "__IF%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); @@ -2476,7 +2515,7 @@ static const char *parse_syntax_close_sub(const char *p, int *flag) } p = script->skip_space(p2); - if(*p != '(') { + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != '(') { disp_error_message("need '('",p); } @@ -2502,7 +2541,7 @@ static const char *parse_syntax_close_sub(const char *p, int *flag) l=script->add_str(label); script->set_label(l, VECTOR_LENGTH(script->buf), p); p = script->skip_space(p); - if(*p != ';') { + if (p == NULL /* Can't be NULL but silence gcc warnings */ || *p != ';') { disp_error_message("parse_syntax: need ';'",p); return p+1; } @@ -2559,6 +2598,9 @@ static const char *parse_syntax_close_sub(const char *p, int *flag) return p; } } +#ifdef _MSC_VER +#pragma warning (pop) +#endif /// Retrieves the value of a constant. static bool script_get_constant(const char *name, int *value) @@ -2869,6 +2911,10 @@ static void script_warning(const char *src, const char *file, int start_line, co StrBuf->Destroy(&buf); } +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable: 4702) +#endif /*========================================== * Analysis of the script *------------------------------------------*/ @@ -2988,7 +3034,8 @@ static struct script_code *parse_script(const char *src, const char *file, int l // Special handling only label tmpp = script->skip_space(script->skip_word(p)); - if (*tmpp == ':' && !(strncmp(p, "default:", 8) == 0 && p + 7 == tmpp) + if (tmpp != NULL /* Can't be NULL but silence gcc warnings */ && *tmpp == ':' + && !(strncmp(p, "default:", 8) == 0 && p + 7 == tmpp) && !(strncmp(p, "function", 8) == 0 && script->skip_space(p + 8) == tmpp)) { i = script->add_word(p); script->set_label(i, VECTOR_LENGTH(script->buf), p); @@ -3094,6 +3141,9 @@ static struct script_code *parse_script(const char *src, const char *file, int l #endif // ENABLE_CASE_CHECK return code; } +#ifdef _MSC_VER +#pragma warning (pop) +#endif /** * Creates a new script_code instance from an existing one. @@ -4320,7 +4370,7 @@ static void script_free_state(struct script_state *st) } if( st->sleep.timer != INVALID_TIMER ) - timer->delete(st->sleep.timer, script->run_timer); + timer->delete_(st->sleep.timer, script->run_timer); if( st->stack ) { script->free_vars(st->stack->scope.vars); if( st->stack->scope.arrays ) @@ -6209,7 +6259,7 @@ static int script_reload(void) script->clear_translations(true); if( script->parse_cleanup_timer_id != INVALID_TIMER ) { - timer->delete(script->parse_cleanup_timer_id,script->parse_cleanup_timer); + timer->delete_(script->parse_cleanup_timer_id,script->parse_cleanup_timer); script->parse_cleanup_timer_id = INVALID_TIMER; } @@ -6352,7 +6402,7 @@ static bool script_sprintf_helper(struct script_state *st, int start, struct Str np++; } else if (*np == '*') { bool positional_widtharg = false; - int width_arg; + int width_arg = 0; np++; // pos-parameter = number "$" if (ISDIGIT(*np) && *np != '0') { @@ -7828,18 +7878,18 @@ static BUILDIN(percentheal) *------------------------------------------*/ static BUILDIN(jobchange) { - int class, upper=-1; + int class_, upper=-1; - class = script_getnum(st,2); + class_ = script_getnum(st,2); if( script_hasdata(st,3) ) upper=script_getnum(st,3); - if (pc->db_checkid(class)) { + if (pc->db_checkid(class_)) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) return true; - pc->jobchange(sd, class, upper); + pc->jobchange(sd, class_, upper); } return true; @@ -7850,8 +7900,8 @@ static BUILDIN(jobchange) *------------------------------------------*/ static BUILDIN(jobname) { - int class = script_getnum(st,2); - script_pushconststr(st, pc->job_name(class)); + int class_ = script_getnum(st,2); + script_pushconststr(st, pc->job_name(class_)); return true; } @@ -8118,7 +8168,6 @@ static BUILDIN(copyarray) int32 idx2; int32 id1; int32 id2; - int32 i; uint32 count; struct map_session_data *sd = NULL; @@ -8157,21 +8206,21 @@ static BUILDIN(copyarray) } count = script_getnum(st, 4); - if( count > SCRIPT_MAX_ARRAYSIZE - idx1 ) + if( count > (uint32)(SCRIPT_MAX_ARRAYSIZE - idx1)) count = SCRIPT_MAX_ARRAYSIZE - idx1; if( count <= 0 || (idx1 == idx2 && is_same_reference(data1, data2)) ) return true;// nothing to copy if( is_same_reference(data1, data2) && idx1 > idx2 ) { // destination might be overlapping the source - copy in reverse order - for( i = count - 1; i >= 0; --i ) { + for (int i = count - 1; i >= 0; --i) { const void *value = script->get_val2(st, reference_uid(id2, idx2 + i), reference_getref(data2)); script->set_reg(st, sd, reference_uid(id1, idx1 + i), name1, value, reference_getref(data1)); script_removetop(st, -1, 0); } } else { // normal copy - for( i = 0; i < count; ++i ) { + for (uint32 i = 0; i < count; ++i) { if( idx2 + i < SCRIPT_MAX_ARRAYSIZE ) { const void *value = script->get_val2(st, reference_uid(id2, idx2 + i), reference_getref(data2)); script->set_reg(st, sd, reference_uid(id1, idx1 + i), name1, value, reference_getref(data1)); @@ -10022,7 +10071,7 @@ static BUILDIN(getpartyleader) switch (type) { case 1: script_pushint(st,p->party.member[i].account_id); break; case 2: script_pushint(st,p->party.member[i].char_id); break; - case 3: script_pushint(st,p->party.member[i].class); break; + case 3: script_pushint(st,p->party.member[i].class_); break; case 4: script_pushstrcopy(st,mapindex_id2name(p->party.member[i].map)); break; case 5: script_pushint(st,p->party.member[i].lv); break; default: script_pushstrcopy(st,p->party.member[i].name); break; @@ -11967,7 +12016,7 @@ static BUILDIN(gettimestr) return false; } - if (maxlen >= sizeof(tmpstr)) { + if ((size_t)maxlen >= sizeof(tmpstr)) { ShowWarning("buildin_gettimestr: Length value is too big %d, max allowed %lu.\n", maxlen, sizeof(tmpstr) - 1); return false; } @@ -14101,16 +14150,16 @@ static BUILDIN(homunculus_shuffle) //These two functions bring the eA MAPID_* class functionality to scripts. static BUILDIN(eaclass) { - int class; + int class_; if (script_hasdata(st,2)) { - class = script_getnum(st,2); + class_ = script_getnum(st,2); } else { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) return true; - class = sd->status.class; + class_ = sd->status.class_; } - script_pushint(st,pc->jobid2mapid(class)); + script_pushint(st,pc->jobid2mapid(class_)); return true; } @@ -14228,7 +14277,7 @@ static BUILDIN(changebase) return true; } - if (sd->disguise == -1 && vclass != sd->vd.class) + if (sd->disguise == -1 && vclass != sd->vd.class_) pc->changelook(sd,LOOK_BASE,vclass); //Updated client view. Base, Weapon and Cloth Colors. return true; @@ -14586,7 +14635,7 @@ static BUILDIN(warpwaitingpc) if (cd->zeny) { // fee set - if ((uint32)sd->status.zeny < cd->zeny) { + if (sd->status.zeny < cd->zeny) { // no zeny to cover set fee break; } @@ -15136,7 +15185,7 @@ static int buildin_pvpoff_sub(struct block_list *bl, va_list ap) clif->pvpset(sd, 0, 0, 2); if (sd->pvp_timer != INVALID_TIMER) { - timer->delete(sd->pvp_timer, pc->calc_pvprank_timer); + timer->delete_(sd->pvp_timer, pc->calc_pvprank_timer); sd->pvp_timer = INVALID_TIMER; } return 0; @@ -16763,7 +16812,7 @@ static BUILDIN(petskillbonus) if (pd->bonus) { //Clear previous bonus if (pd->bonus->timer != INVALID_TIMER) - timer->delete(pd->bonus->timer, pet->skill_bonus_timer); + timer->delete_(pd->bonus->timer, pet->skill_bonus_timer); } else //init pd->bonus = (struct pet_bonus *) aMalloc(sizeof(struct pet_bonus)); @@ -16991,23 +17040,23 @@ static BUILDIN(undisguise) *------------------------------------------*/ static BUILDIN(classchange) { - int class, type, target; + int class_, type, target; struct block_list *bl = map->id2bl(st->oid); if (bl == NULL) return true; - class = script_getnum(st, 2); + class_ = script_getnum(st, 2); type = script_getnum(st, 3); target = script_hasdata(st, 4) ? script_getnum(st, 4) : 0; if (target > 0) { struct map_session_data *sd = script->charid2sd(st, target); if (sd != NULL) { - clif->class_change(bl, class, type, sd); + clif->class_change(bl, class_, type, sd); } } else { - clif->class_change(bl, class, type, NULL); + clif->class_change(bl, class_, type, NULL); } return true; } @@ -17286,7 +17335,7 @@ static BUILDIN(petrecovery) if (pd->recovery) { //Halt previous bonus if (pd->recovery->timer != INVALID_TIMER) - timer->delete(pd->recovery->timer, pet->recovery_timer); + timer->delete_(pd->recovery->timer, pet->recovery_timer); } else //Init pd->recovery = (struct pet_recovery *)aMalloc(sizeof(struct pet_recovery)); @@ -17340,7 +17389,7 @@ static BUILDIN(petskillsupport) if (pd->s_skill) { //Clear previous skill if (pd->s_skill->timer != INVALID_TIMER) { - timer->delete(pd->s_skill->timer, pet->skill_support_timer); + timer->delete_(pd->s_skill->timer, pet->skill_support_timer); } } else { //init memory @@ -18133,7 +18182,7 @@ static BUILDIN(getnpcdir) // set npc direction [4144] static BUILDIN(setnpcdir) { - int newdir; + int newdir = 0; struct npc_data *nd = NULL; if (script_hasdata(st, 3)) { @@ -18534,7 +18583,7 @@ static BUILDIN(summon) md->special_state.ai = AI_ATTACK; if (md->deletetimer != INVALID_TIMER) - timer->delete(md->deletetimer, mob->timer_delete); + timer->delete_(md->deletetimer, mob->timer_delete); const int timeout = script_hasdata(st, 4) ? script_getnum(st, 4) * 1000 : 60000; @@ -18896,15 +18945,13 @@ static BUILDIN(getbattleflag) flag = script_getstr(st,2); - if (battle->config_get_value(flag, &value)) { - script_pushint(st,value); - return true; - } else { + if (battle->config_get_value(flag, &value) == 0) { script_pushint(st,0); ShowWarning("buildin_getbattleflag: non-exist battle config requested %s \n", flag); return false; } + script_pushint(st,value); return true; } @@ -19146,7 +19193,7 @@ static BUILDIN(setchar) int index = script_getnum(st,4); char *output = aStrdup(str); - if(index >= 0 && index < strlen(output)) + if(index >= 0 && (size_t)index < strlen(output)) output[index] = *c; script_pushstr(st, output); @@ -19166,7 +19213,7 @@ static BUILDIN(insertchar) if(index < 0) index = 0; - else if(index > len) + else if((size_t)index > len) index = (int)len; output = (char*)aMalloc(len + 2); @@ -19190,7 +19237,7 @@ static BUILDIN(delchar) char *output; size_t len = strlen(str); - if(index < 0 || index > len) { + if(index < 0 || (size_t)index > len) { //return original output = aStrdup(str); script_pushstr(st, output); @@ -19254,7 +19301,7 @@ static BUILDIN(substr) int len = 0; - if(start >= 0 && end < strlen(str) && start <= end) { + if(start >= 0 && (size_t)end < strlen(str) && start <= end) { len = end - start + 1; output = (char*)aMalloc(len + 1); memcpy(output, &str[start], len); @@ -19340,7 +19387,7 @@ static BUILDIN(implode) { struct script_data* data = script_getdata(st, 2); const char *name; - uint32 array_size, id; + int array_size, id; struct map_session_data *sd = NULL; @@ -19581,7 +19628,7 @@ static BUILDIN(strpos) } len = strlen(haystack); - for ( ; i < len; ++i ) { + for (; (size_t)i < len; ++i) { // FIXME: i can be passed as negative value which isn't handled if ( haystack[i] == *needle ) { // matched starting char -- loop through remaining chars const char *h, *n; @@ -19620,7 +19667,7 @@ static BUILDIN(replacestr) int count = 0; int numFinds = 0; - int i = 0, f = 0; + size_t i = 0, f = 0; if(findlen == 0) { ShowError("script:replacestr: Invalid search length.\n"); @@ -19700,7 +19747,7 @@ static BUILDIN(countstr) bool usecase = true; int numFinds = 0; - int i = 0, f = 0; + size_t i = 0, f = 0; if(findlen == 0) { ShowError("script:countstr: Invalid search length.\n"); @@ -20055,7 +20102,7 @@ static int buildin_query_sql_sub(struct script_state *st, struct Sql *handle) const char* query; struct script_data* data; const char* name; - unsigned int max_rows = SCRIPT_MAX_ARRAYSIZE; // maximum number of rows + int max_rows = SCRIPT_MAX_ARRAYSIZE; // maximum number of rows int num_vars; int num_cols; @@ -20119,8 +20166,8 @@ static int buildin_query_sql_sub(struct script_state *st, struct Sql *handle) script->setd_sub(st, sd, name, i, (void *)h64BPTRSIZE((str?atoi(str):0)), reference_getref(data)); } } - if( i == max_rows && max_rows < SQL->NumRows(handle) ) { - ShowWarning("script:query_sql: Only %u/%u rows have been stored.\n", max_rows, (unsigned int)SQL->NumRows(handle)); + if( i == max_rows && (unsigned int)max_rows < SQL->NumRows(handle) ) { + ShowWarning("script:query_sql: Only %d/%u rows have been stored.\n", max_rows, (unsigned int)SQL->NumRows(handle)); script->reportsrc(st); } @@ -20307,7 +20354,7 @@ static BUILDIN(npcshopdelitem) // remove specified items from the shop item list for (i = 3; i < 3 + amount; i++) { - unsigned int nameid = script_getnum(st,i); + int nameid = script_getnum(st,i); ARR_FIND(0, size, n, nd->u.shop.shop_item[n].nameid == nameid); if (n == size) { @@ -21244,7 +21291,7 @@ static BUILDIN(setunitdata) break; case UDT_CLASS: if ((val >= JOB_NOVICE && val <= JOB_MAX_BASIC) || (val >= JOB_NOVICE_HIGH && val <= JOB_MAX)) - md->vd->class = val; + md->vd->class_ = val; else mob->class_change(md, val); clif->clearunit_area(bl, CLR_OUTSIGHT); @@ -22202,7 +22249,7 @@ static BUILDIN(getunitdata) case UDT_AI: script_pushint(st, md->special_state.ai); break; case UDT_SCOPTION: script_pushint(st, md->sc.option); break; case UDT_SEX: script_pushint(st, md->vd->sex); break; - case UDT_CLASS: script_pushint(st, md->vd->class); break; + case UDT_CLASS: script_pushint(st, md->vd->class_); break; case UDT_HAIRSTYLE: script_pushint(st, md->vd->hair_style); break; case UDT_HAIRCOLOR: script_pushint(st, md->vd->hair_color); break; case UDT_HEADBOTTOM: script_pushint(st, md->vd->head_bottom); break; @@ -22516,7 +22563,7 @@ static BUILDIN(getunitdata) case UDT_ADELAY: script_pushint(st, nd->status.adelay); break; case UDT_DMOTION: script_pushint(st, nd->status.dmotion); break; case UDT_SEX: script_pushint(st, nd->vd.sex); break; - case UDT_CLASS: script_pushint(st, nd->vd.class); break; + case UDT_CLASS: script_pushint(st, nd->vd.class_); break; case UDT_HAIRSTYLE: script_pushint(st, nd->vd.hair_style); break; case UDT_HAIRCOLOR: script_pushint(st, nd->vd.hair_color); break; case UDT_HEADBOTTOM: script_pushint(st, nd->vd.head_bottom); break; @@ -23142,7 +23189,7 @@ static BUILDIN(awake) tst->rid = 0; } - timer->delete(tst->sleep.timer, script->run_timer); + timer->delete_(tst->sleep.timer, script->run_timer); tst->sleep.timer = INVALID_TIMER; if(tst->state != RERUNLINE) tst->sleep.tick = 0; @@ -23382,7 +23429,7 @@ static BUILDIN(mercenary_create) class_ = script_getnum(st,2); - if( !mercenary->class(class_) ) + if( !mercenary->class_(class_) ) return true; contract_time = script_getnum(st,3); @@ -23767,7 +23814,7 @@ static BUILDIN(setquestinfo) { int mer_class = script_getnum(st, 3); - if (!mercenary->class(mer_class)) { + if (!mercenary->class_(mer_class)) { ShowWarning("buildin_setquestinfo: invalid mercenary class given (%d).\n", mer_class); return false; } @@ -25579,7 +25626,7 @@ static BUILDIN(npcskill) struct npc_data *nd; uint16 skill_id = script_isstringtype(st, 2) ? skill->name2id(script_getstr(st, 2)) : script_getnum(st, 2); unsigned short skill_level = script_getnum(st, 3); - unsigned int stat_point = script_getnum(st, 4); + int stat_point = script_getnum(st, 4); unsigned int npc_level = script_getnum(st, 5); struct map_session_data *sd = script->rid2sd(st); @@ -26542,7 +26589,7 @@ static BUILDIN(endsellitem) int newIndex = nd->u.scr.shop->shop_last_index; const struct npc_item_list *const newItem = &nd->u.scr.shop->item[newIndex]; - int i = 0; + unsigned int i = 0; for (i = 0; i < nd->u.scr.shop->items - 1; i++) { const struct npc_item_list *const item = &nd->u.scr.shop->item[i]; if (item->nameid != newItem->nameid || item->value != newItem->value) @@ -26591,10 +26638,11 @@ static BUILDIN(sellitem) { struct npc_data *nd; struct item_data *it; - int i = 0, id = script_getnum(st,2); + int id = script_getnum(st,2); int value = 0; int value2 = 0; int qty = 0; + unsigned int i = 0; if( !(nd = map->id2nd(st->oid)) ) { ShowWarning("buildin_sellitem: trying to run without a proper NPC!\n"); @@ -26637,14 +26685,14 @@ static BUILDIN(sellitem) if (nd->u.scr.shop->type == NST_BARTER) { for (i = 0; i < nd->u.scr.shop->items; i++) { const struct npc_item_list *const item = &nd->u.scr.shop->item[i]; - if (item->nameid == id && item->value == value && item->value2 == value2) { + if (item->nameid == id && item->value == (unsigned int)value && item->value2 == value2) { break; } } } else if (nd->u.scr.shop->type == NST_EXPANDED_BARTER) { for (i = 0; i < nd->u.scr.shop->items; i++) { const struct npc_item_list *const item = &nd->u.scr.shop->item[i]; - if (item->nameid != id || item->value != value) + if (item->nameid != id || item->value != (unsigned int)value) continue; if (item->value2 != (script_lastdata(st) - 4) / 3) continue; @@ -26746,9 +26794,10 @@ static BUILDIN(startsellitem) { struct npc_data *nd; struct item_data *it; - int i = 0, id = script_getnum(st,2); + int id = script_getnum(st,2); int value2 = 0; int qty = 0; + unsigned int i = 0; if (!(nd = map->id2nd(st->oid))) { ShowWarning("buildin_startsellitem: trying to run without a proper NPC!\n"); @@ -26810,7 +26859,8 @@ static BUILDIN(startsellitem) static BUILDIN(stopselling) { struct npc_data *nd; - int i, id = script_getnum(st, 2); + int id = script_getnum(st, 2); + unsigned int i = 0; if (!(nd = map->id2nd(st->oid)) || !nd->u.scr.shop) { ShowWarning("buildin_stopselling: trying to run without a proper NPC!\n"); @@ -26826,7 +26876,7 @@ static BUILDIN(stopselling) const int amount2 = script_getnum(st, 4); for (i = 0; i < nd->u.scr.shop->items; i++) { const struct npc_item_list *const item = &nd->u.scr.shop->item[i]; - if (item->nameid == id && item->value == id2 && item->value2 == amount2) { + if (item->nameid == id && item->value == (unsigned int)id2 && item->value2 == amount2) { break; } } @@ -26838,7 +26888,7 @@ static BUILDIN(stopselling) const int price = script_getnum(st, 3); for (i = 0; i < nd->u.scr.shop->items; i++) { const struct npc_item_list *const item = &nd->u.scr.shop->item[i]; - if (item->nameid == id && item->value == price) { + if (item->nameid == id && item->value == (unsigned int)price) { break; } } @@ -26851,7 +26901,7 @@ static BUILDIN(stopselling) } if (i != nd->u.scr.shop->items) { - int cursor; + unsigned int cursor; if (nd->u.scr.shop->type == NST_MARKET) npc->market_delfromsql(nd, i); @@ -26940,8 +26990,7 @@ static BUILDIN(tradertype) if( !nd->u.scr.shop ) npc->trader_update(nd->src_id?nd->src_id:nd->bl.id); else {/* clear list */ - int i; - for( i = 0; i < nd->u.scr.shop->items; i++ ) { + for (unsigned int i = 0; i < nd->u.scr.shop->items; ++i) { nd->u.scr.shop->item[i].nameid = 0; nd->u.scr.shop->item[i].value = 0; nd->u.scr.shop->item[i].qty = 0; @@ -27016,7 +27065,7 @@ static BUILDIN(shopcount) return false; } - int i; + unsigned int i; /* lookup */ for (i = 0; i < nd->u.scr.shop->items; i++) { if( nd->u.scr.shop->item[i].nameid == id ) { @@ -27049,7 +27098,7 @@ static BUILDIN(channelmes) return true; } - char *message = script_getstr(st, 3); + const char *message = script_getstr(st, 3); if (clif->validate_message(sd, message) == false) { script_pushint(st, 0); return true; @@ -28720,30 +28769,30 @@ static BUILDIN(mestipbox) */ static BUILDIN(getunitparam) { - int class = -1; + int class_ = -1; if (script_hasdata(st, 3)) { - class = script_getnum(st, 3); - if (class != -1) { - if (!pc->db_checkid(class)) { - ShowError("buildin_getunitparam: invalid class (%d)\n", class); + class_ = script_getnum(st, 3); + if (class_ != -1) { + if (!pc->db_checkid(class_)) { + ShowError("buildin_getunitparam: invalid class (%d)\n", class_); st->state = END; return false; } - class = pc->class2idx(class); + class_ = pc->class2idx(class_); } } struct map_session_data *sd = NULL; - if (class == -1) { + if (class_ == -1) { sd = script_rid2sd(st); if (sd == NULL) { ShowError("buildin_getunitparam: No player attached, but class == -1.\n"); return false; } - class = pc->class2idx(sd->status.class); + class_ = pc->class2idx(sd->status.class_); } - struct s_unit_params *entry = status->dbs->unit_params[class]; + struct s_unit_params *entry = status->dbs->unit_params[class_]; int param = script_getnum(st, 2); switch (param) { case UNIT_PARAM_NAME: diff --git a/src/map/script.h b/src/map/script.h index 54b37af74e2..bb6c92f614a 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -856,7 +856,7 @@ struct script_interface { VECTOR_DECL(struct script_queue_iterator) hqi; /* */ char **buildin; - unsigned int buildin_count; + int buildin_count; /** * used to generate quick script_array entries **/ @@ -899,7 +899,14 @@ struct script_interface { int buildin_callfunc_ref; int buildin_getelementofarray_ref; /* */ +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable: 4324) +#endif jmp_buf error_jump; +#ifdef _MSC_VER +#pragma warning (pop) +#endif char* error_msg; const char* error_pos; int error_report; // if the error should produce output diff --git a/src/map/searchstore.c b/src/map/searchstore.c index d4444669032..2758dbe0582 100644 --- a/src/map/searchstore.c +++ b/src/map/searchstore.c @@ -99,8 +99,8 @@ static bool searchstore_open(struct map_session_data *sd, unsigned int uses, uns static void searchstore_query(struct map_session_data *sd, unsigned char type, unsigned int min_price, unsigned int max_price, - const uint32 *itemlist, unsigned int item_count, - const uint32 *cardlist, unsigned int card_count) + const int32 *itemlist, unsigned int item_count, + const int32 *cardlist, unsigned int card_count) { unsigned int i; struct map_session_data* pl_sd; @@ -147,14 +147,14 @@ static void searchstore_query(struct map_session_data *sd, // validate lists for( i = 0; i < item_count; i++ ) { if( !itemdb->exists(itemlist[i]) ) { - ShowWarning("searchstore_query: Client resolved item %u is not known.\n", itemlist[i]); + ShowWarning("searchstore_query: Client resolved item %d is not known.\n", itemlist[i]); clif->search_store_info_failed(sd, SSI_FAILED_NOTHING_SEARCH_ITEM); return; } } for( i = 0; i < card_count; i++ ) { if( !itemdb->exists(cardlist[i]) ) { - ShowWarning("searchstore_query: Client resolved card %u is not known.\n", cardlist[i]); + ShowWarning("searchstore_query: Client resolved card %d is not known.\n", cardlist[i]); clif->search_store_info_failed(sd, SSI_FAILED_NOTHING_SEARCH_ITEM); return; } @@ -269,7 +269,7 @@ static void searchstore_close(struct map_session_data *sd) } } -static void searchstore_click(struct map_session_data *sd, int account_id, int store_id, int nameid) +static void searchstore_click(struct map_session_data *sd, int account_id, unsigned int store_id, int nameid) { unsigned int i; struct map_session_data* pl_sd; diff --git a/src/map/searchstore.h b/src/map/searchstore.h index eb767a5dd31..f01cf0c1871 100644 --- a/src/map/searchstore.h +++ b/src/map/searchstore.h @@ -60,8 +60,8 @@ enum e_searchstore_failure { /// information about the search being performed struct s_search_store_search { struct map_session_data* search_sd; // sd of the searching player - const uint32* itemlist; - const uint32* cardlist; + const int *itemlist; + const int *cardlist; unsigned int item_count; unsigned int card_count; unsigned int min_price; @@ -102,12 +102,12 @@ typedef bool (*searchstore_searchall_t)(struct map_session_data* sd, const struc **/ struct searchstore_interface { bool (*open) (struct map_session_data* sd, unsigned int uses, unsigned short effect); - void (*query) (struct map_session_data* sd, unsigned char type, unsigned int min_price, unsigned int max_price, const uint32* itemlist, unsigned int item_count, const uint32* cardlist, unsigned int card_count); + void (*query) (struct map_session_data* sd, unsigned char type, unsigned int min_price, unsigned int max_price, const int32* itemlist, unsigned int item_count, const int32* cardlist, unsigned int card_count); bool (*querynext) (struct map_session_data* sd); void (*next) (struct map_session_data* sd); void (*clear) (struct map_session_data* sd); void (*close) (struct map_session_data* sd); - void (*click) (struct map_session_data* sd, int account_id, int store_id, int nameid); + void (*click) (struct map_session_data* sd, int account_id, unsigned int store_id, int nameid); bool (*queryremote) (struct map_session_data* sd, int account_id); void (*clearremote) (struct map_session_data* sd); bool (*result) (struct map_session_data* sd, unsigned int store_id, int account_id, const char* store_name, int nameid, unsigned short amount, unsigned int price, const int* card, unsigned char refine_level, unsigned char grade_level, const struct item_option *option); diff --git a/src/map/skill.c b/src/map/skill.c index b78cead6e13..7d183d73506 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1044,10 +1044,10 @@ static int skill_get_fixed_cast(int skill_id, int skill_lv) #endif } -static int skill_tree_get_max(int skill_id, int class) +static int skill_tree_get_max(int skill_id, int class_) { int i; - int class_idx = pc->class2idx(class); + int class_idx = pc->class2idx(class_); ARR_FIND( 0, MAX_SKILL_TREE, i, pc->skill_tree[class_idx][i].id == 0 || pc->skill_tree[class_idx][i].id == skill_id ); if( i < MAX_SKILL_TREE && pc->skill_tree[class_idx][i].id == skill_id ) @@ -3427,7 +3427,7 @@ static int skill_attack(int attack_type, struct block_list *src, struct block_li sce->val1 = skill_id; //Update combo-skill sce->val3 = skill_id; if( sce->timer != INVALID_TIMER ) - timer->delete(sce->timer, status->change_timer); + timer->delete_(sce->timer, status->change_timer); sce->timer = timer->add(tick+sce->val4, status->change_timer, src->id, SC_COMBOATTACK); break; } @@ -4306,14 +4306,14 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill_id, return 0; } - int mhp = skill->get_mhp(skill_id, lv); + unsigned int mhp = skill->get_mhp(skill_id, lv); if (mhp > 0 && get_percentage(st->hp, st->max_hp) > mhp) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_HP_INSUFFICIENT, 0, 0); return 0; } - int msp = skill->get_msp(skill_id, lv); + unsigned int msp = skill->get_msp(skill_id, lv); if (msp > 0 && get_percentage(st->sp, st->max_sp) > msp) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_SP_INSUFFICIENT, 0, 0); @@ -4706,7 +4706,7 @@ static int skill_cleartimerskill(struct block_list *src) if(skill->cleartimerskill_exception(ud->skilltimerskill[i]->skill_id)) continue; } - timer->delete(ud->skilltimerskill[i]->timer, skill->timerskill); + timer->delete_(ud->skilltimerskill[i]->timer, skill->timerskill); ers_free(skill->timer_ers, ud->skilltimerskill[i]); ud->skilltimerskill[i]=NULL; } @@ -5833,8 +5833,11 @@ static int skill_castend_damage_id(struct block_list *src, struct block_list *bl int spell[SC_SPELLBOOK7-SC_SPELLBOOK1 + 1]; int cooldown; - for(i = SC_SPELLBOOK7; i >= SC_SPELLBOOK1; i--) // List all available spell to be released - if( sc->data[i] ) spell[s++] = i; + // List all available spell to be released + for (i = SC_SPELLBOOK7; i >= SC_SPELLBOOK1; i--) { + if (sc->data[i]) + spell[s++] = i; + } if ( s == 0 ) break; @@ -10237,7 +10240,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * break; case GC_HALLUCINATIONWALK: { - int heal = status_get_max_hp(bl) * ( 18 - 2 * skill_lv ) / 100; + unsigned int heal = status_get_max_hp(bl) * ( 18 - 2 * skill_lv ) / 100; if( status_get_hp(bl) < heal ) { // if you haven't enough HP skill fails. if (sd) clif->skill_fail(sd, skill_id, USESKILL_FAIL_HP_INSUFFICIENT, 0, 0); break; @@ -10864,7 +10867,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * for(i=0; idata[i]) - continue; + continue; switch(i){ case SC_POISON: case SC_BLIND: @@ -11581,7 +11584,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * summon_md->master_id = src->id; summon_md->special_state.ai = AI_ZANZOU; if( summon_md->deletetimer != INVALID_TIMER ) - timer->delete(summon_md->deletetimer, mob->timer_delete); + timer->delete_(summon_md->deletetimer, mob->timer_delete); summon_md->deletetimer = timer->add(timer->gettick() + skill->get_time(skill_id, skill_lv), mob->timer_delete, summon_md->bl.id, 0); mob->spawn( summon_md ); pc->setinvincibletimer(sd,500);// unlock target lock @@ -11770,7 +11773,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * if (summon_md != NULL) { summon_md->master_id = src->id; if (summon_md->deletetimer != INVALID_TIMER) - timer->delete(summon_md->deletetimer, mob->timer_delete); + timer->delete_(summon_md->deletetimer, mob->timer_delete); summon_md->deletetimer = timer->add(timer->gettick() + skill->get_time(skill_id, skill_lv), mob->timer_delete, summon_md->bl.id, 0); mob->spawn(summon_md); //Now it is ready for spawning. sc_start4(src, &summon_md->bl, SC_MODECHANGE, 100, 1, 0, MD_CANATTACK | MD_AGGRESSIVE, 0, 60000, skill_id); @@ -12770,7 +12773,7 @@ static int skill_castend_pos2(struct block_list *src, int x, int y, uint16 skill md->master_id = src->id; md->special_state.ai = (skill_id == AM_SPHEREMINE) ? AI_SPHERE : AI_FLORA; if( md->deletetimer != INVALID_TIMER ) - timer->delete(md->deletetimer, mob->timer_delete); + timer->delete_(md->deletetimer, mob->timer_delete); md->deletetimer = timer->add(timer->gettick() + skill->get_time(skill_id,skill_lv), mob->timer_delete, md->bl.id, 0); mob->spawn (md); //Now it is ready for spawning. } @@ -12890,7 +12893,7 @@ static int skill_castend_pos2(struct block_list *src, int x, int y, uint16 skill if ((i = skill->get_time(skill_id, skill_lv)) > 0) { if( md->deletetimer != INVALID_TIMER ) - timer->delete(md->deletetimer, mob->timer_delete); + timer->delete_(md->deletetimer, mob->timer_delete); md->deletetimer = timer->add(tick + i, mob->timer_delete, md->bl.id, 0); } mob->spawn (md); @@ -13034,7 +13037,7 @@ static int skill_castend_pos2(struct block_list *src, int x, int y, uint16 skill md->master_id = src->id; md->special_state.ai = AI_FLORA; if( md->deletetimer != INVALID_TIMER ) - timer->delete(md->deletetimer, mob->timer_delete); + timer->delete_(md->deletetimer, mob->timer_delete); md->deletetimer = timer->add(timer->gettick() + skill->get_time(skill_id, skill_lv), mob->timer_delete, md->bl.id, 0); mob->spawn( md ); } @@ -13119,7 +13122,7 @@ static int skill_castend_pos2(struct block_list *src, int x, int y, uint16 skill // FIXME: Code after this point assumes that the group has one and only one unit, regardless of what the skill_unit_db says. if (ud->skillunit[i]->unit.count != 1) continue; - if (distance_xy(x, y, ud->skillunit[i]->unit.data[0].bl.x, ud->skillunit[i]->unit.data[0].bl.y) < r) { + if (distance_xy(x, y, ud->skillunit[i]->unit.data[0].bl.x, ud->skillunit[i]->unit.data[0].bl.y) < (unsigned int)r) { switch (skill_lv) { case 3: ud->skillunit[i]->unit_id = UNT_FIRE_EXPANSION_SMOKE_POWDER; @@ -14069,7 +14072,7 @@ static int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int // eA style: // Readjust timers since the effect will not last long. sce->val4 = 0; - timer->delete(sce->timer, status->change_timer); + timer->delete_(sce->timer, status->change_timer); sce->timer = timer->add(tick+sg->limit, status->change_timer, bl->id, type); } else if (!battle_config.song_timer_reset) { // Aegis style: @@ -14077,7 +14080,7 @@ static int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int const struct TimerData *td = timer->get(sce->timer); if (DIFF_TICK32(td->tick, timer->gettick()) < sg->interval) { // Update with new values as the current one will vanish soon - timer->delete(sce->timer, status->change_timer); + timer->delete_(sce->timer, status->change_timer); sce->timer = timer->add(tick+sg->limit, status->change_timer, bl->id, type); sce->val1 = sg->skill_lv; // Why are we storing skill_lv as val1? sce->val2 = sg->val1; @@ -14567,7 +14570,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b const struct TimerData *td = timer->get(tsc->data[type]->timer); if (DIFF_TICK32(td->tick, timer->gettick()) < sg->interval) { // Update with new values as the current one will vanish - timer->delete(tsc->data[type]->timer, status->change_timer); + timer->delete_(tsc->data[type]->timer, status->change_timer); tsc->data[type]->timer = timer->add(tick+sg->limit, status->change_timer, bl->id, type); tsc->data[type]->val1 = sg->skill_lv; tsc->data[type]->val2 = sg->val1; @@ -15187,7 +15190,7 @@ static int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) if ((battle_config.song_timer_reset && sce) // eAthena style: update everytime || (!battle_config.song_timer_reset && sce && sce->val4 != 1) // Aegis style: update only when it was not a reduced effect ) { - timer->delete(sce->timer, status->change_timer); + timer->delete_(sce->timer, status->change_timer); //NOTE: It'd be nice if we could get the skill_lv for a more accurate extra time, but alas... //not possible on our current implementation. sce->val4 = 1; //Store the fact that this is a "reduced" duration effect. @@ -15202,7 +15205,7 @@ static int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) if (bl->type == BL_PC) //Players get blind ended immediately, others have it still for 30 secs. [Skotlex] status_change_end(bl, SC_BLIND, INVALID_TIMER); else { - timer->delete(sce->timer, status->change_timer); + timer->delete_(sce->timer, status->change_timer); sce->timer = timer->add(30000+tick, status->change_timer, bl->id, SC_BLIND); } } @@ -15344,62 +15347,59 @@ static int skill_check_condition_char_sub(struct block_list *bl, va_list ap) if (tsd->status.party_id == sd->status.party_id && (tsd->job & MAPID_THIRDMASK) == MAPID_MINSTRELWANDERER) p_sd[(*c)++] = tsd->bl.id; return 1; - } else { + } - switch(skill_id) { - case PR_BENEDICTIO: - { - enum unit_dir dir = map->calc_dir(&sd->bl, tsd->bl.x, tsd->bl.y); - dir = (unit->getdir(&sd->bl) + dir) % UNIT_DIR_MAX; //This adjusts dir to account for the direction the sd is facing. - if ((tsd->job & MAPID_BASEMASK) == MAPID_ACOLYTE && (dir == UNIT_DIR_WEST || dir == UNIT_DIR_EAST) //Must be standing to the left/right of Priest. - && sd->status.sp >= 10) { - p_sd[(*c)++]=tsd->bl.id; - } - return 1; + switch(skill_id) { + case PR_BENEDICTIO: + { + enum unit_dir dir = map->calc_dir(&sd->bl, tsd->bl.x, tsd->bl.y); + dir = (unit->getdir(&sd->bl) + dir) % UNIT_DIR_MAX; //This adjusts dir to account for the direction the sd is facing. + if ((tsd->job & MAPID_BASEMASK) == MAPID_ACOLYTE && (dir == UNIT_DIR_WEST || dir == UNIT_DIR_EAST) //Must be standing to the left/right of Priest. + && sd->status.sp >= 10) { + p_sd[(*c)++]=tsd->bl.id; } - case AB_ADORAMUS: - // Adoramus does not consume Blue Gemstone when there is at least 1 Priest class next to the caster - if ((tsd->job & MAPID_UPPERMASK) == MAPID_PRIEST) - p_sd[(*c)++] = tsd->bl.id; - return 1; - case WL_COMET: - // Comet does not consume Red Gemstones when there is at least 1 Warlock class next to the caster - if ((tsd->job & MAPID_THIRDMASK) == MAPID_WARLOCK) - p_sd[(*c)++] = tsd->bl.id; - return 1; - case LG_RAYOFGENESIS: - if (tsd->status.party_id == sd->status.party_id && (tsd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD && tsd->sc.data[SC_BANDING]) - p_sd[(*c)++] = tsd->bl.id; - return 1; - default: //Warning: Assuming Ensemble Dance/Songs for code speed. [Skotlex] - { - if(pc_issit(tsd) || !unit->can_move(&tsd->bl)) - return 0; + return 1; + } + case AB_ADORAMUS: + // Adoramus does not consume Blue Gemstone when there is at least 1 Priest class next to the caster + if ((tsd->job & MAPID_UPPERMASK) == MAPID_PRIEST) + p_sd[(*c)++] = tsd->bl.id; + return 1; + case WL_COMET: + // Comet does not consume Red Gemstones when there is at least 1 Warlock class next to the caster + if ((tsd->job & MAPID_THIRDMASK) == MAPID_WARLOCK) + p_sd[(*c)++] = tsd->bl.id; + return 1; + case LG_RAYOFGENESIS: + if (tsd->status.party_id == sd->status.party_id && (tsd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD && tsd->sc.data[SC_BANDING]) + p_sd[(*c)++] = tsd->bl.id; + return 1; + default: //Warning: Assuming Ensemble Dance/Songs for code speed. [Skotlex] + { + if(pc_issit(tsd) || !unit->can_move(&tsd->bl)) + return 0; - uint16 skill_lv = pc->checkskill(tsd, skill_id); + uint16 skill_lv = pc->checkskill(tsd, skill_id); #ifdef RENEWAL // In Renewal, partner also gets the requirements consumed, so we must check it - if (skill->check_condition_castbegin(tsd, skill_id, skill_lv) == 0) - return 0; + if (skill->check_condition_castbegin(tsd, skill_id, skill_lv) == 0) + return 0; #endif - if (sd->status.sex != tsd->status.sex && - (tsd->job & MAPID_UPPERMASK) == MAPID_BARDDANCER && - skill_lv > 0 && - (tsd->weapontype1==W_MUSICAL || tsd->weapontype1==W_WHIP) && - sd->status.party_id && tsd->status.party_id && - sd->status.party_id == tsd->status.party_id && - !tsd->sc.data[SC_DANCING]) - { - p_sd[(*c)++]=tsd->bl.id; - return skill_lv; - } else { - return 0; - } + if (sd->status.sex != tsd->status.sex && + (tsd->job & MAPID_UPPERMASK) == MAPID_BARDDANCER && + skill_lv > 0 && + (tsd->weapontype1==W_MUSICAL || tsd->weapontype1==W_WHIP) && + sd->status.party_id && tsd->status.party_id && + sd->status.party_id == tsd->status.party_id && + !tsd->sc.data[SC_DANCING]) + { + p_sd[(*c)++]=tsd->bl.id; + return skill_lv; } - break; - } - + } + break; } + return 0; } @@ -15490,7 +15490,7 @@ static int skill_check_condition_mob_master_sub(struct block_list *bl, va_list a md = BL_UCCAST(BL_MOB, bl); if( md->master_id != src_id - || md->special_state.ai != (skill_id == AM_SPHEREMINE?AI_SPHERE:skill_id == KO_ZANZOU?AI_ZANZOU:skill_id == MH_SUMMON_LEGION?AI_ATTACK:AI_FLORA) ) + || md->special_state.ai != (unsigned int)(skill_id == AM_SPHEREMINE?AI_SPHERE:skill_id == KO_ZANZOU?AI_ZANZOU:skill_id == MH_SUMMON_LEGION?AI_ATTACK:AI_FLORA) ) return 0; //Non alchemist summoned mobs have nothing to do here. if(md->class_==mob_class) (*c)++; @@ -16368,7 +16368,7 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s case KO_HYOUHU_HUBUKI: case KO_KAZEHU_SEIRAN: case KO_DOHU_KOUKAI: - if (sd->charm_type == skill->get_ele(skill_id, skill_lv) && sd->charm_count >= MAX_SPIRITCHARM) { + if ((int)sd->charm_type == skill->get_ele(skill_id, skill_lv) && sd->charm_count >= MAX_SPIRITCHARM) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_SUMMON, 0, 0); return 0; } @@ -16495,7 +16495,7 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s } break; case ST_RECOV_WEIGHT_RATE: - if (pc_overhealweightrate(sd) <= 100 && sd->weight * 100 / sd->max_weight >= pc_overhealweightrate(sd)) { + if (pc_overhealweightrate(sd) <= 100 && sd->weight * 100 / sd->max_weight >= (unsigned int)pc_overhealweightrate(sd)) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0, 0); return 0; } @@ -16609,14 +16609,14 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s } PRAGMA_GCC46(GCC diagnostic pop) - if(require.mhp > 0 && get_percentage(st->hp, st->max_hp) > require.mhp) { + if(require.mhp > 0 && get_percentage(st->hp, st->max_hp) > (unsigned int)require.mhp) { //mhp is the max-hp-requirement, that is, //you must have this % or less of HP to cast it. clif->skill_fail(sd, skill_id, USESKILL_FAIL_HP_INSUFFICIENT, 0, 0); return 0; } - if (require.msp > 0 && get_percentage(st->sp, st->max_sp) > require.msp) { + if (require.msp > 0 && get_percentage(st->sp, st->max_sp) > (unsigned int)require.msp) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_SP_INSUFFICIENT, 0, 0); return 0; } @@ -18134,7 +18134,7 @@ static void skill_weaponrefine(struct map_session_data *sd, int idx) per = refine->get_refine_chance(ditem->wlv, (int)item->refine, REFINE_CHANCE_TYPE_NORMAL) * 10; // Aegis leaked formula. [malufett] - if (sd->status.class == JOB_MECHANIC_T) + if (sd->status.class_ == JOB_MECHANIC_T) per += 100; else per += 5 * (sd->status.job_level - 50); @@ -19695,7 +19695,7 @@ static int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap case UNT_FEINTBOMB: { struct block_list *src = map->id2bl(group->src_id); if( src ) { - map->foreachinrange(skill->area_sub, &su->bl, su->range, skill->splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, BCT_ENEMY|SD_ANIMATION|1, skill->castend_damage_id); + map->foreachinrange(skill->area_sub, &su->bl, su->range, skill->splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, (unsigned int)BCT_ENEMY | (unsigned int)SD_ANIMATION | 1, skill->castend_damage_id); // FIXME: we shouldn't be mixing different enums for bit fields status_change_end(src, SC__FEINTBOMB_MASTER, INVALID_TIMER); } skill->delunit(su); @@ -20109,7 +20109,8 @@ static int skill_can_produce_mix(struct map_session_data *sd, int nameid, int tr static int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty) { int slot[3]; - int i,sc,ele,idx,equip,wlv,make_per = 0,flag = 0,skill_lv = 0; + int i,sc,ele,idx,equip,make_per = 0,flag = 0,skill_lv = 0; + int wlv = 0; // Consider weapon level 0 until actually a weapon is picked later in code int num = -1; // exclude the recipe struct status_data *st; struct item_data* data; @@ -20872,7 +20873,7 @@ static int skill_magicdecoy(struct map_session_data *sd, int nameid) md->master_id = sd->bl.id; md->special_state.ai = AI_FLORA; if( md->deletetimer != INVALID_TIMER ) - timer->delete(md->deletetimer, mob->timer_delete); + timer->delete_(md->deletetimer, mob->timer_delete); md->deletetimer = timer->add(timer->gettick() + skill->get_time(NC_MAGICDECOY,skill_id), mob->timer_delete, md->bl.id, 0); mob->spawn(md); md->status.matk_min = md->status.matk_max = 250 + (50 * skill_id); @@ -21777,7 +21778,7 @@ static void skill_cooldown_save(struct map_session_data *sd) cd->entry[i]->duration = DIFF_TICK32(cd->entry[i]->started + cd->entry[i]->duration, now); if (cd->entry[i]->timer != INVALID_TIMER) { - timer->delete(cd->entry[i]->timer, skill->blockpc_end); + timer->delete_(cd->entry[i]->timer, skill->blockpc_end); cd->entry[i]->timer = INVALID_TIMER; } } diff --git a/src/map/skill.h b/src/map/skill.h index 3f0ddab731b..5758b30cd50 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -2126,7 +2126,7 @@ struct skill_interface { int (*get_unit_layout_type) (int skill_id, int skill_lv); int (*get_unit_range) (int skill_id, int skill_lv); int (*get_cooldown) (int skill_id, int skill_lv); - int (*tree_get_max) (int skill_id, int class); + int (*tree_get_max) (int skill_id, int class_); const char *(*get_name) (int skill_id); const char *(*get_desc) (int skill_id); /* whether its CAST_GROUND, CAST_DAMAGE or CAST_NODAMAGE */ diff --git a/src/map/status.c b/src/map/status.c index ed4ec4d583c..1c86a564982 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1189,7 +1189,7 @@ static int status_calc_mob_(struct mob_data *md, enum e_status_calc_opt opt) mstatus->max_sp += diff*mstatus->int_; mstatus->hp = mstatus->max_hp; mstatus->sp = mstatus->max_sp; - mstatus->speed -= cap_value(diff, 0, mstatus->speed - 10); + mstatus->speed -= cap_value((unsigned int)diff, 0, mstatus->speed - 10); } if (flag&2 && battle_config.mob_size_influence) { @@ -1298,8 +1298,8 @@ static int status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt) pstatus->dex = (bstat->dex*lv)/pd->db->lv; pstatus->luk = (bstat->luk*lv)/pd->db->lv; - pstatus->rhw.atk = cap_value(pstatus->rhw.atk, 1, battle_config.pet_max_atk1); - pstatus->rhw.atk2 = cap_value(pstatus->rhw.atk2, 2, battle_config.pet_max_atk2); + pstatus->rhw.atk = cap_value(pstatus->rhw.atk, 1, (unsigned int)battle_config.pet_max_atk1); + pstatus->rhw.atk2 = cap_value(pstatus->rhw.atk2, 2, (unsigned int)battle_config.pet_max_atk2); pstatus->str = cap_value(pstatus->str,1,battle_config.pet_max_stats); pstatus->agi = cap_value(pstatus->agi,1,battle_config.pet_max_stats); pstatus->vit = cap_value(pstatus->vit,1,battle_config.pet_max_stats); @@ -1332,7 +1332,7 @@ static unsigned int status_get_base_maxsp(const struct map_session_data *sd, con nullpo_ret(sd); nullpo_ret(st); - val = pc->class2idx(sd->status.class); + val = pc->class2idx(sd->status.class_); val = status->dbs->SP_table[val][sd->status.base_level]; if ((sd->job & JOBL_UPPER) != 0) @@ -1353,7 +1353,7 @@ static unsigned int status_get_base_maxhp(const struct map_session_data *sd, con nullpo_ret(sd); nullpo_ret(st); - val = pc->class2idx(sd->status.class); + val = pc->class2idx(sd->status.class_); val = status->dbs->HP_table[val][sd->status.base_level]; if ((sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99) @@ -1460,8 +1460,9 @@ static int status_calc_pc_(struct map_session_data *sd, enum e_status_calc_opt o struct status_data *bstatus; // pointer to the player's base status const struct status_change *sc; struct s_skill b_skill[MAX_SKILL_DB]; // previous skill tree - int b_weight, b_max_weight, b_cart_weight_max, // previous weight + int b_cart_weight_max, // previous weight i, k, index, skill_lv,refinedef=0; + unsigned int b_weight, b_max_weight; int64 i64; nullpo_retr(-1, sd); @@ -1477,7 +1478,7 @@ static int status_calc_pc_(struct map_session_data *sd, enum e_status_calc_opt o pc->calc_skilltree(sd); // SkillTree calculation - sd->max_weight = status->dbs->max_weight_base[pc->class2idx(sd->status.class)]+sd->status.str*300; + sd->max_weight = status->dbs->max_weight_base[pc->class2idx(sd->status.class_)]+sd->status.str*300; if(opt&SCO_FIRST) { //Load Hp/SP from char-received data. @@ -1863,7 +1864,7 @@ static int status_calc_pc_(struct map_session_data *sd, enum e_status_calc_opt o // ----- STATS CALCULATION ----- // Job bonuses - index = pc->class2idx(sd->status.class); + index = pc->class2idx(sd->status.class_); for (i = 0; i < sd->status.job_level && i < MAX_LEVEL; i++) { if(!status->dbs->job_bonus[index][i]) continue; @@ -3247,7 +3248,7 @@ static void status_calc_bl_main(struct block_list *bl, e_scb_flag flag) st->speed = status->calc_speed(bl, sc, bst->speed); - if( bl->type&BL_PC && !(sd && sd->state.permanent_speed) && st->speed < battle_config.max_walk_speed ) + if( bl->type&BL_PC && !(sd && sd->state.permanent_speed) && st->speed < (unsigned int)battle_config.max_walk_speed ) st->speed = battle_config.max_walk_speed; if (bl->type&BL_HOM && battle_config.hom_setting&0x8) { @@ -3728,11 +3729,11 @@ static int status_base_amotion_pc(struct map_session_data *sd, struct status_dat nullpo_ret(sd); nullpo_ret(st); - amotion = status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype1]; + amotion = status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1]; if (sd->weapontype > MAX_SINGLE_WEAPON_TYPE) - amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype2] / 4; + amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2] / 4; if (sd->has_shield) - amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class)][MAX_SINGLE_WEAPON_TYPE]; + amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class_)][MAX_SINGLE_WEAPON_TYPE]; switch (sd->weapontype) { case W_BOW: case W_MUSICAL: @@ -3761,8 +3762,8 @@ static int status_base_amotion_pc(struct map_session_data *sd, struct status_dat #else // base weapon delay amotion = (sd->weapontype < MAX_SINGLE_WEAPON_TYPE) - ? (status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype]) // single weapon - : (status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype1] + status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype2]) * 7 / 10; // dual-wield + ? (status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype]) // single weapon + : (status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1] + status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2]) * 7 / 10; // dual-wield // percentual delay reduction from stats amotion -= amotion * (4 * st->agi + st->dex) / 1000; @@ -6219,12 +6220,12 @@ static int status_get_class(const struct block_list *bl) nullpo_ret(bl); switch (bl->type) { case BL_PC: - return BL_UCCAST(BL_PC, bl)->status.class; + return BL_UCCAST(BL_PC, bl)->status.class_; case BL_MOB: { const struct view_data *const vd = BL_UCCAST(BL_MOB, bl)->vd; nullpo_ret(vd); - return vd->class; //Class used on all code should be the view class of the mob. + return vd->class_; //Class used on all code should be the view class of the mob. } case BL_PET: return BL_UCCAST(BL_PET, bl)->pet.class_; @@ -6670,9 +6671,9 @@ static void status_set_viewdata(struct block_list *bl, int class_) vd = npc->get_viewdata(class_); else if (homdb_checkid(class_)) vd = homun->get_viewdata(class_); - else if (mercenary->class(class_)) + else if (mercenary->class_(class_)) vd = mercenary->get_viewdata(class_); - else if (elemental->class(class_)) + else if (elemental->class_(class_)) vd = elemental->get_viewdata(class_); else vd = NULL; @@ -6708,7 +6709,7 @@ static void status_set_viewdata(struct block_list *bl, int class_) } PRAGMA_GCC46(GCC diagnostic pop) } - sd->vd.class = class_; + sd->vd.class_ = class_; clif->get_weapon_view(sd, &sd->vd.weapon, &sd->vd.shield); sd->vd.head_top = sd->status.look.head_top; sd->vd.head_mid = sd->status.look.head_mid; @@ -6751,7 +6752,7 @@ static void status_set_viewdata(struct block_list *bl, int class_) md->vd = vd; } else if (pc->db_checkid(class_)) { mob->set_dynamic_viewdata(md); - md->vd->class = class_; + md->vd->class_ = class_; } else { ShowError("status_set_viewdata (MOB): No view data for class %d\n", class_); } @@ -6762,7 +6763,7 @@ static void status_set_viewdata(struct block_list *bl, int class_) struct pet_data *pd = BL_UCAST(BL_PET, bl); if (vd != NULL) { memcpy(&pd->vd, vd, sizeof(struct view_data)); - if (!pc->db_checkid(vd->class)) { + if (!pc->db_checkid(vd->class_)) { pd->vd.hair_style = battle_config.pet_hair_style; if(pd->pet.equip) { pd->vd.head_bottom = itemdb_viewid(pd->pet.equip); @@ -6782,7 +6783,7 @@ static void status_set_viewdata(struct block_list *bl, int class_) memcpy(&nd->vd, vd, sizeof(struct view_data)); } else if (pc->db_checkid(class_)) { memset(&nd->vd, 0, sizeof(struct view_data)); - nd->vd.class = class_; + nd->vd.class_ = class_; } else { ShowError("status_set_viewdata (NPC): No view data for class %d (name=%s)\n", class_, nd->name); } @@ -7478,7 +7479,7 @@ static int status_change_start_sub(struct block_list *src, struct block_list *bl val3 |= sc->data[type]->val3; val4 |= sc->data[type]->val4; } - mode = val2 != 0 ? val2 : bst->mode; // Base mode + mode = (unsigned int)val2 != 0 ? (unsigned int)val2 : bst->mode; // Base mode if (val4 != 0) mode &= ~val4; //Del mode if (val3 != 0) @@ -7786,7 +7787,7 @@ static int status_change_start_sub(struct block_list *src, struct block_list *bl //Kaahi overwrites previous level regardless of existing level. //Delete timer if it exists. if (sce->val4 != INVALID_TIMER) { - timer->delete(sce->val4,status->kaahi_heal_timer); + timer->delete_(sce->val4,status->kaahi_heal_timer); sce->val4 = INVALID_TIMER; } break; @@ -8527,7 +8528,7 @@ static int status_change_start_sub(struct block_list *src, struct block_list *bl sc_start4(src, src2, SC_RG_CCONFINE_M, 100, val1, 1, 0, 0, total_tick + 1000, skill_id); else { //Increase count of locked enemies and refresh time. (sce2->val2)++; - timer->delete(sce2->timer, status->change_timer); + timer->delete_(sce2->timer, status->change_timer); sce2->timer = timer->add(timer->gettick()+total_tick+1000, status->change_timer, src2->id, SC_RG_CCONFINE_M); } } else //Status failed. @@ -9987,7 +9988,7 @@ static int status_change_start_sub(struct block_list *src, struct block_list *bl case SC_DRESS_UP: if (vd == NULL) break; - clif->changelook(bl, LOOK_BASE, vd->class); + clif->changelook(bl, LOOK_BASE, vd->class_); clif->changelook(bl, LOOK_WEAPON, 0); clif->changelook(bl, LOOK_SHIELD, 0); clif->changelook(bl, LOOK_CLOTHES_COLOR, vd->cloth_color); @@ -10017,7 +10018,7 @@ static int status_change_start_sub(struct block_list *src, struct block_list *bl clif->changeoption(bl); if( sd && opt_flag&0x4 ) { if (vd) - clif->changelook(bl, LOOK_BASE, vd->class); + clif->changelook(bl, LOOK_BASE, vd->class_); clif->changelook(bl,LOOK_WEAPON,0); clif->changelook(bl,LOOK_SHIELD,0); if (vd) @@ -10058,7 +10059,7 @@ static int status_change_start_sub(struct block_list *src, struct block_list *bl //Don't trust the previous sce assignment, in case the SC ended somewhere between there and here. if((sce=sc->data[type])) {// reuse old sc if( sce->timer != INVALID_TIMER ) - timer->delete(sce->timer, status->change_timer); + timer->delete_(sce->timer, status->change_timer); } else {// new sc ++(sc->count); sce = sc->data[type] = ers_alloc(status->data_ers, struct status_change_entry); @@ -10628,7 +10629,7 @@ static void status_change_start_stop_action(struct block_list *bl, enum sc_type case SC_GRAVITYCONTROL: { struct status_change *sc = status->get_sc(bl); - if (sc->data[SC_DANCING] != NULL) + if (sc != NULL && sc->data[SC_DANCING] != NULL) unit->stop_walking(bl, STOPWALKING_FLAG_FIXPOS); FALLTHROUGH } @@ -11253,7 +11254,7 @@ static int status_change_clear(struct block_list *bl, int type) //If for some reason status_change_end decides to still keep the status when quitting. [Skotlex] (sc->count)--; if (sc->data[i]->timer != INVALID_TIMER) - timer->delete(sc->data[i]->timer, status->change_timer); + timer->delete_(sc->data[i]->timer, status->change_timer); ers_free(status->data_ers, sc->data[i]); sc->data[i] = NULL; } @@ -11303,7 +11304,7 @@ static int status_change_end_(struct block_list *bl, enum sc_type type, int tid) //Do not end infinite endure. return 0; if (sce->timer != INVALID_TIMER) //Could be a SC with infinite duration - timer->delete(sce->timer,status->change_timer); + timer->delete_(sce->timer,status->change_timer); if (sc->opt1) { PRAGMA_GCC46(GCC diagnostic push) PRAGMA_GCC46(GCC diagnostic ignored "-Wswitch-enum") @@ -11353,7 +11354,7 @@ static int status_change_end_(struct block_list *bl, enum sc_type type, int tid) switch(type) { case SC_GRANITIC_ARMOR: { - int damage = st->max_hp*sce->val3/100; + unsigned int damage = st->max_hp*sce->val3/100; if(st->hp < damage) //to not kill him damage = st->hp-1; status->damage(NULL, bl, damage,0,0,1); @@ -11599,7 +11600,7 @@ static int status_change_end_(struct block_list *bl, enum sc_type type, int tid) case SC_KAAHI: //Delete timer if it exists. if (sce->val4 != INVALID_TIMER) - timer->delete(sce->val4,status->kaahi_heal_timer); + timer->delete_(sce->val4,status->kaahi_heal_timer); break; case SC_JAILED: if(tid == INVALID_TIMER) @@ -12273,7 +12274,7 @@ static int status_change_end_(struct block_list *bl, enum sc_type type, int tid) else if(opt_flag) { clif->changeoption(bl); if( sd && opt_flag&0x4 ) { - clif->changelook(bl, LOOK_BASE, sd->vd.class); + clif->changelook(bl, LOOK_BASE, sd->vd.class_); clif->get_weapon_view(sd, &sd->vd.weapon, &sd->vd.shield); clif->changelook(bl,LOOK_WEAPON,sd->vd.weapon); clif->changelook(bl,LOOK_SHIELD,sd->vd.shield); @@ -12466,7 +12467,7 @@ static int status_change_timer(int tid, int64 tick, int id, intptr_t data) break; case SC_POISON: - if (st->hp <= max(st->max_hp / 4, sce->val4)) //Stop damaging after 25% HP left. + if (st->hp <= max(st->max_hp / 4, (unsigned int)sce->val4)) //Stop damaging after 25% HP left. break; FALLTHROUGH case SC_DPOISON: @@ -12513,13 +12514,13 @@ static int status_change_timer(int tid, int64 tick, int id, intptr_t data) case SC_BLOODING: if (--(sce->val4) >= 0) { - int hp = rnd()%600 + 200; + unsigned int hp = rnd()%600 + 200; struct block_list* src = map->id2bl(sce->val2); if( src && bl && bl->type == BL_MOB ) { - mob->log_damage(BL_UCAST(BL_MOB, bl), src, sd != NULL || hp < st->hp ? hp : st->hp-1); + mob->log_damage(BL_UCAST(BL_MOB, bl), src, sd != NULL || hp < st->hp ? hp : st->hp - 1); } map->freeblock_lock(); - status_fix_damage(src, bl, sd||hphp?hp:st->hp-1, 1); + status_fix_damage(src, bl, sd || hp < st->hp ? hp : st->hp - 1, 1); if( sc->data[type] ) { if( st->hp == 1 ) { map->freeblock_unlock(); @@ -12736,7 +12737,7 @@ static int status_change_timer(int tid, int64 tick, int id, intptr_t data) case SC_MAGICMUSHROOM: if( --(sce->val4) > 0 ) { bool flag = 0; - int damage = st->max_hp * 3 / 100; + unsigned int damage = st->max_hp * 3 / 100; if( st->hp <= damage ) damage = st->hp - 1; // Cannot Kill @@ -13060,7 +13061,7 @@ static int status_change_timer(int tid, int64 tick, int id, intptr_t data) case SC_OVERHEAT: { - int damage = st->max_hp / 100; // Suggestion 1% each second + unsigned int damage = st->max_hp / 100; // Suggestion 1% each second if( damage >= st->hp ) damage = st->hp - 1; // Do not kill, just keep you with 1 hp minimum map->freeblock_lock(); status_fix_damage(NULL,bl,damage,clif->damage(bl,bl,0,0,damage,0,BDT_NORMAL,0)); @@ -13092,7 +13093,7 @@ static int status_change_timer(int tid, int64 tick, int id, intptr_t data) case SC_STEALTHFIELD_MASTER: if(--(sce->val4) >= 0) { // 1% SP Upkeep Cost - int sp = st->max_sp / 100; + unsigned int sp = st->max_sp / 100; if( st->sp <= sp ) status_change_end(bl,SC_STEALTHFIELD_MASTER,INVALID_TIMER); @@ -13882,7 +13883,7 @@ static int status_natural_heal(struct block_list *bl, va_list args) if ((flag & RGN_SHP) != 0 && sregen->hp != 0 && sregen->rate.hp > 0) { //Sitting HP regen - int tick = max(battle_config.natural_heal_cap, battle_config.natural_heal_skill_interval * 100 / sregen->rate.hp); + unsigned int tick = max(battle_config.natural_heal_cap, battle_config.natural_heal_skill_interval * 100 / sregen->rate.hp); sregen->tick.hp += status->natural_heal_diff_tick; @@ -13900,7 +13901,7 @@ static int status_natural_heal(struct block_list *bl, va_list args) if ((flag & RGN_SSP) != 0 && sregen->sp != 0 && sregen->sp > 0) { //Sitting SP regen - int tick = max(battle_config.natural_heal_cap, battle_config.natural_heal_skill_interval * 100 / sregen->rate.sp); + unsigned int tick = max(battle_config.natural_heal_cap, battle_config.natural_heal_skill_interval * 100 / sregen->rate.sp); sregen->tick.sp += status->natural_heal_diff_tick; if (regen->state.overweight != 0) @@ -13997,7 +13998,7 @@ static int status_natural_heal(struct block_list *bl, va_list args) //Natural Hp regen if ((flag & RGN_HP) != 0 && hp_bonus > 0) { - int tick = max(interval_cap, hp_interval * 100 / hp_bonus); + unsigned int tick = max(interval_cap, hp_interval * 100 / hp_bonus); regen->tick.hp += status->natural_heal_diff_tick; if (ud != NULL && ud->walktimer != INVALID_TIMER) @@ -14017,7 +14018,7 @@ static int status_natural_heal(struct block_list *bl, va_list args) //Natural SP regen if ((flag & RGN_SP) != 0 && sp_bonus > 0) { - int tick = max(interval_cap, sp_interval * 100 / sp_bonus); + unsigned int tick = max(interval_cap, sp_interval * 100 / sp_bonus); regen->tick.sp += status->natural_heal_diff_tick; if (regen->tick.sp >= tick) { @@ -14041,7 +14042,7 @@ static int status_natural_heal(struct block_list *bl, va_list args) if ((flag & RGN_SHP) != 0 && sregen->hp != 0 && sregen->rate.hp > 0) { //Skill HP regen - int tick = max(battle_config.natural_heal_cap, battle_config.natural_heal_skill_interval * 100 / sregen->rate.hp); + unsigned int tick = max(battle_config.natural_heal_cap, battle_config.natural_heal_skill_interval * 100 / sregen->rate.hp); sregen->tick.hp += status->natural_heal_diff_tick; while (sregen->tick.hp >= tick) { @@ -14053,7 +14054,7 @@ static int status_natural_heal(struct block_list *bl, va_list args) if ((flag & RGN_SSP) != 0 && sregen->sp != 0 && sregen->rate.sp > 0) { //Skill SP regen - int tick = max(battle_config.natural_heal_cap, battle_config.natural_heal_skill_interval * 100 / sregen->rate.sp); + unsigned int tick = max(battle_config.natural_heal_cap, battle_config.natural_heal_skill_interval * 100 / sregen->rate.sp); sregen->tick.sp += status->natural_heal_diff_tick; while (sregen->tick.sp >= tick) { @@ -14385,26 +14386,26 @@ static void status_read_job_db(void) return; while ((jdb = libconfig->setting_get_elem(job_db_conf.root, i++))) { - int class, idx; + int class_, idx; const char *name = config_setting_name(jdb); - if ((class = pc->check_job_name(name)) == -1) { + if ((class_ = pc->check_job_name(name)) == -1) { ShowWarning("pc_read_job_db: '%s' unknown job name!\n", name); continue; } - idx = pc->class2idx(class); + idx = pc->class2idx(class_); status->read_job_db_sub(idx, name, jdb); - status->check_job_bonus(idx, name, class); + status->check_job_bonus(idx, name, class_); } ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, config_filename); libconfig->destroy(&job_db_conf); } -static void status_check_job_bonus(int idx, const char *name, int class) +static void status_check_job_bonus(int idx, const char *name, int class_) { - if (class == JOB_NOVICE || class == JOB_BABY) + if (class_ == JOB_NOVICE || class_ == JOB_BABY) return; Assert_retv(idx >= 0 && idx < CLASS_COUNT); @@ -14416,7 +14417,7 @@ static void status_check_job_bonus(int idx, const char *name, int class) } } if (isEmpty) { - ShowWarning("Missing job %s (%d) in job_db2.txt\n", name, class); + ShowWarning("Missing job %s (%d) in job_db2.txt\n", name, class_); } } @@ -14442,16 +14443,16 @@ static void status_load_sc_type(void) static bool status_readdb_job2(char *fields[], int columns, int current) { - int idx, class, i; + int idx, class_, i; nullpo_retr(false, fields); - class = atoi(fields[0]); + class_ = atoi(fields[0]); - if (!pc->db_checkid(class)) { - ShowWarning("status_readdb_job2: Invalid job class %d specified.\n", class); + if (!pc->db_checkid(class_)) { + ShowWarning("status_readdb_job2: Invalid job class %d specified.\n", class_); return false; } - idx = pc->class2idx(class); + idx = pc->class2idx(class_); for(i = 1; i < columns; i++) { diff --git a/src/map/status.h b/src/map/status.h index 0e18474e3b9..89da27adbd9 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -1575,7 +1575,7 @@ struct status_interface { void (*copy) (struct status_data *a, const struct status_data *b); int (*base_matk_min) (const struct status_data *st); int (*base_matk_max) (const struct status_data *st); - void (*check_job_bonus) (int idx, const char *name, int class); + void (*check_job_bonus) (int idx, const char *name, int class_); }; #ifdef HERCULES_CORE diff --git a/src/map/stylist.c b/src/map/stylist.c index b2d0fd53737..d9b868a7a8b 100644 --- a/src/map/stylist.c +++ b/src/map/stylist.c @@ -117,7 +117,7 @@ static bool stylist_validate_requirements(struct map_session_data *sd, int type, entry = &VECTOR_INDEX(stylist->data[type], idx); - if (sd->status.class == JOB_SUMMONER && (entry->allow_doram == false)) + if (sd->status.class_ == JOB_SUMMONER && (entry->allow_doram == false)) return false; if (entry->id >= 0) { diff --git a/src/map/unit.c b/src/map/unit.c index ab3d51a3f70..4ef5a3bacca 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -468,7 +468,7 @@ static int unit_walk_toxy_timer(int tid, int64 tick, int id, intptr_t data) if (ud->stepaction && ud->target_to != 0) { // Delete old stepaction even if not executed yet, the latest command is what counts if (ud->steptimer != INVALID_TIMER) { - timer->delete(ud->steptimer, unit->steptimer); + timer->delete_(ud->steptimer, unit->steptimer); ud->steptimer = INVALID_TIMER; } // Delay stepactions by half a step (so they are executed at full step) @@ -538,7 +538,7 @@ static int unit_walk_toxy_timer(int tid, int64 tick, int id, intptr_t data) // Walked on occupied cell, call unit->walk_toxy again if (ud->steptimer != INVALID_TIMER) { // Execute step timer on next step instead - timer->delete(ud->steptimer, unit->steptimer); + timer->delete_(ud->steptimer, unit->steptimer); ud->steptimer = INVALID_TIMER; } return unit->walk_toxy(bl, x, y, 8); @@ -1159,7 +1159,7 @@ static int unit_stop_walking(struct block_list *bl, int flag) //timer->delete function does not messes with it. If the function's //behavior changes in the future, this code could break! td = timer->get(ud->walktimer); - timer->delete(ud->walktimer, unit->walk_toxy_timer); + timer->delete_(ud->walktimer, unit->walk_toxy_timer); ud->walktimer = INVALID_TIMER; ud->state.change_walk_target = 0; tick = timer->gettick(); @@ -1853,7 +1853,7 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill ud->state.skillcastcancel = 0; if (sd == NULL || sd->auto_cast_current.type < AUTOCAST_ABRA || skill->get_cast(skill_id, skill_lv) != 0) - ud->canact_tick = tick + max(casttime, max(status_get_amotion(src), battle_config.min_skill_delay_limit)); + ud->canact_tick = tick + max(casttime, max((int)status_get_amotion(src), battle_config.min_skill_delay_limit)); if( sd ) { switch( skill_id ) @@ -1993,7 +1993,7 @@ static int unit_skilluse_pos2(struct block_list *src, short skill_x, short skill ud->state.skillcastcancel = castcancel&&casttime>0?1:0; if (sd == NULL || sd->auto_cast_current.type < AUTOCAST_ABRA || skill->get_cast(skill_id, skill_lv) != 0) - ud->canact_tick = tick + max(casttime, max(status_get_amotion(src), battle_config.min_skill_delay_limit)); + ud->canact_tick = tick + max(casttime, max((int)status_get_amotion(src), battle_config.min_skill_delay_limit)); #if 0 if (sd) { switch (skill_id) { @@ -2086,7 +2086,7 @@ static void unit_stop_attack(struct block_list *bl) return; //Clear timer - timer->delete(ud->attacktimer, unit->attack_timer); + timer->delete_(ud->attacktimer, unit->attack_timer); ud->attacktimer = INVALID_TIMER; } @@ -2111,7 +2111,7 @@ static void unit_stop_stepaction(struct block_list *bl) return; //Clear timer - timer->delete(ud->steptimer, unit->steptimer); + timer->delete_(ud->steptimer, unit->steptimer); ud->steptimer = INVALID_TIMER; } @@ -2225,7 +2225,7 @@ static int unit_cancel_combo(struct block_list *bl) if (ud->attacktimer == INVALID_TIMER) return 1; //Nothing more to do. - timer->delete(ud->attacktimer, unit->attack_timer); + timer->delete_(ud->attacktimer, unit->attack_timer); ud->attacktimer=timer->add(ud->attackabletime,unit->attack_timer,bl->id,0); return 1; } @@ -2547,9 +2547,9 @@ static int unit_skillcastcancel(struct block_list *bl, int type) skill_id = ud->skill_id; if (skill->get_inf(skill_id) & INF_GROUND_SKILL) - ret = timer->delete( ud->skilltimer, skill->castend_pos ); + ret = timer->delete_( ud->skilltimer, skill->castend_pos ); else - ret = timer->delete( ud->skilltimer, skill->castend_id ); + ret = timer->delete_( ud->skilltimer, skill->castend_id ); if( ret < 0 ) ShowError("delete timer error %d : skill %d (%s)\n",ret,skill_id,skill->get_name(skill_id)); @@ -2771,7 +2771,7 @@ static int unit_remove_map(struct block_list *bl, enum clr_type clrtype, const c sd->adopt_invite = 0; if(sd->pvp_timer != INVALID_TIMER) { - timer->delete(sd->pvp_timer,pc->calc_pvprank_timer); + timer->delete_(sd->pvp_timer,pc->calc_pvprank_timer); sd->pvp_timer = INVALID_TIMER; sd->pvp_rank = 0; } @@ -3040,7 +3040,7 @@ static int unit_free(struct block_list *bl, enum clr_type clrtype) if( pd->s_skill ) { if (pd->s_skill->timer != INVALID_TIMER) { - timer->delete(pd->s_skill->timer, pet->skill_support_timer); + timer->delete_(pd->s_skill->timer, pet->skill_support_timer); } aFree(pd->s_skill); pd->s_skill = NULL; @@ -3048,14 +3048,14 @@ static int unit_free(struct block_list *bl, enum clr_type clrtype) if( pd->recovery ) { if(pd->recovery->timer != INVALID_TIMER) - timer->delete(pd->recovery->timer, pet->recovery_timer); + timer->delete_(pd->recovery->timer, pet->recovery_timer); aFree(pd->recovery); pd->recovery = NULL; } if( pd->bonus ) { if (pd->bonus->timer != INVALID_TIMER) - timer->delete(pd->bonus->timer, pet->skill_bonus_timer); + timer->delete_(pd->bonus->timer, pet->skill_bonus_timer); aFree(pd->bonus); pd->bonus = NULL; } @@ -3086,12 +3086,12 @@ static int unit_free(struct block_list *bl, enum clr_type clrtype) if( md->spawn_timer != INVALID_TIMER ) { - timer->delete(md->spawn_timer,mob->delayspawn); + timer->delete_(md->spawn_timer,mob->delayspawn); md->spawn_timer = INVALID_TIMER; } if( md->deletetimer != INVALID_TIMER ) { - timer->delete(md->deletetimer,mob->timer_delete); + timer->delete_(md->deletetimer,mob->timer_delete); md->deletetimer = INVALID_TIMER; } if( md->lootitem ) diff --git a/src/map/unit.h b/src/map/unit.h index 6f4c1ce9822..b04cac238a3 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -83,7 +83,7 @@ struct unit_data { }; struct view_data { - int16 class; + int16 class_; int weapon, shield, //Or left-hand weapon. robe, diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index abbc5d6bb60..699839487e8 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -166,8 +166,8 @@ typedef void (*HPMHOOK_pre_achievement_validate_item_sell) (struct map_session_d typedef void (*HPMHOOK_post_achievement_validate_item_sell) (struct map_session_data *sd, int nameid, int amount); typedef void (*HPMHOOK_pre_achievement_validate_achieve) (struct map_session_data **sd, int *achid); typedef void (*HPMHOOK_post_achievement_validate_achieve) (struct map_session_data *sd, int achid); -typedef void (*HPMHOOK_pre_achievement_validate_taming) (struct map_session_data **sd, int *class); -typedef void (*HPMHOOK_post_achievement_validate_taming) (struct map_session_data *sd, int class); +typedef void (*HPMHOOK_pre_achievement_validate_taming) (struct map_session_data **sd, int *class_); +typedef void (*HPMHOOK_post_achievement_validate_taming) (struct map_session_data *sd, int class_); typedef void (*HPMHOOK_pre_achievement_validate_achievement_rank) (struct map_session_data **sd, int *rank); typedef void (*HPMHOOK_post_achievement_validate_achievement_rank) (struct map_session_data *sd, int rank); typedef bool (*HPMHOOK_pre_achievement_type_requires_criteria) (enum achievement_types *type); @@ -1046,8 +1046,8 @@ typedef int (*HPMHOOK_pre_chr_online_data_cleanup_sub) (union DBKey *key, struct typedef int (*HPMHOOK_post_chr_online_data_cleanup_sub) (int retVal___, union DBKey key, struct DBData *data, va_list ap); typedef int (*HPMHOOK_pre_chr_online_data_cleanup) (int *tid, int64 *tick, int *id, intptr_t *data); typedef int (*HPMHOOK_post_chr_online_data_cleanup) (int retVal___, int tid, int64 tick, int id, intptr_t data); -typedef void (*HPMHOOK_pre_chr_change_sex_sub) (int *sex, int *acc, int *char_id, int *class, int *guild_id); -typedef void (*HPMHOOK_post_chr_change_sex_sub) (int sex, int acc, int char_id, int class, int guild_id); +typedef void (*HPMHOOK_pre_chr_change_sex_sub) (int *sex, int *acc, int *char_id, int *class_, int *guild_id); +typedef void (*HPMHOOK_post_chr_change_sex_sub) (int sex, int acc, int char_id, int class_, int guild_id); typedef void (*HPMHOOK_pre_chr_online_char_destroy) (struct online_char_data **character); typedef void (*HPMHOOK_post_chr_online_char_destroy) (struct online_char_data *character); typedef int (*HPMHOOK_pre_chr_online_char_destroy_sub) (union DBKey *key, struct DBData **data, va_list ap); @@ -1790,8 +1790,8 @@ typedef void (*HPMHOOK_pre_clif_divorced) (struct map_session_data **sd, const c typedef void (*HPMHOOK_post_clif_divorced) (struct map_session_data *sd, const char *name); typedef void (*HPMHOOK_pre_clif_callpartner) (struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_callpartner) (struct map_session_data *sd); -typedef int (*HPMHOOK_pre_clif_skill_damage) (struct block_list **src, struct block_list **dst, int64 *tick, int *sdelay, int *ddelay, int64 *damage, int *div, uint16 *skill_id, uint16 *skill_lv, enum battle_dmg_type *type); -typedef int (*HPMHOOK_post_clif_skill_damage) (int retVal___, struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 damage, int div, uint16 skill_id, uint16 skill_lv, enum battle_dmg_type type); +typedef int (*HPMHOOK_pre_clif_skill_damage) (struct block_list **src, struct block_list **dst, int64 *tick, int *sdelay, int *ddelay, int64 *damage, int *div, uint16 *skill_id, int *skill_lv, enum battle_dmg_type *type); +typedef int (*HPMHOOK_post_clif_skill_damage) (int retVal___, struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 damage, int div, uint16 skill_id, int skill_lv, enum battle_dmg_type type); typedef int (*HPMHOOK_pre_clif_skill_nodamage) (struct block_list **src, struct block_list **dst, uint16 *skill_id, int *heal, int *fail); typedef int (*HPMHOOK_post_clif_skill_nodamage) (int retVal___, struct block_list *src, struct block_list *dst, uint16 skill_id, int heal, int fail); typedef void (*HPMHOOK_pre_clif_skill_poseffect) (struct block_list **src, uint16 *skill_id, int *val, int *x, int *y, int64 *tick); @@ -1914,8 +1914,8 @@ typedef const char * (*HPMHOOK_pre_clif_process_chat_message) (struct map_sessio typedef const char * (*HPMHOOK_post_clif_process_chat_message) (const char * retVal___, struct map_session_data *sd, const struct packet_chat_message *packet, char *out_buf, int out_buflen); typedef bool (*HPMHOOK_pre_clif_process_whisper_message) (struct map_session_data **sd, const struct packet_whisper_message **packet, char **out_name, char **out_message, int *out_messagelen); typedef bool (*HPMHOOK_post_clif_process_whisper_message) (bool retVal___, struct map_session_data *sd, const struct packet_whisper_message *packet, char *out_name, char *out_message, int out_messagelen); -typedef bool (*HPMHOOK_pre_clif_validate_message) (struct map_session_data **sd, char **message); -typedef bool (*HPMHOOK_post_clif_validate_message) (bool retVal___, struct map_session_data *sd, char *message); +typedef bool (*HPMHOOK_pre_clif_validate_message) (struct map_session_data **sd, const char **message); +typedef bool (*HPMHOOK_post_clif_validate_message) (bool retVal___, struct map_session_data *sd, const char *message); typedef void (*HPMHOOK_pre_clif_wisexin) (struct map_session_data **sd, int *type, int *flag); typedef void (*HPMHOOK_post_clif_wisexin) (struct map_session_data *sd, int type, int flag); typedef void (*HPMHOOK_pre_clif_wisall) (struct map_session_data **sd, int *type, int *flag); @@ -3254,8 +3254,8 @@ typedef void (*HPMHOOK_pre_des_decrypt) (unsigned char **data, size_t *size); typedef void (*HPMHOOK_post_des_decrypt) (unsigned char *data, size_t size); #endif // COMMON_DES_H #ifdef MAP_DUEL_H /* duel */ -typedef int (*HPMHOOK_pre_duel_create) (struct map_session_data **sd, const unsigned int *maxpl); -typedef int (*HPMHOOK_post_duel_create) (int retVal___, struct map_session_data *sd, const unsigned int maxpl); +typedef unsigned int (*HPMHOOK_pre_duel_create) (struct map_session_data **sd, const unsigned int *maxpl); +typedef unsigned int (*HPMHOOK_post_duel_create) (unsigned int retVal___, struct map_session_data *sd, const unsigned int maxpl); typedef void (*HPMHOOK_pre_duel_invite) (const unsigned int *did, struct map_session_data **sd, struct map_session_data **target_sd); typedef void (*HPMHOOK_post_duel_invite) (const unsigned int did, struct map_session_data *sd, struct map_session_data *target_sd); typedef void (*HPMHOOK_pre_duel_accept) (const unsigned int *did, struct map_session_data **sd); @@ -3278,8 +3278,8 @@ typedef int (*HPMHOOK_pre_elemental_init) (bool *minimal); typedef int (*HPMHOOK_post_elemental_init) (int retVal___, bool minimal); typedef void (*HPMHOOK_pre_elemental_final) (void); typedef void (*HPMHOOK_post_elemental_final) (void); -typedef bool (*HPMHOOK_pre_elemental_class) (int *class_); -typedef bool (*HPMHOOK_post_elemental_class) (bool retVal___, int class_); +typedef bool (*HPMHOOK_pre_elemental_class_) (int *class_); +typedef bool (*HPMHOOK_post_elemental_class_) (bool retVal___, int class_); typedef struct view_data * (*HPMHOOK_pre_elemental_get_viewdata) (int *class_); typedef struct view_data * (*HPMHOOK_post_elemental_get_viewdata) (struct view_data * retVal___, int class_); typedef int (*HPMHOOK_pre_elemental_create) (struct map_session_data **sd, int *class_, unsigned int *lifetime); @@ -3404,10 +3404,10 @@ typedef bool (*HPMHOOK_pre_extraconf_read_conf) (const char **filename, bool *im typedef bool (*HPMHOOK_post_extraconf_read_conf) (bool retVal___, const char *filename, bool imported, struct config_t *config, const char *node, const struct config_data *conf_vars); typedef bool (*HPMHOOK_pre_extraconf_read_vars) (const char **filename, bool *imported, struct config_t **config, const char **node, const struct config_data **conf_vars); typedef bool (*HPMHOOK_post_extraconf_read_vars) (bool retVal___, const char *filename, bool imported, struct config_t *config, const char *node, const struct config_data *conf_vars); -typedef bool (*HPMHOOK_pre_extraconf_set_var) (struct config_data **conf_var, int *val); -typedef bool (*HPMHOOK_post_extraconf_set_var) (bool retVal___, struct config_data *conf_var, int val); -typedef bool (*HPMHOOK_pre_extraconf_set_var_str) (struct config_data **conf_var, const char **val); -typedef bool (*HPMHOOK_post_extraconf_set_var_str) (bool retVal___, struct config_data *conf_var, const char *val); +typedef bool (*HPMHOOK_pre_extraconf_set_var) (const struct config_data **conf_var, int *val); +typedef bool (*HPMHOOK_post_extraconf_set_var) (bool retVal___, const struct config_data *conf_var, int val); +typedef bool (*HPMHOOK_pre_extraconf_set_var_str) (const struct config_data **conf_var, const char **val); +typedef bool (*HPMHOOK_post_extraconf_set_var_str) (bool retVal___, const struct config_data *conf_var, const char *val); typedef bool (*HPMHOOK_pre_extraconf_read_emblems) (void); typedef bool (*HPMHOOK_post_extraconf_read_emblems) (bool retVal___); #endif // COMMON_EXTRACONF_H @@ -3570,8 +3570,8 @@ typedef int (*HPMHOOK_pre_guild_check_alliance) (int *guild_id1, int *guild_id2, typedef int (*HPMHOOK_post_guild_check_alliance) (int retVal___, int guild_id1, int guild_id2, int flag); typedef int (*HPMHOOK_pre_guild_send_memberinfoshort) (struct map_session_data **sd, int *online); typedef int (*HPMHOOK_post_guild_send_memberinfoshort) (int retVal___, struct map_session_data *sd, int online); -typedef int (*HPMHOOK_pre_guild_recv_memberinfoshort) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class, uint32 *last_login); -typedef int (*HPMHOOK_post_guild_recv_memberinfoshort) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class, uint32 last_login); +typedef int (*HPMHOOK_pre_guild_recv_memberinfoshort) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_, uint32 *last_login); +typedef int (*HPMHOOK_post_guild_recv_memberinfoshort) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class_, uint32 last_login); typedef int (*HPMHOOK_pre_guild_change_memberposition) (int *guild_id, int *account_id, int *char_id, short *idx); typedef int (*HPMHOOK_post_guild_change_memberposition) (int retVal___, int guild_id, int account_id, int char_id, short idx); typedef int (*HPMHOOK_pre_guild_memberposition_changed) (struct guild **g, int *idx, int *pos); @@ -4146,8 +4146,8 @@ typedef bool (*HPMHOOK_pre_inter_guild_add_member) (int *guild_id, const struct typedef bool (*HPMHOOK_post_inter_guild_add_member) (bool retVal___, int guild_id, const struct guild_member *member); typedef bool (*HPMHOOK_pre_inter_guild_leave) (int *guild_id, int *account_id, int *char_id, int *flag, const char **mes); typedef bool (*HPMHOOK_post_inter_guild_leave) (bool retVal___, int guild_id, int account_id, int char_id, int flag, const char *mes); -typedef bool (*HPMHOOK_pre_inter_guild_update_member_info_short) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class); -typedef bool (*HPMHOOK_post_inter_guild_update_member_info_short) (bool retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class); +typedef bool (*HPMHOOK_pre_inter_guild_update_member_info_short) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); +typedef bool (*HPMHOOK_post_inter_guild_update_member_info_short) (bool retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class_); typedef bool (*HPMHOOK_pre_inter_guild_update_member_info) (int *guild_id, int *account_id, int *char_id, enum guild_member_info *type, const char **data, int *len); typedef bool (*HPMHOOK_post_inter_guild_update_member_info) (bool retVal___, int guild_id, int account_id, int char_id, enum guild_member_info type, const char *data, int len); typedef bool (*HPMHOOK_pre_inter_guild_disband) (int *guild_id); @@ -4198,8 +4198,8 @@ typedef bool (*HPMHOOK_pre_inter_msg_config_read) (const char **cfg_name, bool * typedef bool (*HPMHOOK_post_inter_msg_config_read) (bool retVal___, const char *cfg_name, bool allow_override); typedef void (*HPMHOOK_pre_inter_do_final_msg) (void); typedef void (*HPMHOOK_post_inter_do_final_msg) (void); -typedef const char * (*HPMHOOK_pre_inter_job_name) (int *class); -typedef const char * (*HPMHOOK_post_inter_job_name) (const char * retVal___, int class); +typedef const char * (*HPMHOOK_pre_inter_job_name) (int *class_); +typedef const char * (*HPMHOOK_post_inter_job_name) (const char * retVal___, int class_); typedef void (*HPMHOOK_pre_inter_vmsg_to_fd) (int *fd, int *u_fd, int *aid, char **msg, va_list ap); typedef void (*HPMHOOK_post_inter_vmsg_to_fd) (int fd, int u_fd, int aid, char *msg, va_list ap); typedef void (*HPMHOOK_pre_inter_savereg) (int *account_id, int *char_id, const char **key, unsigned int *index, intptr_t *val, bool *is_string); @@ -4466,8 +4466,8 @@ typedef int (*HPMHOOK_pre_intif_guild_addmember) (int *guild_id, struct guild_me typedef int (*HPMHOOK_post_intif_guild_addmember) (int retVal___, int guild_id, struct guild_member *m); typedef int (*HPMHOOK_pre_intif_guild_leave) (int *guild_id, int *account_id, int *char_id, int *flag, const char **mes); typedef int (*HPMHOOK_post_intif_guild_leave) (int retVal___, int guild_id, int account_id, int char_id, int flag, const char *mes); -typedef int (*HPMHOOK_pre_intif_guild_memberinfoshort) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class); -typedef int (*HPMHOOK_post_intif_guild_memberinfoshort) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class); +typedef int (*HPMHOOK_pre_intif_guild_memberinfoshort) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); +typedef int (*HPMHOOK_post_intif_guild_memberinfoshort) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class_); typedef int (*HPMHOOK_pre_intif_guild_break) (int *guild_id); typedef int (*HPMHOOK_post_intif_guild_break) (int retVal___, int guild_id); typedef int (*HPMHOOK_pre_intif_guild_change_gm) (int *guild_id, const char **name, int *len); @@ -5954,8 +5954,8 @@ typedef int (*HPMHOOK_pre_mapif_parse_GuildAddMember) (int *fd, int *guild_id, c typedef int (*HPMHOOK_post_mapif_parse_GuildAddMember) (int retVal___, int fd, int guild_id, const struct guild_member *m); typedef int (*HPMHOOK_pre_mapif_parse_GuildLeave) (int *fd, int *guild_id, int *account_id, int *char_id, int *flag, const char **mes); typedef int (*HPMHOOK_post_mapif_parse_GuildLeave) (int retVal___, int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); -typedef int (*HPMHOOK_pre_mapif_parse_GuildChangeMemberInfoShort) (int *fd, int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class); -typedef int (*HPMHOOK_post_mapif_parse_GuildChangeMemberInfoShort) (int retVal___, int fd, int guild_id, int account_id, int char_id, int online, int lv, int class); +typedef int (*HPMHOOK_pre_mapif_parse_GuildChangeMemberInfoShort) (int *fd, int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); +typedef int (*HPMHOOK_post_mapif_parse_GuildChangeMemberInfoShort) (int retVal___, int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); typedef int (*HPMHOOK_pre_mapif_parse_BreakGuild) (int *fd, int *guild_id); typedef int (*HPMHOOK_post_mapif_parse_BreakGuild) (int retVal___, int fd, int guild_id); typedef int (*HPMHOOK_pre_mapif_parse_GuildBasicInfoChange) (int *fd, int *guild_id, int *type, const void **data, int *len); @@ -6264,8 +6264,8 @@ typedef void (*HPMHOOK_post_md5_salt) (int len, char *output); #ifdef MAP_MERCENARY_H /* mercenary */ typedef void (*HPMHOOK_pre_mercenary_init) (bool *minimal); typedef void (*HPMHOOK_post_mercenary_init) (bool minimal); -typedef bool (*HPMHOOK_pre_mercenary_class) (int *class_); -typedef bool (*HPMHOOK_post_mercenary_class) (bool retVal___, int class_); +typedef bool (*HPMHOOK_pre_mercenary_class_) (int *class_); +typedef bool (*HPMHOOK_post_mercenary_class_) (bool retVal___, int class_); typedef struct view_data * (*HPMHOOK_pre_mercenary_get_viewdata) (int *class_); typedef struct view_data * (*HPMHOOK_post_mercenary_get_viewdata) (struct view_data * retVal___, int class_); typedef int (*HPMHOOK_pre_mercenary_create) (struct map_session_data **sd, int *class_, unsigned int *lifetime); @@ -7034,8 +7034,8 @@ typedef void (*HPMHOOK_pre_pc_final) (void); typedef void (*HPMHOOK_post_pc_final) (void); typedef struct map_session_data * (*HPMHOOK_pre_pc_get_dummy_sd) (void); typedef struct map_session_data * (*HPMHOOK_post_pc_get_dummy_sd) (struct map_session_data * retVal___); -typedef int (*HPMHOOK_pre_pc_class2idx) (int *class); -typedef int (*HPMHOOK_post_pc_class2idx) (int retVal___, int class); +typedef int (*HPMHOOK_pre_pc_class2idx) (int *class_); +typedef int (*HPMHOOK_post_pc_class2idx) (int retVal___, int class_); typedef bool (*HPMHOOK_pre_pc_can_talk) (struct map_session_data **sd); typedef bool (*HPMHOOK_post_pc_can_talk) (bool retVal___, struct map_session_data *sd); typedef bool (*HPMHOOK_pre_pc_can_attack) (struct map_session_data **sd, int *target_id); @@ -7268,8 +7268,8 @@ typedef int (*HPMHOOK_pre_pc_itemheal) (struct map_session_data **sd, int *itemi typedef int (*HPMHOOK_post_pc_itemheal) (int retVal___, struct map_session_data *sd, int itemid, int hp, int sp); typedef int (*HPMHOOK_pre_pc_percentheal) (struct map_session_data **sd, int *hp, int *sp); typedef int (*HPMHOOK_post_pc_percentheal) (int retVal___, struct map_session_data *sd, int hp, int sp); -typedef int (*HPMHOOK_pre_pc_jobchange) (struct map_session_data **sd, int *class, int *upper); -typedef int (*HPMHOOK_post_pc_jobchange) (int retVal___, struct map_session_data *sd, int class, int upper); +typedef int (*HPMHOOK_pre_pc_jobchange) (struct map_session_data **sd, int *class_, int *upper); +typedef int (*HPMHOOK_post_pc_jobchange) (int retVal___, struct map_session_data *sd, int class_, int upper); typedef void (*HPMHOOK_pre_pc_hide) (struct map_session_data **sd, bool *show_msg); typedef void (*HPMHOOK_post_pc_hide) (struct map_session_data *sd, bool show_msg); typedef void (*HPMHOOK_pre_pc_unhide) (struct map_session_data **sd, bool *show_msg); @@ -7348,12 +7348,12 @@ typedef void (*HPMHOOK_pre_pc_setstand) (struct map_session_data **sd); typedef void (*HPMHOOK_post_pc_setstand) (struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_candrop) (struct map_session_data **sd, struct item **item); typedef int (*HPMHOOK_post_pc_candrop) (int retVal___, struct map_session_data *sd, struct item *item); -typedef int (*HPMHOOK_pre_pc_jobid2mapid) (int *class); -typedef int (*HPMHOOK_post_pc_jobid2mapid) (int retVal___, int class); +typedef int (*HPMHOOK_pre_pc_jobid2mapid) (int *class_); +typedef int (*HPMHOOK_post_pc_jobid2mapid) (int retVal___, int class_); typedef int (*HPMHOOK_pre_pc_mapid2jobid) (unsigned int *class_, int *sex); typedef int (*HPMHOOK_post_pc_mapid2jobid) (int retVal___, unsigned int class_, int sex); -typedef const char * (*HPMHOOK_pre_pc_job_name) (int *class); -typedef const char * (*HPMHOOK_post_pc_job_name) (const char * retVal___, int class); +typedef const char * (*HPMHOOK_pre_pc_job_name) (int *class_); +typedef const char * (*HPMHOOK_post_pc_job_name) (const char * retVal___, int class_); typedef void (*HPMHOOK_pre_pc_setinvincibletimer) (struct map_session_data **sd, int *val); typedef void (*HPMHOOK_post_pc_setinvincibletimer) (struct map_session_data *sd, int val); typedef void (*HPMHOOK_pre_pc_delinvincibletimer) (struct map_session_data **sd); @@ -7410,8 +7410,8 @@ typedef int (*HPMHOOK_pre_pc_inventory_rental_clear) (struct map_session_data ** typedef int (*HPMHOOK_post_pc_inventory_rental_clear) (int retVal___, struct map_session_data *sd); typedef void (*HPMHOOK_pre_pc_inventory_rental_add) (struct map_session_data **sd, int *seconds); typedef void (*HPMHOOK_post_pc_inventory_rental_add) (struct map_session_data *sd, int seconds); -typedef int (*HPMHOOK_pre_pc_disguise) (struct map_session_data **sd, int *class); -typedef int (*HPMHOOK_post_pc_disguise) (int retVal___, struct map_session_data *sd, int class); +typedef int (*HPMHOOK_pre_pc_disguise) (struct map_session_data **sd, int *class_); +typedef int (*HPMHOOK_post_pc_disguise) (int retVal___, struct map_session_data *sd, int class_); typedef bool (*HPMHOOK_pre_pc_isautolooting) (struct map_session_data **sd, int *nameid); typedef bool (*HPMHOOK_post_pc_isautolooting) (bool retVal___, struct map_session_data *sd, int nameid); typedef void (*HPMHOOK_pre_pc_overheat) (struct map_session_data **sd, int *val); @@ -7504,8 +7504,8 @@ typedef int (*HPMHOOK_pre_pc_global_expiration_timer) (int *tid, int64 *tick, in typedef int (*HPMHOOK_post_pc_global_expiration_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data); typedef void (*HPMHOOK_pre_pc_expire_check) (struct map_session_data **sd); typedef void (*HPMHOOK_post_pc_expire_check) (struct map_session_data *sd); -typedef bool (*HPMHOOK_pre_pc_db_checkid) (int *class); -typedef bool (*HPMHOOK_post_pc_db_checkid) (bool retVal___, int class); +typedef bool (*HPMHOOK_pre_pc_db_checkid) (int *class_); +typedef bool (*HPMHOOK_post_pc_db_checkid) (bool retVal___, int class_); typedef void (*HPMHOOK_pre_pc_validate_levels) (void); typedef void (*HPMHOOK_post_pc_validate_levels) (void); typedef void (*HPMHOOK_pre_pc_update_job_and_level) (struct map_session_data **sd); @@ -7842,8 +7842,8 @@ typedef void (*HPMHOOK_pre_rodex_add_item) (struct map_session_data **sd, int16 typedef void (*HPMHOOK_post_rodex_add_item) (struct map_session_data *sd, int16 idx, int16 amount); typedef void (*HPMHOOK_pre_rodex_remove_item) (struct map_session_data **sd, int16 *idx, int16 *amount); typedef void (*HPMHOOK_post_rodex_remove_item) (struct map_session_data *sd, int16 idx, int16 amount); -typedef void (*HPMHOOK_pre_rodex_check_player) (struct map_session_data **sd, const char **name, int **base_level, int **char_id, int **class); -typedef void (*HPMHOOK_post_rodex_check_player) (struct map_session_data *sd, const char *name, int *base_level, int *char_id, int *class); +typedef void (*HPMHOOK_pre_rodex_check_player) (struct map_session_data **sd, const char **name, int **base_level, int **char_id, int **class_); +typedef void (*HPMHOOK_post_rodex_check_player) (struct map_session_data *sd, const char *name, int *base_level, int *char_id, int *class_); typedef int (*HPMHOOK_pre_rodex_send_mail) (struct map_session_data **sd, const char **receiver_name, const char **body, const char **title, int64 *zeny); typedef int (*HPMHOOK_post_rodex_send_mail) (int retVal___, struct map_session_data *sd, const char *receiver_name, const char *body, const char *title, int64 zeny); typedef void (*HPMHOOK_pre_rodex_send_mail_result) (struct map_session_data **ssd, struct map_session_data **rsd, bool *result); @@ -8264,8 +8264,8 @@ typedef void (*HPMHOOK_post_script_declare_conditional_feature) (const char *fea #ifdef MAP_SEARCHSTORE_H /* searchstore */ typedef bool (*HPMHOOK_pre_searchstore_open) (struct map_session_data **sd, unsigned int *uses, unsigned short *effect); typedef bool (*HPMHOOK_post_searchstore_open) (bool retVal___, struct map_session_data *sd, unsigned int uses, unsigned short effect); -typedef void (*HPMHOOK_pre_searchstore_query) (struct map_session_data **sd, unsigned char *type, unsigned int *min_price, unsigned int *max_price, const uint32 **itemlist, unsigned int *item_count, const uint32 **cardlist, unsigned int *card_count); -typedef void (*HPMHOOK_post_searchstore_query) (struct map_session_data *sd, unsigned char type, unsigned int min_price, unsigned int max_price, const uint32 *itemlist, unsigned int item_count, const uint32 *cardlist, unsigned int card_count); +typedef void (*HPMHOOK_pre_searchstore_query) (struct map_session_data **sd, unsigned char *type, unsigned int *min_price, unsigned int *max_price, const int32 **itemlist, unsigned int *item_count, const int32 **cardlist, unsigned int *card_count); +typedef void (*HPMHOOK_post_searchstore_query) (struct map_session_data *sd, unsigned char type, unsigned int min_price, unsigned int max_price, const int32 *itemlist, unsigned int item_count, const int32 *cardlist, unsigned int card_count); typedef bool (*HPMHOOK_pre_searchstore_querynext) (struct map_session_data **sd); typedef bool (*HPMHOOK_post_searchstore_querynext) (bool retVal___, struct map_session_data *sd); typedef void (*HPMHOOK_pre_searchstore_next) (struct map_session_data **sd); @@ -8274,8 +8274,8 @@ typedef void (*HPMHOOK_pre_searchstore_clear) (struct map_session_data **sd); typedef void (*HPMHOOK_post_searchstore_clear) (struct map_session_data *sd); typedef void (*HPMHOOK_pre_searchstore_close) (struct map_session_data **sd); typedef void (*HPMHOOK_post_searchstore_close) (struct map_session_data *sd); -typedef void (*HPMHOOK_pre_searchstore_click) (struct map_session_data **sd, int *account_id, int *store_id, int *nameid); -typedef void (*HPMHOOK_post_searchstore_click) (struct map_session_data *sd, int account_id, int store_id, int nameid); +typedef void (*HPMHOOK_pre_searchstore_click) (struct map_session_data **sd, int *account_id, unsigned int *store_id, int *nameid); +typedef void (*HPMHOOK_post_searchstore_click) (struct map_session_data *sd, int account_id, unsigned int store_id, int nameid); typedef bool (*HPMHOOK_pre_searchstore_queryremote) (struct map_session_data **sd, int *account_id); typedef bool (*HPMHOOK_post_searchstore_queryremote) (bool retVal___, struct map_session_data *sd, int account_id); typedef void (*HPMHOOK_pre_searchstore_clearremote) (struct map_session_data **sd); @@ -8406,8 +8406,8 @@ typedef int (*HPMHOOK_pre_skill_get_unit_range) (int *skill_id, int *skill_lv); typedef int (*HPMHOOK_post_skill_get_unit_range) (int retVal___, int skill_id, int skill_lv); typedef int (*HPMHOOK_pre_skill_get_cooldown) (int *skill_id, int *skill_lv); typedef int (*HPMHOOK_post_skill_get_cooldown) (int retVal___, int skill_id, int skill_lv); -typedef int (*HPMHOOK_pre_skill_tree_get_max) (int *skill_id, int *class); -typedef int (*HPMHOOK_post_skill_tree_get_max) (int retVal___, int skill_id, int class); +typedef int (*HPMHOOK_pre_skill_tree_get_max) (int *skill_id, int *class_); +typedef int (*HPMHOOK_post_skill_tree_get_max) (int retVal___, int skill_id, int class_); typedef const char * (*HPMHOOK_pre_skill_get_name) (int *skill_id); typedef const char * (*HPMHOOK_post_skill_get_name) (const char * retVal___, int skill_id); typedef const char * (*HPMHOOK_pre_skill_get_desc) (int *skill_id); @@ -9370,8 +9370,8 @@ typedef int (*HPMHOOK_pre_status_base_matk_min) (const struct status_data **st); typedef int (*HPMHOOK_post_status_base_matk_min) (int retVal___, const struct status_data *st); typedef int (*HPMHOOK_pre_status_base_matk_max) (const struct status_data **st); typedef int (*HPMHOOK_post_status_base_matk_max) (int retVal___, const struct status_data *st); -typedef void (*HPMHOOK_pre_status_check_job_bonus) (int *idx, const char **name, int *class); -typedef void (*HPMHOOK_post_status_check_job_bonus) (int idx, const char *name, int class); +typedef void (*HPMHOOK_pre_status_check_job_bonus) (int *idx, const char **name, int *class_); +typedef void (*HPMHOOK_post_status_check_job_bonus) (int idx, const char *name, int class_); #endif // MAP_STATUS_H #ifdef MAP_STORAGE_H /* storage */ typedef void (*HPMHOOK_pre_storage_init) (bool *minimal); @@ -9584,8 +9584,8 @@ typedef int (*HPMHOOK_pre_timer_add_interval) (int64 *tick, TimerFunc *func, int typedef int (*HPMHOOK_post_timer_add_interval) (int retVal___, int64 tick, TimerFunc func, int id, intptr_t data, int interval); typedef const struct TimerData * (*HPMHOOK_pre_timer_get) (int *tid); typedef const struct TimerData * (*HPMHOOK_post_timer_get) (const struct TimerData * retVal___, int tid); -typedef int (*HPMHOOK_pre_timer_delete) (int *tid, TimerFunc *func); -typedef int (*HPMHOOK_post_timer_delete) (int retVal___, int tid, TimerFunc func); +typedef int (*HPMHOOK_pre_timer_delete_) (int *tid, TimerFunc *func); +typedef int (*HPMHOOK_post_timer_delete_) (int retVal___, int tid, TimerFunc func); typedef int64 (*HPMHOOK_pre_timer_addtick) (int *tid, int64 *tick); typedef int64 (*HPMHOOK_post_timer_addtick) (int64 retVal___, int tid, int64 tick); typedef int64 (*HPMHOOK_pre_timer_settick) (int *tid, int64 *tick); diff --git a/src/plugins/HPMHooking/HPMHooking_api.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_api.HPMHooksCore.inc index 2831abefc97..94bb63e3867 100644 --- a/src/plugins/HPMHooking/HPMHooking_api.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_api.HPMHooksCore.inc @@ -1012,8 +1012,8 @@ struct { struct HPMHookPoint *HP_timer_add_interval_post; struct HPMHookPoint *HP_timer_get_pre; struct HPMHookPoint *HP_timer_get_post; - struct HPMHookPoint *HP_timer_delete_pre; - struct HPMHookPoint *HP_timer_delete_post; + struct HPMHookPoint *HP_timer_delete__pre; + struct HPMHookPoint *HP_timer_delete__post; struct HPMHookPoint *HP_timer_addtick_pre; struct HPMHookPoint *HP_timer_addtick_post; struct HPMHookPoint *HP_timer_settick_pre; @@ -2023,8 +2023,8 @@ struct { int HP_timer_add_interval_post; int HP_timer_get_pre; int HP_timer_get_post; - int HP_timer_delete_pre; - int HP_timer_delete_post; + int HP_timer_delete__pre; + int HP_timer_delete__post; int HP_timer_addtick_pre; int HP_timer_addtick_post; int HP_timer_settick_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_api.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_api.HookingPoints.inc index d5e8feeb386..bac46060df0 100644 --- a/src/plugins/HPMHooking/HPMHooking_api.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_api.HookingPoints.inc @@ -551,7 +551,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(timer->add, HP_timer_add) }, { HP_POP(timer->add_interval, HP_timer_add_interval) }, { HP_POP(timer->get, HP_timer_get) }, - { HP_POP(timer->delete, HP_timer_delete) }, + { HP_POP(timer->delete_, HP_timer_delete_) }, { HP_POP(timer->addtick, HP_timer_addtick) }, { HP_POP(timer->settick, HP_timer_settick) }, { HP_POP(timer->add_func_list, HP_timer_add_func_list) }, diff --git a/src/plugins/HPMHooking/HPMHooking_api.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_api.Hooks.inc index 65d6e434909..90f4ee7ddd4 100644 --- a/src/plugins/HPMHooking/HPMHooking_api.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_api.Hooks.inc @@ -3541,11 +3541,11 @@ bool HP_extraconf_read_vars(const char *filename, bool imported, struct config_t } return retVal___; } -bool HP_extraconf_set_var(struct config_data *conf_var, int val) { +bool HP_extraconf_set_var(const struct config_data *conf_var, int val) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_extraconf_set_var_pre > 0) { - bool (*preHookFunc) (struct config_data **conf_var, int *val); + bool (*preHookFunc) (const struct config_data **conf_var, int *val); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_extraconf_set_var_pre[hIndex].func; @@ -3560,7 +3560,7 @@ bool HP_extraconf_set_var(struct config_data *conf_var, int val) { retVal___ = HPMHooks.source.extraconf.set_var(conf_var, val); } if (HPMHooks.count.HP_extraconf_set_var_post > 0) { - bool (*postHookFunc) (bool retVal___, struct config_data *conf_var, int val); + bool (*postHookFunc) (bool retVal___, const struct config_data *conf_var, int val); for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_post; hIndex++) { postHookFunc = HPMHooks.list.HP_extraconf_set_var_post[hIndex].func; retVal___ = postHookFunc(retVal___, conf_var, val); @@ -3568,11 +3568,11 @@ bool HP_extraconf_set_var(struct config_data *conf_var, int val) { } return retVal___; } -bool HP_extraconf_set_var_str(struct config_data *conf_var, const char *val) { +bool HP_extraconf_set_var_str(const struct config_data *conf_var, const char *val) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_extraconf_set_var_str_pre > 0) { - bool (*preHookFunc) (struct config_data **conf_var, const char **val); + bool (*preHookFunc) (const struct config_data **conf_var, const char **val); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_str_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_extraconf_set_var_str_pre[hIndex].func; @@ -3587,7 +3587,7 @@ bool HP_extraconf_set_var_str(struct config_data *conf_var, const char *val) { retVal___ = HPMHooks.source.extraconf.set_var_str(conf_var, val); } if (HPMHooks.count.HP_extraconf_set_var_str_post > 0) { - bool (*postHookFunc) (bool retVal___, struct config_data *conf_var, const char *val); + bool (*postHookFunc) (bool retVal___, const struct config_data *conf_var, const char *val); for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_str_post; hIndex++) { postHookFunc = HPMHooks.list.HP_extraconf_set_var_str_post[hIndex].func; retVal___ = postHookFunc(retVal___, conf_var, val); @@ -13256,14 +13256,14 @@ const struct TimerData * HP_timer_get(int tid) { } return retVal___; } -int HP_timer_delete(int tid, TimerFunc func) { +int HP_timer_delete_(int tid, TimerFunc func) { int hIndex = 0; int retVal___ = 0; - if (HPMHooks.count.HP_timer_delete_pre > 0) { + if (HPMHooks.count.HP_timer_delete__pre > 0) { int (*preHookFunc) (int *tid, TimerFunc *func); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_timer_delete_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete__pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_timer_delete__pre[hIndex].func; retVal___ = preHookFunc(&tid, &func); } if (*HPMforce_return) { @@ -13272,12 +13272,12 @@ int HP_timer_delete(int tid, TimerFunc func) { } } { - retVal___ = HPMHooks.source.timer.delete(tid, func); + retVal___ = HPMHooks.source.timer.delete_(tid, func); } - if (HPMHooks.count.HP_timer_delete_post > 0) { + if (HPMHooks.count.HP_timer_delete__post > 0) { int (*postHookFunc) (int retVal___, int tid, TimerFunc func); - for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_timer_delete_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete__post; hIndex++) { + postHookFunc = HPMHooks.list.HP_timer_delete__post[hIndex].func; retVal___ = postHookFunc(retVal___, tid, func); } } diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index 54537d2e6a1..1c83c7c0e28 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -1772,8 +1772,8 @@ struct { struct HPMHookPoint *HP_timer_add_interval_post; struct HPMHookPoint *HP_timer_get_pre; struct HPMHookPoint *HP_timer_get_post; - struct HPMHookPoint *HP_timer_delete_pre; - struct HPMHookPoint *HP_timer_delete_post; + struct HPMHookPoint *HP_timer_delete__pre; + struct HPMHookPoint *HP_timer_delete__post; struct HPMHookPoint *HP_timer_addtick_pre; struct HPMHookPoint *HP_timer_addtick_post; struct HPMHookPoint *HP_timer_settick_pre; @@ -3543,8 +3543,8 @@ struct { int HP_timer_add_interval_post; int HP_timer_get_pre; int HP_timer_get_post; - int HP_timer_delete_pre; - int HP_timer_delete_post; + int HP_timer_delete__pre; + int HP_timer_delete__post; int HP_timer_addtick_pre; int HP_timer_addtick_post; int HP_timer_settick_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index fedb5810af8..9d2369af303 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -945,7 +945,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(timer->add, HP_timer_add) }, { HP_POP(timer->add_interval, HP_timer_add_interval) }, { HP_POP(timer->get, HP_timer_get) }, - { HP_POP(timer->delete, HP_timer_delete) }, + { HP_POP(timer->delete_, HP_timer_delete_) }, { HP_POP(timer->addtick, HP_timer_addtick) }, { HP_POP(timer->settick, HP_timer_settick) }, { HP_POP(timer->add_func_list, HP_timer_add_func_list) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 7c04943cb33..c1ece3010b0 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -4717,14 +4717,14 @@ int HP_chr_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { } return retVal___; } -void HP_chr_change_sex_sub(int sex, int acc, int char_id, int class, int guild_id) { +void HP_chr_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) { int hIndex = 0; if (HPMHooks.count.HP_chr_change_sex_sub_pre > 0) { - void (*preHookFunc) (int *sex, int *acc, int *char_id, int *class, int *guild_id); + void (*preHookFunc) (int *sex, int *acc, int *char_id, int *class_, int *guild_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_change_sex_sub_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_chr_change_sex_sub_pre[hIndex].func; - preHookFunc(&sex, &acc, &char_id, &class, &guild_id); + preHookFunc(&sex, &acc, &char_id, &class_, &guild_id); } if (*HPMforce_return) { *HPMforce_return = false; @@ -4732,13 +4732,13 @@ void HP_chr_change_sex_sub(int sex, int acc, int char_id, int class, int guild_i } } { - HPMHooks.source.chr.change_sex_sub(sex, acc, char_id, class, guild_id); + HPMHooks.source.chr.change_sex_sub(sex, acc, char_id, class_, guild_id); } if (HPMHooks.count.HP_chr_change_sex_sub_post > 0) { - void (*postHookFunc) (int sex, int acc, int char_id, int class, int guild_id); + void (*postHookFunc) (int sex, int acc, int char_id, int class_, int guild_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_change_sex_sub_post; hIndex++) { postHookFunc = HPMHooks.list.HP_chr_change_sex_sub_post[hIndex].func; - postHookFunc(sex, acc, char_id, class, guild_id); + postHookFunc(sex, acc, char_id, class_, guild_id); } } return; @@ -6304,11 +6304,11 @@ bool HP_extraconf_read_vars(const char *filename, bool imported, struct config_t } return retVal___; } -bool HP_extraconf_set_var(struct config_data *conf_var, int val) { +bool HP_extraconf_set_var(const struct config_data *conf_var, int val) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_extraconf_set_var_pre > 0) { - bool (*preHookFunc) (struct config_data **conf_var, int *val); + bool (*preHookFunc) (const struct config_data **conf_var, int *val); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_extraconf_set_var_pre[hIndex].func; @@ -6323,7 +6323,7 @@ bool HP_extraconf_set_var(struct config_data *conf_var, int val) { retVal___ = HPMHooks.source.extraconf.set_var(conf_var, val); } if (HPMHooks.count.HP_extraconf_set_var_post > 0) { - bool (*postHookFunc) (bool retVal___, struct config_data *conf_var, int val); + bool (*postHookFunc) (bool retVal___, const struct config_data *conf_var, int val); for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_post; hIndex++) { postHookFunc = HPMHooks.list.HP_extraconf_set_var_post[hIndex].func; retVal___ = postHookFunc(retVal___, conf_var, val); @@ -6331,11 +6331,11 @@ bool HP_extraconf_set_var(struct config_data *conf_var, int val) { } return retVal___; } -bool HP_extraconf_set_var_str(struct config_data *conf_var, const char *val) { +bool HP_extraconf_set_var_str(const struct config_data *conf_var, const char *val) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_extraconf_set_var_str_pre > 0) { - bool (*preHookFunc) (struct config_data **conf_var, const char **val); + bool (*preHookFunc) (const struct config_data **conf_var, const char **val); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_str_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_extraconf_set_var_str_pre[hIndex].func; @@ -6350,7 +6350,7 @@ bool HP_extraconf_set_var_str(struct config_data *conf_var, const char *val) { retVal___ = HPMHooks.source.extraconf.set_var_str(conf_var, val); } if (HPMHooks.count.HP_extraconf_set_var_str_post > 0) { - bool (*postHookFunc) (bool retVal___, struct config_data *conf_var, const char *val); + bool (*postHookFunc) (bool retVal___, const struct config_data *conf_var, const char *val); for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_str_post; hIndex++) { postHookFunc = HPMHooks.list.HP_extraconf_set_var_str_post[hIndex].func; retVal___ = postHookFunc(retVal___, conf_var, val); @@ -8125,15 +8125,15 @@ bool HP_inter_guild_leave(int guild_id, int account_id, int char_id, int flag, c } return retVal___; } -bool HP_inter_guild_update_member_info_short(int guild_id, int account_id, int char_id, int online, int lv, int class) { +bool HP_inter_guild_update_member_info_short(int guild_id, int account_id, int char_id, int online, int lv, int class_) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_inter_guild_update_member_info_short_pre > 0) { - bool (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class); + bool (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_update_member_info_short_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_inter_guild_update_member_info_short_pre[hIndex].func; - retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &online, &lv, &class); + retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &online, &lv, &class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -8141,13 +8141,13 @@ bool HP_inter_guild_update_member_info_short(int guild_id, int account_id, int c } } { - retVal___ = HPMHooks.source.inter_guild.update_member_info_short(guild_id, account_id, char_id, online, lv, class); + retVal___ = HPMHooks.source.inter_guild.update_member_info_short(guild_id, account_id, char_id, online, lv, class_); } if (HPMHooks.count.HP_inter_guild_update_member_info_short_post > 0) { - bool (*postHookFunc) (bool retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class); + bool (*postHookFunc) (bool retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_update_member_info_short_post; hIndex++) { postHookFunc = HPMHooks.list.HP_inter_guild_update_member_info_short_post[hIndex].func; - retVal___ = postHookFunc(retVal___, guild_id, account_id, char_id, online, lv, class); + retVal___ = postHookFunc(retVal___, guild_id, account_id, char_id, online, lv, class_); } } return retVal___; @@ -8773,15 +8773,15 @@ void HP_inter_do_final_msg(void) { } return; } -const char * HP_inter_job_name(int class) { +const char * HP_inter_job_name(int class_) { int hIndex = 0; const char * retVal___ = NULL; if (HPMHooks.count.HP_inter_job_name_pre > 0) { - const char * (*preHookFunc) (int *class); + const char * (*preHookFunc) (int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_job_name_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_inter_job_name_pre[hIndex].func; - retVal___ = preHookFunc(&class); + retVal___ = preHookFunc(&class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -8789,13 +8789,13 @@ const char * HP_inter_job_name(int class) { } } { - retVal___ = HPMHooks.source.inter.job_name(class); + retVal___ = HPMHooks.source.inter.job_name(class_); } if (HPMHooks.count.HP_inter_job_name_post > 0) { - const char * (*postHookFunc) (const char * retVal___, int class); + const char * (*postHookFunc) (const char * retVal___, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_job_name_post; hIndex++) { postHookFunc = HPMHooks.list.HP_inter_job_name_post[hIndex].func; - retVal___ = postHookFunc(retVal___, class); + retVal___ = postHookFunc(retVal___, class_); } } return retVal___; @@ -15283,15 +15283,15 @@ int HP_mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, } return retVal___; } -int HP_mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class) { +int HP_mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_pre > 0) { - int (*preHookFunc) (int *fd, int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class); + int (*preHookFunc) (int *fd, int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_mapif_parse_GuildChangeMemberInfoShort_pre[hIndex].func; - retVal___ = preHookFunc(&fd, &guild_id, &account_id, &char_id, &online, &lv, &class); + retVal___ = preHookFunc(&fd, &guild_id, &account_id, &char_id, &online, &lv, &class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -15299,13 +15299,13 @@ int HP_mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_ } } { - retVal___ = HPMHooks.source.mapif.parse_GuildChangeMemberInfoShort(fd, guild_id, account_id, char_id, online, lv, class); + retVal___ = HPMHooks.source.mapif.parse_GuildChangeMemberInfoShort(fd, guild_id, account_id, char_id, online, lv, class_); } if (HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_post > 0) { - int (*postHookFunc) (int retVal___, int fd, int guild_id, int account_id, int char_id, int online, int lv, int class); + int (*postHookFunc) (int retVal___, int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_post; hIndex++) { postHookFunc = HPMHooks.list.HP_mapif_parse_GuildChangeMemberInfoShort_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fd, guild_id, account_id, char_id, online, lv, class); + retVal___ = postHookFunc(retVal___, fd, guild_id, account_id, char_id, online, lv, class_); } } return retVal___; @@ -23380,14 +23380,14 @@ const struct TimerData * HP_timer_get(int tid) { } return retVal___; } -int HP_timer_delete(int tid, TimerFunc func) { +int HP_timer_delete_(int tid, TimerFunc func) { int hIndex = 0; int retVal___ = 0; - if (HPMHooks.count.HP_timer_delete_pre > 0) { + if (HPMHooks.count.HP_timer_delete__pre > 0) { int (*preHookFunc) (int *tid, TimerFunc *func); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_timer_delete_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete__pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_timer_delete__pre[hIndex].func; retVal___ = preHookFunc(&tid, &func); } if (*HPMforce_return) { @@ -23396,12 +23396,12 @@ int HP_timer_delete(int tid, TimerFunc func) { } } { - retVal___ = HPMHooks.source.timer.delete(tid, func); + retVal___ = HPMHooks.source.timer.delete_(tid, func); } - if (HPMHooks.count.HP_timer_delete_post > 0) { + if (HPMHooks.count.HP_timer_delete__post > 0) { int (*postHookFunc) (int retVal___, int tid, TimerFunc func); - for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_timer_delete_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete__post; hIndex++) { + postHookFunc = HPMHooks.list.HP_timer_delete__post[hIndex].func; retVal___ = postHookFunc(retVal___, tid, func); } } diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index 697ed5561c1..060b90eeb78 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -914,8 +914,8 @@ struct { struct HPMHookPoint *HP_timer_add_interval_post; struct HPMHookPoint *HP_timer_get_pre; struct HPMHookPoint *HP_timer_get_post; - struct HPMHookPoint *HP_timer_delete_pre; - struct HPMHookPoint *HP_timer_delete_post; + struct HPMHookPoint *HP_timer_delete__pre; + struct HPMHookPoint *HP_timer_delete__post; struct HPMHookPoint *HP_timer_addtick_pre; struct HPMHookPoint *HP_timer_addtick_post; struct HPMHookPoint *HP_timer_settick_pre; @@ -1827,8 +1827,8 @@ struct { int HP_timer_add_interval_post; int HP_timer_get_pre; int HP_timer_get_post; - int HP_timer_delete_pre; - int HP_timer_delete_post; + int HP_timer_delete__pre; + int HP_timer_delete__post; int HP_timer_addtick_pre; int HP_timer_addtick_post; int HP_timer_settick_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index 9528cfedfb0..9b8519eb3fc 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -501,7 +501,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(timer->add, HP_timer_add) }, { HP_POP(timer->add_interval, HP_timer_add_interval) }, { HP_POP(timer->get, HP_timer_get) }, - { HP_POP(timer->delete, HP_timer_delete) }, + { HP_POP(timer->delete_, HP_timer_delete_) }, { HP_POP(timer->addtick, HP_timer_addtick) }, { HP_POP(timer->settick, HP_timer_settick) }, { HP_POP(timer->add_func_list, HP_timer_add_func_list) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index 01e7cf906fc..32a2ee2711e 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -1636,11 +1636,11 @@ bool HP_extraconf_read_vars(const char *filename, bool imported, struct config_t } return retVal___; } -bool HP_extraconf_set_var(struct config_data *conf_var, int val) { +bool HP_extraconf_set_var(const struct config_data *conf_var, int val) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_extraconf_set_var_pre > 0) { - bool (*preHookFunc) (struct config_data **conf_var, int *val); + bool (*preHookFunc) (const struct config_data **conf_var, int *val); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_extraconf_set_var_pre[hIndex].func; @@ -1655,7 +1655,7 @@ bool HP_extraconf_set_var(struct config_data *conf_var, int val) { retVal___ = HPMHooks.source.extraconf.set_var(conf_var, val); } if (HPMHooks.count.HP_extraconf_set_var_post > 0) { - bool (*postHookFunc) (bool retVal___, struct config_data *conf_var, int val); + bool (*postHookFunc) (bool retVal___, const struct config_data *conf_var, int val); for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_post; hIndex++) { postHookFunc = HPMHooks.list.HP_extraconf_set_var_post[hIndex].func; retVal___ = postHookFunc(retVal___, conf_var, val); @@ -1663,11 +1663,11 @@ bool HP_extraconf_set_var(struct config_data *conf_var, int val) { } return retVal___; } -bool HP_extraconf_set_var_str(struct config_data *conf_var, const char *val) { +bool HP_extraconf_set_var_str(const struct config_data *conf_var, const char *val) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_extraconf_set_var_str_pre > 0) { - bool (*preHookFunc) (struct config_data **conf_var, const char **val); + bool (*preHookFunc) (const struct config_data **conf_var, const char **val); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_str_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_extraconf_set_var_str_pre[hIndex].func; @@ -1682,7 +1682,7 @@ bool HP_extraconf_set_var_str(struct config_data *conf_var, const char *val) { retVal___ = HPMHooks.source.extraconf.set_var_str(conf_var, val); } if (HPMHooks.count.HP_extraconf_set_var_str_post > 0) { - bool (*postHookFunc) (bool retVal___, struct config_data *conf_var, const char *val); + bool (*postHookFunc) (bool retVal___, const struct config_data *conf_var, const char *val); for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_str_post; hIndex++) { postHookFunc = HPMHooks.list.HP_extraconf_set_var_str_post[hIndex].func; retVal___ = postHookFunc(retVal___, conf_var, val); @@ -11920,14 +11920,14 @@ const struct TimerData * HP_timer_get(int tid) { } return retVal___; } -int HP_timer_delete(int tid, TimerFunc func) { +int HP_timer_delete_(int tid, TimerFunc func) { int hIndex = 0; int retVal___ = 0; - if (HPMHooks.count.HP_timer_delete_pre > 0) { + if (HPMHooks.count.HP_timer_delete__pre > 0) { int (*preHookFunc) (int *tid, TimerFunc *func); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_timer_delete_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete__pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_timer_delete__pre[hIndex].func; retVal___ = preHookFunc(&tid, &func); } if (*HPMforce_return) { @@ -11936,12 +11936,12 @@ int HP_timer_delete(int tid, TimerFunc func) { } } { - retVal___ = HPMHooks.source.timer.delete(tid, func); + retVal___ = HPMHooks.source.timer.delete_(tid, func); } - if (HPMHooks.count.HP_timer_delete_post > 0) { + if (HPMHooks.count.HP_timer_delete__post > 0) { int (*postHookFunc) (int retVal___, int tid, TimerFunc func); - for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_timer_delete_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete__post; hIndex++) { + postHookFunc = HPMHooks.list.HP_timer_delete__post[hIndex].func; retVal___ = postHookFunc(retVal___, tid, func); } } diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 55ad040ce52..1341c5dd024 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -2622,8 +2622,8 @@ struct { struct HPMHookPoint *HP_elemental_init_post; struct HPMHookPoint *HP_elemental_final_pre; struct HPMHookPoint *HP_elemental_final_post; - struct HPMHookPoint *HP_elemental_class_pre; - struct HPMHookPoint *HP_elemental_class_post; + struct HPMHookPoint *HP_elemental_class__pre; + struct HPMHookPoint *HP_elemental_class__post; struct HPMHookPoint *HP_elemental_get_viewdata_pre; struct HPMHookPoint *HP_elemental_get_viewdata_post; struct HPMHookPoint *HP_elemental_create_pre; @@ -4262,8 +4262,8 @@ struct { struct HPMHookPoint *HP_md5_salt_post; struct HPMHookPoint *HP_mercenary_init_pre; struct HPMHookPoint *HP_mercenary_init_post; - struct HPMHookPoint *HP_mercenary_class_pre; - struct HPMHookPoint *HP_mercenary_class_post; + struct HPMHookPoint *HP_mercenary_class__pre; + struct HPMHookPoint *HP_mercenary_class__post; struct HPMHookPoint *HP_mercenary_get_viewdata_pre; struct HPMHookPoint *HP_mercenary_get_viewdata_post; struct HPMHookPoint *HP_mercenary_create_pre; @@ -7484,8 +7484,8 @@ struct { struct HPMHookPoint *HP_timer_add_interval_post; struct HPMHookPoint *HP_timer_get_pre; struct HPMHookPoint *HP_timer_get_post; - struct HPMHookPoint *HP_timer_delete_pre; - struct HPMHookPoint *HP_timer_delete_post; + struct HPMHookPoint *HP_timer_delete__pre; + struct HPMHookPoint *HP_timer_delete__post; struct HPMHookPoint *HP_timer_addtick_pre; struct HPMHookPoint *HP_timer_addtick_post; struct HPMHookPoint *HP_timer_settick_pre; @@ -10243,8 +10243,8 @@ struct { int HP_elemental_init_post; int HP_elemental_final_pre; int HP_elemental_final_post; - int HP_elemental_class_pre; - int HP_elemental_class_post; + int HP_elemental_class__pre; + int HP_elemental_class__post; int HP_elemental_get_viewdata_pre; int HP_elemental_get_viewdata_post; int HP_elemental_create_pre; @@ -11883,8 +11883,8 @@ struct { int HP_md5_salt_post; int HP_mercenary_init_pre; int HP_mercenary_init_post; - int HP_mercenary_class_pre; - int HP_mercenary_class_post; + int HP_mercenary_class__pre; + int HP_mercenary_class__post; int HP_mercenary_get_viewdata_pre; int HP_mercenary_get_viewdata_post; int HP_mercenary_create_pre; @@ -15105,8 +15105,8 @@ struct { int HP_timer_add_interval_post; int HP_timer_get_pre; int HP_timer_get_post; - int HP_timer_delete_pre; - int HP_timer_delete_post; + int HP_timer_delete__pre; + int HP_timer_delete__post; int HP_timer_addtick_pre; int HP_timer_addtick_post; int HP_timer_settick_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 15319ea1fe2..f6c8fb6aab4 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1343,7 +1343,7 @@ struct HookingPointData HookingPoints[] = { /* elemental_interface */ { HP_POP(elemental->init, HP_elemental_init) }, { HP_POP(elemental->final, HP_elemental_final) }, - { HP_POP(elemental->class, HP_elemental_class) }, + { HP_POP(elemental->class_, HP_elemental_class_) }, { HP_POP(elemental->get_viewdata, HP_elemental_get_viewdata) }, { HP_POP(elemental->create, HP_elemental_create) }, { HP_POP(elemental->data_received, HP_elemental_data_received) }, @@ -2186,7 +2186,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(md5->salt, HP_md5_salt) }, /* mercenary_interface */ { HP_POP(mercenary->init, HP_mercenary_init) }, - { HP_POP(mercenary->class, HP_mercenary_class) }, + { HP_POP(mercenary->class_, HP_mercenary_class_) }, { HP_POP(mercenary->get_viewdata, HP_mercenary_get_viewdata) }, { HP_POP(mercenary->create, HP_mercenary_create) }, { HP_POP(mercenary->data_received, HP_mercenary_data_received) }, @@ -3829,7 +3829,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(timer->add, HP_timer_add) }, { HP_POP(timer->add_interval, HP_timer_add_interval) }, { HP_POP(timer->get, HP_timer_get) }, - { HP_POP(timer->delete, HP_timer_delete) }, + { HP_POP(timer->delete_, HP_timer_delete_) }, { HP_POP(timer->addtick, HP_timer_addtick) }, { HP_POP(timer->settick, HP_timer_settick) }, { HP_POP(timer->add_func_list, HP_timer_add_func_list) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 4a5f73e2f25..70b2a585e32 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -1327,14 +1327,14 @@ void HP_achievement_validate_achieve(struct map_session_data *sd, int achid) { } return; } -void HP_achievement_validate_taming(struct map_session_data *sd, int class) { +void HP_achievement_validate_taming(struct map_session_data *sd, int class_) { int hIndex = 0; if (HPMHooks.count.HP_achievement_validate_taming_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, int *class); + void (*preHookFunc) (struct map_session_data **sd, int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_validate_taming_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_achievement_validate_taming_pre[hIndex].func; - preHookFunc(&sd, &class); + preHookFunc(&sd, &class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -1342,13 +1342,13 @@ void HP_achievement_validate_taming(struct map_session_data *sd, int class) { } } { - HPMHooks.source.achievement.validate_taming(sd, class); + HPMHooks.source.achievement.validate_taming(sd, class_); } if (HPMHooks.count.HP_achievement_validate_taming_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, int class); + void (*postHookFunc) (struct map_session_data *sd, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_validate_taming_post; hIndex++) { postHookFunc = HPMHooks.list.HP_achievement_validate_taming_post[hIndex].func; - postHookFunc(sd, class); + postHookFunc(sd, class_); } } return; @@ -14976,11 +14976,11 @@ void HP_clif_callpartner(struct map_session_data *sd) { } return; } -int HP_clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 damage, int div, uint16 skill_id, uint16 skill_lv, enum battle_dmg_type type) { +int HP_clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 damage, int div, uint16 skill_id, int skill_lv, enum battle_dmg_type type) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_clif_skill_damage_pre > 0) { - int (*preHookFunc) (struct block_list **src, struct block_list **dst, int64 *tick, int *sdelay, int *ddelay, int64 *damage, int *div, uint16 *skill_id, uint16 *skill_lv, enum battle_dmg_type *type); + int (*preHookFunc) (struct block_list **src, struct block_list **dst, int64 *tick, int *sdelay, int *ddelay, int64 *damage, int *div, uint16 *skill_id, int *skill_lv, enum battle_dmg_type *type); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_skill_damage_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_skill_damage_pre[hIndex].func; @@ -14995,7 +14995,7 @@ int HP_clif_skill_damage(struct block_list *src, struct block_list *dst, int64 t retVal___ = HPMHooks.source.clif.skill_damage(src, dst, tick, sdelay, ddelay, damage, div, skill_id, skill_lv, type); } if (HPMHooks.count.HP_clif_skill_damage_post > 0) { - int (*postHookFunc) (int retVal___, struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 damage, int div, uint16 skill_id, uint16 skill_lv, enum battle_dmg_type type); + int (*postHookFunc) (int retVal___, struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 damage, int div, uint16 skill_id, int skill_lv, enum battle_dmg_type type); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_skill_damage_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_skill_damage_post[hIndex].func; retVal___ = postHookFunc(retVal___, src, dst, tick, sdelay, ddelay, damage, div, skill_id, skill_lv, type); @@ -16592,11 +16592,11 @@ bool HP_clif_process_whisper_message(struct map_session_data *sd, const struct p } return retVal___; } -bool HP_clif_validate_message(struct map_session_data *sd, char *message) { +bool HP_clif_validate_message(struct map_session_data *sd, const char *message) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_clif_validate_message_pre > 0) { - bool (*preHookFunc) (struct map_session_data **sd, char **message); + bool (*preHookFunc) (struct map_session_data **sd, const char **message); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_validate_message_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_validate_message_pre[hIndex].func; @@ -16611,7 +16611,7 @@ bool HP_clif_validate_message(struct map_session_data *sd, char *message) { retVal___ = HPMHooks.source.clif.validate_message(sd, message); } if (HPMHooks.count.HP_clif_validate_message_post > 0) { - bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, char *message); + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, const char *message); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_validate_message_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_validate_message_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd, message); @@ -33926,11 +33926,11 @@ void HP_des_decrypt(unsigned char *data, size_t size) { return; } /* duel_interface */ -int HP_duel_create(struct map_session_data *sd, const unsigned int maxpl) { +unsigned int HP_duel_create(struct map_session_data *sd, const unsigned int maxpl) { int hIndex = 0; - int retVal___ = 0; + unsigned int retVal___ = 0; if (HPMHooks.count.HP_duel_create_pre > 0) { - int (*preHookFunc) (struct map_session_data **sd, const unsigned int *maxpl); + unsigned int (*preHookFunc) (struct map_session_data **sd, const unsigned int *maxpl); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_duel_create_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_duel_create_pre[hIndex].func; @@ -33945,7 +33945,7 @@ int HP_duel_create(struct map_session_data *sd, const unsigned int maxpl) { retVal___ = HPMHooks.source.duel.create(sd, maxpl); } if (HPMHooks.count.HP_duel_create_post > 0) { - int (*postHookFunc) (int retVal___, struct map_session_data *sd, const unsigned int maxpl); + unsigned int (*postHookFunc) (unsigned int retVal___, struct map_session_data *sd, const unsigned int maxpl); for (hIndex = 0; hIndex < HPMHooks.count.HP_duel_create_post; hIndex++) { postHookFunc = HPMHooks.list.HP_duel_create_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd, maxpl); @@ -34216,14 +34216,14 @@ void HP_elemental_final(void) { } return; } -bool HP_elemental_class(int class_) { +bool HP_elemental_class_(int class_) { int hIndex = 0; bool retVal___ = false; - if (HPMHooks.count.HP_elemental_class_pre > 0) { + if (HPMHooks.count.HP_elemental_class__pre > 0) { bool (*preHookFunc) (int *class_); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_elemental_class_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_elemental_class_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_elemental_class__pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_elemental_class__pre[hIndex].func; retVal___ = preHookFunc(&class_); } if (*HPMforce_return) { @@ -34232,12 +34232,12 @@ bool HP_elemental_class(int class_) { } } { - retVal___ = HPMHooks.source.elemental.class(class_); + retVal___ = HPMHooks.source.elemental.class_(class_); } - if (HPMHooks.count.HP_elemental_class_post > 0) { + if (HPMHooks.count.HP_elemental_class__post > 0) { bool (*postHookFunc) (bool retVal___, int class_); - for (hIndex = 0; hIndex < HPMHooks.count.HP_elemental_class_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_elemental_class_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_elemental_class__post; hIndex++) { + postHookFunc = HPMHooks.list.HP_elemental_class__post[hIndex].func; retVal___ = postHookFunc(retVal___, class_); } } @@ -35870,11 +35870,11 @@ bool HP_extraconf_read_vars(const char *filename, bool imported, struct config_t } return retVal___; } -bool HP_extraconf_set_var(struct config_data *conf_var, int val) { +bool HP_extraconf_set_var(const struct config_data *conf_var, int val) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_extraconf_set_var_pre > 0) { - bool (*preHookFunc) (struct config_data **conf_var, int *val); + bool (*preHookFunc) (const struct config_data **conf_var, int *val); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_extraconf_set_var_pre[hIndex].func; @@ -35889,7 +35889,7 @@ bool HP_extraconf_set_var(struct config_data *conf_var, int val) { retVal___ = HPMHooks.source.extraconf.set_var(conf_var, val); } if (HPMHooks.count.HP_extraconf_set_var_post > 0) { - bool (*postHookFunc) (bool retVal___, struct config_data *conf_var, int val); + bool (*postHookFunc) (bool retVal___, const struct config_data *conf_var, int val); for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_post; hIndex++) { postHookFunc = HPMHooks.list.HP_extraconf_set_var_post[hIndex].func; retVal___ = postHookFunc(retVal___, conf_var, val); @@ -35897,11 +35897,11 @@ bool HP_extraconf_set_var(struct config_data *conf_var, int val) { } return retVal___; } -bool HP_extraconf_set_var_str(struct config_data *conf_var, const char *val) { +bool HP_extraconf_set_var_str(const struct config_data *conf_var, const char *val) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_extraconf_set_var_str_pre > 0) { - bool (*preHookFunc) (struct config_data **conf_var, const char **val); + bool (*preHookFunc) (const struct config_data **conf_var, const char **val); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_str_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_extraconf_set_var_str_pre[hIndex].func; @@ -35916,7 +35916,7 @@ bool HP_extraconf_set_var_str(struct config_data *conf_var, const char *val) { retVal___ = HPMHooks.source.extraconf.set_var_str(conf_var, val); } if (HPMHooks.count.HP_extraconf_set_var_str_post > 0) { - bool (*postHookFunc) (bool retVal___, struct config_data *conf_var, const char *val); + bool (*postHookFunc) (bool retVal___, const struct config_data *conf_var, const char *val); for (hIndex = 0; hIndex < HPMHooks.count.HP_extraconf_set_var_str_post; hIndex++) { postHookFunc = HPMHooks.list.HP_extraconf_set_var_str_post[hIndex].func; retVal___ = postHookFunc(retVal___, conf_var, val); @@ -37882,15 +37882,15 @@ int HP_guild_send_memberinfoshort(struct map_session_data *sd, int online) { } return retVal___; } -int HP_guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class, uint32 last_login) { +int HP_guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class_, uint32 last_login) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_guild_recv_memberinfoshort_pre > 0) { - int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class, uint32 *last_login); + int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_, uint32 *last_login); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_guild_recv_memberinfoshort_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_guild_recv_memberinfoshort_pre[hIndex].func; - retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &online, &lv, &class, &last_login); + retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &online, &lv, &class_, &last_login); } if (*HPMforce_return) { *HPMforce_return = false; @@ -37898,13 +37898,13 @@ int HP_guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int } } { - retVal___ = HPMHooks.source.guild.recv_memberinfoshort(guild_id, account_id, char_id, online, lv, class, last_login); + retVal___ = HPMHooks.source.guild.recv_memberinfoshort(guild_id, account_id, char_id, online, lv, class_, last_login); } if (HPMHooks.count.HP_guild_recv_memberinfoshort_post > 0) { - int (*postHookFunc) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class, uint32 last_login); + int (*postHookFunc) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class_, uint32 last_login); for (hIndex = 0; hIndex < HPMHooks.count.HP_guild_recv_memberinfoshort_post; hIndex++) { postHookFunc = HPMHooks.list.HP_guild_recv_memberinfoshort_post[hIndex].func; - retVal___ = postHookFunc(retVal___, guild_id, account_id, char_id, online, lv, class, last_login); + retVal___ = postHookFunc(retVal___, guild_id, account_id, char_id, online, lv, class_, last_login); } } return retVal___; @@ -42277,15 +42277,15 @@ int HP_intif_guild_leave(int guild_id, int account_id, int char_id, int flag, co } return retVal___; } -int HP_intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class) { +int HP_intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class_) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_intif_guild_memberinfoshort_pre > 0) { - int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class); + int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_intif_guild_memberinfoshort_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_intif_guild_memberinfoshort_pre[hIndex].func; - retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &online, &lv, &class); + retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &online, &lv, &class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -42293,13 +42293,13 @@ int HP_intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, in } } { - retVal___ = HPMHooks.source.intif.guild_memberinfoshort(guild_id, account_id, char_id, online, lv, class); + retVal___ = HPMHooks.source.intif.guild_memberinfoshort(guild_id, account_id, char_id, online, lv, class_); } if (HPMHooks.count.HP_intif_guild_memberinfoshort_post > 0) { - int (*postHookFunc) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class); + int (*postHookFunc) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_intif_guild_memberinfoshort_post; hIndex++) { postHookFunc = HPMHooks.list.HP_intif_guild_memberinfoshort_post[hIndex].func; - retVal___ = postHookFunc(retVal___, guild_id, account_id, char_id, online, lv, class); + retVal___ = postHookFunc(retVal___, guild_id, account_id, char_id, online, lv, class_); } } return retVal___; @@ -56383,14 +56383,14 @@ void HP_mercenary_init(bool minimal) { } return; } -bool HP_mercenary_class(int class_) { +bool HP_mercenary_class_(int class_) { int hIndex = 0; bool retVal___ = false; - if (HPMHooks.count.HP_mercenary_class_pre > 0) { + if (HPMHooks.count.HP_mercenary_class__pre > 0) { bool (*preHookFunc) (int *class_); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_mercenary_class_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_mercenary_class_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_mercenary_class__pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_mercenary_class__pre[hIndex].func; retVal___ = preHookFunc(&class_); } if (*HPMforce_return) { @@ -56399,12 +56399,12 @@ bool HP_mercenary_class(int class_) { } } { - retVal___ = HPMHooks.source.mercenary.class(class_); + retVal___ = HPMHooks.source.mercenary.class_(class_); } - if (HPMHooks.count.HP_mercenary_class_post > 0) { + if (HPMHooks.count.HP_mercenary_class__post > 0) { bool (*postHookFunc) (bool retVal___, int class_); - for (hIndex = 0; hIndex < HPMHooks.count.HP_mercenary_class_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_mercenary_class_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_mercenary_class__post; hIndex++) { + postHookFunc = HPMHooks.list.HP_mercenary_class__post[hIndex].func; retVal___ = postHookFunc(retVal___, class_); } } @@ -66604,15 +66604,15 @@ struct map_session_data * HP_pc_get_dummy_sd(void) { } return retVal___; } -int HP_pc_class2idx(int class) { +int HP_pc_class2idx(int class_) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_pc_class2idx_pre > 0) { - int (*preHookFunc) (int *class); + int (*preHookFunc) (int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_class2idx_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pc_class2idx_pre[hIndex].func; - retVal___ = preHookFunc(&class); + retVal___ = preHookFunc(&class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -66620,13 +66620,13 @@ int HP_pc_class2idx(int class) { } } { - retVal___ = HPMHooks.source.pc.class2idx(class); + retVal___ = HPMHooks.source.pc.class2idx(class_); } if (HPMHooks.count.HP_pc_class2idx_post > 0) { - int (*postHookFunc) (int retVal___, int class); + int (*postHookFunc) (int retVal___, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_class2idx_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pc_class2idx_post[hIndex].func; - retVal___ = postHookFunc(retVal___, class); + retVal___ = postHookFunc(retVal___, class_); } } return retVal___; @@ -69746,15 +69746,15 @@ int HP_pc_percentheal(struct map_session_data *sd, int hp, int sp) { } return retVal___; } -int HP_pc_jobchange(struct map_session_data *sd, int class, int upper) { +int HP_pc_jobchange(struct map_session_data *sd, int class_, int upper) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_pc_jobchange_pre > 0) { - int (*preHookFunc) (struct map_session_data **sd, int *class, int *upper); + int (*preHookFunc) (struct map_session_data **sd, int *class_, int *upper); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_jobchange_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pc_jobchange_pre[hIndex].func; - retVal___ = preHookFunc(&sd, &class, &upper); + retVal___ = preHookFunc(&sd, &class_, &upper); } if (*HPMforce_return) { *HPMforce_return = false; @@ -69762,13 +69762,13 @@ int HP_pc_jobchange(struct map_session_data *sd, int class, int upper) { } } { - retVal___ = HPMHooks.source.pc.jobchange(sd, class, upper); + retVal___ = HPMHooks.source.pc.jobchange(sd, class_, upper); } if (HPMHooks.count.HP_pc_jobchange_post > 0) { - int (*postHookFunc) (int retVal___, struct map_session_data *sd, int class, int upper); + int (*postHookFunc) (int retVal___, struct map_session_data *sd, int class_, int upper); for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_jobchange_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pc_jobchange_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, class, upper); + retVal___ = postHookFunc(retVal___, sd, class_, upper); } } return retVal___; @@ -70820,15 +70820,15 @@ int HP_pc_candrop(struct map_session_data *sd, struct item *item) { } return retVal___; } -int HP_pc_jobid2mapid(int class) { +int HP_pc_jobid2mapid(int class_) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_pc_jobid2mapid_pre > 0) { - int (*preHookFunc) (int *class); + int (*preHookFunc) (int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_jobid2mapid_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pc_jobid2mapid_pre[hIndex].func; - retVal___ = preHookFunc(&class); + retVal___ = preHookFunc(&class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -70836,13 +70836,13 @@ int HP_pc_jobid2mapid(int class) { } } { - retVal___ = HPMHooks.source.pc.jobid2mapid(class); + retVal___ = HPMHooks.source.pc.jobid2mapid(class_); } if (HPMHooks.count.HP_pc_jobid2mapid_post > 0) { - int (*postHookFunc) (int retVal___, int class); + int (*postHookFunc) (int retVal___, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_jobid2mapid_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pc_jobid2mapid_post[hIndex].func; - retVal___ = postHookFunc(retVal___, class); + retVal___ = postHookFunc(retVal___, class_); } } return retVal___; @@ -70874,15 +70874,15 @@ int HP_pc_mapid2jobid(unsigned int class_, int sex) { } return retVal___; } -const char * HP_pc_job_name(int class) { +const char * HP_pc_job_name(int class_) { int hIndex = 0; const char * retVal___ = NULL; if (HPMHooks.count.HP_pc_job_name_pre > 0) { - const char * (*preHookFunc) (int *class); + const char * (*preHookFunc) (int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_job_name_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pc_job_name_pre[hIndex].func; - retVal___ = preHookFunc(&class); + retVal___ = preHookFunc(&class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -70890,13 +70890,13 @@ const char * HP_pc_job_name(int class) { } } { - retVal___ = HPMHooks.source.pc.job_name(class); + retVal___ = HPMHooks.source.pc.job_name(class_); } if (HPMHooks.count.HP_pc_job_name_post > 0) { - const char * (*postHookFunc) (const char * retVal___, int class); + const char * (*postHookFunc) (const char * retVal___, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_job_name_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pc_job_name_post[hIndex].func; - retVal___ = postHookFunc(retVal___, class); + retVal___ = postHookFunc(retVal___, class_); } } return retVal___; @@ -71648,15 +71648,15 @@ void HP_pc_inventory_rental_add(struct map_session_data *sd, int seconds) { } return; } -int HP_pc_disguise(struct map_session_data *sd, int class) { +int HP_pc_disguise(struct map_session_data *sd, int class_) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_pc_disguise_pre > 0) { - int (*preHookFunc) (struct map_session_data **sd, int *class); + int (*preHookFunc) (struct map_session_data **sd, int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_disguise_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pc_disguise_pre[hIndex].func; - retVal___ = preHookFunc(&sd, &class); + retVal___ = preHookFunc(&sd, &class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -71664,13 +71664,13 @@ int HP_pc_disguise(struct map_session_data *sd, int class) { } } { - retVal___ = HPMHooks.source.pc.disguise(sd, class); + retVal___ = HPMHooks.source.pc.disguise(sd, class_); } if (HPMHooks.count.HP_pc_disguise_post > 0) { - int (*postHookFunc) (int retVal___, struct map_session_data *sd, int class); + int (*postHookFunc) (int retVal___, struct map_session_data *sd, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_disguise_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pc_disguise_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, class); + retVal___ = postHookFunc(retVal___, sd, class_); } } return retVal___; @@ -72926,15 +72926,15 @@ void HP_pc_expire_check(struct map_session_data *sd) { } return; } -bool HP_pc_db_checkid(int class) { +bool HP_pc_db_checkid(int class_) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_pc_db_checkid_pre > 0) { - bool (*preHookFunc) (int *class); + bool (*preHookFunc) (int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_db_checkid_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pc_db_checkid_pre[hIndex].func; - retVal___ = preHookFunc(&class); + retVal___ = preHookFunc(&class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -72942,13 +72942,13 @@ bool HP_pc_db_checkid(int class) { } } { - retVal___ = HPMHooks.source.pc.db_checkid(class); + retVal___ = HPMHooks.source.pc.db_checkid(class_); } if (HPMHooks.count.HP_pc_db_checkid_post > 0) { - bool (*postHookFunc) (bool retVal___, int class); + bool (*postHookFunc) (bool retVal___, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_db_checkid_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pc_db_checkid_post[hIndex].func; - retVal___ = postHookFunc(retVal___, class); + retVal___ = postHookFunc(retVal___, class_); } } return retVal___; @@ -76839,14 +76839,14 @@ void HP_rodex_remove_item(struct map_session_data *sd, int16 idx, int16 amount) } return; } -void HP_rodex_check_player(struct map_session_data *sd, const char *name, int *base_level, int *char_id, int *class) { +void HP_rodex_check_player(struct map_session_data *sd, const char *name, int *base_level, int *char_id, int *class_) { int hIndex = 0; if (HPMHooks.count.HP_rodex_check_player_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, const char **name, int **base_level, int **char_id, int **class); + void (*preHookFunc) (struct map_session_data **sd, const char **name, int **base_level, int **char_id, int **class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_rodex_check_player_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_rodex_check_player_pre[hIndex].func; - preHookFunc(&sd, &name, &base_level, &char_id, &class); + preHookFunc(&sd, &name, &base_level, &char_id, &class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -76854,13 +76854,13 @@ void HP_rodex_check_player(struct map_session_data *sd, const char *name, int *b } } { - HPMHooks.source.rodex.check_player(sd, name, base_level, char_id, class); + HPMHooks.source.rodex.check_player(sd, name, base_level, char_id, class_); } if (HPMHooks.count.HP_rodex_check_player_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, const char *name, int *base_level, int *char_id, int *class); + void (*postHookFunc) (struct map_session_data *sd, const char *name, int *base_level, int *char_id, int *class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_rodex_check_player_post; hIndex++) { postHookFunc = HPMHooks.list.HP_rodex_check_player_post[hIndex].func; - postHookFunc(sd, name, base_level, char_id, class); + postHookFunc(sd, name, base_level, char_id, class_); } } return; @@ -82553,10 +82553,10 @@ bool HP_searchstore_open(struct map_session_data *sd, unsigned int uses, unsigne } return retVal___; } -void HP_searchstore_query(struct map_session_data *sd, unsigned char type, unsigned int min_price, unsigned int max_price, const uint32 *itemlist, unsigned int item_count, const uint32 *cardlist, unsigned int card_count) { +void HP_searchstore_query(struct map_session_data *sd, unsigned char type, unsigned int min_price, unsigned int max_price, const int32 *itemlist, unsigned int item_count, const int32 *cardlist, unsigned int card_count) { int hIndex = 0; if (HPMHooks.count.HP_searchstore_query_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, unsigned char *type, unsigned int *min_price, unsigned int *max_price, const uint32 **itemlist, unsigned int *item_count, const uint32 **cardlist, unsigned int *card_count); + void (*preHookFunc) (struct map_session_data **sd, unsigned char *type, unsigned int *min_price, unsigned int *max_price, const int32 **itemlist, unsigned int *item_count, const int32 **cardlist, unsigned int *card_count); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_searchstore_query_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_searchstore_query_pre[hIndex].func; @@ -82571,7 +82571,7 @@ void HP_searchstore_query(struct map_session_data *sd, unsigned char type, unsig HPMHooks.source.searchstore.query(sd, type, min_price, max_price, itemlist, item_count, cardlist, card_count); } if (HPMHooks.count.HP_searchstore_query_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, unsigned char type, unsigned int min_price, unsigned int max_price, const uint32 *itemlist, unsigned int item_count, const uint32 *cardlist, unsigned int card_count); + void (*postHookFunc) (struct map_session_data *sd, unsigned char type, unsigned int min_price, unsigned int max_price, const int32 *itemlist, unsigned int item_count, const int32 *cardlist, unsigned int card_count); for (hIndex = 0; hIndex < HPMHooks.count.HP_searchstore_query_post; hIndex++) { postHookFunc = HPMHooks.list.HP_searchstore_query_post[hIndex].func; postHookFunc(sd, type, min_price, max_price, itemlist, item_count, cardlist, card_count); @@ -82684,10 +82684,10 @@ void HP_searchstore_close(struct map_session_data *sd) { } return; } -void HP_searchstore_click(struct map_session_data *sd, int account_id, int store_id, int nameid) { +void HP_searchstore_click(struct map_session_data *sd, int account_id, unsigned int store_id, int nameid) { int hIndex = 0; if (HPMHooks.count.HP_searchstore_click_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, int *account_id, int *store_id, int *nameid); + void (*preHookFunc) (struct map_session_data **sd, int *account_id, unsigned int *store_id, int *nameid); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_searchstore_click_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_searchstore_click_pre[hIndex].func; @@ -82702,7 +82702,7 @@ void HP_searchstore_click(struct map_session_data *sd, int account_id, int store HPMHooks.source.searchstore.click(sd, account_id, store_id, nameid); } if (HPMHooks.count.HP_searchstore_click_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, int account_id, int store_id, int nameid); + void (*postHookFunc) (struct map_session_data *sd, int account_id, unsigned int store_id, int nameid); for (hIndex = 0; hIndex < HPMHooks.count.HP_searchstore_click_post; hIndex++) { postHookFunc = HPMHooks.list.HP_searchstore_click_post[hIndex].func; postHookFunc(sd, account_id, store_id, nameid); @@ -84413,15 +84413,15 @@ int HP_skill_get_cooldown(int skill_id, int skill_lv) { } return retVal___; } -int HP_skill_tree_get_max(int skill_id, int class) { +int HP_skill_tree_get_max(int skill_id, int class_) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_tree_get_max_pre > 0) { - int (*preHookFunc) (int *skill_id, int *class); + int (*preHookFunc) (int *skill_id, int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_tree_get_max_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_tree_get_max_pre[hIndex].func; - retVal___ = preHookFunc(&skill_id, &class); + retVal___ = preHookFunc(&skill_id, &class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -84429,13 +84429,13 @@ int HP_skill_tree_get_max(int skill_id, int class) { } } { - retVal___ = HPMHooks.source.skill.tree_get_max(skill_id, class); + retVal___ = HPMHooks.source.skill.tree_get_max(skill_id, class_); } if (HPMHooks.count.HP_skill_tree_get_max_post > 0) { - int (*postHookFunc) (int retVal___, int skill_id, int class); + int (*postHookFunc) (int retVal___, int skill_id, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_tree_get_max_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_tree_get_max_post[hIndex].func; - retVal___ = postHookFunc(retVal___, skill_id, class); + retVal___ = postHookFunc(retVal___, skill_id, class_); } } return retVal___; @@ -97386,14 +97386,14 @@ int HP_status_base_matk_max(const struct status_data *st) { } return retVal___; } -void HP_status_check_job_bonus(int idx, const char *name, int class) { +void HP_status_check_job_bonus(int idx, const char *name, int class_) { int hIndex = 0; if (HPMHooks.count.HP_status_check_job_bonus_pre > 0) { - void (*preHookFunc) (int *idx, const char **name, int *class); + void (*preHookFunc) (int *idx, const char **name, int *class_); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_status_check_job_bonus_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_status_check_job_bonus_pre[hIndex].func; - preHookFunc(&idx, &name, &class); + preHookFunc(&idx, &name, &class_); } if (*HPMforce_return) { *HPMforce_return = false; @@ -97401,13 +97401,13 @@ void HP_status_check_job_bonus(int idx, const char *name, int class) { } } { - HPMHooks.source.status.check_job_bonus(idx, name, class); + HPMHooks.source.status.check_job_bonus(idx, name, class_); } if (HPMHooks.count.HP_status_check_job_bonus_post > 0) { - void (*postHookFunc) (int idx, const char *name, int class); + void (*postHookFunc) (int idx, const char *name, int class_); for (hIndex = 0; hIndex < HPMHooks.count.HP_status_check_job_bonus_post; hIndex++) { postHookFunc = HPMHooks.list.HP_status_check_job_bonus_post[hIndex].func; - postHookFunc(idx, name, class); + postHookFunc(idx, name, class_); } } return; @@ -100053,14 +100053,14 @@ const struct TimerData * HP_timer_get(int tid) { } return retVal___; } -int HP_timer_delete(int tid, TimerFunc func) { +int HP_timer_delete_(int tid, TimerFunc func) { int hIndex = 0; int retVal___ = 0; - if (HPMHooks.count.HP_timer_delete_pre > 0) { + if (HPMHooks.count.HP_timer_delete__pre > 0) { int (*preHookFunc) (int *tid, TimerFunc *func); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_timer_delete_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete__pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_timer_delete__pre[hIndex].func; retVal___ = preHookFunc(&tid, &func); } if (*HPMforce_return) { @@ -100069,12 +100069,12 @@ int HP_timer_delete(int tid, TimerFunc func) { } } { - retVal___ = HPMHooks.source.timer.delete(tid, func); + retVal___ = HPMHooks.source.timer.delete_(tid, func); } - if (HPMHooks.count.HP_timer_delete_post > 0) { + if (HPMHooks.count.HP_timer_delete__post > 0) { int (*postHookFunc) (int retVal___, int tid, TimerFunc func); - for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_timer_delete_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_timer_delete__post; hIndex++) { + postHookFunc = HPMHooks.list.HP_timer_delete__post[hIndex].func; retVal___ = postHookFunc(retVal___, tid, func); } } diff --git a/src/plugins/mapcache/mapcache.c b/src/plugins/mapcache/mapcache.c index a5fc4cceed5..703995f7b40 100644 --- a/src/plugins/mapcache/mapcache.c +++ b/src/plugins/mapcache/mapcache.c @@ -107,7 +107,7 @@ bool write_mapcache(const uint8 *buf, int32 buf_len, bool is_compressed, const c struct map_cache_header header = { 0 }; char file_path[255]; int mapname_len; - unsigned long compressed_buf_len; + unsigned long compressed_buf_len = 0; uint8 *compressed_buf = NULL; FILE *new_mapcache_fp; diff --git a/src/plugins/test_equippos/test_equippos.c b/src/plugins/test_equippos/test_equippos.c index 58ef3664992..36bc6dffefe 100644 --- a/src/plugins/test_equippos/test_equippos.c +++ b/src/plugins/test_equippos/test_equippos.c @@ -84,11 +84,11 @@ VECTOR_STRUCT_DECL(autorelease, struct map_session_data *); static bool checklook(const struct view_data *vd, enum look expected_bottom, enum look expected_top, enum look expected_mid) { nullpo_retr(false, vd); - if (vd->head_bottom != expected_bottom) + if (vd->head_bottom != (int)expected_bottom) return false; - if (vd->head_top != expected_top) + if (vd->head_top != (int)expected_top) return false; - if (vd->head_mid != expected_mid) + if (vd->head_mid != (int)expected_mid) return false; return true; } @@ -156,7 +156,7 @@ static struct map_session_data *make_sd(void) dummy->status.account_id = 150000; dummy->status.char_id = 150000; dummy->status.base_level = 1; - dummy->vd.class = JOB_NOVICE; + dummy->vd.class_ = JOB_NOVICE; dummy->status.inventorySize = FIXED_INVENTORY_SIZE; for (int i = 0; i < ARRAYLENGTH(items); i++) { dummy->inventory_data[i] = &items[i]; diff --git a/src/test/test_spinlock.c b/src/test/test_spinlock.c index ff9afdf5426..421d2da6e77 100644 --- a/src/test/test_spinlock.c +++ b/src/test/test_spinlock.c @@ -40,7 +40,11 @@ static struct spin_lock lock; static unsigned int val = 0; +#ifdef WIN32 +static volatile LONG done_threads = 0; +#else static volatile int32 done_threads = 0; +#endif static void *worker(void *p){ register int i; diff --git a/tools/Script-Checker.applescript b/tools/Script-Checker.applescript deleted file mode 100644 index cbb9a428a3f..00000000000 --- a/tools/Script-Checker.applescript +++ /dev/null @@ -1,167 +0,0 @@ -(* - This file is part of Hercules. - http://herc.ws - http://github.com/HerculesWS/Hercules - - Copyright (C) 2014-2026 Hercules Dev Team - - Hercules 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 3 of the License, or - (at your option) 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 . -*) - --- Base Author: Haru @ http://herc.ws - -(* - ************************************************************* - ************************************************************* - ******** ************** - ******** NOTE: This script must be saved as app!!! ************** - ******** ************** - ************************************************************* - ************************************************************* -*) - -property allowed_extensions : {"txt", "c", "ath", "herc"} -property allowed_types : {"TEXT"} - -on run - try - set the resource_path to path to resource "Scripts" - tell application "Finder" to set the resource_path to the container of the resource_path - on error - display alert "Error" message "You need to save this script as an app bundle." buttons {"Cancel"} cancel button 1 as warning - end try - set the dialog_result to display dialog "You can drag files to this app to have them checked." with title "Hercules Script Checker" buttons {"Cancel", "(Re)build Hercules", "Check Script"} default button 3 cancel button 1 - if the button returned of the dialog_result is "(Re)build Hercules" then - rebuild() - else - set these_items to choose file of type allowed_extensions with prompt "Choose the script(s) you want to check:" with multiple selections allowed - process_items(these_items) - end if -end run - -on open these_items - process_items(these_items) -end open - -on build_hercules(hercules_repo) - try - set the resource_path to path to resource "Scripts" - tell application "Finder" to set the resource_path to the container of the resource_path - on error - display alert "Error" message "You need to save this script as an app bundle." buttons {"Cancel"} cancel button 1 as warning - end try - set the configuration_flags to display dialog "Do you want to use any configuration flags? (i.e. --disable-renewal)" with title "Configuration" default answer "" buttons {"Cancel", "Ok"} default button 2 cancel button 1 - try - set the command_output to do shell script "cd " & (the quoted form of the POSIX path of the hercules_repo) & " && echo './configure " & the text returned of the configuration_flags & " 2>&1' | bash -i" - on error - display dialog "Configuration failed" with title "Configuration result" buttons {"Abort"} cancel button 1 - end try - tell application "TextEdit" - activate - set the new_document to make new document - set the text of new_document to the command_output - end tell - display dialog "Configuration successfully completed. Please check the log file for details." with title "Configuration result" buttons {"Abort", "Continue"} default button 2 cancel button 1 - try - set the command_output to do shell script "cd " & (the quoted form of the POSIX path of the hercules_repo) & " && echo 'make clean 2>&1 && make sql -j8 2>&1' | bash -i" - on error - display dialog "Build failed." with title "Build result" buttons {"Abort"} cancel button 1 - end try - tell application "TextEdit" - activate - set the new_document to make new document - set the text of new_document to the command_output - end tell - display dialog "Build successfully completed. Please check the log file for details." with title "Build result" buttons {"Abort", "Continue"} default button 2 cancel button 1 - set the files_to_copy to {"map-server", "script-checker"} - set the conf_files_to_copy to {"inter-server.conf", "import", "packet.conf", "script.conf"} - set the db_files_to_copy to {"map_index.txt", "item_db2.txt", "constants.conf", "mob_db2.txt"} - set the db2_files_to_copy to {"map_cache.dat", "item_db.txt", "skill_db.txt", "mob_db.txt"} - try - set the hercules_path to path to resource "Hercules" - do shell script "rm -r " & the quoted form of ((the POSIX path of hercules_path) & "/") - end try - set the hercules_path to the resource_path - tell application "Finder" to make new folder at hercules_path with properties {name:"Hercules"} - delay 3 - set the hercules_path to path to resource "Hercules" - repeat with each_file in files_to_copy - copy_file(each_file, hercules_repo, hercules_path, ".") - end repeat - do shell script "mkdir " & the quoted form of ((POSIX path of the hercules_path) & "/conf") - repeat with each_file in conf_files_to_copy - copy_file(each_file, hercules_repo, hercules_path, "conf") - end repeat - do shell script "mkdir " & the quoted form of ((POSIX path of the hercules_path) & "/db") - repeat with each_file in db_files_to_copy - copy_file(each_file, hercules_repo, hercules_path, "db") - end repeat - do shell script "mkdir " & the quoted form of ((POSIX path of the hercules_path) & "/db/pre-re") - repeat with each_file in db2_files_to_copy - copy_file(each_file, hercules_repo, hercules_path, "db/pre-re") - end repeat - do shell script "mkdir " & the quoted form of ((POSIX path of the hercules_path) & "/db/re") - repeat with each_file in db2_files_to_copy - copy_file(each_file, hercules_repo, hercules_path, "db/re") - end repeat - display dialog "Build complete" with title "Done" buttons {"Ok"} default button "Ok" -end build_hercules - -on rebuild() - set the repo_path to choose folder with prompt "Choose the folder where your Hercules repository is located:" - build_hercules(repo_path) -end rebuild - -on copy_file(filename, source, destination, subpath) - do shell script "cp -rp " & the quoted form of ((the POSIX path of source) & "/" & subpath & "/" & filename) & " " & the quoted form of ((the POSIX path of destination) & "/" & subpath & "/") -end copy_file - -on process_items(these_items) - repeat - try - set the scriptchecker to the path to resource "script-checker" in directory "Hercules" - set the mapserver to the path to resource "map-server" in directory "Hercules" - on error - display alert "Missing Hercules binaries" message "You need to build Hercules and place it within this app bundle before running the script checker." & linefeed & linefeed & "I can try to build it for you, but only if you have the Xcode command line tools installed." & linefeed & "Do you want to continue?" buttons {"Cancel", "Build"} default button "Build" cancel button "Cancel" as warning - rebuild() - return false - end try - exit repeat - end repeat - repeat with i from 1 to the count of these_items - set this_item to item i of these_items - set the item_info to info for this_item - set this_name to the name of the item_info - try - set this_extension to the name extension of item_info - on error - set this_extension to "" - end try - try - set this_filetype to the file type of item_info - on error - set this_filetype to "" - end try - if (folder of the item_info is false) and (alias of the item_info is false) and ((this_filetype is in the allowed_types) or (this_extension is in the allowed_extensions)) then - process_item(scriptchecker, this_item) - end if - end repeat -end process_items - -on process_item(checkerpath, this_item) - set the_result to do shell script (the quoted form of the POSIX path of checkerpath & " " & the quoted form of the POSIX path of this_item) & " 2>&1" - if the_result is "" then - set the_result to "Check passed." - end if - display dialog ("File: " & POSIX path of this_item) & linefeed & "Result: " & linefeed & the_result with title "Output" buttons {"Abort", "Next"} default button "Next" cancel button "Abort" -end process_item diff --git a/tools/ci/windows.ps1 b/tools/ci/windows.ps1 index 738a524729f..4ac1d4060a2 100644 --- a/tools/ci/windows.ps1 +++ b/tools/ci/windows.ps1 @@ -54,12 +54,15 @@ function WritePropsFile { function CatchProcessErrors { param([string]$programName, [string]$additionalArgs) - Write-Host "Running server $programName with arguments: $additionalArgs" + $errorFileName = $programName.Replace("\\", "--").Replace("/", "--") - $process = Start-Process -FilePath "$programName" -ArgumentList $additionalArgs -NoNewWindow -PassThru -RedirectStandardError "error_$programName.txt" + Write-Host "Running server $programName and writing errors to error_$errorFileName.txt with arguments: $additionalArgs" + + $process = Start-Process -FilePath "$programName" -ArgumentList $additionalArgs -NoNewWindow -PassThru -RedirectStandardError "error_$errorFileName.txt" + $handle = $process.Handle # Workaround a bug where handle becomes null after wait https://stackoverflow.com/questions/44057728/start-process-system-diagnostics-process-exitcode-is-null-with-nonewwindow $process.WaitForExit() - $errorText = Get-Content "error_$programName.txt" -TotalCount 10000 + $errorText = Get-Content "error_$errorFileName.txt" -TotalCount 10000 if ($null -ne $errorText -and $errorText -ne "") { Write-Host "Errors found in running server $programName" Write-Host "$errorText" @@ -74,31 +77,31 @@ function CatchProcessErrors { Write-Host "Arguments: $args" if ($args[0] -eq "build") { - $propsFile = WritePropsFile $args[1..($args.Length - 1)] - CatchProcessErrors msbuild "-m Hercules.sln /p:ForceImportBeforeCppTargets=$propsFile" - - foreach ($plugin in @("httpsample", "constdb2doc", "db2sql", "dbghelpplug", "generate-translations", "mapcache", "script_mapquit")) { - CreatePluginProject $plugin - CatchProcessErrors msbuild "-m vcproj\\plugin-$plugin.vcxproj /p:ForceImportBeforeCppTargets=$propsFile" - } + $compileFlags = $args[1..($args.Length - 1)] + ./setup_env.ps1 -BuildDir build + Push-Location "build" + cmake -S .. -B . $compileFlags + ninja all + ninja install + Pop-Location } elseif ($args[0] -eq "run") { $serverArgs = "--run-once" - CatchProcessErrors "api-server.exe" $serverArgs - CatchProcessErrors "login-server.exe" $serverArgs - CatchProcessErrors "char-server.exe" $serverArgs - CatchProcessErrors "map-server.exe" $serverArgs + CatchProcessErrors "bin/api-server.exe" $serverArgs + CatchProcessErrors "bin/login-server.exe" $serverArgs + CatchProcessErrors "bin/char-server.exe" $serverArgs + CatchProcessErrors "bin/map-server.exe" $serverArgs } elseif ($args[0] -eq "test") { $serverArgs = "--run-once" - foreach ($plugin in @("HPMHooking", "httpsample", "constdb2doc", "db2sql", "dbghelpplug", "generate-translations", "mapcache", "script_mapquit")) { + foreach ($plugin in @("HPMHooking", "httpsample", "constdb2doc", "db2sql", "generate-translations", "mapcache", "script_mapquit")) { $serverArgs += " --load-plugin $plugin" } - CatchProcessErrors "map-server.exe" "$serverArgs --load-script npc/dev/test.txt --load-script npc/dev/ci_test.txt" - CatchProcessErrors "map-server.exe" "$serverArgs --constdb2doc" - CatchProcessErrors "map-server.exe" "$serverArgs --db2sql" - CatchProcessErrors "map-server.exe" "$serverArgs --itemdb2sql" - CatchProcessErrors "map-server.exe" "$serverArgs --mobdb2sql" - CatchProcessErrors "map-server.exe" "$serverArgs --generate-translations" - CatchProcessErrors "map-server.exe" "$serverArgs --fix-md5" + CatchProcessErrors "bin/map-server.exe" "$serverArgs --load-script npc/dev/test.txt --load-script npc/dev/ci_test.txt" + CatchProcessErrors "bin/map-server.exe" "$serverArgs --constdb2doc" + CatchProcessErrors "bin/map-server.exe" "$serverArgs --db2sql" + CatchProcessErrors "bin/map-server.exe" "$serverArgs --itemdb2sql" + CatchProcessErrors "bin/map-server.exe" "$serverArgs --mobdb2sql" + CatchProcessErrors "bin/map-server.exe" "$serverArgs --generate-translations" + CatchProcessErrors "bin/map-server.exe" "$serverArgs --fix-md5" }