From 5657972614adcdd62e05af9bf711f6e735b15c54 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 17 Jun 2023 16:48:45 -0700 Subject: [PATCH 01/31] More GH Action updates --- .github/workflows/gh-actions-pr.yml | 58 +++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/.github/workflows/gh-actions-pr.yml b/.github/workflows/gh-actions-pr.yml index 77e9d3dcf3..3184d35eb4 100644 --- a/.github/workflows/gh-actions-pr.yml +++ b/.github/workflows/gh-actions-pr.yml @@ -6,142 +6,184 @@ jobs: build: name: Build runs-on: ubuntu-latest + continue-on-error: ${{ matrix.allow_failure }} defaults: run: shell: bash strategy: - fail-fast: true + fail-fast: false matrix: include: - FROM: 'ubuntu:jammy' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'ubuntu:jammy' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'ubuntu:jammy' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'ubuntu:jammy' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'ubuntu:focal' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'ubuntu:focal' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'ubuntu:focal' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'ubuntu:focal' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'ubuntu:bionic' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'ubuntu:bionic' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'ubuntu:bionic' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'ubuntu:bionic' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'linuxmintd/mint21-amd64' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'linuxmintd/mint21-amd64' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'linuxmintd/mint20-amd64' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'linuxmintd/mint20-amd64' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'debian:bookworm' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'debian:bookworm' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'debian:bullseye' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'debian:bullseye' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'debian:buster' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'debian:buster' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'opensuse/leap:15.4' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'opensuse/leap:15.4' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'opensuse/leap:15.3' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'opensuse/leap:15.3' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'opensuse/leap:15.2' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'opensuse/leap:15.2' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'fedora:37' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'fedora:37' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'fedora:36' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'fedora:36' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'fedora:35' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'fedora:35' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'rockylinux:9.0' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'rockylinux:9.0' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'rockylinux:8.6' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'rockylinux:8.6' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false - FROM: 'rockylinux:8.5' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: false - FROM: 'rockylinux:8.5' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' - # Disabling Manjaro builds as there is an issue with the distro - # - FROM: 'manjarolinux/base' - # COMPILER: 'clang' - # OpenGL_GL_PREFERENCE: 'LEGACY' - # - FROM: 'manjarolinux/base' - # COMPILER: 'clang' - # OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: false + - FROM: 'manjarolinux/base' + COMPILER: 'clang' + OpenGL_GL_PREFERENCE: 'LEGACY' + allow_failure: true + - FROM: 'manjarolinux/base' + COMPILER: 'clang' + OpenGL_GL_PREFERENCE: 'GLVND' + allow_failure: true steps: - name: Checkout repository From 3e82023e5f094658537907543482d1c9621df9a8 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 17 Jun 2023 18:30:15 -0700 Subject: [PATCH 02/31] codeql.yml: Uncomment `with: languages` clause for CodeQL Init --- .github/workflows/codeql.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 84a59507d0..f287209375 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -28,12 +28,8 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@0225834cc549ee0ca93cb085b92954821a145866 #v2.3.5 - # with: - # languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + with: + languages: ${{ matrix.language }} - name: Bootstrap and Build the Code run: | From 673fdc843a8b387ec80cc016d726515b97f0f6e6 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 17 Jun 2023 18:41:53 -0700 Subject: [PATCH 03/31] Update Windows-CI.yml --- .github/workflows/Windows-CI.yml | 175 +++++++++++++++++++++---------- 1 file changed, 118 insertions(+), 57 deletions(-) diff --git a/.github/workflows/Windows-CI.yml b/.github/workflows/Windows-CI.yml index 33daae7c28..300fc36810 100644 --- a/.github/workflows/Windows-CI.yml +++ b/.github/workflows/Windows-CI.yml @@ -1,10 +1,7 @@ -# This is a basic workflow to help you get started with Actions - name: Windows-CI # Controls when the action will run. on: - # Triggers the workflow on push or pull request events but only for the master branch push: pull_request: @@ -22,80 +19,144 @@ jobs: fail-fast: false matrix: include: - - os: windows-2019 - cmakeGenerator: VS16Win64 - - os: windows-2022 - cmakeGenerator: Ninja + - os: windows-2019 + cmake-generator: VS2019Win64 + enable-pie: 1 + build-type: Debug + - os: windows-2019 + cmake-generator: VS2019Win64 + enable-pie: 1 + build-type: Release + - os: windows-2019 + cmake-generator: VS2019Win64 + enable-pie: 0 + build-type: Debug + - os: windows-2019 + cmake-generator: VS2019Win64 + enable-pie: 0 + build-type: Release + # - os: windows-2019 + # cmake-generator: ninja + # enable-pie: 1 + # build-type: Debug + # - os: windows-2019 + # cmake-generator: ninja + # enable-pie: 1 + # build-type: Release + # - os: windows-2019 + # cmake-generator: ninja + # enable-pie: 0 + # build-type: Debug + # - os: windows-2019 + # cmake-generator: ninja + # enable-pie: 0 + # build-type: Release + - os: windows-2022 + cmake-generator: VS2022Win64 + enable-pie: 1 + build-type: Debug + - os: windows-2022 + cmake-generator: VS2022Win64 + enable-pie: 1 + build-type: Release + - os: windows-2022 + cmake-generator: VS2022Win64 + enable-pie: 0 + build-type: Debug + - os: windows-2022 + cmake-generator: VS2022Win64 + enable-pie: 0 + build-type: Release + # - os: windows-2022 + # cmake-generator: ninja + # enable-pie: 1 + # build-type: Debug + # - os: windows-2022 + # cmake-generator: ninja + # enable-pie: 1 + # build-type: Release + # - os: windows-2022 + # cmake-generator: ninja + # enable-pie: 0 + # build-type: Debug + # - os: windows-2022 + # cmake-generator: ninja + # enable-pie: 0 + # build-type: Release env: - buildDir: '${{ github.workspace }}/build/' + # Indicates the location of vcpkg + VCPKG_ROOT: '${{ github.workspace }}/v' + # Tells vcpkg where binary packages are stored. + VCPKG_DEFAULT_BINARY_CACHE: '${{ github.workspace }}/vbincache' + ## Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. + #VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite' + VCPKG_DEFAULT_TRIPLET: x64-windows + VCPKG_DEFAULT_HOST_TRIPLET: x64-windows PYTHONHOME: '${{ github.workspace }}/v/packages/python3_x64-windows/tools/python3' # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + # Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage + # for Binary Caching. + - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - - name: install-cmake - uses: lukka/get-cmake@v3.21.2 + - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" + run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE + shell: bash - - name: install-vcpkg - # You may pin to the exact commit or the version. - # uses: lukka/run-vcpkg@9c0ae56bad291f4b185cc433a9b56084b2962259 - uses: lukka/run-vcpkg@v7 + - name: install-cmake + uses: lukka/get-cmake@359fbae4b163fa01633e6de228fa7f2a31ab1fc7 #v3.26.1 with: - vcpkgDirectory: '${{ github.workspace }}/v' - setupOnly: true - vcpkgGitCommitId: '49a30e9db17a8edf7c2809940ee2036746b1b982' - vcpkgTriplet: 'x64-windows' - appendedCacheKey: ${{ hashFiles( '**/vcpkg.json' ) }} - additionalCachedPaths: ${{ env.buildDir }}/vcpkg_installed + cmakeVersion: 3.26.1 + ninjaVersion: 1.11.1 - - name: run-cmake - # You may pin to the exact commit or the version. - # uses: lukka/run-cmake@7ba4481660f0f04c86cfa5f1f24b90effc97bde1 - uses: lukka/run-cmake@v3 - with: - # Path to CMakeLists.txt. Used for both CMakeListsTxtBasic and CMakeListsTxtAdvanced modes. - cmakeListsTxtPath: ${{ github.workspace }}/engine/CMakeLists.txt - # Indicates whether to use vcpkg's CMake toolchain file if RUNVCPKG_VCPKG_ROOT environment variable is defined, for example by a previous run-vcpkg action execution. If the variable is defined, its content would be passed with '-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cmake'. Used by any mode. - useVcpkgToolchainFile: true - # Specify the triplet used with vcpkg. Default value is RUNVCPKG_VCPKG_TRIPLET environment variable, which is set e.g. by the run-vcpkg. Possible values include any file name with no extension present in the vcpkgroot/trplet directory, e.g. x64-linux, x64-windows, x64-osx and so forth. Used by any mode. - vcpkgTriplet: x64-windows - # Select the build configuration, typically Debug or Release. Used by CMakeListsTxtBasic mode. - cmakeBuildType: Release - # Specify the CMake generator to use. Possible values: Ninja: Ninja, NinjaMulti: Ninja Multi-Config UnixMakefiles: Unix Makefiles, VS16Win64: Visual Studio 2019 x64, VS16Arm64: Visual Studio 2019 ARM64, VS16Arm: Visual Studio 2019 ARM, VS16Win32: Visual Studio 2019 Win32, VS15Win64: Visual Studio 2017 x64, VS15Arm64: Visual Studio 2017 ARM64, VS15Arm: Visual Studio 2017 ARM, VS15Win32: Visual Studio 2017 Win32. Used by CMakeListsTxtBasic mode. - cmakeGenerator: ${{ matrix.cmakeGenerator }} - # Set the build directory, i.e. where CMake generates the build system files. Defaults to `$(Build.ArtifactStagingDirectory)` for CMakeLists.txt, and to `$(Build.ArtifactStagingDirectory)/` for CMakeSettings.json. Used by any mode. - buildDirectory: ${{ env.buildDir }} - # Provides a mean to provide all the CMake arguments. This is required when using CMakeLists.txt in Advanced mode. For CMakeSettings.json, the arguments are already inferred, but you can append your arguments providing them here. Used by CMakeListsTxtAdvanced and CMakeSettingsJson modes. - cmakeAppendedArgs: "" - # Indicates whether to run 'cmake --build' after CMake project files have been generated successfully. Used by any mode. - buildWithCMake: true - # Additional parameters for both CMake and the make program (e.g. ninja or make). Separate CMake arguments to the native make program arguments with '--', such as: '--clean-first --config Debug -- -j0'. Used by both CMakeListsTxtBasic and CMakeListsTxtAdvanced modes - buildWithCMakeArgs: "--config Release" + # # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching + # # when it is being run afterward by CMake. + # - name: restore-vcpkg + # uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1 + # with: + # # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the + # # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. + # # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. + # path: | + # ${{ env.VCPKG_ROOT }} + # !${{ env.VCPKG_ROOT }}/buildtrees + # !${{ env.VCPKG_ROOT }}/packages + # !${{ env.VCPKG_ROOT }}/downloads + # !${{ env.VCPKG_ROOT }}/installed + # # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. + # key: | + # ${{ hashFiles( '.git/modules/vcpkg/HEAD' )}} - - name: copy-build-artifacts + - name: install-vcpkg + #if: steps.cache.outputs.cache-hit != 'true' run: | - New-Item bin -Force -Type Directory - $aPossibleBinaryDirs = @("build", "build\objconv", "build\Release", "build\objconv\Release") - $aPossibleBinaryDirs | ForEach-Object { - if (Test-Path $_) { - Copy-Item -Force -Verbose $_\*.* .\bin - } - } + git clone https://github.com/stephengtuggy/vcpkg-local.git ${{ env.VCPKG_ROOT }} + ${{ env.VCPKG_ROOT }}\bootstrap-vcpkg.bat -disableMetrics + + - name: run-build-script + working-directory: ${{ github.workspace }} + run: .\script\build.ps1 -Generator ${{ matrix.cmake-generator }} -EnablePIE ${{ matrix.enable-pie }} -BuildType ${{ matrix.build-type }} - name: Test - working-directory: ${{github.workspace}}/build + working-directory: ${{ github.workspace }} env: GTEST_OUTPUT: xml GTEST_COLOR: 1 - run: ctest -V -C Release + run: .\script\test.ps1 -Generator ${{ matrix.cmake-generator }} -EnablePIE ${{ matrix.enable-pie }} -BuildType ${{ matrix.build-type }} - name: Upload test results uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce #v3.1.2 if: failure() with: - name: test_results_xml - path: ${{github.workspace}}/build/test-results/**/*.xml + name: test_results_xml + path: ${{ github.workspace }}/**/test-results/**/*.xml From 8ab1214f61fe1d93e1b7b7549905d181d0376489 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 17 Jun 2023 18:43:12 -0700 Subject: [PATCH 04/31] Update codeql.yml --- .github/workflows/codeql.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f287209375..a47b9a3db0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -20,21 +20,21 @@ jobs: language: ['cpp', 'python'] steps: - - name: Checkout repository - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #v3.5.2 - with: - fetch-depth: 2 + - name: Checkout repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + with: + fetch-depth: 2 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@0225834cc549ee0ca93cb085b92954821a145866 #v2.3.5 - with: - languages: ${{ matrix.language }} + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@0225834cc549ee0ca93cb085b92954821a145866 #v2.3.5 + with: + languages: ${{ matrix.language }} - - name: Bootstrap and Build the Code - run: | - sudo script/bootstrap - script/build + - name: Bootstrap and Build the Code + run: | + sudo script/bootstrap + script/build - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@0225834cc549ee0ca93cb085b92954821a145866 #v2.3.5 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@0225834cc549ee0ca93cb085b92954821a145866 #v2.3.5 From 6ae4f71acb2c687a7ed728a51c3f4ad66a51faf2 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 17 Jun 2023 18:44:20 -0700 Subject: [PATCH 05/31] Update fortify-on-demand-scan.yml --- .github/workflows/fortify-on-demand-scan.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/fortify-on-demand-scan.yml b/.github/workflows/fortify-on-demand-scan.yml index 38bb3947a3..501d22cee3 100644 --- a/.github/workflows/fortify-on-demand-scan.yml +++ b/.github/workflows/fortify-on-demand-scan.yml @@ -2,8 +2,8 @@ name: Fortify on Demand Scan # Controls when the action will run. on: -# push: -# pull_request: + # push: + # pull_request: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -16,7 +16,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #v3.5.2 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - name: Fortify on Demand Scan # You may pin to the exact commit or the version. From accfb12fdd3eb47ca9989fd1993ebb8fd8428126 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 17 Jun 2023 18:46:07 -0700 Subject: [PATCH 06/31] gh-actions-pr.yml: whitespace updates --- .github/workflows/gh-actions-pr.yml | 74 ++++++++++++++--------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/gh-actions-pr.yml b/.github/workflows/gh-actions-pr.yml index 3184d35eb4..02eacdd986 100644 --- a/.github/workflows/gh-actions-pr.yml +++ b/.github/workflows/gh-actions-pr.yml @@ -186,45 +186,45 @@ jobs: allow_failure: true steps: - - name: Checkout repository - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #v3.5.2 - with: - fetch-depth: 2 - submodules: false + - name: Checkout repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + with: + fetch-depth: 2 + submodules: false - # Ensure PRs are built against the PR Head - # As opposed to the merge commit - - name: Move to PR HEAD - run: git checkout ${{ github.event.pull_request.head.sha }} + # Ensure PRs are built against the PR Head + # As opposed to the merge commit + - name: Move to PR HEAD + run: git checkout ${{ github.event.pull_request.head.sha }} - - name: Extract short SHA - shell: bash - run: | - echo "SHORT_SHA=`git rev-parse --short ${{ github.event.pull_request.head.sha }}`" >> $GITHUB_ENV - - name: Test short SHA - run: | - echo "${SHORT_SHA}" + - name: Extract short SHA + shell: bash + run: | + echo "SHORT_SHA=`git rev-parse --short ${{ github.event.pull_request.head.sha }}`" >> $GITHUB_ENV + - name: Test short SHA + run: | + echo "${SHORT_SHA}" - - name: Build and Test - env: - FROM: ${{ matrix.FROM }} - COMPILER: ${{ matrix.COMPILER }} - FLAGS: '-DOpenGL_GL_PREFERENCE=${{ matrix.OpenGL_GL_PREFERENCE }}' - MY_OS_NAME: linux - IS_RELEASE: 0 - run: script/cibuild $FLAGS + - name: Build and Test + env: + FROM: ${{ matrix.FROM }} + COMPILER: ${{ matrix.COMPILER }} + FLAGS: '-DOpenGL_GL_PREFERENCE=${{ matrix.OpenGL_GL_PREFERENCE }}' + MY_OS_NAME: linux + IS_RELEASE: 0 + run: script/cibuild $FLAGS - # This is run from inside the Docker container, by script/docker-entrypoint.sh - # - name: Test - # working-directory: ${{github.workspace}}/build - # env: - # GTEST_OUTPUT: xml - # GTEST_COLOR: 1 - # run: ctest -V + # This is run from inside the Docker container, by script/docker-entrypoint.sh + # - name: Test + # working-directory: ${{github.workspace}}/build + # env: + # GTEST_OUTPUT: xml + # GTEST_COLOR: 1 + # run: ctest -V - - name: Upload test results - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce #v3.1.2 - if: failure() - with: - name: test_results_xml - path: ${{github.workspace}}/test-results/**/*.xml + - name: Upload test results + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce #v3.1.2 + if: failure() + with: + name: test_results_xml + path: ${{github.workspace}}/test-results/**/*.xml From 773e0c5b99da8f9c3d60b4c2e252faf9ff613f8c Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 17 Jun 2023 18:48:42 -0700 Subject: [PATCH 07/31] Update gh-actions-release.yml --- .github/workflows/gh-actions-release.yml | 59 ++++++++++++------------ 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/.github/workflows/gh-actions-release.yml b/.github/workflows/gh-actions-release.yml index 661806b185..9513fa6584 100644 --- a/.github/workflows/gh-actions-release.yml +++ b/.github/workflows/gh-actions-release.yml @@ -10,6 +10,7 @@ jobs: build: name: Build runs-on: ubuntu-latest + continue-on-error: true strategy: fail-fast: false @@ -158,33 +159,33 @@ jobs: ARTIFACT_EXT: 'rpm' steps: - - name: Checkout repository - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #v3.5.2 - with: - fetch-depth: 2 - submodules: false + - name: Checkout repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + with: + fetch-depth: 2 + submodules: false - - name: Extract tag name and short SHA - shell: bash - run: | - echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/} | sed 's/\//_/g')" >> $GITHUB_ENV - echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV - - name: Test tag name and short SHA - run: | - echo "${TAG_NAME}" - echo "${SHORT_SHA}" - - name: Run CI - env: - FROM: ${{ matrix.FROM }} - COMPILER: ${{ matrix.COMPILER }} - FLAGS: '-DOpenGL_GL_PREFERENCE=${{ matrix.OpenGL_GL_PREFERENCE }}' - MY_OS_NAME: linux - IS_RELEASE: 1 - run: script/cibuild $FLAGS - - name: Upload the artifacts - uses: skx/github-action-publish-binaries@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ARTIFACT_EXT: ${{ matrix.ARTIFACT_EXT }} - with: - args: "packages/*.${{ matrix.ARTIFACT_EXT }}" + - name: Extract tag name and short SHA + shell: bash + run: | + echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/} | sed 's/\//_/g')" >> $GITHUB_ENV + echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV + - name: Test tag name and short SHA + run: | + echo "${TAG_NAME}" + echo "${SHORT_SHA}" + - name: Run CI + env: + FROM: ${{ matrix.FROM }} + COMPILER: ${{ matrix.COMPILER }} + FLAGS: '-DOpenGL_GL_PREFERENCE=${{ matrix.OpenGL_GL_PREFERENCE }}' + MY_OS_NAME: linux + IS_RELEASE: 1 + run: script/cibuild $FLAGS + - name: Upload the artifacts + uses: skx/github-action-publish-binaries@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ARTIFACT_EXT: ${{ matrix.ARTIFACT_EXT }} + with: + args: "packages/*.${{ matrix.ARTIFACT_EXT }}" From a403c7a987bed193d16d11e6a01ae7ada0cc4e00 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 17 Jun 2023 19:46:56 -0700 Subject: [PATCH 08/31] More on GH Actions --- .github/workflows/codeql.yml | 2 +- .github/workflows/gh-actions-pr.yml | 2 +- .github/workflows/gh-actions-release.yml | 2 +- .github/workflows/macos-ci.yml | 7 ++++--- .github/workflows/scorecards-analysis.yml | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a47b9a3db0..4129bcda24 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -20,7 +20,7 @@ jobs: language: ['cpp', 'python'] steps: - - name: Checkout repository + - name: Check out repository uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 with: fetch-depth: 2 diff --git a/.github/workflows/gh-actions-pr.yml b/.github/workflows/gh-actions-pr.yml index 02eacdd986..bd497c6f4a 100644 --- a/.github/workflows/gh-actions-pr.yml +++ b/.github/workflows/gh-actions-pr.yml @@ -186,7 +186,7 @@ jobs: allow_failure: true steps: - - name: Checkout repository + - name: Check out repository uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 with: fetch-depth: 2 diff --git a/.github/workflows/gh-actions-release.yml b/.github/workflows/gh-actions-release.yml index 9513fa6584..b0b3014dbb 100644 --- a/.github/workflows/gh-actions-release.yml +++ b/.github/workflows/gh-actions-release.yml @@ -159,7 +159,7 @@ jobs: ARTIFACT_EXT: 'rpm' steps: - - name: Checkout repository + - name: Check out repository uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 with: fetch-depth: 2 diff --git a/.github/workflows/macos-ci.yml b/.github/workflows/macos-ci.yml index ec50f6229e..c8c41152f8 100644 --- a/.github/workflows/macos-ci.yml +++ b/.github/workflows/macos-ci.yml @@ -49,8 +49,8 @@ jobs: run: brew install boost-python3 gtk+3 gtkglext sdl # The following Apple-provided libraries are deprecated: - # * OpenGL as of MacOS 10.14 - # * GLUT as of MacOS 10.9 + # * OpenGL as of macOS 10.14 + # * GLUT as of macOS 10.9 - name: Optionally install homebrewed OpenGL and GLUT if: ${{ matrix.homebrew-gl }} run: | @@ -60,7 +60,7 @@ jobs: # ln -s /usr/local/lib/libGL.dylib /usr/local/lib/libOpenGL.dylib # find /usr/local/lib/ -iname '*gl*.dylib' - # The Apple-provided OpenAL is deprecated as of MacOS 10.15 + # The Apple-provided OpenAL is deprecated as of macOS 10.15 - name: Optionally install homebrewed OpenAL if: ${{ matrix.homebrew-al }} run: brew install openal-soft @@ -71,6 +71,7 @@ jobs: fetch-depth: 2 submodules: false + # Ensure PRs are built against the PR Head as opposed to the merge commit - name: Conditionally relocate to PR HEAD if: github.event.pull_request run: git checkout HEAD^2 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index cf2d664bb5..58336adac4 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -21,7 +21,7 @@ jobs: contents: read steps: - - name: "Checkout code" + - name: "Check out code" uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #v3.5.2 with: persist-credentials: false From f8a57d5259e2b277f222278a6b23fe2991fefb42 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 17 Jun 2023 19:57:13 -0700 Subject: [PATCH 09/31] Updates to engine/CMakeLists.txt --- engine/CMakeLists.txt | 1137 +++++++++++++++++++++-------------------- 1 file changed, 580 insertions(+), 557 deletions(-) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 4b9e6aca1e..ae3d25e1d4 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -9,7 +9,7 @@ # to change build target (in Release, RelWithDebInfo, Debug, Profiler) # > cmake -DCMAKE_BUILD_TYPE=Debug #==================================== -# Copyright (C) 2001-2022 safemode, Anth0rx, pyramid, Roy Falk, +# Copyright (C) 2001-2023 safemode, Anth0rx, pyramid, Roy Falk, # Nachum Barcohen, Rune Morling, Stephen G. Tuggy, Benjamen Meyer, s0600204, # Evert Vorster, and other Vega Strike contributors. # @@ -79,11 +79,11 @@ ENDIF () SET(VEGASTRIKE_ASSETS_API_VERSION "2") PROJECT(Vega_Strike - VERSION + VERSION "${VEGASTRIKE_VERSION_MAJOR}.${VEGASTRIKE_VERSION_MINOR}.${VEGASTRIKE_VERSION_PATCH}" #.${VEGASTRIKE_VERSION_TWEAK} # CMake only allows numeric version components, unfortunately. - LANGUAGES + LANGUAGES CXX C -) + ) # One version header generator to rule them all CONFIGURE_FILE(src/version.h.in ${CMAKE_SOURCE_DIR}/src/version.h) @@ -121,22 +121,22 @@ SET(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) INCLUDE(InstallRequiredSystemLibraries) IF (MSVC) -INCLUDE_DIRECTORIES( - ${Vega_Strike_SOURCE_DIR}/src - ${Vega_Strike_SOURCE_DIR}/src/cmd - ${Vega_Strike_SOURCE_DIR}/src/damage - ${Vega_Strike_SOURCE_DIR}/src/resource - ${Vega_Strike_BINARY_DIR} -) + INCLUDE_DIRECTORIES( + ${Vega_Strike_SOURCE_DIR}/src + ${Vega_Strike_SOURCE_DIR}/src/cmd + ${Vega_Strike_SOURCE_DIR}/src/damage + ${Vega_Strike_SOURCE_DIR}/src/resource + ${Vega_Strike_BINARY_DIR} + ) ELSE (MSVC) -INCLUDE_DIRECTORIES( - ${Vega_Strike_SOURCE_DIR}/src - ${Vega_Strike_SOURCE_DIR}/src/cmd - ${Vega_Strike_SOURCE_DIR}/src/damage - ${Vega_Strike_SOURCE_DIR}/src/resource - ${Vega_Strike_BINARY_DIR} - /usr/include/harfbuzz/ -) + INCLUDE_DIRECTORIES( + ${Vega_Strike_SOURCE_DIR}/src + ${Vega_Strike_SOURCE_DIR}/src/cmd + ${Vega_Strike_SOURCE_DIR}/src/damage + ${Vega_Strike_SOURCE_DIR}/src/resource + ${Vega_Strike_BINARY_DIR} + /usr/include/harfbuzz/ + ) ENDIF (MSVC) # The source files used to be listed here... @@ -299,7 +299,9 @@ add_link_options("$<$:/DEBUG>") add_compile_options("$<$,$,$>:-pipe>" "$<$,$,$>:-Wall>" "$<$,$,$>:-fvisibility=hidden>" - "$<$,$,$>,$,$,$>>:-Og>" + "$<$,$>,$>:-fstandalone-debug>" + "$<$,$,$>,$>:-O0>" + "$<$,$,$>,$,$>>:-Og>" "$<$,$,$>,$,$>>:-g3>" "$<$,$,$>,$>:-pg>" "$<$,$,$>,$>:-g2>" @@ -314,7 +316,7 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${Vega_Strike_SOURCE_DIR}) # so that we can handle the special cases for Xenial and stretch FIND_PACKAGE(LinuxDistro REQUIRED) -FIND_PACKAGE(Python3 REQUIRED COMPONENTS Development) +FIND_PACKAGE(Python3 REQUIRED COMPONENTS Development Interpreter) MESSAGE("++ Python library : ${Python3_LIBRARIES} (${Python3_VERSION})") MESSAGE("++ Python include dir : ${Python3_INCLUDE_DIRS}") IF (Python3_FOUND) @@ -374,7 +376,8 @@ IF (USE_SYSTEM_BOOST) ENDIF (Boost_python3_FOUND) SET(BOOST_PYTHON_NO_PY_SIGNATURES 1) - SET(TST_INCLUDES ${TST_INCLUDES} ${Boost_INCLUDE_DIRS}) + SET(TST_INCLUDES ${TST_INCLUDES} ${Python3_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) + MESSAGE("** Boost_LIBRARIES: ${Boost_LIBRARIES}") SET(TST_LIBS ${TST_LIBS} ${Boost_LIBRARIES}) INCLUDE_DIRECTORIES(${TST_INCLUDES}) ELSE (Boost_FOUND) @@ -636,510 +639,518 @@ add_link_options("$<$,$,$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +target_compile_definitions(vegastrike-OPcollide PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) +target_compile_definitions(vegastrike-OPcollide PUBLIC _WIN32_WINNT=0x0A00) +target_compile_definitions(vegastrike-OPcollide PUBLIC WINVER=0x0A00) SET(LIBCMD_SOURCES - src/cmd/alphacurve.cpp - src/cmd/cargo.cpp - src/cmd/carrier.cpp - src/cmd/collection.cpp - src/cmd/collide_map.cpp - src/cmd/collide.cpp - src/cmd/container.cpp - src/cmd/csv.cpp - src/cmd/mount.cpp - src/cmd/armed.cpp - src/cmd/audible.cpp - src/cmd/jump_capable.cpp - src/cmd/role_bitmask.cpp - src/cmd/unit_collide.cpp - src/cmd/unit_const_cache.cpp - src/cmd/unit_csv.cpp - src/cmd/unit_csv_factory.cpp - src/cmd/unit_json_factory.cpp - src/cmd/unit_optimize_factory.cpp - src/cmd/json.cpp - src/cmd/unit_functions_generic.cpp - src/cmd/unit_generic.cpp - src/cmd/upgradeable_unit.cpp - src/cmd/fg_util.cpp - src/cmd/unit_util_generic.cpp - src/cmd/unit_xml.cpp - src/cmd/engineVersion.cpp - - src/cmd/collision.cpp - src/cmd/damageable.cpp - src/cmd/drawable.cpp - src/cmd/movable.cpp - src/cmd/computer.cpp - - src/cmd/intelligent.cpp - src/cmd/energetic.cpp - - src/cmd/planetary_orbit.cpp - - src/cmd/weapon_factory.cpp - src/cmd/weapon_info.cpp - src/cmd/mount_size.cpp - src/cmd/weapon_type.cpp - src/vega_py_run.cpp -) + src/cmd/alphacurve.cpp + src/cmd/cargo.cpp + src/cmd/carrier.cpp + src/cmd/collection.cpp + src/cmd/collide_map.cpp + src/cmd/collide.cpp + src/cmd/container.cpp + src/cmd/csv.cpp + src/cmd/mount.cpp + src/cmd/armed.cpp + src/cmd/audible.cpp + src/cmd/jump_capable.cpp + src/cmd/role_bitmask.cpp + src/cmd/unit_collide.cpp + src/cmd/unit_const_cache.cpp + src/cmd/unit_csv.cpp + src/cmd/unit_csv_factory.cpp + src/cmd/unit_json_factory.cpp + src/cmd/unit_optimize_factory.cpp + src/cmd/json.cpp + src/cmd/unit_functions_generic.cpp + src/cmd/unit_generic.cpp + src/cmd/upgradeable_unit.cpp + src/cmd/fg_util.cpp + src/cmd/unit_util_generic.cpp + src/cmd/unit_xml.cpp + src/cmd/engineVersion.cpp + + src/cmd/collision.cpp + src/cmd/damageable.cpp + src/cmd/drawable.cpp + src/cmd/movable.cpp + src/cmd/computer.cpp + + src/cmd/intelligent.cpp + src/cmd/energetic.cpp + + src/cmd/planetary_orbit.cpp + + src/cmd/weapon_factory.cpp + src/cmd/weapon_info.cpp + src/cmd/mount_size.cpp + src/cmd/weapon_type.cpp + src/vega_py_run.cpp + ) SET(LIBCMDSERVER_SOURCES - src/cmd/atmosphere_server.cpp - src/cmd/base_util_server.cpp - src/cmd/beam_server.cpp - src/cmd/bolt_server.cpp - src/cmd/unit_factory_server.cpp - src/cmd/unit_functions_server.cpp - src/cmd/unit_util_server.cpp - src/cmd/unit_server.cpp - src/cmd/pilot_server.cpp - src/cmd/images_server.cpp - src/cmd/faction_xml_server.cpp -) + src/cmd/atmosphere_server.cpp + src/cmd/base_util_server.cpp + src/cmd/beam_server.cpp + src/cmd/bolt_server.cpp + src/cmd/unit_factory_server.cpp + src/cmd/unit_functions_server.cpp + src/cmd/unit_util_server.cpp + src/cmd/unit_server.cpp + src/cmd/pilot_server.cpp + src/cmd/images_server.cpp + src/cmd/faction_xml_server.cpp + ) SET(LIBGFXGENERIC_SOURCES - src/gfx/texture_manager.cpp - src/gfx/boltdrawmanager.cpp - src/gfx/cockpit_generic.cpp - src/gfx/lerp.cpp - src/gfx/matrix.cpp - src/gfx/mesh_bxm.cpp - src/gfx/mesh_poly.cpp - src/gfx/mesh_xml.cpp - src/gfx/mesh.cpp - src/gfx/quaternion.cpp - src/gfx/soundcontainer_generic.cpp - src/gfx/sphere_generic.cpp - src/gfx/tvector.cpp -) + src/gfx/texture_manager.cpp + src/gfx/boltdrawmanager.cpp + src/gfx/cockpit_generic.cpp + src/gfx/lerp.cpp + src/gfx/matrix.cpp + src/gfx/mesh_bxm.cpp + src/gfx/mesh_poly.cpp + src/gfx/mesh_xml.cpp + src/gfx/mesh.cpp + src/gfx/quaternion.cpp + src/gfx/soundcontainer_generic.cpp + src/gfx/sphere_generic.cpp + src/gfx/tvector.cpp + ) SET(LIBGFXCLIENT_SOURCES - src/gfx/ani_texture.cpp - src/gfx/animation.cpp - src/gfx/aux_logo.cpp - src/gfx/aux_palette.cpp - src/gfx/aux_texture.cpp - src/gfx/background.cpp - src/gfx/camera.cpp - src/gfx/cockpit_xml.cpp - src/gfx/cockpit.cpp - src/gfx/cockpit_gfx.cpp - src/gfx/cockpit_gfx_utils.cpp - src/gfx/coord_select.cpp - src/gfx/env_map_gent.cpp - src/gfx/gauge.cpp - src/gfx/halo_system.cpp - src/gfx/halo.cpp - src/gfx/hud.cpp - src/gfx/jpeg_memory.cpp - src/gfx/loc_select.cpp - src/gfx/masks.cpp - src/gfx/mesh_bin.cpp - src/gfx/mesh_fx.cpp - src/gfx/mesh_gfx.cpp - src/gfx/nav/criteria_xml.cpp - src/gfx/nav/criteria.cpp - src/gfx/nav/drawgalaxy.cpp - src/gfx/nav/drawlist.cpp - src/gfx/nav/drawsystem.cpp - src/gfx/nav/navcomputer.cpp - src/gfx/nav/navgetxmldata.cpp - src/gfx/nav/navpath.cpp - src/gfx/nav/navscreen.cpp - src/gfx/nav/navscreenoccupied.cpp - src/gfx/radar/bubble_display.cpp - src/gfx/radar/bubble_display.h - src/gfx/radar/dual_display.cpp - src/gfx/radar/dual_display.h - src/gfx/radar/null_display.h - src/gfx/radar/plane_display.cpp - src/gfx/radar/plane_display.h - src/gfx/radar/radar.cpp - src/gfx/radar/radar.h - src/gfx/radar/sensor.cpp - src/gfx/radar/sensor.h - src/gfx/radar/sphere_display.cpp - src/gfx/radar/sphere_display.h - src/gfx/radar/track.cpp - src/gfx/radar/track.h - src/gfx/radar/viewarea.cpp - src/gfx/radar/viewarea.h - src/gfx/particle.cpp - src/gfx/pipelined_texture.cpp - src/gfx/quadsquare_cull.cpp - src/gfx/quadsquare_render.cpp - src/gfx/quadsquare_update.cpp - src/gfx/quadsquare.cpp - src/gfx/quadtree_xml.cpp - src/gfx/quadtree.cpp - src/gfx/ring.cpp - src/gfx/occlusion.cpp - src/gfx/screenshot.cpp - src/gfx/soundcontainer.cpp - src/gfx/soundcontainer_aldrv.cpp - src/gfx/sphere.cpp - src/gfx/sprite.cpp - src/gfx/star.cpp - src/gfx/stream_texture.cpp - src/gfx/technique.cpp - src/gfx/pass.cpp - src/gfx/tex_transform.cpp - src/gfx/vdu.cpp - src/gfx/vid_file.cpp - src/ffmpeg_init.cpp - src/gfx/vsbox.cpp - src/gfx/vsimage.cpp - src/gfx/warptrail.cpp -) + src/gfx/ani_texture.cpp + src/gfx/animation.cpp + src/gfx/aux_logo.cpp + src/gfx/aux_palette.cpp + src/gfx/aux_texture.cpp + src/gfx/background.cpp + src/gfx/camera.cpp + src/gfx/cockpit_xml.cpp + src/gfx/cockpit.cpp + src/gfx/cockpit_gfx.cpp + src/gfx/cockpit_gfx_utils.cpp + src/gfx/coord_select.cpp + src/gfx/env_map_gent.cpp + src/gfx/gauge.cpp + src/gfx/halo_system.cpp + src/gfx/halo.cpp + src/gfx/hud.cpp + src/gfx/jpeg_memory.cpp + src/gfx/loc_select.cpp + src/gfx/masks.cpp + src/gfx/mesh_bin.cpp + src/gfx/mesh_fx.cpp + src/gfx/mesh_gfx.cpp + src/gfx/nav/criteria_xml.cpp + src/gfx/nav/criteria.cpp + src/gfx/nav/drawgalaxy.cpp + src/gfx/nav/drawlist.cpp + src/gfx/nav/drawsystem.cpp + src/gfx/nav/navcomputer.cpp + src/gfx/nav/navgetxmldata.cpp + src/gfx/nav/navpath.cpp + src/gfx/nav/navscreen.cpp + src/gfx/nav/navscreenoccupied.cpp + src/gfx/radar/bubble_display.cpp + src/gfx/radar/bubble_display.h + src/gfx/radar/dual_display.cpp + src/gfx/radar/dual_display.h + src/gfx/radar/null_display.h + src/gfx/radar/plane_display.cpp + src/gfx/radar/plane_display.h + src/gfx/radar/radar.cpp + src/gfx/radar/radar.h + src/gfx/radar/sensor.cpp + src/gfx/radar/sensor.h + src/gfx/radar/sphere_display.cpp + src/gfx/radar/sphere_display.h + src/gfx/radar/track.cpp + src/gfx/radar/track.h + src/gfx/radar/viewarea.cpp + src/gfx/radar/viewarea.h + src/gfx/particle.cpp + src/gfx/pipelined_texture.cpp + src/gfx/quadsquare_cull.cpp + src/gfx/quadsquare_render.cpp + src/gfx/quadsquare_update.cpp + src/gfx/quadsquare.cpp + src/gfx/quadtree_xml.cpp + src/gfx/quadtree.cpp + src/gfx/ring.cpp + src/gfx/occlusion.cpp + src/gfx/screenshot.cpp + src/gfx/soundcontainer.cpp + src/gfx/soundcontainer_aldrv.cpp + src/gfx/sphere.cpp + src/gfx/sprite.cpp + src/gfx/star.cpp + src/gfx/stream_texture.cpp + src/gfx/technique.cpp + src/gfx/pass.cpp + src/gfx/tex_transform.cpp + src/gfx/vdu.cpp + src/gfx/vid_file.cpp + src/ffmpeg_init.cpp + src/gfx/vsbox.cpp + src/gfx/vsimage.cpp + src/gfx/warptrail.cpp + ) SET(LIBGFXSERVER_SOURCES - src/gfx/sphere_server.cpp - src/gfx/vsbox_server.cpp - src/gfx/mesh_server.cpp - src/gfx/background_server.cpp - src/gfx/mesh_bin_server.cpp -) + src/gfx/sphere_server.cpp + src/gfx/vsbox_server.cpp + src/gfx/mesh_server.cpp + src/gfx/background_server.cpp + src/gfx/mesh_bin_server.cpp + ) SET(LIBROOTGENERIC_SOURCES - src/atmospheric_fog_mesh.cpp - src/configxml.cpp - src/easydom.cpp - src/endianness.cpp - src/macosx_math.cpp - src/faction_generic.cpp - src/faction_util_generic.cpp - src/galaxy.cpp - src/galaxy_gen.cpp - src/galaxy_xml.cpp - src/galaxy_utils.cpp - src/hashtable.cpp - src/lin_time.cpp - src/load_mission.cpp - src/pk3.cpp - src/posh.cpp - src/savegame.cpp - src/system_factory.cpp - src/star_system_generic.cpp - src/star_system_xml.cpp - src/stardate.cpp - src/universe_globals.cpp - src/universe_util_generic.cpp - src/vs_globals.cpp - src/vsfilesystem.cpp - src/xml_serializer.cpp - src/xml_support.cpp - src/XMLDocument.cpp - src/options.cpp -) + src/atmospheric_fog_mesh.cpp + src/configxml.cpp + src/easydom.cpp + src/endianness.cpp + src/macosx_math.cpp + src/faction_generic.cpp + src/faction_util_generic.cpp + src/galaxy.cpp + src/galaxy_gen.cpp + src/galaxy_xml.cpp + src/galaxy_utils.cpp + src/hashtable.cpp + src/lin_time.cpp + src/load_mission.cpp + src/pk3.cpp + src/posh.cpp + src/savegame.cpp + src/system_factory.cpp + src/star_system_generic.cpp + src/star_system_xml.cpp + src/stardate.cpp + src/universe_globals.cpp + src/universe_util_generic.cpp + src/vs_globals.cpp + src/vsfilesystem.cpp + src/xml_serializer.cpp + src/xml_support.cpp + src/XMLDocument.cpp + src/options.cpp + ) SET(LIBROOTCLIENT_SOURCES - src/cg_global.cpp - src/command.cpp - src/config_xml.cpp - src/debug_vs.cpp - src/faction_util.cpp - src/force_feedback.cpp - src/gamemenu.cpp - src/gfxlib_struct.cpp - src/in_joystick.cpp - src/in_kb.cpp - src/in_main.cpp - src/in_mouse.cpp - src/in_sdl.cpp - src/main_loop.cpp - src/physics.cpp - src/rendertext.cpp - src/ship_commands.cpp - src/star_system_jump.cpp - src/star_system.cpp - src/universe_util.cpp - src/universe.cpp -) + src/cg_global.cpp + src/command.cpp + src/config_xml.cpp + src/debug_vs.cpp + src/faction_util.cpp + src/force_feedback.cpp + src/gamemenu.cpp + src/gfxlib_struct.cpp + src/in_joystick.cpp + src/in_kb.cpp + src/in_main.cpp + src/in_mouse.cpp + src/in_sdl.cpp + src/main_loop.cpp + src/physics.cpp + src/rendertext.cpp + src/ship_commands.cpp + src/star_system_jump.cpp + src/star_system.cpp + src/universe_util.cpp + src/universe.cpp + ) SET(LIBROOTSERVER_SOURCES - src/force_feedback_server.cpp - src/faction_util_server.cpp - src/gfxlib_struct_server.cpp - src/libaudioserver.cpp - src/libserver.cpp - src/universe_util_server.cpp -) + src/force_feedback_server.cpp + src/faction_util_server.cpp + src/gfxlib_struct_server.cpp + src/libaudioserver.cpp + src/libserver.cpp + src/universe_util_server.cpp + ) SET(LIBAUDIO_SOURCES - src/audio/CodecRegistry.cpp - src/audio/Listener.cpp - src/audio/RenderableListener.cpp - src/audio/RenderableSource.cpp - src/audio/Renderer.cpp - src/audio/Scene.cpp - src/audio/SceneManager.cpp - src/audio/SimpleScene.cpp - src/audio/SimpleSound.cpp - src/audio/SimpleSource.cpp - src/audio/SoundBuffer.cpp - src/audio/Sound.cpp - src/audio/Source.cpp - src/audio/SourceTemplate.cpp - src/audio/Stream.cpp - src/audio/test.cpp - src/audio/utils.cpp - src/audio/codecs/Codec.cpp - src/audio/codecs/FFCodec.cpp - src/audio/codecs/FFStream.cpp - src/audio/codecs/OggCodec.cpp - src/audio/codecs/OggData.cpp - src/audio/codecs/OggStream.cpp - src/audio/renderers/OpenAL/OpenALHelpers.cpp - src/audio/renderers/OpenAL/OpenALRenderableListener.cpp - src/audio/renderers/OpenAL/OpenALRenderableSource.cpp - src/audio/renderers/OpenAL/OpenALRenderableStreamingSource.cpp - src/audio/renderers/OpenAL/OpenALRenderer.cpp - src/audio/renderers/OpenAL/OpenALSimpleSound.cpp - src/audio/renderers/OpenAL/OpenALStreamingSound.cpp -) + src/audio/CodecRegistry.cpp + src/audio/Listener.cpp + src/audio/RenderableListener.cpp + src/audio/RenderableSource.cpp + src/audio/Renderer.cpp + src/audio/Scene.cpp + src/audio/SceneManager.cpp + src/audio/SimpleScene.cpp + src/audio/SimpleSound.cpp + src/audio/SimpleSource.cpp + src/audio/SoundBuffer.cpp + src/audio/Sound.cpp + src/audio/Source.cpp + src/audio/SourceTemplate.cpp + src/audio/Stream.cpp + src/audio/test.cpp + src/audio/utils.cpp + src/audio/codecs/Codec.cpp + src/audio/codecs/FFCodec.cpp + src/audio/codecs/FFStream.cpp + src/audio/codecs/OggCodec.cpp + src/audio/codecs/OggData.cpp + src/audio/codecs/OggStream.cpp + src/audio/renderers/OpenAL/OpenALHelpers.cpp + src/audio/renderers/OpenAL/OpenALRenderableListener.cpp + src/audio/renderers/OpenAL/OpenALRenderableSource.cpp + src/audio/renderers/OpenAL/OpenALRenderableStreamingSource.cpp + src/audio/renderers/OpenAL/OpenALRenderer.cpp + src/audio/renderers/OpenAL/OpenALSimpleSound.cpp + src/audio/renderers/OpenAL/OpenALStreamingSound.cpp + ) ADD_LIBRARY(vegastrike-engine_com - ${LIBVS_LOGGING} - ${LIBCONFIG} - ${LIBDAMAGE} - ${LIBRESOURCE} - ${LIBAI_SOURCES} - ${LIBCMD_SOURCES} - ${LIBNET_SOURCES} - ${LIBPYTHON_SOURCES} - ${LIBROOTGENERIC_SOURCES} - ${LIBSCRIPT_SOURCES} - ${LIBGFXGENERIC_SOURCES} -) + ${LIBVS_LOGGING} + ${LIBCONFIG} + ${LIBDAMAGE} + ${LIBRESOURCE} + ${LIBAI_SOURCES} + ${LIBCMD_SOURCES} + ${LIBNET_SOURCES} + ${LIBPYTHON_SOURCES} + ${LIBROOTGENERIC_SOURCES} + ${LIBSCRIPT_SOURCES} + ${LIBGFXGENERIC_SOURCES} + ) TARGET_COMPILE_FEATURES(vegastrike-engine_com PUBLIC cxx_std_11) IF (NEED_LINKING_AGAINST_LIBM) TARGET_LINK_LIBRARIES(vegastrike-engine_com m) ENDIF() +target_compile_definitions(vegastrike-engine_com PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +target_compile_definitions(vegastrike-engine_com PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) +target_compile_definitions(vegastrike-engine_com PUBLIC _WIN32_WINNT=0x0A00) +target_compile_definitions(vegastrike-engine_com PUBLIC WINVER=0x0A00) SET(VEGASTRIKE_SOURCES - ${LIBGUI_SOURCES} - ${LIBNETCLIENT_SOURCES} - ${LIBROOTCLIENT_SOURCES} - ${LIBGFXCLIENT_SOURCES} - ${LIBAUDIO_SOURCES} - src/aldrv/al_globals.cpp - src/aldrv/al_init.cpp - src/aldrv/al_listen.cpp - src/aldrv/al_sound.cpp - src/cmd/ai/firekeyboard.cpp - src/cmd/ai/flyjoystick.cpp - src/cmd/ai/flykeyboard.cpp - src/cmd/asteroid.cpp - src/cmd/atmosphere.cpp - src/cmd/base_init.cpp - src/cmd/base_interface.cpp - src/cmd/base_util.cpp - src/cmd/base_write_python.cpp - src/cmd/base_write_xml.cpp - src/cmd/base_xml.cpp - src/cmd/basecomputer.cpp - src/cmd/beam.cpp - src/cmd/bolt.cpp - src/cmd/briefing.cpp - src/cmd/building.cpp - src/cmd/click_list.cpp - src/cmd/cont_terrain.cpp - src/cmd/missile.cpp - src/cmd/music.cpp - src/cmd/nebula.cpp - src/cmd/planet.cpp - src/cmd/ship.cpp - src/cmd/script/c_alike/c_alike.tab.cpp - src/cmd/script/c_alike/lex.yy.cpp - src/cmd/script/director.cpp - src/cmd/script/flightgroup.cpp - src/cmd/script/script_call_briefing.cpp - src/cmd/script/script_call_unit.cpp - src/cmd/terrain.cpp - src/cmd/unit_functions.cpp - src/cmd/unit_util.cpp - src/cmd/faction_xml.cpp - src/cmd/faction_factory.cpp - src/cmd/pilot.cpp - src/cmd/images.cpp - src/cmd/turret.cpp - src/gldrv/gl_program.cpp - src/gldrv/gl_clip.cpp - src/gldrv/gl_fog.cpp - src/gldrv/gl_globals.cpp - src/gldrv/gl_init.cpp - src/gldrv/gl_light_pick.cpp - src/gldrv/gl_light_state.cpp - src/gldrv/gl_light.cpp - src/gldrv/gl_material.cpp - src/gldrv/gl_matrix.cpp - src/gldrv/gl_misc.cpp - src/gldrv/gl_quad_list.cpp - src/gldrv/gl_sphere_list.cpp - src/gldrv/gl_state.cpp - src/gldrv/sdds.cpp - src/gldrv/gl_texture.cpp - src/gldrv/gl_vertex_list.cpp - src/gldrv/winsys.cpp - src/main.cpp - src/python/briefing_wrapper.cpp -) + ${LIBGUI_SOURCES} + ${LIBNETCLIENT_SOURCES} + ${LIBROOTCLIENT_SOURCES} + ${LIBGFXCLIENT_SOURCES} + ${LIBAUDIO_SOURCES} + src/aldrv/al_globals.cpp + src/aldrv/al_init.cpp + src/aldrv/al_listen.cpp + src/aldrv/al_sound.cpp + src/cmd/ai/firekeyboard.cpp + src/cmd/ai/flyjoystick.cpp + src/cmd/ai/flykeyboard.cpp + src/cmd/asteroid.cpp + src/cmd/atmosphere.cpp + src/cmd/base_init.cpp + src/cmd/base_interface.cpp + src/cmd/base_util.cpp + src/cmd/base_write_python.cpp + src/cmd/base_write_xml.cpp + src/cmd/base_xml.cpp + src/cmd/basecomputer.cpp + src/cmd/beam.cpp + src/cmd/bolt.cpp + src/cmd/briefing.cpp + src/cmd/building.cpp + src/cmd/click_list.cpp + src/cmd/cont_terrain.cpp + src/cmd/missile.cpp + src/cmd/music.cpp + src/cmd/nebula.cpp + src/cmd/planet.cpp + src/cmd/ship.cpp + src/cmd/script/c_alike/c_alike.tab.cpp + src/cmd/script/c_alike/lex.yy.cpp + src/cmd/script/director.cpp + src/cmd/script/flightgroup.cpp + src/cmd/script/script_call_briefing.cpp + src/cmd/script/script_call_unit.cpp + src/cmd/terrain.cpp + src/cmd/unit_functions.cpp + src/cmd/unit_util.cpp + src/cmd/faction_xml.cpp + src/cmd/faction_factory.cpp + src/cmd/pilot.cpp + src/cmd/images.cpp + src/cmd/turret.cpp + src/gldrv/gl_program.cpp + src/gldrv/gl_clip.cpp + src/gldrv/gl_fog.cpp + src/gldrv/gl_globals.cpp + src/gldrv/gl_init.cpp + src/gldrv/gl_light_pick.cpp + src/gldrv/gl_light_state.cpp + src/gldrv/gl_light.cpp + src/gldrv/gl_material.cpp + src/gldrv/gl_matrix.cpp + src/gldrv/gl_misc.cpp + src/gldrv/gl_quad_list.cpp + src/gldrv/gl_sphere_list.cpp + src/gldrv/gl_state.cpp + src/gldrv/sdds.cpp + src/gldrv/gl_texture.cpp + src/gldrv/gl_vertex_list.cpp + src/gldrv/winsys.cpp + src/main.cpp + src/python/briefing_wrapper.cpp + ) SET(TST_LIBS vegastrike-engine_com vegastrike-OPcollide ${TST_LIBS}) @@ -1151,6 +1162,10 @@ IF (NOT DISABLE_CLIENT) IF (NEED_LINKING_AGAINST_LIBM) TARGET_LINK_LIBRARIES(vegastrike-engine m) ENDIF() + target_compile_definitions(vegastrike-engine PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") + target_compile_definitions(vegastrike-engine PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vegastrike-engine PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vegastrike-engine PUBLIC WINVER=0x0A00) ADD_DEPENDENCIES(vegastrike-engine OpenGL::GL OpenGL::GLU) @@ -1178,60 +1193,60 @@ ADD_SUBDIRECTORY(objconv) ## end debug output MARK_AS_ADVANCED(FORCE - Boost_DIR - AVCODEC_FOUND - AVFORMAT_FOUND - AVUTIL_FOUND - AVCODEC_LIBRARY - AVCODEC_INCLUDE_DIR - AVUTIL_INCLUDE_DIR - AVFORMAT_LIBRARY - AVUTIL_LIBRARY - SWSCALE_INCLUDE_DIR - SWSCALE_LIBRARY - AVFORMAT_INCLUDE_DIR - HAVE_AVFORMAT_H - HAVE_AVCODEC_H - HAVE_AVIO_H - HAVE_FFMPEG_SWSCALE_H - CMAKE_BACKWARDS_COMPATIBILITY - FFMPEG_INCLUDE_DIR - FFMPEG_FOUND - FFMPEG_LIBRARIES - FFMPEG_DEFINITIONS - GTK3_ATK_INCLUDE_DIR - GTK3_ATK_LIBRARY - GTK3_CAIRO_INCLUDE_DIR - GTK3_CAIRO_LIBRARY - GTK3_GDK_INCLUDE_DIR - GTK3_GDK_LIBRARY - GTK3_GDK_PIXBUF_LIBRARY - GTK3_GDK_PIXBUF_INCLUDE_DIR - GTK3_GLIBCONFIG_INCLUDE_DIR - GTK3_GLIB_INCLUDE_DIR - GTK3_GLIB_LIBRARY - GTK3_GMODULE_LIBRARY - GTK3_GOBJECT_LIBRARY - GTK3_PANGO_INCLUDE_DIR - GTK3_PANGO_LIBRARY - GTK3_GTHREAD_LIBRARY - GTK3_GTKGL_INCLUDE_DIR - GTK3_GTKGL_LIBRARY - GTK3_GTK_INCLUDE_DIR - GTK3_GTK_LIBRARY - LIBRARY_OUTPUT_PATH - OPENAL_INCLUDE_DIR - OPENAL_LIBRARY - SDLMAIN_LIBRARY - SDL_INCLUDE_DIR - SDL_LIBRARY - UTIL_LIB - ogg_INCLUDE_DIR - ogg_LIBRARY - vorbis_INCLUDE_DIR - vorbis_LIBRARY - vorbisfile_LIBRARY -) + Boost_DIR + AVCODEC_FOUND + AVFORMAT_FOUND + AVUTIL_FOUND + AVCODEC_LIBRARY + AVCODEC_INCLUDE_DIR + AVUTIL_INCLUDE_DIR + AVFORMAT_LIBRARY + AVUTIL_LIBRARY + SWSCALE_INCLUDE_DIR + SWSCALE_LIBRARY + AVFORMAT_INCLUDE_DIR + HAVE_AVFORMAT_H + HAVE_AVCODEC_H + HAVE_AVIO_H + HAVE_FFMPEG_SWSCALE_H + CMAKE_BACKWARDS_COMPATIBILITY + FFMPEG_INCLUDE_DIR + FFMPEG_FOUND + FFMPEG_LIBRARIES + FFMPEG_DEFINITIONS + GTK3_ATK_INCLUDE_DIR + GTK3_ATK_LIBRARY + GTK3_CAIRO_INCLUDE_DIR + GTK3_CAIRO_LIBRARY + GTK3_GDK_INCLUDE_DIR + GTK3_GDK_LIBRARY + GTK3_GDK_PIXBUF_LIBRARY + GTK3_GDK_PIXBUF_INCLUDE_DIR + GTK3_GLIBCONFIG_INCLUDE_DIR + GTK3_GLIB_INCLUDE_DIR + GTK3_GLIB_LIBRARY + GTK3_GMODULE_LIBRARY + GTK3_GOBJECT_LIBRARY + GTK3_PANGO_INCLUDE_DIR + GTK3_PANGO_LIBRARY + GTK3_GTHREAD_LIBRARY + GTK3_GTKGL_INCLUDE_DIR + GTK3_GTKGL_LIBRARY + GTK3_GTK_INCLUDE_DIR + GTK3_GTK_LIBRARY + LIBRARY_OUTPUT_PATH + OPENAL_INCLUDE_DIR + OPENAL_LIBRARY + SDLMAIN_LIBRARY + SDL_INCLUDE_DIR + SDL_LIBRARY + UTIL_LIB + ogg_INCLUDE_DIR + ogg_LIBRARY + vorbis_INCLUDE_DIR + vorbis_LIBRARY + vorbisfile_LIBRARY + ) INSTALL(TARGETS vegastrike-engine DESTINATION bin) # CMake doesn't support doing symlinks directly; however, @@ -1582,9 +1597,9 @@ ENDIF (INSTALL_GTEST OR USE_GTEST) IF (INSTALL_GTEST) INCLUDE(FetchContent) FetchContent_Declare( - googletest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.11.0 + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.11.0 ) FetchContent_GetProperties(googletest) @@ -1609,42 +1624,50 @@ IF (USE_GTEST) SET(TEST_NAME ${PROJECT_NAME}_tests) ADD_EXECUTABLE( - ${TEST_NAME} - src/cmd/tests/csv_tests.cpp - src/cmd/tests/json_tests.cpp - src/configuration/tests/configuration_tests.cpp - src/damage/tests/health_tests.cpp - src/damage/tests/layer_tests.cpp - src/damage/tests/object_tests.cpp - src/resource/tests/buy_sell.cpp - src/resource/tests/resource_test.cpp - src/exit_unit_tests.cpp + ${TEST_NAME} + src/cmd/tests/csv_tests.cpp + src/cmd/tests/json_tests.cpp + src/configuration/tests/configuration_tests.cpp + src/damage/tests/health_tests.cpp + src/damage/tests/layer_tests.cpp + src/damage/tests/object_tests.cpp + src/resource/tests/buy_sell.cpp + src/resource/tests/resource_test.cpp + src/exit_unit_tests.cpp ) ADD_LIBRARY(vegastrike-testing - ${LIBCONFIG} - ${LIBDAMAGE} - ${LIBRESOURCE} - ${LIBCMD_SOURCES} - ${LIBVS_LOGGING} - ) + ${LIBCONFIG} + ${LIBDAMAGE} + ${LIBRESOURCE} + ${LIBCMD_SOURCES} + ${LIBVS_LOGGING} + ) + target_compile_definitions(vegastrike-testing PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") + target_compile_definitions(vegastrike-testing PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vegastrike-testing PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vegastrike-testing PUBLIC WINVER=0x0A00) TARGET_LINK_LIBRARIES( - ${TEST_NAME} - gtest_main - vegastrike-testing - Boost::log - Boost::log_setup + ${TEST_NAME} + gtest_main + vegastrike-testing + Boost::log + Boost::log_setup ) + target_compile_definitions(${TEST_NAME} PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") + target_compile_definitions(${TEST_NAME} PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(${TEST_NAME} PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(${TEST_NAME} PUBLIC WINVER=0x0A00) FILE( - COPY "src/configuration/tests/vegastrike.config" - DESTINATION ${CMAKE_BINARY_DIR}/test_assets + COPY "src/configuration/tests/vegastrike.config" + DESTINATION ${CMAKE_BINARY_DIR}/test_assets ) FILE( - COPY "src/cmd/tests/units.json" - DESTINATION ${CMAKE_BINARY_DIR}/test_assets + COPY "src/cmd/tests/units.json" + DESTINATION ${CMAKE_BINARY_DIR}/test_assets ) INCLUDE(GoogleTest) From 45053aebfb4225e4d04623b8cb86124647650866 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 17 Jun 2023 19:59:41 -0700 Subject: [PATCH 10/31] Add engine/CMakePresets.json --- engine/CMakePresets.json | 765 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 765 insertions(+) create mode 100644 engine/CMakePresets.json diff --git a/engine/CMakePresets.json b/engine/CMakePresets.json new file mode 100644 index 0000000000..44a3cb0cd2 --- /dev/null +++ b/engine/CMakePresets.json @@ -0,0 +1,765 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 16, + "patch": 0 + }, + "configurePresets": [ + { + "name": "default", + "hidden": true, + "displayName": "Default Config", + "description": "Default build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceParentDir}/build/${presetName}", + "debug": { + "output": true + } + }, + { + "name": "debug", + "hidden": true, + "displayName": "Debug", + "inherits": "default", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "release", + "hidden": true, + "displayName": "Release", + "inherits": "default", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "pie-enabled", + "hidden": true, + "inherits": "default", + "displayName": "PIE Enabled", + "description": "Enable Position-Independent Executables (PIE)", + "cacheVariables": { + "ENABLE_PIE": true + } + }, + { + "name": "pie-disabled", + "hidden": true, + "inherits": "default", + "displayName": "PIE Disabled", + "description": "Build with Position-Independent Executables (PIE) turned off", + "cacheVariables": { + "ENABLE_PIE": false + } + }, + { + "name": "legacy-gl", + "hidden": true, + "displayName": "Legacy OpenGL", + "cacheVariables": { + "OpenGL_GL_PREFERENCE": { + "type": "string", + "value": "LEGACY" + } + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "glvnd", + "hidden": true, + "displayName": "GLVND", + "cacheVariables": { + "OpenGL_GL_PREFERENCE": { + "type": "string", + "value": "GLVND" + } + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-enabled-glvnd-debug", + "inherits": [ + "pie-enabled", + "glvnd", + "debug" + ], + "displayName": "PIE Enabled, GLVND, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-enabled-glvnd-release", + "inherits": [ + "pie-enabled", + "glvnd", + "release" + ], + "displayName": "PIE Enabled, GLVND, Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-enabled-legacy-gl-debug", + "inherits": [ + "pie-enabled", + "legacy-gl", + "debug" + ], + "displayName": "PIE Enabled, Legacy OpenGL, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-enabled-legacy-gl-release", + "inherits": [ + "pie-enabled", + "legacy-gl", + "release" + ], + "displayName": "PIE Enabled, Legacy OpenGL, Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-disabled-glvnd-debug", + "inherits": [ + "pie-disabled", + "glvnd", + "debug" + ], + "displayName": "PIE Disabled, GLVND, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-disabled-glvnd-release", + "inherits": [ + "pie-disabled", + "glvnd", + "release" + ], + "displayName": "PIE Disabled, GLVND, Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-disabled-legacy-gl-debug", + "inherits": [ + "pie-disabled", + "legacy-gl", + "debug" + ], + "displayName": "PIE Disabled, Legacy OpenGL, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-disabled-legacy-gl-release", + "inherits": [ + "pie-disabled", + "legacy-gl", + "release" + ], + "displayName": "PIE Disabled, Legacy OpenGL, Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "macos-default", + "hidden": true, + "inherits": "default", + "displayName": "macOS Default", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "macos-pie-enabled-debug", + "inherits": [ + "macos-default", + "pie-enabled", + "debug" + ], + "displayName": "macOS, PIE Enabled, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "macos-pie-enabled-release", + "inherits": [ + "macos-default", + "pie-enabled", + "release" + ], + "displayName": "macOS, PIE Enabled, Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "macos-pie-disabled-debug", + "inherits": [ + "macos-default", + "pie-disabled", + "debug" + ], + "displayName": "macOS, PIE Disabled, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "macos-pie-disabled-release", + "inherits": [ + "macos-default", + "pie-disabled", + "release" + ], + "displayName": "macOS, Pie Enabled, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "windows-default", + "hidden": true, + "inherits": "default", + "displayName": "Windows Default", + "description": "Default build for Windows", + "environment": { + "VCPKG_DEFAULT_TRIPLET": "x64-windows", + "VCPKG_DEFAULT_HOST_TRIPLET": "x64-windows", + "VCPKG_TARGET_TRIPLET": "x64-windows", + "VCPKG_HOST_TRIPLET": "x64-windows" + }, + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "debug": { + "output": true, + "find": true + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2019Win64", + "hidden": true, + "inherits": "windows-default", + "displayName": "Visual Studio 2019 on Windows x64", + "generator": "Visual Studio 16 2019", + "architecture": "X64", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2022Win64", + "hidden": true, + "inherits": "windows-default", + "displayName": "Visual Studio 2022 on Windows x64", + "generator": "Visual Studio 17 2022", + "architecture": "X64", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "ninja-windows", + "hidden": true, + "inherits": "windows-default", + "displayName": "Ninja on Windows", + "generator": "Ninja", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "windows-ninja-pie-enabled-debug", + "displayName": "Windows, Ninja, PIE Enabled, Debug", + "inherits": [ + "ninja-windows", + "pie-enabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "windows-ninja-pie-enabled-release", + "displayName": "Windows, Ninja, PIE Enabled, Release", + "inherits": [ + "ninja-windows", + "pie-enabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "windows-ninja-pie-disabled-debug", + "displayName": "Windows, Ninja, PIE Disabled, Debug", + "inherits": [ + "ninja-windows", + "pie-disabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "windows-ninja-pie-disabled-release", + "displayName": "Windows, Ninja, PIE Disabled, Release", + "inherits": [ + "ninja-windows", + "pie-disabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2019Win64-pie-enabled-debug", + "displayName": "VS2019Win64, PIE Enabled, Debug", + "inherits": [ + "VS2019Win64", + "pie-enabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2019Win64-pie-enabled-release", + "displayName": "VS2019Win64, PIE Enabled, Release", + "inherits": [ + "VS2019Win64", + "pie-enabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2019Win64-pie-disabled-debug", + "displayName": "VS2019Win64, PIE Disabled, Debug", + "inherits": [ + "VS2019Win64", + "pie-disabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2019Win64-pie-disabled-release", + "displayName": "VS2019Win64, PIE Disabled, Release", + "inherits": [ + "VS2019Win64", + "pie-disabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2022Win64-pie-enabled-debug", + "displayName": "VS2022Win64, PIE Enabled, Debug", + "inherits": [ + "VS2022Win64", + "pie-enabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2022Win64-pie-enabled-release", + "displayName": "VS2022Win64, PIE Enabled, Release", + "inherits": [ + "VS2022Win64", + "pie-enabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2022Win64-pie-disabled-debug", + "displayName": "VS2022Win64, PIE Disabled, Debug", + "inherits": [ + "VS2022Win64", + "pie-disabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2022Win64-pie-disabled-release", + "displayName": "VS2022Win64, PIE Disabled, Release", + "inherits": [ + "VS2022Win64", + "pie-disabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + } + ], + "buildPresets": [ + { + "name": "build-linux-pie-enabled-glvnd-debug", + "configurePreset": "linux-pie-enabled-glvnd-debug", + "displayName": "Linux, PIE Enabled, GLVND, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-enabled-glvnd-release", + "configurePreset": "linux-pie-enabled-glvnd-release", + "displayName": "Linux, PIE Enabled, GLVND, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-enabled-legacy-gl-debug", + "configurePreset": "linux-pie-enabled-legacy-gl-debug", + "displayName": "Linux, PIE Enabled, Legacy OpenGL, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-enabled-legacy-gl-release", + "configurePreset": "linux-pie-enabled-legacy-gl-release", + "displayName": "Linux, PIE Enabled, Legacy OpenGL, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-disabled-glvnd-debug", + "configurePreset": "linux-pie-disabled-glvnd-debug", + "displayName": "Linux, PIE Disabled, GLVND, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-disabled-glvnd-release", + "configurePreset": "linux-pie-disabled-glvnd-release", + "displayName": "Linux, PIE Disabled, GLVND, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-disabled-legacy-gl-debug", + "configurePreset": "linux-pie-disabled-legacy-gl-debug", + "displayName": "Linux, PIE Disabled, Legacy OpenGL, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-disabled-legacy-gl-release", + "configurePreset": "linux-pie-disabled-legacy-gl-release", + "displayName": "Linux, PIE Disabled, Legacy OpenGL, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-macos-pie-enabled-debug", + "configurePreset": "macos-pie-enabled-debug", + "displayName": "macOS, PIE Enabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "build-macos-pie-enabled-release", + "configurePreset": "macos-pie-enabled-release", + "displayName": "macOS, PIE Enabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "build-macos-pie-disabled-debug", + "configurePreset": "macos-pie-disabled-debug", + "displayName": "macOS, PIE Disabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "build-macos-pie-disabled-release", + "configurePreset": "macos-pie-disabled-release", + "displayName": "macOS, PIE Disabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "build-windows-ninja-pie-enabled-debug", + "configurePreset": "windows-ninja-pie-enabled-debug", + "displayName": "Windows, Ninja, PIE Enabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-windows-ninja-pie-enabled-release", + "configurePreset": "windows-ninja-pie-enabled-release", + "displayName": "Windows, Ninja, PIE Enabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-windows-ninja-pie-disabled-debug", + "configurePreset": "windows-ninja-pie-disabled-debug", + "displayName": "Windows, Ninja, PIE Disabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-windows-ninja-pie-disabled-release", + "configurePreset": "windows-ninja-pie-disabled-release", + "displayName": "Windows, Ninja, PIE Disabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2019Win64-pie-enabled-debug", + "configurePreset": "VS2019Win64-pie-enabled-debug", + "displayName": "VS2019Win64, PIE Enabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2019Win64-pie-enabled-release", + "configurePreset": "VS2019Win64-pie-enabled-release", + "displayName": "VS2019Win64, PIE Enabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2019Win64-pie-disabled-debug", + "configurePreset": "VS2019Win64-pie-disabled-debug", + "displayName": "VS2019Win64, PIE Disabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2019Win64-pie-disabled-release", + "configurePreset": "VS2019Win64-pie-disabled-release", + "displayName": "VS2019Win64, PIE Disabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2022Win64-pie-enabled-debug", + "configurePreset": "VS2022Win64-pie-enabled-debug", + "displayName": "VS2022Win64, PIE Enabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2022Win64-pie-enabled-release", + "configurePreset": "VS2022Win64-pie-enabled-release", + "displayName": "VS2022Win64, PIE Enabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2022Win64-pie-disabled-debug", + "configurePreset": "VS2022Win64-pie-disabled-debug", + "displayName": "VS2022Win64, PIE Disabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2022Win64-pie-disabled-release", + "configurePreset": "VS2022Win64-pie-disabled-release", + "displayName": "VS2022Win64, PIE Disabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + } + ] +} From d0a4c703b6a4ec804debfaae415ddc6f0fd70aa9 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 17 Jun 2023 20:17:28 -0700 Subject: [PATCH 11/31] Updates to 9 .cpp and .h files --- engine/src/cmd/ai/aggressive.cpp | 6 ++-- engine/src/cmd/ai/docking.cpp | 9 +++--- engine/src/cmd/ai/firekeyboard.cpp | 6 ++-- engine/src/cmd/ai/hard_coded_scripts.cpp | 9 +++--- engine/src/cmd/ai/pythonai.cpp | 1 + engine/src/cmd/ai/pythonai.h | 9 +++--- engine/src/cmd/base_init.cpp | 11 +++---- engine/src/cmd/base_interface.cpp | 7 +++-- engine/src/cmd/base_util.cpp | 39 ++++++++++++------------ 9 files changed, 49 insertions(+), 48 deletions(-) diff --git a/engine/src/cmd/ai/aggressive.cpp b/engine/src/cmd/ai/aggressive.cpp index 964d9a7b5e..cb99167a29 100644 --- a/engine/src/cmd/ai/aggressive.cpp +++ b/engine/src/cmd/ai/aggressive.cpp @@ -1,9 +1,8 @@ /* * aggressive.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -24,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include #include "aggressive.h" diff --git a/engine/src/cmd/ai/docking.cpp b/engine/src/cmd/ai/docking.cpp index de8e4e28b2..b3e57e1a10 100644 --- a/engine/src/cmd/ai/docking.cpp +++ b/engine/src/cmd/ai/docking.cpp @@ -1,10 +1,8 @@ -/** +/* * docking.cpp * - * Copyright (c) 2001-2002 Daniel Horn - * Copyright (c) 2002-2019 pyramid3d and other Vega Strike Contributors - * Copyright (c) 2019-2021 Stephen G. Tuggy, and other Vega Strike Contributors - * Copyright (C) 2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike Contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -25,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include "python/python_compile.h" #include "docking.h" #include "xml_support.h" diff --git a/engine/src/cmd/ai/firekeyboard.cpp b/engine/src/cmd/ai/firekeyboard.cpp index 776aaf1e35..9bc8f53991 100644 --- a/engine/src/cmd/ai/firekeyboard.cpp +++ b/engine/src/cmd/ai/firekeyboard.cpp @@ -1,9 +1,8 @@ /* * firekeyboard.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -27,6 +26,7 @@ /// Keyboard parsing /// Parses keyboard commands +#define PY_SSIZE_T_CLEAN #include #include "firekeyboard.h" #include "flybywire.h" diff --git a/engine/src/cmd/ai/hard_coded_scripts.cpp b/engine/src/cmd/ai/hard_coded_scripts.cpp index 3a7eeaac39..63522f83b4 100644 --- a/engine/src/cmd/ai/hard_coded_scripts.cpp +++ b/engine/src/cmd/ai/hard_coded_scripts.cpp @@ -1,10 +1,8 @@ -/** +/* * hard_coded_scripts.cpp * - * Copyright (c) 2001-2002 Daniel Horn - * Copyright (c) 2002-2019 pyramid3d and other Vega Strike Contributors - * Copyright (c) 2019-2021 Stephen G. Tuggy, and other Vega Strike Contributors - * Copyright (C) 2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike Contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -25,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include "python/python_class.h" #include "script.h" diff --git a/engine/src/cmd/ai/pythonai.cpp b/engine/src/cmd/ai/pythonai.cpp index 38ef8c3c47..e01dd3c0d6 100644 --- a/engine/src/cmd/ai/pythonai.cpp +++ b/engine/src/cmd/ai/pythonai.cpp @@ -23,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include diff --git a/engine/src/cmd/ai/pythonai.h b/engine/src/cmd/ai/pythonai.h index 52b5278dcd..f6aa221fe7 100644 --- a/engine/src/cmd/ai/pythonai.h +++ b/engine/src/cmd/ai/pythonai.h @@ -1,10 +1,8 @@ -/** +/* * pythonai.h * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike - * contributors - * Copyright (C) 2022-2023 Stephen G. Tuggy, Benjamen R. Meyer + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -25,6 +23,7 @@ */ // NO HEADER GUARD +#define PY_SSIZE_T_CLEAN #include #include "fire.h" #include diff --git a/engine/src/cmd/base_init.cpp b/engine/src/cmd/base_init.cpp index 909970c57a..d59285a932 100644 --- a/engine/src/cmd/base_init.cpp +++ b/engine/src/cmd/base_init.cpp @@ -1,10 +1,8 @@ -/** +/* * base_init.cpp * - * Copyright (c) 2001-2002 Daniel Horn - * Copyright (c) 2002-2019 pyramid3d and other Vega Strike Contributors - * Copyright (c) 2019-2021 Stephen G. Tuggy, and other Vega Strike Contributors - * Copyright (C) 2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -17,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -25,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include diff --git a/engine/src/cmd/base_interface.cpp b/engine/src/cmd/base_interface.cpp index 9b7607ddd9..5dbae4de99 100644 --- a/engine/src/cmd/base_interface.cpp +++ b/engine/src/cmd/base_interface.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * base_interface.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -21,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include #include diff --git a/engine/src/cmd/base_util.cpp b/engine/src/cmd/base_util.cpp index 067f6590a4..48cb71c007 100644 --- a/engine/src/cmd/base_util.cpp +++ b/engine/src/cmd/base_util.cpp @@ -1,9 +1,8 @@ /* * base_util.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -24,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include @@ -159,25 +159,26 @@ int Room(std::string text) { return BaseInterface::CurrentBase->rooms.size() - 1; } -void Texture(int room, std::string index, std::string file, float x, float y) { - BaseInterface::Room *newroom = CheckRoom(room); - if (!newroom) { - return; - } - newroom->objs.push_back(new BaseInterface::Room::BaseVSSprite(file.c_str(), index)); + void Texture(int room, std::string index, std::string file, float x, float y) { + VS_LOG_AND_FLUSH(debug, (boost::format("BaseUtil::Texture called. room: %1%; index: '%2%'; file: '%3%'; x: %4%; y: %5%") % room % index % file % x % y)); + BaseInterface::Room *newroom = CheckRoom(room); + if (!newroom) { + return; + } + newroom->objs.push_back(new BaseInterface::Room::BaseVSSprite(file, index)); + BaseInterface::Room::BaseVSSprite + *p_base_vs_sprite = vega_dynamic_cast_ptr( newroom->objs.back()); #ifdef BASE_MAKER - ( (BaseInterface::Room::BaseVSSprite*) newroom->objs.back() )->texfile = file; + p_base_vs_sprite->texfile = file; #endif - float tx = 0, ty = 0; - static bool - addspritepos = XMLSupport::parse_bool(vs_config->getVariable("graphics", "offset_sprites_by_pos", "true")); - if (addspritepos) { - ((BaseInterface::Room::BaseVSSprite *) newroom->objs.back())->spr.GetPosition(tx, ty); + float tx = 0, ty = 0; + static bool + addspritepos = XMLSupport::parse_bool(vs_config->getVariable("graphics", "offset_sprites_by_pos", "true")); + if (addspritepos) { + p_base_vs_sprite->spr.GetPosition(tx, ty); + } + p_base_vs_sprite->spr.SetPosition(x + tx, y + ty); } - BaseInterface::Room::BaseVSSprite - *p_base_vs_sprite = vega_dynamic_cast_ptr( newroom->objs.back()); - p_base_vs_sprite->spr.SetPosition(x + tx, y + ty); -} SharedPtr CreateVideoSoundStream(const std::string &afile, const std::string &scene) { SharedPtr sound = SceneManager::getSingleton()->getRenderer()->getSound( From 7efdac1097b21493a2bba69dccec900c04cb5f20 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sun, 18 Jun 2023 16:18:46 -0700 Subject: [PATCH 12/31] vcpkg.json: updates --- engine/vcpkg.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/engine/vcpkg.json b/engine/vcpkg.json index 3d66e9e900..2a5c5a6f49 100644 --- a/engine/vcpkg.json +++ b/engine/vcpkg.json @@ -2,7 +2,6 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", "name": "vega-strike", "version-string": "0.9.0", - "builtin-baseline": "b25cb779e5783531cc66562e224079b376055939", "dependencies": [ "boost-python", "boost-log", @@ -22,10 +21,7 @@ "openal-soft", "opengl", "opengl-registry", - { - "name": "openssl", - "version>=": "1.1.1m" - }, + "openssl", "sdl1", "zlib" ] From b2c873d7c3230923c3016936c24086b396bf759c Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sun, 18 Jun 2023 16:19:35 -0700 Subject: [PATCH 13/31] Update bootstrap.ps1 and build.ps1; add test.ps1 --- script/bootstrap.ps1 | 35 ++++++++++++++++++-------- script/build.ps1 | 57 +++++++++++++++++++++++++++++++++++------ script/test.ps1 | 60 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+), 18 deletions(-) create mode 100644 script/test.ps1 diff --git a/script/bootstrap.ps1 b/script/bootstrap.ps1 index 3e66c4ae51..fa4118bd88 100644 --- a/script/bootstrap.ps1 +++ b/script/bootstrap.ps1 @@ -1,4 +1,6 @@ -# Copyright (C) 2021 Stephen G. Tuggy +# bootstrap.ps1 + +# Copyright (C) 2021-2023 Stephen G. Tuggy and other Vega Strike contributors # https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -17,25 +19,36 @@ # You should have received a copy of the GNU General Public License # along with Vega Strike. If not, see . + # You can customize this directory location if desired, but it should be # something very short. Otherwise, you will run into problems. -Set-Variable -Name VCKPG_PARENT_DIR -Value "C:\Projects" -Set-Variable -Name CMAKE_VERSION -Value "3.21.1" +param( + [String]$VCPKG_PARENT_DIR = "C:\Projects" +) + +Set-Variable -Name CMAKE_VERSION -Value "3.25.1" New-Item "$VCKPG_PARENT_DIR" -ItemType Directory -Force Push-Location "$VCKPG_PARENT_DIR" -git clone https://github.com/Microsoft/vcpkg.git -.\vcpkg\bootstrap-vcpkg.bat -disableMetrics +git clone https://github.com/stephengtuggy/vcpkg-local.git ./v +.\v\bootstrap-vcpkg.bat -disableMetrics -[Environment]::SetEnvironmentVariable('VCPKG_ROOT', "$VCKPG_PARENT_DIR\vcpkg", 'User') +[Environment]::SetEnvironmentVariable('VCPKG_ROOT', "$VCKPG_PARENT_DIR\v", 'User') +$env:VCPKG_ROOT = "$VCKPG_PARENT_DIR\v" $path = [Environment]::GetEnvironmentVariable('PATH', 'User') -$newPath = $path + ";$VCKPG_PARENT_DIR\vcpkg\downloads\tools\cmake-$CMAKE_VERSION-windows\cmake-$CMAKE_VERSION-windows-i386\bin" +$newPath = $path + ";$VCKPG_PARENT_DIR\v\downloads\tools\cmake-$CMAKE_VERSION-windows\cmake-$CMAKE_VERSION-windows-i386\bin" [Environment]::SetEnvironmentVariable('PATH', $newPath, 'User') +$env:PATH = $newPath -[Environment]::SetEnvironmentVariable('VCPKG_DEFAULT_TRIPLET', 'x64-windows', 'User') -[Environment]::SetEnvironmentVariable('PYTHONHOME', "$VCKPG_PARENT_DIR\vcpkg\packages\python3_x64-windows\tools\python3", 'User') +$triplet = 'x64-windows' +[Environment]::SetEnvironmentVariable('VCPKG_DEFAULT_TRIPLET', $triplet, 'User') +$env:VCPKG_DEFAULT_TRIPLET = $triplet +[Environment]::SetEnvironmentVariable('VCPKG_DEFAULT_HOST_TRIPLET', $triplet, 'User') +$env:VCPKG_DEFAULT_HOST_TRIPLET = $triplet -Pop-Location +$pythonHome = "$VCKPG_PARENT_DIR\v\packages\python3_x64-windows\tools\python3" +[Environment]::SetEnvironmentVariable('PYTHONHOME', $pythonHome, 'User') +$env:PYTHONHOME = $pythonHome -. refreshenv +Pop-Location diff --git a/script/build.ps1 b/script/build.ps1 index 28fa4ad8c4..b4515adca4 100644 --- a/script/build.ps1 +++ b/script/build.ps1 @@ -1,4 +1,6 @@ -# Copyright (C) 2021 Stephen G. Tuggy +# build.ps1 + +# Copyright (C) 2021-2023 Stephen G. Tuggy and other Vega Strike contributors # https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -17,10 +19,51 @@ # You should have received a copy of the GNU General Public License # along with Vega Strike. If not, see . -cmake -B build -S .\engine\ -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" -DCMAKE_BUILD_TYPE=Release -cmake --build .\build\ --config Release -v + +param( + [String]$Generator = "VS2019Win64", # Other options include "ninja" and "VS2022Win64" + [Boolean]$EnablePIE = $false, + [String]$BuildType = "Release" # You can also specify "Debug" +) + +[String]$cmakePresetName = "" +if ($Generator -ieq "Ninja") { + $cmakePresetName += "windows-ninja" +} elseif ($Generator -ieq "VS2019Win64") { + $cmakePresetName += "VS2019Win64" +} elseif ($Generator -ieq "VS2022Win64") { + $cmakePresetName += "VS2022Win64" +} else { + Write-Error "Invalid value for Generator: $Generator" + exit 1 +} +$cmakePresetName += "-" +if ($EnablePIE) { + $cmakePresetName += "pie-enabled" +} else { + $cmakePresetName += "pie-disabled" +} +$cmakePresetName += "-" +if ($BuildType -ieq "Debug") { + $cmakePresetName += "debug" +} elseif ($BuildType -ieq "Release") { + $cmakePresetName += "release" +} else { + Write-Error "Unrecognized value for BuildType: $BuildType" + exit 1 +} + +[String]$baseDir = (Get-Location -PSProvider "FileSystem").Path +[String]$binaryDir = "$baseDir\build\$cmakePresetName" +Push-Location $baseDir\engine +cmake --preset $cmakePresetName +cmake --build --preset "build-$cmakePresetName" -v +Pop-Location + New-Item bin -ItemType Directory -Force -xcopy /y .\build\Release\*.* .\bin\ -xcopy /y .\build\objconv\Release\*.* .\bin\ -# Not building vegasettings for the moment -# xcopy /y .\build\setup\Release\*.* .\bin\ +$aPossibleBinaryDirs = @("$binaryDir","$binaryDir\$BuildType", "$binaryDir\$BuildType\objconv", "$binaryDir\objconv\$BuildType", "$binaryDir\$BuildType\setup", "$binaryDir\setup\$BuildType") +$aPossibleBinaryDirs | ForEach-Object { + if (Test-Path $_) { + Copy-Item -Force -Verbose $_\*.* .\bin + } +} diff --git a/script/test.ps1 b/script/test.ps1 new file mode 100644 index 0000000000..e977c3157a --- /dev/null +++ b/script/test.ps1 @@ -0,0 +1,60 @@ +# test.ps1 + +# Copyright (C) 2023 Stephen G. Tuggy and other Vega Strike contributors + +# https://github.com/vegastrike/Vega-Strike-Engine-Source + +# This file is part of Vega Strike. + +# Vega Strike 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. + +# Vega Strike 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 Vega Strike. If not, see . + + +param( + [String]$Generator = "VS2019Win64", # Other options include "ninja" and "VS2022Win64" + [Boolean]$EnablePIE = $false, + [String]$BuildType = "Release" # You can also specify "Debug" +) + +[String]$cmakePresetName = "" +if ($Generator -ieq "Ninja") { + $cmakePresetName += "windows-ninja" +} elseif ($Generator -ieq "VS2019Win64") { + $cmakePresetName += "VS2019Win64" +} elseif ($Generator -ieq "VS2022Win64") { + $cmakePresetName += "VS2022Win64" +} else { + Write-Error "Invalid value for Generator: $Generator" + exit 1 +} +$cmakePresetName += "-" +if ($EnablePIE) { + $cmakePresetName += "pie-enabled" +} else { + $cmakePresetName += "pie-disabled" +} +$cmakePresetName += "-" +if ($BuildType -ieq "Debug") { + $cmakePresetName += "debug" +} elseif ($BuildType -ieq "Release") { + $cmakePresetName += "release" +} else { + Write-Error "Unrecognized value for BuildType: $BuildType" + exit 1 +} + +[String]$baseDir = (Get-Location -PSProvider "FileSystem").Path +[String]$binaryDir = "$baseDir\build\$cmakePresetName" +Push-Location $binaryDir +ctest -V -C $BuildType +Pop-Location From 7a9a4239c7b6c409a2116d6e5a7ebcb646bbb4ba Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sun, 18 Jun 2023 17:27:40 -0700 Subject: [PATCH 14/31] 32 .cpp and .h files: various updates --- engine/src/cmd/base_util.h | 11 +- engine/src/cmd/base_xml.cpp | 6 +- engine/src/cmd/collide_map.cpp | 47 +- engine/src/cmd/collide_map.h | 34 +- engine/src/cmd/engineVersion.cpp | 5 +- engine/src/cmd/intelligent.cpp | 7 +- engine/src/gfx/cockpit.cpp | 6 +- engine/src/gfx/tvector.cpp | 6 +- engine/src/gfx/vsimage.cpp | 5 +- engine/src/gfx/vsimage.h | 9 +- engine/src/gfxlib_struct.h | 21 +- engine/src/gldrv/gl_texture.cpp | 6 +- engine/src/gldrv/gl_vertex_list.cpp | 4 +- engine/src/load_mission.cpp | 5 +- engine/src/main.cpp | 5 +- engine/src/python/briefing_wrapper.cpp | 5 +- engine/src/python/init.cpp | 1 + engine/src/python/init.h | 8 +- engine/src/python/python_class.h | 2 + engine/src/python/python_compile.cpp | 1 + engine/src/python/python_compile.h | 8 +- engine/src/python/unit_exports.cpp | 5 +- engine/src/python/unit_exports.h | 7 +- engine/src/python/unit_from_to_python.h | 7 +- engine/src/python/unit_method_defs.cpp | 5 +- engine/src/python/unit_wrapper.cpp | 5 +- engine/src/python/unit_wrapper_class.h | 62 +- engine/src/python/universe_util_export.cpp | 7 +- engine/src/savegame.cpp | 97 +- engine/src/star_system.cpp | 5 +- engine/src/universe_util_generic.cpp | 1515 ++++++++++---------- engine/src/vega_py_run.cpp | 11 +- 32 files changed, 998 insertions(+), 930 deletions(-) diff --git a/engine/src/cmd/base_util.h b/engine/src/cmd/base_util.h index 0eb1a70fd3..a3cbd31e14 100644 --- a/engine/src/cmd/base_util.h +++ b/engine/src/cmd/base_util.h @@ -1,10 +1,8 @@ -/** +/* * base_util.h * - * Copyright (c) 2001-2002 Daniel Horn - * Copyright (c) 2002-2019 pyramid3d and other Vega Strike Contributors - * Copyright (c) 2019-2021 Stephen G. Tuggy, and other Vega Strike Contributors - * Copyright (C) 2022-2023 Stephen G. Tuggy, Benjamen R. Meyer + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike Contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -23,9 +21,12 @@ * You should have received a copy of the GNU General Public License * along with Vega Strike. If not, see . */ + + #ifndef VEGA_STRIKE_ENGINE_CMD_BASE_UTIL_H #define VEGA_STRIKE_ENGINE_CMD_BASE_UTIL_H +#define PY_SSIZE_T_CLEAN #include #include #if BOOST_VERSION != 102800 diff --git a/engine/src/cmd/base_xml.cpp b/engine/src/cmd/base_xml.cpp index 92385ce1fd..94cff98f96 100644 --- a/engine/src/cmd/base_xml.cpp +++ b/engine/src/cmd/base_xml.cpp @@ -1,9 +1,8 @@ /* * base_xml.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -24,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #if BOOST_VERSION != 102800 #include diff --git a/engine/src/cmd/collide_map.cpp b/engine/src/cmd/collide_map.cpp index 2cef6f7538..5dcbcbb3d2 100644 --- a/engine/src/cmd/collide_map.cpp +++ b/engine/src/cmd/collide_map.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * collide_map.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -22,7 +24,8 @@ #include -#include +#include +#include "vega_cast_utils.h" #include "collide_map.h" #include "unit_generic.h" #include "bolt.h" @@ -36,27 +39,23 @@ void CollideArray::erase(iterator target) { count -= 1; if (target >= this->begin() && target < this->end()) { target->radius = 0; - target->ref.unit = NULL; + target->ref.unit = nullptr; size_t diff = (target - this->begin()); if (this->unsorted.size() > diff) { //for secondary collide arrays that have no unsorted array iterator tmp = &*(this->unsorted.begin() + diff); tmp->radius = 0; - tmp->ref.unit = NULL; + tmp->ref.unit = nullptr; } return; - } else if (target == NULL) { + } else if (target == nullptr) { return; } else { - CollidableBackref *targ = static_cast< CollidableBackref * > (&*target); - std::list *targlist = &toflattenhints[targ->toflattenhints_offset]; - std::list::iterator endlist = targlist->end(); - for (std::list::iterator i = targlist->begin(); i != endlist; ++i) { - if (&*i == target) { - targlist->erase(i); - return; - } - } + CollidableBackref *targ = vega_dynamic_cast_ptr(&*target); + std::list *targlist = &toflattenhints.at(targ->toflattenhints_offset); + auto first_to_remove = std::stable_partition(targlist->begin(), targlist->end(), [target](CollidableBackref &backref) { return &*backref != target; }); +// std::for_each(first_to_remove, targlist->end(), [](CollidableBackref &backref) { delete backref; }); + targlist->erase(first_to_remove, targlist->end()); } } @@ -97,12 +96,12 @@ class RadiusUpdate { double last_big_radius_key; CollideArray *cm; public: - RadiusUpdate(CollideArray *cm) { + explicit RadiusUpdate(CollideArray *cm_) { last_radius = 0; last_big_radius = 0; last_radius_key = 0; last_big_radius_key = 0; - this->cm = cm; + cm = cm_; } void operator()(const Collidable &collidable, size_t index) { @@ -161,8 +160,8 @@ void CollideArray::flatten() { collideUpdate(*tmp, index); } - std::list::iterator listend = toflattenhints[i].end(); - for (std::list::iterator j = toflattenhints[i].begin(); + auto listend = toflattenhints[i].end(); + for (auto j = toflattenhints[i].begin(); j != listend; ++j) { if (j->radius != 0) { @@ -180,7 +179,7 @@ void CollideArray::flatten() { if (location_index == Unit::UNIT_BOLT) { size_t i = 0; size_t size = sorted.size(); - ResizableArray::iterator iter = sorted.begin(); + auto iter = sorted.begin(); UpdateBackpointers update; RadiusUpdate<1, false> radUpdate(this); for (i = 0; i != size; ++i, ++iter) { @@ -339,7 +338,7 @@ class CollideChecker { break; } } else if (rad != 0) { - if (canbebolt == true && BoltType(un)) { + if (canbebolt && BoltType(un)) { CollideMap::iterator tmptmore = ref.unit->location[Unit::UNIT_ONLY]; CollideMap::iterator tmptless = tmptmore; ++tmptmore; @@ -369,7 +368,7 @@ class CollideChecker { } } } else if (rad != 0) { - if (canbebolt == true && BoltType(un)) { + if (canbebolt && BoltType(un)) { CollideMap::iterator tmptmore = ref.unit->location[Unit::UNIT_ONLY]; CollideMap::iterator tmptless = tmptmore; ++tmptmore; @@ -402,7 +401,7 @@ class CollideChecker { } } else if (rad != 0) { //not null unit - if (canbebolt == true && BoltType(un)) { + if (canbebolt && BoltType(un)) { CollideMap::iterator tmptmore = ref.unit->location[Unit::UNIT_ONLY]; CollideMap::iterator tmptless = tmptmore; ++tmptmore; @@ -585,7 +584,7 @@ bool CollideMap::CheckUnitCollisions(Bolt *bol, const Collidable &updated) { bool CollideMap::CheckCollisions(Unit *un, const Collidable &updated) { //need to check beams - if (un->activeStarSystem == NULL) { + if (un->activeStarSystem == nullptr) { un->activeStarSystem = _Universe->activeStarSystem(); } else assert(un->activeStarSystem == _Universe->activeStarSystem()); @@ -594,7 +593,7 @@ bool CollideMap::CheckCollisions(Unit *un, const Collidable &updated) { bool CollideMap::CheckUnitCollisions(Unit *un, const Collidable &updated) { //need to check beams - if (un->activeStarSystem == NULL) { + if (un->activeStarSystem == nullptr) { un->activeStarSystem = _Universe->activeStarSystem(); } else assert(un->activeStarSystem == _Universe->activeStarSystem()); diff --git a/engine/src/cmd/collide_map.h b/engine/src/cmd/collide_map.h index 7f51850890..db74b864da 100644 --- a/engine/src/cmd/collide_map.h +++ b/engine/src/cmd/collide_map.h @@ -1,10 +1,8 @@ -/** +/* * collide_map.h * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike - * contributors - * Copyright (C) 2022-2023 Stephen G. Tuggy, Benjamen R. Meyer + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -45,7 +43,7 @@ class Collidable { Unit *unit; unsigned int bolt_index; } - ref; + ref{}; QVector GetPosition() const { return position; @@ -94,7 +92,7 @@ class Collidable { ) { } - Collidable(Unit *un); + explicit Collidable(Unit *un); Collidable(unsigned int bolt_index, float speed, const QVector &p) { ref.bolt_index = bolt_index; @@ -110,6 +108,8 @@ class Collidable { } this->SetPosition(p); } + + virtual ~Collidable() = default; }; class CollideArray { @@ -121,12 +121,12 @@ class CollideArray { class CollidableBackref : public Collidable { public: - size_t toflattenhints_offset; + size_t toflattenhints_offset{}; CollidableBackref() : Collidable() { } - CollidableBackref(Unit *un) : Collidable(un) { + explicit CollidableBackref(Unit *un) : Collidable(un) { } CollidableBackref(unsigned int bolt_index, float speed, const QVector &p) : Collidable(bolt_index, speed, p) { @@ -135,6 +135,8 @@ class CollideArray { CollidableBackref(const Collidable &b, size_t offset) : Collidable(b) { toflattenhints_offset = offset; } + + ~CollidableBackref() override = default; }; void SetLocationIndex(unsigned int li) { @@ -157,7 +159,7 @@ class CollideArray { iterator changeKey(iterator iter, const Collidable &newKey, iterator tless, iterator tmore); iterator begin() { - return sorted.size() != 0 ? &*sorted.begin() : NULL; + return !sorted.empty() ? &*sorted.begin() : nullptr; } iterator end() { @@ -168,9 +170,11 @@ class CollideArray { void erase(iterator iter); void checkSet(); - CollideArray(unsigned int location_index) : toflattenhints(1), count(0) { + explicit CollideArray(unsigned int location_index) : toflattenhints(1), count(0) { this->location_index = location_index; } + + // TODO: Add virtual destructor? }; #ifdef VS_ENABLE_COLLIDE_KEY @@ -185,7 +189,7 @@ class CollideMap : public CollideArray { #endif #endif public: - CollideMap(unsigned int location_offset) : CollideArray(location_offset) { + explicit CollideMap(unsigned int location_offset) : CollideArray(location_offset) { } //Check collisions takes an item to check collisions with, and returns whether that item collided with a Unit only @@ -195,6 +199,8 @@ class CollideMap : public CollideArray { bool CheckCollisions(Unit *un, const Collidable &updated); //will be handed off to a templated function bool CheckUnitCollisions(Unit *un, const Collidable &updated); //DANGER must be used on lists that are only populated with Units, not bolts + + // TODO: Add virtual destructor? }; #if defined (VS_ENABLE_COLLIDE_LIST) || defined (VS_ENABLE_COLLIDE_KEY) @@ -227,11 +233,11 @@ inline void init_null_collide_iter() { } inline bool is_null(const CollideMap::iterator &it) { - return it == NULL; + return it == nullptr; } inline void set_null(CollideMap::iterator &it) { - it = NULL; + it = nullptr; } #endif diff --git a/engine/src/cmd/engineVersion.cpp b/engine/src/cmd/engineVersion.cpp index 98854f5f2f..4b8e52df18 100644 --- a/engine/src/cmd/engineVersion.cpp +++ b/engine/src/cmd/engineVersion.cpp @@ -1,8 +1,8 @@ /* * engineVersion.cpp * - * Copyright (C) 2021 Benjamen Meyer - * Copyright (C) 2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, Benjamen R. Meyer, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -23,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN //#include #include diff --git a/engine/src/cmd/intelligent.cpp b/engine/src/cmd/intelligent.cpp index 0807f45966..dd4840db73 100644 --- a/engine/src/cmd/intelligent.cpp +++ b/engine/src/cmd/intelligent.cpp @@ -1,8 +1,8 @@ -/** +/* * intelligent.cpp * - * Copyright (C) 2020 Roy Falk - * Copyright (C) 2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, Roy Falk, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -27,6 +27,7 @@ * ships, space installations, missiles, drones, etc. */ +#define PY_SSIZE_T_CLEAN #include "intelligent.h" #include "ai/order.h" diff --git a/engine/src/gfx/cockpit.cpp b/engine/src/gfx/cockpit.cpp index a8205c6ccd..bf69f50d01 100644 --- a/engine/src/gfx/cockpit.cpp +++ b/engine/src/gfx/cockpit.cpp @@ -3,9 +3,8 @@ /* * cockpit.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -29,6 +28,7 @@ /// Draws cockpit parts /// Draws gauges, info strings, radar, ... +#define PY_SSIZE_T_CLEAN #include #if BOOST_VERSION != 102800 #include diff --git a/engine/src/gfx/tvector.cpp b/engine/src/gfx/tvector.cpp index d7fb725b63..ec3f0ee019 100644 --- a/engine/src/gfx/tvector.cpp +++ b/engine/src/gfx/tvector.cpp @@ -1,9 +1,8 @@ /* * tvector.cpp * - * Copyright (C) 2020-2021 Roy Falk, Nachum Barcohen, Stephen G. Tuggy, - * Davie Wales, and other Vega Strike contributors - * Copyright (C) 2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, Roy Falk, Nachum Barcohen, + * Stephen G. Tuggy, Davie Wales, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -24,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include "tvector.h" #include "matrix.h" diff --git a/engine/src/gfx/vsimage.cpp b/engine/src/gfx/vsimage.cpp index 082dbe8f90..af9baa1090 100644 --- a/engine/src/gfx/vsimage.cpp +++ b/engine/src/gfx/vsimage.cpp @@ -1,9 +1,8 @@ /* * vsimage.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * diff --git a/engine/src/gfx/vsimage.h b/engine/src/gfx/vsimage.h index e4f191beaa..4f5df66b75 100644 --- a/engine/src/gfx/vsimage.h +++ b/engine/src/gfx/vsimage.h @@ -1,9 +1,8 @@ -/** +/* * vsimage.h * - * Copyright (C) 2020 pyramid3d, Roy Falk, Stephen G. Tuggy, - * and other Vega Strike contributors - * Copyright (C) 2022-2023 Stephen G. Tuggy, Benjamen R. Meyer + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Roy Falk, Benjamen R. Meyer, + * Stephen G. Tuggy, and other Vega Strike contributors * * This file is part of Vega Strike. * @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License * along with Vega Strike. If not, see . */ + + #ifndef VEGA_STRIKE_ENGINE_GFX_VSIMAGE_H #define VEGA_STRIKE_ENGINE_GFX_VSIMAGE_H diff --git a/engine/src/gfxlib_struct.h b/engine/src/gfxlib_struct.h index 1c305e8a08..17cdf5908e 100644 --- a/engine/src/gfxlib_struct.h +++ b/engine/src/gfxlib_struct.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * gfxlib_struct.h + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -19,6 +21,7 @@ * You should have received a copy of the GNU General Public License * along with Vega Strike. If not, see . */ + #ifndef VEGA_STRIKE_ENGINE_GFXLIB_STRUCT_H #define VEGA_STRIKE_ENGINE_GFXLIB_STRUCT_H @@ -1031,22 +1034,22 @@ class /*GFXDRVAPI*/ GFXSphereVertexList : public GFXVertexList { protected: float radius; GFXVertexList *sphere; - virtual void Draw(enum POLYTYPE *poly, const INDEX index, const int numLists, const int *offsets); + void Draw(enum POLYTYPE *poly, const INDEX index, const int numLists, const int *offsets) override; public: ///creates a vertex list with 1 polytype and a given number of vertices GFXSphereVertexList(float radius, int detail, bool insideout, bool reverse_normals); - ~GFXSphereVertexList(); + ~GFXSphereVertexList() override; ///Returns the array of vertices to be mutated - virtual VDAT *BeginMutate(int offset); + VDAT *BeginMutate(int offset) override; ///Ends mutation and refreshes display list - virtual void EndMutate(int newsize = 0); + void EndMutate(int newsize = 0) override; ///Loads the draw state (what is active) of a given vlist for mass drawing ///Specifies array pointers and loads the draw state of a given vlist for mass drawing - virtual void BeginDrawState(GFXBOOL lock = GFXTRUE); + void BeginDrawState(GFXBOOL lock = GFXTRUE) override; ///Draws a single copy of the mass-loaded vlist - virtual void Draw(); - virtual void EndDrawState(GFXBOOL lock = GFXTRUE); + void Draw() override; + void EndDrawState(GFXBOOL lock = GFXTRUE) override; ///returns a packed vertex list with number of polys and number of tries to passed in arguments. Useful for getting vertex info from a mesh virtual void GetPolys(GFXVertex **vert, int *numPolys, int *numTris); ///generates procedural planetdata to the actual detaillevel with the "plasma method" diff --git a/engine/src/gldrv/gl_texture.cpp b/engine/src/gldrv/gl_texture.cpp index cc0a29e899..fec050b630 100644 --- a/engine/src/gldrv/gl_texture.cpp +++ b/engine/src/gldrv/gl_texture.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * gl_texture.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -768,7 +770,7 @@ GFXBOOL /*GFXDRVAPI*/ GFXTransferTexture(unsigned char *buffer, if (maxdimension == 65536) { maxdimension = gl_options.max_texture_dimension; } - VS_LOG(trace, + VS_LOG(debug, (boost::format( "Transferring %1%x%2% texture, page %3% (eff: %4%x%5% - limited at %6% - %7% mips), onto name %8% (%9%)") % textures[handle].iwidth diff --git a/engine/src/gldrv/gl_vertex_list.cpp b/engine/src/gldrv/gl_vertex_list.cpp index 0344e51e14..c8b7ce00d9 100644 --- a/engine/src/gldrv/gl_vertex_list.cpp +++ b/engine/src/gldrv/gl_vertex_list.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, Alan Shieh, pyramid3d, + * gl_vertex_list.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, Alan Shieh, pyramid3d, * Stephen G. Tuggy, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source diff --git a/engine/src/load_mission.cpp b/engine/src/load_mission.cpp index a509302c2d..0a115ff71d 100644 --- a/engine/src/load_mission.cpp +++ b/engine/src/load_mission.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * load_mission.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -21,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include "configxml.h" #include "cmd/script/mission.h" #include "cmd/script/pythonmission.h" diff --git a/engine/src/main.cpp b/engine/src/main.cpp index 67ce422f37..385aa0b356 100644 --- a/engine/src/main.cpp +++ b/engine/src/main.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * main.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -21,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include "audio/test.h" #if defined (HAVE_SDL) diff --git a/engine/src/python/briefing_wrapper.cpp b/engine/src/python/briefing_wrapper.cpp index 651591a559..8648ea4a1d 100644 --- a/engine/src/python/briefing_wrapper.cpp +++ b/engine/src/python/briefing_wrapper.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * briefing_wrapper.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -21,6 +23,7 @@ */ #ifndef PYTHON_STUB +#define PY_SSIZE_T_CLEAN #include #include "python_class.h" #include "cmd/briefing.h" diff --git a/engine/src/python/init.cpp b/engine/src/python/init.cpp index cbd9418ed8..1f8965406b 100644 --- a/engine/src/python/init.cpp +++ b/engine/src/python/init.cpp @@ -24,6 +24,7 @@ #ifdef HAVE_PYTHON +#define PY_SSIZE_T_CLEAN #include #if defined (_MSC_VER) && _MSC_VER <= 1200 #define Vector Vactor diff --git a/engine/src/python/init.h b/engine/src/python/init.h index 4c1cc705bc..0704c13e82 100644 --- a/engine/src/python/init.h +++ b/engine/src/python/init.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * init.h + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -19,11 +21,13 @@ * You should have received a copy of the GNU General Public License * along with Vega Strike. If not, see . */ + #ifdef HAVE_PYTHON #ifndef VEGA_STRIKE_ENGINE_PYTHON_INIT_H #define VEGA_STRIKE_ENGINE_PYTHON_INIT_H +#define PY_SSIZE_T_CLEAN #include "gfx/vec.h" #include diff --git a/engine/src/python/python_class.h b/engine/src/python/python_class.h index a43fa7e052..cba2e28059 100644 --- a/engine/src/python/python_class.h +++ b/engine/src/python/python_class.h @@ -21,9 +21,11 @@ * You should have received a copy of the GNU General Public License * along with Vega Strike. If not, see . */ + #ifndef VEGA_STRIKE_ENGINE_PYTHON_PYTHON_CLASS_H #define VEGA_STRIKE_ENGINE_PYTHON_PYTHON_CLASS_H +#define PY_SSIZE_T_CLEAN //This takes care of the fact that several systems use the _POSIX_C_SOURCES //variable and don't set them to the same thing. //Python.h sets and uses it diff --git a/engine/src/python/python_compile.cpp b/engine/src/python/python_compile.cpp index db49c67b0a..14db6c8acc 100644 --- a/engine/src/python/python_compile.cpp +++ b/engine/src/python/python_compile.cpp @@ -23,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include "cmd/unit_generic.h" #include "python_compile.h" #include diff --git a/engine/src/python/python_compile.h b/engine/src/python/python_compile.h index 2da803aadf..afb34cbf17 100644 --- a/engine/src/python/python_compile.h +++ b/engine/src/python/python_compile.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * python_compile.h + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -19,8 +21,10 @@ * You should have received a copy of the GNU General Public License * along with Vega Strike. If not, see . */ + #ifndef VEGA_STRIKE_ENGINE_PYTHON_PYTHON_COMPILE_H #define VEGA_STRIKE_ENGINE_PYTHON_PYTHON_COMPILE_H +#define PY_SSIZE_T_CLEAN //Resets variable for use by python config.h #ifdef _POSIX_C_SOURCE diff --git a/engine/src/python/unit_exports.cpp b/engine/src/python/unit_exports.cpp index 0622afc170..04743fd659 100644 --- a/engine/src/python/unit_exports.cpp +++ b/engine/src/python/unit_exports.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * unit_exports.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -20,6 +22,7 @@ * along with Vega Strike. If not, see . */ +#define PY_SSIZE_T_CLEAN #include #if BOOST_VERSION != 102800 #include diff --git a/engine/src/python/unit_exports.h b/engine/src/python/unit_exports.h index 158563978c..f2ed21cbd0 100644 --- a/engine/src/python/unit_exports.h +++ b/engine/src/python/unit_exports.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * unit_exports.h + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -21,6 +23,7 @@ */ // NO HEADER GUARD +#define PY_SSIZE_T_CLEAN #include "python_class.h" #include "cmd/container.h" diff --git a/engine/src/python/unit_from_to_python.h b/engine/src/python/unit_from_to_python.h index 7ac44bb0f8..82b887390e 100644 --- a/engine/src/python/unit_from_to_python.h +++ b/engine/src/python/unit_from_to_python.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * unit_from_to_python.h + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -23,6 +25,7 @@ #ifndef VEGA_STRIKE_ENGINE_PYTHON_UNIT_FROM_TO_PYTHON_H #define VEGA_STRIKE_ENGINE_PYTHON_UNIT_FROM_TO_PYTHON_H +#define PY_SSIZE_T_CLEAN #include #if BOOST_VERSION != 102800 diff --git a/engine/src/python/unit_method_defs.cpp b/engine/src/python/unit_method_defs.cpp index a2d3a15879..3a0e95d511 100644 --- a/engine/src/python/unit_method_defs.cpp +++ b/engine/src/python/unit_method_defs.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * unit_method_defs.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -21,6 +23,7 @@ */ #if _MSC_VER <= 1200 +#define PY_SSIZE_T_CLEAN #include #include typedef boost::python::dict BoostPythonDictionary; diff --git a/engine/src/python/unit_wrapper.cpp b/engine/src/python/unit_wrapper.cpp index 2ea75a7c9f..956e1b0d53 100644 --- a/engine/src/python/unit_wrapper.cpp +++ b/engine/src/python/unit_wrapper.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * unit_wrapper.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -21,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include typedef boost::python::dict BoostPythonDictionary; diff --git a/engine/src/python/unit_wrapper_class.h b/engine/src/python/unit_wrapper_class.h index 633eb16d00..1c4b48e420 100644 --- a/engine/src/python/unit_wrapper_class.h +++ b/engine/src/python/unit_wrapper_class.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * unit_wrapper_class.h + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -21,6 +23,8 @@ */ // NO HEADER GUARD + +#define PY_SSIZE_T_CLEAN #include "vs_logging.h" using std::string; //WARNING: Macro City ahead. Please skip this section if you don't like macros. @@ -162,15 +166,15 @@ class UnitWrapper : public UnitContainer { boost::python::tuple GetOrientation() { { CHECKME VS_BOOST_MAKE_TUPLE(VS_BOOST_MAKE_TUPLE(0, 0, 0), VS_BOOST_MAKE_TUPLE(0, 0, 0), VS_BOOST_MAKE_TUPLE(0, - 0, - 0)); + 0, + 0)); } Vector p, q, r; unit->GetOrientation(p, q, r); return VS_BOOST_MAKE_TUPLE(VS_BOOST_MAKE_TUPLE(p.i, p.j, p.k), VS_BOOST_MAKE_TUPLE(q.i, - q.j, - q.k), - VS_BOOST_MAKE_TUPLE(r.i, r.j, r.k)); + q.j, + q.k), + VS_BOOST_MAKE_TUPLE(r.i, r.j, r.k)); } boost::python::tuple rayCollide(QVector st, QVector en) { @@ -232,23 +236,23 @@ class UnitWrapper : public UnitContainer { Vector bigNormal, smallNormal; if (!unit->InsideCollideTree(smaller, bigpos, bigNormal, smallpos, smallNormal)) { bigpos = smallpos = QVector(0, - 0, - 0); + 0, + 0); } boost::python::tuple tup = VS_BOOST_MAKE_TUPLE_4(VS_BOOST_MAKE_TUPLE(bigpos.i, - bigpos.j, - bigpos.k), - VS_BOOST_MAKE_TUPLE(bigNormal.i, - bigNormal.j, - bigNormal.k), - VS_BOOST_MAKE_TUPLE(smallpos.i, - smallpos - .j, - smallpos - .k), - VS_BOOST_MAKE_TUPLE(smallNormal.i, - smallNormal.j, - smallNormal.k)); + bigpos.j, + bigpos.k), + VS_BOOST_MAKE_TUPLE(bigNormal.i, + bigNormal.j, + bigNormal.k), + VS_BOOST_MAKE_TUPLE(smallpos.i, + smallpos + .j, + smallpos + .k), + VS_BOOST_MAKE_TUPLE(smallNormal.i, + smallNormal.j, + smallNormal.k)); return tup; } @@ -271,13 +275,13 @@ class UnitWrapper : public UnitContainer { } void ApplyDamage(Vector pnt, - Vector normal, - float amt, - UnitWrapper dealer, - float r, - float g, - float b, - float a) { + Vector normal, + float amt, + UnitWrapper dealer, + float r, + float g, + float b, + float a) { { CHECKME; } diff --git a/engine/src/python/universe_util_export.cpp b/engine/src/python/universe_util_export.cpp index a1b82b222c..eff412bc5b 100644 --- a/engine/src/python/universe_util_export.cpp +++ b/engine/src/python/universe_util_export.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * universe_util_export.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -20,6 +22,7 @@ * along with Vega Strike. If not, see . */ +#define PY_SSIZE_T_CLEAN #include #include #include "python_class.h" @@ -40,7 +43,7 @@ void StarSystemExports() { #define EXPORT_FACTION(name, aff) PYTHON_DEFINE_GLOBAL( VS, &FactionUtil::name, #name ); #define voidEXPORT_FACTION(name) EXPORT_FACTION( name, 0 ) - #include "star_system_exports.h" +#include "star_system_exports.h" } #include diff --git a/engine/src/savegame.cpp b/engine/src/savegame.cpp index 4a93d2e15a..825a362c47 100644 --- a/engine/src/savegame.cpp +++ b/engine/src/savegame.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * savegame.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -21,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include "cmd/unit_generic.h" #include "hashtable.h" @@ -90,8 +93,8 @@ std::string GetHelperPlayerSaveGame(int num) { f.Close(); } else { VS_LOG_AND_FLUSH(fatal, - (boost::format("!!! ERROR : Creating default save.4.x.txt file : %1%") - % f.GetFullPath())); + (boost::format("!!! ERROR : Creating default save.4.x.txt file : %1%") + % f.GetFullPath())); VSExit(1); } err = f.OpenReadOnly("save.4.x.txt", UnknownFile); @@ -270,8 +273,8 @@ std::vector readFile(std::string filename) vec.reserve(fileSize); std::copy(std::istream_iterator(file), - std::istream_iterator(), - std::back_inserter(vec)); + std::istream_iterator(), + std::back_inserter(vec)); file.close(); @@ -426,16 +429,16 @@ void CopySavedShips(std::string filename, int player_num, const std::vectorPackUnitInfo(packedInfo); cp->savegame->WriteSaveGame(cp->activeStarSystem->getFileName().c_str(), - un->LocalPosition(), cp->credits, packedInfo, auto_save ? -1 : player_num); + un->LocalPosition(), cp->credits, packedInfo, auto_save ? -1 : player_num); un->WriteUnit(cp->GetUnitModifications().c_str()); if (GetWritePlayerSaveGame(player_num).length() && !auto_save) { cp->savegame->SetSavedCredits(_Universe->AccessCockpit()->credits); @@ -718,9 +721,9 @@ void SaveGame::ReadMissionStringData(char *&buf, bool select_data, const std::se } else { // debugging attempt -- show why the allocation would fail VS_LOG(info, - (boost::format( - " SaveGame::ReadMissionStringData: vecstring->reserve(md_i_size = %1%) will fail, bailing out (i = %2%)") - % md_i_size % i)); + (boost::format( + " SaveGame::ReadMissionStringData: vecstring->reserve(md_i_size = %1%) will fail, bailing out (i = %2%)") + % md_i_size % i)); } for (int j = 0; j < md_i_size; j++) { if (skip) { @@ -737,7 +740,7 @@ void SaveGame::ReadMissionStringData(char *&buf, bool select_data, const std::se void SaveGame::PurgeZeroStarships() // DELETE unused function? { for (MissionStringDat::MSD::iterator i = missionstringdata->m.begin(), ie = missionstringdata->m.end(); i != ie; - ++i) { + ++i) { if (fg_util::IsFGKey(i->first)) { if (fg_util::CheckFG(i->second)) { // VS_LOG(info, (boost::format("correcting flightgroup %1% to have right landed ships") % i->first.c_str())); @@ -784,7 +787,7 @@ void SaveGame::WriteMissionStringData(std::vector &ret) { const string &key = (*i).first; unsigned int siz = (*i).second.size(); if (key == "mission_descriptions" || key == "mission_scripts" || key == "mission_vars" - || key == "mission_names") { + || key == "mission_names") { //*** BLACKLIST *** //Don't bother to write these out since they waste a lot of space and aren't used. siz = 0; //Not writing them out altogether will cause saved games to break. @@ -806,10 +809,10 @@ void SaveGame::ReadStardate(char *&buf) { } void SaveGame::ReadSavedPackets(char *&buf, - bool commitfactions, - bool skip_news, - bool select_data, - const std::set &select_data_filter) { + bool commitfactions, + bool skip_news, + bool select_data, + const std::set &select_data_filter) { int a = 0; char unitname[1024]; char factname[1024]; @@ -860,7 +863,7 @@ void SaveGame::LoadSavedMissions() { Mission *ignoreMission = Mission::getNthPlayerMission(_Universe->CurrentCockpit(), 0); for (i = active_missions.size() - 1; i > 0; --i) { //don't terminate zeroth mission if (active_missions[i]->player_num == _Universe->CurrentCockpit() - && active_missions[i] != ignoreMission) { + && active_missions[i] != ignoreMission) { active_missions[i]->terminateMission(); } } @@ -905,10 +908,10 @@ static char *tmprealloc(char *var, int &oldlength, int newlength) { #define MAXBUFFER 16384 string SaveGame::WritePlayerData(const QVector &FP, - std::vector unitname, - const char *systemname, - float credits, - std::string fact) { + std::vector unitname, + const char *systemname, + float credits, + std::string fact) { string playerdata(""); int MB = MAXBUFFER; char *tmp = (char *) malloc(MB); @@ -989,12 +992,12 @@ string SaveGame::WriteDynamicUniverse() { using namespace VSFileSystem; string SaveGame::WriteSaveGame(const char *systemname, - const QVector &FP, - float credits, - std::vector unitname, - int player_num, - std::string fact, - bool write) { + const QVector &FP, + float credits, + std::vector unitname, + int player_num, + std::string fact, + bool write) { savestring = string(""); VS_LOG(info, (boost::format("Writing Save Game %1%") % outputsavegame)); savestring += WritePlayerData(FP, unitname, systemname, credits, fact); @@ -1042,20 +1045,20 @@ void SaveGame::SetOutputFileName(const string &filename) { } void SaveGame::ParseSaveGame(const string &filename_p, - string &FSS, - const string &originalstarsystem, - QVector &PP, - bool &shouldupdatepos, - float &credits, - vector &savedstarship, - int player_num, - const string &save_contents, - bool read, - bool commitfaction, - bool quick_read, - bool skip_news, - bool select_data, - const std::set &select_data_filter) { + string &FSS, + const string &originalstarsystem, + QVector &PP, + bool &shouldupdatepos, + float &credits, + vector &savedstarship, + int player_num, + const string &save_contents, + bool read, + bool commitfaction, + bool quick_read, + bool skip_news, + bool select_data, + const std::set &select_data_filter) { const string &str = save_contents; //alias string filename; //Now leave filename empty, use the default name regardless... diff --git a/engine/src/star_system.cpp b/engine/src/star_system.cpp index 99c68e37c9..6598af0ffa 100644 --- a/engine/src/star_system.cpp +++ b/engine/src/star_system.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * star_system.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -21,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include "star_system.h" diff --git a/engine/src/universe_util_generic.cpp b/engine/src/universe_util_generic.cpp index c45eb8a7fb..42b8d92e25 100644 --- a/engine/src/universe_util_generic.cpp +++ b/engine/src/universe_util_generic.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * universe_util_generic.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -21,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include #include "lin_time.h" @@ -79,422 +82,422 @@ using namespace VSFileSystem; namespace UniverseUtil { -void PythonUnitIter::advanceSignificant() { - advance(); - while (!isDone() && !UnitUtil::isSignificant(**this)) { + void PythonUnitIter::advanceSignificant() { advance(); + while (!isDone() && !UnitUtil::isSignificant(**this)) { + advance(); + } } -} -void PythonUnitIter::advanceInsignificant() { - advance(); - while (!isDone() && UnitUtil::isSignificant(**this)) { + void PythonUnitIter::advanceInsignificant() { advance(); + while (!isDone() && UnitUtil::isSignificant(**this)) { + advance(); + } } -} -void PythonUnitIter::advancePlanet() { - advance(); - while (!isDone() && !(**this)->isPlanet()) { + void PythonUnitIter::advancePlanet() { advance(); + while (!isDone() && !(**this)->isPlanet()) { + advance(); + } } -} -void PythonUnitIter::advanceJumppoint() { - advance(); - while (!isDone() && !(**this)->isJumppoint()) { + void PythonUnitIter::advanceJumppoint() { advance(); + while (!isDone() && !(**this)->isJumppoint()) { + advance(); + } } -} -void PythonUnitIter::advanceN(int n) { - while (!isDone() && n > 0) { - advance(); - --n; + void PythonUnitIter::advanceN(int n) { + while (!isDone() && n > 0) { + advance(); + --n; + } } -} -void PythonUnitIter::advanceNSignificant(int n) { - if (!isDone() && !UnitUtil::isSignificant(**this)) { - advanceSignificant(); - } - while (!isDone() && (n > 0)) { - advanceSignificant(); - --n; + void PythonUnitIter::advanceNSignificant(int n) { + if (!isDone() && !UnitUtil::isSignificant(**this)) { + advanceSignificant(); + } + while (!isDone() && (n > 0)) { + advanceSignificant(); + --n; + } } -} -void PythonUnitIter::advanceNInsignificant(int n) { - if (!isDone() && UnitUtil::isSignificant(**this)) { - advanceInsignificant(); - } - while (!isDone() && (n > 0)) { - advanceInsignificant(); - --n; + void PythonUnitIter::advanceNInsignificant(int n) { + if (!isDone() && UnitUtil::isSignificant(**this)) { + advanceInsignificant(); + } + while (!isDone() && (n > 0)) { + advanceInsignificant(); + --n; + } } -} -void PythonUnitIter::advanceNPlanet(int n) { - if (!isDone() && !(**this)->isPlanet()) { - advancePlanet(); - } - while (!isDone() && n > 0) { - advancePlanet(); - --n; + void PythonUnitIter::advanceNPlanet(int n) { + if (!isDone() && !(**this)->isPlanet()) { + advancePlanet(); + } + while (!isDone() && n > 0) { + advancePlanet(); + --n; + } } -} -void PythonUnitIter::advanceNJumppoint(int n) { - if (!isDone() && !(**this)->isJumppoint()) { - advanceJumppoint(); - } - while (!isDone() && n > 0) { - advanceJumppoint(); - --n; + void PythonUnitIter::advanceNJumppoint(int n) { + if (!isDone() && !(**this)->isJumppoint()) { + advanceJumppoint(); + } + while (!isDone() && n > 0) { + advanceJumppoint(); + --n; + } } -} - -std::string vsConfig(std::string category, std::string option, std::string def) { - return vs_config->getVariable(category, option, def); -} - -Unit *launchJumppoint(string name_string, - string faction_string, - string type_string, - string unittype_string, - string ai_string, - int nr_of_ships, - int nr_of_waves, - QVector pos, - string squadlogo, - string destinations) { - int clstype = Vega_UnitType::unit; - if (unittype_string == "planet") { - clstype = Vega_UnitType::planet; - } else if (unittype_string == "asteroid") { - clstype = Vega_UnitType::asteroid; - } else if (unittype_string == "nebula") { - clstype = Vega_UnitType::nebula; - } - CreateFlightgroup cf; - cf.fg = Flightgroup::newFlightgroup(name_string, - type_string, - faction_string, - ai_string, - nr_of_ships, - nr_of_waves, - squadlogo, - "", - mission); - cf.unittype = CreateFlightgroup::UNIT; - cf.terrain_nr = -1; - cf.waves = nr_of_waves; - cf.nr_ships = nr_of_ships; - cf.fg->pos = pos; - cf.rot[0] = cf.rot[1] = cf.rot[2] = 0.0f; - Unit *tmp = mission->call_unit_launch(&cf, clstype, destinations); - mission->number_of_ships += nr_of_ships; - - return tmp; -} -Cargo getRandCargo(int quantity, string category) { - Cargo *ret = NULL; - Unit *mpl = &GetUnitMasterPartList(); - unsigned int max = mpl->numCargo(); - if (!category.empty()) { - size_t Begin, End; - mpl->GetSortedCargoCat(category, Begin, End); - if (Begin < End) { - unsigned int i = Begin + (rand() % (End - Begin)); - ret = &mpl->GetCargo(i); - } else { - VS_LOG(info, (boost::format("Cargo category %1% not found") % category)); + std::string vsConfig(std::string category, std::string option, std::string def) { + return vs_config->getVariable(category, option, def); + } + + Unit *launchJumppoint(string name_string, + string faction_string, + string type_string, + string unittype_string, + string ai_string, + int nr_of_ships, + int nr_of_waves, + QVector pos, + string squadlogo, + string destinations) { + int clstype = Vega_UnitType::unit; + if (unittype_string == "planet") { + clstype = Vega_UnitType::planet; + } else if (unittype_string == "asteroid") { + clstype = Vega_UnitType::asteroid; + } else if (unittype_string == "nebula") { + clstype = Vega_UnitType::nebula; } - } else if (mpl->numCargo()) { - for (unsigned int i = 0; i < 500; ++i) { - ret = &mpl->GetCargo(rand() % max); - if (ret->GetName().find("mission") == string::npos) { - break; + CreateFlightgroup cf; + cf.fg = Flightgroup::newFlightgroup(name_string, + type_string, + faction_string, + ai_string, + nr_of_ships, + nr_of_waves, + squadlogo, + "", + mission); + cf.unittype = CreateFlightgroup::UNIT; + cf.terrain_nr = -1; + cf.waves = nr_of_waves; + cf.nr_ships = nr_of_ships; + cf.fg->pos = pos; + cf.rot[0] = cf.rot[1] = cf.rot[2] = 0.0f; + Unit *tmp = mission->call_unit_launch(&cf, clstype, destinations); + mission->number_of_ships += nr_of_ships; + + return tmp; + } + + Cargo getRandCargo(int quantity, string category) { + Cargo *ret = NULL; + Unit *mpl = &GetUnitMasterPartList(); + unsigned int max = mpl->numCargo(); + if (!category.empty()) { + size_t Begin, End; + mpl->GetSortedCargoCat(category, Begin, End); + if (Begin < End) { + unsigned int i = Begin + (rand() % (End - Begin)); + ret = &mpl->GetCargo(i); + } else { + VS_LOG(info, (boost::format("Cargo category %1% not found") % category)); + } + } else if (mpl->numCargo()) { + for (unsigned int i = 0; i < 500; ++i) { + ret = &mpl->GetCargo(rand() % max); + if (ret->GetName().find("mission") == string::npos) { + break; + } } } + if (ret) { + Cargo tempret = *ret; + tempret.SetQuantity(quantity); + return tempret; //uses copy + } else { + Cargo newret; + newret.SetQuantity(0); + return newret; + } } - if (ret) { - Cargo tempret = *ret; - tempret.SetQuantity(quantity); - return tempret; //uses copy - } else { - Cargo newret; - newret.SetQuantity(0); - return newret; - } -} -float GetGameTime() { - return mission->getGametime(); -} + float GetGameTime() { + return mission->getGametime(); + } -float getStarTime() { - return (float) _Universe->current_stardate.GetCurrentStarTime(); -} + float getStarTime() { + return (float) _Universe->current_stardate.GetCurrentStarTime(); + } -string getStarDate() { - return _Universe->current_stardate.GetFullTrekDate(); -} + string getStarDate() { + return _Universe->current_stardate.GetFullTrekDate(); + } -void SetTimeCompression() { - setTimeCompression(1.0); -} + void SetTimeCompression() { + setTimeCompression(1.0); + } -static UnitContainer scratch_unit; -static QVector scratch_vector; + static UnitContainer scratch_unit; + static QVector scratch_vector; -Unit *GetMasterPartList() { - return getMasterPartList(); -} + Unit *GetMasterPartList() { + return getMasterPartList(); + } -Unit *getScratchUnit() { - return scratch_unit.GetUnit(); -} + Unit *getScratchUnit() { + return scratch_unit.GetUnit(); + } -void setScratchUnit(Unit *un) { - scratch_unit.SetUnit(un); -} + void setScratchUnit(Unit *un) { + scratch_unit.SetUnit(un); + } -QVector getScratchVector() { - return scratch_vector; -} + QVector getScratchVector() { + return scratch_vector; + } -void setScratchVector(QVector un) { - scratch_vector = un; -} + void setScratchVector(QVector un) { + scratch_vector = un; + } -void pushSystem(string name) { - StarSystem *ss = _Universe->GenerateStarSystem(name.c_str(), "", Vector(0, 0, 0)); - _Universe->pushActiveStarSystem(ss); -} + void pushSystem(string name) { + StarSystem *ss = _Universe->GenerateStarSystem(name.c_str(), "", Vector(0, 0, 0)); + _Universe->pushActiveStarSystem(ss); + } -void popSystem() { - _Universe->popActiveStarSystem(); -} + void popSystem() { + _Universe->popActiveStarSystem(); + } -string getSystemFile() { - if (!activeSys) { - return ""; + string getSystemFile() { + if (!activeSys) { + return ""; + } + return activeSys->getFileName(); } - return activeSys->getFileName(); -} -string getSystemName() { - if (!activeSys) { - return ""; + string getSystemName() { + if (!activeSys) { + return ""; + } + return activeSys->getName(); } - return activeSys->getName(); -} ///tells the respective flightgroups in this system to start shooting at each other -void TargetEachOther(string fgname, string faction, string enfgname, string enfaction) { - int fac = FactionUtil::GetFactionIndex(faction); - int enfac = FactionUtil::GetFactionIndex(enfaction); - Unit *un; - Unit *en = NULL; - Unit *al = NULL; - for (un_iter i = _Universe->activeStarSystem()->getUnitList().createIterator(); (un = *i) && ((!en) || (!al)); - ++i) { - if (un->faction == enfac && UnitUtil::getFlightgroupName(un) == enfgname) { - if ((NULL == en) || (rand() % 3 == 0)) { - en = un; + void TargetEachOther(string fgname, string faction, string enfgname, string enfaction) { + int fac = FactionUtil::GetFactionIndex(faction); + int enfac = FactionUtil::GetFactionIndex(enfaction); + Unit *un; + Unit *en = NULL; + Unit *al = NULL; + for (un_iter i = _Universe->activeStarSystem()->getUnitList().createIterator(); (un = *i) && ((!en) || (!al)); + ++i) { + if (un->faction == enfac && UnitUtil::getFlightgroupName(un) == enfgname) { + if ((NULL == en) || (rand() % 3 == 0)) { + en = un; + } + } + if (un->faction == fac && UnitUtil::getFlightgroupName(un) == fgname) { + al = un; } } - if (un->faction == fac && UnitUtil::getFlightgroupName(un) == fgname) { - al = un; + if (en && al) { + UnitUtil::setFlightgroupLeader(al, al); + al->Target(en); + //attack target, darent change target! + UnitUtil::setFgDirective(al, "A."); + UnitUtil::setFlightgroupLeader(en, en); + en->Target(al); + //help me out here! + UnitUtil::setFgDirective(en, "h"); } } - if (en && al) { - UnitUtil::setFlightgroupLeader(al, al); - al->Target(en); - //attack target, darent change target! - UnitUtil::setFgDirective(al, "A."); - UnitUtil::setFlightgroupLeader(en, en); - en->Target(al); - //help me out here! - UnitUtil::setFgDirective(en, "h"); - } -} ///tells the respective flightgroups in this system to stop killing each other urgently...they may still attack--just not warping and stuff -void StopTargettingEachOther(string fgname, string faction, string enfgname, string enfaction) { - int fac = FactionUtil::GetFactionIndex(faction); - int enfac = FactionUtil::GetFactionIndex(enfaction); - Unit *un; - int clear = 0; - for (un_iter i = _Universe->activeStarSystem()->getUnitList().createIterator(); (un = *i) && clear != 3; ++i) { - if ((un->faction == enfac && UnitUtil::getFlightgroupName(un) == enfgname)) { - clear |= 1; - UnitUtil::setFgDirective(un, "b"); - } else if (un->faction == fac && UnitUtil::getFlightgroupName(un) == fgname) { - clear |= 2; - UnitUtil::setFgDirective(un, "b"); - //check to see that its' in this flightgroup or something :-) + void StopTargettingEachOther(string fgname, string faction, string enfgname, string enfaction) { + int fac = FactionUtil::GetFactionIndex(faction); + int enfac = FactionUtil::GetFactionIndex(enfaction); + Unit *un; + int clear = 0; + for (un_iter i = _Universe->activeStarSystem()->getUnitList().createIterator(); (un = *i) && clear != 3; ++i) { + if ((un->faction == enfac && UnitUtil::getFlightgroupName(un) == enfgname)) { + clear |= 1; + UnitUtil::setFgDirective(un, "b"); + } else if (un->faction == fac && UnitUtil::getFlightgroupName(un) == fgname) { + clear |= 2; + UnitUtil::setFgDirective(un, "b"); + //check to see that its' in this flightgroup or something :-) + } } } -} -bool systemInMemory(string nam) { - unsigned int nass = _Universe->star_system.size(); - for (unsigned int i = 0; i < nass; ++i) { - if (_Universe->star_system[i]->getFileName() == nam) { - return true; + bool systemInMemory(string nam) { + unsigned int nass = _Universe->star_system.size(); + for (unsigned int i = 0; i < nass; ++i) { + if (_Universe->star_system[i]->getFileName() == nam) { + return true; + } } + return false; } - return false; -} -float GetRelation(std::string myfaction, std::string theirfaction) { - int myfac = FactionUtil::GetFactionIndex(myfaction); - int theirfac = FactionUtil::GetFactionIndex(theirfaction); - int cp = _Universe->CurrentCockpit(); - Unit *un = _Universe->AccessCockpit()->GetParent(); - if (!un) { - return FactionUtil::GetIntRelation(myfac, theirfac); - } - if (myfac == theirfac) { - return 0; - } else if (myfac == un->faction) { - return getRelationModifierInt(cp, theirfac); - } else if (theirfac == un->faction) { - return getRelationModifierInt(cp, myfac); - } else { - return FactionUtil::GetIntRelation(myfac, theirfac); + float GetRelation(std::string myfaction, std::string theirfaction) { + int myfac = FactionUtil::GetFactionIndex(myfaction); + int theirfac = FactionUtil::GetFactionIndex(theirfaction); + int cp = _Universe->CurrentCockpit(); + Unit *un = _Universe->AccessCockpit()->GetParent(); + if (!un) { + return FactionUtil::GetIntRelation(myfac, theirfac); + } + if (myfac == theirfac) { + return 0; + } else if (myfac == un->faction) { + return getRelationModifierInt(cp, theirfac); + } else if (theirfac == un->faction) { + return getRelationModifierInt(cp, myfac); + } else { + return FactionUtil::GetIntRelation(myfac, theirfac); + } } -} -void AdjustRelation(std::string myfaction, std::string theirfaction, float factor, float rank) { - int myfac = FactionUtil::GetFactionIndex(myfaction); - int theirfac = FactionUtil::GetFactionIndex(theirfaction); - float realfactor = factor * rank; - int cp = _Universe->CurrentCockpit(); - Unit *un = _Universe->AccessCockpit()->GetParent(); - if (!un) { - return; - } - if (myfac == theirfac) { - return; - } else if (myfac == un->faction) { - return adjustRelationModifierInt(cp, theirfac, realfactor); - } else if (theirfac == un->faction) { - return adjustRelationModifierInt(cp, myfac, realfactor); + void AdjustRelation(std::string myfaction, std::string theirfaction, float factor, float rank) { + int myfac = FactionUtil::GetFactionIndex(myfaction); + int theirfac = FactionUtil::GetFactionIndex(theirfaction); + float realfactor = factor * rank; + int cp = _Universe->CurrentCockpit(); + Unit *un = _Universe->AccessCockpit()->GetParent(); + if (!un) { + return; + } + if (myfac == theirfac) { + return; + } else if (myfac == un->faction) { + return adjustRelationModifierInt(cp, theirfac, realfactor); + } else if (theirfac == un->faction) { + return adjustRelationModifierInt(cp, myfac, realfactor); + } } -} -float getRelationModifierInt(int which_cp, int faction) { - string saveVar = "Relation_to_" + FactionUtil::GetFactionName(faction); - if (getSaveDataLength(which_cp, saveVar) == 0) { - return 0.; - } - float val = getSaveData(which_cp, saveVar, 0); - if (val > 1) { - val = 1; + float getRelationModifierInt(int which_cp, int faction) { + string saveVar = "Relation_to_" + FactionUtil::GetFactionName(faction); + if (getSaveDataLength(which_cp, saveVar) == 0) { + return 0.; + } + float val = getSaveData(which_cp, saveVar, 0); + if (val > 1) { + val = 1; + } + return val; } - return val; -} - -float getRelationModifier(int which_cp, string faction) { - return getRelationModifierInt(which_cp, FactionUtil::GetFactionIndex(faction)); -} -float getFGRelationModifier(int which_cp, string fg) { - fg = "FG_Relation_" + fg; - if (getSaveDataLength(which_cp, fg) == 0) { - return 0.; + float getRelationModifier(int which_cp, string faction) { + return getRelationModifierInt(which_cp, FactionUtil::GetFactionIndex(faction)); } - return getSaveData(which_cp, fg, 0); -} -void adjustRelationModifierInt(int which_cp, int faction, float delta) { - if (delta > 1) { - delta = 1; - } - string saveVar = "Relation_to_" + FactionUtil::GetFactionName(faction); - if (getSaveDataLength(which_cp, saveVar) == 0) { - pushSaveData(which_cp, saveVar, delta); + float getFGRelationModifier(int which_cp, string fg) { + fg = "FG_Relation_" + fg; + if (getSaveDataLength(which_cp, fg) == 0) { + return 0.; + } + return getSaveData(which_cp, fg, 0); } - float val = getSaveData(which_cp, saveVar, 0) + delta; - if (val > 1) { - val = 1; + + void adjustRelationModifierInt(int which_cp, int faction, float delta) { + if (delta > 1) { + delta = 1; + } + string saveVar = "Relation_to_" + FactionUtil::GetFactionName(faction); + if (getSaveDataLength(which_cp, saveVar) == 0) { + pushSaveData(which_cp, saveVar, delta); + } + float val = getSaveData(which_cp, saveVar, 0) + delta; + if (val > 1) { + val = 1; + } + return putSaveData(which_cp, saveVar, 0, val); } - return putSaveData(which_cp, saveVar, 0, val); -} -void adjustRelationModifier(int which_cp, string faction, float delta) { - adjustRelationModifierInt(which_cp, FactionUtil::GetFactionIndex(faction), delta); -} + void adjustRelationModifier(int which_cp, string faction, float delta) { + adjustRelationModifierInt(which_cp, FactionUtil::GetFactionIndex(faction), delta); + } -void adjustFGRelationModifier(int which_cp, string fg, float delta) { - fg = "FG_Relation_" + fg; - if (getSaveDataLength(which_cp, fg) == 0) { - pushSaveData(which_cp, fg, delta); - return; + void adjustFGRelationModifier(int which_cp, string fg, float delta) { + fg = "FG_Relation_" + fg; + if (getSaveDataLength(which_cp, fg) == 0) { + pushSaveData(which_cp, fg, delta); + return; + } + putSaveData(which_cp, fg, 0, getSaveData(which_cp, fg, 0) + delta); } - putSaveData(which_cp, fg, 0, getSaveData(which_cp, fg, 0) + delta); -} -void setMissionOwner(int whichplayer) { - mission->player_num = whichplayer; -} + void setMissionOwner(int whichplayer) { + mission->player_num = whichplayer; + } -int getMissionOwner() { - return mission->player_num; -} + int getMissionOwner() { + return mission->player_num; + } -UniverseUtil::PythonUnitIter getUnitList() { - return activeSys->getUnitList().createIterator(); -} + UniverseUtil::PythonUnitIter getUnitList() { + return activeSys->getUnitList().createIterator(); + } -Unit *getUnit(int index) { - un_iter iter = activeSys->getUnitList().createIterator(); - Unit *un = NULL; - for (int i = -1; (un = *iter) && i < index; ++iter) { - if (!un->Destroyed()) { - ++i; - } - if (i == index) { - break; + Unit *getUnit(int index) { + un_iter iter = activeSys->getUnitList().createIterator(); + Unit *un = NULL; + for (int i = -1; (un = *iter) && i < index; ++iter) { + if (!un->Destroyed()) { + ++i; + } + if (i == index) { + break; + } } + return un; } - return un; -} -Unit *getUnitByPtr(void *ptr, Unit *finder, bool allowslowness) { - if (finder) { - UnitPtrLocator unitLocator(ptr); - findObjects(activeSys->collide_map[Unit::UNIT_ONLY], finder->location[Unit::UNIT_ONLY], &unitLocator); - if (unitLocator.retval) { - return reinterpret_cast< Unit * > (ptr); - } else if (!finder->isSubUnit()) { + Unit *getUnitByPtr(void *ptr, Unit *finder, bool allowslowness) { + if (finder) { + UnitPtrLocator unitLocator(ptr); + findObjects(activeSys->collide_map[Unit::UNIT_ONLY], finder->location[Unit::UNIT_ONLY], &unitLocator); + if (unitLocator.retval) { + return reinterpret_cast< Unit * > (ptr); + } else if (!finder->isSubUnit()) { + return 0; + } + } + if (!allowslowness) { return 0; } + return ((activeSys->getUnitList().contains((Unit *) ptr)) ? reinterpret_cast< Unit * > (ptr) : NULL); } - if (!allowslowness) { - return 0; - } - return ((activeSys->getUnitList().contains((Unit *) ptr)) ? reinterpret_cast< Unit * > (ptr) : NULL); -} -Unit *getUnitByName(std::string name) { - un_iter iter = activeSys->getUnitList().createIterator(); - while (!iter.isDone() && UnitUtil::getName(*iter) != name) { - ++iter; + Unit *getUnitByName(std::string name) { + un_iter iter = activeSys->getUnitList().createIterator(); + while (!iter.isDone() && UnitUtil::getName(*iter) != name) { + ++iter; + } + return ((!iter.isDone()) ? (*iter) : NULL); } - return ((!iter.isDone()) ? (*iter) : NULL); -} -int getNumUnits() { + int getNumUnits() { #ifdef USE_STL_COLLECTION - return activeSys->getUnitList().size(); + return activeSys->getUnitList().size(); #else - //Implentation-safe getNumUnits(). + //Implentation-safe getNumUnits(). int count = 0; un_iter iter = activeSys->getUnitList().createIterator(); while ( iter.current() ) { @@ -503,7 +506,7 @@ int getNumUnits() { } return count; #endif -} + } //NOTEXPORTEDYET /* * float GetGameTime () { @@ -513,525 +516,525 @@ int getNumUnits() { * setTimeCompression(1.0); * } */ -string GetAdjacentSystem(string str, int which) { - return _Universe->getAdjacentStarSystems(str)[which]; -} + string GetAdjacentSystem(string str, int which) { + return _Universe->getAdjacentStarSystems(str)[which]; + } -string GetGalaxyProperty(string sys, string prop) { - return _Universe->getGalaxyProperty(sys, prop); -} + string GetGalaxyProperty(string sys, string prop) { + return _Universe->getGalaxyProperty(sys, prop); + } -string GetGalaxyPropertyDefault(string sys, string prop, string def) { - return _Universe->getGalaxyPropertyDefault(sys, prop, def); -} + string GetGalaxyPropertyDefault(string sys, string prop, string def) { + return _Universe->getGalaxyPropertyDefault(sys, prop, def); + } #define DEFAULT_FACTION_SAVENAME "FactionTookOver_" -string GetGalaxyFaction(string sys) { - string fac = _Universe->getGalaxyProperty(sys, "faction"); - vector *ans = - &(_Universe->AccessCockpit(0)->savegame->getMissionStringData(string(DEFAULT_FACTION_SAVENAME) + sys)); - if (ans->size()) { - fac = (*ans)[0]; + string GetGalaxyFaction(string sys) { + string fac = _Universe->getGalaxyProperty(sys, "faction"); + vector *ans = + &(_Universe->AccessCockpit(0)->savegame->getMissionStringData(string(DEFAULT_FACTION_SAVENAME) + sys)); + if (ans->size()) { + fac = (*ans)[0]; + } + return fac; } - return fac; -} -void SetGalaxyFaction(string sys, string fac) { - vector *ans = - &(_Universe->AccessCockpit(0)->savegame->getMissionStringData(string(DEFAULT_FACTION_SAVENAME) + sys)); - if (ans->size()) { - (*ans)[0] = fac; - } else { - ans->push_back(std::string(fac)); + void SetGalaxyFaction(string sys, string fac) { + vector *ans = + &(_Universe->AccessCockpit(0)->savegame->getMissionStringData(string(DEFAULT_FACTION_SAVENAME) + sys)); + if (ans->size()) { + (*ans)[0] = fac; + } else { + ans->push_back(std::string(fac)); + } } -} -int GetNumAdjacentSystems(string sysname) { - return _Universe->getAdjacentStarSystems(sysname).size(); -} + int GetNumAdjacentSystems(string sysname) { + return _Universe->getAdjacentStarSystems(sysname).size(); + } -float GetDifficulty() { - return g_game.difficulty; -} + float GetDifficulty() { + return g_game.difficulty; + } -void SetDifficulty(float diff) { - g_game.difficulty = diff; -} + void SetDifficulty(float diff) { + g_game.difficulty = diff; + } -extern void playVictoryTune(); + extern void playVictoryTune(); -void terminateMission(bool Win) { - if (Win) { - playVictoryTune(); + void terminateMission(bool Win) { + if (Win) { + playVictoryTune(); + } + mission->terminateMission(); } - mission->terminateMission(); -} -static string dontBlankOut(string objective) { - while (1) { - std::string::size_type where = objective.find(".blank"); - if (where != string::npos) { - objective = objective.substr(0, where) + objective.substr(where + strlen(".blank")); - } else { - return objective; + static string dontBlankOut(string objective) { + while (1) { + std::string::size_type where = objective.find(".blank"); + if (where != string::npos) { + objective = objective.substr(0, where) + objective.substr(where + strlen(".blank")); + } else { + return objective; + } } + return objective; } - return objective; -} - -int addObjective(string objective) { - float status = 0; - mission->objectives.push_back(Mission::Objective(status, dontBlankOut(objective))); - return mission->objectives.size() - 1; -} + int addObjective(string objective) { + float status = 0; -void setObjective(int which, string newobjective) { - if (which < (int) mission->objectives.size() && which >= 0) { - mission->objectives[which].objective = dontBlankOut(newobjective); + mission->objectives.push_back(Mission::Objective(status, dontBlankOut(objective))); + return mission->objectives.size() - 1; } -} -void setCompleteness(int which, float completeNess) { - if (which < (int) mission->objectives.size() && which >= 0) { - mission->objectives[which].completeness = completeNess; + void setObjective(int which, string newobjective) { + if (which < (int) mission->objectives.size() && which >= 0) { + mission->objectives[which].objective = dontBlankOut(newobjective); + } } -} -float getCompleteness(int which) { - if (which < (int) mission->objectives.size() && which >= 0) { - return mission->objectives[which].completeness; - } else { - return 0; + void setCompleteness(int which, float completeNess) { + if (which < (int) mission->objectives.size() && which >= 0) { + mission->objectives[which].completeness = completeNess; + } } -} -void setTargetLabel(std::string label) { - _Universe->AccessCockpit()->setTargetLabel(label); -} + float getCompleteness(int which) { + if (which < (int) mission->objectives.size() && which >= 0) { + return mission->objectives[which].completeness; + } else { + return 0; + } + } -std::string getTargetLabel() { - return _Universe->AccessCockpit()->getTargetLabel(); -} + void setTargetLabel(std::string label) { + _Universe->AccessCockpit()->setTargetLabel(label); + } -void eraseObjective(int which) { - if (which < (int) mission->objectives.size() && which >= 0) { - mission->objectives.erase(mission->objectives.begin() + which); + std::string getTargetLabel() { + return _Universe->AccessCockpit()->getTargetLabel(); } -} -void clearObjectives() { - if (mission->objectives.size()) { - mission->objectives.clear(); + void eraseObjective(int which) { + if (which < (int) mission->objectives.size() && which >= 0) { + mission->objectives.erase(mission->objectives.begin() + which); + } } -} -void setOwnerII(int which, Unit *owner) { - if (which < (int) mission->objectives.size()) { - mission->objectives[which].setOwner(owner); + void clearObjectives() { + if (mission->objectives.size()) { + mission->objectives.clear(); + } } -} -Unit *getOwner(int which) { - if (which < (int) mission->objectives.size()) { - return mission->objectives[which].getOwner(); - } else { - return 0; + void setOwnerII(int which, Unit *owner) { + if (which < (int) mission->objectives.size()) { + mission->objectives[which].setOwner(owner); + } } -} -int numActiveMissions() { - int num = 0; - unsigned int cp = _Universe->CurrentCockpit(); - for (unsigned int i = 0; i < active_missions.size(); ++i) { - if (active_missions[i]->player_num == cp) { - num++; + Unit *getOwner(int which) { + if (which < (int) mission->objectives.size()) { + return mission->objectives[which].getOwner(); + } else { + return 0; } } - return num + ::num_delayed_missions(); -} -void IOmessage(int delay, string from, string to, string message) { - if (to == "news" && (!game_options()->news_from_cargolist)) { - for (unsigned int i = 0; i < _Universe->numPlayers(); i++) { - pushSaveString(i, "news", string("#") + message); + int numActiveMissions() { + int num = 0; + unsigned int cp = _Universe->CurrentCockpit(); + for (unsigned int i = 0; i < active_missions.size(); ++i) { + if (active_missions[i]->player_num == cp) { + num++; + } } - } else { - mission->msgcenter->add(from, to, message, delay); + return num + ::num_delayed_missions(); } -} -Unit *GetContrabandList(string faction) { - return FactionUtil::GetContraband(FactionUtil::GetFactionIndex(faction)); -} + void IOmessage(int delay, string from, string to, string message) { + if (to == "news" && (!game_options()->news_from_cargolist)) { + for (unsigned int i = 0; i < _Universe->numPlayers(); i++) { + pushSaveString(i, "news", string("#") + message); + } + } else { + mission->msgcenter->add(from, to, message, delay); + } + } -void LoadMission(string missionname) { - ::LoadMission(missionname.c_str(), "", false); -} + Unit *GetContrabandList(string faction) { + return FactionUtil::GetContraband(FactionUtil::GetFactionIndex(faction)); + } -void LoadNamedMissionScript(string title, string missionscript) { - ::LoadMission(("#" + title).c_str(), missionscript, false); -} + void LoadMission(string missionname) { + ::LoadMission(missionname.c_str(), "", false); + } -void LoadMissionScript(string missionscript) { - ::LoadMission("nothing.mission", missionscript, false); -} + void LoadNamedMissionScript(string title, string missionscript) { + ::LoadMission(("#" + title).c_str(), missionscript, false); + } -void SetAutoStatus(int global_auto, int player_auto) { - if (global_auto == 1) { - mission->global_autopilot = Mission::AUTO_ON; - } else if (global_auto == -1) { - mission->global_autopilot = Mission::AUTO_OFF; - } else { - mission->global_autopilot = Mission::AUTO_NORMAL; - } - if (player_auto == 1) { - mission->player_autopilot = Mission::AUTO_ON; - } else if (player_auto == -1) { - mission->player_autopilot = Mission::AUTO_OFF; - } else { - mission->player_autopilot = Mission::AUTO_NORMAL; + void LoadMissionScript(string missionscript) { + ::LoadMission("nothing.mission", missionscript, false); } -} -QVector SafeStarSystemEntrancePoint(StarSystem *sts, QVector pos, float radial_size) { - if (radial_size < 0) { - radial_size = game_options()->respawn_unit_size; + void SetAutoStatus(int global_auto, int player_auto) { + if (global_auto == 1) { + mission->global_autopilot = Mission::AUTO_ON; + } else if (global_auto == -1) { + mission->global_autopilot = Mission::AUTO_OFF; + } else { + mission->global_autopilot = Mission::AUTO_NORMAL; + } + if (player_auto == 1) { + mission->player_autopilot = Mission::AUTO_ON; + } else if (player_auto == -1) { + mission->player_autopilot = Mission::AUTO_OFF; + } else { + mission->player_autopilot = Mission::AUTO_NORMAL; + } } - for (unsigned int k = 0; k < 10; ++k) { - Unit *un; - bool collision = false; - { - //fixme, make me faster, use collide map - for (un_iter i = sts->getUnitList().createIterator(); (un = *i) != NULL; ++i) { - if (UnitUtil::isAsteroid(un) || un->isUnit() == Vega_UnitType::nebula) { - continue; - } - double dist = (pos - un->LocalPosition()).Magnitude() - un->rSize() -/*def_un_size-*/ radial_size; - if (dist < 0) { - QVector delta = pos - un->LocalPosition(); - double mag = delta.Magnitude(); - if (mag > .01) { - delta = delta / mag; - } else { - delta.Set(0, 0, 1); + + QVector SafeStarSystemEntrancePoint(StarSystem *sts, QVector pos, float radial_size) { + if (radial_size < 0) { + radial_size = game_options()->respawn_unit_size; + } + for (unsigned int k = 0; k < 10; ++k) { + Unit *un; + bool collision = false; + { + //fixme, make me faster, use collide map + for (un_iter i = sts->getUnitList().createIterator(); (un = *i) != NULL; ++i) { + if (UnitUtil::isAsteroid(un) || un->isUnit() == Vega_UnitType::nebula) { + continue; } - delta = delta.Scale(dist + un->rSize() + radial_size); - if (k < 5) { - pos = pos + delta; - collision = true; - } else { - QVector r(.5, .5, .5); - pos += (radial_size + un->rSize()) * r; - collision = true; + double dist = (pos - un->LocalPosition()).Magnitude() - un->rSize() -/*def_un_size-*/ radial_size; + if (dist < 0) { + QVector delta = pos - un->LocalPosition(); + double mag = delta.Magnitude(); + if (mag > .01) { + delta = delta / mag; + } else { + delta.Set(0, 0, 1); + } + delta = delta.Scale(dist + un->rSize() + radial_size); + if (k < 5) { + pos = pos + delta; + collision = true; + } else { + QVector r(.5, .5, .5); + pos += (radial_size + un->rSize()) * r; + collision = true; + } } } - } - if (collision == false) { - break; + if (collision == false) { + break; + } } } - } - return pos; -} - -QVector SafeEntrancePoint(QVector pos, float radial_size) { - return SafeStarSystemEntrancePoint(_Universe->activeStarSystem(), pos, radial_size); -} - -Unit *launch(string name_string, - string type_string, - string faction_string, - string unittype, - string ai_string, - int nr_of_ships, - int nr_of_waves, - QVector pos, - string sqadlogo) { - return launchJumppoint(name_string, - faction_string, - type_string, - unittype, - ai_string, - nr_of_ships, - nr_of_waves, - pos, - sqadlogo, - ""); -} - -string LookupUnitStat(const string &unitname, const string &faction, const string &statname) { - const std::string unit_key = GetUnitKeyFromNameAndFaction(unitname, faction); + return pos; + } + + QVector SafeEntrancePoint(QVector pos, float radial_size) { + return SafeStarSystemEntrancePoint(_Universe->activeStarSystem(), pos, radial_size); + } + + Unit *launch(string name_string, + string type_string, + string faction_string, + string unittype, + string ai_string, + int nr_of_ships, + int nr_of_waves, + QVector pos, + string sqadlogo) { + return launchJumppoint(name_string, + faction_string, + type_string, + unittype, + ai_string, + nr_of_ships, + nr_of_waves, + pos, + sqadlogo, + ""); + } + + string LookupUnitStat(const string &unitname, const string &faction, const string &statname) { + const std::string unit_key = GetUnitKeyFromNameAndFaction(unitname, faction); + + // No Unit Key Found + if(unit_key.size() == 0) { + return unit_key; + } - // No Unit Key Found - if(unit_key.size() == 0) { - return unit_key; + return UnitCSVFactory::GetVariable(unit_key, statname, std::string()); } - return UnitCSVFactory::GetVariable(unit_key, statname, std::string()); -} - -static std::vector cachedUnits; + static std::vector cachedUnits; -void precacheUnit(string type_string, string faction_string) { - cachedUnits.push_back(new Unit(type_string.c_str(), true, FactionUtil::GetFactionIndex(faction_string))); -} + void precacheUnit(string type_string, string faction_string) { + cachedUnits.push_back(new Unit(type_string.c_str(), true, FactionUtil::GetFactionIndex(faction_string))); + } -Unit *getPlayer() { - return _Universe->AccessCockpit()->GetParent(); -} + Unit *getPlayer() { + return _Universe->AccessCockpit()->GetParent(); + } -bool networked() { - return false; -} + bool networked() { + return false; + } -bool isserver() { - return false; -} + bool isserver() { + return false; + } -void securepythonstr(string &message) { - std::replace(message.begin(), message.end(), '\'', '\"'); - std::replace(message.begin(), message.end(), '\\', '/'); - std::replace(message.begin(), message.end(), '\n', ' '); - std::replace(message.begin(), message.end(), '\r', ' '); -} + void securepythonstr(string &message) { + std::replace(message.begin(), message.end(), '\'', '\"'); + std::replace(message.begin(), message.end(), '\\', '/'); + std::replace(message.begin(), message.end(), '\n', ' '); + std::replace(message.begin(), message.end(), '\r', ' '); + } -void receivedCustom(int cp, bool trusted, string cmd, string args, string id) { - int cp_orig = _Universe->CurrentCockpit(); - _Universe->SetActiveCockpit(cp); - _Universe->pushActiveStarSystem(_Universe->AccessCockpit()->activeStarSystem); - securepythonstr(cmd); - securepythonstr(args); - securepythonstr(id); - string pythonCode = configuration()->general_config.custom_python + "(" + (trusted ? "True" : "False") - + ", r\'" + cmd + "\', r\'" + args + "\', r\'" + id + "\')\n"; - VS_LOG(info, "Executing python command: "); - VS_LOG(info, (boost::format(" %1%") % pythonCode)); - ::Python::reseterrors(); - VegaPyRunString(pythonCode); + void receivedCustom(int cp, bool trusted, string cmd, string args, string id) { + int cp_orig = _Universe->CurrentCockpit(); + _Universe->SetActiveCockpit(cp); + _Universe->pushActiveStarSystem(_Universe->AccessCockpit()->activeStarSystem); + securepythonstr(cmd); + securepythonstr(args); + securepythonstr(id); + string pythonCode = configuration()->general_config.custom_python + "(" + (trusted ? "True" : "False") + + ", r\'" + cmd + "\', r\'" + args + "\', r\'" + id + "\')\n"; + VS_LOG(info, "Executing python command: "); + VS_LOG(info, (boost::format(" %1%") % pythonCode)); + ::Python::reseterrors(); + VegaPyRunString(pythonCode); // ::Python::reseterrors(); - _Universe->popActiveStarSystem(); - _Universe->SetActiveCockpit(cp_orig); -} - -int getNumPlayers() { - return _Universe->numPlayers(); -} + _Universe->popActiveStarSystem(); + _Universe->SetActiveCockpit(cp_orig); + } -Unit *getPlayerX(int which) { - if (which >= getNumPlayers()) { - return NULL; + int getNumPlayers() { + return _Universe->numPlayers(); } - return _Universe->AccessCockpit(which)->GetParent(); -} -float getPlanetRadiusPercent() { - return game_options()->auto_pilot_planet_radius_percent; -} + Unit *getPlayerX(int which) { + if (which >= getNumPlayers()) { + return NULL; + } + return _Universe->AccessCockpit(which)->GetParent(); + } -std::string getVariable(std::string section, std::string name, std::string def) { - return vs_config->getVariable(section, name, def); -} + float getPlanetRadiusPercent() { + return game_options()->auto_pilot_planet_radius_percent; + } -std::string getSubVariable(std::string section, std::string subsection, std::string name, std::string def) { - return vs_config->getVariable(section, subsection, name, def); -} + std::string getVariable(std::string section, std::string name, std::string def) { + return vs_config->getVariable(section, name, def); + } -double timeofday() { - return getNewTime(); -} + std::string getSubVariable(std::string section, std::string subsection, std::string name, std::string def) { + return vs_config->getVariable(section, subsection, name, def); + } -double sqrt(double x) { - return ::sqrt(x); -} + double timeofday() { + return getNewTime(); + } -double log(double x) { - return ::log(x); -} + double sqrt(double x) { + return ::sqrt(x); + } -double exp(double x) { - return ::exp(x); -} + double log(double x) { + return ::log(x); + } -double cos(double x) { - return ::cos(x); -} + double exp(double x) { + return ::exp(x); + } -double sin(double x) { - return ::sin(x); -} + double cos(double x) { + return ::cos(x); + } -double acos(double x) { - return ::acos(x); -} + double sin(double x) { + return ::sin(x); + } -double asin(double x) { - return ::asin(x); -} + double acos(double x) { + return ::acos(x); + } -double atan(double x) { - return ::atan(x); -} + double asin(double x) { + return ::asin(x); + } -double tan(double x) { - return ::tan(x); -} + double atan(double x) { + return ::atan(x); + } -void micro_sleep(int n) { - ::micro_sleep(n); -} + double tan(double x) { + return ::tan(x); + } -string getSaveDir() { - return GetSaveDir(); -} + void micro_sleep(int n) { + ::micro_sleep(n); + } -static std::string simplePrettySystem(std::string system) { - std::string::size_type where = system.find_first_of('/'); - std::string::size_type basewhere = system.find_first_of('@', where); - return std::string("Sec:") + system.substr(0, where) - + " Sys:" + (where == string::npos ? std::string("") : system.substr(where + 1, - (basewhere != string::npos) ? basewhere - - where - 1 : string::npos)) - + (basewhere == string::npos ? std::string("") : std::string(" ") + system.substr(basewhere + 1)); -} + string getSaveDir() { + return GetSaveDir(); + } -static std::string simplePrettyShip(std::string ship) { - if (ship.length() > 0) { - ship[0] = toupper(ship[0]); + static std::string simplePrettySystem(std::string system) { + std::string::size_type where = system.find_first_of('/'); + std::string::size_type basewhere = system.find_first_of('@', where); + return std::string("Sec:") + system.substr(0, where) + + " Sys:" + (where == string::npos ? std::string("") : system.substr(where + 1, + (basewhere != string::npos) ? basewhere + - where - 1 : string::npos)) + + (basewhere == string::npos ? std::string("") : std::string(" ") + system.substr(basewhere + 1)); } - std::string::size_type where = ship.find("."); - if (where != string::npos) { - ship = ship.substr(0, where); - ship = "Refurbished " + ship; + + static std::string simplePrettyShip(std::string ship) { + if (ship.length() > 0) { + ship[0] = toupper(ship[0]); + } + std::string::size_type where = ship.find("."); + if (where != string::npos) { + ship = ship.substr(0, where); + ship = "Refurbished " + ship; + } + return ship; } - return ship; -} -string getSaveInfo(const std::string &filename, bool formatForTextbox) { - static SaveGame savegame(""); - static set campaign_score_vars; - static bool campaign_score_vars_init = false; - if (!campaign_score_vars_init) { - - string::size_type where = 0, when = game_options()->campaigns.find(' '); - while (where != string::npos) { - campaign_score_vars.insert(game_options()->campaigns - .substr(where, ((when == string::npos) ? when : when - where))); - where = (when == string::npos) ? when : when + 1; - when = game_options()->campaigns.find(' ', where); - } - campaign_score_vars_init = true; - } - std::string system; - std::string lf = (formatForTextbox ? "#n#" : "\n"); - QVector pos(0, 0, 0); - bool updatepos = false; - float creds; - vector Ships; - std::string sillytemp = UniverseUtil::setCurrentSaveGame(filename); - savegame.SetStarSystem(""); - savegame.ParseSaveGame(filename, - system, - "", - pos, - updatepos, - creds, - Ships, - _Universe->CurrentCockpit(), - "", - true, - false, - configuration()->general_config.quick_savegame_summaries, - true, - true, - campaign_score_vars); - UniverseUtil::setCurrentSaveGame(sillytemp); - std::ostringstream ss{}; - ss << "Savegame: " << filename << lf; - ss << "_________________" << lf; - try { - ss << "Saved on: "; - const boost::filesystem::path file_name_path{filename}; - const boost::filesystem::path save_dir_path{getSaveDir()}; - const boost::filesystem::path full_file_path{boost::filesystem::absolute(file_name_path, save_dir_path)}; - std::time_t last_saved_time{boost::filesystem::last_write_time(full_file_path)}; - boost::chrono::system_clock::time_point - last_saved_time_point{boost::chrono::system_clock::from_time_t(last_saved_time)}; - ss << boost::chrono::time_fmt(boost::chrono::timezone::local, "%c") - << last_saved_time_point - << lf; - } - catch (boost::filesystem::filesystem_error &fse) { - VS_LOG_AND_FLUSH(fatal, "boost::filesystem::filesystem_error encountered:"); - VS_LOG_AND_FLUSH(fatal, fse.what()); - VSExit(-6); - } - catch (std::exception &e) { - VS_LOG_AND_FLUSH(fatal, "std::exception encountered:"); - VS_LOG_AND_FLUSH(fatal, e.what()); - VSExit(-6); - } - catch (...) { - VS_LOG_AND_FLUSH(fatal, "unknown exception type encountered!"); - VSExit(-6); - } - ss << "Credits: " - << static_cast(creds) - << "." - << (static_cast(creds * 100) % 100) - << lf; - ss << simplePrettySystem(system) << lf; - if (Ships.size()) { - ss << "Starship: " << simplePrettyShip(Ships[0]) << lf; - if (Ships.size() > 2) { - ss << "Fleet:" << lf; - for (size_t i = 2; i < Ships.size(); i += 2) { - ss << " " << simplePrettyShip(Ships[i - 1]) << lf; - ss << " Located At:" << lf; - ss << " " << simplePrettySystem(Ships[i]) << lf; + string getSaveInfo(const std::string &filename, bool formatForTextbox) { + static SaveGame savegame(""); + static set campaign_score_vars; + static bool campaign_score_vars_init = false; + if (!campaign_score_vars_init) { + + string::size_type where = 0, when = game_options()->campaigns.find(' '); + while (where != string::npos) { + campaign_score_vars.insert(game_options()->campaigns + .substr(where, ((when == string::npos) ? when : when - where))); + where = (when == string::npos) ? when : when + 1; + when = game_options()->campaigns.find(' ', where); } + campaign_score_vars_init = true; } - } - if (!configuration()->general_config.quick_savegame_summaries) { - bool hit = false; - for (set::const_iterator it = campaign_score_vars.begin(); it != campaign_score_vars.end(); ++it) { - string var = *it; - int64_t curscore = savegame.getMissionData(var).size() + savegame.getMissionStringData(var).size(); - if (curscore > 0) { - hit = true; - if (var.length() > 0) { - var[0] = toupper(var[0]); + std::string system; + std::string lf = (formatForTextbox ? "#n#" : "\n"); + QVector pos(0, 0, 0); + bool updatepos = false; + float creds; + vector Ships; + std::string sillytemp = UniverseUtil::setCurrentSaveGame(filename); + savegame.SetStarSystem(""); + savegame.ParseSaveGame(filename, + system, + "", + pos, + updatepos, + creds, + Ships, + _Universe->CurrentCockpit(), + "", + true, + false, + configuration()->general_config.quick_savegame_summaries, + true, + true, + campaign_score_vars); + UniverseUtil::setCurrentSaveGame(sillytemp); + std::ostringstream ss{}; + ss << "Savegame: " << filename << lf; + ss << "_________________" << lf; + try { + ss << "Saved on: "; + const boost::filesystem::path file_name_path{filename}; + const boost::filesystem::path save_dir_path{getSaveDir()}; + const boost::filesystem::path full_file_path{boost::filesystem::absolute(file_name_path, save_dir_path)}; + std::time_t last_saved_time{boost::filesystem::last_write_time(full_file_path)}; + boost::chrono::system_clock::time_point + last_saved_time_point{boost::chrono::system_clock::from_time_t(last_saved_time)}; + ss << boost::chrono::time_fmt(boost::chrono::timezone::local, "%c") + << last_saved_time_point + << lf; + } + catch (boost::filesystem::filesystem_error &fse) { + VS_LOG_AND_FLUSH(fatal, "boost::filesystem::filesystem_error encountered:"); + VS_LOG_AND_FLUSH(fatal, fse.what()); + VSExit(-6); + } + catch (std::exception &e) { + VS_LOG_AND_FLUSH(fatal, "std::exception encountered:"); + VS_LOG_AND_FLUSH(fatal, e.what()); + VSExit(-6); + } + catch (...) { + VS_LOG_AND_FLUSH(fatal, "unknown exception type encountered!"); + VSExit(-6); + } + ss << "Credits: " + << static_cast(creds) + << "." + << (static_cast(creds * 100) % 100) + << lf; + ss << simplePrettySystem(system) << lf; + if (Ships.size()) { + ss << "Starship: " << simplePrettyShip(Ships[0]) << lf; + if (Ships.size() > 2) { + ss << "Fleet:" << lf; + for (size_t i = 2; i < Ships.size(); i += 2) { + ss << " " << simplePrettyShip(Ships[i - 1]) << lf; + ss << " Located At:" << lf; + ss << " " << simplePrettySystem(Ships[i]) << lf; } - ss << var.substr(0, var.find("_")) + " Campaign Score: " << curscore << lf; } } - if (!hit) { - ss << "Campaign Score: 0" << lf; + if (!configuration()->general_config.quick_savegame_summaries) { + bool hit = false; + for (set::const_iterator it = campaign_score_vars.begin(); it != campaign_score_vars.end(); ++it) { + string var = *it; + int64_t curscore = savegame.getMissionData(var).size() + savegame.getMissionStringData(var).size(); + if (curscore > 0) { + hit = true; + if (var.length() > 0) { + var[0] = toupper(var[0]); + } + ss << var.substr(0, var.find("_")) + " Campaign Score: " << curscore << lf; + } + } + if (!hit) { + ss << "Campaign Score: 0" << lf; + } } + const std::string ret_val{ss.str()}; + return ret_val; } - const std::string ret_val{ss.str()}; - return ret_val; -} -string getCurrentSaveGame() { - return GetCurrentSaveGame(); -} + string getCurrentSaveGame() { + return GetCurrentSaveGame(); + } -string setCurrentSaveGame(const string &newsave) { - return SetCurrentSaveGame(newsave); -} + string setCurrentSaveGame(const string &newsave) { + return SetCurrentSaveGame(newsave); + } -string getNewGameSaveName() { - static string ngsn("New_Game"); - return ngsn; -} + string getNewGameSaveName() { + static string ngsn("New_Game"); + return ngsn; + } -vector GetJumpPath(string from, string to) { - vector path; - _Universe->getJumpPath(from, to, path); - return path; -} + vector GetJumpPath(string from, string to) { + vector path; + _Universe->getJumpPath(from, to, path); + return path; + } } diff --git a/engine/src/vega_py_run.cpp b/engine/src/vega_py_run.cpp index bb8578a8c0..de89793701 100644 --- a/engine/src/vega_py_run.cpp +++ b/engine/src/vega_py_run.cpp @@ -1,7 +1,7 @@ /* * vega_py_run.cpp * - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -22,6 +22,7 @@ * along with Vega Strike. If not, see . */ +#define PY_SSIZE_T_CLEAN #include #include #include @@ -37,9 +38,9 @@ void VegaPyRunString(const std::string &py_snippet) { } void VegaPyRunString(char *py_snippet) { -#if defined(_WINDOWS) && defined(_DEBUG) - VS_LOG(important_info, (boost::format("Debug mode on Windows; not running %1%") % py_snippet)); -#else +//#if defined(_WINDOWS) && defined(_DEBUG) +// VS_LOG(important_info, (boost::format("Debug mode on Windows; not running %1%") % py_snippet)); +//#else VS_LOG(important_info, (boost::format("running %1%") % py_snippet)); PyRun_SimpleString(py_snippet); //Python::reseterrors(); @@ -49,5 +50,5 @@ void VegaPyRunString(char *py_snippet) { PyErr_Clear(); VegaStrikeLogging::vega_logger()->FlushLogs(); } -#endif +//#endif } From e2af41aa571f8309445a82f8ceaa8a9d8d1b3e4f Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sun, 18 Jun 2023 18:12:15 -0700 Subject: [PATCH 15/31] updates to 13 more .cpp and .h files --- engine/src/cmd/music.cpp | 7 ++--- engine/src/cmd/script/director.cpp | 3 +- engine/src/cmd/script/director_generic.cpp | 6 ++-- engine/src/cmd/script/director_server.cpp | 24 ++++++++-------- engine/src/cmd/script/mission.cpp | 5 +++- engine/src/cmd/script/pythonmission.cpp | 6 ++-- engine/src/cmd/script/script_call_unit.cpp | 9 +++--- engine/src/cmd/script/script_callbacks.cpp | 32 +++++++++++++--------- engine/src/cmd/unit_generic.cpp | 5 +++- engine/src/cmd/unit_util_generic.cpp | 4 +-- engine/src/command.cpp | 5 +++- engine/src/config_xml.cpp | 5 +++- engine/src/gfx/ani_texture.h | 28 +++++++++++-------- 13 files changed, 81 insertions(+), 58 deletions(-) diff --git a/engine/src/cmd/music.cpp b/engine/src/cmd/music.cpp index db37e45d0f..59dcecb853 100644 --- a/engine/src/cmd/music.cpp +++ b/engine/src/cmd/music.cpp @@ -1,10 +1,8 @@ /* * music.cpp * - * Copyright (C) 2001-2019 Daniel Horn and other Vega Strike contributors - * Copyright (C) 2020-2021 pyramid3d, Stephen G. Tuggy, Evert Vorster, - * and other Vega Strike contributors - * Copyright (C) 2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Evert Vorster, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -25,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include #include diff --git a/engine/src/cmd/script/director.cpp b/engine/src/cmd/script/director.cpp index 38f81593c2..ee3f449431 100644 --- a/engine/src/cmd/script/director.cpp +++ b/engine/src/cmd/script/director.cpp @@ -1,7 +1,7 @@ /* * director.cpp * - * Copyright (C) 2001-2022 Daniel Horn, Alexander Rawass, pyramid3d, + * Copyright (C) 2001-2023 Daniel Horn, Alexander Rawass, pyramid3d, * Stephen G. Tuggy, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -26,6 +26,7 @@ /* * xml Mission Scripting written by Alexander Rawass */ +#define PY_SSIZE_T_CLEAN #include #include #include "python/python_class.h" diff --git a/engine/src/cmd/script/director_generic.cpp b/engine/src/cmd/script/director_generic.cpp index 8058b5003a..8b7c80d29e 100644 --- a/engine/src/cmd/script/director_generic.cpp +++ b/engine/src/cmd/script/director_generic.cpp @@ -1,9 +1,8 @@ /* * director_generic.cpp * - * Copyright (C) 2020 pyramid3d, Nachum Barcohen, Roy Falk, Stephen G. Tuggy, - * and other Vega Strike contributors. - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Nachum Barcohen, Roy Falk, + * Stephen G. Tuggy, and other Vega Strike contributors. * * This file is part of Vega Strike. * @@ -22,6 +21,7 @@ */ +#define PY_SSIZE_T_CLEAN #ifdef HAVE_PYTHON #include #include diff --git a/engine/src/cmd/script/director_server.cpp b/engine/src/cmd/script/director_server.cpp index 399f84a9f0..abeb8ab165 100644 --- a/engine/src/cmd/script/director_server.cpp +++ b/engine/src/cmd/script/director_server.cpp @@ -1,28 +1,30 @@ /* - * Vega Strike - * Copyright (C) 2001-2002 Daniel Horn - * Copyright (C) 2022 Stephen G. Tuggy + * director_server.cpp * - * http://vegastrike.sourceforge.net/ + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Nachum Barcohen, klausfreire, + * dan_w, safemode, ace123, balloyd1, khepri, surfdargent, Stephen G. Tuggy, + * and other Vega Strike contributors. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This file is part of Vega Strike. * - * This program is distributed in the hope that it will be useful, + * Vega Strike is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Vega Strike 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with Vega Strike. If not, see . */ /* * xml Mission Scripting written by Alexander Rawass */ +#define PY_SSIZE_T_CLEAN #include "python/python_class.h" #include #include diff --git a/engine/src/cmd/script/mission.cpp b/engine/src/cmd/script/mission.cpp index 19c50ecfe5..68d9f29c08 100644 --- a/engine/src/cmd/script/mission.cpp +++ b/engine/src/cmd/script/mission.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, Alexander Rawass, pyramid3d, + * mission.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, Alexander Rawass, pyramid3d, * Stephen G. Tuggy, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -24,6 +26,7 @@ /* * xml Mission written by Alexander Rawass */ +#define PY_SSIZE_T_CLEAN #include #include #include diff --git a/engine/src/cmd/script/pythonmission.cpp b/engine/src/cmd/script/pythonmission.cpp index c1b9eb9e7f..8689e5ccb7 100644 --- a/engine/src/cmd/script/pythonmission.cpp +++ b/engine/src/cmd/script/pythonmission.cpp @@ -1,9 +1,8 @@ /* * pythonmission.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -24,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include #include diff --git a/engine/src/cmd/script/script_call_unit.cpp b/engine/src/cmd/script/script_call_unit.cpp index 9eb3cd9c99..4eaa2b41f1 100644 --- a/engine/src/cmd/script/script_call_unit.cpp +++ b/engine/src/cmd/script/script_call_unit.cpp @@ -1,10 +1,8 @@ -/** +/* * script_call_unit.cpp * - * Copyright (c) 2001-2002 Daniel Horn - * Copyright (c) 2002-2019 pyramid3d and other Vega Strike Contributors - * Copyright (c) 2019-2021 Stephen G. Tuggy, and other Vega Strike Contributors - * Copyright (C) 2022 Stephen G. Tuggy + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike Contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -25,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include diff --git a/engine/src/cmd/script/script_callbacks.cpp b/engine/src/cmd/script/script_callbacks.cpp index 29b910f123..956aa01668 100644 --- a/engine/src/cmd/script/script_callbacks.cpp +++ b/engine/src/cmd/script/script_callbacks.cpp @@ -1,30 +1,36 @@ -/// Parses functions for python modules -/// /* - * Vega Strike - * Copyright (C) 2001-2002 Daniel Horn - * Copyright (C) 2022 Stephen G. Tuggy + * script_callbacks.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, alexannika, ace123, surfdargent, + * khepri, klaussfriere, pyramid3d, dan_w, pheonixstorm, Roy Falk, + * Stephen G. Tuggy, and other Vega Strike Contributors * - * http://vegastrike.sourceforge.net/ + * https://github.com/vegastrike/Vega-Strike-Engine-Source * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This file is part of Vega Strike. * - * This program is distributed in the hope that it will be useful, + * Vega Strike is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Vega Strike 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with Vega Strike. If not, see . */ + /* * xml Mission Scripting written by Alexander Rawass */ + +/// Parses functions for python modules + +#define PY_SSIZE_T_CLEAN #include #include #include diff --git a/engine/src/cmd/unit_generic.cpp b/engine/src/cmd/unit_generic.cpp index 410f02f861..d540bdfb82 100644 --- a/engine/src/cmd/unit_generic.cpp +++ b/engine/src/cmd/unit_generic.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * unit_generic.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -22,6 +24,7 @@ // -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- +#define PY_SSIZE_T_CLEAN #include "unit_generic.h" #include diff --git a/engine/src/cmd/unit_util_generic.cpp b/engine/src/cmd/unit_util_generic.cpp index a234047c76..cc987dca3a 100644 --- a/engine/src/cmd/unit_util_generic.cpp +++ b/engine/src/cmd/unit_util_generic.cpp @@ -1,9 +1,8 @@ /* * unit_util_generic.cpp * - * Copyright (C) 2020 pyramid3d, Roy Falk, Stephen G. Tuggy, + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Roy Falk, Stephen G. Tuggy, * and other Vega Strike contributors. - * Copyright (C) 2021-2022 Stephen G. Tuggy * * This file is part of Vega Strike. * @@ -22,6 +21,7 @@ */ +#define PY_SSIZE_T_CLEAN #include #include "cmd/unit_generic.h" #include "cmd/unit_util.h" diff --git a/engine/src/command.cpp b/engine/src/command.cpp index fda3a2a304..6ef02c4ec1 100644 --- a/engine/src/command.cpp +++ b/engine/src/command.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Nachum Barcohen, + * command.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Nachum Barcohen, * Stephen G. Tuggy, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -21,6 +23,7 @@ */ +#define PY_SSIZE_T_CLEAN #include "command.h" #include #include diff --git a/engine/src/config_xml.cpp b/engine/src/config_xml.cpp index a8359323f0..2921f3345d 100644 --- a/engine/src/config_xml.cpp +++ b/engine/src/config_xml.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, Alexander Rawass, pyramid3d, + * config_xml.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, Alexander Rawass, pyramid3d, * Stephen G. Tuggy, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -24,6 +26,7 @@ * xml Configuration written by Alexander Rawass */ +#define PY_SSIZE_T_CLEAN #include #include "xml_support.h" #include "vegastrike.h" diff --git a/engine/src/gfx/ani_texture.h b/engine/src/gfx/ani_texture.h index dbaf082db7..e4c74a7fae 100644 --- a/engine/src/gfx/ani_texture.h +++ b/engine/src/gfx/ani_texture.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * ani_texture.h + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -19,6 +21,8 @@ * You should have received a copy of the GNU General Public License * along with Vega Strike. If not, see . */ + + #ifndef VEGA_STRIKE_ENGINE_GFX_ANI_TEXTURE_H #define VEGA_STRIKE_ENGINE_GFX_ANI_TEXTURE_H @@ -130,27 +134,27 @@ class AnimatedTexture : public Texture { void Destroy(); - virtual const Texture *Original() const; + const Texture *Original() const override; - virtual Texture *Original(); + Texture *Original() override; - ~AnimatedTexture(); + ~AnimatedTexture() override; - virtual Texture *Clone(); + Texture *Clone() override; - virtual void MakeActive() { + void MakeActive() override { MakeActive(texstage, 0); } //MSVC bug seems to hide MakeActive() if we define MakeActive(int,int) - the suckers! - virtual void MakeActive(int stage) { + void MakeActive(int stage) override { MakeActive(stage, 0); } //MSVC bug seems to hide MakeActive(int) if we define MakeActive(int,int) - the suckers! - virtual void MakeActive(int stage, int pass); + void MakeActive(int stage, int pass) override; - bool SetupPass(int pass, int stage, const enum BLENDFUNC src, const enum BLENDFUNC dst); + bool SetupPass(int pass, int stage, const enum BLENDFUNC src, const enum BLENDFUNC dst) override; - bool SetupPass(int pass, const enum BLENDFUNC src, const enum BLENDFUNC dst) { + bool SetupPass(int pass, const enum BLENDFUNC src, const enum BLENDFUNC dst) override { return SetupPass(pass, texstage, src, dst); } @@ -203,7 +207,7 @@ class AnimatedTexture : public Texture { bool Done() const; - virtual bool LoadSuccess(); + bool LoadSuccess() override; //Some useful factory methods -- also defined in ani_texture.cpp static AnimatedTexture *CreateVideoTexture(const std::string &fname, From 6c5853ddfea99888468ef6e0a56115902457d5c2 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 24 Jun 2023 17:08:29 -0700 Subject: [PATCH 16/31] CMakeLists.txt: Only set BOOST_USE_WINAPI_VERSION, etc. on Windows --- engine/CMakeLists.txt | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index ae3d25e1d4..6155a59890 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -793,9 +793,11 @@ IF (NEED_LINKING_AGAINST_LIBM) TARGET_LINK_LIBRARIES(vegastrike-OPcollide m) ENDIF() target_compile_definitions(vegastrike-OPcollide PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") -target_compile_definitions(vegastrike-OPcollide PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) -target_compile_definitions(vegastrike-OPcollide PUBLIC _WIN32_WINNT=0x0A00) -target_compile_definitions(vegastrike-OPcollide PUBLIC WINVER=0x0A00) +IF (WIN32) + target_compile_definitions(vegastrike-OPcollide PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vegastrike-OPcollide PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vegastrike-OPcollide PUBLIC WINVER=0x0A00) +ENDIF() SET(LIBCMD_SOURCES src/cmd/alphacurve.cpp @@ -1079,9 +1081,11 @@ IF (NEED_LINKING_AGAINST_LIBM) TARGET_LINK_LIBRARIES(vegastrike-engine_com m) ENDIF() target_compile_definitions(vegastrike-engine_com PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") -target_compile_definitions(vegastrike-engine_com PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) -target_compile_definitions(vegastrike-engine_com PUBLIC _WIN32_WINNT=0x0A00) -target_compile_definitions(vegastrike-engine_com PUBLIC WINVER=0x0A00) +IF (WIN32) + target_compile_definitions(vegastrike-engine_com PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vegastrike-engine_com PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vegastrike-engine_com PUBLIC WINVER=0x0A00) +ENDIF() SET(VEGASTRIKE_SOURCES ${LIBGUI_SOURCES} @@ -1163,9 +1167,11 @@ IF (NOT DISABLE_CLIENT) TARGET_LINK_LIBRARIES(vegastrike-engine m) ENDIF() target_compile_definitions(vegastrike-engine PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") - target_compile_definitions(vegastrike-engine PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) - target_compile_definitions(vegastrike-engine PUBLIC _WIN32_WINNT=0x0A00) - target_compile_definitions(vegastrike-engine PUBLIC WINVER=0x0A00) + IF (WIN32) + target_compile_definitions(vegastrike-engine PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vegastrike-engine PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vegastrike-engine PUBLIC WINVER=0x0A00) + ENDIF() ADD_DEPENDENCIES(vegastrike-engine OpenGL::GL OpenGL::GLU) @@ -1644,9 +1650,11 @@ IF (USE_GTEST) ${LIBVS_LOGGING} ) target_compile_definitions(vegastrike-testing PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") - target_compile_definitions(vegastrike-testing PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) - target_compile_definitions(vegastrike-testing PUBLIC _WIN32_WINNT=0x0A00) - target_compile_definitions(vegastrike-testing PUBLIC WINVER=0x0A00) + IF (WIN32) + target_compile_definitions(vegastrike-testing PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vegastrike-testing PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vegastrike-testing PUBLIC WINVER=0x0A00) + ENDIF() TARGET_LINK_LIBRARIES( ${TEST_NAME} @@ -1656,9 +1664,11 @@ IF (USE_GTEST) Boost::log_setup ) target_compile_definitions(${TEST_NAME} PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") - target_compile_definitions(${TEST_NAME} PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) - target_compile_definitions(${TEST_NAME} PUBLIC _WIN32_WINNT=0x0A00) - target_compile_definitions(${TEST_NAME} PUBLIC WINVER=0x0A00) + IF (WIN32) + target_compile_definitions(${TEST_NAME} PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(${TEST_NAME} PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(${TEST_NAME} PUBLIC WINVER=0x0A00) + ENDIF() FILE( COPY "src/configuration/tests/vegastrike.config" From 690ddd6429d159d54c42be6a8289d4fcf98ccaef Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sun, 9 Jul 2023 17:52:33 -0700 Subject: [PATCH 17/31] 6 copies of CMakeLists.txt: Troubleshooting Position-Independent Code; copyleft updates; etc. --- doc/CMakeLists.txt | 6 +++--- doc/man/CMakeLists.txt | 6 +++--- engine/CMakeLists.txt | 10 ++++++++-- engine/objconv/CMakeLists.txt | 30 +++++++++++++++++++++++++--- engine/objconv/mesher/CMakeLists.txt | 15 +++++++++----- engine/setup/CMakeLists.txt | 7 ++++--- 6 files changed, 55 insertions(+), 19 deletions(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 4ade40ef91..cf8bf597f6 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,8 +1,8 @@ ## # CMakeLists.txt # -# Copyright (c) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, -# Benjamen Meyer, and other Vega Strike contributors +# Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +# Benjamen R. Meyer, and other Vega Strike contributors # # https://github.com/vegastrike/Vega-Strike-Engine-Source # @@ -15,7 +15,7 @@ # # Vega Strike 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 +# 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 diff --git a/doc/man/CMakeLists.txt b/doc/man/CMakeLists.txt index b780525fba..e694498c63 100644 --- a/doc/man/CMakeLists.txt +++ b/doc/man/CMakeLists.txt @@ -1,8 +1,8 @@ ## # CMakeLists.txt # -# Copyright (c) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, -# Benjamen Meyer, and other Vega Strike contributors +# Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +# Benjamen R. Meyer, and other Vega Strike contributors # # https://github.com/vegastrike/Vega-Strike-Engine-Source # @@ -15,7 +15,7 @@ # # Vega Strike 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 +# 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 diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 6155a59890..72fa307ddd 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -24,11 +24,11 @@ # # Vega Strike 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 +# 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 Vega Strike. If not, see . +# along with Vega Strike. If not, see . CMAKE_MINIMUM_REQUIRED(VERSION 3.16 FATAL_ERROR) @@ -268,6 +268,9 @@ ENDIF (DATADIR) # OPTION(ENABLE_PIE "Enable Position Independent Executables/Shared Libraries (NOT RECOMMENDED on Ubuntu/Mint)" OFF) MESSAGE("-- Always using preferred PIE logic now") + +include(CheckPIESupported) +check_pie_supported() UNSET(CMAKE_POSITION_INDEPENDENT_CODE) IF (ENABLE_PIE) MESSAGE("!! Enabling Position Independent Executables/Shared Libraries (NOT RECOMMENDED on Ubuntu/Mint) !!") @@ -789,6 +792,7 @@ ADD_LIBRARY(vegastrike-OPcollide ) TARGET_COMPILE_FEATURES(vegastrike-OPcollide PUBLIC cxx_std_11) +set_property(TARGET vegastrike-OPcollide PROPERTY POSITION_INDEPENDENT_CODE TRUE) IF (NEED_LINKING_AGAINST_LIBM) TARGET_LINK_LIBRARIES(vegastrike-OPcollide m) ENDIF() @@ -1077,6 +1081,7 @@ ADD_LIBRARY(vegastrike-engine_com ) TARGET_COMPILE_FEATURES(vegastrike-engine_com PUBLIC cxx_std_11) +set_property(TARGET vegastrike-engine_com PROPERTY POSITION_INDEPENDENT_CODE TRUE) IF (NEED_LINKING_AGAINST_LIBM) TARGET_LINK_LIBRARIES(vegastrike-engine_com m) ENDIF() @@ -1650,6 +1655,7 @@ IF (USE_GTEST) ${LIBVS_LOGGING} ) target_compile_definitions(vegastrike-testing PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") + set_property(TARGET vegastrike-testing PROPERTY POSITION_INDEPENDENT_CODE TRUE) IF (WIN32) target_compile_definitions(vegastrike-testing PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) target_compile_definitions(vegastrike-testing PUBLIC _WIN32_WINNT=0x0A00) diff --git a/engine/objconv/CMakeLists.txt b/engine/objconv/CMakeLists.txt index c1a8588a27..8170d5bbfc 100644 --- a/engine/objconv/CMakeLists.txt +++ b/engine/objconv/CMakeLists.txt @@ -1,8 +1,8 @@ ## # CMakeLists.txt # -# Copyright (c) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, -# Benjamen Meyer, and other Vega Strike contributors +# Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +# Benjamen R. Meyer, and other Vega Strike contributors # # https://github.com/vegastrike/Vega-Strike-Engine-Source # @@ -15,7 +15,7 @@ # # Vega Strike 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 +# 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 @@ -29,12 +29,30 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.16 FATAL_ERROR) INCLUDE_DIRECTORIES("..") SET(TRISORT_SOURCES trisort.cpp) ADD_EXECUTABLE(vs-buildenv-trisort ${TRISORT_SOURCES}) +target_compile_definitions(vs-buildenv-trisort PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +IF (WIN32) + target_compile_definitions(vs-buildenv-trisort PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vs-buildenv-trisort PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vs-buildenv-trisort PUBLIC WINVER=0x0A00) +ENDIF() SET(ASTEROID_SOURCES asteroidgen.cpp) ADD_EXECUTABLE(vs-buildenv-asteroidgen ${ASTEROID_SOURCES}) +target_compile_definitions(vs-buildenv-asteroidgen PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +IF (WIN32) + target_compile_definitions(vs-buildenv-asteroidgen PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vs-buildenv-asteroidgen PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vs-buildenv-asteroidgen PUBLIC WINVER=0x0A00) +ENDIF() SET(REPLACE_SOURCES replace.cpp) ADD_EXECUTABLE(vs-buildenv-replace ${REPLACE_SOURCES}) +target_compile_definitions(vs-buildenv-replace PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +IF (WIN32) + target_compile_definitions(vs-buildenv-replace PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vs-buildenv-replace PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vs-buildenv-replace PUBLIC WINVER=0x0A00) +ENDIF() #find Expat FIND_PACKAGE(EXPAT REQUIRED) @@ -76,6 +94,12 @@ SET(MESHER_SOURCES INCLUDE_DIRECTORIES(${MSH_INCLUDES} mesher) ADD_EXECUTABLE(vega-meshtool ${MESHER_SOURCES}) +target_compile_definitions(vega-meshtool PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +IF (WIN32) + target_compile_definitions(vega-meshtool PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vega-meshtool PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vega-meshtool PUBLIC WINVER=0x0A00) +ENDIF() # OGRE already looked for by parent # USE_SYSTEM_BOOST already set by main script diff --git a/engine/objconv/mesher/CMakeLists.txt b/engine/objconv/mesher/CMakeLists.txt index bf0c64204b..0ecbddf070 100644 --- a/engine/objconv/mesher/CMakeLists.txt +++ b/engine/objconv/mesher/CMakeLists.txt @@ -1,9 +1,8 @@ ## # CMakeLists.txt # -# Copyright (c) 2001-2002 Daniel Horn -# Copyright (c) 2002-2019 pyramid3d and other Vega Strike Contributors -# Copyright (c) 2019-2021 Stephen G. Tuggy, and other Vega Strike Contributors +# Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +# Benjamen R. Meyer, and other Vega Strike contributors # # https://github.com/vegastrike/Vega-Strike-Engine-Source # @@ -16,7 +15,7 @@ # # Vega Strike 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 +# 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 @@ -50,10 +49,16 @@ IF (EXPAT_FOUND) #if have OGRE to_OgreMesh.cpp ADD_EXECUTABLE(mesher ${MESHER_SOURCES}) + target_compile_definitions(mesher PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") + IF (WIN32) + target_compile_definitions(mesher PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(mesher PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(mesher PUBLIC WINVER=0x0A00) + ENDIF() # OGRE already looked for by parent # USE_SYSTEM_BOOST already set by main script - MESSAGE("-- ${OGRE_FOUND} ${USE_SYSTEM_BOOST}" + MESSAGE("-- ${OGRE_FOUND} ${USE_SYSTEM_BOOST}") IF (OGRE_FOUND AND NOT USE_SYSTEM_BOOST) # Ogre usage in mesher requires boost::system ADD_DEPENDENCIES(mesher boost_system) diff --git a/engine/setup/CMakeLists.txt b/engine/setup/CMakeLists.txt index 652bf207ec..09b4b6a0f1 100644 --- a/engine/setup/CMakeLists.txt +++ b/engine/setup/CMakeLists.txt @@ -1,8 +1,8 @@ ## # CMakeLists.txt # -# Copyright (c) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, -# Benjamen Meyer, and other Vega Strike contributors +# Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +# Benjamen R. Meyer, and other Vega Strike contributors # # https://github.com/vegastrike/Vega-Strike-Engine-Source # @@ -15,7 +15,7 @@ # # Vega Strike 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 +# 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 @@ -38,6 +38,7 @@ IF ((NOT BEOS) AND (NOT WIN32)) ) ADD_EXECUTABLE(vegasettings ${VEGASETTINGS_SOURCES}) + target_compile_definitions(vegasettings PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") INSTALL(TARGETS vegasettings DESTINATION bin) From 4b115c01cb40f182875f13484bf2aea660473f0a Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sun, 9 Jul 2023 17:53:14 -0700 Subject: [PATCH 18/31] LICENSE, cmake-config.h.in: Copyleft updates --- LICENSE | 5 ++--- engine/cmake-config.h.in | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/LICENSE b/LICENSE index 2b9d063a9b..1f787aa147 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,6 @@ Vega Strike - Space Simulation, Combat and Trading -Copyright (c) 2001-2002 Daniel Horn -Copyright (c) 2002-2019 pyramid3d and other Vega Strike Contributors -Copyright (c) 2019-2021 Stephen G. Tuggy, and other Vega Strike Contributors +Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +Roy Falk, Benjamen R. Meyer, and other Vega Strike Contributors GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 diff --git a/engine/cmake-config.h.in b/engine/cmake-config.h.in index 95b7be8175..6ff6f3c3ef 100644 --- a/engine/cmake-config.h.in +++ b/engine/cmake-config.h.in @@ -1,9 +1,8 @@ /** * cmake-config.h.in * -* Copyright (c) 2001-2002 Daniel Horn -* Copyright (c) 2002-2019 pyramid3d and other Vega Strike Contributors -* Copyright (c) 2019-2023 Stephen G. Tuggy, Benjamen R. Meyer, and other Vega Strike Contributors +* Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +* Benjamen R. Meyer, and other Vega Strike Contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -16,7 +15,7 @@ * * Vega Strike 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 +* 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 From 3ea80711443c6a8e74fb5412b6fefee4c26d4ef1 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sun, 9 Jul 2023 17:56:03 -0700 Subject: [PATCH 19/31] cmake-config.h.in: Reformat copyleft header block --- engine/cmake-config.h.in | 46 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/engine/cmake-config.h.in b/engine/cmake-config.h.in index 6ff6f3c3ef..fcf514aca9 100644 --- a/engine/cmake-config.h.in +++ b/engine/cmake-config.h.in @@ -1,26 +1,26 @@ -/** -* cmake-config.h.in -* -* Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, -* Benjamen R. Meyer, and other Vega Strike Contributors -* -* https://github.com/vegastrike/Vega-Strike-Engine-Source -* -* This file is part of Vega Strike. -* -* Vega Strike is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 2 of the License, or -* (at your option) any later version. -* -* Vega Strike 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 Vega Strike. If not, see . -*/ +/* + * cmake-config.h.in + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike Contributors + * + * https://github.com/vegastrike/Vega-Strike-Engine-Source + * + * This file is part of Vega Strike. + * + * Vega Strike is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Vega Strike 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 Vega Strike. If not, see . + */ #ifndef _CONFIG_H_ #define _CONFIG_H_ From 988a2574d2a51d29c12aa1214ca8ab78338ecbe5 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sun, 9 Jul 2023 19:28:26 -0700 Subject: [PATCH 20/31] CMakeLists.txt: Omit `APPEND` clause from `INCLUDE_DIRECTORIES` statements --- engine/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 72fa307ddd..8ef160e742 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -635,8 +635,8 @@ CONFIGURE_FILE(${Vega_Strike_SOURCE_DIR}/cmake-config.h.in ${Vega_Strike_BINARY_ #end config.h generation -INCLUDE_DIRECTORIES(APPEND ${TST_INCLUDES}) -include_directories(APPEND ${CMAKE_CURRENT_BINARY_DIR}) +INCLUDE_DIRECTORIES(${TST_INCLUDES}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_compile_options("$<$,$,$>:-include>" "$<$,$,$>:config.h>") add_link_options("$<$,$,$>:-Bsymbolic>") From dc9e179826ba1a4a6510aa609a0d4b5acfe84f01 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 15 Jul 2023 17:55:56 -0700 Subject: [PATCH 21/31] engine/CMakeLists.txt, CMakePresets.json: Replicate latest changes from corresponding pr-754 branch --- engine/CMakeLists.txt | 91 ++++++++++++++++++++++++++++++---------- engine/CMakePresets.json | 8 +++- 2 files changed, 76 insertions(+), 23 deletions(-) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 8ef160e742..d258a281da 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -78,6 +78,45 @@ ENDIF () # If a release is missing this value, then version `1` can be assumed. SET(VEGASTRIKE_ASSETS_API_VERSION "2") +#IF (COMMAND cmake_policy) +# CMAKE_POLICY (SET CMP0003 NEW) +#ENDIF (COMMAND cmake_policy) +# +## VERSION Policy +#IF (POLICY CMP0048) +# CMAKE_POLICY (SET CMP0048 NEW) +#ENDIF (POLICY CMP0048) +# +## Used to be that without this, CMake couldn't find pow() -- at least not on my Windows machine. +#IF (POLICY CMP0066) +# CMAKE_POLICY (SET CMP0066 NEW) +#ENDIF () +# +## FindOpenGL prefers GLVND by default when available. But there is an option to override that. +#IF (POLICY CMP0072) +# CMAKE_POLICY (SET CMP0072 NEW) +#ENDIF (POLICY CMP0072) +# +## find_package() uses _ROOT variables +#IF (POLICY CMP0074) +# CMAKE_POLICY (SET CMP0074 NEW) +#ENDIF (POLICY CMP0074) +# +## Include file check macros honor CMAKE_REQUIRED_LIBRARIES +#IF (POLICY CMP0075) +# CMAKE_POLICY (SET CMP0075 NEW) +#ENDIF () +# +## Concerning link time flags for turning on or off Position Independent Executables (PIE) +#IF (POLICY CMP0083) +# CMAKE_POLICY (SET CMP0083 NEW) +#ENDIF () +# +## MSVC runtime library flags are selected by an abstraction. Supported by CMake 3.15 and up +#IF (POLICY CMP0091) +# CMAKE_POLICY (SET CMP0091 NEW) +#ENDIF () + PROJECT(Vega_Strike VERSION "${VEGASTRIKE_VERSION_MAJOR}.${VEGASTRIKE_VERSION_MINOR}.${VEGASTRIKE_VERSION_PATCH}" #.${VEGASTRIKE_VERSION_TWEAK} # CMake only allows numeric version components, unfortunately. @@ -86,17 +125,17 @@ PROJECT(Vega_Strike ) # One version header generator to rule them all -CONFIGURE_FILE(src/version.h.in ${CMAKE_SOURCE_DIR}/src/version.h) -CONFIGURE_FILE(src/version.h.in ${CMAKE_SOURCE_DIR}/setup/src/include/version.h) +CONFIGURE_FILE(src/version.h.in ${Vega_Strike_BINARY_DIR}/src/version.h) +CONFIGURE_FILE(src/version.h.in ${Vega_Strike_BINARY_DIR}/setup/src/include/version.h) MESSAGE("== Vega Strike Version: ${VEGASTRIKE_VERSION_LONG_STR}") SET(CMAKE_CXX_STANDARD 11) SET(CMAKE_CXX_STANDARD_REQUIRED TRUE) -SET(CMAKE_CXX_EXTENSIONS ON) +SET(CMAKE_CXX_EXTENSIONS OFF) SET(CMAKE_C_STANDARD 11) SET(CMAKE_C_STANDARD_REQUIRED TRUE) -SET(CMAKE_C_EXTENSIONS ON) +SET(CMAKE_C_EXTENSIONS OFF) UNSET(PYTHONLIBS_FOUND) UNSET(Boost_FOUND) @@ -120,24 +159,26 @@ SET(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") SET(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) INCLUDE(InstallRequiredSystemLibraries) -IF (MSVC) +IF (UNIX) INCLUDE_DIRECTORIES( ${Vega_Strike_SOURCE_DIR}/src ${Vega_Strike_SOURCE_DIR}/src/cmd ${Vega_Strike_SOURCE_DIR}/src/damage ${Vega_Strike_SOURCE_DIR}/src/resource ${Vega_Strike_BINARY_DIR} + ${Vega_Strike_BINARY_DIR}/src + /usr/include/harfbuzz/ ) -ELSE (MSVC) +ELSE () INCLUDE_DIRECTORIES( ${Vega_Strike_SOURCE_DIR}/src ${Vega_Strike_SOURCE_DIR}/src/cmd ${Vega_Strike_SOURCE_DIR}/src/damage ${Vega_Strike_SOURCE_DIR}/src/resource ${Vega_Strike_BINARY_DIR} - /usr/include/harfbuzz/ + ${Vega_Strike_BINARY_DIR}/src ) -ENDIF (MSVC) +ENDIF () # The source files used to be listed here... @@ -637,7 +678,8 @@ CONFIGURE_FILE(${Vega_Strike_SOURCE_DIR}/cmake-config.h.in ${Vega_Strike_BINARY_ INCLUDE_DIRECTORIES(${TST_INCLUDES}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_compile_options("$<$,$,$>:-include>" "$<$,$,$>:config.h>") +add_compile_options("$<$,$,$>:-include>" + "$<$,$,$>:config.h>") add_link_options("$<$,$,$>:-Bsymbolic>") # Now the source files are listed starting here! @@ -791,16 +833,17 @@ ADD_LIBRARY(vegastrike-OPcollide src/cmd/collide2/CSopcodecollider.cpp ) -TARGET_COMPILE_FEATURES(vegastrike-OPcollide PUBLIC cxx_std_11) +#TARGET_COMPILE_FEATURES(vegastrike-OPcollide PUBLIC cxx_std_11) set_property(TARGET vegastrike-OPcollide PROPERTY POSITION_INDEPENDENT_CODE TRUE) IF (NEED_LINKING_AGAINST_LIBM) TARGET_LINK_LIBRARIES(vegastrike-OPcollide m) ENDIF() -target_compile_definitions(vegastrike-OPcollide PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +target_compile_definitions(vegastrike-OPcollide PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>") IF (WIN32) target_compile_definitions(vegastrike-OPcollide PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) target_compile_definitions(vegastrike-OPcollide PUBLIC _WIN32_WINNT=0x0A00) target_compile_definitions(vegastrike-OPcollide PUBLIC WINVER=0x0A00) + target_compile_definitions(vegastrike-OPcollide PUBLIC "$<$:Py_DEBUG>") ENDIF() SET(LIBCMD_SOURCES @@ -1080,16 +1123,17 @@ ADD_LIBRARY(vegastrike-engine_com ${LIBGFXGENERIC_SOURCES} ) -TARGET_COMPILE_FEATURES(vegastrike-engine_com PUBLIC cxx_std_11) +#TARGET_COMPILE_FEATURES(vegastrike-engine_com PUBLIC cxx_std_11) set_property(TARGET vegastrike-engine_com PROPERTY POSITION_INDEPENDENT_CODE TRUE) IF (NEED_LINKING_AGAINST_LIBM) TARGET_LINK_LIBRARIES(vegastrike-engine_com m) ENDIF() -target_compile_definitions(vegastrike-engine_com PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +target_compile_definitions(vegastrike-engine_com PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>") IF (WIN32) target_compile_definitions(vegastrike-engine_com PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) target_compile_definitions(vegastrike-engine_com PUBLIC _WIN32_WINNT=0x0A00) target_compile_definitions(vegastrike-engine_com PUBLIC WINVER=0x0A00) + target_compile_definitions(vegastrike-engine_com PUBLIC "$<$:Py_DEBUG>") ENDIF() SET(VEGASTRIKE_SOURCES @@ -1167,25 +1211,26 @@ SET(TST_LIBS vegastrike-engine_com vegastrike-OPcollide ${TST_LIBS}) IF (NOT DISABLE_CLIENT) ADD_EXECUTABLE(vegastrike-engine ${VEGASTRIKE_SOURCES}) - TARGET_COMPILE_FEATURES(vegastrike-engine PUBLIC cxx_std_11) + #TARGET_COMPILE_FEATURES(vegastrike-engine PUBLIC cxx_std_11) IF (NEED_LINKING_AGAINST_LIBM) TARGET_LINK_LIBRARIES(vegastrike-engine m) ENDIF() - target_compile_definitions(vegastrike-engine PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") + target_compile_definitions(vegastrike-engine PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>") IF (WIN32) target_compile_definitions(vegastrike-engine PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) target_compile_definitions(vegastrike-engine PUBLIC _WIN32_WINNT=0x0A00) target_compile_definitions(vegastrike-engine PUBLIC WINVER=0x0A00) + target_compile_definitions(vegastrike-engine PUBLIC "$<$:Py_DEBUG>") ENDIF() - ADD_DEPENDENCIES(vegastrike-engine OpenGL::GL OpenGL::GLU) + #ADD_DEPENDENCIES(vegastrike-engine OpenGL::GL OpenGL::GLU) TARGET_LINK_LIBRARIES(vegastrike-engine OpenGL::GL OpenGL::GLU ${TST_LIBS}) - IF (MSVC) + #IF (MSVC) SET_TARGET_PROPERTIES(vegastrike-engine PROPERTIES LINK_FLAGS "${TST_LFLAGS}") - ELSE (MSVC) - SET_TARGET_PROPERTIES(vegastrike-engine PROPERTIES LINK_FLAGS "-L/usr/lib -L/usr/local/lib ${TST_LFLAGS}") - ENDIF (MSVC) + #ELSE (MSVC) + # SET_TARGET_PROPERTIES(vegastrike-engine PROPERTIES LINK_FLAGS "-L/usr/lib -L/usr/local/lib ${TST_LFLAGS}") + #ENDIF (MSVC) ENDIF (NOT DISABLE_CLIENT) # Vssetup Sub build file @@ -1654,12 +1699,13 @@ IF (USE_GTEST) ${LIBCMD_SOURCES} ${LIBVS_LOGGING} ) - target_compile_definitions(vegastrike-testing PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") + target_compile_definitions(vegastrike-testing PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>") set_property(TARGET vegastrike-testing PROPERTY POSITION_INDEPENDENT_CODE TRUE) IF (WIN32) target_compile_definitions(vegastrike-testing PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) target_compile_definitions(vegastrike-testing PUBLIC _WIN32_WINNT=0x0A00) target_compile_definitions(vegastrike-testing PUBLIC WINVER=0x0A00) + target_compile_definitions(vegastrike-testing PUBLIC "$<$:Py_DEBUG>") ENDIF() TARGET_LINK_LIBRARIES( @@ -1669,11 +1715,12 @@ IF (USE_GTEST) Boost::log Boost::log_setup ) - target_compile_definitions(${TEST_NAME} PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") + target_compile_definitions(${TEST_NAME} PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>") IF (WIN32) target_compile_definitions(${TEST_NAME} PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) target_compile_definitions(${TEST_NAME} PUBLIC _WIN32_WINNT=0x0A00) target_compile_definitions(${TEST_NAME} PUBLIC WINVER=0x0A00) + target_compile_definitions(${TEST_NAME} PUBLIC "$<$:Py_DEBUG>") ENDIF() FILE( diff --git a/engine/CMakePresets.json b/engine/CMakePresets.json index 44a3cb0cd2..50944c6d30 100644 --- a/engine/CMakePresets.json +++ b/engine/CMakePresets.json @@ -208,6 +208,12 @@ "type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin" + }, + "environment": { + "VERBOSE": "ON" + }, + "cacheVariables": { + "CMAKE_FIND_FRAMEWORK": "LAST" } }, { @@ -259,7 +265,7 @@ "pie-disabled", "release" ], - "displayName": "macOS, Pie Enabled, Debug", + "displayName": "macOS, Pie Disabled, Release", "condition": { "type": "equals", "lhs": "${hostSystemName}", From 3f9ec5c163d5dc96868d3d5a9ac389ac2b1cdfba Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sat, 15 Jul 2023 18:00:31 -0700 Subject: [PATCH 22/31] engine/CMakeLists.txt: Missed a spot --- engine/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index d258a281da..c5cf4623f6 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -231,8 +231,10 @@ OPTION(DISABLE_CLIENT "Disable building the vegastrike bin" OFF ) # OPTION(VEGA_STRIKE_PREFER_LEGACY_OPENGL "Prefer legacy OpenGL implementation (such as Mesa's)? Or prefer GLVND?" OFF ) IF (OpenGL_GL_PREFERENCE STREQUAL "LEGACY") SET (VEGA_STRIKE_GLU_DEPENDENCY "libglu1-mesa") -ELSE () +ELSEIF (OpenGL_GL_PREFERENCE STREQUAL "GLVND") SET (VEGA_STRIKE_GLU_DEPENDENCY "libglvnd0") +ELSE () + UNSET (VEGA_STRIKE_GLU_DEPENDENCY) ENDIF () MESSAGE("** OpenGL_GL_PREFERENCE: ${OpenGL_GL_PREFERENCE}") From b945b3954e27dcfebf324903e31cec5ef20d46fb Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sun, 16 Jul 2023 10:57:45 -0700 Subject: [PATCH 23/31] 41 .cpp and .h files: `#include ` ahead of Python.h (and other headers) after all --- engine/src/cmd/ai/aggressive.cpp | 5 +++-- engine/src/cmd/ai/docking.cpp | 3 ++- engine/src/cmd/ai/firekeyboard.cpp | 5 +++-- engine/src/cmd/ai/hard_coded_scripts.cpp | 3 ++- engine/src/cmd/ai/pythonai.cpp | 5 +++-- engine/src/cmd/ai/pythonai.h | 5 +++-- engine/src/cmd/base_init.cpp | 4 ++-- engine/src/cmd/base_interface.cpp | 3 ++- engine/src/cmd/base_util.cpp | 8 ++++---- engine/src/cmd/base_util.h | 3 ++- engine/src/cmd/base_xml.cpp | 5 +++-- engine/src/cmd/intelligent.cpp | 5 +++-- engine/src/cmd/music.cpp | 5 +++-- engine/src/cmd/script/director.cpp | 5 +++-- engine/src/cmd/script/director_generic.cpp | 5 +++-- engine/src/cmd/script/director_server.cpp | 5 +++-- engine/src/cmd/script/mission.cpp | 3 ++- engine/src/cmd/script/pythonmission.cpp | 5 +++-- engine/src/cmd/script/script_call_unit.cpp | 3 ++- engine/src/cmd/script/script_callbacks.cpp | 3 ++- engine/src/cmd/unit_generic.cpp | 3 ++- engine/src/cmd/unit_util_generic.cpp | 5 +++-- engine/src/command.cpp | 3 ++- engine/src/config_xml.cpp | 3 ++- engine/src/gfx/cockpit.cpp | 5 +++-- engine/src/gfx/tvector.cpp | 4 ++-- engine/src/load_mission.cpp | 3 ++- engine/src/main.cpp | 3 ++- engine/src/python/briefing_wrapper.cpp | 1 + engine/src/python/init.h | 5 ++--- engine/src/python/python_class.h | 5 +++-- engine/src/python/python_compile.cpp | 3 ++- engine/src/python/python_compile.h | 3 ++- engine/src/python/unit_exports.cpp | 4 ++-- engine/src/python/unit_exports.h | 2 +- engine/src/python/unit_from_to_python.h | 3 ++- engine/src/python/unit_wrapper_class.h | 3 ++- engine/src/savegame.cpp | 3 ++- engine/src/star_system.cpp | 1 + engine/src/universe_util_generic.cpp | 3 ++- engine/src/vega_py_run.cpp | 3 ++- 41 files changed, 95 insertions(+), 61 deletions(-) diff --git a/engine/src/cmd/ai/aggressive.cpp b/engine/src/cmd/ai/aggressive.cpp index cb99167a29..37130116dd 100644 --- a/engine/src/cmd/ai/aggressive.cpp +++ b/engine/src/cmd/ai/aggressive.cpp @@ -15,15 +15,16 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #define PY_SSIZE_T_CLEAN +#include #include #include #include "aggressive.h" diff --git a/engine/src/cmd/ai/docking.cpp b/engine/src/cmd/ai/docking.cpp index b3e57e1a10..aa82b19a17 100644 --- a/engine/src/cmd/ai/docking.cpp +++ b/engine/src/cmd/ai/docking.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -24,6 +24,7 @@ #define PY_SSIZE_T_CLEAN +#include #include "python/python_compile.h" #include "docking.h" #include "xml_support.h" diff --git a/engine/src/cmd/ai/firekeyboard.cpp b/engine/src/cmd/ai/firekeyboard.cpp index 9bc8f53991..0ee2234d42 100644 --- a/engine/src/cmd/ai/firekeyboard.cpp +++ b/engine/src/cmd/ai/firekeyboard.cpp @@ -15,11 +15,11 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -27,6 +27,7 @@ /// Parses keyboard commands #define PY_SSIZE_T_CLEAN +#include #include #include "firekeyboard.h" #include "flybywire.h" diff --git a/engine/src/cmd/ai/hard_coded_scripts.cpp b/engine/src/cmd/ai/hard_coded_scripts.cpp index 63522f83b4..1c73d5b3f0 100644 --- a/engine/src/cmd/ai/hard_coded_scripts.cpp +++ b/engine/src/cmd/ai/hard_coded_scripts.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -25,6 +25,7 @@ #define PY_SSIZE_T_CLEAN #include +#include #include "python/python_class.h" #include "script.h" #include "cmd/unit_generic.h" diff --git a/engine/src/cmd/ai/pythonai.cpp b/engine/src/cmd/ai/pythonai.cpp index e01dd3c0d6..06a59802c7 100644 --- a/engine/src/cmd/ai/pythonai.cpp +++ b/engine/src/cmd/ai/pythonai.cpp @@ -15,16 +15,17 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #define PY_SSIZE_T_CLEAN #include +#include #include #include diff --git a/engine/src/cmd/ai/pythonai.h b/engine/src/cmd/ai/pythonai.h index f6aa221fe7..afe60d904f 100644 --- a/engine/src/cmd/ai/pythonai.h +++ b/engine/src/cmd/ai/pythonai.h @@ -15,15 +15,16 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ // NO HEADER GUARD #define PY_SSIZE_T_CLEAN +#include #include #include "fire.h" #include diff --git a/engine/src/cmd/base_init.cpp b/engine/src/cmd/base_init.cpp index d59285a932..6ba73c56a6 100644 --- a/engine/src/cmd/base_init.cpp +++ b/engine/src/cmd/base_init.cpp @@ -24,16 +24,16 @@ #define PY_SSIZE_T_CLEAN -#include #include -#if BOOST_VERSION != 102800 #include +#if BOOST_VERSION != 102800 typedef boost::python::dict BoostPythonDictionary; #else #include typedef boost::python::dictionary BoostPythonDictionary; #endif +#include #if BOOST_VERSION != 102800 #include #include diff --git a/engine/src/cmd/base_interface.cpp b/engine/src/cmd/base_interface.cpp index 5dbae4de99..714bfa3a2c 100644 --- a/engine/src/cmd/base_interface.cpp +++ b/engine/src/cmd/base_interface.cpp @@ -24,8 +24,9 @@ #define PY_SSIZE_T_CLEAN -#include +#include #include +#include #include #include "base.h" #include "gldrv/winsys.h" diff --git a/engine/src/cmd/base_util.cpp b/engine/src/cmd/base_util.cpp index 48cb71c007..987634ac9f 100644 --- a/engine/src/cmd/base_util.cpp +++ b/engine/src/cmd/base_util.cpp @@ -15,20 +15,20 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #define PY_SSIZE_T_CLEAN -#include +//#include #include -#if BOOST_VERSION != 102800 #include +#if BOOST_VERSION != 102800 typedef boost::python::dict BoostPythonDictionary; #else #include diff --git a/engine/src/cmd/base_util.h b/engine/src/cmd/base_util.h index a3cbd31e14..7aac2eb6c9 100644 --- a/engine/src/cmd/base_util.h +++ b/engine/src/cmd/base_util.h @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -27,6 +27,7 @@ #define VEGA_STRIKE_ENGINE_CMD_BASE_UTIL_H #define PY_SSIZE_T_CLEAN +#include #include #include #if BOOST_VERSION != 102800 diff --git a/engine/src/cmd/base_xml.cpp b/engine/src/cmd/base_xml.cpp index 94cff98f96..9f379dd0f0 100644 --- a/engine/src/cmd/base_xml.cpp +++ b/engine/src/cmd/base_xml.cpp @@ -15,16 +15,17 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #define PY_SSIZE_T_CLEAN #include +#include #if BOOST_VERSION != 102800 #include #else diff --git a/engine/src/cmd/intelligent.cpp b/engine/src/cmd/intelligent.cpp index dd4840db73..439bc89809 100644 --- a/engine/src/cmd/intelligent.cpp +++ b/engine/src/cmd/intelligent.cpp @@ -15,11 +15,11 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -28,6 +28,7 @@ #define PY_SSIZE_T_CLEAN +#include #include "intelligent.h" #include "ai/order.h" diff --git a/engine/src/cmd/music.cpp b/engine/src/cmd/music.cpp index 59dcecb853..ae62ed9bd6 100644 --- a/engine/src/cmd/music.cpp +++ b/engine/src/cmd/music.cpp @@ -15,15 +15,16 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #define PY_SSIZE_T_CLEAN +#include #include #include #include diff --git a/engine/src/cmd/script/director.cpp b/engine/src/cmd/script/director.cpp index ee3f449431..f6112ed566 100644 --- a/engine/src/cmd/script/director.cpp +++ b/engine/src/cmd/script/director.cpp @@ -15,11 +15,11 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -28,6 +28,7 @@ */ #define PY_SSIZE_T_CLEAN #include +#include #include #include "python/python_class.h" #include diff --git a/engine/src/cmd/script/director_generic.cpp b/engine/src/cmd/script/director_generic.cpp index 8b7c80d29e..5e834b6d70 100644 --- a/engine/src/cmd/script/director_generic.cpp +++ b/engine/src/cmd/script/director_generic.cpp @@ -13,17 +13,18 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #define PY_SSIZE_T_CLEAN #ifdef HAVE_PYTHON #include +#include #include #include #endif diff --git a/engine/src/cmd/script/director_server.cpp b/engine/src/cmd/script/director_server.cpp index abeb8ab165..f7799cb9ba 100644 --- a/engine/src/cmd/script/director_server.cpp +++ b/engine/src/cmd/script/director_server.cpp @@ -14,11 +14,11 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ /* @@ -27,6 +27,7 @@ #define PY_SSIZE_T_CLEAN #include "python/python_class.h" #include +#include #include #ifdef HAVE_PYTHON #include diff --git a/engine/src/cmd/script/mission.cpp b/engine/src/cmd/script/mission.cpp index 68d9f29c08..fa565ddffb 100644 --- a/engine/src/cmd/script/mission.cpp +++ b/engine/src/cmd/script/mission.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -27,6 +27,7 @@ * xml Mission written by Alexander Rawass */ #define PY_SSIZE_T_CLEAN +#include #include #include #include diff --git a/engine/src/cmd/script/pythonmission.cpp b/engine/src/cmd/script/pythonmission.cpp index 8689e5ccb7..a4ad35c06f 100644 --- a/engine/src/cmd/script/pythonmission.cpp +++ b/engine/src/cmd/script/pythonmission.cpp @@ -15,16 +15,17 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #define PY_SSIZE_T_CLEAN #include +#include #include #include #include "pythonmission.h" diff --git a/engine/src/cmd/script/script_call_unit.cpp b/engine/src/cmd/script/script_call_unit.cpp index 4eaa2b41f1..5c6ba830d6 100644 --- a/engine/src/cmd/script/script_call_unit.cpp +++ b/engine/src/cmd/script/script_call_unit.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -24,6 +24,7 @@ #define PY_SSIZE_T_CLEAN +#include #include #include diff --git a/engine/src/cmd/script/script_callbacks.cpp b/engine/src/cmd/script/script_callbacks.cpp index 956aa01668..38ebef751a 100644 --- a/engine/src/cmd/script/script_callbacks.cpp +++ b/engine/src/cmd/script/script_callbacks.cpp @@ -16,7 +16,7 @@ * * Vega Strike 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 + * 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 @@ -31,6 +31,7 @@ /// Parses functions for python modules #define PY_SSIZE_T_CLEAN +#include #include #include #include diff --git a/engine/src/cmd/unit_generic.cpp b/engine/src/cmd/unit_generic.cpp index d540bdfb82..1365c74a73 100644 --- a/engine/src/cmd/unit_generic.cpp +++ b/engine/src/cmd/unit_generic.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -25,6 +25,7 @@ // -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- #define PY_SSIZE_T_CLEAN +#include #include "unit_generic.h" #include diff --git a/engine/src/cmd/unit_util_generic.cpp b/engine/src/cmd/unit_util_generic.cpp index cc987dca3a..8a1057ac72 100644 --- a/engine/src/cmd/unit_util_generic.cpp +++ b/engine/src/cmd/unit_util_generic.cpp @@ -13,15 +13,16 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #define PY_SSIZE_T_CLEAN +#include #include #include "cmd/unit_generic.h" #include "cmd/unit_util.h" diff --git a/engine/src/command.cpp b/engine/src/command.cpp index 6ef02c4ec1..c91d9eccb8 100644 --- a/engine/src/command.cpp +++ b/engine/src/command.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -24,6 +24,7 @@ #define PY_SSIZE_T_CLEAN +#include #include "command.h" #include #include diff --git a/engine/src/config_xml.cpp b/engine/src/config_xml.cpp index 2921f3345d..4b4d2bb70d 100644 --- a/engine/src/config_xml.cpp +++ b/engine/src/config_xml.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -27,6 +27,7 @@ */ #define PY_SSIZE_T_CLEAN +#include #include #include "xml_support.h" #include "vegastrike.h" diff --git a/engine/src/gfx/cockpit.cpp b/engine/src/gfx/cockpit.cpp index bf69f50d01..634cb91a8d 100644 --- a/engine/src/gfx/cockpit.cpp +++ b/engine/src/gfx/cockpit.cpp @@ -17,11 +17,11 @@ * * Vega Strike 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 + * 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 Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -30,6 +30,7 @@ #define PY_SSIZE_T_CLEAN #include +#include #if BOOST_VERSION != 102800 #include #include diff --git a/engine/src/gfx/tvector.cpp b/engine/src/gfx/tvector.cpp index ec3f0ee019..a36abb3aad 100644 --- a/engine/src/gfx/tvector.cpp +++ b/engine/src/gfx/tvector.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -24,6 +24,7 @@ #define PY_SSIZE_T_CLEAN +#include #include "tvector.h" #include "matrix.h" @@ -34,7 +35,6 @@ #include #include "vegastrike.h" #include -#include #define _CZ (761.465325527) // Specialization comes first (actually only for declaration) diff --git a/engine/src/load_mission.cpp b/engine/src/load_mission.cpp index 0a115ff71d..b71826446d 100644 --- a/engine/src/load_mission.cpp +++ b/engine/src/load_mission.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -24,6 +24,7 @@ #define PY_SSIZE_T_CLEAN +#include #include "configxml.h" #include "cmd/script/mission.h" #include "cmd/script/pythonmission.h" diff --git a/engine/src/main.cpp b/engine/src/main.cpp index 385aa0b356..eafdc2406d 100644 --- a/engine/src/main.cpp +++ b/engine/src/main.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -24,6 +24,7 @@ #define PY_SSIZE_T_CLEAN +#include #include #include "audio/test.h" #if defined (HAVE_SDL) diff --git a/engine/src/python/briefing_wrapper.cpp b/engine/src/python/briefing_wrapper.cpp index 8648ea4a1d..27a89cb7e5 100644 --- a/engine/src/python/briefing_wrapper.cpp +++ b/engine/src/python/briefing_wrapper.cpp @@ -24,6 +24,7 @@ #ifndef PYTHON_STUB #define PY_SSIZE_T_CLEAN +#include #include #include "python_class.h" #include "cmd/briefing.h" diff --git a/engine/src/python/init.h b/engine/src/python/init.h index 0704c13e82..555f747266 100644 --- a/engine/src/python/init.h +++ b/engine/src/python/init.h @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -28,6 +28,7 @@ #define VEGA_STRIKE_ENGINE_PYTHON_INIT_H #define PY_SSIZE_T_CLEAN +#include #include "gfx/vec.h" #include @@ -37,8 +38,6 @@ #define Vector Vactor #endif //defined (_MSC_VER) && _MSC_VER <= 1200 -#include - #if defined (_MSC_VER) && _MSC_VER <= 1200 #undef Vector #endif // defined (_MSC_VER) && _MSC_VER <= 1200 diff --git a/engine/src/python/python_class.h b/engine/src/python/python_class.h index cba2e28059..9d4ebc696e 100644 --- a/engine/src/python/python_class.h +++ b/engine/src/python/python_class.h @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -26,6 +26,8 @@ #define VEGA_STRIKE_ENGINE_PYTHON_PYTHON_CLASS_H #define PY_SSIZE_T_CLEAN +#include ///module.hpp> + //This takes care of the fact that several systems use the _POSIX_C_SOURCES //variable and don't set them to the same thing. //Python.h sets and uses it @@ -44,7 +46,6 @@ #include "boost/python/object.hpp" #include "boost/python/class.hpp" #include "boost/python/call_method.hpp" -#include ///module.hpp> #if defined (_MSC_VER) && _MSC_VER <= 1200 #undef Vector diff --git a/engine/src/python/python_compile.cpp b/engine/src/python/python_compile.cpp index 14db6c8acc..f2995f27a4 100644 --- a/engine/src/python/python_compile.cpp +++ b/engine/src/python/python_compile.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -24,6 +24,7 @@ #define PY_SSIZE_T_CLEAN +#include #include "cmd/unit_generic.h" #include "python_compile.h" #include diff --git a/engine/src/python/python_compile.h b/engine/src/python/python_compile.h index afb34cbf17..4c0baa809b 100644 --- a/engine/src/python/python_compile.h +++ b/engine/src/python/python_compile.h @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -25,6 +25,7 @@ #ifndef VEGA_STRIKE_ENGINE_PYTHON_PYTHON_COMPILE_H #define VEGA_STRIKE_ENGINE_PYTHON_PYTHON_COMPILE_H #define PY_SSIZE_T_CLEAN +#include //Resets variable for use by python config.h #ifdef _POSIX_C_SOURCE diff --git a/engine/src/python/unit_exports.cpp b/engine/src/python/unit_exports.cpp index 04743fd659..3813b351f4 100644 --- a/engine/src/python/unit_exports.cpp +++ b/engine/src/python/unit_exports.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -24,8 +24,8 @@ #define PY_SSIZE_T_CLEAN #include -#if BOOST_VERSION != 102800 #include +#if BOOST_VERSION != 102800 typedef boost::python::dict BoostPythonDictionary; #else #include diff --git a/engine/src/python/unit_exports.h b/engine/src/python/unit_exports.h index f2ed21cbd0..cccc697462 100644 --- a/engine/src/python/unit_exports.h +++ b/engine/src/python/unit_exports.h @@ -33,8 +33,8 @@ #include "cmd/unit_generic.h" #include -#if BOOST_VERSION != 102800 #include +#if BOOST_VERSION != 102800 typedef boost::python::dict BoostPythonDictionary; #else //BOOST_VERSION != 102800 #include diff --git a/engine/src/python/unit_from_to_python.h b/engine/src/python/unit_from_to_python.h index 82b887390e..365bac9757 100644 --- a/engine/src/python/unit_from_to_python.h +++ b/engine/src/python/unit_from_to_python.h @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -27,6 +27,7 @@ #define PY_SSIZE_T_CLEAN #include +#include #if BOOST_VERSION != 102800 //#include diff --git a/engine/src/python/unit_wrapper_class.h b/engine/src/python/unit_wrapper_class.h index 1c4b48e420..f8bd44febc 100644 --- a/engine/src/python/unit_wrapper_class.h +++ b/engine/src/python/unit_wrapper_class.h @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -25,6 +25,7 @@ #define PY_SSIZE_T_CLEAN +#include #include "vs_logging.h" using std::string; //WARNING: Macro City ahead. Please skip this section if you don't like macros. diff --git a/engine/src/savegame.cpp b/engine/src/savegame.cpp index 825a362c47..9c433a10c7 100644 --- a/engine/src/savegame.cpp +++ b/engine/src/savegame.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -24,6 +24,7 @@ #define PY_SSIZE_T_CLEAN +#include #include #include "cmd/unit_generic.h" #include "hashtable.h" diff --git a/engine/src/star_system.cpp b/engine/src/star_system.cpp index 6598af0ffa..48dad075a2 100644 --- a/engine/src/star_system.cpp +++ b/engine/src/star_system.cpp @@ -24,6 +24,7 @@ #define PY_SSIZE_T_CLEAN +#include #include #include "star_system.h" diff --git a/engine/src/universe_util_generic.cpp b/engine/src/universe_util_generic.cpp index 42b8d92e25..bd0f0916c9 100644 --- a/engine/src/universe_util_generic.cpp +++ b/engine/src/universe_util_generic.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -24,6 +24,7 @@ #define PY_SSIZE_T_CLEAN +#include #include #include #include "lin_time.h" diff --git a/engine/src/vega_py_run.cpp b/engine/src/vega_py_run.cpp index de89793701..15bf11415f 100644 --- a/engine/src/vega_py_run.cpp +++ b/engine/src/vega_py_run.cpp @@ -15,7 +15,7 @@ * * Vega Strike 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 + * 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 @@ -23,6 +23,7 @@ */ #define PY_SSIZE_T_CLEAN +#include #include #include #include From dd72ed090bfdd1819c11526069abccec4ed5d732 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sun, 16 Jul 2023 11:25:45 -0700 Subject: [PATCH 24/31] gh-actions-pr.yml: Add ENABLE_PIE flag, as well as several add'l distros/versions, some of which are commented out --- .github/workflows/gh-actions-pr.yml | 170 +++++++++++++++++++++++++--- 1 file changed, 156 insertions(+), 14 deletions(-) diff --git a/.github/workflows/gh-actions-pr.yml b/.github/workflows/gh-actions-pr.yml index bd497c6f4a..a737950f32 100644 --- a/.github/workflows/gh-actions-pr.yml +++ b/.github/workflows/gh-actions-pr.yml @@ -16,174 +16,316 @@ jobs: fail-fast: false matrix: include: + #- FROM: 'ubuntu:lunar' + # COMPILER: 'gcc' + # OpenGL_GL_PREFERENCE: 'LEGACY' + # ENABLE_PIE: 'OFF' + # allow_failure: false + #- FROM: 'ubuntu:lunar' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'LEGACY' + # ENABLE_PIE: 'OFF' + # allow_failure: false + #- FROM: 'ubuntu:lunar' + # COMPILER: 'gcc' + # OpenGL_GL_PREFERENCE: 'GLVND' + # ENABLE_PIE: 'OFF' + # allow_failure: false + #- FROM: 'ubuntu:lunar' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'GLVND' + # ENABLE_PIE: 'OFF' + # allow_failure: false + - FROM: 'ubuntu:kinetic' + COMPILER: 'gcc' + OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' + allow_failure: false + - FROM: 'ubuntu:kinetic' + COMPILER: 'clang' + OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' + allow_failure: false + - FROM: 'ubuntu:kinetic' + COMPILER: 'gcc' + OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' + allow_failure: false + - FROM: 'ubuntu:kinetic' + COMPILER: 'clang' + OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' + allow_failure: false - FROM: 'ubuntu:jammy' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'ubuntu:jammy' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'ubuntu:jammy' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'ubuntu:jammy' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'ubuntu:focal' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'ubuntu:focal' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'ubuntu:focal' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'ubuntu:focal' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'ubuntu:bionic' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'ubuntu:bionic' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'ubuntu:bionic' COMPILER: 'gcc' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'ubuntu:bionic' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' - allow_failure: false + ENABLE_PIE: 'OFF' + allow_failure: false + #- FROM: 'linuxmintd/mint21.1-amd64' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'LEGACY' + # ENABLE_PIE: 'OFF' + # allow_failure: false + #- FROM: 'linuxmintd/mint21.1-amd64' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'GLVND' + # ENABLE_PIE: 'OFF' + # allow_failure: false - FROM: 'linuxmintd/mint21-amd64' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'linuxmintd/mint21-amd64' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'linuxmintd/mint20-amd64' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'linuxmintd/mint20-amd64' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'debian:bookworm' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'debian:bookworm' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'debian:bullseye' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'debian:bullseye' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'debian:buster' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'OFF' allow_failure: false - FROM: 'debian:buster' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' - allow_failure: false + ENABLE_PIE: 'OFF' + allow_failure: false + #- FROM: 'opensuse/leap:15.5' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'LEGACY' + # ENABLE_PIE: 'ON' + # allow_failure: false + #- FROM: 'opensuse/leap:15.5' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'GLVND' + # ENABLE_PIE: 'ON' + # allow_failure: false - FROM: 'opensuse/leap:15.4' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'opensuse/leap:15.4' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'opensuse/leap:15.3' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'opensuse/leap:15.3' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'opensuse/leap:15.2' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'opensuse/leap:15.2' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' - allow_failure: false + ENABLE_PIE: 'ON' + allow_failure: false + #- FROM: 'fedora:38' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'LEGACY' + # ENABLE_PIE: 'ON' + # allow_failure: false + #- FROM: 'fedora:38' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'GLVND' + # ENABLE_PIE: 'ON' + # allow_failure: false - FROM: 'fedora:37' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'fedora:37' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'fedora:36' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'fedora:36' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'fedora:35' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'fedora:35' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'ON' + allow_failure: false + - FROM: 'rockylinux:9.1' + COMPILER: 'clang' + OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'ON' + allow_failure: false + - FROM: 'rockylinux:9.1' + COMPILER: 'clang' + OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'rockylinux:9.0' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'rockylinux:9.0' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' - allow_failure: false + ENABLE_PIE: 'ON' + allow_failure: false + #- FROM: 'rockylinux:8.7' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'LEGACY' + # ENABLE_PIE: 'ON' + # allow_failure: false + #- FROM: 'rockylinux:8.7' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'GLVND' + # ENABLE_PIE: 'ON' + # allow_failure: false - FROM: 'rockylinux:8.6' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'rockylinux:8.6' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'rockylinux:8.5' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'ON' allow_failure: false - FROM: 'rockylinux:8.5' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' - allow_failure: false - - FROM: 'manjarolinux/base' - COMPILER: 'clang' - OpenGL_GL_PREFERENCE: 'LEGACY' - allow_failure: true - - FROM: 'manjarolinux/base' - COMPILER: 'clang' - OpenGL_GL_PREFERENCE: 'GLVND' - allow_failure: true + ENABLE_PIE: 'ON' + allow_failure: false + #- FROM: 'manjarolinux/base' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'LEGACY' + # ENABLE_PIE: 'ON' + # allow_failure: true + #- FROM: 'manjarolinux/base' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'GLVND' + # ENABLE_PIE: 'ON' + # allow_failure: true + #- FROM: 'funtoo/stage3-generic_64' + # COMPILER: 'gcc' + # OpenGL_GL_PREFERENCE: 'LEGACY' + # ENABLE_PIE: 'ON' + # allow_failure: true + #- FROM: 'funtoo/stage3-generic_64' + # COMPILER: 'gcc' + # OpenGL_GL_PREFERENCE: 'GLVND' + # ENABLE_PIE: 'ON' + # allow_failure: true steps: - name: Check out repository @@ -209,7 +351,7 @@ jobs: env: FROM: ${{ matrix.FROM }} COMPILER: ${{ matrix.COMPILER }} - FLAGS: '-DOpenGL_GL_PREFERENCE=${{ matrix.OpenGL_GL_PREFERENCE }}' + FLAGS: '-DOpenGL_GL_PREFERENCE=${{ matrix.OpenGL_GL_PREFERENCE }} -DENABLE_PIE=${{ matrix.ENABLE_PIE }}' MY_OS_NAME: linux IS_RELEASE: 0 run: script/cibuild $FLAGS From 51cadbd76addbdfde935df6187c6771d3056e97a Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Sun, 16 Jul 2023 11:32:35 -0700 Subject: [PATCH 25/31] gh-actions-pr.yml: Uncomment Rocky Linux 8.7 builds --- .github/workflows/gh-actions-pr.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/gh-actions-pr.yml b/.github/workflows/gh-actions-pr.yml index a737950f32..169da267c2 100644 --- a/.github/workflows/gh-actions-pr.yml +++ b/.github/workflows/gh-actions-pr.yml @@ -276,16 +276,16 @@ jobs: OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' allow_failure: false - #- FROM: 'rockylinux:8.7' - # COMPILER: 'clang' - # OpenGL_GL_PREFERENCE: 'LEGACY' - # ENABLE_PIE: 'ON' - # allow_failure: false - #- FROM: 'rockylinux:8.7' - # COMPILER: 'clang' - # OpenGL_GL_PREFERENCE: 'GLVND' - # ENABLE_PIE: 'ON' - # allow_failure: false + - FROM: 'rockylinux:8.7' + COMPILER: 'clang' + OpenGL_GL_PREFERENCE: 'LEGACY' + ENABLE_PIE: 'ON' + allow_failure: false + - FROM: 'rockylinux:8.7' + COMPILER: 'clang' + OpenGL_GL_PREFERENCE: 'GLVND' + ENABLE_PIE: 'ON' + allow_failure: false - FROM: 'rockylinux:8.6' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' From cd601763fe53979260896c90678fdb62a6d6b655 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Mon, 17 Jul 2023 22:26:41 -0700 Subject: [PATCH 26/31] CMakeLists.txt: Turn CMAKE_C(XX)_EXTENSIONS back on --- engine/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index c5cf4623f6..634a232d19 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -132,10 +132,10 @@ MESSAGE("== Vega Strike Version: ${VEGASTRIKE_VERSION_LONG_STR}") SET(CMAKE_CXX_STANDARD 11) SET(CMAKE_CXX_STANDARD_REQUIRED TRUE) -SET(CMAKE_CXX_EXTENSIONS OFF) +SET(CMAKE_CXX_EXTENSIONS ON) SET(CMAKE_C_STANDARD 11) SET(CMAKE_C_STANDARD_REQUIRED TRUE) -SET(CMAKE_C_EXTENSIONS OFF) +SET(CMAKE_C_EXTENSIONS ON) UNSET(PYTHONLIBS_FOUND) UNSET(Boost_FOUND) From e20587344992f9c487fd2b1ada9312ba257cecca Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Mon, 4 Sep 2023 14:36:40 -0700 Subject: [PATCH 27/31] Add vcpkg-configuration.json --- engine/vcpkg-configuration.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 engine/vcpkg-configuration.json diff --git a/engine/vcpkg-configuration.json b/engine/vcpkg-configuration.json new file mode 100644 index 0000000000..d3a0aa84ad --- /dev/null +++ b/engine/vcpkg-configuration.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json", + "default-registry": { + "kind": "git", + "baseline": "638b1588be3a265a9c7ad5b212cef72a1cad336a", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + } + ] +} From 3cbbbf95788c761a2c51100a7de3b8e5583efd85 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Mon, 4 Sep 2023 14:37:12 -0700 Subject: [PATCH 28/31] vcpkg.json: Update schema file URL --- engine/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/vcpkg.json b/engine/vcpkg.json index 2a5c5a6f49..39bc93b0c9 100644 --- a/engine/vcpkg.json +++ b/engine/vcpkg.json @@ -1,5 +1,5 @@ { - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "vega-strike", "version-string": "0.9.0", "dependencies": [ From a574ed31d8742e73b2bfaa01e6fbeeac35702bd6 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Mon, 4 Sep 2023 14:56:51 -0700 Subject: [PATCH 29/31] vcpkg-configuration.json: Update baseline --- engine/vcpkg-configuration.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/vcpkg-configuration.json b/engine/vcpkg-configuration.json index d3a0aa84ad..e0c00465ca 100644 --- a/engine/vcpkg-configuration.json +++ b/engine/vcpkg-configuration.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json", "default-registry": { "kind": "git", - "baseline": "638b1588be3a265a9c7ad5b212cef72a1cad336a", + "baseline": "9edb1b8e590cc086563301d735cae4b6e732d2d2", "repository": "https://github.com/microsoft/vcpkg" }, "registries": [ From eef1f8d21562e42b35ef9110a0166669247b22bf Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Tue, 10 Oct 2023 20:45:38 -0700 Subject: [PATCH 30/31] collide_map.cpp: Don't cache list_end, as discussed --- engine/src/cmd/collide_map.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/src/cmd/collide_map.cpp b/engine/src/cmd/collide_map.cpp index 5dcbcbb3d2..96fafffad0 100644 --- a/engine/src/cmd/collide_map.cpp +++ b/engine/src/cmd/collide_map.cpp @@ -160,9 +160,8 @@ void CollideArray::flatten() { collideUpdate(*tmp, index); } - auto listend = toflattenhints[i].end(); for (auto j = toflattenhints[i].begin(); - j != listend; + j != toflattenhints[i].end(); ++j) { if (j->radius != 0) { sorted[--index] = *j; From 31bcad7955f2f0f255d6e3442fd38f563785de5c Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Tue, 10 Oct 2023 20:45:38 -0700 Subject: [PATCH 31/31] collide_map.cpp: Don't cache list_end, as discussed --- engine/src/cmd/collide_map.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/src/cmd/collide_map.cpp b/engine/src/cmd/collide_map.cpp index 5dcbcbb3d2..96fafffad0 100644 --- a/engine/src/cmd/collide_map.cpp +++ b/engine/src/cmd/collide_map.cpp @@ -160,9 +160,8 @@ void CollideArray::flatten() { collideUpdate(*tmp, index); } - auto listend = toflattenhints[i].end(); for (auto j = toflattenhints[i].begin(); - j != listend; + j != toflattenhints[i].end(); ++j) { if (j->radius != 0) { sorted[--index] = *j;