Update to 1.11.0-RC1
This commit is contained in:
88
.changelog
88
.changelog
@@ -1,3 +1,91 @@
|
||||
1.11.0-RC1 (2021-03-14)
|
||||
------------------------------------------------------------------------
|
||||
Feature: Option to (dis-)allow hardware accelerated video drivers (#8819)
|
||||
Feature: Option to set display refresh rate (#8813)
|
||||
Feature: Allow custom width/height of screenshot and making heightmap screenshots via console (#8804)
|
||||
Feature: Allow filtering on name in rail station window (#8706)
|
||||
Feature: Setting for highest resolution of sprites to use (#8604)
|
||||
Add: Make NewGRF Scanner / World Generation update smoother and make aborting it react faster (#8830)
|
||||
Add: Malaysia Ringgit as Currency (#8783)
|
||||
Add: "Engines only" filter in build train window (#8733)
|
||||
Change: De-limit framerate window's framerate (#8772)
|
||||
Change: Clarify what effect town interactions have (#8744)
|
||||
Change: Don't show global goals in company goal windows (#8709)
|
||||
Change: Recolour graph windows to brown (#8700)
|
||||
Fix #8855: Bootstrap could result in an empty screen when bootstrap fails (#8856)
|
||||
Fix #8851: Don't allow infinite "exec" depth in script, but limit to 10 deep (#8852)
|
||||
Fix #8647: Incorrect drawing order of tram catenary sprites (#8843)
|
||||
Fix #8711: Having gui_zoom lower than zoom_min causes a crash (#8835)
|
||||
Fix #8810: "aircraft out of fuel" news shows the wrong place (#8832)
|
||||
Fix #8833: Don't reload NewGRFs when we are shutting down (#8830)
|
||||
Fix: Scale padding between elements the same as other padding (#8829)
|
||||
Fix #8808: [OSX, OpenGL] Crash on switching blitters due to double-mapping the video buffer (#8822)
|
||||
Fix #8784: Using Alt+Enter doesn't update the fullscreen toggle visibly (#8820)
|
||||
Fix #8817: Keep NewGRF order for object class sorting (#8818)
|
||||
Fix #8809: Crash when removing airport when hangar window open (#8815)
|
||||
Fix #8799: Crash when Search Internet in Multiplayer (#8801)
|
||||
Fix #8775: [Win32] Don't create the main window when Alt-Tabbing back into fullscreen (#8792)
|
||||
Fix #8774: Black screenshots when using 40bpp-blitter (#8791)
|
||||
Fix: [OSX] Hide dock when entering fullscreen (#8789)
|
||||
Fix: Bootstrap fails to start on clean install (#8788)
|
||||
Fix: Terraform limit acts random when maxing out per_64k_frames setting (#8782)
|
||||
Fix: Max-value of fast-forward-speed-limit can be outside its storage size (#8769)
|
||||
|
||||
|
||||
1.11.0-beta2 (2021-02-28)
|
||||
------------------------------------------------------------------------
|
||||
Feature: Add setting to limit fast-forward speed (#8766)
|
||||
Feature: Significant performance improvements to all video drivers (#8605, #8652, #8660, #8685, #8702, #8703, #8707, #8726, #8740)
|
||||
Feature: Configurable display refresh-rate, default to 60fps (#8680)
|
||||
Feature: Automatically upload releases to Steam (#8644)
|
||||
Feature: Generic Linux builds (#8641)
|
||||
Feature: [GS] Allow non-question type windows to have no buttons (#8638)
|
||||
Feature: [macOS] ZIP build (#8614)
|
||||
Feature: Object class selection string filtering (#8603)
|
||||
Feature: 'Remove all industries' button in scenario editor (#8550)
|
||||
Feature: Automatic UI and font zoom levels when supported by the OS (#8537)
|
||||
Feature: [macOS] Render screen at native resolution by default for HiDPI screens (#8519)
|
||||
Feature: OpenGL video driver (#7744)
|
||||
Add: Indonesia Rupiah currency (#8616)
|
||||
Change: Improve graph period markings (#8732)
|
||||
Change: Make pathfinder account for maximum order speed, if set (#8722)
|
||||
Change: Darken graph grid lines for legibility (#8690)
|
||||
Change: Make order window hotkeys toggle for load & unload variants (#8669)
|
||||
Change: Use a more specific error message when attempting to bulldoze your own HQ (#8667)
|
||||
Change: Convert .md to .rtf for Windows/Mac packages (#8617)
|
||||
Change: Move the 'tree placer algorithm' & 'road drive side' settings to the Settings window (#8566)
|
||||
Change: Move town name generator selection to mapgen GUI (#8566)
|
||||
Change: [macOS] Native font rendering (#8518)
|
||||
Fix: Display of network lobby windows for different GUI sizes (#8765)
|
||||
Fix: Don't desync if client leaves before you finish downloading map (#8755)
|
||||
Fix: Allow estimating vehicle clone cost even if short on money (#8748)
|
||||
Fix: Don't notify twice that a client left because of a timeout (#8746)
|
||||
Fix: Vehicle cursor size did not account for the interface zoom level (#8739)
|
||||
Fix #8123: Trams on half-tiles couldn't find depots (#8738)
|
||||
Fix #8276: [NewGRF] Crash when an object's size was not set (#8719)
|
||||
Fix #8349: Close depot vehicle list windows when closing the depot window (#8717)
|
||||
Fix #8594: [NRT] Road pathfinder did not account for roadtype speed limits or lengths of tunnels/bridges (#8710)
|
||||
Fix: Whole status bar instead of money widget refreshed on money change (#8692)
|
||||
Fix: Unnecessary status bar redraws when there is no news to show (#8691)
|
||||
Fix: New orders are non-stop by default (#8689)
|
||||
Fix: Framerate window showed a slightly higher rate than actually measured (#8682)
|
||||
Fix: Autorenew failure advice due to bad refit being shown to all companies (#8681)
|
||||
Fix #8625: Wrong ending year was displayed in highscore table (#8672)
|
||||
Fix #8620: Scale spacing between date & news in history window according to font scaling (#8671)
|
||||
Fix: [Win32] Set minimum resolution for timers to 1ms (#8660)
|
||||
Fix: Mention our websites with https:// (instead of http://) (#8657)
|
||||
Fix: [Emscripten] Open links in browser (#8655)
|
||||
Fix: Don't crash when towns upgrade road tiles during expansion (#8651)
|
||||
Fix #8029: [SDL2] Blank display when under Wayland (#8648)
|
||||
Fix: Default Network Server List sorter put compatible servers in wrong order (#8626)
|
||||
Fix: Use non-pulsating red highlight for coverage (#8622)
|
||||
Fix: Center text and image in vehicle statusbar vertically (#8602)
|
||||
Fix: Don't walk out of the map when trying to build tunnels (#8600)
|
||||
Fix: Off-by-one error in desert/rainforest positioning at world gen (#8588)
|
||||
Fix #8037: Crash when restarting AI that is controlling the same company as the player (#8587)
|
||||
Fix: Stopped ships shouldn't block depots (#8578)
|
||||
|
||||
|
||||
1.11.0-beta1 (2021-01-22)
|
||||
------------------------------------------------------------------------
|
||||
Feature: [GS] Ability to set some extra text in the industry window (#8576)
|
||||
|
||||
133
.github/workflows/ci-build.yml
vendored
133
.github/workflows/ci-build.yml
vendored
@@ -39,7 +39,7 @@ jobs:
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
make -j$(nproc) tools
|
||||
cmake --build . -j $(nproc) --target tools
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
@@ -56,7 +56,7 @@ jobs:
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
emmake make -j$(nproc)
|
||||
cmake --build . -j $(nproc)
|
||||
echo "::endgroup::"
|
||||
|
||||
linux:
|
||||
@@ -66,10 +66,18 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- compiler: clang
|
||||
cxxcompiler: clang++
|
||||
- compiler: gcc
|
||||
cxxcompiler: g++
|
||||
- compiler: clang
|
||||
cxxcompiler: clang++
|
||||
libsdl: libsdl2-dev
|
||||
- compiler: gcc
|
||||
cxxcompiler: g++
|
||||
libsdl: libsdl2-dev
|
||||
- compiler: gcc
|
||||
cxxcompiler: g++
|
||||
libsdl: libsdl1.2-dev
|
||||
- compiler: gcc
|
||||
cxxcompiler: g++
|
||||
extra-cmake-parameters: -DOPTION_DEDICATED=ON
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
@@ -88,12 +96,12 @@ jobs:
|
||||
|
||||
echo "::group::Install dependencies"
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
liballegro4-dev \
|
||||
libfontconfig-dev \
|
||||
libicu-dev \
|
||||
liblzma-dev \
|
||||
liblzo2-dev \
|
||||
libsdl1.2-dev \
|
||||
libsdl2-dev \
|
||||
${{ matrix.libsdl }} \
|
||||
zlib1g-dev \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
@@ -124,18 +132,18 @@ jobs:
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ..
|
||||
cmake .. ${{ matrix.extra-cmake-parameters }}
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
make -j$(nproc)
|
||||
cmake --build . -j $(nproc)
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
cd build
|
||||
make -j$(nproc) test
|
||||
ctest -j $(nproc)
|
||||
|
||||
macos:
|
||||
name: Mac OS
|
||||
@@ -155,13 +163,27 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare vcpkg (with cache)
|
||||
uses: lukka/run-vcpkg@v6
|
||||
- name: Prepare cache key
|
||||
id: key
|
||||
run: |
|
||||
echo "::set-output name=image::$ImageOS-$ImageVersion"
|
||||
|
||||
- name: Enable vcpkg cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
vcpkgDirectory: '/usr/local/share/vcpkg'
|
||||
doNotUpdateVcpkg: true
|
||||
vcpkgArguments: 'freetype liblzma lzo'
|
||||
vcpkgTriplet: '${{ matrix.arch }}-osx'
|
||||
path: /usr/local/share/vcpkg/installed
|
||||
key: ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}-0 # Increase the number whenever dependencies are modified
|
||||
restore-keys: |
|
||||
${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}
|
||||
|
||||
- name: Prepare vcpkg
|
||||
run: |
|
||||
vcpkg install --triplet=${{ matrix.arch }}-osx \
|
||||
liblzma \
|
||||
libpng \
|
||||
lzo \
|
||||
zlib \
|
||||
# EOF
|
||||
|
||||
- name: Install OpenGFX
|
||||
run: |
|
||||
@@ -196,13 +218,13 @@ jobs:
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
||||
make -j$(sysctl -n hw.logicalcpu)
|
||||
cmake --build . -j $(sysctl -n hw.logicalcpu)
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
cd build
|
||||
make -j$(sysctl -n hw.logicalcpu) test
|
||||
ctest -j $(sysctl -n hw.logicalcpu)
|
||||
|
||||
windows:
|
||||
name: Windows
|
||||
@@ -210,35 +232,41 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: x86
|
||||
- arch: x64
|
||||
os: [windows-latest, windows-2016]
|
||||
arch: [x86, x64]
|
||||
|
||||
runs-on: windows-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# "restore-cache" which is done by "run-vcpkg" uses Windows tar.
|
||||
# A git clone on windows marks a few files as read-only; when Windows tar
|
||||
# tries to extract the cache over this folder, it fails, despite the files
|
||||
# being identical. This failure shows up as an warning in the logs. We
|
||||
# avoid this by simply removing the read-only mark from the git folder.
|
||||
# In other words: this is a hack!
|
||||
# See: https://github.com/lukka/run-vcpkg/issues/61
|
||||
- name: Remove read-only flag from vcpkg git folder
|
||||
- name: Prepare cache key
|
||||
id: key
|
||||
shell: powershell
|
||||
run: |
|
||||
attrib -r "c:\vcpkg\.git\*.*" /s
|
||||
# Work around caching failure with GNU tar
|
||||
New-Item -Type Junction -Path vcpkg -Target c:\vcpkg
|
||||
|
||||
- name: Prepare vcpkg (with cache)
|
||||
uses: lukka/run-vcpkg@v6
|
||||
Write-Output "::set-output name=image::$env:ImageOS-$env:ImageVersion"
|
||||
|
||||
- name: Enable vcpkg cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
vcpkgDirectory: 'c:/vcpkg'
|
||||
doNotUpdateVcpkg: true
|
||||
vcpkgArguments: 'liblzma libpng lzo zlib'
|
||||
vcpkgTriplet: '${{ matrix.arch }}-windows-static'
|
||||
path: vcpkg/installed
|
||||
key: ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}-0 # Increase the number whenever dependencies are modified
|
||||
restore-keys: |
|
||||
${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}
|
||||
|
||||
- name: Prepare vcpkg
|
||||
shell: bash
|
||||
run: |
|
||||
vcpkg install --triplet=${{ matrix.arch }}-windows-static \
|
||||
liblzma \
|
||||
libpng \
|
||||
lzo \
|
||||
zlib \
|
||||
# EOF
|
||||
|
||||
- name: Install OpenGFX
|
||||
shell: bash
|
||||
@@ -259,16 +287,31 @@ jobs:
|
||||
- name: Install MSVC problem matcher
|
||||
uses: ammaraskar/msvc-problem-matcher@master
|
||||
|
||||
- name: Build
|
||||
uses: lukka/run-cmake@v3
|
||||
- name: Configure developer command prompt for ${{ matrix.arch }}
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
|
||||
useVcpkgToolchainFile: true
|
||||
buildDirectory: '${{ github.workspace }}/build'
|
||||
cmakeAppendedArgs: ' -GNinja'
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake .. \
|
||||
-GNinja \
|
||||
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
|
||||
-DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build .
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Test
|
||||
shell: bash
|
||||
run: |
|
||||
cd ${GITHUB_WORKSPACE}/build
|
||||
ctest -C Debug
|
||||
ctest
|
||||
|
||||
417
.github/workflows/release.yml
vendored
417
.github/workflows/release.yml
vendored
@@ -230,7 +230,7 @@ jobs:
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
make docs
|
||||
cmake --build . --target docs
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Create bundles
|
||||
@@ -265,7 +265,104 @@ jobs:
|
||||
retention-days: 5
|
||||
|
||||
linux:
|
||||
name: Linux
|
||||
name: Linux (Generic)
|
||||
needs: source
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
container:
|
||||
# manylinux2014 is based on CentOS 7, but already has a lot of things
|
||||
# installed and preconfigured. It makes it easier to build OpenTTD.
|
||||
image: quay.io/pypa/manylinux2014_x86_64
|
||||
|
||||
steps:
|
||||
- name: Download source
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: internal-source
|
||||
|
||||
- name: Unpack source
|
||||
run: |
|
||||
tar -xf source.tar.gz --strip-components=1
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
echo "::group::Install dependencies"
|
||||
yum install -y \
|
||||
fontconfig-devel \
|
||||
freetype-devel \
|
||||
libicu-devel \
|
||||
libpng-devel \
|
||||
libpng-devel \
|
||||
lzo-devel \
|
||||
SDL2-devel \
|
||||
wget \
|
||||
xz-devel \
|
||||
zlib-devel \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
# The yum variant of fluidsynth depends on all possible audio drivers,
|
||||
# like jack, ALSA, pulseaudio, etc. This is not really useful for us,
|
||||
# as we route the output of fluidsynth back via our sound driver, and
|
||||
# as such do not use these audio driver outputs at all. So instead,
|
||||
# we compile fluidsynth ourselves, with as little dependencies as
|
||||
# possible. This currently means it picks up SDL2, but this is fine,
|
||||
# as we need SDL2 anyway.
|
||||
echo "::group::Install fluidsynth"
|
||||
wget https://github.com/FluidSynth/fluidsynth/archive/v2.1.6.tar.gz
|
||||
tar xf v2.1.6.tar.gz
|
||||
(
|
||||
cd fluidsynth-2.1.6
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
|
||||
cmake --build . -j $(nproc)
|
||||
cmake --install .
|
||||
)
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DOPTION_PACKAGE_DEPENDENCIES=ON \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
cmake --build . -j $(nproc)
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Create bundles
|
||||
run: |
|
||||
cd ${GITHUB_WORKSPACE}/build
|
||||
echo "::group::Run CPack"
|
||||
cpack
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Cleanup"
|
||||
# Remove the sha256 files CPack generates; we will do this ourself at
|
||||
# the end of this workflow.
|
||||
rm -f bundles/*.sha256
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Store bundles
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: openttd-linux-generic
|
||||
path: build/bundles
|
||||
retention-days: 5
|
||||
|
||||
linux-distro:
|
||||
name: Linux (Distros)
|
||||
needs: source
|
||||
|
||||
if: needs.source.outputs.is_tag == 'true'
|
||||
@@ -317,7 +414,6 @@ jobs:
|
||||
liblzma-dev \
|
||||
liblzo2-dev \
|
||||
libsdl2-dev \
|
||||
libxdg-basedir-dev \
|
||||
lsb-release \
|
||||
zlib1g-dev \
|
||||
# EOF
|
||||
@@ -342,12 +438,22 @@ jobs:
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
make -j$(nproc) package
|
||||
# Ubuntu 18.04 cmake does not support -j so we pass the option to the native tool
|
||||
cmake --build . -- -j $(nproc)
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Create bundles
|
||||
run: |
|
||||
cd ${GITHUB_WORKSPACE}/build
|
||||
echo "::group::Run CPack"
|
||||
cpack
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Cleanup"
|
||||
# Remove the sha256 files CPack generates; we will do this ourself at
|
||||
# the end of this workflow.
|
||||
rm -f bundles/*.sha256
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Store bundles
|
||||
uses: actions/upload-artifact@v2
|
||||
@@ -374,21 +480,42 @@ jobs:
|
||||
run: |
|
||||
tar -xf source.tar.gz --strip-components=1
|
||||
|
||||
# The following step can be removed when the build VM is updated with a revision of
|
||||
# vcpkg dating from roughly 01/01/2021 or later. At that point, `doNotUpdateVcpkg`
|
||||
# can be set to `true` and the `vcpkgGitCommitId` can be removed.
|
||||
- name: Update vcpkg
|
||||
- name: Install dependencies
|
||||
env:
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
cd /usr/local/share/vcpkg
|
||||
git fetch --unshallow
|
||||
brew install pandoc
|
||||
|
||||
- name: Prepare vcpkg (with cache)
|
||||
uses: lukka/run-vcpkg@v6
|
||||
- name: Prepare cache key
|
||||
id: key
|
||||
run: |
|
||||
echo "::set-output name=image::$ImageOS-$ImageVersion"
|
||||
|
||||
- name: Enable vcpkg cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
vcpkgDirectory: '/usr/local/share/vcpkg'
|
||||
doNotUpdateVcpkg: false
|
||||
vcpkgGitCommitId: 2a42024b53ebb512fb5dd63c523338bf26c8489c
|
||||
vcpkgArguments: 'freetype:x64-osx liblzma:x64-osx lzo:x64-osx freetype:arm64-osx liblzma:arm64-osx lzo:arm64-osx'
|
||||
path: /usr/local/share/vcpkg/installed
|
||||
key: ${{ steps.key.outputs.image }}-vcpkg-release-0 # Increase the number whenever dependencies are modified
|
||||
restore-keys: |
|
||||
${{ steps.key.outputs.image }}-vcpkg-release
|
||||
${{ steps.key.outputs.image }}-vcpkg-x64
|
||||
|
||||
- name: Prepare vcpkg
|
||||
run: |
|
||||
vcpkg install \
|
||||
liblzma:x64-osx \
|
||||
liblzma:arm64-osx \
|
||||
libpng:x64-osx \
|
||||
libpng:arm64-osx \
|
||||
lzo:x64-osx \
|
||||
lzo:arm64-osx \
|
||||
zlib:x64-osx \
|
||||
zlib:arm64-osx \
|
||||
# EOF
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- name: Build tools
|
||||
run: |
|
||||
@@ -404,12 +531,9 @@ jobs:
|
||||
|
||||
echo "::group::Build tools"
|
||||
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
||||
make -j$(sysctl -n hw.logicalcpu) tools
|
||||
cmake --build . -j $(sysctl -n hw.logicalcpu) --target tools
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- name: Import code signing certificates
|
||||
uses: Apple-Actions/import-codesign-certs@v1
|
||||
with:
|
||||
@@ -437,7 +561,7 @@ jobs:
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
||||
make -j$(sysctl -n hw.logicalcpu)
|
||||
cmake --build . -j $(sysctl -n hw.logicalcpu)
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Build x64
|
||||
@@ -460,25 +584,28 @@ jobs:
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
||||
make -j$(sysctl -n hw.logicalcpu)
|
||||
cmake --build . -j $(sysctl -n hw.logicalcpu)
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Build package
|
||||
- name: Create bundles
|
||||
run: |
|
||||
cd build-x64
|
||||
|
||||
echo "::group::Create universal binary"
|
||||
# Combine the `openttd` binaries from each build into a single file
|
||||
lipo -create -output openttd-universal ../build-*/openttd
|
||||
mv openttd-universal openttd
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
||||
make -j$(sysctl -n hw.logicalcpu) package
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Run CPack"
|
||||
cpack
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Cleanup"
|
||||
# Remove the sha256 files CPack generates; we will do this ourself at
|
||||
# the end of this workflow.
|
||||
rm -f bundles/*.sha256
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install gon
|
||||
env:
|
||||
@@ -496,6 +623,29 @@ jobs:
|
||||
cd build-x64
|
||||
../os/macosx/notarize.sh
|
||||
|
||||
- name: Build zip
|
||||
run: |
|
||||
cd build-x64
|
||||
|
||||
pushd _CPack_Packages/*/Bundle/openttd-*/
|
||||
|
||||
# Remove the Applications symlink from the staging folder
|
||||
rm -f Applications
|
||||
|
||||
# Remove the original dmg built by CPack to avoid a conflict when resolving
|
||||
# the zip_filename variable below
|
||||
rm -f ../*.dmg
|
||||
|
||||
zip_filename=(../openttd-*)
|
||||
|
||||
# Package up the existing, notarised .app into a zip file
|
||||
zip -r -9 ${zip_filename}.zip OpenTTD.app
|
||||
|
||||
popd
|
||||
|
||||
# Now move it into place to be uploaded
|
||||
mv _CPack_Packages/*/Bundle/openttd-*.zip bundles/
|
||||
|
||||
- name: Store bundles
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
@@ -512,8 +662,11 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- arch: x86
|
||||
host: x86
|
||||
- arch: x64
|
||||
host: x64
|
||||
- arch: arm64
|
||||
host: x64_arm64
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
@@ -528,55 +681,111 @@ jobs:
|
||||
run: |
|
||||
tar -xf source.tar.gz --strip-components=1
|
||||
|
||||
# "restore-cache" which is done by "run-vcpkg" uses Windows tar.
|
||||
# A git clone on windows marks a few files as read-only; when Windows tar
|
||||
# tries to extract the cache over this folder, it fails, despite the files
|
||||
# being identical. This failure shows up as an warning in the logs. We
|
||||
# avoid this by simply removing the read-only mark from the git folder.
|
||||
# In other words: this is a hack!
|
||||
# See: https://github.com/lukka/run-vcpkg/issues/61
|
||||
- name: Remove read-only flag from vcpkg git folder
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
choco install pandoc
|
||||
|
||||
- name: Prepare cache key
|
||||
id: key
|
||||
shell: powershell
|
||||
run: |
|
||||
attrib -r "c:\vcpkg\.git\*.*" /s
|
||||
# Work around caching failure with GNU tar
|
||||
New-Item -Type Junction -Path vcpkg -Target c:\vcpkg
|
||||
|
||||
- name: Prepare vcpkg (with cache)
|
||||
uses: lukka/run-vcpkg@v6
|
||||
with:
|
||||
vcpkgDirectory: 'c:/vcpkg'
|
||||
doNotUpdateVcpkg: true
|
||||
vcpkgArguments: 'liblzma libpng lzo zlib'
|
||||
vcpkgTriplet: '${{ matrix.arch }}-windows-static'
|
||||
Write-Output "::set-output name=image::$env:ImageOS-$env:ImageVersion"
|
||||
|
||||
- name: Build tools
|
||||
uses: lukka/run-cmake@v3
|
||||
- name: Enable vcpkg cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
|
||||
useVcpkgToolchainFile: false
|
||||
buildDirectory: '${{ github.workspace }}/build-host'
|
||||
buildWithCMakeArgs: '--target tools'
|
||||
cmakeAppendedArgs: ' -GNinja -DOPTION_TOOLS_ONLY=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo'
|
||||
path: vcpkg/installed
|
||||
key: ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}-0 # Increase the number whenever dependencies are modified
|
||||
restore-keys: |
|
||||
${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}
|
||||
|
||||
- name: Prepare vcpkg
|
||||
shell: bash
|
||||
run: |
|
||||
vcpkg install --triplet=${{ matrix.arch }}-windows-static \
|
||||
liblzma \
|
||||
libpng \
|
||||
lzo \
|
||||
zlib \
|
||||
# EOF
|
||||
|
||||
- name: Install MSVC problem matcher
|
||||
uses: ammaraskar/msvc-problem-matcher@master
|
||||
|
||||
- name: Configure developer command prompt for tools
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
|
||||
- name: Build tools
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build-host
|
||||
cd build-host
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-GNinja \
|
||||
-DOPTION_TOOLS_ONLY=ON \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build . --target tools
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Configure developer command prompt for ${{ matrix.arch }}
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: ${{ matrix.host }}
|
||||
|
||||
- name: Build (with installer)
|
||||
if: needs.source.outputs.is_tag == 'true'
|
||||
uses: lukka/run-cmake@v3
|
||||
with:
|
||||
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
|
||||
useVcpkgToolchainFile: true
|
||||
buildDirectory: '${{ github.workspace }}/build'
|
||||
cmakeAppendedArgs: ' -GNinja -DOPTION_USE_NSIS=ON -DHOST_BINARY_DIR=${{ github.workspace }}/build-host -DCMAKE_BUILD_TYPE=RelWithDebInfo'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-GNinja \
|
||||
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
|
||||
-DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
|
||||
-DOPTION_USE_NSIS=ON \
|
||||
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build .
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Build (without installer)
|
||||
if: needs.source.outputs.is_tag != 'true'
|
||||
uses: lukka/run-cmake@v3
|
||||
with:
|
||||
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
|
||||
useVcpkgToolchainFile: true
|
||||
buildDirectory: '${{ github.workspace }}/build'
|
||||
cmakeAppendedArgs: ' -GNinja -DHOST_BINARY_DIR=${{ github.workspace }}/build-host -DCMAKE_BUILD_TYPE=RelWithDebInfo'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-GNinja \
|
||||
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
|
||||
-DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
|
||||
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build .
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Create bundles
|
||||
shell: bash
|
||||
@@ -606,11 +815,12 @@ jobs:
|
||||
retention-days: 5
|
||||
|
||||
upload:
|
||||
name: Upload
|
||||
name: Upload (AWS)
|
||||
needs:
|
||||
- source
|
||||
- docs
|
||||
- linux
|
||||
- linux-distro
|
||||
- macos
|
||||
- windows
|
||||
|
||||
@@ -619,7 +829,7 @@ jobs:
|
||||
# "always()" is important here, it is the keyword to use to stop skipping
|
||||
# this job if any dependency is skipped. It looks a bit silly, but it is
|
||||
# how GitHub Actions work ;)
|
||||
if: always() && needs.source.result == 'success' && needs.docs.result == 'success' && (needs.linux.result == 'success' || needs.linux.result == 'skipped') && needs.macos.result == 'success' && needs.windows.result == 'success'
|
||||
if: always() && needs.source.result == 'success' && needs.docs.result == 'success' && needs.linux.result == 'success' && (needs.linux-distro.result == 'success' || needs.linux-distro.result == 'skipped') && needs.macos.result == 'success' && needs.windows.result == 'success'
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
@@ -654,7 +864,7 @@ jobs:
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
||||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
|
||||
|
||||
- name: Trigger 'New OpenTTD release'
|
||||
uses: peter-evans/repository-dispatch@v1
|
||||
@@ -663,3 +873,80 @@ jobs:
|
||||
repository: OpenTTD/workflows
|
||||
event-type: ${{ needs.source.outputs.trigger_type }}
|
||||
client-payload: '{"version": "${{ needs.source.outputs.version }}", "folder": "${{ needs.source.outputs.folder }}"}'
|
||||
|
||||
upload-steam:
|
||||
name: Upload (Steam)
|
||||
needs:
|
||||
- source
|
||||
- linux
|
||||
- macos
|
||||
- windows
|
||||
|
||||
if: needs.source.outputs.trigger_type == 'new-master' || needs.source.outputs.trigger_type == 'new-tag'
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Download all bundles
|
||||
uses: actions/download-artifact@v2
|
||||
|
||||
- name: Setup steamcmd
|
||||
uses: CyberAndrii/setup-steamcmd@v1
|
||||
|
||||
- name: Generate Steam auth code
|
||||
id: steam-totp
|
||||
uses: CyberAndrii/steam-totp@v1
|
||||
with:
|
||||
shared_secret: ${{ secrets.STEAM_SHARED_SECRET }}
|
||||
|
||||
- name: Upload to Steam
|
||||
run: |
|
||||
echo "::group::Extracting source"
|
||||
mkdir source
|
||||
(
|
||||
cd source
|
||||
tar -xf ../internal-source/source.tar.gz --strip-components=1
|
||||
)
|
||||
echo "::endgroup::"
|
||||
|
||||
mkdir steam
|
||||
(
|
||||
cd steam
|
||||
|
||||
echo "::group::Prepare Win32"
|
||||
unzip ../openttd-windows-x86/openttd-*-windows-win32.zip
|
||||
mv openttd-*-windows-win32 steam-win32
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Prepare Win64"
|
||||
unzip ../openttd-windows-x64/openttd-*-windows-win64.zip
|
||||
mv openttd-*-windows-win64 steam-win64
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Prepare macOS"
|
||||
mkdir steam-macos
|
||||
(
|
||||
cd steam-macos
|
||||
unzip ../../openttd-macos-universal/openttd-*-macos-universal.zip
|
||||
)
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Prepare Linux"
|
||||
tar xvf ../openttd-linux-generic/openttd-*-linux-generic-amd64.tar.xz
|
||||
mv openttd-*-linux-generic-amd64 steam-linux
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Preparing build file"
|
||||
if [ "${{ needs.source.outputs.trigger_type }}" = "new-tag" ]; then
|
||||
BRANCH="testing"
|
||||
else
|
||||
BRANCH="nightly"
|
||||
fi
|
||||
cat ../source/os/steam/release.vdf | sed 's/@@DESCRIPTION@@/openttd-${{ needs.source.outputs.version }}/;s/@@BRANCH@@/'${BRANCH}'/' > release.vdf
|
||||
cat release.vdf
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Upload to Steam"
|
||||
steamcmd +login ${{ secrets.STEAM_USERNAME }} ${{ secrets.STEAM_PASSWORD }} ${{ steps.steam-totp.outputs.code }} +run_app_build $(pwd)/release.vdf +quit
|
||||
echo "::endgroup::"
|
||||
)
|
||||
|
||||
2
.ottdrev
2
.ottdrev
@@ -1 +1 @@
|
||||
1.11.0-beta1 20210122 0 a252679a121a3e989ba76fae29007151fdac26a1 1 1 2021
|
||||
1.11.0-RC1 20210314 0 ad256b5c1d50838beaeaf73a952aab257dab90b3 1 1 2021
|
||||
|
||||
@@ -1 +1 @@
|
||||
2021-01-22 10:21 UTC
|
||||
2021-03-14 20:54 UTC
|
||||
|
||||
112
CMakeLists.txt
112
CMakeLists.txt
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
|
||||
if(NOT BINARY_NAME)
|
||||
set(BINARY_NAME openttd)
|
||||
@@ -23,10 +23,13 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
|
||||
|
||||
# Use GNUInstallDirs to allow customisation
|
||||
# but set our own default data dir
|
||||
# but set our own default data and bin dir
|
||||
if(NOT CMAKE_INSTALL_DATADIR)
|
||||
set(CMAKE_INSTALL_DATADIR "share/games")
|
||||
endif()
|
||||
if(NOT CMAKE_INSTALL_BINDIR)
|
||||
set(CMAKE_INSTALL_BINDIR "games")
|
||||
endif()
|
||||
include(GNUInstallDirs)
|
||||
|
||||
include(Options)
|
||||
@@ -101,6 +104,11 @@ if(OPTION_TOOLS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
# Avoid searching for headers in Frameworks, and libraries in LIBDIR.
|
||||
set(CMAKE_FIND_FRAMEWORK LAST)
|
||||
endif()
|
||||
|
||||
# Prefer -pthread over -lpthread, which is often the better option of the two.
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD YES)
|
||||
# Make sure we have Threads available.
|
||||
@@ -111,25 +119,33 @@ find_package(LibLZMA)
|
||||
find_package(LZO)
|
||||
find_package(PNG)
|
||||
|
||||
if(NOT WIN32)
|
||||
find_package(Allegro)
|
||||
find_package(Freetype)
|
||||
if(NOT APPLE)
|
||||
find_package(SDL2)
|
||||
if(NOT SDL2_FOUND)
|
||||
find_package(SDL)
|
||||
if(NOT OPTION_DEDICATED)
|
||||
if(NOT WIN32)
|
||||
find_package(Allegro)
|
||||
if(NOT APPLE)
|
||||
find_package(Freetype)
|
||||
find_package(SDL2)
|
||||
if(NOT SDL2_FOUND)
|
||||
find_package(SDL)
|
||||
endif()
|
||||
find_package(Fluidsynth)
|
||||
find_package(Fontconfig)
|
||||
find_package(ICU OPTIONAL_COMPONENTS i18n lx)
|
||||
endif()
|
||||
find_package(Fluidsynth)
|
||||
find_package(Fontconfig)
|
||||
find_package(ICU OPTIONAL_COMPONENTS i18n lx)
|
||||
else()
|
||||
find_package(Iconv)
|
||||
|
||||
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
|
||||
find_library(AUDIOUNIT_LIBRARY AudioUnit)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
endif()
|
||||
endif()
|
||||
if(APPLE)
|
||||
find_package(Iconv)
|
||||
|
||||
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
|
||||
find_library(AUDIOUNIT_LIBRARY AudioUnit)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
find_library(QUARTZCORE_LIBRARY QuartzCore)
|
||||
endif()
|
||||
|
||||
if(NOT EMSCRIPTEN AND NOT OPTION_DEDICATED)
|
||||
find_package(OpenGL COMPONENTS OpenGL)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
find_package(Editbin REQUIRED)
|
||||
@@ -140,19 +156,14 @@ find_package(Xaudio2)
|
||||
|
||||
find_package(Grfcodec)
|
||||
|
||||
# IPO is only properly supported from CMake 3.9. Despite the fact we are
|
||||
# CMake 3.5, still enable IPO if we detect we are 3.9+.
|
||||
if(POLICY CMP0069)
|
||||
cmake_policy(SET CMP0069 NEW)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT IPO_FOUND)
|
||||
endif()
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT IPO_FOUND)
|
||||
|
||||
show_options()
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT OPTION_DEDICATED)
|
||||
if(NOT SDL_FOUND AND NOT SDL2_FOUND)
|
||||
message(FATAL_ERROR "SDL or SDL2 is required for this platform")
|
||||
if(NOT SDL_FOUND AND NOT SDL2_FOUND AND NOT ALLEGRO_FOUND)
|
||||
message(FATAL_ERROR "SDL, SDL2 or Allegro is required for this platform")
|
||||
endif()
|
||||
endif()
|
||||
if(APPLE)
|
||||
@@ -165,6 +176,30 @@ if(APPLE)
|
||||
if(NOT COCOA_LIBRARY)
|
||||
message(FATAL_ERROR "Cocoa is required for this platform")
|
||||
endif()
|
||||
if(NOT QUARTZCORE_LIBRARY)
|
||||
message(FATAL_ERROR "QuartzCore is required for this platform")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OPTION_PACKAGE_DEPENDENCIES)
|
||||
if(NOT UNIX)
|
||||
message(FATAL_ERROR "Can only package dependencies on Linux")
|
||||
endif()
|
||||
if(OPTION_INSTALL_FHS)
|
||||
message(FATAL_ERROR "Cannot install in FHS folders when we are packaging dependencies")
|
||||
endif()
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
|
||||
message(FATAL_ERROR "OPTION_PACKAGE_DEPENDENCIES can only work with CMake 3.16+; you are using ${CMAKE_VERSION}")
|
||||
endif()
|
||||
|
||||
# If we are packaging dependencies, we do two things:
|
||||
# 1) set the RPATH to include $ORIGIN/lib; $ORIGIN (that literal string)
|
||||
# is a Linux indicator for "path where application is". In CMake, we
|
||||
# have to do this before add_executable() is executed.
|
||||
# 2) copy the libraries that we compile against to the "lib" folder.
|
||||
# This is done in InstallAndPackage.cmake.
|
||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN/lib")
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
||||
endif()
|
||||
|
||||
include(SourceList)
|
||||
@@ -180,8 +215,13 @@ add_executable(openttd WIN32 ${GENERATED_SOURCE_FILES})
|
||||
set_target_properties(openttd PROPERTIES OUTPUT_NAME "${BINARY_NAME}")
|
||||
# All other files are added via target_sources()
|
||||
|
||||
if(MSVC)
|
||||
# Add DPI manifest to project; other WIN32 targets get this via ottdres.rc
|
||||
target_sources(openttd PRIVATE "${CMAKE_SOURCE_DIR}/os/windows/openttd.manifest")
|
||||
endif()
|
||||
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/src)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/media/baseset)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/media)
|
||||
|
||||
add_dependencies(openttd
|
||||
find_version)
|
||||
@@ -189,6 +229,7 @@ add_dependencies(openttd
|
||||
target_link_libraries(openttd
|
||||
openttd::languages
|
||||
openttd::settings
|
||||
openttd::media
|
||||
openttd::basesets
|
||||
openttd::script_api
|
||||
Threads::Threads
|
||||
@@ -217,6 +258,16 @@ if(NOT OPTION_DEDICATED)
|
||||
link_package(Fontconfig TARGET Fontconfig::Fontconfig)
|
||||
link_package(ICU_lx)
|
||||
link_package(ICU_i18n)
|
||||
|
||||
if(SDL2_FOUND AND OPENGL_FOUND AND UNIX)
|
||||
# SDL2 dynamically loads OpenGL if needed, so do not link to OpenGL when
|
||||
# on Linux. For Windows, we need to link to OpenGL as we also have a win32
|
||||
# driver using it.
|
||||
add_definitions(-DWITH_OPENGL)
|
||||
message(STATUS "OpenGL found -- -DWITH_OPENGL -- (via SDL2)")
|
||||
else()
|
||||
link_package(OpenGL TARGET OpenGL::GL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
@@ -226,6 +277,7 @@ if(APPLE)
|
||||
${AUDIOTOOLBOX_LIBRARY}
|
||||
${AUDIOUNIT_LIBRARY}
|
||||
${COCOA_LIBRARY}
|
||||
${QUARTZCORE_LIBRARY}
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
@@ -313,4 +365,8 @@ endif()
|
||||
include(CreateRegression)
|
||||
create_regression()
|
||||
|
||||
if(APPLE OR WIN32)
|
||||
find_package(Pandoc)
|
||||
endif()
|
||||
|
||||
include(InstallAndPackage)
|
||||
|
||||
@@ -57,6 +57,9 @@ To install both the x64 (64bit) and x86 (32bit) variants (though only one is nec
|
||||
```
|
||||
|
||||
You can open the folder (as a CMake project). CMake will be detected, and you can compile from there.
|
||||
If libraries are installed but not found, you need to set VCPKG_TARGET_TRIPLET in CMake parameters.
|
||||
For Visual Studio 2017 you also need to set CMAKE_TOOLCHAIN_FILE.
|
||||
(Typical values are shown in the MSVC project file command line example)
|
||||
|
||||
Alternatively, you can create a MSVC project file via CMake. For this
|
||||
either download CMake from https://cmake.org/download/ or use the version
|
||||
@@ -73,6 +76,7 @@ in the build folder are MSVC project files. MSVC can rebuild the project
|
||||
files himself via the `ZERO_CHECK` project.
|
||||
|
||||
## All other platforms
|
||||
Minimum required version of CMake is 3.9.
|
||||
|
||||
```bash
|
||||
mkdir build
|
||||
|
||||
@@ -1,3 +1,91 @@
|
||||
1.11.0-RC1 (2021-03-14)
|
||||
------------------------------------------------------------------------
|
||||
Feature: Option to (dis-)allow hardware accelerated video drivers (#8819)
|
||||
Feature: Option to set display refresh rate (#8813)
|
||||
Feature: Allow custom width/height of screenshot and making heightmap screenshots via console (#8804)
|
||||
Feature: Allow filtering on name in rail station window (#8706)
|
||||
Feature: Setting for highest resolution of sprites to use (#8604)
|
||||
Add: Make NewGRF Scanner / World Generation update smoother and make aborting it react faster (#8830)
|
||||
Add: Malaysia Ringgit as Currency (#8783)
|
||||
Add: "Engines only" filter in build train window (#8733)
|
||||
Change: De-limit framerate window's framerate (#8772)
|
||||
Change: Clarify what effect town interactions have (#8744)
|
||||
Change: Don't show global goals in company goal windows (#8709)
|
||||
Change: Recolour graph windows to brown (#8700)
|
||||
Fix #8855: Bootstrap could result in an empty screen when bootstrap fails (#8856)
|
||||
Fix #8851: Don't allow infinite "exec" depth in script, but limit to 10 deep (#8852)
|
||||
Fix #8647: Incorrect drawing order of tram catenary sprites (#8843)
|
||||
Fix #8711: Having gui_zoom lower than zoom_min causes a crash (#8835)
|
||||
Fix #8810: "aircraft out of fuel" news shows the wrong place (#8832)
|
||||
Fix #8833: Don't reload NewGRFs when we are shutting down (#8830)
|
||||
Fix: Scale padding between elements the same as other padding (#8829)
|
||||
Fix #8808: [OSX, OpenGL] Crash on switching blitters due to double-mapping the video buffer (#8822)
|
||||
Fix #8784: Using Alt+Enter doesn't update the fullscreen toggle visibly (#8820)
|
||||
Fix #8817: Keep NewGRF order for object class sorting (#8818)
|
||||
Fix #8809: Crash when removing airport when hangar window open (#8815)
|
||||
Fix #8799: Crash when Search Internet in Multiplayer (#8801)
|
||||
Fix #8775: [Win32] Don't create the main window when Alt-Tabbing back into fullscreen (#8792)
|
||||
Fix #8774: Black screenshots when using 40bpp-blitter (#8791)
|
||||
Fix: [OSX] Hide dock when entering fullscreen (#8789)
|
||||
Fix: Bootstrap fails to start on clean install (#8788)
|
||||
Fix: Terraform limit acts random when maxing out per_64k_frames setting (#8782)
|
||||
Fix: Max-value of fast-forward-speed-limit can be outside its storage size (#8769)
|
||||
|
||||
|
||||
1.11.0-beta2 (2021-02-28)
|
||||
------------------------------------------------------------------------
|
||||
Feature: Add setting to limit fast-forward speed (#8766)
|
||||
Feature: Significant performance improvements to all video drivers (#8605, #8652, #8660, #8685, #8702, #8703, #8707, #8726, #8740)
|
||||
Feature: Configurable display refresh-rate, default to 60fps (#8680)
|
||||
Feature: Automatically upload releases to Steam (#8644)
|
||||
Feature: Generic Linux builds (#8641)
|
||||
Feature: [GS] Allow non-question type windows to have no buttons (#8638)
|
||||
Feature: [macOS] ZIP build (#8614)
|
||||
Feature: Object class selection string filtering (#8603)
|
||||
Feature: 'Remove all industries' button in scenario editor (#8550)
|
||||
Feature: Automatic UI and font zoom levels when supported by the OS (#8537)
|
||||
Feature: [macOS] Render screen at native resolution by default for HiDPI screens (#8519)
|
||||
Feature: OpenGL video driver (#7744)
|
||||
Add: Indonesia Rupiah currency (#8616)
|
||||
Change: Improve graph period markings (#8732)
|
||||
Change: Make pathfinder account for maximum order speed, if set (#8722)
|
||||
Change: Darken graph grid lines for legibility (#8690)
|
||||
Change: Make order window hotkeys toggle for load & unload variants (#8669)
|
||||
Change: Use a more specific error message when attempting to bulldoze your own HQ (#8667)
|
||||
Change: Convert .md to .rtf for Windows/Mac packages (#8617)
|
||||
Change: Move the 'tree placer algorithm' & 'road drive side' settings to the Settings window (#8566)
|
||||
Change: Move town name generator selection to mapgen GUI (#8566)
|
||||
Change: [macOS] Native font rendering (#8518)
|
||||
Fix: Display of network lobby windows for different GUI sizes (#8765)
|
||||
Fix: Don't desync if client leaves before you finish downloading map (#8755)
|
||||
Fix: Allow estimating vehicle clone cost even if short on money (#8748)
|
||||
Fix: Don't notify twice that a client left because of a timeout (#8746)
|
||||
Fix: Vehicle cursor size did not account for the interface zoom level (#8739)
|
||||
Fix #8123: Trams on half-tiles couldn't find depots (#8738)
|
||||
Fix #8276: [NewGRF] Crash when an object's size was not set (#8719)
|
||||
Fix #8349: Close depot vehicle list windows when closing the depot window (#8717)
|
||||
Fix #8594: [NRT] Road pathfinder did not account for roadtype speed limits or lengths of tunnels/bridges (#8710)
|
||||
Fix: Whole status bar instead of money widget refreshed on money change (#8692)
|
||||
Fix: Unnecessary status bar redraws when there is no news to show (#8691)
|
||||
Fix: New orders are non-stop by default (#8689)
|
||||
Fix: Framerate window showed a slightly higher rate than actually measured (#8682)
|
||||
Fix: Autorenew failure advice due to bad refit being shown to all companies (#8681)
|
||||
Fix #8625: Wrong ending year was displayed in highscore table (#8672)
|
||||
Fix #8620: Scale spacing between date & news in history window according to font scaling (#8671)
|
||||
Fix: [Win32] Set minimum resolution for timers to 1ms (#8660)
|
||||
Fix: Mention our websites with https:// (instead of http://) (#8657)
|
||||
Fix: [Emscripten] Open links in browser (#8655)
|
||||
Fix: Don't crash when towns upgrade road tiles during expansion (#8651)
|
||||
Fix #8029: [SDL2] Blank display when under Wayland (#8648)
|
||||
Fix: Default Network Server List sorter put compatible servers in wrong order (#8626)
|
||||
Fix: Use non-pulsating red highlight for coverage (#8622)
|
||||
Fix: Center text and image in vehicle statusbar vertically (#8602)
|
||||
Fix: Don't walk out of the map when trying to build tunnels (#8600)
|
||||
Fix: Off-by-one error in desert/rainforest positioning at world gen (#8588)
|
||||
Fix #8037: Crash when restarting AI that is controlling the same company as the player (#8587)
|
||||
Fix: Stopped ships shouldn't block depots (#8578)
|
||||
|
||||
|
||||
1.11.0-beta1 (2021-01-22)
|
||||
------------------------------------------------------------------------
|
||||
Feature: [GS] Ability to set some extra text in the industry window (#8576)
|
||||
|
||||
@@ -27,9 +27,6 @@ macro(compile_flags)
|
||||
# Enable multi-threaded compilation.
|
||||
add_compile_options(/MP)
|
||||
endif()
|
||||
|
||||
# Add DPI manifest to project; other WIN32 targets get this via ottdres.rc
|
||||
list(APPEND GENERATED_SOURCE_FILES "${CMAKE_SOURCE_DIR}/os/windows/openttd.manifest")
|
||||
endif()
|
||||
|
||||
# Add some -D flags for Debug builds. We cannot use add_definitions(), because
|
||||
|
||||
@@ -10,8 +10,8 @@ macro(create_regression)
|
||||
# build folder before we can run the regression
|
||||
file(GLOB_RECURSE REGRESSION_SOURCE_FILES ${CMAKE_SOURCE_DIR}/regression/*)
|
||||
foreach(REGRESSION_SOURCE_FILE IN LISTS REGRESSION_SOURCE_FILES)
|
||||
string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/regression/" "${CMAKE_BINARY_DIR}/ai/" REGRESSION_BINARY_FILE "${REGRESSION_SOURCE_FILE}")
|
||||
string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/regression/" "" REGRESSION_SOURCE_FILE_NAME "${REGRESSION_SOURCE_FILE}")
|
||||
string(REPLACE "${CMAKE_SOURCE_DIR}/regression/" "" REGRESSION_SOURCE_FILE_NAME "${REGRESSION_SOURCE_FILE}")
|
||||
string(CONCAT REGRESSION_BINARY_FILE "${CMAKE_BINARY_DIR}/ai/" "${REGRESSION_SOURCE_FILE_NAME}")
|
||||
|
||||
if("${REGRESSION_SOURCE_FILE_NAME}" STREQUAL "regression.cfg")
|
||||
continue()
|
||||
|
||||
@@ -31,7 +31,7 @@ The following cache variables may also be set:
|
||||
#]=======================================================================]
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_Allegro QUIET allegro)
|
||||
pkg_check_modules(PC_Allegro QUIET allegro<5)
|
||||
|
||||
find_path(Allegro_INCLUDE_DIR
|
||||
NAMES allegro.h
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
# CMake provides a FindICU module since version 3.7.
|
||||
# But it doesn't use pkgconfig, doesn't set expected variables,
|
||||
# And it returns incomplete dependencies if only some modules are searched.
|
||||
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindICU
|
||||
-------
|
||||
|
||||
3
cmake/FindPandoc.cmake
Normal file
3
cmake/FindPandoc.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
if(NOT EXISTS ${PANDOC_EXECUTABLE})
|
||||
find_program(PANDOC_EXECUTABLE pandoc)
|
||||
endif()
|
||||
@@ -58,8 +58,18 @@ if(OPTION_INSTALL_FHS)
|
||||
COMPONENT manual)
|
||||
endif()
|
||||
|
||||
# TODO -- Media files
|
||||
# TODO -- Menu files
|
||||
if(UNIX AND NOT APPLE)
|
||||
install(DIRECTORY
|
||||
${CMAKE_BINARY_DIR}/media/icons
|
||||
${CMAKE_BINARY_DIR}/media/pixmaps
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}
|
||||
COMPONENT media)
|
||||
|
||||
install(FILES
|
||||
${CMAKE_BINARY_DIR}/media/${BINARY_NAME}.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications
|
||||
COMPONENT menu)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
set(ARCHITECTURE "amd64")
|
||||
@@ -95,7 +105,14 @@ set(CPACK_PACKAGE_HOMEPAGE_URL "https://www.openttd.org/")
|
||||
set(CPACK_PACKAGE_CONTACT "OpenTTD <info@openttd.org>")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenTTD")
|
||||
set(CPACK_PACKAGE_CHECKSUM "SHA256")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.md")
|
||||
|
||||
if((APPLE OR WIN32) AND EXISTS ${PANDOC_EXECUTABLE})
|
||||
execute_process(COMMAND ${PANDOC_EXECUTABLE} "${CMAKE_SOURCE_DIR}/COPYING.md" -s -o "${CMAKE_BINARY_DIR}/COPYING.rtf")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/COPYING.rtf")
|
||||
else()
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.md")
|
||||
endif()
|
||||
|
||||
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
|
||||
set(CPACK_MONOLITHIC_INSTALL YES)
|
||||
set(CPACK_PACKAGE_EXECUTABLES "openttd;OpenTTD")
|
||||
@@ -123,8 +140,12 @@ elseif(UNIX)
|
||||
# With FHS, we can create deb/rpm/... Without it, they would be horribly broken
|
||||
# and not work. The other way around is also true; with FHS they are not
|
||||
# usable, and only flat formats work.
|
||||
if(NOT OPTION_INSTALL_FHS)
|
||||
if(OPTION_PACKAGE_DEPENDENCIES)
|
||||
set(CPACK_GENERATOR "TXZ")
|
||||
set(PLATFORM "generic")
|
||||
elseif(NOT OPTION_INSTALL_FHS)
|
||||
set(CPACK_GENERATOR "TXZ")
|
||||
set(PLATFORM "unknown")
|
||||
else()
|
||||
find_program(LSB_RELEASE_EXEC lsb_release)
|
||||
execute_process(COMMAND ${LSB_RELEASE_EXEC} -is
|
||||
@@ -149,7 +170,7 @@ elseif(UNIX)
|
||||
string(REGEX MATCH "ID=(.*)" _ ${OS_RELEASE_CONTENTS})
|
||||
set(DISTRO_ID ${CMAKE_MATCH_1})
|
||||
if(DISTRO_ID STREQUAL "arch")
|
||||
set(PLATFORM "generic")
|
||||
set(PLATFORM "arch")
|
||||
set(CPACK_GENERATOR "TXZ")
|
||||
else()
|
||||
set(UNSUPPORTED_PLATFORM_NAME "Linux distribution '${DISTRO_ID}' from /etc/os-release")
|
||||
@@ -163,12 +184,39 @@ elseif(UNIX)
|
||||
set(CPACK_GENERATOR "TXZ")
|
||||
message(WARNING "Unknown ${UNSUPPORTED_PLATFORM_NAME} found for packaging; can only pack to a txz. Please consider creating a Pull Request to add support for this distribution.")
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-linux-${PLATFORM}-${CPACK_SYSTEM_NAME}")
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-linux-${PLATFORM}-${CPACK_SYSTEM_NAME}")
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown OS found for packaging; please consider creating a Pull Request to add support for this OS.")
|
||||
endif()
|
||||
|
||||
include(CPack)
|
||||
|
||||
if(OPTION_PACKAGE_DEPENDENCIES)
|
||||
# Install all dependencies we can resolve, with the exception of ones that
|
||||
# every Linux machine should have. This should make this build as generic
|
||||
# as possible, where it runs on any machine with the same or newer libc
|
||||
# than the one this is compiled with.
|
||||
# We copy these libraries into lib/ folder, so they can be found on game
|
||||
# startup. See comment in root CMakeLists.txt for how this works exactly.
|
||||
install(CODE [[
|
||||
file(GET_RUNTIME_DEPENDENCIES
|
||||
RESOLVED_DEPENDENCIES_VAR DEPENDENCIES
|
||||
UNRESOLVED_DEPENDENCIES_VAR UNRESOLVED_DEPENDENCIES
|
||||
EXECUTABLES openttd
|
||||
POST_EXCLUDE_REGEXES "ld-linux|libc.so|libdl.so|libm.so|libgcc_s.so|libpthread.so|librt.so|libstdc...so")
|
||||
file(INSTALL
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
|
||||
FILES ${DEPENDENCIES}
|
||||
FOLLOW_SYMLINK_CHAIN)
|
||||
|
||||
# This should not be possible, but error out when a dependency cannot
|
||||
# be resolved.
|
||||
list(LENGTH UNRESOLVED_DEPENDENCIES UNRESOLVED_LENGTH)
|
||||
if(${UNRESOLVED_LENGTH} GREATER 0)
|
||||
message(FATAL_ERROR "Unresolved dependencies: ${UNRESOLVED_DEPENDENCIES}")
|
||||
endif()
|
||||
]])
|
||||
endif()
|
||||
|
||||
@@ -16,6 +16,7 @@ source_group("Sprite loaders" REGULAR_EXPRESSION "src/spriteloader/")
|
||||
source_group("Squirrel" REGULAR_EXPRESSION "src/3rdparty/squirrel/squirrel/")
|
||||
source_group("Tables" REGULAR_EXPRESSION "src/table/")
|
||||
source_group("Video" REGULAR_EXPRESSION "src/video/")
|
||||
source_group("Video/GL" REGULAR_EXPRESSION "src/3rdparty/opengl/")
|
||||
source_group("Widgets" REGULAR_EXPRESSION "src/widgets/")
|
||||
source_group("Windows files" REGULAR_EXPRESSION "src/os/windows/|\.rc$")
|
||||
|
||||
|
||||
@@ -44,7 +44,9 @@ endfunction()
|
||||
# set_options()
|
||||
#
|
||||
function(set_options)
|
||||
if(UNIX AND NOT APPLE)
|
||||
option(OPTION_PACKAGE_DEPENDENCIES "Copy dependencies into lib/ for easy packaging (Linux only)" OFF)
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT OPTION_PACKAGE_DEPENDENCIES)
|
||||
set(DEFAULT_OPTION_INSTALL_FHS ON)
|
||||
else()
|
||||
set(DEFAULT_OPTION_INSTALL_FHS OFF)
|
||||
@@ -76,6 +78,7 @@ endfunction()
|
||||
# show_options()
|
||||
#
|
||||
function(show_options)
|
||||
message(STATUS "Option Package Dependencies - ${OPTION_PACKAGE_DEPENDENCIES}")
|
||||
message(STATUS "Option Dedicated - ${OPTION_DEDICATED}")
|
||||
message(STATUS "Option Install FHS - ${OPTION_INSTALL_FHS}")
|
||||
message(STATUS "Option Use assert - ${OPTION_USE_ASSERTS}")
|
||||
|
||||
@@ -4,6 +4,16 @@ cmake_minimum_required(VERSION 3.5)
|
||||
# Create a single baseset meta file with the correct translations.
|
||||
#
|
||||
|
||||
if(NOT BASESET_SOURCE_FILE)
|
||||
message(FATAL_ERROR "Script needs BASESET_SOURCE_FILE defined")
|
||||
endif()
|
||||
if(NOT BASESET_BINARY_FILE)
|
||||
message(FATAL_ERROR "Script needs BASESET_BINARY_FILE defined")
|
||||
endif()
|
||||
if(NOT BASESET_EXTRAGRF_FILE)
|
||||
message(FATAL_ERROR "Script needs BASESET_EXTRAGRF_FILE defined")
|
||||
endif()
|
||||
|
||||
set(ARGC 1)
|
||||
set(ARG_READ NO)
|
||||
|
||||
|
||||
60
cmake/scripts/Desktop.cmake
Normal file
60
cmake/scripts/Desktop.cmake
Normal file
@@ -0,0 +1,60 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
#
|
||||
# Create a desktop file with the correct translations.
|
||||
#
|
||||
|
||||
if(NOT DESKTOP_SOURCE_FILE)
|
||||
message(FATAL_ERROR "Script needs DESKTOP_SOURCE_FILE defined")
|
||||
endif()
|
||||
if(NOT DESKTOP_BINARY_FILE)
|
||||
message(FATAL_ERROR "Script needs DESKTOP_BINARY_FILE defined")
|
||||
endif()
|
||||
if(NOT BINARY_NAME)
|
||||
message(FATAL_ERROR "Script needs BINARY_NAME defined")
|
||||
endif()
|
||||
|
||||
set(ARGC 1)
|
||||
set(ARG_READ NO)
|
||||
|
||||
# Read all the arguments given to CMake; we are looking for -- and everything
|
||||
# that follows. Those are our language files.
|
||||
while(ARGC LESS CMAKE_ARGC)
|
||||
set(ARG ${CMAKE_ARGV${ARGC}})
|
||||
|
||||
if(ARG_READ)
|
||||
list(APPEND LANG_SOURCE_FILES "${ARG}")
|
||||
endif()
|
||||
|
||||
if(ARG STREQUAL "--")
|
||||
set(ARG_READ YES)
|
||||
endif()
|
||||
|
||||
math(EXPR ARGC "${ARGC} + 1")
|
||||
endwhile()
|
||||
|
||||
# Place holder format is @<ini_key>_<str_id>@
|
||||
file(STRINGS "${DESKTOP_SOURCE_FILE}" PLACE_HOLDER REGEX "^@")
|
||||
string(REGEX REPLACE "@([^_]+).*@" "\\1" INI_KEY "${PLACE_HOLDER}")
|
||||
string(REGEX REPLACE "@[^_]+_(.*)@" "\\1" STR_ID "${PLACE_HOLDER}")
|
||||
string(REGEX REPLACE "@(.*)@" "\\1" PLACE_HOLDER "${PLACE_HOLDER}")
|
||||
|
||||
# Get the translations
|
||||
foreach(LANGFILE IN LISTS LANG_SOURCE_FILES)
|
||||
file(STRINGS "${LANGFILE}" LANGLINES REGEX "^(##isocode|${STR_ID})" ENCODING UTF-8)
|
||||
string(FIND "${LANGLINES}" "${STR_ID}" HAS_STR_ID)
|
||||
if(HAS_STR_ID LESS 0)
|
||||
continue()
|
||||
endif()
|
||||
string(REGEX REPLACE "##isocode ([^;]+).*" "\\1" ISOCODE "${LANGLINES}")
|
||||
if("${ISOCODE}" STREQUAL "en_GB")
|
||||
string(REGEX REPLACE "[^:]*:(.*)" "${INI_KEY}=\\1" LANGLINES "${LANGLINES}")
|
||||
else()
|
||||
string(REGEX REPLACE "[^:]*:(.*)" "${INI_KEY}[${ISOCODE}]=\\1" LANGLINES "${LANGLINES}")
|
||||
endif()
|
||||
list(APPEND ${PLACE_HOLDER} ${LANGLINES})
|
||||
endforeach()
|
||||
list(SORT ${PLACE_HOLDER})
|
||||
string(REPLACE ";" "\n" ${PLACE_HOLDER} "${${PLACE_HOLDER}}")
|
||||
|
||||
configure_file(${DESKTOP_SOURCE_FILE} ${DESKTOP_BINARY_FILE})
|
||||
@@ -53,6 +53,9 @@ string(REPLACE "0x(nil)" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
string(REPLACE "0x0000000000000000" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
string(REPLACE "0x0x0" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
|
||||
# Remove timestamps if any
|
||||
string(REGEX REPLACE "\[[0-9-]+ [0-9:]+\] " "" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
|
||||
# Convert the output to a format that is expected (and more readable) by result.txt
|
||||
string(REPLACE "\ndbg: [script]" "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
string(REPLACE "\n " "\nERROR: " REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
|
||||
@@ -16,11 +16,18 @@ endif()
|
||||
set(ARGC 1)
|
||||
set(ARG_READ NO)
|
||||
|
||||
# For MSVC CMake runs this script from a batch file using || to detect errors,
|
||||
# depending on source path it may quote args, and cause cmd to not understand ||
|
||||
# and pass it as argument to ourself.
|
||||
# Read all the arguments given to CMake; we are looking for -- and everything
|
||||
# that follows. Those are our api files.
|
||||
# that follows, until ||. Those are our api files.
|
||||
while(ARGC LESS CMAKE_ARGC)
|
||||
set(ARG ${CMAKE_ARGV${ARGC}})
|
||||
|
||||
if(ARG STREQUAL "||")
|
||||
set(ARG_READ NO)
|
||||
endif()
|
||||
|
||||
if(ARG_READ)
|
||||
list(APPEND SCRIPT_API_BINARY_FILES "${ARG}")
|
||||
endif()
|
||||
|
||||
@@ -5,10 +5,14 @@
|
||||
<meta name="Description" content="Structure of OpenTTD (OTTD) landscape arrays #2">
|
||||
<title>OpenTTD Landscape Internals - #2</title>
|
||||
<style type="text/css">
|
||||
span.abuse { font-family: "Courier New", Courier, mono; background-color: rgb(255, 58, 31); }
|
||||
span.option{ font-family: "Courier New", Courier, mono; background-color: rgb(255,255, 30); }
|
||||
span.free { font-family: "Courier New", Courier, mono; background-color: rgb(30, 178, 54); }
|
||||
span.used { font-family: "Courier New", Courier, mono; }
|
||||
span.free { font-family: "Courier New", Courier, mono; background-color: rgb( 70, 190, 70); }
|
||||
span.usable { font-family: "Courier New", Courier, mono; background-color: rgb( 50, 150, 150); }
|
||||
span.used { font-family: "Courier New", Courier, mono; background-color: rgb(120, 120, 255); }
|
||||
span.pool { font-family: "Courier New", Courier, mono; background-color: rgb(220, 120, 255); }
|
||||
span.patch { font-family: "Courier New", Courier, mono; background-color: rgb(255, 165, 0); }
|
||||
span.abuse { font-family: "Courier New", Courier, mono; background-color: rgb(255, 100, 100); }
|
||||
span.rearrange{ font-family: "Courier New", Courier, mono; background-color: rgb(160, 160, 255); }
|
||||
|
||||
td.bits { white-space: nowrap; text-align: center; font-family: "Courier New", Courier, mono; }
|
||||
td.caption { white-space: nowrap; text-align: left; }
|
||||
td li { white-space: nowrap; text-align: left; }
|
||||
@@ -20,13 +24,7 @@
|
||||
<span style="font-weight: bold;"></span>Nine attributes hold the information about a tile.
|
||||
This can be seen in the <a href="landscape.html">Landscape</a> document. This page tries to give an overview of used and free bits of
|
||||
the array so you can quickly see what is used and what is not.
|
||||
<ul>
|
||||
<li><span style="font-weight: bold;"><span class="free">O</span></span> - bit is free</li>
|
||||
<li><span style="font-weight: bold;"><span class="used">X</span></span> - bit is used</li>
|
||||
<li><span style="font-weight: bold;"><span class="abuse"> </span></span> - bit of attribute is abused for different purposes, i.e. other bits define the actual meaning.</li>
|
||||
<li><span style="font-weight: bold;"><span class="option">~</span></span> - bit is accessed, but does not really have a meaning (e.g. owner of clear land is always OWNER_NONE)</li>
|
||||
</ul>
|
||||
<p>
|
||||
|
||||
<ul>
|
||||
<li><span style="font-weight: bold;">type</span> - 8 bits in size, tile class (bits 4..7), bridge (bits 2..3) tropic zone (bits 0..1, only valid in tropic climate)</li>
|
||||
<li><span style="font-weight: bold;">height</span> - 8 bits in size, stores tile height</li>
|
||||
@@ -39,6 +37,16 @@ the array so you can quickly see what is used and what is not.
|
||||
<li><span style="font-weight: bold;">m7</span> - 8 bits in size, is used for general storage</li>
|
||||
<li><span style="font-weight: bold;">m8</span> - 16 bits in size, is used for general storage</li>
|
||||
</ul>
|
||||
<p>
|
||||
<ul>
|
||||
<li><span style="font-weight: bold;"><span class="free">O</span></span> - bit is free</li>
|
||||
<li><span style="font-weight: bold;"><span class="usable">X</span></span> - bit is used, but could be freed if needed</li>
|
||||
<li><span style="font-weight: bold;"><span class="used">X</span></span> - bit is used</li>
|
||||
<li><span style="font-weight: bold;"><span class="pool">X</span></span> - bit is used for an index on a pool</li>
|
||||
<li><span style="font-weight: bold;"><span class="patch">X</span></span> - bit is introduced by a patch</li>
|
||||
<li><span style="font-weight: bold;"><span class="abuse">X</span></span> - bit of attribute is abused for different purposes, i.e. other bits define the actual meaning</li>
|
||||
<li><span style="font-weight: bold;"><span class="rearrange">X</span></span> - bit is accessed, but a rearrangement of the map array could free some of these bits (probably not done for bit alignment)</li>
|
||||
</ul>
|
||||
|
||||
<table align=center border="1" cellpadding="2" cellspacing="2">
|
||||
<tbody>
|
||||
@@ -71,134 +79,103 @@ the array so you can quickly see what is used and what is not.
|
||||
<tr>
|
||||
<td rowspan="2">0</td>
|
||||
<td class="caption">ground</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOO</span><span class="option">~ ~~~~</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX <span class="free">OOOO</span></td>
|
||||
<td class="bits">XXXX XX<span class="free">OO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOO</span>X XX<span class="free">OO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits" rowspan=27><span class="used" title="Tile type">XXXX</span> <span class="used" title="Presence and direction of bridge above">XX</span> <span class="used" title="Tropic Zone: only meaningfull in tropic climate. It contains the definition of the available zones">XX</span></td>
|
||||
<td class="bits" rowspan=27><span class="used" title="Tile height">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OOO</span><span class="usable" title="Owner (always OWNER_NONE)">1 OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Type of hedge on NE border">XXX</span> <span class="used" title="Snow presence">X</span><span class="free">OOOO</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Type of hedge on SW border">XXX</span> <span class="used" title="Type of hedge on SE border">XXX</span><span class="free">OO</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Update counter">XXX</span> <span class="used" title="Type: grass, rough land, rocks, fields, snow, desert">XXX</span> <span class="used" title="Density">XX</span></td><td class="bits" rowspan=2><span class="free" >OOO</span><span class="used" title="Type of hedge on NW border">X XX</span><span class="free">OO</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">farmland</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOO</span>X XX<span class="free">OO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="pool" title="Industry index on pool">XXXX XXXX XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Type of hedge on NE border">XXX</span> <span class="used" title="Field production stage">XXXXX</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=3>1</td>
|
||||
<td class="caption">rail</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">X<span class="free">OO</span>X XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX <span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OO</span>XX XXXX</td>
|
||||
<td class="bits" rowspan=3><span class="used" title="Ship docking tile status (for half-tile with water)">X</span><span class="free">OO</span><span class="used" title="Owner">X XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="used" title="Reserved tracks">XXXX</span> <span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span> </td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="used" title="Ground type: fences, snow, desert">XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Rail tile type: rail, rail with signals, depot">OO</span> <span class="used" title="Track pieces">XXXXXX</span></td>
|
||||
<td class="bits" rowspan=3><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits" rowspan=3><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits" rowspan=3><span class="free">OOOO OOOO OO</span><span class="used" title="Railway type">XX XXXX</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">rail with signals</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX XXXX XXXX</td>
|
||||
<td class="bits">XXXX <span class="free">OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="used" title="Reserved tracks">XXXX</span> <span class="used" title="Signal types and sempahore/lights">XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Signals present">XXXX</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Signals colors">XXXX</span> <span class="used" title="Ground type: fences, snow, desert">XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Rail tile type: rail, rail with signals, depot">O1</span> <span class="used" title="Track pieces">XXXXXX</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">depot</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX</td>
|
||||
<td class="bits">XX<span class="free">O</span>X <span class="free">OO</span>XX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="pool" title="Depot index on pool">XXXX XXXX XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="used" title="Ground type: fences, snow, desert (fences on depot are not valid)">XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Rail tile type: rail, rail with signals, depot">11</span><span class="free">O</span><span class="used" title="PBS reservation">X</span> <span class="free">OO</span><span class="used" title="Depot exit direction">XX</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=3>2</td>
|
||||
<td class="caption">road</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOO</span>X XXXX</td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OO</span>XX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
|
||||
<td class="bits"><span class="free">OO</span>X<span class="free">O</span> XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX XX<span class="free">OO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOO</span><span class="used" title="Owner of road">X XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="pool" title="Town index on pool">XXXX XXXX XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Owner of tram">XXXX</span> <span class="used" title="Tram pieces">XXXX</span></td>
|
||||
<td class="bits" rowspan=3><span class="free">OO</span><span class="used" title="Road type">XX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Tile type: simple road (00), level crossing (01), road depot (10)">OO</span> <span class="used" title="Disallow vehicles to go a specific direction">XX</span> <span class="used" title="Road pieces">XXXX</span></td>
|
||||
<td class="bits"><span class="free">OO</span> <span class="used" title="Pavement type">XXX</span><span class="free">OOO</span></td>
|
||||
<td class="bits"><span class="free">OO</span><span class="used" title="Snow/desert present">X</span> <span class="free">O</span><span class="used" title="Roadworks counter">XXXX</span></td>
|
||||
<td class="bits" rowspan=1><span class="free">OOOO</span> <span class="used" title="Tram type">XXXX XX<span class="free">OO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">level crossing</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX <span class="free">OOO</span>X</td>
|
||||
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
|
||||
<td class="bits"><span class="free">OO</span>XX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOO</span><span class="used" title="Owner of rail track">X XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Owner of tram">XXXX</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Tile type: simple road (00), level crossing (01), road depot (10)">O1</span> <span class="used" title="Lights are on">X</span> <span class="used" title="PBS reservation">X</span><span class="free">OOO</span><span class="used" title="Direction of the rail and roads">X</span></td>
|
||||
<td class="bits"><span class="free">OO</span> <span class="used" title="Pavement type">XXX</span><span class="free">OOO</span></td>
|
||||
<td class="bits"><span class="free">OO</span><span class="used" title="Snow/desert present">X</span> <span class="used" title="Owner of road">XXXXX</span></td>
|
||||
<td class="bits" rowspan=1><span class="free">OOOO</span> <span class="used" title="Tram type">XXXX XX</span> <span class="used" title="Railway type">XXXXXX</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">road depot</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX <span class="free">OOOO</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XX<span class="free">OO OO</span>XX</td>
|
||||
<td class="bits"><span class="free">OOO</span><span class="used" title="Owner of the depot">X XXXX</span></td>
|
||||
<td class="bits"><span class="pool" title="Depot index on pool">XXXX XXXX XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="usable" title="Owner of tram depot">XXXX</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Tile type: simple road (00), level crossing (01), road depot (10)">1O</span><span class="free">OO OO</span><span class="used" title="Depot exit direction">XX</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OO</span>X<span class="free">O</span> XXXX</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OO</span><span class="used" title="Snow/desert present">X</span> <span class="usable" title="Owner of road depot">XXXXX</span></td>
|
||||
<td class="bits" rowspan=1><span class="free">OOOO</span> <span class="used" title="Tram type">XXXX XX</span><span class="free">OO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
<td class="caption">house</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits">XX<span class="free">O</span><span class="option">~ ~~</span>XX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXX<span class="abuse">X XXXX</span></td>
|
||||
<td class="bits"><span class="abuse">XXXX XX</span><span class="free">OO</span></td>
|
||||
<td class="bits">XXXX <span class="abuse">XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td rowspan=2>3</td>
|
||||
<td class="caption">finished house</td>
|
||||
<td class="bits" rowspan=2><span class="used" title="House random bits">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="pool" title="Town index on pool">XXXX XXXX XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="House is complete/in construction (see m5)">1</span> <span class="used" title="House type (m4 + m3[6])">X</span><span class="free">O</span><span class="usable" title="Activated triggers (bits 2..4 don't have a meaning)">XXX</span><span class="used" title="Activated triggers (bits 2..4 don't have a meaning)">XX</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="House type (m4 + m3[6])">XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Age in years, clamped at 255">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="abuse" title="Newhouses activated: periodic processing time remaining; if not, lift position for houses 04 and 05">XXXX XX</span><span class="free">OO</span></td>
|
||||
<td class="bits" rowspan=2><span class="abuse" title="If newhouses active, m7 is the current animation frame">XXXX</span> <span class="abuse" title="If newhouses active, m7 is the current animantion frame; if not, lift behaviour for houses 04 and 05">XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">house under construction</td>
|
||||
<td class="bits"><span class="used" title="House is complete/in construction (see m5)">O</span> <span class="used" title="House type (m4 + m3[6])">X</span><span class="free">O</span><span class="usable" title="Activated triggers (bits 2..4 don't have a meaning)">XXX</span><span class="used" title="Activated triggers (bits 2..4 don't have a meaning)">XX</span></td>
|
||||
<td class="bits"><span class="free">OOO</span><span class="used" title="Construction stage">XX</span> <span class="used" title="Construction counter">XXX</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>4</td>
|
||||
<td class="caption">trees</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">O</span>XX<span class="option">~ ~~~~</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOO</span>X XXXX XXXX</td>
|
||||
<td class="bits"><span class="option">~~</span>XX XXXX</td>
|
||||
<td class="bits"><span class="free">O</span><span class="used" title="Water class">XX</span><span class="usable" title="Owner (always OWNER_NONE)">1 OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOO</span><span class="used" title="Tree ground">XXX</span> <span class="used" title="Tree density">XX</span> <span class="used" title="Tree counter">XXXX</span></td>
|
||||
<td class="bits"><span class="usable" title="Tree type unused bits">XX</span><span class="used" title="Tree type">XX XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XX<span class="free">OO O</span>XXX</td>
|
||||
<td class="bits"><span class="used" title="Number of trees on tile (+1)">XX</span><span class="free">OO O</span><span class="used" title="Tree growth">XXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
@@ -206,189 +183,155 @@ the array so you can quickly see what is used and what is not.
|
||||
<tr>
|
||||
<td rowspan=7>5</td>
|
||||
<td class="caption">rail station</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits">XXXX <span class="free">OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OO</span>XX XX<span class="free">OO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OO</span>XX XXXX</td>
|
||||
<td class="bits" rowspan=7><span class="free">O</span><span class="used" title="Water class">XX</span> <span class="used" title="Owner">XXXXX</span></td>
|
||||
<td class="bits" rowspan=7><span class="pool" title="Station index on pool">XXXX XXXX XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Random bits">XXXX</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Custom station specifications ID">XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Graphics index">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OO</span><span class="used" title="Station type">XXX</span> <span class="used" title="Reserved track">X</span><span class="free">OO</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Animation frame">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OOOO OOOO OO</span><span class="used" title="Railway type">XX XXXX</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">rail waypoint</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="usable" title="Graphics index">OOOO OOO</span><span class="used" title="Graphics index">X</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">road stop</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="free">OO</span>XX XXXX</td>
|
||||
<td class="bits"><span class="option">~~~~ ~</span>XXX</td>
|
||||
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
|
||||
<td class="bits"><span class="free">OOO</span>X XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX XX<span class="free">OO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">dock</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="option">~~~~ ~</span>XXX</td>
|
||||
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Owner of tram">XXXX</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="free">OO</span><span class="used" title="Roadtype for road stop">XX XXXX</span></td>
|
||||
<td class="bits"><span class="usable" title="Graphics index">OOOO O</span><span class="used" title="Graphics index: 00 (exit towards NE), 01 (exit towards SE), 02 (exit towards SW), 03 (exit towards NW), 04 (drive through X), 05 (drive through Y)">XXX</span></td>
|
||||
<td class="bits" rowspan=5><span class="free">OO</span><span class="used" title="Station type">XX X</span><span class="free">OOO</span></td>
|
||||
<td class="bits"><span class="free">OOO</span><span class="used" title="Owner of road">X XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="used" title="Tram type">XXXX XX<span class="free">OO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">airport</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Random bits">XXXX</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Graphics index">XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Animation frame">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=4><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">dock</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="usable" title="Graphics index">OOOO </span><span class="usable" title="Graphics index">O</span><span class="used" title="Graphics index">XXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">buoy</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
|
||||
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
|
||||
<td class="bits"><span class="usable">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">oilrig</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
|
||||
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
|
||||
<td class="bits"><span class="usable">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=3>6</td>
|
||||
<td rowspan=4>6</td>
|
||||
<td class="caption">sea, shore</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits" rowspan=4><span class="used" title="Ship docking tile status">X</span> <span class="used" title="Water class">XX</span> <span class="used" title="Owner">XXXXX</span></td>
|
||||
<td class="bits" rowspan=3><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits" rowspan=4><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">X<span class="option">~~</span>X XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Water tile type: coast, clear, lock, depot">O<span class="usable">OO</span>O</span> <span class="free">OOO</span><span class="used" title="Sea shore flag">X</span></td>
|
||||
<td class="bits" rowspan=4><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits" rowspan=4><span class="free">OOOO OOOO</td>
|
||||
<td class="bits" rowspan=4><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">canal, river</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Canal/river random bits">XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Water tile type: coast, clear, lock, depot">O<span class="usable">OO</span>O</span> <span class="free">OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">lock</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Water tile type: coast, clear, lock, depot">O<span class="usable">OO</span>1</span> <span class="used" title="Lock part">XX</span> <span class="used" title="Lock orientation m5[1..0]">XX</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">shipdepot</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits"><span class="pool" title="Depot index on pool">XXXX XXXX XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Water tile type: coast, clear, lock, depot">1<span class="usable">OOO</span></span> <span class="free">OO</span><span class="used" title="Depot axis">X</span> <span class="used" title="Depot part">X</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8</td>
|
||||
<td class="caption">industry</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXX<span class="free">O</span> <span class="abuse">XXXX</span></td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OO</span>XX XX<span class="free">OO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td rowspan=2>8</td>
|
||||
<td class="caption">finished industry</td>
|
||||
<td class="bits"><span class="used" title="Completed industry">1</span> <span class="used" title="Water class">XX</span><span class="free">O</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits" rowspan=2><span class="pool" title="Industry index on pool">XXXX XXXX XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Random bits">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Animation loop">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Industry graphics ID (m5 + m6[2])">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OO</span><span class="used" title="Random triggers (NewGRF)">XXX</span> <span class="used" title="Industry graphics ID (m5 + m6[2])">X</span><span class="free">OO</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Animation frame">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">industry under construction</td>
|
||||
<td class="bits"><span class="used" title="Completed industry">O</span> <span class="used" title="Water class">XX</span><span class="free">O</span> <span class="used" title="If under construction, construction counter and stage of construction">XXXX</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=2>9</td>
|
||||
<td class="caption">tunnel entrance</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">X<span class="free">OO</span>X XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="free">OO</span>XX XXXX</td>
|
||||
<td class="bits">X<span class="free">OO</span>X XXXX</td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Ship docking tile status (for aqueducts)">X</span><span class="free">OO</span> <span class="used" title="Owner">XXXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits" rowspan=2><span class="rearrange" title="Owner of tram (road only; a rearrangement can free some of these bits)">XXXX</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OO</span><span class="used" title="Road type">XX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Bridge or tunnel bit">O</span><span class="free">OO</span><span class="rearrange" title="PBS reservation (rail; a rearrangement can free some of these bits)">X</span> <span class="used" title="Transport type">XX</span> <span class="used" title="Direction of the tunnel/bridge">XX</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OO</span>XX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX XXXX XXXX</td>
|
||||
<td class="bits" rowspan=2><span class="free">OO</span><span class="used" title="Snow/desert present">X</span><span class="rearrange" title="Owner of road (road only; a rearrangement can free some of these bits)">X XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OOOO</span> <span class="used" title="Tram type">XXXX XX</span><span class="rearrange" title="Railway type (rail only; a rearrangement can free some of these bits)">XX XXXX</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bridge ramp</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OO</span>XX XX<span class="free">OO</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="used" title="Bridge or tunnel bit">1</span><span class="free">OO</span><span class="rearrange" title="PBS reservation (rail; a rearrangement can free some of these bits)">X</span> <span class="used" title="Transport type">XX</span> <span class="used" title="Direction of the tunnel/bridge">XX</span></td>
|
||||
<td class="bits"><span class="free">OO</span><span class="used" title="Bridge type: wooden, steel,...">XX XX</span><span class="free">OO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=2>A</td>
|
||||
<td>A</td>
|
||||
<td class="caption">objects</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">O</span>XXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">O</span><span class="used" title="Water class">XX</span> <span class="used" title="Owner">XXXXX</span></td>
|
||||
<td class="bits"><span class="pool" title="Object index on pool (m2 + m5)">XXXX XXXX XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Random bits">XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="pool" title="Object index on pool (m2 + m5)">XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Animation counter">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=1><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2 class="caption">bits</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">FEDC BA98 7654 3210</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">FEDC BA98 7654 3210</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan=2>class</th>
|
||||
<th>type (8)</th>
|
||||
<th>height (8)</th>
|
||||
<th>m1 (8)</th>
|
||||
<th>m2 (16)</th>
|
||||
<th>m3 (8)</th>
|
||||
<th>m4 (8)</th>
|
||||
<th>m5 (8)</th>
|
||||
<th>m6 (8)</th>
|
||||
<th>m7 (8)</th>
|
||||
<th>m8 (16)</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
OpenTTD's known bugs
|
||||
Last updated: 2021-01-22
|
||||
Release version: 1.11.0-beta1
|
||||
Last updated: 2021-03-14
|
||||
Release version: 1.11.0-RC1
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -364,35 +364,6 @@ Trains might not stop at platforms that are currently being changed [#5553]:
|
||||
list multiple times in a row or if there is only one station
|
||||
in theorder list (see #5684).
|
||||
|
||||
Inconsistent catchment areas [#5661]:
|
||||
Due to performance decisions the catchment area for cargo accepted by a
|
||||
station for delivery to houses or industries differs from the catchment
|
||||
area for cargo that is delivered to stations from houses or industries.
|
||||
|
||||
Conceptually they work the same, but the effect in game differs. They
|
||||
work by finding the closest destination "around" the source which is
|
||||
within a certain distance. This distance depends on the type of station,
|
||||
e.g. road stops have a smaller catchment area than large airports.
|
||||
In both cases the bounding box, the smallest rectangle that contains
|
||||
all tiles of something, is searched for the target of the cargo,
|
||||
and then spiraling outwards finding the closest tile of the target.
|
||||
|
||||
In the case of a station with two tiles spread far apart with a house
|
||||
that is within the station's bounding box, it would be possible that
|
||||
the spiraling search from the house does not reach one of the station
|
||||
tiles before the search ends, i.e. all tiles within that distance
|
||||
are searched. So the house does not deliver cargo to the station.
|
||||
On the other hand, the station will deliver cargo because the house
|
||||
falls within the bounding box, and thus search area.
|
||||
|
||||
It is possible to make these consistent, but then cargo from a house
|
||||
to a station needs to search up to 32 tiles around itself, i.e. 64
|
||||
by 64 tiles, to find all possible stations it could deliver to
|
||||
instead of 10 by 10 tiles (40 times more tiles). Alternatively the
|
||||
search from a station could be changed to use the actual tiles, but
|
||||
that would require considering checking 10 by 10 tiles for each of
|
||||
the tiles of a station, instead of just once.
|
||||
|
||||
Some houses and industries are not affected by transparency [#5817]:
|
||||
Some of the default houses and industries (f.e. the iron ore mine) are
|
||||
not affected by the transparency options. This is because the graphics
|
||||
@@ -409,3 +380,12 @@ Involuntary cargo exchange with cargodist via neutral station [#6114]:
|
||||
shared station make the order "no unload" and if you're unloading make
|
||||
it "no load". Cargodist will then figure out that it should not create
|
||||
such a route.
|
||||
|
||||
Incorrect ending year displayed in end of game newspaper [#8625]
|
||||
The ending year of the game is configurable, but the date displayed in
|
||||
the newspaper at the end of the game is part of the graphics, not text.
|
||||
So to fix this would involve fixing the graphics in every baseset,
|
||||
including the original. Additionally, basesets are free to put this
|
||||
text in different positions (which they do), making a proper solution
|
||||
to this infinitely more complex for a part of the game that fewer than
|
||||
1% of players ever see.
|
||||
|
||||
98
media/CMakeLists.txt
Normal file
98
media/CMakeLists.txt
Normal file
@@ -0,0 +1,98 @@
|
||||
add_subdirectory(baseset)
|
||||
|
||||
add_library(media
|
||||
INTERFACE
|
||||
)
|
||||
add_library(openttd::media ALIAS media)
|
||||
|
||||
if(NOT UNIX OR APPLE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(MEDIA_PNG_SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttd.16.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttd.32.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttd.48.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttd.64.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttd.128.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttd.256.png
|
||||
)
|
||||
|
||||
# Walk over all the png files, and generate a command to copy them
|
||||
foreach(MEDIA_PNG_SOURCE_FILE IN LISTS MEDIA_PNG_SOURCE_FILES)
|
||||
get_filename_component(MEDIA_PNG_FILE_NAME "${MEDIA_PNG_SOURCE_FILE}" NAME)
|
||||
string(REGEX REPLACE "[^.]+.([0-9]*).*" "${CMAKE_CURRENT_BINARY_DIR}/icons/hicolor/\\1x\\1/apps/${BINARY_NAME}.png" MEDIA_PNG_BINARY_FILE "${MEDIA_PNG_FILE_NAME}")
|
||||
|
||||
add_custom_command(OUTPUT ${MEDIA_PNG_BINARY_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${MEDIA_PNG_SOURCE_FILE}
|
||||
${MEDIA_PNG_BINARY_FILE}
|
||||
MAIN_DEPENDENCY ${MEDIA_PNG_SOURCE_FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Copying ${MEDIA_PNG_FILE_NAME} file"
|
||||
)
|
||||
|
||||
list(APPEND MEDIA_BINARY_FILES ${MEDIA_PNG_BINARY_FILE})
|
||||
endforeach()
|
||||
|
||||
set(MEDIA_XPM_SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttd.32.xpm
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttd.64.xpm
|
||||
)
|
||||
|
||||
# Walk over all the xpm files, and generate a command to copy them
|
||||
foreach(MEDIA_XPM_SOURCE_FILE IN LISTS MEDIA_XPM_SOURCE_FILES)
|
||||
get_filename_component(MEDIA_XPM_FILE_NAME "${MEDIA_XPM_SOURCE_FILE}" NAME)
|
||||
get_filename_component(MEDIA_XPM_FILE_EXT "${MEDIA_XPM_FILE_NAME}" EXT)
|
||||
set(MEDIA_XPM_BINARY_FILE "${CMAKE_CURRENT_BINARY_DIR}/pixmaps/${BINARY_NAME}${MEDIA_XPM_FILE_EXT}")
|
||||
|
||||
add_custom_command(OUTPUT ${MEDIA_XPM_BINARY_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${MEDIA_XPM_SOURCE_FILE}
|
||||
${MEDIA_XPM_BINARY_FILE}
|
||||
MAIN_DEPENDENCY ${MEDIA_XPM_SOURCE_FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Copying ${MEDIA_XPM_FILE_NAME} file"
|
||||
)
|
||||
|
||||
list(APPEND MEDIA_BINARY_FILES ${MEDIA_XPM_BINARY_FILE})
|
||||
endforeach()
|
||||
|
||||
# Create a new target which copies media files
|
||||
add_custom_target(media_files
|
||||
DEPENDS
|
||||
${MEDIA_BINARY_FILES}
|
||||
)
|
||||
|
||||
add_dependencies(media
|
||||
media_files
|
||||
)
|
||||
|
||||
get_target_property(LANG_SOURCE_FILES language_files LANG_SOURCE_FILES)
|
||||
|
||||
set(DESKTOP_BINARY_NAME ${BINARY_NAME}.desktop)
|
||||
|
||||
add_custom_command_timestamp(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_BINARY_NAME}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DDESKTOP_SOURCE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/openttd.desktop
|
||||
-DDESKTOP_BINARY_FILE=${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_BINARY_NAME}
|
||||
-DBINARY_NAME=${BINARY_NAME}
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/scripts/Desktop.cmake
|
||||
--
|
||||
${LANG_SOURCE_FILES}
|
||||
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/openttd.desktop
|
||||
DEPENDS ${LANG_SOURCE_FILES}
|
||||
${CMAKE_SOURCE_DIR}/cmake/scripts/Desktop.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating desktop file"
|
||||
)
|
||||
|
||||
# Create a new target which generates desktop file
|
||||
add_custom_target_timestamp(desktop_file
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_BINARY_NAME}
|
||||
)
|
||||
|
||||
add_dependencies(media
|
||||
desktop_file
|
||||
)
|
||||
11
media/openttd.desktop
Normal file
11
media/openttd.desktop
Normal file
@@ -0,0 +1,11 @@
|
||||
# http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Version=1.0
|
||||
Name=OpenTTD
|
||||
Icon=${BINARY_NAME}
|
||||
Exec=${BINARY_NAME}
|
||||
Terminal=false
|
||||
Categories=Game;
|
||||
Keywords=game;simulation;transport;tycoon;deluxe;economics;multiplayer;money;train;ship;bus;truck;aircraft;cargo;
|
||||
@Comment_STR_DESKTOP_SHORTCUT_COMMENT@
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM emscripten/emsdk
|
||||
FROM emscripten/emsdk:2.0.10
|
||||
|
||||
COPY emsdk-liblzma.patch /
|
||||
RUN cd /emsdk/upstream/emscripten && patch -p1 < /emsdk-liblzma.patch
|
||||
|
||||
@@ -71,6 +71,34 @@ Module.preRun.push(function() {
|
||||
* add_server("localhost", 3979); */
|
||||
}
|
||||
|
||||
var leftButtonDown = false;
|
||||
document.addEventListener("mousedown", e => {
|
||||
if (e.button == 0) {
|
||||
leftButtonDown = true;
|
||||
}
|
||||
});
|
||||
document.addEventListener("mouseup", e => {
|
||||
if (e.button == 0) {
|
||||
leftButtonDown = false;
|
||||
}
|
||||
});
|
||||
window.openttd_open_url = function(url, url_len) {
|
||||
const url_string = UTF8ToString(url, url_len);
|
||||
function openWindow() {
|
||||
document.removeEventListener("mouseup", openWindow);
|
||||
window.open(url_string, '_blank');
|
||||
}
|
||||
/* Trying to open the URL while the mouse is down results in the button getting stuck, so wait for the
|
||||
* mouse to be released before opening it. However, when OpenTTD is lagging, the mouse can get released
|
||||
* before the button click even registers, so check for that, and open the URL immediately if that's the
|
||||
* case. */
|
||||
if (leftButtonDown) {
|
||||
document.addEventListener("mouseup", openWindow);
|
||||
} else {
|
||||
openWindow();
|
||||
}
|
||||
}
|
||||
|
||||
/* https://github.com/emscripten-core/emscripten/pull/12995 implements this
|
||||
* properly. Till that time, we use a polyfill. */
|
||||
SOCKFS.websocket_sock_ops.createPeer_ = SOCKFS.websocket_sock_ops.createPeer;
|
||||
|
||||
@@ -29,5 +29,7 @@
|
||||
<string>Copyright 2004-${CURRENT_YEAR} The OpenTTD team</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>True</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -56,3 +56,13 @@ cat <<EOF > notarize.json
|
||||
EOF
|
||||
|
||||
gon notarize.json
|
||||
|
||||
app_filename=(_CPack_Packages/*/Bundle/openttd-*/OpenTTD.app)
|
||||
|
||||
if [ "${app_filename}" = "_CPack_Packages/*/Bundle/openttd-*/OpenTTD.app" ]; then
|
||||
echo "No .app found in the _CPack_Packages directory, skipping stapling."
|
||||
exit 0
|
||||
fi;
|
||||
|
||||
# Now staple the ticket to the .app
|
||||
xcrun stapler staple "${app_filename[0]}"
|
||||
|
||||
57
os/steam/release.vdf
Normal file
57
os/steam/release.vdf
Normal file
@@ -0,0 +1,57 @@
|
||||
"AppBuild"
|
||||
{
|
||||
"AppID" "1536610"
|
||||
"Desc" "@@DESCRIPTION@@"
|
||||
|
||||
"SetLive" "@@BRANCH@@"
|
||||
|
||||
"ContentRoot" "./"
|
||||
"BuildOutput" "build/"
|
||||
|
||||
"Depots"
|
||||
{
|
||||
"1536613"
|
||||
{
|
||||
"ContentRoot" "./steam-win32"
|
||||
"FileMapping"
|
||||
{
|
||||
"LocalPath" "*"
|
||||
"DepotPath" "."
|
||||
"recursive" "1"
|
||||
}
|
||||
}
|
||||
|
||||
"1536612"
|
||||
{
|
||||
"ContentRoot" "./steam-win64"
|
||||
"FileMapping"
|
||||
{
|
||||
"LocalPath" "*"
|
||||
"DepotPath" "."
|
||||
"recursive" "1"
|
||||
}
|
||||
}
|
||||
|
||||
"1536614"
|
||||
{
|
||||
"ContentRoot" "./steam-macos"
|
||||
"FileMapping"
|
||||
{
|
||||
"LocalPath" "*"
|
||||
"DepotPath" "."
|
||||
"recursive" "1"
|
||||
}
|
||||
}
|
||||
|
||||
"1536615"
|
||||
{
|
||||
"ContentRoot" "./steam-linux"
|
||||
"FileMapping"
|
||||
{
|
||||
"LocalPath" "*"
|
||||
"DepotPath" "."
|
||||
"recursive" "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
src/3rdparty/CMakeLists.txt
vendored
1
src/3rdparty/CMakeLists.txt
vendored
@@ -1,3 +1,4 @@
|
||||
add_subdirectory(md5)
|
||||
add_subdirectory(squirrel)
|
||||
add_subdirectory(opengl)
|
||||
add_subdirectory(os2)
|
||||
|
||||
10
src/3rdparty/opengl/CMakeLists.txt
vendored
Normal file
10
src/3rdparty/opengl/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
add_files(
|
||||
khrplatform.h
|
||||
glext.h
|
||||
CONDITION OPENGL_FOUND
|
||||
)
|
||||
|
||||
add_files(
|
||||
wglext.h
|
||||
CONDITION WIN32 AND OPENGL_FOUND
|
||||
)
|
||||
12861
src/3rdparty/opengl/glext.h
vendored
Normal file
12861
src/3rdparty/opengl/glext.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
290
src/3rdparty/opengl/khrplatform.h
vendored
Normal file
290
src/3rdparty/opengl/khrplatform.h
vendored
Normal file
@@ -0,0 +1,290 @@
|
||||
#ifndef __khrplatform_h_
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* The master copy of khrplatform.h is maintained in the Khronos EGL
|
||||
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
|
||||
* The last semantic modification to khrplatform.h was at commit ID:
|
||||
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by filing pull requests or issues on
|
||||
* the EGL Registry repository linked above.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
* should be located on your system and for more details of its use:
|
||||
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||
*
|
||||
* This file should be included as
|
||||
* #include <KHR/khrplatform.h>
|
||||
* by Khronos client API header files that use its types and defines.
|
||||
*
|
||||
* The types in khrplatform.h should only be used to define API-specific types.
|
||||
*
|
||||
* Types defined in khrplatform.h:
|
||||
* khronos_int8_t signed 8 bit
|
||||
* khronos_uint8_t unsigned 8 bit
|
||||
* khronos_int16_t signed 16 bit
|
||||
* khronos_uint16_t unsigned 16 bit
|
||||
* khronos_int32_t signed 32 bit
|
||||
* khronos_uint32_t unsigned 32 bit
|
||||
* khronos_int64_t signed 64 bit
|
||||
* khronos_uint64_t unsigned 64 bit
|
||||
* khronos_intptr_t signed same number of bits as a pointer
|
||||
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||
* khronos_ssize_t signed size
|
||||
* khronos_usize_t unsigned size
|
||||
* khronos_float_t signed 32 bit floating point
|
||||
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||
* nanoseconds
|
||||
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||
* only be used as a base type when a client API's boolean type is
|
||||
* an enum. Client APIs which use an integer or other type for
|
||||
* booleans cannot use this as the base type for their boolean.
|
||||
*
|
||||
* Tokens defined in khrplatform.h:
|
||||
*
|
||||
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||
*
|
||||
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||
*
|
||||
* Calling convention macros defined in this file:
|
||||
* KHRONOS_APICALL
|
||||
* KHRONOS_APIENTRY
|
||||
* KHRONOS_APIATTRIBUTES
|
||||
*
|
||||
* These may be used in function prototypes as:
|
||||
*
|
||||
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||
* int arg1,
|
||||
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||
*/
|
||||
|
||||
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
|
||||
# define KHRONOS_STATIC 1
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* This precedes the return type of the function in the function prototype.
|
||||
*/
|
||||
#if defined(KHRONOS_STATIC)
|
||||
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
|
||||
* header compatible with static linking. */
|
||||
# define KHRONOS_APICALL
|
||||
#elif defined(_WIN32)
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIENTRY
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
# define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIATTRIBUTES
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined (__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
|
||||
/*
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__VMS ) || defined(__sgi)
|
||||
|
||||
/*
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
|
||||
/*
|
||||
* Win32
|
||||
*/
|
||||
typedef __int32 khronos_int32_t;
|
||||
typedef unsigned __int32 khronos_uint32_t;
|
||||
typedef __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int khronos_int64_t;
|
||||
typedef unsigned long int khronos_uint64_t;
|
||||
#else
|
||||
typedef long long int khronos_int64_t;
|
||||
typedef unsigned long long int khronos_uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif 0
|
||||
|
||||
/*
|
||||
* Hypothetical platform with no float or int64 support
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#define KHRONOS_SUPPORT_INT64 0
|
||||
#define KHRONOS_SUPPORT_FLOAT 0
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Generic fallback
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Types that are (so far) the same on all platforms
|
||||
*/
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* to be the only LLP64 architecture in current use.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
typedef signed long long int khronos_intptr_t;
|
||||
typedef unsigned long long int khronos_uintptr_t;
|
||||
typedef signed long long int khronos_ssize_t;
|
||||
typedef unsigned long long int khronos_usize_t;
|
||||
#else
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef unsigned long int khronos_uintptr_t;
|
||||
typedef signed long int khronos_ssize_t;
|
||||
typedef unsigned long int khronos_usize_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
/* Time types
|
||||
*
|
||||
* These types can be used to represent a time interval in nanoseconds or
|
||||
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||
* time the system booted). The Unadjusted System Time is an unsigned
|
||||
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||
* may be either signed or unsigned.
|
||||
*/
|
||||
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy value used to pad enum types to 32 bits.
|
||||
*/
|
||||
#ifndef KHRONOS_MAX_ENUM
|
||||
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enumerated boolean type
|
||||
*
|
||||
* Values other than zero should be considered to be true. Therefore
|
||||
* comparisons should not be made against KHRONOS_TRUE.
|
||||
*/
|
||||
typedef enum {
|
||||
KHRONOS_FALSE = 0,
|
||||
KHRONOS_TRUE = 1,
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
} khronos_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
||||
845
src/3rdparty/opengl/wglext.h
vendored
Normal file
845
src/3rdparty/opengl/wglext.h
vendored
Normal file
@@ -0,0 +1,845 @@
|
||||
#ifndef __wgl_wglext_h_
|
||||
#define __wgl_wglext_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright 2013-2020 The Khronos Group Inc.
|
||||
** SPDX-License-Identifier: MIT
|
||||
**
|
||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
||||
** API Registry. The current version of the Registry, generator scripts
|
||||
** used to make the header, and the header can be found at
|
||||
** https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define WGL_WGLEXT_VERSION 20200813
|
||||
|
||||
/* Generated C header for:
|
||||
* API: wgl
|
||||
* Versions considered: .*
|
||||
* Versions emitted: _nomatch_^
|
||||
* Default extensions included: wgl
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_ARB_buffer_region 1
|
||||
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
|
||||
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
|
||||
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
|
||||
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
|
||||
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
|
||||
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
|
||||
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
|
||||
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
|
||||
VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
|
||||
BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
|
||||
BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#endif
|
||||
#endif /* WGL_ARB_buffer_region */
|
||||
|
||||
#ifndef WGL_ARB_context_flush_control
|
||||
#define WGL_ARB_context_flush_control 1
|
||||
#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
|
||||
#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
|
||||
#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
|
||||
#endif /* WGL_ARB_context_flush_control */
|
||||
|
||||
#ifndef WGL_ARB_create_context
|
||||
#define WGL_ARB_create_context 1
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
|
||||
#define WGL_CONTEXT_FLAGS_ARB 0x2094
|
||||
#define ERROR_INVALID_VERSION_ARB 0x2095
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#endif
|
||||
#endif /* WGL_ARB_create_context */
|
||||
|
||||
#ifndef WGL_ARB_create_context_no_error
|
||||
#define WGL_ARB_create_context_no_error 1
|
||||
#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
|
||||
#endif /* WGL_ARB_create_context_no_error */
|
||||
|
||||
#ifndef WGL_ARB_create_context_profile
|
||||
#define WGL_ARB_create_context_profile 1
|
||||
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
|
||||
#define ERROR_INVALID_PROFILE_ARB 0x2096
|
||||
#endif /* WGL_ARB_create_context_profile */
|
||||
|
||||
#ifndef WGL_ARB_create_context_robustness
|
||||
#define WGL_ARB_create_context_robustness 1
|
||||
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
|
||||
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
|
||||
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
|
||||
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
|
||||
#endif /* WGL_ARB_create_context_robustness */
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#define WGL_ARB_extensions_string 1
|
||||
typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
const char *WINAPI wglGetExtensionsStringARB (HDC hdc);
|
||||
#endif
|
||||
#endif /* WGL_ARB_extensions_string */
|
||||
|
||||
#ifndef WGL_ARB_framebuffer_sRGB
|
||||
#define WGL_ARB_framebuffer_sRGB 1
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
|
||||
#endif /* WGL_ARB_framebuffer_sRGB */
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define WGL_ARB_make_current_read 1
|
||||
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
|
||||
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
HDC WINAPI wglGetCurrentReadDCARB (void);
|
||||
#endif
|
||||
#endif /* WGL_ARB_make_current_read */
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_ARB_multisample 1
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
#define WGL_SAMPLES_ARB 0x2042
|
||||
#endif /* WGL_ARB_multisample */
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_ARB_pbuffer 1
|
||||
DECLARE_HANDLE(HPBUFFERARB);
|
||||
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
|
||||
#define WGL_PBUFFER_LARGEST_ARB 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_ARB 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
|
||||
#define WGL_PBUFFER_LOST_ARB 0x2036
|
||||
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
|
||||
int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
|
||||
BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_ARB_pbuffer */
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_ARB_pixel_format 1
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
#define WGL_NEED_PALETTE_ARB 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
||||
#define WGL_SWAP_METHOD_ARB 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
||||
#define WGL_TRANSPARENT_ARB 0x200A
|
||||
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
||||
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
||||
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
||||
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
||||
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
||||
#define WGL_SHARE_DEPTH_ARB 0x200C
|
||||
#define WGL_SHARE_STENCIL_ARB 0x200D
|
||||
#define WGL_SHARE_ACCUM_ARB 0x200E
|
||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
#define WGL_STEREO_ARB 0x2012
|
||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_RED_BITS_ARB 0x2015
|
||||
#define WGL_RED_SHIFT_ARB 0x2016
|
||||
#define WGL_GREEN_BITS_ARB 0x2017
|
||||
#define WGL_GREEN_SHIFT_ARB 0x2018
|
||||
#define WGL_BLUE_BITS_ARB 0x2019
|
||||
#define WGL_BLUE_SHIFT_ARB 0x201A
|
||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
||||
#define WGL_ACCUM_BITS_ARB 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||
#define WGL_AUX_BUFFERS_ARB 0x2024
|
||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
||||
#define WGL_SWAP_COPY_ARB 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
#endif /* WGL_ARB_pixel_format */
|
||||
|
||||
#ifndef WGL_ARB_pixel_format_float
|
||||
#define WGL_ARB_pixel_format_float 1
|
||||
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
|
||||
#endif /* WGL_ARB_pixel_format_float */
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_ARB_render_texture 1
|
||||
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
|
||||
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
|
||||
#define WGL_TEXTURE_FORMAT_ARB 0x2072
|
||||
#define WGL_TEXTURE_TARGET_ARB 0x2073
|
||||
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
|
||||
#define WGL_TEXTURE_RGB_ARB 0x2075
|
||||
#define WGL_TEXTURE_RGBA_ARB 0x2076
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
|
||||
#define WGL_TEXTURE_1D_ARB 0x2079
|
||||
#define WGL_TEXTURE_2D_ARB 0x207A
|
||||
#define WGL_MIPMAP_LEVEL_ARB 0x207B
|
||||
#define WGL_CUBE_MAP_FACE_ARB 0x207C
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
|
||||
#define WGL_FRONT_LEFT_ARB 0x2083
|
||||
#define WGL_FRONT_RIGHT_ARB 0x2084
|
||||
#define WGL_BACK_LEFT_ARB 0x2085
|
||||
#define WGL_BACK_RIGHT_ARB 0x2086
|
||||
#define WGL_AUX0_ARB 0x2087
|
||||
#define WGL_AUX1_ARB 0x2088
|
||||
#define WGL_AUX2_ARB 0x2089
|
||||
#define WGL_AUX3_ARB 0x208A
|
||||
#define WGL_AUX4_ARB 0x208B
|
||||
#define WGL_AUX5_ARB 0x208C
|
||||
#define WGL_AUX6_ARB 0x208D
|
||||
#define WGL_AUX7_ARB 0x208E
|
||||
#define WGL_AUX8_ARB 0x208F
|
||||
#define WGL_AUX9_ARB 0x2090
|
||||
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#endif
|
||||
#endif /* WGL_ARB_render_texture */
|
||||
|
||||
#ifndef WGL_ARB_robustness_application_isolation
|
||||
#define WGL_ARB_robustness_application_isolation 1
|
||||
#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
|
||||
#endif /* WGL_ARB_robustness_application_isolation */
|
||||
|
||||
#ifndef WGL_ARB_robustness_share_group_isolation
|
||||
#define WGL_ARB_robustness_share_group_isolation 1
|
||||
#endif /* WGL_ARB_robustness_share_group_isolation */
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_3DFX_multisample 1
|
||||
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
|
||||
#define WGL_SAMPLES_3DFX 0x2061
|
||||
#endif /* WGL_3DFX_multisample */
|
||||
|
||||
#ifndef WGL_3DL_stereo_control
|
||||
#define WGL_3DL_stereo_control 1
|
||||
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
|
||||
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
|
||||
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
|
||||
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
|
||||
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
|
||||
#endif
|
||||
#endif /* WGL_3DL_stereo_control */
|
||||
|
||||
#ifndef WGL_AMD_gpu_association
|
||||
#define WGL_AMD_gpu_association 1
|
||||
#define WGL_GPU_VENDOR_AMD 0x1F00
|
||||
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
|
||||
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
|
||||
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
|
||||
#define WGL_GPU_RAM_AMD 0x21A3
|
||||
#define WGL_GPU_CLOCK_AMD 0x21A4
|
||||
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
|
||||
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
|
||||
#define WGL_GPU_NUM_RB_AMD 0x21A7
|
||||
#define WGL_GPU_NUM_SPI_AMD 0x21A8
|
||||
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
|
||||
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void *data);
|
||||
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
|
||||
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
|
||||
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
|
||||
INT WINAPI wglGetGPUInfoAMD (UINT id, INT property, GLenum dataType, UINT size, void *data);
|
||||
UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
|
||||
HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
|
||||
HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
|
||||
BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
|
||||
HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
|
||||
VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
#endif /* WGL_AMD_gpu_association */
|
||||
|
||||
#ifndef WGL_ATI_pixel_format_float
|
||||
#define WGL_ATI_pixel_format_float 1
|
||||
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
|
||||
#endif /* WGL_ATI_pixel_format_float */
|
||||
|
||||
#ifndef WGL_ATI_render_texture_rectangle
|
||||
#define WGL_ATI_render_texture_rectangle 1
|
||||
#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5
|
||||
#endif /* WGL_ATI_render_texture_rectangle */
|
||||
|
||||
#ifndef WGL_EXT_colorspace
|
||||
#define WGL_EXT_colorspace 1
|
||||
#define WGL_COLORSPACE_EXT 0x309D
|
||||
#define WGL_COLORSPACE_SRGB_EXT 0x3089
|
||||
#define WGL_COLORSPACE_LINEAR_EXT 0x308A
|
||||
#endif /* WGL_EXT_colorspace */
|
||||
|
||||
#ifndef WGL_EXT_create_context_es2_profile
|
||||
#define WGL_EXT_create_context_es2_profile 1
|
||||
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
|
||||
#endif /* WGL_EXT_create_context_es2_profile */
|
||||
|
||||
#ifndef WGL_EXT_create_context_es_profile
|
||||
#define WGL_EXT_create_context_es_profile 1
|
||||
#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
|
||||
#endif /* WGL_EXT_create_context_es_profile */
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_EXT_depth_float 1
|
||||
#define WGL_DEPTH_FLOAT_EXT 0x2040
|
||||
#endif /* WGL_EXT_depth_float */
|
||||
|
||||
#ifndef WGL_EXT_display_color_table
|
||||
#define WGL_EXT_display_color_table 1
|
||||
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
|
||||
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
|
||||
GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
|
||||
GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
|
||||
VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
|
||||
#endif
|
||||
#endif /* WGL_EXT_display_color_table */
|
||||
|
||||
#ifndef WGL_EXT_extensions_string
|
||||
#define WGL_EXT_extensions_string 1
|
||||
typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
const char *WINAPI wglGetExtensionsStringEXT (void);
|
||||
#endif
|
||||
#endif /* WGL_EXT_extensions_string */
|
||||
|
||||
#ifndef WGL_EXT_framebuffer_sRGB
|
||||
#define WGL_EXT_framebuffer_sRGB 1
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
|
||||
#endif /* WGL_EXT_framebuffer_sRGB */
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define WGL_EXT_make_current_read 1
|
||||
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
HDC WINAPI wglGetCurrentReadDCEXT (void);
|
||||
#endif
|
||||
#endif /* WGL_EXT_make_current_read */
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_EXT_multisample 1
|
||||
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
|
||||
#define WGL_SAMPLES_EXT 0x2042
|
||||
#endif /* WGL_EXT_multisample */
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_EXT_pbuffer 1
|
||||
DECLARE_HANDLE(HPBUFFEREXT);
|
||||
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
|
||||
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
|
||||
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
|
||||
#define WGL_PBUFFER_LARGEST_EXT 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_EXT 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
|
||||
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
|
||||
int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
|
||||
BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_EXT_pbuffer */
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_EXT_pixel_format 1
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
|
||||
#define WGL_ACCELERATION_EXT 0x2003
|
||||
#define WGL_NEED_PALETTE_EXT 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
|
||||
#define WGL_SWAP_METHOD_EXT 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
|
||||
#define WGL_TRANSPARENT_EXT 0x200A
|
||||
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
|
||||
#define WGL_SHARE_DEPTH_EXT 0x200C
|
||||
#define WGL_SHARE_STENCIL_EXT 0x200D
|
||||
#define WGL_SHARE_ACCUM_EXT 0x200E
|
||||
#define WGL_SUPPORT_GDI_EXT 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_EXT 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_EXT 0x2011
|
||||
#define WGL_STEREO_EXT 0x2012
|
||||
#define WGL_PIXEL_TYPE_EXT 0x2013
|
||||
#define WGL_COLOR_BITS_EXT 0x2014
|
||||
#define WGL_RED_BITS_EXT 0x2015
|
||||
#define WGL_RED_SHIFT_EXT 0x2016
|
||||
#define WGL_GREEN_BITS_EXT 0x2017
|
||||
#define WGL_GREEN_SHIFT_EXT 0x2018
|
||||
#define WGL_BLUE_BITS_EXT 0x2019
|
||||
#define WGL_BLUE_SHIFT_EXT 0x201A
|
||||
#define WGL_ALPHA_BITS_EXT 0x201B
|
||||
#define WGL_ALPHA_SHIFT_EXT 0x201C
|
||||
#define WGL_ACCUM_BITS_EXT 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_EXT 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
|
||||
#define WGL_DEPTH_BITS_EXT 0x2022
|
||||
#define WGL_STENCIL_BITS_EXT 0x2023
|
||||
#define WGL_AUX_BUFFERS_EXT 0x2024
|
||||
#define WGL_NO_ACCELERATION_EXT 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
|
||||
#define WGL_FULL_ACCELERATION_EXT 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_EXT 0x2028
|
||||
#define WGL_SWAP_COPY_EXT 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_EXT 0x202A
|
||||
#define WGL_TYPE_RGBA_EXT 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_EXT 0x202C
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
#endif /* WGL_EXT_pixel_format */
|
||||
|
||||
#ifndef WGL_EXT_pixel_format_packed_float
|
||||
#define WGL_EXT_pixel_format_packed_float 1
|
||||
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
|
||||
#endif /* WGL_EXT_pixel_format_packed_float */
|
||||
|
||||
#ifndef WGL_EXT_swap_control
|
||||
#define WGL_EXT_swap_control 1
|
||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
||||
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglSwapIntervalEXT (int interval);
|
||||
int WINAPI wglGetSwapIntervalEXT (void);
|
||||
#endif
|
||||
#endif /* WGL_EXT_swap_control */
|
||||
|
||||
#ifndef WGL_EXT_swap_control_tear
|
||||
#define WGL_EXT_swap_control_tear 1
|
||||
#endif /* WGL_EXT_swap_control_tear */
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_I3D_digital_video_control 1
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
|
||||
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
|
||||
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_I3D_digital_video_control */
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_I3D_gamma 1
|
||||
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
|
||||
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#endif
|
||||
#endif /* WGL_I3D_gamma */
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_I3D_genlock 1
|
||||
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
|
||||
BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
|
||||
BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
|
||||
BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
|
||||
BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
|
||||
BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
|
||||
BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
|
||||
BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
|
||||
BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
|
||||
BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
|
||||
BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
|
||||
BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#endif
|
||||
#endif /* WGL_I3D_genlock */
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_I3D_image_buffer 1
|
||||
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
|
||||
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
|
||||
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
|
||||
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
|
||||
BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#endif
|
||||
#endif /* WGL_I3D_image_buffer */
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#define WGL_I3D_swap_frame_lock 1
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglEnableFrameLockI3D (void);
|
||||
BOOL WINAPI wglDisableFrameLockI3D (void);
|
||||
BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
|
||||
BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
|
||||
#endif
|
||||
#endif /* WGL_I3D_swap_frame_lock */
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_usage
|
||||
#define WGL_I3D_swap_frame_usage 1
|
||||
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
|
||||
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
|
||||
BOOL WINAPI wglBeginFrameTrackingI3D (void);
|
||||
BOOL WINAPI wglEndFrameTrackingI3D (void);
|
||||
BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#endif
|
||||
#endif /* WGL_I3D_swap_frame_usage */
|
||||
|
||||
#ifndef WGL_NV_DX_interop
|
||||
#define WGL_NV_DX_interop 1
|
||||
#define WGL_ACCESS_READ_ONLY_NV 0x00000000
|
||||
#define WGL_ACCESS_READ_WRITE_NV 0x00000001
|
||||
#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002
|
||||
typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
|
||||
typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
|
||||
typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||
typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
|
||||
typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
|
||||
typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
|
||||
HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
|
||||
BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
|
||||
HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||
BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
|
||||
BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
|
||||
BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
#endif
|
||||
#endif /* WGL_NV_DX_interop */
|
||||
|
||||
#ifndef WGL_NV_DX_interop2
|
||||
#define WGL_NV_DX_interop2 1
|
||||
#endif /* WGL_NV_DX_interop2 */
|
||||
|
||||
#ifndef WGL_NV_copy_image
|
||||
#define WGL_NV_copy_image 1
|
||||
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
#endif /* WGL_NV_copy_image */
|
||||
|
||||
#ifndef WGL_NV_delay_before_swap
|
||||
#define WGL_NV_delay_before_swap 1
|
||||
typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds);
|
||||
#endif
|
||||
#endif /* WGL_NV_delay_before_swap */
|
||||
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_NV_float_buffer 1
|
||||
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
|
||||
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
|
||||
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
|
||||
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
|
||||
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
|
||||
#endif /* WGL_NV_float_buffer */
|
||||
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
#define WGL_NV_gpu_affinity 1
|
||||
DECLARE_HANDLE(HGPUNV);
|
||||
struct _GPU_DEVICE {
|
||||
DWORD cb;
|
||||
CHAR DeviceName[32];
|
||||
CHAR DeviceString[128];
|
||||
DWORD Flags;
|
||||
RECT rcVirtualScreen;
|
||||
};
|
||||
typedef struct _GPU_DEVICE *PGPU_DEVICE;
|
||||
#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
|
||||
#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
|
||||
BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
BOOL WINAPI wglDeleteDCNV (HDC hdc);
|
||||
#endif
|
||||
#endif /* WGL_NV_gpu_affinity */
|
||||
|
||||
#ifndef WGL_NV_multigpu_context
|
||||
#define WGL_NV_multigpu_context 1
|
||||
#define WGL_CONTEXT_MULTIGPU_ATTRIB_NV 0x20AA
|
||||
#define WGL_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV 0x20AB
|
||||
#define WGL_CONTEXT_MULTIGPU_ATTRIB_AFR_NV 0x20AC
|
||||
#define WGL_CONTEXT_MULTIGPU_ATTRIB_MULTICAST_NV 0x20AD
|
||||
#define WGL_CONTEXT_MULTIGPU_ATTRIB_MULTI_DISPLAY_MULTICAST_NV 0x20AE
|
||||
#endif /* WGL_NV_multigpu_context */
|
||||
|
||||
#ifndef WGL_NV_multisample_coverage
|
||||
#define WGL_NV_multisample_coverage 1
|
||||
#define WGL_COVERAGE_SAMPLES_NV 0x2042
|
||||
#define WGL_COLOR_SAMPLES_NV 0x20B9
|
||||
#endif /* WGL_NV_multisample_coverage */
|
||||
|
||||
#ifndef WGL_NV_present_video
|
||||
#define WGL_NV_present_video 1
|
||||
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
|
||||
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
|
||||
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
int WINAPI wglEnumerateVideoDevicesNV (HDC hDc, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
BOOL WINAPI wglBindVideoDeviceNV (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_NV_present_video */
|
||||
|
||||
#ifndef WGL_NV_render_depth_texture
|
||||
#define WGL_NV_render_depth_texture 1
|
||||
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
|
||||
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
|
||||
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
|
||||
#define WGL_DEPTH_COMPONENT_NV 0x20A7
|
||||
#endif /* WGL_NV_render_depth_texture */
|
||||
|
||||
#ifndef WGL_NV_render_texture_rectangle
|
||||
#define WGL_NV_render_texture_rectangle 1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
|
||||
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
|
||||
#endif /* WGL_NV_render_texture_rectangle */
|
||||
|
||||
#ifndef WGL_NV_swap_group
|
||||
#define WGL_NV_swap_group 1
|
||||
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
|
||||
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
|
||||
BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
|
||||
BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
|
||||
BOOL WINAPI wglResetFrameCountNV (HDC hDC);
|
||||
#endif
|
||||
#endif /* WGL_NV_swap_group */
|
||||
|
||||
#ifndef WGL_NV_vertex_array_range
|
||||
#define WGL_NV_vertex_array_range 1
|
||||
typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
void WINAPI wglFreeMemoryNV (void *pointer);
|
||||
#endif
|
||||
#endif /* WGL_NV_vertex_array_range */
|
||||
|
||||
#ifndef WGL_NV_video_capture
|
||||
#define WGL_NV_video_capture 1
|
||||
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
|
||||
#define WGL_UNIQUE_ID_NV 0x20CE
|
||||
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#endif
|
||||
#endif /* WGL_NV_video_capture */
|
||||
|
||||
#ifndef WGL_NV_video_output
|
||||
#define WGL_NV_video_output 1
|
||||
DECLARE_HANDLE(HPVIDEODEV);
|
||||
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
|
||||
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
|
||||
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
|
||||
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
|
||||
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
|
||||
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
|
||||
#define WGL_VIDEO_OUT_FRAME 0x20C8
|
||||
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
|
||||
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
|
||||
BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif
|
||||
#endif /* WGL_NV_video_output */
|
||||
|
||||
#ifndef WGL_OML_sync_control
|
||||
#define WGL_OML_sync_control 1
|
||||
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#endif
|
||||
#endif /* WGL_OML_sync_control */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -155,7 +155,7 @@ add_files(
|
||||
fios_gui.cpp
|
||||
fontcache.cpp
|
||||
fontcache.h
|
||||
fontdetection.cpp
|
||||
fontcache_internal.h
|
||||
fontdetection.h
|
||||
framerate_gui.cpp
|
||||
framerate_type.h
|
||||
|
||||
@@ -1406,7 +1406,8 @@ struct AIDebugWindow : public Window {
|
||||
this->SetWidgetLoweredState(WID_AID_MATCH_CASE_BTN, this->case_sensitive_break_check);
|
||||
|
||||
this->SetWidgetDisabledState(WID_AID_SETTINGS, ai_debug_company == INVALID_COMPANY);
|
||||
this->SetWidgetDisabledState(WID_AID_RELOAD_TOGGLE, ai_debug_company == INVALID_COMPANY || ai_debug_company == OWNER_DEITY);
|
||||
extern CompanyID _local_company;
|
||||
this->SetWidgetDisabledState(WID_AID_RELOAD_TOGGLE, ai_debug_company == INVALID_COMPANY || ai_debug_company == OWNER_DEITY || ai_debug_company == _local_company);
|
||||
this->SetWidgetDisabledState(WID_AID_CONTINUE_BTN, ai_debug_company == INVALID_COMPANY ||
|
||||
(ai_debug_company == OWNER_DEITY ? !Game::IsPaused() : !AI::IsPaused(ai_debug_company)));
|
||||
}
|
||||
@@ -1430,7 +1431,7 @@ StringFilter AIDebugWindow::break_string_filter(&AIDebugWindow::case_sensitive_b
|
||||
/** Make a number of rows with buttons for each company for the AI debug window. */
|
||||
NWidgetBase *MakeCompanyButtonRowsAIDebug(int *biggest_index)
|
||||
{
|
||||
return MakeCompanyButtonRows(biggest_index, WID_AID_COMPANY_BUTTON_START, WID_AID_COMPANY_BUTTON_END, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP);
|
||||
return MakeCompanyButtonRows(biggest_index, WID_AID_COMPANY_BUTTON_START, WID_AID_COMPANY_BUTTON_END, COLOUR_GREY, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -909,7 +909,7 @@ static bool AircraftController(Aircraft *v)
|
||||
SoundID sfx = AircraftVehInfo(v->engine_type)->sfx;
|
||||
/* For compatibility with old NewGRF we ignore the sfx property, unless a NewGRF-defined sound is used.
|
||||
* The baseset has only one helicopter sound, so this only limits using plane or cow sounds. */
|
||||
if (sfx < ORIGINAL_SAMPLE_COUNT) sfx = SND_18_HELICOPTER;
|
||||
if (sfx < ORIGINAL_SAMPLE_COUNT) sfx = SND_18_TAKEOFF_HELICOPTER;
|
||||
SndPlayVehicleFx(sfx, v);
|
||||
}
|
||||
}
|
||||
@@ -1328,19 +1328,22 @@ static void CrashAirplane(Aircraft *v)
|
||||
v->Next()->cargo.Truncate();
|
||||
const Station *st = GetTargetAirportIfValid(v);
|
||||
StringID newsitem;
|
||||
TileIndex vt;
|
||||
if (st == nullptr) {
|
||||
newsitem = STR_NEWS_PLANE_CRASH_OUT_OF_FUEL;
|
||||
vt = TileVirtXY(v->x_pos, v->y_pos);
|
||||
} else {
|
||||
SetDParam(1, st->index);
|
||||
newsitem = STR_NEWS_AIRCRAFT_CRASH;
|
||||
vt = v->tile;
|
||||
}
|
||||
|
||||
AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, v->tile, st == nullptr ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING));
|
||||
Game::NewEvent(new ScriptEventVehicleCrashed(v->index, v->tile, st == nullptr ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING));
|
||||
AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, vt, st == nullptr ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING));
|
||||
Game::NewEvent(new ScriptEventVehicleCrashed(v->index, vt, st == nullptr ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING));
|
||||
|
||||
AddTileNewsItem(newsitem, NT_ACCIDENT, v->tile, nullptr, st != nullptr ? st->index : INVALID_STATION);
|
||||
AddTileNewsItem(newsitem, NT_ACCIDENT, vt, nullptr, st != nullptr ? st->index : INVALID_STATION);
|
||||
|
||||
ModifyStationRatingAround(v->tile, v->owner, -160, 30);
|
||||
ModifyStationRatingAround(vt, v->owner, -160, 30);
|
||||
if (_settings_client.sound.disaster) SndPlayVehicleFx(SND_12_EXPLOSION, v);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32 p1, uint32
|
||||
{
|
||||
if (result.Failed()) return;
|
||||
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
|
||||
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||
}
|
||||
|
||||
|
||||
@@ -319,6 +319,8 @@ static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehic
|
||||
/* Does it need to be refitted */
|
||||
CargoID refit_cargo = GetNewCargoTypeForReplace(old_veh, e, part_of_chain);
|
||||
if (refit_cargo == CT_INVALID) {
|
||||
if (!IsLocalCompany()) return CommandCost();
|
||||
|
||||
SetDParam(0, old_veh->index);
|
||||
|
||||
int order_id = GetIncompatibleRefitOrderIdForAutoreplace(old_veh, e);
|
||||
|
||||
@@ -124,6 +124,18 @@ public:
|
||||
return ((r * 13063) + (g * 25647) + (b * 4981)) / 65536;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a colour dark grey, for specialized 32bpp remapping.
|
||||
* @param colour the colour to make dark.
|
||||
* @return the new colour, now darker.
|
||||
*/
|
||||
static inline Colour MakeDark(Colour colour)
|
||||
{
|
||||
uint8 d = MakeDark(colour.r, colour.g, colour.b);
|
||||
|
||||
return Colour(d, d, d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a colour grey - based.
|
||||
* @param colour the colour to make grey.
|
||||
@@ -154,6 +166,16 @@ public:
|
||||
|
||||
return ReallyAdjustBrightness(colour, brightness);
|
||||
}
|
||||
|
||||
static inline uint8 GetColourBrightness(Colour colour)
|
||||
{
|
||||
uint8 rgb_max = std::max(colour.r, std::max(colour.g, colour.b));
|
||||
|
||||
/* Black pixel (8bpp or old 32bpp image), so use default value */
|
||||
if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
|
||||
|
||||
return rgb_max;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* BLITTER_32BPP_BASE_HPP */
|
||||
|
||||
@@ -24,7 +24,7 @@ static FBlitter_32bppOptimized iFBlitter_32bppOptimized;
|
||||
* @param bp further blitting parameters
|
||||
* @param zoom zoom level at which we are drawing
|
||||
*/
|
||||
template <BlitterMode mode>
|
||||
template <BlitterMode mode, bool Tpal_to_rgb>
|
||||
inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
|
||||
{
|
||||
const SpriteData *src = (const SpriteData *)bp->sprite;
|
||||
@@ -209,18 +209,29 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
default:
|
||||
if (src_px->a == 255) {
|
||||
/* faster than memcpy(), n is usually low */
|
||||
src_n += n;
|
||||
do {
|
||||
*dst = src_px->data;
|
||||
if (Tpal_to_rgb && *src_n != 0) {
|
||||
/* Convert the mapping channel to a RGB value */
|
||||
*dst = this->AdjustBrightness(this->LookupColourInPalette(GB(*src_n, 0, 8)), GB(*src_n, 8, 8)).data;
|
||||
} else {
|
||||
*dst = src_px->data;
|
||||
}
|
||||
dst++;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
} else {
|
||||
src_n += n;
|
||||
do {
|
||||
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
|
||||
if (Tpal_to_rgb && *src_n != 0) {
|
||||
/* Convert the mapping channel to a RGB value */
|
||||
Colour colour = this->AdjustBrightness(this->LookupColourInPalette(GB(*src_n, 0, 8)), GB(*src_n, 8, 8));
|
||||
*dst = ComposeColourRGBANoCheck(colour.r, colour.g, colour.b, src_px->a, *dst);
|
||||
} else {
|
||||
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
|
||||
}
|
||||
dst++;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
}
|
||||
break;
|
||||
@@ -233,6 +244,22 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
}
|
||||
}
|
||||
|
||||
template <bool Tpal_to_rgb>
|
||||
void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
{
|
||||
switch (mode) {
|
||||
default: NOT_REACHED();
|
||||
case BM_NORMAL: Draw<BM_NORMAL, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BM_BLACK_REMAP: Draw<BM_BLACK_REMAP, Tpal_to_rgb>(bp, zoom); return;
|
||||
}
|
||||
}
|
||||
|
||||
template void Blitter_32bppOptimized::Draw<true>(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
template void Blitter_32bppOptimized::Draw<false>(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. Calls adequate templated function.
|
||||
*
|
||||
@@ -242,17 +269,10 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
*/
|
||||
void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
{
|
||||
switch (mode) {
|
||||
default: NOT_REACHED();
|
||||
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
|
||||
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return;
|
||||
case BM_BLACK_REMAP: Draw<BM_BLACK_REMAP> (bp, zoom); return;
|
||||
}
|
||||
this->Draw<false>(bp, mode, zoom);
|
||||
}
|
||||
|
||||
Sprite *Blitter_32bppOptimized::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
{
|
||||
/* streams of pixels (a, r, g, b channels)
|
||||
*
|
||||
@@ -324,17 +344,23 @@ Sprite *Blitter_32bppOptimized::Encode(const SpriteLoader::Sprite *sprite, Alloc
|
||||
*dst_n = src->m;
|
||||
if (src->m != 0) {
|
||||
/* Get brightest value */
|
||||
uint8 rgb_max = std::max({src->r, src->g, src->b});
|
||||
uint8 rgb_max = std::max({ src->r, src->g, src->b });
|
||||
|
||||
/* Black pixel (8bpp or old 32bpp image), so use default value */
|
||||
if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
|
||||
*dst_n |= rgb_max << 8;
|
||||
|
||||
/* Pre-convert the mapping channel to a RGB value */
|
||||
Colour colour = this->AdjustBrightness(this->LookupColourInPalette(src->m), rgb_max);
|
||||
dst_px->r = colour.r;
|
||||
dst_px->g = colour.g;
|
||||
dst_px->b = colour.b;
|
||||
if (Tpal_to_rgb) {
|
||||
/* Pre-convert the mapping channel to a RGB value */
|
||||
Colour colour = this->AdjustBrightness(this->LookupColourInPalette(src->m), rgb_max);
|
||||
dst_px->r = colour.r;
|
||||
dst_px->g = colour.g;
|
||||
dst_px->b = colour.b;
|
||||
} else {
|
||||
dst_px->r = src->r;
|
||||
dst_px->g = src->g;
|
||||
dst_px->b = src->b;
|
||||
}
|
||||
} else {
|
||||
dst_px->r = src->r;
|
||||
dst_px->g = src->g;
|
||||
@@ -397,3 +423,11 @@ Sprite *Blitter_32bppOptimized::Encode(const SpriteLoader::Sprite *sprite, Alloc
|
||||
|
||||
return dest_sprite;
|
||||
}
|
||||
|
||||
template Sprite *Blitter_32bppOptimized::EncodeInternal<true>(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
template Sprite *Blitter_32bppOptimized::EncodeInternal<false>(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
|
||||
Sprite *Blitter_32bppOptimized::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
{
|
||||
return this->EncodeInternal<true>(sprite, allocator);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,11 @@ public:
|
||||
|
||||
const char *GetName() override { return "32bpp-optimized"; }
|
||||
|
||||
template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
||||
template <BlitterMode mode, bool Tpal_to_rgb = false> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
||||
|
||||
protected:
|
||||
template <bool Tpal_to_rgb> void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
template <bool Tpal_to_rgb> Sprite *EncodeInternal(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
};
|
||||
|
||||
/** Factory for the optimised 32 bpp blitter (without palette animation). */
|
||||
|
||||
@@ -43,7 +43,7 @@ typedef union ALIGN(16) um128i {
|
||||
|
||||
#define CLEAR_HIGH_BYTE_MASK _mm_setr_epi8(-1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0)
|
||||
#define ALPHA_CONTROL_MASK _mm_setr_epi8( 6, 7, 6, 7, 6, 7, -1, -1, 14, 15, 14, 15, 14, 15, -1, -1)
|
||||
#define PACK_LOW_CONTROL_MASK _mm_setr_epi8( 0, 2, 4, -1, 8, 10, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1)
|
||||
#define PACK_LOW_CONTROL_MASK _mm_setr_epi8( 0, 2, 4, 6, 8, 10, 12, 14, -1, -1, -1, -1, -1, -1, -1, -1)
|
||||
#define PACK_HIGH_CONTROL_MASK _mm_setr_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 0, 2, 4, -1, 8, 10, 12, -1)
|
||||
#define BRIGHTNESS_LOW_CONTROL_MASK _mm_setr_epi8( 1, 2, 1, 2, 1, 2, 0, 2, 3, 2, 3, 2, 3, 2, 0, 2)
|
||||
#define BRIGHTNESS_DIV_CLEANER _mm_setr_epi8(-1, 1, -1, 1, -1, 1, -1, 0, -1, 1, -1, 1, -1, 1, -1, 0)
|
||||
|
||||
518
src/blitter/40bpp_anim.cpp
Normal file
518
src/blitter/40bpp_anim.cpp
Normal file
@@ -0,0 +1,518 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD 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, version 2.
|
||||
* OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 40bpp_optimized.cpp Implementation of the optimized 40 bpp blitter. */
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../zoom_func.h"
|
||||
#include "../settings_type.h"
|
||||
#include "../video/video_driver.hpp"
|
||||
#include "40bpp_anim.hpp"
|
||||
#include "common.hpp"
|
||||
|
||||
#include "../table/sprites.h"
|
||||
|
||||
#include "../safeguards.h"
|
||||
|
||||
|
||||
/** Instantiation of the 40bpp with animation blitter factory. */
|
||||
static FBlitter_40bppAnim iFBlitter_40bppAnim;
|
||||
|
||||
/** Cached black value. */
|
||||
static const Colour _black_colour(0, 0, 0);
|
||||
|
||||
|
||||
void Blitter_40bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
|
||||
{
|
||||
if (_screen_disable_anim) {
|
||||
Blitter_32bppOptimized::SetPixel(video, x, y, colour);
|
||||
} else {
|
||||
*((Colour *)video + x + y * _screen.pitch) = _black_colour;
|
||||
|
||||
VideoDriver::GetInstance()->GetAnimBuffer()[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * _screen.pitch] = colour;
|
||||
}
|
||||
}
|
||||
|
||||
void Blitter_40bppAnim::DrawRect(void *video, int width, int height, uint8 colour)
|
||||
{
|
||||
if (_screen_disable_anim) {
|
||||
/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */
|
||||
Blitter_32bppOptimized::DrawRect(video, width, height, colour);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(VideoDriver::GetInstance()->GetAnimBuffer() != nullptr);
|
||||
uint8 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + VideoDriver::GetInstance()->GetAnimBuffer();
|
||||
|
||||
do {
|
||||
Colour *dst = (Colour *)video;
|
||||
uint8 *anim = anim_line;
|
||||
|
||||
for (int i = width; i > 0; i--) {
|
||||
*dst = _black_colour;
|
||||
*anim = colour;
|
||||
dst++;
|
||||
anim++;
|
||||
}
|
||||
video = (uint32 *)video + _screen.pitch;
|
||||
anim_line += _screen.pitch;
|
||||
} while (--height);
|
||||
}
|
||||
|
||||
void Blitter_40bppAnim::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
|
||||
{
|
||||
if (_screen_disable_anim) {
|
||||
/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */
|
||||
Blitter_32bppOptimized::DrawLine(video, x, y, x2, y2, screen_width, screen_height, colour, width, dash);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(VideoDriver::GetInstance()->GetAnimBuffer() != nullptr);
|
||||
uint8 *anim = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + VideoDriver::GetInstance()->GetAnimBuffer();
|
||||
|
||||
this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [=](int x, int y) {
|
||||
*((Colour *)video + x + y * _screen.pitch) = _black_colour;
|
||||
*(anim + x + y * _screen.pitch) = colour;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. It is templated to allow faster operation.
|
||||
*
|
||||
* @tparam mode blitter mode
|
||||
* @param bp further blitting parameters
|
||||
* @param zoom zoom level at which we are drawing
|
||||
*/
|
||||
template <BlitterMode mode>
|
||||
inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
|
||||
{
|
||||
const SpriteData *src = (const SpriteData *)bp->sprite;
|
||||
|
||||
/* src_px : each line begins with uint32 n = 'number of bytes in this line',
|
||||
* then n times is the Colour struct for this line */
|
||||
const Colour *src_px = (const Colour *)(src->data + src->offset[zoom][0]);
|
||||
/* src_n : each line begins with uint32 n = 'number of bytes in this line',
|
||||
* then interleaved stream of 'm' and 'n' channels. 'm' is remap,
|
||||
* 'n' is number of bytes with the same alpha channel class */
|
||||
const uint16 *src_n = (const uint16 *)(src->data + src->offset[zoom][1]);
|
||||
|
||||
/* skip upper lines in src_px and src_n */
|
||||
for (uint i = bp->skip_top; i != 0; i--) {
|
||||
src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
|
||||
src_n = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
|
||||
}
|
||||
|
||||
/* skip lines in dst */
|
||||
Colour *dst = (Colour *)bp->dst + bp->top * bp->pitch + bp->left;
|
||||
assert(VideoDriver::GetInstance()->GetAnimBuffer() != nullptr);
|
||||
uint8 *anim = VideoDriver::GetInstance()->GetAnimBuffer() + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * bp->pitch + bp->left;
|
||||
|
||||
/* store so we don't have to access it via bp everytime (compiler assumes pointer aliasing) */
|
||||
const byte *remap = bp->remap;
|
||||
|
||||
for (int y = 0; y < bp->height; y++) {
|
||||
/* next dst line begins here */
|
||||
Colour *dst_ln = dst + bp->pitch;
|
||||
uint8 *anim_ln = anim + bp->pitch;
|
||||
|
||||
/* next src line begins here */
|
||||
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
|
||||
src_px++;
|
||||
|
||||
/* next src_n line begins here */
|
||||
const uint16 *src_n_ln = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
|
||||
src_n += 2;
|
||||
|
||||
/* we will end this line when we reach this point */
|
||||
Colour *dst_end = dst + bp->skip_left;
|
||||
|
||||
/* number of pixels with the same alpha channel class */
|
||||
uint n;
|
||||
|
||||
while (dst < dst_end) {
|
||||
n = *src_n++;
|
||||
|
||||
if (src_px->a == 0) {
|
||||
dst += n;
|
||||
src_px++;
|
||||
src_n++;
|
||||
|
||||
if (dst > dst_end) anim += dst - dst_end;
|
||||
} else {
|
||||
if (dst + n > dst_end) {
|
||||
uint d = dst_end - dst;
|
||||
src_px += d;
|
||||
src_n += d;
|
||||
|
||||
dst = dst_end - bp->skip_left;
|
||||
dst_end = dst + bp->width;
|
||||
|
||||
n = std::min<uint>(n - d, (uint)bp->width);
|
||||
goto draw;
|
||||
}
|
||||
dst += n;
|
||||
src_px += n;
|
||||
src_n += n;
|
||||
}
|
||||
}
|
||||
|
||||
dst -= bp->skip_left;
|
||||
dst_end -= bp->skip_left;
|
||||
|
||||
dst_end += bp->width;
|
||||
|
||||
while (dst < dst_end) {
|
||||
n = std::min<uint>(*src_n++, (uint)(dst_end - dst));
|
||||
|
||||
if (src_px->a == 0) {
|
||||
anim += n;
|
||||
dst += n;
|
||||
src_px++;
|
||||
src_n++;
|
||||
continue;
|
||||
}
|
||||
|
||||
draw:;
|
||||
|
||||
switch (mode) {
|
||||
case BM_COLOUR_REMAP:
|
||||
case BM_CRASH_REMAP:
|
||||
if (src_px->a == 255) {
|
||||
do {
|
||||
uint8 m = GB(*src_n, 0, 8);
|
||||
/* In case the m-channel is zero, only apply the crash remap by darkening the RGB colour. */
|
||||
if (m == 0) {
|
||||
*dst = mode == BM_CRASH_REMAP ? this->MakeDark(*src_px) : *src_px;
|
||||
*anim = 0;
|
||||
} else {
|
||||
uint r = remap[m];
|
||||
if (r != 0) {
|
||||
*dst = src_px->data;
|
||||
*anim = r;
|
||||
}
|
||||
}
|
||||
anim++;
|
||||
dst++;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
} else {
|
||||
do {
|
||||
uint8 m = GB(*src_n, 0, 8);
|
||||
Colour b = this->RealizeBlendedColour(*anim, *dst);
|
||||
if (m == 0) {
|
||||
Colour c = mode == BM_CRASH_REMAP ? this->MakeDark(*src_px) : *src_px;
|
||||
*dst = this->ComposeColourRGBANoCheck(c.r, c.g, c.b, src_px->a, b);
|
||||
*anim = 0;
|
||||
} else {
|
||||
uint r = remap[m];
|
||||
if (r != 0) {
|
||||
*dst = this->ComposeColourPANoCheck(this->LookupColourInPalette(r), src_px->a, b);
|
||||
*anim = 0; // Animation colours don't work with alpha-blending.
|
||||
}
|
||||
}
|
||||
anim++;
|
||||
dst++;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_BLACK_REMAP:
|
||||
do {
|
||||
*anim++ = 0;
|
||||
*dst++ = _black_colour;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
|
||||
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
|
||||
* we produce a result the newgrf maker didn't expect ;) */
|
||||
|
||||
/* Make the current colour a bit more black, so it looks like this image is transparent */
|
||||
src_n += n;
|
||||
if (src_px->a == 255) {
|
||||
src_px += n;
|
||||
do {
|
||||
/* If the anim buffer contains a color value, the image composition will
|
||||
* only look at the RGB brightness value. As such, we can simply darken the
|
||||
* RGB value to darken the anim color. */
|
||||
Colour b = *anim != 0 ? Colour(this->GetColourBrightness(*dst), 0, 0) : *dst;
|
||||
*dst = this->MakeTransparent(b, 3, 4);
|
||||
anim++;
|
||||
dst++;
|
||||
} while (--n != 0);
|
||||
} else {
|
||||
do {
|
||||
Colour b = this->RealizeBlendedColour(*anim, *dst);
|
||||
*dst = this->MakeTransparent(b, (256 * 4 - src_px->a), 256 * 4);
|
||||
*anim = 0; // Animation colours don't work with alpha-blending.
|
||||
anim++;
|
||||
dst++;
|
||||
src_px++;
|
||||
} while (--n != 0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (src_px->a == 255) {
|
||||
do {
|
||||
*anim++ = GB(*src_n, 0, 8);
|
||||
*dst++ = src_px->data;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
break;
|
||||
} else {
|
||||
do {
|
||||
uint8 m = GB(*src_n, 0, 8);
|
||||
Colour b = this->RealizeBlendedColour(*anim, *dst);
|
||||
|
||||
if (m == 0) {
|
||||
*dst = this->ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, b);
|
||||
*anim = 0;
|
||||
} else {
|
||||
*dst = this->ComposeColourPANoCheck(this->LookupColourInPalette(m), src_px->a, b);
|
||||
*anim = m;
|
||||
}
|
||||
|
||||
anim++;
|
||||
dst++;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dst = dst_ln;
|
||||
anim = anim_ln;
|
||||
src_px = src_px_ln;
|
||||
src_n = src_n_ln;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. Calls adequate templated function.
|
||||
*
|
||||
* @param bp further blitting parameters
|
||||
* @param mode blitter mode
|
||||
* @param zoom zoom level at which we are drawing
|
||||
*/
|
||||
void Blitter_40bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
{
|
||||
assert(_screen.dst_ptr != nullptr);
|
||||
|
||||
if (_screen_disable_anim || VideoDriver::GetInstance()->GetAnimBuffer() == nullptr) {
|
||||
/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent Draw() */
|
||||
Blitter_32bppOptimized::Draw<true>(bp, mode, zoom);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
default: NOT_REACHED();
|
||||
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
|
||||
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return;
|
||||
case BM_BLACK_REMAP: Draw<BM_BLACK_REMAP> (bp, zoom); return;
|
||||
}
|
||||
}
|
||||
|
||||
void Blitter_40bppAnim::DrawColourMappingRect(void *dst, int width, int height, PaletteID pal)
|
||||
{
|
||||
if (_screen_disable_anim) {
|
||||
/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawColourMappingRect() */
|
||||
Blitter_32bppOptimized::DrawColourMappingRect(dst, width, height, pal);
|
||||
return;
|
||||
}
|
||||
|
||||
Colour *udst = (Colour *)dst;
|
||||
uint8 *anim = VideoDriver::GetInstance()->GetAnimBuffer() + ((uint32 *)dst - (uint32 *)_screen.dst_ptr);
|
||||
|
||||
if (pal == PALETTE_TO_TRANSPARENT) {
|
||||
/* If the anim buffer contains a color value, the image composition will
|
||||
* only look at the RGB brightness value. As such, we can simply darken the
|
||||
* RGB value to darken the anim color. */
|
||||
do {
|
||||
for (int i = 0; i != width; i++) {
|
||||
Colour b = *anim != 0 ? Colour(this->GetColourBrightness(*udst), 0, 0) : *udst;
|
||||
*udst = MakeTransparent(b, 154);
|
||||
udst++;
|
||||
anim++;
|
||||
}
|
||||
udst = udst - width + _screen.pitch;
|
||||
anim = anim - width + _screen.pitch;
|
||||
} while (--height);
|
||||
} else if (pal == PALETTE_NEWSPAPER) {
|
||||
const uint8 *remap = GetNonSprite(pal, ST_RECOLOUR) + 1;
|
||||
do {
|
||||
for (int i = 0; i != width; i++) {
|
||||
if (*anim == 0) *udst = MakeGrey(*udst);
|
||||
*anim = remap[*anim];
|
||||
udst++;
|
||||
anim++;
|
||||
}
|
||||
udst = udst - width + _screen.pitch;
|
||||
anim = anim - width + _screen.pitch;
|
||||
} while (--height);
|
||||
} else {
|
||||
const uint8 *remap = GetNonSprite(pal, ST_RECOLOUR) + 1;
|
||||
do {
|
||||
for (int i = 0; i != width; i++) {
|
||||
*anim = remap[*anim];
|
||||
anim++;
|
||||
}
|
||||
anim = anim - width + _screen.pitch;
|
||||
} while (--height);
|
||||
}
|
||||
}
|
||||
|
||||
Sprite *Blitter_40bppAnim::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
{
|
||||
return this->EncodeInternal<false>(sprite, allocator);
|
||||
}
|
||||
|
||||
|
||||
void Blitter_40bppAnim::CopyFromBuffer(void *video, const void *src, int width, int height)
|
||||
{
|
||||
assert(!_screen_disable_anim);
|
||||
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
|
||||
uint32 *dst = (uint32 *)video;
|
||||
const uint32 *usrc = (const uint32 *)src;
|
||||
|
||||
uint8 *anim_buf = VideoDriver::GetInstance()->GetAnimBuffer();
|
||||
if (anim_buf == nullptr) return;
|
||||
uint8 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + anim_buf;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
memcpy(dst, usrc, width * sizeof(uint32));
|
||||
usrc += width;
|
||||
dst += _screen.pitch;
|
||||
/* Copy back the anim-buffer */
|
||||
memcpy(anim_line, usrc, width * sizeof(uint8));
|
||||
usrc = (const uint32 *)((const uint8 *)usrc + width);
|
||||
anim_line += _screen.pitch;
|
||||
}
|
||||
}
|
||||
|
||||
void Blitter_40bppAnim::CopyToBuffer(const void *video, void *dst, int width, int height)
|
||||
{
|
||||
assert(!_screen_disable_anim);
|
||||
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
|
||||
uint32 *udst = (uint32 *)dst;
|
||||
const uint32 *src = (const uint32 *)video;
|
||||
|
||||
uint8 *anim_buf = VideoDriver::GetInstance()->GetAnimBuffer();
|
||||
if (anim_buf == nullptr) return;
|
||||
const uint8 *anim_line = ((const uint32 *)video - (uint32 *)_screen.dst_ptr) + anim_buf;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
memcpy(udst, src, width * sizeof(uint32));
|
||||
src += _screen.pitch;
|
||||
udst += width;
|
||||
/* Copy the anim-buffer */
|
||||
memcpy(udst, anim_line, width * sizeof(uint8));
|
||||
udst = (uint32 *)((uint8 *)udst + width);
|
||||
anim_line += _screen.pitch;
|
||||
}
|
||||
}
|
||||
|
||||
void Blitter_40bppAnim::CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
|
||||
{
|
||||
uint8 *anim_buf = VideoDriver::GetInstance()->GetAnimBuffer();
|
||||
if (anim_buf == nullptr) {
|
||||
Blitter_32bppOptimized::CopyImageToBuffer(video, dst, width, height, dst_pitch);
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 *udst = (uint32 *)dst;
|
||||
const uint32 *src = (const uint32 *)video;
|
||||
const uint8 *anim_line = ((const uint32 *)video - (uint32 *)_screen.dst_ptr) + anim_buf;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
udst[x] = this->RealizeBlendedColour(anim_line[x], src[x]).data;
|
||||
}
|
||||
src += _screen.pitch;
|
||||
anim_line += _screen.pitch;
|
||||
udst += dst_pitch;
|
||||
}
|
||||
}
|
||||
|
||||
void Blitter_40bppAnim::ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y)
|
||||
{
|
||||
assert(!_screen_disable_anim);
|
||||
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
|
||||
uint8 *anim_buf = VideoDriver::GetInstance()->GetAnimBuffer();
|
||||
uint8 *dst, *src;
|
||||
|
||||
/* We need to scroll the anim-buffer too */
|
||||
if (scroll_y > 0) {
|
||||
dst = anim_buf + left + (top + height - 1) * _screen.pitch;
|
||||
src = dst - scroll_y * _screen.pitch;
|
||||
|
||||
/* Adjust left & width */
|
||||
if (scroll_x >= 0) {
|
||||
dst += scroll_x;
|
||||
} else {
|
||||
src -= scroll_x;
|
||||
}
|
||||
|
||||
uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
|
||||
uint th = height - scroll_y;
|
||||
for (; th > 0; th--) {
|
||||
memcpy(dst, src, tw * sizeof(uint8));
|
||||
src -= _screen.pitch;
|
||||
dst -= _screen.pitch;
|
||||
}
|
||||
} else {
|
||||
/* Calculate pointers */
|
||||
dst = anim_buf + left + top * _screen.pitch;
|
||||
src = dst - scroll_y * _screen.pitch;
|
||||
|
||||
/* Adjust left & width */
|
||||
if (scroll_x >= 0) {
|
||||
dst += scroll_x;
|
||||
} else {
|
||||
src -= scroll_x;
|
||||
}
|
||||
|
||||
/* the y-displacement may be 0 therefore we have to use memmove,
|
||||
* because source and destination may overlap */
|
||||
uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
|
||||
uint th = height + scroll_y;
|
||||
for (; th > 0; th--) {
|
||||
memmove(dst, src, tw * sizeof(uint8));
|
||||
src += _screen.pitch;
|
||||
dst += _screen.pitch;
|
||||
}
|
||||
}
|
||||
|
||||
Blitter_32bppBase::ScrollBuffer(video, left, top, width, height, scroll_x, scroll_y);
|
||||
}
|
||||
|
||||
int Blitter_40bppAnim::BufferSize(int width, int height)
|
||||
{
|
||||
return width * height * (sizeof(uint32) + sizeof(uint8));
|
||||
}
|
||||
|
||||
Blitter::PaletteAnimation Blitter_40bppAnim::UsePaletteAnimation()
|
||||
{
|
||||
return Blitter::PALETTE_ANIMATION_VIDEO_BACKEND;
|
||||
}
|
||||
|
||||
bool Blitter_40bppAnim::NeedsAnimationBuffer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
64
src/blitter/40bpp_anim.hpp
Normal file
64
src/blitter/40bpp_anim.hpp
Normal file
@@ -0,0 +1,64 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD 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, version 2.
|
||||
* OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 40bpp_optimized.hpp Optimized 40 bpp blitter. */
|
||||
|
||||
#ifndef BLITTER_40BPP_OPTIMIZED_HPP
|
||||
#define BLITTER_40BPP_OPTIMIZED_HPP
|
||||
|
||||
|
||||
#include "32bpp_optimized.hpp"
|
||||
#include "../video/video_driver.hpp"
|
||||
|
||||
/** The optimized 40 bpp blitter (for OpenGL video driver). */
|
||||
class Blitter_40bppAnim : public Blitter_32bppOptimized {
|
||||
public:
|
||||
|
||||
// void *MoveTo(void *video, int x, int y) override;
|
||||
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
||||
void DrawRect(void *video, int width, int height, uint8 colour) override;
|
||||
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
|
||||
void CopyFromBuffer(void *video, const void *src, int width, int height) override;
|
||||
void CopyToBuffer(const void *video, void *dst, int width, int height) override;
|
||||
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override;
|
||||
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override;
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
|
||||
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
|
||||
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
|
||||
int BufferSize(int width, int height) override;
|
||||
Blitter::PaletteAnimation UsePaletteAnimation() override;
|
||||
bool NeedsAnimationBuffer() override;
|
||||
|
||||
const char *GetName() override { return "40bpp-anim"; }
|
||||
int GetBytesPerPixel() override { return 5; }
|
||||
|
||||
template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
||||
|
||||
protected:
|
||||
static inline Colour RealizeBlendedColour(uint8 anim, Colour c)
|
||||
{
|
||||
return anim != 0 ? AdjustBrightness(LookupColourInPalette(anim), GetColourBrightness(c)) : c;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/** Factory for the 40 bpp animated blitter (for OpenGL). */
|
||||
class FBlitter_40bppAnim : public BlitterFactory {
|
||||
protected:
|
||||
bool IsUsable() const override
|
||||
{
|
||||
return VideoDriver::GetInstance() == nullptr || VideoDriver::GetInstance()->HasAnimBuffer();
|
||||
}
|
||||
|
||||
public:
|
||||
FBlitter_40bppAnim() : BlitterFactory("40bpp-anim", "40bpp Animation Blitter (OpenGL)") {}
|
||||
Blitter *CreateInstance() override { return new Blitter_40bppAnim(); }
|
||||
};
|
||||
|
||||
#endif /* BLITTER_40BPP_OPTIMIZED_HPP */
|
||||
@@ -32,6 +32,13 @@ add_files(
|
||||
CONDITION NOT OPTION_DEDICATED AND SSE_FOUND
|
||||
)
|
||||
|
||||
add_files(
|
||||
40bpp_anim.cpp
|
||||
40bpp_anim.hpp
|
||||
CONDITION NOT OPTION_DEDICATED AND OPENGL_FOUND
|
||||
)
|
||||
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
set_compile_flags(
|
||||
32bpp_anim_sse2.cpp
|
||||
|
||||
@@ -25,7 +25,7 @@ enum BlitterMode {
|
||||
/**
|
||||
* How all blitters should look like. Extend this class to make your own.
|
||||
*/
|
||||
class Blitter {
|
||||
class Blitter : public SpriteEncoder {
|
||||
public:
|
||||
/** Parameters related to blitting. */
|
||||
struct BlitterParams {
|
||||
@@ -58,6 +58,11 @@ public:
|
||||
*/
|
||||
virtual uint8 GetScreenDepth() = 0;
|
||||
|
||||
bool Is32BppSupported() override
|
||||
{
|
||||
return this->GetScreenDepth() > 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw an image to the screen, given an amount of params defined above.
|
||||
*/
|
||||
@@ -74,11 +79,6 @@ public:
|
||||
*/
|
||||
virtual void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) = 0;
|
||||
|
||||
/**
|
||||
* Convert a sprite from the loader to our own format.
|
||||
*/
|
||||
virtual Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) = 0;
|
||||
|
||||
/**
|
||||
* Move the destination pointer the requested amount x and y, keeping in mind
|
||||
* any pitch and bpp of the renderer.
|
||||
@@ -185,6 +185,14 @@ public:
|
||||
*/
|
||||
virtual Blitter::PaletteAnimation UsePaletteAnimation() = 0;
|
||||
|
||||
/**
|
||||
* Does this blitter require a separate animation buffer from the video backend?
|
||||
*/
|
||||
virtual bool NeedsAnimationBuffer()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the blitter, the same as the Factory-instance returns.
|
||||
*/
|
||||
|
||||
@@ -73,6 +73,15 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the blitter usable with the current drivers and hardware config?
|
||||
* @return True if the blitter can be instantiated.
|
||||
*/
|
||||
virtual bool IsUsable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~BlitterFactory()
|
||||
{
|
||||
@@ -119,7 +128,7 @@ public:
|
||||
for (; it != GetBlitters().end(); it++) {
|
||||
BlitterFactory *b = (*it).second;
|
||||
if (strcasecmp(bname, b->name.c_str()) == 0) {
|
||||
return b;
|
||||
return b->IsUsable() ? b : nullptr;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
#include "base_media_base.h"
|
||||
#include "blitter/factory.hpp"
|
||||
|
||||
#if defined(WITH_FREETYPE) || defined(WITH_UNISCRIBE)
|
||||
#if defined(WITH_FREETYPE) || defined(WITH_UNISCRIBE) || defined(WITH_COCOA)
|
||||
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "error.h"
|
||||
#include "fontcache.h"
|
||||
#include "gfx_func.h"
|
||||
#include "network/network.h"
|
||||
@@ -61,8 +62,65 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Nested widgets for the error window. */
|
||||
static const NWidgetPart _nested_bootstrap_errmsg_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY, WID_BEM_CAPTION), SetDataTip(STR_MISSING_GRAPHICS_ERROR_TITLE, STR_NULL),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BEM_MESSAGE), EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BEM_QUIT), SetDataTip(STR_MISSING_GRAPHICS_ERROR_QUIT, STR_NULL), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
/** Window description for the error window. */
|
||||
static WindowDesc _bootstrap_errmsg_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WC_BOOTSTRAP, WC_NONE,
|
||||
WDF_MODAL,
|
||||
_nested_bootstrap_errmsg_widgets, lengthof(_nested_bootstrap_errmsg_widgets)
|
||||
);
|
||||
|
||||
/** The window for a failed bootstrap. */
|
||||
class BootstrapErrorWindow : public Window {
|
||||
public:
|
||||
BootstrapErrorWindow() : Window(&_bootstrap_errmsg_desc)
|
||||
{
|
||||
this->InitNested(1);
|
||||
}
|
||||
|
||||
~BootstrapErrorWindow()
|
||||
{
|
||||
_exit_game = true;
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
||||
{
|
||||
if (widget == WID_BEM_MESSAGE) {
|
||||
*size = GetStringBoundingBox(STR_MISSING_GRAPHICS_ERROR);
|
||||
size->height = GetStringHeight(STR_MISSING_GRAPHICS_ERROR, size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT) + WD_FRAMETEXT_BOTTOM + WD_FRAMETEXT_TOP;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawWidget(const Rect &r, int widget) const override
|
||||
{
|
||||
if (widget == WID_BEM_MESSAGE) {
|
||||
DrawStringMultiLine(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMETEXT_TOP, r.bottom - WD_FRAMETEXT_BOTTOM, STR_MISSING_GRAPHICS_ERROR, TC_FROMSTRING, SA_CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
{
|
||||
if (widget == WID_BEM_QUIT) {
|
||||
_exit_game = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** Nested widgets for the download window. */
|
||||
static const NWidgetPart _nested_boostrap_download_status_window_widgets[] = {
|
||||
static const NWidgetPart _nested_bootstrap_download_status_window_widgets[] = {
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_NCDS_BACKGROUND),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(350, 0), SetMinimalTextLines(3, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 30),
|
||||
@@ -74,7 +132,7 @@ static WindowDesc _bootstrap_download_status_window_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WC_NETWORK_STATUS_WINDOW, WC_NONE,
|
||||
WDF_MODAL,
|
||||
_nested_boostrap_download_status_window_widgets, lengthof(_nested_boostrap_download_status_window_widgets)
|
||||
_nested_bootstrap_download_status_window_widgets, lengthof(_nested_bootstrap_download_status_window_widgets)
|
||||
);
|
||||
|
||||
|
||||
@@ -86,6 +144,14 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
~BootstrapContentDownloadStatusWindow()
|
||||
{
|
||||
/* If we are not set to exit the game, it means the bootstrap failed. */
|
||||
if (!_exit_game) {
|
||||
new BootstrapErrorWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void OnDownloadComplete(ContentID cid) override
|
||||
{
|
||||
/* We have completed downloading. We can trigger finding the right set now. */
|
||||
@@ -218,7 +284,7 @@ bool HandleBootstrap()
|
||||
if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) goto failure;
|
||||
|
||||
/* If there is no network or no freetype, then there is nothing we can do. Go straight to failure. */
|
||||
#if (defined(_WIN32) && defined(WITH_UNISCRIBE)) || (defined(WITH_FREETYPE) && (defined(WITH_FONTCONFIG) || defined(__APPLE__)))
|
||||
#if (defined(_WIN32) && defined(WITH_UNISCRIBE)) || (defined(WITH_FREETYPE) && (defined(WITH_FONTCONFIG) || defined(__APPLE__))) || defined(WITH_COCOA)
|
||||
if (!_network_available) goto failure;
|
||||
|
||||
/* First tell the game we're bootstrapping. */
|
||||
|
||||
@@ -61,7 +61,7 @@ typedef GUIList<BuildBridgeData> GUIBridgeList; ///< List of bridges, used in #B
|
||||
void CcBuildBridge(const CommandCost &result, TileIndex end_tile, uint32 p1, uint32 p2, uint32 cmd)
|
||||
{
|
||||
if (result.Failed()) return;
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_27_BLACKSMITH_ANVIL, end_tile);
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_27_CONSTRUCTION_BRIDGE, end_tile);
|
||||
|
||||
TransportType transport_type = Extract<TransportType, 15, 2>(p2);
|
||||
|
||||
|
||||
@@ -86,8 +86,9 @@ static const NWidgetPart _nested_build_vehicle_widgets[] = {
|
||||
};
|
||||
|
||||
/** Special cargo filter criteria */
|
||||
static const CargoID CF_ANY = CT_NO_REFIT; ///< Show all vehicles independent of carried cargo (i.e. no filtering)
|
||||
static const CargoID CF_NONE = CT_INVALID; ///< Show only vehicles which do not carry cargo (e.g. train engines)
|
||||
static const CargoID CF_ANY = CT_NO_REFIT; ///< Show all vehicles independent of carried cargo (i.e. no filtering)
|
||||
static const CargoID CF_NONE = CT_INVALID; ///< Show only vehicles which do not carry cargo (e.g. train engines)
|
||||
static const CargoID CF_ENGINES = CT_AUTO_REFIT; ///< Show only engines (for rail vehicles only)
|
||||
|
||||
bool _engine_sort_direction; ///< \c false = descending, \c true = ascending.
|
||||
byte _engine_sort_last_criteria[] = {0, 0, 0, 0}; ///< Last set sort criteria, for each vehicle type.
|
||||
@@ -531,16 +532,21 @@ const StringID _engine_sort_listing[][12] = {{
|
||||
INVALID_STRING_ID
|
||||
}};
|
||||
|
||||
/** Cargo filter functions */
|
||||
static bool CDECL CargoFilter(const EngineID *eid, const CargoID cid)
|
||||
/** Filters vehicles by cargo and engine (in case of rail vehicle). */
|
||||
static bool CDECL CargoAndEngineFilter(const EngineID *eid, const CargoID cid)
|
||||
{
|
||||
if (cid == CF_ANY) return true;
|
||||
CargoTypes refit_mask = GetUnionOfArticulatedRefitMasks(*eid, true) & _standard_cargo_mask;
|
||||
return (cid == CF_NONE ? refit_mask == 0 : HasBit(refit_mask, cid));
|
||||
if (cid == CF_ANY) {
|
||||
return true;
|
||||
} else if (cid == CF_ENGINES) {
|
||||
return Engine::Get(*eid)->GetPower() != 0;
|
||||
} else {
|
||||
CargoTypes refit_mask = GetUnionOfArticulatedRefitMasks(*eid, true) & _standard_cargo_mask;
|
||||
return (cid == CF_NONE ? refit_mask == 0 : HasBit(refit_mask, cid));
|
||||
}
|
||||
}
|
||||
|
||||
static GUIEngineList::FilterFunction * const _filter_funcs[] = {
|
||||
&CargoFilter,
|
||||
&CargoAndEngineFilter,
|
||||
};
|
||||
|
||||
static int DrawCargoCapacityInfo(int left, int right, int y, EngineID engine, TestedEngineDetails &te)
|
||||
@@ -1046,8 +1052,8 @@ struct BuildVehicleWindow : Window {
|
||||
EngineID sel_engine; ///< Currently selected engine, or #INVALID_ENGINE
|
||||
EngineID rename_engine; ///< Engine being renamed.
|
||||
GUIEngineList eng_list;
|
||||
CargoID cargo_filter[NUM_CARGO + 2]; ///< Available cargo filters; CargoID or CF_ANY or CF_NONE
|
||||
StringID cargo_filter_texts[NUM_CARGO + 3]; ///< Texts for filter_cargo, terminated by INVALID_STRING_ID
|
||||
CargoID cargo_filter[NUM_CARGO + 3]; ///< Available cargo filters; CargoID or CF_ANY or CF_NONE or CF_ENGINES
|
||||
StringID cargo_filter_texts[NUM_CARGO + 4]; ///< Texts for filter_cargo, terminated by INVALID_STRING_ID
|
||||
byte cargo_filter_criteria; ///< Selected cargo filter
|
||||
int details_height; ///< Minimal needed height of the details panels (found so far).
|
||||
Scrollbar *vscroll;
|
||||
@@ -1165,9 +1171,15 @@ struct BuildVehicleWindow : Window {
|
||||
this->cargo_filter_texts[filter_items] = STR_PURCHASE_INFO_ALL_TYPES;
|
||||
filter_items++;
|
||||
|
||||
/* Add item for vehicles not carrying anything, e.g. train engines.
|
||||
* This could also be useful for eyecandy vehicles of other types, but is likely too confusing for joe, */
|
||||
/* Specific filters for trains. */
|
||||
if (this->vehicle_type == VEH_TRAIN) {
|
||||
/* Add item for locomotives only in case of trains. */
|
||||
this->cargo_filter[filter_items] = CF_ENGINES;
|
||||
this->cargo_filter_texts[filter_items] = STR_PURCHASE_INFO_ENGINES_ONLY;
|
||||
filter_items++;
|
||||
|
||||
/* Add item for vehicles not carrying anything, e.g. train engines.
|
||||
* This could also be useful for eyecandy vehicles of other types, but is likely too confusing for joe, */
|
||||
this->cargo_filter[filter_items] = CF_NONE;
|
||||
this->cargo_filter_texts[filter_items] = STR_PURCHASE_INFO_NONE;
|
||||
filter_items++;
|
||||
@@ -1254,7 +1266,7 @@ struct BuildVehicleWindow : Window {
|
||||
bool FilterSingleEngine(EngineID eid)
|
||||
{
|
||||
CargoID filter_type = this->cargo_filter[this->cargo_filter_criteria];
|
||||
return (filter_type == CF_ANY || CargoFilter(&eid, filter_type));
|
||||
return CargoAndEngineFilter(&eid, filter_type);
|
||||
}
|
||||
|
||||
/* Figure out what train EngineIDs to put in the list */
|
||||
@@ -1460,7 +1472,7 @@ struct BuildVehicleWindow : Window {
|
||||
if (sel_eng != INVALID_ENGINE) {
|
||||
CommandCallback *callback = (this->vehicle_type == VEH_TRAIN && RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) ? CcBuildWagon : CcBuildPrimaryVehicle;
|
||||
CargoID cargo = this->cargo_filter[this->cargo_filter_criteria];
|
||||
if (cargo == CF_ANY) cargo = CF_NONE;
|
||||
if (cargo == CF_ANY || cargo == CF_ENGINES) cargo = CF_NONE;
|
||||
DoCommandP(this->window_number, sel_eng | (cargo << 24), 0, GetCmdBuildVeh(this->vehicle_type), callback);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -338,6 +338,7 @@ void GenerateClearTile()
|
||||
TileIndex tile_new;
|
||||
|
||||
SetClearGroundDensity(tile, CLEAR_ROCKS, 3);
|
||||
MarkTileDirtyByTile(tile);
|
||||
do {
|
||||
if (--j == 0) goto get_out;
|
||||
tile_new = tile + TileOffsByDiagDir((DiagDirection)GB(Random(), 0, 2));
|
||||
|
||||
@@ -77,7 +77,7 @@ CommandCallback CcBuildBridge;
|
||||
|
||||
/* dock_gui.cpp */
|
||||
CommandCallback CcBuildDocks;
|
||||
CommandCallback CcPlaySound_SPLAT_WATER;
|
||||
CommandCallback CcPlaySound_CONSTRUCTION_WATER;
|
||||
|
||||
/* depot_gui.cpp */
|
||||
CommandCallback CcCloneVehicle;
|
||||
@@ -98,13 +98,13 @@ CommandCallback CcPlaceSign;
|
||||
CommandCallback CcTerraform;
|
||||
|
||||
/* rail_gui.cpp */
|
||||
CommandCallback CcPlaySound_SPLAT_RAIL;
|
||||
CommandCallback CcPlaySound_CONSTRUCTION_RAIL;
|
||||
CommandCallback CcRailDepot;
|
||||
CommandCallback CcStation;
|
||||
CommandCallback CcBuildRailTunnel;
|
||||
|
||||
/* road_gui.cpp */
|
||||
CommandCallback CcPlaySound_SPLAT_OTHER;
|
||||
CommandCallback CcPlaySound_CONSTRUCTION_OTHER;
|
||||
CommandCallback CcBuildRoadTunnel;
|
||||
CommandCallback CcRoadDepot;
|
||||
CommandCallback CcRoadStop;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "game/game.hpp"
|
||||
#include "goal_base.h"
|
||||
#include "story_base.h"
|
||||
#include "widgets/statusbar_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
@@ -62,9 +63,9 @@ Company::Company(uint16 name_1, bool is_ai)
|
||||
this->name_1 = name_1;
|
||||
this->location_of_HQ = INVALID_TILE;
|
||||
this->is_ai = is_ai;
|
||||
this->terraform_limit = _settings_game.construction.terraform_frame_burst << 16;
|
||||
this->clear_limit = _settings_game.construction.clear_frame_burst << 16;
|
||||
this->tree_limit = _settings_game.construction.tree_frame_burst << 16;
|
||||
this->terraform_limit = (uint32)_settings_game.construction.terraform_frame_burst << 16;
|
||||
this->clear_limit = (uint32)_settings_game.construction.clear_frame_burst << 16;
|
||||
this->tree_limit = (uint32)_settings_game.construction.tree_frame_burst << 16;
|
||||
|
||||
for (uint j = 0; j < 4; j++) this->share_owners[j] = COMPANY_SPECTATOR;
|
||||
InvalidateWindowData(WC_PERFORMANCE_DETAIL, 0, INVALID_COMPANY);
|
||||
@@ -119,6 +120,7 @@ void SetLocalCompany(CompanyID new_company)
|
||||
/* ... and redraw the whole screen. */
|
||||
MarkWholeScreenDirty();
|
||||
InvalidateWindowClassesData(WC_SIGN_LIST, -1);
|
||||
InvalidateWindowClassesData(WC_GOALS_LIST);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,7 +184,7 @@ void InvalidateCompanyWindows(const Company *company)
|
||||
{
|
||||
CompanyID cid = company->index;
|
||||
|
||||
if (cid == _local_company) SetWindowDirty(WC_STATUS_BAR, 0);
|
||||
if (cid == _local_company) SetWindowWidgetDirty(WC_STATUS_BAR, 0, WID_S_RIGHT);
|
||||
SetWindowDirty(WC_FINANCES, cid);
|
||||
}
|
||||
|
||||
@@ -265,9 +267,9 @@ void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost &cst)
|
||||
void UpdateLandscapingLimits()
|
||||
{
|
||||
for (Company *c : Company::Iterate()) {
|
||||
c->terraform_limit = std::min<uint32>(c->terraform_limit + _settings_game.construction.terraform_per_64k_frames, _settings_game.construction.terraform_frame_burst << 16);
|
||||
c->clear_limit = std::min<uint32>(c->clear_limit + _settings_game.construction.clear_per_64k_frames, _settings_game.construction.clear_frame_burst << 16);
|
||||
c->tree_limit = std::min<uint32>(c->tree_limit + _settings_game.construction.tree_per_64k_frames, _settings_game.construction.tree_frame_burst << 16);
|
||||
c->terraform_limit = std::min<uint64>((uint64)c->terraform_limit + _settings_game.construction.terraform_per_64k_frames, (uint64)_settings_game.construction.terraform_frame_burst << 16);
|
||||
c->clear_limit = std::min<uint64>((uint64)c->clear_limit + _settings_game.construction.clear_per_64k_frames, (uint64)_settings_game.construction.clear_frame_burst << 16);
|
||||
c->tree_limit = std::min<uint64>((uint64)c->tree_limit + _settings_game.construction.tree_per_64k_frames, (uint64)_settings_game.construction.tree_frame_burst << 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -821,13 +823,6 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
|
||||
ClientID client_id = (ClientID)p2;
|
||||
NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(client_id);
|
||||
#ifndef DEBUG_DUMP_COMMANDS
|
||||
/* When replaying the client ID is not a valid client; there
|
||||
* are actually no clients at all. However, the company has to
|
||||
* be created, otherwise we cannot rerun the game properly.
|
||||
* So only allow a nullptr client info in that case. */
|
||||
if (ci == nullptr) return CommandCost();
|
||||
#endif /* NOT DEBUG_DUMP_COMMANDS */
|
||||
|
||||
/* Delete multiplayer progress bar */
|
||||
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
|
||||
@@ -836,7 +831,9 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
|
||||
/* A new company could not be created, revert to being a spectator */
|
||||
if (c == nullptr) {
|
||||
if (_network_server) {
|
||||
/* We check for "ci != nullptr" as a client could have left by
|
||||
* the time we execute this command. */
|
||||
if (_network_server && ci != nullptr) {
|
||||
ci->client_playas = COMPANY_SPECTATOR;
|
||||
NetworkUpdateClientInfo(ci->client_id);
|
||||
}
|
||||
@@ -863,9 +860,16 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
}
|
||||
|
||||
case CCA_NEW_AI: { // Make a new AI company
|
||||
if (company_id != INVALID_COMPANY && company_id >= MAX_COMPANIES) return CMD_ERROR;
|
||||
|
||||
/* For network games, company deletion is delayed. */
|
||||
if (!_networking && company_id != INVALID_COMPANY && Company::IsValidID(company_id)) return CMD_ERROR;
|
||||
|
||||
if (!(flags & DC_EXEC)) return CommandCost();
|
||||
|
||||
if (company_id != INVALID_COMPANY && (company_id >= MAX_COMPANIES || Company::IsValidID(company_id))) return CMD_ERROR;
|
||||
/* For network game, just assume deletion happened. */
|
||||
assert(company_id == INVALID_COMPANY || !Company::IsValidID(company_id));
|
||||
|
||||
Company *c = DoStartupNewCompany(true, company_id);
|
||||
if (c != nullptr) NetworkServerNewCompany(c, nullptr);
|
||||
break;
|
||||
@@ -875,6 +879,9 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
CompanyRemoveReason reason = (CompanyRemoveReason)GB(p1, 24, 8);
|
||||
if (reason >= CRR_END) return CMD_ERROR;
|
||||
|
||||
/* We can't delete the last existing company in singleplayer mode. */
|
||||
if (!_networking && Company::GetNumItems() == 1) return CMD_ERROR;
|
||||
|
||||
Company *c = Company::GetIfValid(company_id);
|
||||
if (c == nullptr) return CMD_ERROR;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "safeguards.h"
|
||||
|
||||
/* scriptfile handling */
|
||||
static bool _script_running; ///< Script is running (used to abort execution when #ConReturn is encountered).
|
||||
static uint _script_current_depth; ///< Depth of scripts running (used to abort execution when #ConReturn is encountered).
|
||||
|
||||
/** File list storage for the console, for caching the last 'ls' command. */
|
||||
class ConsoleFileList : public FileList {
|
||||
@@ -147,7 +147,7 @@ DEF_CONSOLE_HOOK(ConHookNeedNetwork)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether we are in single player mode.
|
||||
* Check whether we are in singleplayer mode.
|
||||
* @return True when no network is active.
|
||||
*/
|
||||
DEF_CONSOLE_HOOK(ConHookNoNetwork)
|
||||
@@ -960,10 +960,16 @@ DEF_CONSOLE_CMD(ConExec)
|
||||
return true;
|
||||
}
|
||||
|
||||
_script_running = true;
|
||||
if (_script_current_depth == 11) {
|
||||
IConsoleError("Maximum 'exec' depth reached; script A is calling script B is calling script C ... more than 10 times.");
|
||||
return true;
|
||||
}
|
||||
|
||||
_script_current_depth++;
|
||||
uint script_depth = _script_current_depth;
|
||||
|
||||
char cmdline[ICON_CMDLN_SIZE];
|
||||
while (_script_running && fgets(cmdline, sizeof(cmdline), script_file) != nullptr) {
|
||||
while (fgets(cmdline, sizeof(cmdline), script_file) != nullptr) {
|
||||
/* Remove newline characters from the executing script */
|
||||
for (char *cmdptr = cmdline; *cmdptr != '\0'; cmdptr++) {
|
||||
if (*cmdptr == '\n' || *cmdptr == '\r') {
|
||||
@@ -972,13 +978,18 @@ DEF_CONSOLE_CMD(ConExec)
|
||||
}
|
||||
}
|
||||
IConsoleCmdExec(cmdline);
|
||||
/* Ensure that we are still on the same depth or that we returned via 'return'. */
|
||||
assert(_script_current_depth == script_depth || _script_current_depth == script_depth - 1);
|
||||
|
||||
/* The 'return' command was executed. */
|
||||
if (_script_current_depth == script_depth - 1) break;
|
||||
}
|
||||
|
||||
if (ferror(script_file)) {
|
||||
IConsoleError("Encountered error while trying to read from script file");
|
||||
}
|
||||
|
||||
_script_running = false;
|
||||
if (_script_current_depth == script_depth) _script_current_depth--;
|
||||
FioFCloseFile(script_file);
|
||||
return true;
|
||||
}
|
||||
@@ -990,7 +1001,7 @@ DEF_CONSOLE_CMD(ConReturn)
|
||||
return true;
|
||||
}
|
||||
|
||||
_script_running = false;
|
||||
_script_current_depth--;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1248,13 +1259,14 @@ DEF_CONSOLE_CMD(ConReloadAI)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Company::IsHumanID(company_id)) {
|
||||
/* In singleplayer mode the player can be in an AI company, after cheating or loading network save with an AI in first slot. */
|
||||
if (Company::IsHumanID(company_id) || company_id == _local_company) {
|
||||
IConsoleWarning("Company is not controlled by an AI.");
|
||||
return true;
|
||||
}
|
||||
|
||||
/* First kill the company of the AI, then start a new one. This should start the current AI again */
|
||||
DoCommandP(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0,CMD_COMPANY_CTRL);
|
||||
DoCommandP(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0, CMD_COMPANY_CTRL);
|
||||
DoCommandP(0, CCA_NEW_AI | company_id << 16, 0, CMD_COMPANY_CTRL);
|
||||
IConsolePrint(CC_DEFAULT, "AI reloaded.");
|
||||
|
||||
@@ -1285,6 +1297,7 @@ DEF_CONSOLE_CMD(ConStopAI)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* In singleplayer mode the player can be in an AI company, after cheating or loading network save with an AI in first slot. */
|
||||
if (Company::IsHumanID(company_id) || company_id == _local_company) {
|
||||
IConsoleWarning("Company is not controlled by an AI.");
|
||||
return true;
|
||||
@@ -1338,7 +1351,7 @@ DEF_CONSOLE_CMD(ConRescanNewGRF)
|
||||
return true;
|
||||
}
|
||||
|
||||
ScanNewGRFFiles(nullptr);
|
||||
RequestNewGRFScan();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1407,46 +1420,80 @@ DEF_CONSOLE_CMD(ConAlias)
|
||||
DEF_CONSOLE_CMD(ConScreenShot)
|
||||
{
|
||||
if (argc == 0) {
|
||||
IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [big | giant | no_con | minimap] [file name]'");
|
||||
IConsoleHelp("'big' makes a zoomed-in screenshot of the visible area, 'giant' makes a screenshot of the "
|
||||
"whole map, 'no_con' hides the console to create the screenshot. 'big' or 'giant' "
|
||||
"screenshots are always drawn without console. "
|
||||
"'minimap' makes a top-viewed minimap screenshot of whole world which represents one tile by one pixel.");
|
||||
IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [viewport | normal | big | giant | heightmap | minimap] [no_con] [size <width> <height>] [<filename>]'");
|
||||
IConsoleHelp("'viewport' (default) makes a screenshot of the current viewport (including menus, windows, ..), "
|
||||
"'normal' makes a screenshot of the visible area, "
|
||||
"'big' makes a zoomed-in screenshot of the visible area, "
|
||||
"'giant' makes a screenshot of the whole map, "
|
||||
"'heightmap' makes a heightmap screenshot of the map that can be loaded in as heightmap, "
|
||||
"'minimap' makes a top-viewed minimap screenshot of the whole world which represents one tile by one pixel. "
|
||||
"'no_con' hides the console to create the screenshot (only useful in combination with 'viewport'). "
|
||||
"'size' sets the width and height of the viewport to make a screenshot of (only useful in combination with 'normal' or 'big').");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argc > 3) return false;
|
||||
if (argc > 7) return false;
|
||||
|
||||
ScreenshotType type = SC_VIEWPORT;
|
||||
uint32 width = 0;
|
||||
uint32 height = 0;
|
||||
const char *name = nullptr;
|
||||
uint32 arg_index = 1;
|
||||
|
||||
if (argc > 1) {
|
||||
if (strcmp(argv[1], "big") == 0) {
|
||||
/* screenshot big [filename] */
|
||||
if (argc > arg_index) {
|
||||
if (strcmp(argv[arg_index], "viewport") == 0) {
|
||||
type = SC_VIEWPORT;
|
||||
arg_index += 1;
|
||||
} else if (strcmp(argv[arg_index], "normal") == 0) {
|
||||
type = SC_DEFAULTZOOM;
|
||||
arg_index += 1;
|
||||
} else if (strcmp(argv[arg_index], "big") == 0) {
|
||||
type = SC_ZOOMEDIN;
|
||||
if (argc > 2) name = argv[2];
|
||||
} else if (strcmp(argv[1], "giant") == 0) {
|
||||
/* screenshot giant [filename] */
|
||||
arg_index += 1;
|
||||
} else if (strcmp(argv[arg_index], "giant") == 0) {
|
||||
type = SC_WORLD;
|
||||
if (argc > 2) name = argv[2];
|
||||
} else if (strcmp(argv[1], "minimap") == 0) {
|
||||
/* screenshot minimap [filename] */
|
||||
arg_index += 1;
|
||||
} else if (strcmp(argv[arg_index], "heightmap") == 0) {
|
||||
type = SC_HEIGHTMAP;
|
||||
arg_index += 1;
|
||||
} else if (strcmp(argv[arg_index], "minimap") == 0) {
|
||||
type = SC_MINIMAP;
|
||||
if (argc > 2) name = argv[2];
|
||||
} else if (strcmp(argv[1], "no_con") == 0) {
|
||||
/* screenshot no_con [filename] */
|
||||
IConsoleClose();
|
||||
if (argc > 2) name = argv[2];
|
||||
} else if (argc == 2) {
|
||||
/* screenshot filename */
|
||||
name = argv[1];
|
||||
} else {
|
||||
/* screenshot argv[1] argv[2] - invalid */
|
||||
return false;
|
||||
arg_index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
MakeScreenshot(type, name);
|
||||
if (argc > arg_index && strcmp(argv[arg_index], "no_con") == 0) {
|
||||
if (type != SC_VIEWPORT) {
|
||||
IConsoleError("'no_con' can only be used in combination with 'viewport'");
|
||||
return true;
|
||||
}
|
||||
IConsoleClose();
|
||||
arg_index += 1;
|
||||
}
|
||||
|
||||
if (argc > arg_index + 2 && strcmp(argv[arg_index], "size") == 0) {
|
||||
/* size <width> <height> */
|
||||
if (type != SC_DEFAULTZOOM && type != SC_ZOOMEDIN) {
|
||||
IConsoleError("'size' can only be used in combination with 'normal' or 'big'");
|
||||
return true;
|
||||
}
|
||||
GetArgumentInteger(&width, argv[arg_index + 1]);
|
||||
GetArgumentInteger(&height, argv[arg_index + 2]);
|
||||
arg_index += 3;
|
||||
}
|
||||
|
||||
if (argc > arg_index) {
|
||||
/* Last parameter that was not one of the keywords must be the filename. */
|
||||
name = argv[arg_index];
|
||||
arg_index += 1;
|
||||
}
|
||||
|
||||
if (argc > arg_index) {
|
||||
/* We have parameters we did not process; means we misunderstood any of the above. */
|
||||
return false;
|
||||
}
|
||||
|
||||
MakeScreenshot(type, name, width, height);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1832,7 +1879,7 @@ DEF_CONSOLE_CMD(ConContent)
|
||||
* to download every available package on BaNaNaS. This is not in
|
||||
* the spirit of this service. Additionally, these few people were
|
||||
* good for 70% of the consumed bandwidth of BaNaNaS. */
|
||||
IConsolePrintF(CC_ERROR, "'select all' is no longer supported since 1.11");
|
||||
IConsoleError("'select all' is no longer supported since 1.11");
|
||||
} else {
|
||||
_network_content_client.Select((ContentID)atoi(argv[2]));
|
||||
}
|
||||
@@ -2134,7 +2181,7 @@ static void ConDumpRoadTypes()
|
||||
grfs.emplace(grfid, grf);
|
||||
}
|
||||
IConsolePrintF(CC_DEFAULT, " %02u %s %c%c%c%c, Flags: %c%c%c%c%c, GRF: %08X, %s",
|
||||
(uint) rt,
|
||||
(uint)rt,
|
||||
RoadTypeIsTram(rt) ? "Tram" : "Road",
|
||||
rti->label >> 24, rti->label >> 16, rti->label >> 8, rti->label,
|
||||
HasBit(rti->flags, ROTF_CATENARY) ? 'c' : '-',
|
||||
@@ -2172,7 +2219,7 @@ static void ConDumpRailTypes()
|
||||
grfs.emplace(grfid, grf);
|
||||
}
|
||||
IConsolePrintF(CC_DEFAULT, " %02u %c%c%c%c, Flags: %c%c%c%c%c%c, GRF: %08X, %s",
|
||||
(uint) rt,
|
||||
(uint)rt,
|
||||
rti->label >> 24, rti->label >> 16, rti->label >> 8, rti->label,
|
||||
HasBit(rti->flags, RTF_CATENARY) ? 'c' : '-',
|
||||
HasBit(rti->flags, RTF_NO_LEVEL_CROSSING) ? 'l' : '-',
|
||||
@@ -2215,7 +2262,7 @@ static void ConDumpCargoTypes()
|
||||
grfs.emplace(grfid, grf);
|
||||
}
|
||||
IConsolePrintF(CC_DEFAULT, " %02u Bit: %2u, Label: %c%c%c%c, Callback mask: 0x%02X, Cargo class: %c%c%c%c%c%c%c%c%c%c%c, GRF: %08X, %s",
|
||||
(uint) i,
|
||||
(uint)i,
|
||||
spec->bitnum,
|
||||
spec->label >> 24, spec->label >> 16, spec->label >> 8, spec->label,
|
||||
spec->callback_mask,
|
||||
|
||||
@@ -26,3 +26,25 @@ Dimension maxdim(const Dimension &d1, const Dimension &d2)
|
||||
d.height = std::max(d1.height, d2.height);
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the bounding rectangle around two rectangles.
|
||||
* @param r1 First rectangle.
|
||||
* @param r2 Second rectangle.
|
||||
* @return The bounding rectangle, the smallest rectangle that contains both arguments.
|
||||
*/
|
||||
Rect BoundingRect(const Rect &r1, const Rect &r2)
|
||||
{
|
||||
/* If either the first or the second is empty, return the other. */
|
||||
if (IsEmptyRect(r1)) return r2;
|
||||
if (IsEmptyRect(r2)) return r1;
|
||||
|
||||
Rect r;
|
||||
|
||||
r.top = std::min(r1.top, r2.top);
|
||||
r.bottom = std::max(r1.bottom, r2.bottom);
|
||||
r.left = std::min(r1.left, r2.left);
|
||||
r.right = std::max(r1.right, r2.right);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -14,4 +14,16 @@
|
||||
|
||||
Dimension maxdim(const Dimension &d1, const Dimension &d2);
|
||||
|
||||
/**
|
||||
* Check if a rectangle is empty.
|
||||
* @param r Rectangle to check.
|
||||
* @return True if and only if the rectangle doesn't define space.
|
||||
*/
|
||||
static inline bool IsEmptyRect(const Rect &r)
|
||||
{
|
||||
return (r.left | r.top | r.right | r.bottom) == 0;
|
||||
}
|
||||
|
||||
Rect BoundingRect(const Rect &r1, const Rect &r2);
|
||||
|
||||
#endif /* GEOMETRY_FUNC_HPP */
|
||||
|
||||
@@ -114,6 +114,12 @@ public:
|
||||
*/
|
||||
static void InitialiseCrashLog();
|
||||
|
||||
/**
|
||||
* Prepare crash log handler for a newly started thread.
|
||||
* @note must be implemented by all implementers of CrashLog.
|
||||
*/
|
||||
static void InitThread();
|
||||
|
||||
static void SetErrorMessage(const char *message);
|
||||
static void AfterCrashLogCleanup();
|
||||
};
|
||||
|
||||
@@ -66,6 +66,8 @@ static const CurrencySpec origin_currency_specs[CURRENCY_END] = {
|
||||
{ 8, "", CF_NOEURO, u8"\u00a5", "", 0, STR_GAME_OPTIONS_CURRENCY_CNY }, ///< chinese renminbi
|
||||
{ 10, "", CF_NOEURO, "HKD" NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_HKD }, ///< hong kong dollar
|
||||
{ 90, "", CF_NOEURO, u8"\u20b9", "", 0, STR_GAME_OPTIONS_CURRENCY_INR }, ///< Indian Rupee
|
||||
{ 19, "", CF_NOEURO, "Rp", "", 0, STR_GAME_OPTIONS_CURRENCY_IDR }, ///< Indonesian Rupiah
|
||||
{ 5, "", CF_NOEURO, "RM", "", 0, STR_GAME_OPTIONS_CURRENCY_MYR }, ///< Malaysian Ringgit
|
||||
};
|
||||
|
||||
/** Array of currencies used by the system */
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define CURRENCY_H
|
||||
|
||||
#include "date_type.h"
|
||||
#include "string_func.h"
|
||||
#include "strings_type.h"
|
||||
|
||||
static const int CF_NOEURO = 0; ///< Currency never switches to the Euro (as far as known).
|
||||
@@ -62,6 +63,8 @@ enum Currencies {
|
||||
CURRENCY_CNY, ///< Chinese Renminbi
|
||||
CURRENCY_HKD, ///< Hong Kong Dollar
|
||||
CURRENCY_INR, ///< Indian Rupee
|
||||
CURRENCY_IDR, ///< Indonesian Rupiah
|
||||
CURRENCY_MYR, ///< Malaysian Ringgit
|
||||
CURRENCY_END, ///< always the last item
|
||||
};
|
||||
|
||||
@@ -83,6 +86,15 @@ struct CurrencySpec {
|
||||
*/
|
||||
byte symbol_pos;
|
||||
StringID name;
|
||||
|
||||
CurrencySpec() = default;
|
||||
|
||||
CurrencySpec(uint16 rate, const char *separator, Year to_euro, const char *prefix, const char *suffix, byte symbol_pos, StringID name) : rate(rate), to_euro(to_euro), symbol_pos(symbol_pos), name(name)
|
||||
{
|
||||
strecpy(this->separator, separator, lastof(this->separator));
|
||||
strecpy(this->prefix, prefix, lastof(this->prefix));
|
||||
strecpy(this->suffix, suffix, lastof(this->suffix));
|
||||
}
|
||||
};
|
||||
|
||||
extern CurrencySpec _currency_specs[CURRENCY_END];
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "linkgraph/linkgraph.h"
|
||||
#include "saveload/saveload.h"
|
||||
#include "newgrf_profiling.h"
|
||||
#include "widgets/statusbar_widget.h"
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
@@ -255,7 +256,7 @@ static void OnNewDay()
|
||||
DisasterDailyLoop();
|
||||
IndustryDailyLoop();
|
||||
|
||||
SetWindowWidgetDirty(WC_STATUS_BAR, 0, 0);
|
||||
SetWindowWidgetDirty(WC_STATUS_BAR, 0, WID_S_LEFT);
|
||||
EnginesDailyLoop();
|
||||
|
||||
/* Refresh after possible snowline change */
|
||||
|
||||
@@ -45,8 +45,6 @@ int _debug_console_level;
|
||||
int _debug_random_level;
|
||||
#endif
|
||||
|
||||
uint32 _realtime_tick = 0;
|
||||
|
||||
struct DebugLevel {
|
||||
const char *name;
|
||||
int *level;
|
||||
@@ -134,7 +132,7 @@ static void debug_print(const char *dbg, const char *buf)
|
||||
char buffer[512];
|
||||
seprintf(buffer, lastof(buffer), "%sdbg: [%s] %s\n", GetLogPrefix(), dbg, buf);
|
||||
#if defined(_WIN32)
|
||||
TCHAR system_buf[512];
|
||||
wchar_t system_buf[512];
|
||||
convert_to_fs(buffer, system_buf, lengthof(system_buf), true);
|
||||
_fputts(system_buf, stderr);
|
||||
#else
|
||||
|
||||
@@ -121,7 +121,4 @@ void CDECL ShowInfoF(const char *str, ...) WARN_FORMAT(1, 2);
|
||||
|
||||
const char *GetLogPrefix();
|
||||
|
||||
/** The real time in the game. */
|
||||
extern uint32 _realtime_tick;
|
||||
|
||||
#endif /* DEBUG_H */
|
||||
|
||||
@@ -294,6 +294,7 @@ struct DepotWindow : Window {
|
||||
~DepotWindow()
|
||||
{
|
||||
DeleteWindowById(WC_BUILD_VEHICLE, this->window_number);
|
||||
DeleteWindowById(GetWindowClassForVehicleType(this->type), VehicleListIdentifier(VL_DEPOT_LIST, this->type, this->owner, this->GetDepotIndex()).Pack(), false);
|
||||
OrderBackup::Reset(this->window_number);
|
||||
}
|
||||
|
||||
@@ -423,10 +424,8 @@ struct DepotWindow : Window {
|
||||
{
|
||||
if (widget != WID_D_CAPTION) return;
|
||||
|
||||
/* locate the depot struct */
|
||||
TileIndex tile = this->window_number;
|
||||
SetDParam(0, this->type);
|
||||
SetDParam(1, (this->type == VEH_AIRCRAFT) ? GetStationIndex(tile) : GetDepotIndex(tile));
|
||||
SetDParam(1, this->GetDepotIndex());
|
||||
}
|
||||
|
||||
struct GetDepotVehiclePtData {
|
||||
@@ -809,11 +808,8 @@ struct DepotWindow : Window {
|
||||
case WID_D_SELL_ALL:
|
||||
/* Only open the confirmation window if there are anything to sell */
|
||||
if (this->vehicle_list.size() != 0 || this->wagon_list.size() != 0) {
|
||||
TileIndex tile = this->window_number;
|
||||
byte vehtype = this->type;
|
||||
|
||||
SetDParam(0, vehtype);
|
||||
SetDParam(1, (vehtype == VEH_AIRCRAFT) ? GetStationIndex(tile) : GetDepotIndex(tile));
|
||||
SetDParam(0, this->type);
|
||||
SetDParam(1, this->GetDepotIndex());
|
||||
ShowQuery(
|
||||
STR_DEPOT_CAPTION,
|
||||
STR_DEPOT_SELL_CONFIRMATION_TEXT,
|
||||
@@ -839,7 +835,7 @@ struct DepotWindow : Window {
|
||||
if (str == nullptr) return;
|
||||
|
||||
/* Do depot renaming */
|
||||
DoCommandP(0, GetDepotIndex(this->window_number), 0, CMD_RENAME_DEPOT | CMD_MSG(STR_ERROR_CAN_T_RENAME_DEPOT), nullptr, str);
|
||||
DoCommandP(0, this->GetDepotIndex(), 0, CMD_RENAME_DEPOT | CMD_MSG(STR_ERROR_CAN_T_RENAME_DEPOT), nullptr, str);
|
||||
}
|
||||
|
||||
bool OnRightClick(Point pt, int widget) override
|
||||
@@ -1076,6 +1072,16 @@ struct DepotWindow : Window {
|
||||
|
||||
return ES_NOT_HANDLED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the DepotID of the current window.
|
||||
* In the case of airports, this is the station ID.
|
||||
* @return Depot or station ID of this window.
|
||||
*/
|
||||
inline uint16 GetDepotIndex() const
|
||||
{
|
||||
return (this->type == VEH_AIRCRAFT) ? ::GetStationIndex(this->window_number) : ::GetDepotIndex(this->window_number);
|
||||
}
|
||||
};
|
||||
|
||||
static void DepotSellAllConfirmationCallback(Window *win, bool confirmed)
|
||||
|
||||
@@ -42,13 +42,13 @@ void CcBuildDocks(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p
|
||||
{
|
||||
if (result.Failed()) return;
|
||||
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT_WATER, tile);
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_02_CONSTRUCTION_WATER, tile);
|
||||
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||
}
|
||||
|
||||
void CcPlaySound_SPLAT_WATER(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
|
||||
void CcPlaySound_CONSTRUCTION_WATER(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
|
||||
{
|
||||
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT_WATER, tile);
|
||||
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_CONSTRUCTION_WATER, tile);
|
||||
}
|
||||
|
||||
|
||||
@@ -244,10 +244,10 @@ struct BuildDocksToolbarWindow : Window {
|
||||
GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
|
||||
break;
|
||||
case DDSP_CREATE_WATER:
|
||||
DoCommandP(end_tile, start_tile, (_game_mode == GM_EDITOR && _ctrl_pressed) ? WATER_CLASS_SEA : WATER_CLASS_CANAL, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_BUILD_CANALS), CcPlaySound_SPLAT_WATER);
|
||||
DoCommandP(end_tile, start_tile, (_game_mode == GM_EDITOR && _ctrl_pressed) ? WATER_CLASS_SEA : WATER_CLASS_CANAL, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_BUILD_CANALS), CcPlaySound_CONSTRUCTION_WATER);
|
||||
break;
|
||||
case DDSP_CREATE_RIVER:
|
||||
DoCommandP(end_tile, start_tile, WATER_CLASS_RIVER, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_PLACE_RIVERS), CcPlaySound_SPLAT_WATER);
|
||||
DoCommandP(end_tile, start_tile, WATER_CLASS_RIVER, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_PLACE_RIVERS), CcPlaySound_CONSTRUCTION_WATER);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "debug.h"
|
||||
#include "error.h"
|
||||
#include "sound/sound_driver.hpp"
|
||||
#include "music/music_driver.hpp"
|
||||
#include "video/video_driver.hpp"
|
||||
#include "string_func.h"
|
||||
#include "table/strings.h"
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
@@ -111,6 +113,8 @@ bool DriverFactoryBase::SelectDriverImpl(const std::string &name, Driver::Type t
|
||||
if (d->type != type) continue;
|
||||
if (d->priority != priority) continue;
|
||||
|
||||
if (type == Driver::DT_VIDEO && !_video_hw_accel && d->UsesHardwareAcceleration()) continue;
|
||||
|
||||
Driver *oldd = *GetActiveDriver(type);
|
||||
Driver *newd = d->CreateInstance();
|
||||
*GetActiveDriver(type) = newd;
|
||||
@@ -125,6 +129,12 @@ bool DriverFactoryBase::SelectDriverImpl(const std::string &name, Driver::Type t
|
||||
*GetActiveDriver(type) = oldd;
|
||||
DEBUG(driver, 1, "Probing %s driver '%s' failed with error: %s", GetDriverTypeName(type), d->name, err);
|
||||
delete newd;
|
||||
|
||||
if (type == Driver::DT_VIDEO && _video_hw_accel && d->UsesHardwareAcceleration()) {
|
||||
_video_hw_accel = false;
|
||||
ErrorMessageData msg(STR_VIDEO_DRIVER_ERROR, STR_VIDEO_DRIVER_ERROR_NO_HARDWARE_ACCELERATION);
|
||||
ScheduleErrorMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
usererror("Couldn't find any suitable %s driver", GetDriverTypeName(type));
|
||||
|
||||
@@ -107,6 +107,15 @@ protected:
|
||||
|
||||
virtual ~DriverFactoryBase();
|
||||
|
||||
/**
|
||||
* Does the driver use hardware acceleration (video-drivers only).
|
||||
* @return True if the driver uses hardware acceleration.
|
||||
*/
|
||||
virtual bool UsesHardwareAcceleration() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Shuts down all active drivers
|
||||
|
||||
@@ -289,7 +289,7 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
|
||||
if (_networking) NetworkClientsToSpectators(old_owner);
|
||||
if (old_owner == _local_company) {
|
||||
/* Single player cheated to AI company.
|
||||
* There are no spectators in single player, so we must pick some other company. */
|
||||
* There are no spectators in singleplayer mode, so we must pick some other company. */
|
||||
assert(!_networking);
|
||||
Backup<CompanyID> cur_company2(_current_company, FILE_LINE);
|
||||
for (const Company *c : Company::Iterate()) {
|
||||
@@ -605,7 +605,7 @@ static void CompanyCheckBankrupt(Company *c)
|
||||
default:
|
||||
case 10: {
|
||||
if (!_networking && _local_company == c->index) {
|
||||
/* If we are in offline mode, leave the company playing. Eg. there
|
||||
/* If we are in singleplayer mode, leave the company playing. Eg. there
|
||||
* is no THE-END, otherwise mark the client as spectator to make sure
|
||||
* he/she is no long in control of this company. However... when you
|
||||
* join another company (cheat) the "unowned" company can bankrupt. */
|
||||
@@ -2114,7 +2114,7 @@ CommandCost CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
/* Disable takeovers when not asked */
|
||||
if (!HasBit(c->bankrupt_asked, _current_company)) return CMD_ERROR;
|
||||
|
||||
/* Disable taking over the local company in single player */
|
||||
/* Disable taking over the local company in singleplayer mode */
|
||||
if (!_networking && _local_company == c->index) return CMD_ERROR;
|
||||
|
||||
/* Do not allow companies to take over themselves */
|
||||
|
||||
@@ -499,7 +499,7 @@ static bool BubbleTick(EffectVehicle *v)
|
||||
if (b->y == 4 && b->x == 1) {
|
||||
if (v->z_pos > 180 || Chance16I(1, 96, Random())) {
|
||||
v->spritenum = 5;
|
||||
if (_settings_client.sound.ambient) SndPlayVehicleFx(SND_2F_POP, v);
|
||||
if (_settings_client.sound.ambient) SndPlayVehicleFx(SND_2F_BUBBLE_GENERATOR_FAIL, v);
|
||||
}
|
||||
anim_state = 0;
|
||||
}
|
||||
@@ -508,7 +508,7 @@ static bool BubbleTick(EffectVehicle *v)
|
||||
TileIndex tile;
|
||||
|
||||
anim_state++;
|
||||
if (_settings_client.sound.ambient) SndPlayVehicleFx(SND_31_EXTRACT, v);
|
||||
if (_settings_client.sound.ambient) SndPlayVehicleFx(SND_31_BUBBLE_GENERATOR_SUCCESS, v);
|
||||
|
||||
tile = TileVirtXY(v->x_pos, v->y_pos);
|
||||
if (IsTileType(tile, MP_INDUSTRY) && GetIndustryGfx(tile) == GFX_BUBBLE_CATCHER) AddAnimatedTile(tile);
|
||||
|
||||
@@ -124,6 +124,9 @@ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override)
|
||||
*/
|
||||
static TrackBits MaskWireBits(TileIndex t, TrackBits tracks)
|
||||
{
|
||||
/* Single track bits are never masked out. */
|
||||
if (likely(HasAtMostOneBit(tracks))) return tracks;
|
||||
|
||||
if (!IsPlainRailTile(t)) return tracks;
|
||||
|
||||
TrackdirBits neighbour_tdb = TRACKDIR_BIT_NONE;
|
||||
|
||||
@@ -396,6 +396,7 @@ void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel
|
||||
|
||||
bool no_timeout = wl == WL_CRITICAL;
|
||||
|
||||
if (_game_mode == GM_BOOTSTRAP) return;
|
||||
if (_settings_client.gui.errmsg_duration == 0 && !no_timeout) return;
|
||||
|
||||
ErrorMessageData data(summary_msg, detailed_msg, no_timeout ? 0 : _settings_client.gui.errmsg_duration, x, y, textref_stack_grffile, textref_stack_size, textref_stack);
|
||||
|
||||
@@ -340,7 +340,7 @@ std::string FioFindDirectory(Subdirectory subdir)
|
||||
|
||||
static FILE *FioFOpenFileSp(const std::string &filename, const char *mode, Searchpath sp, Subdirectory subdir, size_t *filesize)
|
||||
{
|
||||
#if defined(_WIN32) && defined(UNICODE)
|
||||
#if defined(_WIN32)
|
||||
/* fopen is implemented as a define with ellipses for
|
||||
* Unicode support (prepend an L). As we are not sending
|
||||
* a string, but a variable, it 'renames' the variable,
|
||||
|
||||
@@ -107,14 +107,14 @@ DECLARE_ENUM_AS_BIT_SET(TarScanner::Mode)
|
||||
struct DIR;
|
||||
|
||||
struct dirent { // XXX - only d_name implemented
|
||||
TCHAR *d_name; // name of found file
|
||||
wchar_t *d_name; // name of found file
|
||||
/* little hack which will point to parent DIR struct which will
|
||||
* save us a call to GetFileAttributes if we want information
|
||||
* about the file (for example in function fio_bla) */
|
||||
DIR *dir;
|
||||
};
|
||||
|
||||
DIR *opendir(const TCHAR *path);
|
||||
DIR *opendir(const wchar_t *path);
|
||||
struct dirent *readdir(DIR *d);
|
||||
int closedir(DIR *d);
|
||||
#else
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "network/network_content.h"
|
||||
#include "screenshot.h"
|
||||
#include "string_func.h"
|
||||
#include "strings_func.h"
|
||||
#include "tar_type.h"
|
||||
#include <sys/stat.h>
|
||||
#include <functional>
|
||||
@@ -376,7 +377,8 @@ static void FiosGetFileList(SaveLoadOperation fop, fios_getlist_callback_proc *c
|
||||
fios->type = FIOS_TYPE_PARENT;
|
||||
fios->mtime = 0;
|
||||
strecpy(fios->name, "..", lastof(fios->name));
|
||||
strecpy(fios->title, ".. (Parent directory)", lastof(fios->title));
|
||||
SetDParamStr(0, "..");
|
||||
GetString(fios->title, STR_SAVELOAD_PARENT_DIRECTORY, lastof(fios->title));
|
||||
}
|
||||
|
||||
/* Show subdirectories */
|
||||
@@ -392,7 +394,9 @@ static void FiosGetFileList(SaveLoadOperation fop, fios_getlist_callback_proc *c
|
||||
fios->type = FIOS_TYPE_DIR;
|
||||
fios->mtime = 0;
|
||||
strecpy(fios->name, d_name, lastof(fios->name));
|
||||
seprintf(fios->title, lastof(fios->title), "%s" PATHSEP " (Directory)", d_name);
|
||||
std::string dirname = std::string(d_name) + PATHSEP;
|
||||
SetDParamStr(0, dirname.c_str());
|
||||
GetString(fios->title, STR_SAVELOAD_DIRECTORY, lastof(fios->title));
|
||||
str_validate(fios->title, lastof(fios->title));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "fontcache.h"
|
||||
#include "fontcache_internal.h"
|
||||
#include "fontdetection.h"
|
||||
#include "blitter/factory.hpp"
|
||||
#include "core/math_func.hpp"
|
||||
@@ -31,6 +32,8 @@ static const int ASCII_LETTERSTART = 32; ///< First printable ASCII letter.
|
||||
static const int _default_font_height[FS_END] = {10, 6, 18, 10};
|
||||
static const int _default_font_ascender[FS_END] = { 8, 5, 15, 8};
|
||||
|
||||
FreeTypeSettings _freetype;
|
||||
|
||||
/**
|
||||
* Create a new font cache.
|
||||
* @param fs The size of the font.
|
||||
@@ -52,6 +55,11 @@ FontCache::~FontCache()
|
||||
Layouter::ResetFontCache(this->fs);
|
||||
}
|
||||
|
||||
int FontCache::GetDefaultFontHeight(FontSize fs)
|
||||
{
|
||||
return _default_font_height[fs];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get height of a character for a given font size.
|
||||
@@ -197,66 +205,6 @@ bool SpriteFontCache::GetDrawGlyphShadow()
|
||||
|
||||
/* static */ FontCache *FontCache::caches[FS_END] = { new SpriteFontCache(FS_NORMAL), new SpriteFontCache(FS_SMALL), new SpriteFontCache(FS_LARGE), new SpriteFontCache(FS_MONO) };
|
||||
|
||||
#if defined(WITH_FREETYPE) || defined(_WIN32)
|
||||
|
||||
FreeTypeSettings _freetype;
|
||||
|
||||
static const int MAX_FONT_SIZE = 72; ///< Maximum font size.
|
||||
|
||||
static const byte FACE_COLOUR = 1;
|
||||
static const byte SHADOW_COLOUR = 2;
|
||||
|
||||
/** Font cache for fonts that are based on a TrueType font. */
|
||||
class TrueTypeFontCache : public FontCache {
|
||||
protected:
|
||||
int req_size; ///< Requested font size.
|
||||
int used_size; ///< Used font size.
|
||||
|
||||
typedef SmallMap<uint32, std::pair<size_t, const void*> > FontTable; ///< Table with font table cache
|
||||
FontTable font_tables; ///< Cached font tables.
|
||||
|
||||
/** Container for information about a glyph. */
|
||||
struct GlyphEntry {
|
||||
Sprite *sprite; ///< The loaded sprite.
|
||||
byte width; ///< The width of the glyph.
|
||||
bool duplicate; ///< Whether this glyph entry is a duplicate, i.e. may this be freed?
|
||||
};
|
||||
|
||||
/**
|
||||
* The glyph cache. This is structured to reduce memory consumption.
|
||||
* 1) There is a 'segment' table for each font size.
|
||||
* 2) Each segment table is a discrete block of characters.
|
||||
* 3) Each block contains 256 (aligned) characters sequential characters.
|
||||
*
|
||||
* The cache is accessed in the following way:
|
||||
* For character 0x0041 ('A'): glyph_to_sprite[0x00][0x41]
|
||||
* For character 0x20AC (Euro): glyph_to_sprite[0x20][0xAC]
|
||||
*
|
||||
* Currently only 256 segments are allocated, "limiting" us to 65536 characters.
|
||||
* This can be simply changed in the two functions Get & SetGlyphPtr.
|
||||
*/
|
||||
GlyphEntry **glyph_to_sprite;
|
||||
|
||||
GlyphEntry *GetGlyphPtr(GlyphID key);
|
||||
void SetGlyphPtr(GlyphID key, const GlyphEntry *glyph, bool duplicate = false);
|
||||
|
||||
virtual const void *InternalGetFontTable(uint32 tag, size_t &length) = 0;
|
||||
virtual const Sprite *InternalGetGlyph(GlyphID key, bool aa) = 0;
|
||||
|
||||
public:
|
||||
TrueTypeFontCache(FontSize fs, int pixels);
|
||||
virtual ~TrueTypeFontCache();
|
||||
virtual int GetFontSize() const { return this->used_size; }
|
||||
virtual SpriteID GetUnicodeGlyph(WChar key) { return this->parent->GetUnicodeGlyph(key); }
|
||||
virtual void SetUnicodeGlyph(WChar key, SpriteID sprite) { this->parent->SetUnicodeGlyph(key, sprite); }
|
||||
virtual void InitializeUnicodeGlyphMap() { this->parent->InitializeUnicodeGlyphMap(); }
|
||||
virtual const Sprite *GetGlyph(GlyphID key);
|
||||
virtual const void *GetFontTable(uint32 tag, size_t &length);
|
||||
virtual void ClearFontCache();
|
||||
virtual uint GetGlyphWidth(GlyphID key);
|
||||
virtual bool GetDrawGlyphShadow();
|
||||
virtual bool IsBuiltInFont() { return false; }
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a new TrueTypeFontCache.
|
||||
@@ -329,17 +277,12 @@ void TrueTypeFontCache::SetGlyphPtr(GlyphID key, const GlyphEntry *glyph, bool d
|
||||
this->glyph_to_sprite[GB(key, 8, 8)][GB(key, 0, 8)].duplicate = duplicate;
|
||||
}
|
||||
|
||||
static void *AllocateFont(size_t size)
|
||||
{
|
||||
return MallocT<byte>(size);
|
||||
}
|
||||
|
||||
|
||||
/* Check if a glyph should be rendered with anti-aliasing. */
|
||||
static bool GetFontAAState(FontSize size)
|
||||
static bool GetFontAAState(FontSize size, bool check_blitter = true)
|
||||
{
|
||||
/* AA is only supported for 32 bpp */
|
||||
if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() != 32) return false;
|
||||
if (check_blitter && BlitterFactory::GetCurrentBlitter()->GetScreenDepth() != 32) return false;
|
||||
|
||||
switch (size) {
|
||||
default: NOT_REACHED();
|
||||
@@ -403,10 +346,11 @@ const Sprite *TrueTypeFontCache::GetGlyph(GlyphID key)
|
||||
0, // x_offs
|
||||
0, // y_offs
|
||||
ST_FONT,
|
||||
SCC_PAL,
|
||||
builtin_questionmark_data
|
||||
};
|
||||
|
||||
Sprite *spr = BlitterFactory::GetCurrentBlitter()->Encode(&builtin_questionmark, AllocateFont);
|
||||
Sprite *spr = BlitterFactory::GetCurrentBlitter()->Encode(&builtin_questionmark, SimpleSpriteAlloc);
|
||||
assert(spr != nullptr);
|
||||
GlyphEntry new_glyph;
|
||||
new_glyph.sprite = spr;
|
||||
@@ -492,7 +436,7 @@ void FreeTypeFontCache::SetFontSize(FontSize fs, FT_Face face, int pixels)
|
||||
/* Font height is minimum height plus the difference between the default
|
||||
* height for this font size and the small size. */
|
||||
int diff = scaled_height - ScaleFontTrad(_default_font_height[FS_SMALL]);
|
||||
pixels = Clamp(std::min<uint>(head->Lowest_Rec_PPEM, 20u) + diff, scaled_height, MAX_FONT_SIZE);
|
||||
pixels = Clamp(std::min<uint>(head->Lowest_Rec_PPEM, MAX_FONT_MIN_REC_SIZE) + diff, scaled_height, MAX_FONT_SIZE);
|
||||
}
|
||||
} else {
|
||||
pixels = ScaleFontTrad(pixels);
|
||||
@@ -660,12 +604,13 @@ const Sprite *FreeTypeFontCache::InternalGetGlyph(GlyphID key, bool aa)
|
||||
uint height = std::max(1U, (uint)slot->bitmap.rows + (this->fs == FS_NORMAL));
|
||||
|
||||
/* Limit glyph size to prevent overflows later on. */
|
||||
if (width > 256 || height > 256) usererror("Font glyph is too large");
|
||||
if (width > MAX_GLYPH_DIM || height > MAX_GLYPH_DIM) usererror("Font glyph is too large");
|
||||
|
||||
/* FreeType has rendered the glyph, now we allocate a sprite and copy the image into it */
|
||||
SpriteLoader::Sprite sprite;
|
||||
sprite.AllocateData(ZOOM_LVL_NORMAL, width * height);
|
||||
sprite.type = ST_FONT;
|
||||
sprite.colours = (aa ? SCC_PAL | SCC_ALPHA : SCC_PAL);
|
||||
sprite.width = width;
|
||||
sprite.height = height;
|
||||
sprite.x_offs = slot->bitmap_left;
|
||||
@@ -693,7 +638,7 @@ const Sprite *FreeTypeFontCache::InternalGetGlyph(GlyphID key, bool aa)
|
||||
}
|
||||
|
||||
GlyphEntry new_glyph;
|
||||
new_glyph.sprite = BlitterFactory::GetCurrentBlitter()->Encode(&sprite, AllocateFont);
|
||||
new_glyph.sprite = BlitterFactory::GetCurrentBlitter()->Encode(&sprite, SimpleSpriteAlloc);
|
||||
new_glyph.width = slot->advance.x >> 6;
|
||||
|
||||
this->SetGlyphPtr(key, &new_glyph);
|
||||
@@ -728,337 +673,8 @@ const void *FreeTypeFontCache::InternalGetFontTable(uint32 tag, size_t &length)
|
||||
length = len;
|
||||
return result;
|
||||
}
|
||||
|
||||
#elif defined(_WIN32)
|
||||
|
||||
#include "os/windows/win32.h"
|
||||
#ifndef ANTIALIASED_QUALITY
|
||||
#define ANTIALIASED_QUALITY 4
|
||||
#endif
|
||||
|
||||
/** Font cache for fonts that are based on a Win32 font. */
|
||||
class Win32FontCache : public TrueTypeFontCache {
|
||||
private:
|
||||
LOGFONT logfont; ///< Logical font information for selecting the font face.
|
||||
HFONT font = nullptr; ///< The font face associated with this font.
|
||||
HDC dc = nullptr; ///< Cached GDI device context.
|
||||
HGDIOBJ old_font; ///< Old font selected into the GDI context.
|
||||
SIZE glyph_size; ///< Maximum size of regular glyphs.
|
||||
|
||||
void SetFontSize(FontSize fs, int pixels);
|
||||
virtual const void *InternalGetFontTable(uint32 tag, size_t &length);
|
||||
virtual const Sprite *InternalGetGlyph(GlyphID key, bool aa);
|
||||
|
||||
public:
|
||||
Win32FontCache(FontSize fs, const LOGFONT &logfont, int pixels);
|
||||
~Win32FontCache();
|
||||
virtual void ClearFontCache();
|
||||
virtual GlyphID MapCharToGlyph(WChar key);
|
||||
virtual const char *GetFontName() { return WIDE_TO_MB(this->logfont.lfFaceName); }
|
||||
virtual bool IsBuiltInFont() { return false; }
|
||||
virtual void *GetOSHandle() { return &this->logfont; }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Create a new Win32FontCache.
|
||||
* @param fs The font size that is going to be cached.
|
||||
* @param logfont The font that has to be loaded.
|
||||
* @param pixels The number of pixels this font should be high.
|
||||
*/
|
||||
Win32FontCache::Win32FontCache(FontSize fs, const LOGFONT &logfont, int pixels) : TrueTypeFontCache(fs, pixels), logfont(logfont)
|
||||
{
|
||||
this->dc = CreateCompatibleDC(nullptr);
|
||||
this->SetFontSize(fs, pixels);
|
||||
}
|
||||
|
||||
Win32FontCache::~Win32FontCache()
|
||||
{
|
||||
this->ClearFontCache();
|
||||
DeleteDC(this->dc);
|
||||
DeleteObject(this->font);
|
||||
}
|
||||
|
||||
void Win32FontCache::SetFontSize(FontSize fs, int pixels)
|
||||
{
|
||||
if (pixels == 0) {
|
||||
/* Try to determine a good height based on the minimal height recommended by the font. */
|
||||
int scaled_height = ScaleFontTrad(_default_font_height[this->fs]);
|
||||
pixels = scaled_height;
|
||||
|
||||
HFONT temp = CreateFontIndirect(&this->logfont);
|
||||
if (temp != nullptr) {
|
||||
HGDIOBJ old = SelectObject(this->dc, temp);
|
||||
|
||||
UINT size = GetOutlineTextMetrics(this->dc, 0, nullptr);
|
||||
LPOUTLINETEXTMETRIC otm = (LPOUTLINETEXTMETRIC)AllocaM(BYTE, size);
|
||||
GetOutlineTextMetrics(this->dc, size, otm);
|
||||
|
||||
/* Font height is minimum height plus the difference between the default
|
||||
* height for this font size and the small size. */
|
||||
int diff = scaled_height - ScaleFontTrad(_default_font_height[FS_SMALL]);
|
||||
pixels = Clamp(std::min(otm->otmusMinimumPPEM, 20u) + diff, scaled_height, MAX_FONT_SIZE);
|
||||
|
||||
SelectObject(dc, old);
|
||||
DeleteObject(temp);
|
||||
}
|
||||
} else {
|
||||
pixels = ScaleFontTrad(pixels);
|
||||
}
|
||||
this->used_size = pixels;
|
||||
|
||||
/* Create GDI font handle. */
|
||||
this->logfont.lfHeight = -pixels;
|
||||
this->logfont.lfWidth = 0;
|
||||
this->logfont.lfOutPrecision = ANTIALIASED_QUALITY;
|
||||
|
||||
if (this->font != nullptr) {
|
||||
SelectObject(dc, this->old_font);
|
||||
DeleteObject(this->font);
|
||||
}
|
||||
this->font = CreateFontIndirect(&this->logfont);
|
||||
this->old_font = SelectObject(this->dc, this->font);
|
||||
|
||||
/* Query the font metrics we needed. */
|
||||
UINT otmSize = GetOutlineTextMetrics(this->dc, 0, nullptr);
|
||||
POUTLINETEXTMETRIC otm = (POUTLINETEXTMETRIC)AllocaM(BYTE, otmSize);
|
||||
GetOutlineTextMetrics(this->dc, otmSize, otm);
|
||||
|
||||
this->units_per_em = otm->otmEMSquare;
|
||||
this->ascender = otm->otmTextMetrics.tmAscent;
|
||||
this->descender = otm->otmTextMetrics.tmDescent;
|
||||
this->height = this->ascender + this->descender;
|
||||
this->glyph_size.cx = otm->otmTextMetrics.tmMaxCharWidth;
|
||||
this->glyph_size.cy = otm->otmTextMetrics.tmHeight;
|
||||
|
||||
DEBUG(freetype, 2, "Loaded font '%s' with size %d", FS2OTTD((LPTSTR)((BYTE *)otm + (ptrdiff_t)otm->otmpFullName)), pixels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset cached glyphs.
|
||||
*/
|
||||
void Win32FontCache::ClearFontCache()
|
||||
{
|
||||
/* GUI scaling might have changed, determine font size anew if it was automatically selected. */
|
||||
if (this->font != nullptr) this->SetFontSize(this->fs, this->req_size);
|
||||
|
||||
this->TrueTypeFontCache::ClearFontCache();
|
||||
}
|
||||
|
||||
/* virtual */ const Sprite *Win32FontCache::InternalGetGlyph(GlyphID key, bool aa)
|
||||
{
|
||||
GLYPHMETRICS gm;
|
||||
MAT2 mat = { {0, 1}, {0, 0}, {0, 0}, {0, 1} };
|
||||
|
||||
/* Make a guess for the needed memory size. */
|
||||
DWORD size = this->glyph_size.cy * Align(aa ? this->glyph_size.cx : std::max(this->glyph_size.cx / 8l, 1l), 4); // Bitmap data is DWORD-aligned rows.
|
||||
byte *bmp = AllocaM(byte, size);
|
||||
size = GetGlyphOutline(this->dc, key, GGO_GLYPH_INDEX | (aa ? GGO_GRAY8_BITMAP : GGO_BITMAP), &gm, size, bmp, &mat);
|
||||
|
||||
if (size == GDI_ERROR) {
|
||||
/* No dice with the guess. First query size of needed glyph memory, then allocate the
|
||||
* memory and query again. This dance is necessary as some glyphs will only render with
|
||||
* the exact matching size; e.g. the space glyph has no pixels and must be requested
|
||||
* with size == 0, anything else fails. Unfortunately, a failed call doesn't return any
|
||||
* info about the size and thus the triple GetGlyphOutline()-call. */
|
||||
size = GetGlyphOutline(this->dc, key, GGO_GLYPH_INDEX | (aa ? GGO_GRAY8_BITMAP : GGO_BITMAP), &gm, 0, nullptr, &mat);
|
||||
if (size == GDI_ERROR) usererror("Unable to render font glyph");
|
||||
bmp = AllocaM(byte, size);
|
||||
GetGlyphOutline(this->dc, key, GGO_GLYPH_INDEX | (aa ? GGO_GRAY8_BITMAP : GGO_BITMAP), &gm, size, bmp, &mat);
|
||||
}
|
||||
|
||||
/* Add 1 pixel for the shadow on the medium font. Our sprite must be at least 1x1 pixel. */
|
||||
uint width = std::max(1U, (uint)gm.gmBlackBoxX + (this->fs == FS_NORMAL));
|
||||
uint height = std::max(1U, (uint)gm.gmBlackBoxY + (this->fs == FS_NORMAL));
|
||||
|
||||
/* Limit glyph size to prevent overflows later on. */
|
||||
if (width > 256 || height > 256) usererror("Font glyph is too large");
|
||||
|
||||
/* GDI has rendered the glyph, now we allocate a sprite and copy the image into it. */
|
||||
SpriteLoader::Sprite sprite;
|
||||
sprite.AllocateData(ZOOM_LVL_NORMAL, width * height);
|
||||
sprite.type = ST_FONT;
|
||||
sprite.width = width;
|
||||
sprite.height = height;
|
||||
sprite.x_offs = gm.gmptGlyphOrigin.x;
|
||||
sprite.y_offs = this->ascender - gm.gmptGlyphOrigin.y;
|
||||
|
||||
if (size > 0) {
|
||||
/* All pixel data returned by GDI is in the form of DWORD-aligned rows.
|
||||
* For a non anti-aliased glyph, the returned bitmap has one bit per pixel.
|
||||
* For anti-aliased rendering, GDI uses the strange value range of 0 to 64,
|
||||
* inclusively. To map this to 0 to 255, we shift left by two and then
|
||||
* subtract one. */
|
||||
uint pitch = Align(aa ? gm.gmBlackBoxX : std::max(gm.gmBlackBoxX / 8u, 1u), 4);
|
||||
|
||||
/* Draw shadow for medium size. */
|
||||
if (this->fs == FS_NORMAL && !aa) {
|
||||
for (uint y = 0; y < gm.gmBlackBoxY; y++) {
|
||||
for (uint x = 0; x < gm.gmBlackBoxX; x++) {
|
||||
if (aa ? (bmp[x + y * pitch] > 0) : HasBit(bmp[(x / 8) + y * pitch], 7 - (x % 8))) {
|
||||
sprite.data[1 + x + (1 + y) * sprite.width].m = SHADOW_COLOUR;
|
||||
sprite.data[1 + x + (1 + y) * sprite.width].a = aa ? (bmp[x + y * pitch] << 2) - 1 : 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (uint y = 0; y < gm.gmBlackBoxY; y++) {
|
||||
for (uint x = 0; x < gm.gmBlackBoxX; x++) {
|
||||
if (aa ? (bmp[x + y * pitch] > 0) : HasBit(bmp[(x / 8) + y * pitch], 7 - (x % 8))) {
|
||||
sprite.data[x + y * sprite.width].m = FACE_COLOUR;
|
||||
sprite.data[x + y * sprite.width].a = aa ? (bmp[x + y * pitch] << 2) - 1 : 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlyphEntry new_glyph;
|
||||
new_glyph.sprite = BlitterFactory::GetCurrentBlitter()->Encode(&sprite, AllocateFont);
|
||||
new_glyph.width = gm.gmCellIncX;
|
||||
|
||||
this->SetGlyphPtr(key, &new_glyph);
|
||||
|
||||
return new_glyph.sprite;
|
||||
}
|
||||
|
||||
/* virtual */ GlyphID Win32FontCache::MapCharToGlyph(WChar key)
|
||||
{
|
||||
assert(IsPrintable(key));
|
||||
|
||||
if (key >= SCC_SPRITE_START && key <= SCC_SPRITE_END) {
|
||||
return this->parent->MapCharToGlyph(key);
|
||||
}
|
||||
|
||||
/* Convert characters outside of the BMP into surrogate pairs. */
|
||||
WCHAR chars[2];
|
||||
if (key >= 0x010000U) {
|
||||
chars[0] = (WCHAR)(((key - 0x010000U) >> 10) + 0xD800);
|
||||
chars[1] = (WCHAR)(((key - 0x010000U) & 0x3FF) + 0xDC00);
|
||||
} else {
|
||||
chars[0] = (WCHAR)(key & 0xFFFF);
|
||||
}
|
||||
|
||||
WORD glyphs[2] = {0, 0};
|
||||
GetGlyphIndicesW(this->dc, chars, key >= 0x010000U ? 2 : 1, glyphs, GGI_MARK_NONEXISTING_GLYPHS);
|
||||
|
||||
return glyphs[0] != 0xFFFF ? glyphs[0] : 0;
|
||||
}
|
||||
|
||||
/* virtual */ const void *Win32FontCache::InternalGetFontTable(uint32 tag, size_t &length)
|
||||
{
|
||||
DWORD len = GetFontData(this->dc, tag, 0, nullptr, 0);
|
||||
|
||||
void *result = nullptr;
|
||||
if (len != GDI_ERROR && len > 0) {
|
||||
result = MallocT<BYTE>(len);
|
||||
GetFontData(this->dc, tag, 0, result, len);
|
||||
}
|
||||
|
||||
length = len;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the GDI font.
|
||||
* If a GDI font description is present, e.g. from the automatic font
|
||||
* fallback search, use it. Otherwise, try to resolve it by font name.
|
||||
* @param fs The font size to load.
|
||||
*/
|
||||
static void LoadWin32Font(FontSize fs)
|
||||
{
|
||||
static const char *SIZE_TO_NAME[] = { "medium", "small", "large", "mono" };
|
||||
|
||||
FreeTypeSubSetting *settings = nullptr;
|
||||
switch (fs) {
|
||||
default: NOT_REACHED();
|
||||
case FS_SMALL: settings = &_freetype.small; break;
|
||||
case FS_NORMAL: settings = &_freetype.medium; break;
|
||||
case FS_LARGE: settings = &_freetype.large; break;
|
||||
case FS_MONO: settings = &_freetype.mono; break;
|
||||
}
|
||||
|
||||
if (StrEmpty(settings->font)) return;
|
||||
|
||||
LOGFONT logfont;
|
||||
MemSetT(&logfont, 0);
|
||||
logfont.lfPitchAndFamily = fs == FS_MONO ? FIXED_PITCH : VARIABLE_PITCH;
|
||||
logfont.lfCharSet = DEFAULT_CHARSET;
|
||||
logfont.lfOutPrecision = OUT_OUTLINE_PRECIS;
|
||||
logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||
|
||||
if (settings->os_handle != nullptr) {
|
||||
logfont = *(const LOGFONT *)settings->os_handle;
|
||||
} else if (strchr(settings->font, '.') != nullptr) {
|
||||
/* Might be a font file name, try load it. */
|
||||
|
||||
TCHAR fontPath[MAX_PATH] = {};
|
||||
|
||||
/* See if this is an absolute path. */
|
||||
if (FileExists(settings->font)) {
|
||||
convert_to_fs(settings->font, fontPath, lengthof(fontPath), false);
|
||||
} else {
|
||||
/* Scan the search-paths to see if it can be found. */
|
||||
std::string full_font = FioFindFullPath(BASE_DIR, settings->font);
|
||||
if (!full_font.empty()) {
|
||||
convert_to_fs(full_font.c_str(), fontPath, lengthof(fontPath), false);
|
||||
}
|
||||
}
|
||||
|
||||
if (fontPath[0] != 0) {
|
||||
if (AddFontResourceEx(fontPath, FR_PRIVATE, 0) != 0) {
|
||||
/* Try a nice little undocumented function first for getting the internal font name.
|
||||
* Some documentation is found at: http://www.undocprint.org/winspool/getfontresourceinfo */
|
||||
typedef BOOL(WINAPI * PFNGETFONTRESOURCEINFO)(LPCTSTR, LPDWORD, LPVOID, DWORD);
|
||||
#ifdef UNICODE
|
||||
static PFNGETFONTRESOURCEINFO GetFontResourceInfo = (PFNGETFONTRESOURCEINFO)GetProcAddress(GetModuleHandle(_T("Gdi32")), "GetFontResourceInfoW");
|
||||
#else
|
||||
static PFNGETFONTRESOURCEINFO GetFontResourceInfo = (PFNGETFONTRESOURCEINFO)GetProcAddress(GetModuleHandle(_T("Gdi32")), "GetFontResourceInfoA");
|
||||
#endif
|
||||
|
||||
if (GetFontResourceInfo != nullptr) {
|
||||
/* Try to query an array of LOGFONTs that describe the file. */
|
||||
DWORD len = 0;
|
||||
if (GetFontResourceInfo(fontPath, &len, nullptr, 2) && len >= sizeof(LOGFONT)) {
|
||||
LOGFONT *buf = (LOGFONT *)AllocaM(byte, len);
|
||||
if (GetFontResourceInfo(fontPath, &len, buf, 2)) {
|
||||
logfont = *buf; // Just use first entry.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* No dice yet. Use the file name as the font face name, hoping it matches. */
|
||||
if (logfont.lfFaceName[0] == 0) {
|
||||
TCHAR fname[_MAX_FNAME];
|
||||
_tsplitpath(fontPath, nullptr, nullptr, fname, nullptr);
|
||||
|
||||
_tcsncpy_s(logfont.lfFaceName, lengthof(logfont.lfFaceName), fname, _TRUNCATE);
|
||||
logfont.lfWeight = strcasestr(settings->font, " bold") != nullptr || strcasestr(settings->font, "-bold") != nullptr ? FW_BOLD : FW_NORMAL; // Poor man's way to allow selecting bold fonts.
|
||||
}
|
||||
} else {
|
||||
ShowInfoF("Unable to load file '%s' for %s font, using default windows font selection instead", settings->font, SIZE_TO_NAME[fs]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (logfont.lfFaceName[0] == 0) {
|
||||
logfont.lfWeight = strcasestr(settings->font, " bold") != nullptr ? FW_BOLD : FW_NORMAL; // Poor man's way to allow selecting bold fonts.
|
||||
convert_to_fs(settings->font, logfont.lfFaceName, lengthof(logfont.lfFaceName), false);
|
||||
}
|
||||
|
||||
HFONT font = CreateFontIndirect(&logfont);
|
||||
if (font == nullptr) {
|
||||
ShowInfoF("Unable to use '%s' for %s font, Win32 reported error 0x%lX, using sprite font instead", settings->font, SIZE_TO_NAME[fs], GetLastError());
|
||||
return;
|
||||
}
|
||||
DeleteObject(font);
|
||||
|
||||
new Win32FontCache(fs, logfont, settings->size);
|
||||
}
|
||||
|
||||
#endif /* WITH_FREETYPE */
|
||||
|
||||
#endif /* defined(WITH_FREETYPE) || defined(_WIN32) */
|
||||
|
||||
/**
|
||||
* (Re)initialize the freetype related things, i.e. load the non-sprite fonts.
|
||||
@@ -1075,7 +691,11 @@ void InitFreeType(bool monospace)
|
||||
#ifdef WITH_FREETYPE
|
||||
LoadFreeTypeFont(fs);
|
||||
#elif defined(_WIN32)
|
||||
extern void LoadWin32Font(FontSize fs);
|
||||
LoadWin32Font(fs);
|
||||
#elif defined(WITH_COCOA)
|
||||
extern void LoadCoreTextFont(FontSize fs);
|
||||
LoadCoreTextFont(fs);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1095,3 +715,25 @@ void UninitFreeType()
|
||||
_library = nullptr;
|
||||
#endif /* WITH_FREETYPE */
|
||||
}
|
||||
|
||||
/**
|
||||
* Should any of the active fonts be anti-aliased?
|
||||
* @return True if any of the loaded fonts want anti-aliased drawing.
|
||||
*/
|
||||
bool HasAntialiasedFonts()
|
||||
{
|
||||
for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) {
|
||||
if (!FontCache::Get(fs)->IsBuiltInFont() && GetFontAAState(fs, false)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG) && !defined(WITH_COCOA)
|
||||
|
||||
#ifdef WITH_FREETYPE
|
||||
FT_Error GetFontByFaceName(const char *font_name, FT_Face *face) { return FT_Err_Cannot_Open_Resource; }
|
||||
#endif /* WITH_FREETYPE */
|
||||
|
||||
bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback) { return false; }
|
||||
#endif /* !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG) && !defined(WITH_COCOA) */
|
||||
|
||||
@@ -28,6 +28,9 @@ protected:
|
||||
int ascender; ///< The ascender value of the font.
|
||||
int descender; ///< The descender value of the font.
|
||||
int units_per_em; ///< The units per EM value of the font.
|
||||
|
||||
static int GetDefaultFontHeight(FontSize fs);
|
||||
|
||||
public:
|
||||
FontCache(FontSize fs);
|
||||
virtual ~FontCache();
|
||||
@@ -127,7 +130,7 @@ public:
|
||||
* Get the native OS font handle, if there is one.
|
||||
* @return Opaque OS font handle.
|
||||
*/
|
||||
virtual void *GetOSHandle()
|
||||
virtual const void *GetOSHandle()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -209,15 +212,13 @@ static inline bool GetDrawGlyphShadow(FontSize size)
|
||||
return FontCache::Get(size)->GetDrawGlyphShadow();
|
||||
}
|
||||
|
||||
#if defined(WITH_FREETYPE) || defined(_WIN32)
|
||||
|
||||
/** Settings for a single freetype font. */
|
||||
struct FreeTypeSubSetting {
|
||||
char font[MAX_PATH]; ///< The name of the font, or path to the font.
|
||||
uint size; ///< The (requested) size of the font.
|
||||
bool aa; ///< Whether to do anti aliasing or not.
|
||||
|
||||
const void *os_handle = nullptr; ///< Optional native OS font info.
|
||||
const void *os_handle = nullptr; ///< Optional native OS font info. Only valid during font search.
|
||||
};
|
||||
|
||||
/** Settings for the freetype fonts. */
|
||||
@@ -230,9 +231,8 @@ struct FreeTypeSettings {
|
||||
|
||||
extern FreeTypeSettings _freetype;
|
||||
|
||||
#endif /* defined(WITH_FREETYPE) || defined(_WIN32) */
|
||||
|
||||
void InitFreeType(bool monospace);
|
||||
void UninitFreeType();
|
||||
bool HasAntialiasedFonts();
|
||||
|
||||
#endif /* FONTCACHE_H */
|
||||
|
||||
77
src/fontcache_internal.h
Normal file
77
src/fontcache_internal.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD 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, version 2.
|
||||
* OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file fontcache_internal.h Support types and functions for platform-specific font support. */
|
||||
|
||||
#ifndef FONTCACHE_INTERNAL_H
|
||||
#define FONTCACHE_INTERNAL_H
|
||||
|
||||
#include "core/smallmap_type.hpp"
|
||||
#include "fontcache.h"
|
||||
|
||||
|
||||
static const int MAX_FONT_SIZE = 72; ///< Maximum font size.
|
||||
|
||||
static const byte FACE_COLOUR = 1;
|
||||
static const byte SHADOW_COLOUR = 2;
|
||||
|
||||
/** Font cache for fonts that are based on a TrueType font. */
|
||||
class TrueTypeFontCache : public FontCache {
|
||||
protected:
|
||||
static constexpr int MAX_GLYPH_DIM = 256; ///< Maximum glyph dimensions.
|
||||
static constexpr uint MAX_FONT_MIN_REC_SIZE = 20u; ///< Upper limit for the recommended font size in case a font file contains nonsensical values.
|
||||
|
||||
int req_size; ///< Requested font size.
|
||||
int used_size; ///< Used font size.
|
||||
|
||||
typedef SmallMap<uint32, std::pair<size_t, const void *> > FontTable; ///< Table with font table cache
|
||||
FontTable font_tables; ///< Cached font tables.
|
||||
|
||||
/** Container for information about a glyph. */
|
||||
struct GlyphEntry {
|
||||
Sprite *sprite; ///< The loaded sprite.
|
||||
byte width; ///< The width of the glyph.
|
||||
bool duplicate; ///< Whether this glyph entry is a duplicate, i.e. may this be freed?
|
||||
};
|
||||
|
||||
/**
|
||||
* The glyph cache. This is structured to reduce memory consumption.
|
||||
* 1) There is a 'segment' table for each font size.
|
||||
* 2) Each segment table is a discrete block of characters.
|
||||
* 3) Each block contains 256 (aligned) characters sequential characters.
|
||||
*
|
||||
* The cache is accessed in the following way:
|
||||
* For character 0x0041 ('A'): glyph_to_sprite[0x00][0x41]
|
||||
* For character 0x20AC (Euro): glyph_to_sprite[0x20][0xAC]
|
||||
*
|
||||
* Currently only 256 segments are allocated, "limiting" us to 65536 characters.
|
||||
* This can be simply changed in the two functions Get & SetGlyphPtr.
|
||||
*/
|
||||
GlyphEntry **glyph_to_sprite;
|
||||
|
||||
GlyphEntry *GetGlyphPtr(GlyphID key);
|
||||
void SetGlyphPtr(GlyphID key, const GlyphEntry *glyph, bool duplicate = false);
|
||||
|
||||
virtual const void *InternalGetFontTable(uint32 tag, size_t &length) = 0;
|
||||
virtual const Sprite *InternalGetGlyph(GlyphID key, bool aa) = 0;
|
||||
|
||||
public:
|
||||
TrueTypeFontCache(FontSize fs, int pixels);
|
||||
virtual ~TrueTypeFontCache();
|
||||
int GetFontSize() const override { return this->used_size; }
|
||||
SpriteID GetUnicodeGlyph(WChar key) override { return this->parent->GetUnicodeGlyph(key); }
|
||||
void SetUnicodeGlyph(WChar key, SpriteID sprite) override { this->parent->SetUnicodeGlyph(key, sprite); }
|
||||
void InitializeUnicodeGlyphMap() override { this->parent->InitializeUnicodeGlyphMap(); }
|
||||
const Sprite *GetGlyph(GlyphID key) override;
|
||||
const void *GetFontTable(uint32 tag, size_t &length) override;
|
||||
void ClearFontCache() override;
|
||||
uint GetGlyphWidth(GlyphID key) override;
|
||||
bool GetDrawGlyphShadow() override;
|
||||
bool IsBuiltInFont() override { return false; }
|
||||
};
|
||||
|
||||
#endif /* FONTCACHE_INTERNAL_H */
|
||||
@@ -27,7 +27,6 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face);
|
||||
|
||||
#endif /* WITH_FREETYPE */
|
||||
|
||||
#if defined(WITH_FREETYPE) || defined(_WIN32)
|
||||
/**
|
||||
* We would like to have a fallback font as the current one
|
||||
* doesn't contain all characters we need.
|
||||
@@ -38,8 +37,6 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face);
|
||||
* @param callback The function to call to check for missing glyphs.
|
||||
* @return true if a font has been set, false otherwise.
|
||||
*/
|
||||
bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, class MissingGlyphSearcher *callback);
|
||||
|
||||
#endif /* defined(WITH_FREETYPE) || defined(WIN32)*/
|
||||
bool SetFallbackFont(struct FreeTypeSettings *settings, const char *language_isocode, int winlangid, class MissingGlyphSearcher *callback);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -151,6 +151,10 @@ namespace {
|
||||
/* Total duration covered by collected points */
|
||||
TimingMeasurement total = 0;
|
||||
|
||||
/* We have nothing to compare the first point against */
|
||||
point--;
|
||||
if (point < 0) point = NUM_FRAMERATE_POINTS - 1;
|
||||
|
||||
while (point != last_point) {
|
||||
/* Only record valid data points, but pretend the gaps in measurements aren't there */
|
||||
if (this->durations[point] != INVALID_DURATION) {
|
||||
@@ -185,7 +189,7 @@ namespace {
|
||||
PerformanceData(1), // PFE_ACC_GL_AIRCRAFT
|
||||
PerformanceData(1), // PFE_GL_LANDSCAPE
|
||||
PerformanceData(1), // PFE_GL_LINKGRAPH
|
||||
PerformanceData(GL_RATE), // PFE_DRAWING
|
||||
PerformanceData(1000.0 / 30), // PFE_DRAWING
|
||||
PerformanceData(1), // PFE_ACC_DRAWWORLD
|
||||
PerformanceData(60.0), // PFE_VIDEO
|
||||
PerformanceData(1000.0 * 8192 / 44100), // PFE_SOUND
|
||||
@@ -270,6 +274,7 @@ void PerformanceMeasurer::SetExpectedRate(double rate)
|
||||
*/
|
||||
/* static */ void PerformanceMeasurer::Paused(PerformanceElement elem)
|
||||
{
|
||||
PerformanceMeasurer::SetInactive(elem);
|
||||
_pf_data[elem].AddPause(GetPerformanceTimer());
|
||||
}
|
||||
|
||||
@@ -395,7 +400,6 @@ struct FramerateWindow : Window {
|
||||
{
|
||||
const double threshold_good = target * 0.95;
|
||||
const double threshold_bad = target * 2 / 3;
|
||||
value = std::min(9999.99, value);
|
||||
this->value = (uint32)(value * 100);
|
||||
this->strid = (value > threshold_good) ? STR_FRAMERATE_FPS_GOOD : (value < threshold_bad) ? STR_FRAMERATE_FPS_BAD : STR_FRAMERATE_FPS_WARN;
|
||||
}
|
||||
@@ -404,7 +408,6 @@ struct FramerateWindow : Window {
|
||||
{
|
||||
const double threshold_good = target / 3;
|
||||
const double threshold_bad = target;
|
||||
value = std::min(9999.99, value);
|
||||
this->value = (uint32)(value * 100);
|
||||
this->strid = (value < threshold_good) ? STR_FRAMERATE_MS_GOOD : (value > threshold_bad) ? STR_FRAMERATE_MS_BAD : STR_FRAMERATE_MS_WARN;
|
||||
}
|
||||
@@ -464,7 +467,7 @@ struct FramerateWindow : Window {
|
||||
this->speed_gameloop.SetRate(gl_rate / _pf_data[PFE_GAMELOOP].expected_rate, 1.0);
|
||||
if (this->small) return; // in small mode, this is everything needed
|
||||
|
||||
this->rate_drawing.SetRate(_pf_data[PFE_DRAWING].GetRate(), _pf_data[PFE_DRAWING].expected_rate);
|
||||
this->rate_drawing.SetRate(_pf_data[PFE_DRAWING].GetRate(), _settings_client.gui.refresh_rate);
|
||||
|
||||
int new_active = 0;
|
||||
for (PerformanceElement e = PFE_FIRST; e < PFE_MAX; e++) {
|
||||
|
||||
@@ -59,18 +59,10 @@ GenWorldInfo _gw;
|
||||
/** Whether we are generating the map or not. */
|
||||
bool _generating_world;
|
||||
|
||||
/**
|
||||
* Tells if the world generation is done in a thread or not.
|
||||
* @return the 'threaded' status
|
||||
*/
|
||||
bool IsGenerateWorldThreaded()
|
||||
{
|
||||
return _gw.threaded && !_gw.quit_thread;
|
||||
}
|
||||
class AbortGenerateWorldSignal { };
|
||||
|
||||
/**
|
||||
* Clean up the 'mess' of generation. That is, show windows again, reset
|
||||
* thread variables, and delete the progress window.
|
||||
* Generation is done; show windows again and delete the progress window.
|
||||
*/
|
||||
static void CleanupGeneration()
|
||||
{
|
||||
@@ -78,11 +70,10 @@ static void CleanupGeneration()
|
||||
|
||||
SetMouseCursorBusy(false);
|
||||
/* Show all vital windows again, because we have hidden them */
|
||||
if (_gw.threaded && _game_mode != GM_MENU) ShowVitalWindows();
|
||||
if (_game_mode != GM_MENU) ShowVitalWindows();
|
||||
SetModalProgress(false);
|
||||
_gw.proc = nullptr;
|
||||
_gw.abortp = nullptr;
|
||||
_gw.threaded = false;
|
||||
|
||||
DeleteWindowByClass(WC_MODAL_PROGRESS);
|
||||
ShowFirstError();
|
||||
@@ -97,10 +88,8 @@ static void _GenerateWorld()
|
||||
/* Make sure everything is done via OWNER_NONE. */
|
||||
Backup<CompanyID> _cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
|
||||
std::unique_lock<std::mutex> lock(_modal_progress_work_mutex, std::defer_lock);
|
||||
try {
|
||||
_generating_world = true;
|
||||
lock.lock();
|
||||
if (_network_dedicated) DEBUG(net, 1, "Generating map, please wait...");
|
||||
/* Set the Random() seed to generation_seed so we produce the same map with the same seed */
|
||||
if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
|
||||
@@ -136,14 +125,7 @@ static void _GenerateWorld()
|
||||
/* Only generate towns, tree and industries in newgame mode. */
|
||||
if (_game_mode != GM_EDITOR) {
|
||||
if (!GenerateTowns(_settings_game.economy.town_layout)) {
|
||||
_cur_company.Restore();
|
||||
HandleGeneratingWorldAbortion();
|
||||
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP);
|
||||
if (_network_dedicated) {
|
||||
/* Exit the game to prevent a return to main menu. */
|
||||
DEBUG(net, 0, "Generating map failed, aborting");
|
||||
_exit_game = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
GenerateIndustries();
|
||||
@@ -200,7 +182,6 @@ static void _GenerateWorld()
|
||||
IncreaseGeneratingWorldProgress(GWP_GAME_START);
|
||||
|
||||
CleanupGeneration();
|
||||
lock.unlock();
|
||||
|
||||
ShowNewGRFError();
|
||||
|
||||
@@ -212,11 +193,19 @@ static void _GenerateWorld()
|
||||
seprintf(name, lastof(name), "dmp_cmds_%08x_%08x.sav", _settings_game.game_creation.generation_seed, _date);
|
||||
SaveOrLoad(name, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, false);
|
||||
}
|
||||
} catch (...) {
|
||||
} catch (AbortGenerateWorldSignal&) {
|
||||
CleanupGeneration();
|
||||
|
||||
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP, true);
|
||||
if (_cur_company.IsValid()) _cur_company.Restore();
|
||||
_generating_world = false;
|
||||
throw;
|
||||
|
||||
if (_network_dedicated) {
|
||||
/* Exit the game to prevent a return to main menu. */
|
||||
DEBUG(net, 0, "Generating map failed, aborting");
|
||||
_exit_game = true;
|
||||
} else {
|
||||
SwitchToMode(_switch_mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,23 +229,6 @@ void GenerateWorldSetAbortCallback(GWAbortProc *proc)
|
||||
_gw.abortp = proc;
|
||||
}
|
||||
|
||||
/**
|
||||
* This will wait for the thread to finish up his work. It will not continue
|
||||
* till the work is done.
|
||||
*/
|
||||
void WaitTillGeneratedWorld()
|
||||
{
|
||||
if (!_gw.thread.joinable()) return;
|
||||
|
||||
_modal_progress_work_mutex.unlock();
|
||||
_modal_progress_paint_mutex.unlock();
|
||||
_gw.quit_thread = true;
|
||||
_gw.thread.join();
|
||||
_gw.threaded = false;
|
||||
_modal_progress_work_mutex.lock();
|
||||
_modal_progress_paint_mutex.lock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the abortion process
|
||||
*/
|
||||
@@ -271,7 +243,7 @@ void AbortGeneratingWorld()
|
||||
*/
|
||||
bool IsGeneratingWorldAborted()
|
||||
{
|
||||
return _gw.abort;
|
||||
return _gw.abort || _exit_game;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -284,11 +256,7 @@ void HandleGeneratingWorldAbortion()
|
||||
|
||||
if (_gw.abortp != nullptr) _gw.abortp();
|
||||
|
||||
CleanupGeneration();
|
||||
|
||||
if (_gw.thread.joinable() && _gw.thread.get_id() == std::this_thread::get_id()) throw OTTDThreadExitSignal();
|
||||
|
||||
SwitchToMode(_switch_mode);
|
||||
throw AbortGenerateWorldSignal();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,8 +276,6 @@ void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_setti
|
||||
_gw.abort = false;
|
||||
_gw.abortp = nullptr;
|
||||
_gw.lc = _local_company;
|
||||
_gw.quit_thread = false;
|
||||
_gw.threaded = true;
|
||||
|
||||
/* This disables some commands and stuff */
|
||||
SetLocalCompany(COMPANY_SPECTATOR);
|
||||
@@ -328,28 +294,16 @@ void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_setti
|
||||
SetupColoursAndInitialWindow();
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
|
||||
|
||||
if (_gw.thread.joinable()) _gw.thread.join();
|
||||
|
||||
if (!UseThreadedModelProgress() || !VideoDriver::GetInstance()->HasGUI() || !StartNewThread(&_gw.thread, "ottd:genworld", &_GenerateWorld)) {
|
||||
DEBUG(misc, 1, "Cannot create genworld thread, reverting to single-threaded mode");
|
||||
_gw.threaded = false;
|
||||
_modal_progress_work_mutex.unlock();
|
||||
_GenerateWorld();
|
||||
_modal_progress_work_mutex.lock();
|
||||
return;
|
||||
}
|
||||
|
||||
UnshowCriticalError();
|
||||
/* Remove any open window */
|
||||
DeleteAllNonVitalWindows();
|
||||
/* Hide vital windows, because we don't allow to use them */
|
||||
HideVitalWindows();
|
||||
|
||||
/* Don't show the dialog if we don't have a thread */
|
||||
ShowGenerateWorldProgress();
|
||||
|
||||
/* Centre the view on the map */
|
||||
if (FindWindowById(WC_MAIN_WINDOW, 0) != nullptr) {
|
||||
ScrollMainWindowToTile(TileXY(MapSizeX() / 2, MapSizeY() / 2), true);
|
||||
}
|
||||
|
||||
_GenerateWorld();
|
||||
}
|
||||
|
||||
@@ -52,15 +52,12 @@ typedef void GWAbortProc(); ///< Called when genworld is aborted
|
||||
/** Properties of current genworld process */
|
||||
struct GenWorldInfo {
|
||||
bool abort; ///< Whether to abort the thread ASAP
|
||||
bool quit_thread; ///< Do we want to quit the active thread
|
||||
bool threaded; ///< Whether we run _GenerateWorld threaded
|
||||
GenWorldMode mode; ///< What mode are we making a world in
|
||||
CompanyID lc; ///< The local_company before generating
|
||||
uint size_x; ///< X-size of the map
|
||||
uint size_y; ///< Y-size of the map
|
||||
GWDoneProc *proc; ///< Proc that is called when done (can be nullptr)
|
||||
GWAbortProc *abortp; ///< Proc that is called when aborting (can be nullptr)
|
||||
std::thread thread; ///< The thread we are in (joinable if a thread was created)
|
||||
};
|
||||
|
||||
/** Current stage of world generation process */
|
||||
@@ -81,10 +78,8 @@ enum GenWorldProgress {
|
||||
};
|
||||
|
||||
/* genworld.cpp */
|
||||
bool IsGenerateWorldThreaded();
|
||||
void GenerateWorldSetCallback(GWDoneProc *proc);
|
||||
void GenerateWorldSetAbortCallback(GWAbortProc *proc);
|
||||
void WaitTillGeneratedWorld();
|
||||
void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings = true);
|
||||
void AbortGeneratingWorld();
|
||||
bool IsGeneratingWorldAborted();
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#include "saveload/saveload.h"
|
||||
#include "progress.h"
|
||||
#include "error.h"
|
||||
#include "newgrf_townname.h"
|
||||
#include "townname_type.h"
|
||||
#include "video/video_driver.hpp"
|
||||
|
||||
#include "widgets/genworld_widget.h"
|
||||
|
||||
@@ -80,11 +83,11 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = {
|
||||
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAPSIZE, STR_MAPGEN_MAPSIZE_TOOLTIP), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_LAND_GENERATOR, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_TOWNS, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_TERRAIN_TYPE, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_VARIETY, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_SEA_LAKES, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_TREE_PLACER, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_TOWNS, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_INDUSTRIES, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BORDER_TYPE, STR_NULL), SetFill(1, 1),
|
||||
EndContainer(),
|
||||
/* Widgets at the right of the labels. */
|
||||
@@ -96,11 +99,11 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = {
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_MAPGEN_MAPSIZE_TOOLTIP), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_LANDSCAPE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TERRAIN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_VARIETY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_WATER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TREE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_BORDERS_RANDOM), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@@ -110,9 +113,9 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = {
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAX_HEIGHTLEVEL, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_LINE_HEIGHT, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DATE, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_INDUSTRIES, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SMOOTHNESS, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_RIVERS, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_GAME_OPTIONS_TOWN_NAMES_FRAME, STR_NULL), SetFill(1, 1),
|
||||
EndContainer(),
|
||||
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
||||
/* Max. heightlevel. */
|
||||
@@ -133,9 +136,9 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = {
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1),
|
||||
EndContainer(),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_SMOOTHNESS_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_RIVER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWNNAME_DROPDOWN), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_TOWN_NAMES_DROPDOWN_TOOLTIP), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_GL_GENERATE_BUTTON), SetMinimalSize(84, 0), SetDataTip(STR_MAPGEN_GENERATE, STR_NULL), SetFill(1, 1),
|
||||
@@ -197,18 +200,19 @@ static const NWidgetPart _nested_heightmap_load_widgets[] = {
|
||||
/* Labels at the left side. */
|
||||
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_HEIGHTMAP_NAME, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE_LABEL, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAPSIZE, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_HEIGHTMAP_ROTATION, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_TOWNS, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_INDUSTRIES, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_RIVERS, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_TREE_PLACER, STR_NULL), SetFill(1, 1),
|
||||
EndContainer(),
|
||||
/* Widgets at the right of the labels. */
|
||||
NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
|
||||
NWidget(WWT_EMPTY, COLOUR_ORANGE, WID_GL_HEIGHTMAP_NAME_TEXT), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(0, 5, 0),
|
||||
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE, WID_GL_HEIGHTMAP_SIZE_TEXT), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE, STR_NULL), SetFill(1, 0),
|
||||
/* Mapsize X * Y. */
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0),
|
||||
@@ -219,33 +223,32 @@ static const NWidgetPart _nested_heightmap_load_widgets[] = {
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_RIVER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TREE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0),
|
||||
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE_LABEL, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_LINE_HEIGHT, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAX_HEIGHTLEVEL, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_LINE_HEIGHT, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DATE, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_GAME_OPTIONS_TOWN_NAMES_FRAME, STR_NULL), SetFill(1, 1),
|
||||
EndContainer(),
|
||||
NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_ORANGE, WID_GL_HEIGHTMAP_SIZE_TEXT), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE, STR_NULL), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_MAX_HEIGHTLEVEL_DOWN), SetFill(0, 1),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_MAX_HEIGHTLEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_MAX_HEIGHTLEVEL_UP), SetFill(0, 1),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1),
|
||||
EndContainer(),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWNNAME_DROPDOWN), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_TOWN_NAMES_DROPDOWN_TOOLTIP), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_GL_GENERATE_BUTTON), SetMinimalSize(84, 0), SetDataTip(STR_MAPGEN_GENERATE, STR_NULL), SetFill(1, 1),
|
||||
@@ -293,11 +296,38 @@ static DropDownList BuildMapsizeDropDown()
|
||||
return list;
|
||||
}
|
||||
|
||||
static DropDownList BuildTownNameDropDown()
|
||||
{
|
||||
DropDownList list;
|
||||
|
||||
/* Add and sort newgrf townnames generators */
|
||||
const auto &grf_names = GetGRFTownNameList();
|
||||
for (uint i = 0; i < grf_names.size(); i++) {
|
||||
list.emplace_back(new DropDownListStringItem(grf_names[i], BUILTIN_TOWNNAME_GENERATOR_COUNT + i, false));
|
||||
}
|
||||
std::sort(list.begin(), list.end(), DropDownListStringItem::NatSortFunc);
|
||||
|
||||
size_t newgrf_size = list.size();
|
||||
/* Insert newgrf_names at the top of the list */
|
||||
if (newgrf_size > 0) {
|
||||
list.emplace_back(new DropDownListItem(-1, false)); // separator line
|
||||
newgrf_size++;
|
||||
}
|
||||
|
||||
/* Add and sort original townnames generators */
|
||||
for (uint i = 0; i < BUILTIN_TOWNNAME_GENERATOR_COUNT; i++) {
|
||||
list.emplace_back(new DropDownListStringItem(STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + i, i, false));
|
||||
}
|
||||
std::sort(list.begin() + newgrf_size, list.end(), DropDownListStringItem::NatSortFunc);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
static const StringID _elevations[] = {STR_TERRAIN_TYPE_VERY_FLAT, STR_TERRAIN_TYPE_FLAT, STR_TERRAIN_TYPE_HILLY, STR_TERRAIN_TYPE_MOUNTAINOUS, STR_TERRAIN_TYPE_ALPINIST, INVALID_STRING_ID};
|
||||
static const StringID _sea_lakes[] = {STR_SEA_LEVEL_VERY_LOW, STR_SEA_LEVEL_LOW, STR_SEA_LEVEL_MEDIUM, STR_SEA_LEVEL_HIGH, STR_SEA_LEVEL_CUSTOM, INVALID_STRING_ID};
|
||||
static const StringID _rivers[] = {STR_RIVERS_NONE, STR_RIVERS_FEW, STR_RIVERS_MODERATE, STR_RIVERS_LOT, INVALID_STRING_ID};
|
||||
static const StringID _smoothness[] = {STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_SMOOTH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_ROUGH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_ROUGH, INVALID_STRING_ID};
|
||||
static const StringID _tree_placer[] = {STR_CONFIG_SETTING_TREE_PLACER_NONE, STR_CONFIG_SETTING_TREE_PLACER_ORIGINAL, STR_CONFIG_SETTING_TREE_PLACER_IMPROVED, INVALID_STRING_ID};
|
||||
static const StringID _rotation[] = {STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE, STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_CLOCKWISE, INVALID_STRING_ID};
|
||||
static const StringID _landscape[] = {STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL, STR_CONFIG_SETTING_LAND_GENERATOR_TERRA_GENESIS, INVALID_STRING_ID};
|
||||
static const StringID _num_towns[] = {STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, STR_NUM_CUSTOM, INVALID_STRING_ID};
|
||||
@@ -321,10 +351,9 @@ struct GenerateLandscapeWindow : public Window {
|
||||
|
||||
this->mode = (GenerateLandscapeWindowMode)this->window_number;
|
||||
|
||||
/* Disable town, industry and trees in SE */
|
||||
/* Disable town and industry in SE */
|
||||
this->SetWidgetDisabledState(WID_GL_TOWN_PULLDOWN, _game_mode == GM_EDITOR);
|
||||
this->SetWidgetDisabledState(WID_GL_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR);
|
||||
this->SetWidgetDisabledState(WID_GL_TREE_PULLDOWN, _game_mode == GM_EDITOR);
|
||||
|
||||
this->OnInvalidateData();
|
||||
}
|
||||
@@ -350,9 +379,17 @@ struct GenerateLandscapeWindow : public Window {
|
||||
}
|
||||
break;
|
||||
|
||||
case WID_GL_TOWNNAME_DROPDOWN: {
|
||||
uint gen = _settings_newgame.game_creation.town_name;
|
||||
StringID name = gen < BUILTIN_TOWNNAME_GENERATOR_COUNT ?
|
||||
STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + gen :
|
||||
GetGRFTownNameName(gen - BUILTIN_TOWNNAME_GENERATOR_COUNT);
|
||||
SetDParam(0, name);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_GL_INDUSTRY_PULLDOWN: SetDParam(0, _game_mode == GM_EDITOR ? STR_CONFIG_SETTING_OFF : _num_inds[_settings_newgame.difficulty.industry_density]); break;
|
||||
case WID_GL_LANDSCAPE_PULLDOWN: SetDParam(0, _landscape[_settings_newgame.game_creation.land_generator]); break;
|
||||
case WID_GL_TREE_PULLDOWN: SetDParam(0, _tree_placer[_settings_newgame.game_creation.tree_placer]); break;
|
||||
case WID_GL_TERRAIN_PULLDOWN: SetDParam(0, _elevations[_settings_newgame.difficulty.terrain_type]); break;
|
||||
|
||||
case WID_GL_WATER_PULLDOWN:
|
||||
@@ -477,7 +514,6 @@ struct GenerateLandscapeWindow : public Window {
|
||||
|
||||
case WID_GL_INDUSTRY_PULLDOWN: strs = _num_inds; break;
|
||||
case WID_GL_LANDSCAPE_PULLDOWN: strs = _landscape; break;
|
||||
case WID_GL_TREE_PULLDOWN: strs = _tree_placer; break;
|
||||
case WID_GL_TERRAIN_PULLDOWN: strs = _elevations; break;
|
||||
case WID_GL_WATER_PULLDOWN:
|
||||
strs = _sea_lakes;
|
||||
@@ -548,6 +584,10 @@ struct GenerateLandscapeWindow : public Window {
|
||||
ShowDropDownMenu(this, _num_towns, _settings_newgame.difficulty.number_towns, WID_GL_TOWN_PULLDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case WID_GL_TOWNNAME_DROPDOWN: // Townname generator
|
||||
ShowDropDownList(this, BuildTownNameDropDown(), _settings_newgame.game_creation.town_name, WID_GL_TOWNNAME_DROPDOWN);
|
||||
break;
|
||||
|
||||
case WID_GL_INDUSTRY_PULLDOWN: // Number of industries
|
||||
ShowDropDownMenu(this, _num_inds, _settings_newgame.difficulty.industry_density, WID_GL_INDUSTRY_PULLDOWN, 0, 0);
|
||||
break;
|
||||
@@ -634,10 +674,6 @@ struct GenerateLandscapeWindow : public Window {
|
||||
ShowQueryString(STR_JUST_INT, STR_MAPGEN_SNOW_LINE_QUERY_CAPT, 4, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
|
||||
break;
|
||||
|
||||
case WID_GL_TREE_PULLDOWN: // Tree placer
|
||||
ShowDropDownMenu(this, _tree_placer, _settings_newgame.game_creation.tree_placer, WID_GL_TREE_PULLDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case WID_GL_LANDSCAPE_PULLDOWN: // Landscape generator
|
||||
ShowDropDownMenu(this, _landscape, _settings_newgame.game_creation.land_generator, WID_GL_LANDSCAPE_PULLDOWN, 0, 0);
|
||||
break;
|
||||
@@ -717,7 +753,6 @@ struct GenerateLandscapeWindow : public Window {
|
||||
switch (widget) {
|
||||
case WID_GL_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break;
|
||||
case WID_GL_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break;
|
||||
case WID_GL_TREE_PULLDOWN: _settings_newgame.game_creation.tree_placer = index; break;
|
||||
case WID_GL_RIVER_PULLDOWN: _settings_newgame.game_creation.amount_of_rivers = index; break;
|
||||
case WID_GL_SMOOTHNESS_PULLDOWN: _settings_newgame.game_creation.tgen_smoothness = index; break;
|
||||
case WID_GL_VARIETY_PULLDOWN: _settings_newgame.game_creation.variety = index; break;
|
||||
@@ -740,6 +775,13 @@ struct GenerateLandscapeWindow : public Window {
|
||||
_settings_newgame.difficulty.number_towns = index;
|
||||
break;
|
||||
|
||||
case WID_GL_TOWNNAME_DROPDOWN: // Town names
|
||||
if (_game_mode == GM_MENU || Town::GetNumItems() == 0) {
|
||||
_settings_newgame.game_creation.town_name = index;
|
||||
SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
|
||||
}
|
||||
break;
|
||||
|
||||
case WID_GL_INDUSTRY_PULLDOWN: _settings_newgame.difficulty.industry_density = index; break;
|
||||
case WID_GL_TERRAIN_PULLDOWN: _settings_newgame.difficulty.terrain_type = index; break;
|
||||
|
||||
@@ -1147,7 +1189,7 @@ struct GenWorldStatus {
|
||||
StringID cls;
|
||||
uint current;
|
||||
uint total;
|
||||
int timer;
|
||||
std::chrono::steady_clock::time_point next_update;
|
||||
};
|
||||
|
||||
static GenWorldStatus _gws;
|
||||
@@ -1249,11 +1291,11 @@ struct GenerateProgressWindow : public Window {
|
||||
*/
|
||||
void PrepareGenerateWorldProgress()
|
||||
{
|
||||
_gws.cls = STR_GENERATION_WORLD_GENERATION;
|
||||
_gws.cls = STR_GENERATION_WORLD_GENERATION;
|
||||
_gws.current = 0;
|
||||
_gws.total = 0;
|
||||
_gws.total = 0;
|
||||
_gws.percent = 0;
|
||||
_gws.timer = 0; // Forces to paint the progress window immediately
|
||||
_gws.next_update = std::chrono::steady_clock::now();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1271,10 +1313,10 @@ static void _SetGeneratingWorldProgress(GenWorldProgress cls, uint progress, uin
|
||||
static_assert(lengthof(percent_table) == GWP_CLASS_COUNT + 1);
|
||||
assert(cls < GWP_CLASS_COUNT);
|
||||
|
||||
/* Do not run this function if we aren't in a thread */
|
||||
if (!IsGenerateWorldThreaded() && !_network_dedicated) return;
|
||||
|
||||
if (IsGeneratingWorldAborted()) HandleGeneratingWorldAbortion();
|
||||
if (IsGeneratingWorldAborted()) {
|
||||
HandleGeneratingWorldAbortion();
|
||||
return;
|
||||
}
|
||||
|
||||
if (total == 0) {
|
||||
assert(_gws.cls == _generation_class_table[cls]);
|
||||
@@ -1287,9 +1329,6 @@ static void _SetGeneratingWorldProgress(GenWorldProgress cls, uint progress, uin
|
||||
_gws.percent = percent_table[cls];
|
||||
}
|
||||
|
||||
/* Don't update the screen too often. So update it once in every once in a while... */
|
||||
if (!_network_dedicated && _gws.timer != 0 && _realtime_tick - _gws.timer < MODAL_PROGRESS_REDRAW_TIMEOUT) return;
|
||||
|
||||
/* Percentage is about the number of completed tasks, so 'current - 1' */
|
||||
_gws.percent = percent_table[cls] + (percent_table[cls + 1] - percent_table[cls]) * (_gws.current == 0 ? 0 : _gws.current - 1) / _gws.total;
|
||||
|
||||
@@ -1308,23 +1347,12 @@ static void _SetGeneratingWorldProgress(GenWorldProgress cls, uint progress, uin
|
||||
DEBUG(net, 1, "Map generation percentage complete: %d", _gws.percent);
|
||||
last_percent = _gws.percent;
|
||||
|
||||
/* Don't continue as dedicated never has a thread running */
|
||||
return;
|
||||
}
|
||||
|
||||
SetWindowDirty(WC_MODAL_PROGRESS, 0);
|
||||
MarkWholeScreenDirty();
|
||||
|
||||
/* Release the rights to the map generator, and acquire the rights to the
|
||||
* paint thread. The 'other' thread already has the paint thread rights so
|
||||
* this ensures us that we are waiting until the paint thread is done
|
||||
* before we reacquire the mapgen rights */
|
||||
_modal_progress_work_mutex.unlock();
|
||||
_modal_progress_paint_mutex.lock();
|
||||
_modal_progress_work_mutex.lock();
|
||||
_modal_progress_paint_mutex.unlock();
|
||||
|
||||
_gws.timer = _realtime_tick;
|
||||
VideoDriver::GetInstance()->GameLoopPause();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
68
src/gfx.cpp
68
src/gfx.cpp
@@ -34,7 +34,7 @@ byte _support8bpp;
|
||||
CursorVars _cursor;
|
||||
bool _ctrl_pressed; ///< Is Ctrl pressed?
|
||||
bool _shift_pressed; ///< Is Shift pressed?
|
||||
byte _fast_forward;
|
||||
uint16 _game_speed = 100; ///< Current game-speed; 100 is 1x, 0 is infinite.
|
||||
bool _left_button_down; ///< Is left mouse button pressed?
|
||||
bool _left_button_clicked; ///< Is left mouse button clicked?
|
||||
bool _right_button_down; ///< Is right mouse button pressed?
|
||||
@@ -59,6 +59,10 @@ static ReusableBuffer<uint8> _cursor_backup;
|
||||
ZoomLevel _gui_zoom; ///< GUI Zoom level
|
||||
ZoomLevel _font_zoom; ///< Font Zoom level
|
||||
|
||||
int8 _gui_zoom_cfg; ///< GUI zoom level in config.
|
||||
int8 _font_zoom_cfg; ///< Font zoom level in config.
|
||||
|
||||
|
||||
/**
|
||||
* The rect for repaint.
|
||||
*
|
||||
@@ -1344,6 +1348,9 @@ void ScreenSizeChanged()
|
||||
|
||||
void UndrawMouseCursor()
|
||||
{
|
||||
/* Don't undraw mouse cursor if it is handled by the video driver. */
|
||||
if (VideoDriver::GetInstance()->UseSystemCursor()) return;
|
||||
|
||||
/* Don't undraw the mouse cursor if the screen is not ready */
|
||||
if (_screen.dst_ptr == nullptr) return;
|
||||
|
||||
@@ -1357,6 +1364,9 @@ void UndrawMouseCursor()
|
||||
|
||||
void DrawMouseCursor()
|
||||
{
|
||||
/* Don't draw mouse cursor if it is handled by the video driver. */
|
||||
if (VideoDriver::GetInstance()->UseSystemCursor()) return;
|
||||
|
||||
/* Don't draw the mouse cursor if the screen is not ready */
|
||||
if (_screen.dst_ptr == nullptr) return;
|
||||
|
||||
@@ -1460,29 +1470,6 @@ void DrawDirtyBlocks()
|
||||
int x;
|
||||
int y;
|
||||
|
||||
if (HasModalProgress()) {
|
||||
/* We are generating the world, so release our rights to the map and
|
||||
* painting while we are waiting a bit. */
|
||||
_modal_progress_paint_mutex.unlock();
|
||||
_modal_progress_work_mutex.unlock();
|
||||
|
||||
/* Wait a while and update _realtime_tick so we are given the rights */
|
||||
if (!IsFirstModalProgressLoop()) CSleep(MODAL_PROGRESS_REDRAW_TIMEOUT);
|
||||
_realtime_tick += MODAL_PROGRESS_REDRAW_TIMEOUT;
|
||||
|
||||
/* Modal progress thread may need blitter access while we are waiting for it. */
|
||||
VideoDriver::GetInstance()->ReleaseBlitterLock();
|
||||
_modal_progress_paint_mutex.lock();
|
||||
VideoDriver::GetInstance()->AcquireBlitterLock();
|
||||
_modal_progress_work_mutex.lock();
|
||||
|
||||
/* When we ended with the modal progress, do not draw the blocks.
|
||||
* Simply let the next run do so, otherwise we would be loading
|
||||
* the new state (and possibly change the blitter) when we hold
|
||||
* the drawing lock, which we must not do. */
|
||||
if (_switch_mode != SM_NONE && !HasModalProgress()) return;
|
||||
}
|
||||
|
||||
y = 0;
|
||||
do {
|
||||
x = 0;
|
||||
@@ -1876,3 +1863,36 @@ void SortResolutions()
|
||||
{
|
||||
std::sort(_resolutions.begin(), _resolutions.end());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve GUI zoom level, if auto-suggestion is requested.
|
||||
*/
|
||||
void UpdateGUIZoom()
|
||||
{
|
||||
/* Determine real GUI zoom to use. */
|
||||
if (_gui_zoom_cfg == ZOOM_LVL_CFG_AUTO) {
|
||||
_gui_zoom = static_cast<ZoomLevel>(Clamp(VideoDriver::GetInstance()->GetSuggestedUIZoom(), _settings_client.gui.zoom_min, _settings_client.gui.zoom_max));
|
||||
} else {
|
||||
/* Ensure the gui_zoom is clamped between min/max. Change the
|
||||
* _gui_zoom_cfg if it isn't, as this is used to visually show the
|
||||
* selection in the Game Options. */
|
||||
_gui_zoom_cfg = Clamp(_gui_zoom_cfg, _settings_client.gui.zoom_min, _settings_client.gui.zoom_max);
|
||||
_gui_zoom = static_cast<ZoomLevel>(_gui_zoom_cfg);
|
||||
}
|
||||
|
||||
/* Determine real font zoom to use. */
|
||||
if (_font_zoom_cfg == ZOOM_LVL_CFG_AUTO) {
|
||||
_font_zoom = static_cast<ZoomLevel>(VideoDriver::GetInstance()->GetSuggestedUIZoom());
|
||||
} else {
|
||||
_font_zoom = static_cast<ZoomLevel>(_font_zoom_cfg);
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeGameSpeed(bool enable_fast_forward)
|
||||
{
|
||||
if (enable_fast_forward) {
|
||||
_game_speed = _settings_client.gui.fast_forward_speed_limit;
|
||||
} else {
|
||||
_game_speed = 100;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ extern byte _support8bpp;
|
||||
extern CursorVars _cursor;
|
||||
extern bool _ctrl_pressed; ///< Is Ctrl pressed?
|
||||
extern bool _shift_pressed; ///< Is Shift pressed?
|
||||
extern byte _fast_forward;
|
||||
extern uint16 _game_speed;
|
||||
|
||||
extern bool _left_button_down;
|
||||
extern bool _left_button_clicked;
|
||||
@@ -73,10 +73,12 @@ void HandleTextInput(const char *str, bool marked = false, const char *caret = n
|
||||
void HandleCtrlChanged();
|
||||
void HandleMouseEvents();
|
||||
void UpdateWindows();
|
||||
void ChangeGameSpeed(bool enable_fast_forward);
|
||||
|
||||
void DrawMouseCursor();
|
||||
void ScreenSizeChanged();
|
||||
void GameSizeChanged();
|
||||
void UpdateGUIZoom();
|
||||
void UndrawMouseCursor();
|
||||
|
||||
/** Size of the buffer used for drawing strings. */
|
||||
|
||||
@@ -263,11 +263,13 @@ static bool SwitchNewGRFBlitter()
|
||||
* between multiple 32bpp blitters, which perform differently with 8bpp sprites.
|
||||
*/
|
||||
uint depth_wanted_by_base = BaseGraphics::GetUsedSet()->blitter == BLT_32BPP ? 32 : 8;
|
||||
uint depth_wanted_by_grf = _support8bpp == S8BPP_NONE ? 32 : 8;
|
||||
uint depth_wanted_by_grf = _support8bpp != S8BPP_NONE ? 8 : 32;
|
||||
for (GRFConfig *c = _grfconfig; c != nullptr; c = c->next) {
|
||||
if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND || HasBit(c->flags, GCF_INIT_ONLY)) continue;
|
||||
if (c->palette & GRFP_BLT_32BPP) depth_wanted_by_grf = 32;
|
||||
}
|
||||
/* We need a 32bpp blitter for font anti-alias. */
|
||||
if (HasAntialiasedFonts()) depth_wanted_by_grf = 32;
|
||||
|
||||
/* Search the best blitter. */
|
||||
static const struct {
|
||||
@@ -275,13 +277,14 @@ static bool SwitchNewGRFBlitter()
|
||||
uint animation; ///< 0: no support, 1: do support, 2: both
|
||||
uint min_base_depth, max_base_depth, min_grf_depth, max_grf_depth;
|
||||
} replacement_blitters[] = {
|
||||
{ "8bpp-optimized", 2, 8, 8, 8, 8 },
|
||||
{ "40bpp-anim", 2, 8, 32, 8, 32 },
|
||||
#ifdef WITH_SSE
|
||||
{ "32bpp-sse4", 0, 32, 32, 8, 32 },
|
||||
{ "32bpp-ssse3", 0, 32, 32, 8, 32 },
|
||||
{ "32bpp-sse2", 0, 32, 32, 8, 32 },
|
||||
{ "32bpp-sse4-anim", 1, 32, 32, 8, 32 },
|
||||
#endif
|
||||
{ "8bpp-optimized", 2, 8, 8, 8, 8 },
|
||||
{ "32bpp-optimized", 0, 8, 32, 8, 32 },
|
||||
#ifdef WITH_SSE
|
||||
{ "32bpp-sse2-anim", 1, 8, 32, 8, 32 },
|
||||
@@ -292,8 +295,6 @@ static bool SwitchNewGRFBlitter()
|
||||
const bool animation_wanted = HasBit(_display_opt, DO_FULL_ANIMATION);
|
||||
const char *cur_blitter = BlitterFactory::GetCurrentBlitter()->GetName();
|
||||
|
||||
VideoDriver::GetInstance()->AcquireBlitterLock();
|
||||
|
||||
for (uint i = 0; i < lengthof(replacement_blitters); i++) {
|
||||
if (animation_wanted && (replacement_blitters[i].animation == 0)) continue;
|
||||
if (!animation_wanted && (replacement_blitters[i].animation == 1)) continue;
|
||||
@@ -303,25 +304,15 @@ static bool SwitchNewGRFBlitter()
|
||||
const char *repl_blitter = replacement_blitters[i].name;
|
||||
|
||||
if (strcmp(repl_blitter, cur_blitter) == 0) {
|
||||
VideoDriver::GetInstance()->ReleaseBlitterLock();
|
||||
return false;
|
||||
}
|
||||
if (BlitterFactory::GetBlitterFactory(repl_blitter) == nullptr) continue;
|
||||
|
||||
DEBUG(misc, 1, "Switching blitter from '%s' to '%s'... ", cur_blitter, repl_blitter);
|
||||
Blitter *new_blitter = BlitterFactory::SelectBlitter(repl_blitter);
|
||||
if (new_blitter == nullptr) NOT_REACHED();
|
||||
DEBUG(misc, 1, "Successfully switched to %s.", repl_blitter);
|
||||
/* Inform the video driver we want to switch blitter as soon as possible. */
|
||||
VideoDriver::GetInstance()->ChangeBlitter(repl_blitter);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!VideoDriver::GetInstance()->AfterBlitterChange()) {
|
||||
/* Failed to switch blitter, let's hope we can return to the old one. */
|
||||
if (BlitterFactory::SelectBlitter(cur_blitter) == nullptr || !VideoDriver::GetInstance()->AfterBlitterChange()) usererror("Failed to reinitialize video driver. Specify a fixed blitter in the config");
|
||||
}
|
||||
|
||||
VideoDriver::GetInstance()->ReleaseBlitterLock();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -341,6 +332,7 @@ void GfxLoadSprites()
|
||||
DEBUG(sprite, 2, "Loading sprite set %d", _settings_game.game_creation.landscape);
|
||||
|
||||
SwitchNewGRFBlitter();
|
||||
VideoDriver::GetInstance()->ClearSystemSprites();
|
||||
ClearFontCache();
|
||||
GfxInitSpriteMem();
|
||||
LoadSpriteTables();
|
||||
|
||||
10
src/goal.cpp
10
src/goal.cpp
@@ -256,12 +256,16 @@ CommandCost CmdGoalQuestion(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||
if (StrEmpty(text)) return CMD_ERROR;
|
||||
if (is_client) {
|
||||
if (NetworkClientInfo::GetByClientID(client) == nullptr) return CMD_ERROR;
|
||||
/* Only check during pre-flight; the client might have left between
|
||||
* testing and executing. In that case it is fine to just ignore the
|
||||
* fact the client is no longer here. */
|
||||
if (!(flags & DC_EXEC) && _network_server && NetworkClientInfo::GetByClientID(client) == nullptr) return CMD_ERROR;
|
||||
} else {
|
||||
if (company != INVALID_COMPANY && !Company::IsValidID(company)) return CMD_ERROR;
|
||||
}
|
||||
if (CountBits(button_mask) < 1 || CountBits(button_mask) > 3) return CMD_ERROR;
|
||||
if (type >= GOAL_QUESTION_TYPE_COUNT) return CMD_ERROR;
|
||||
uint min_buttons = (type == GQT_QUESTION ? 1 : 0);
|
||||
if (CountBits(button_mask) < min_buttons || CountBits(button_mask) > 3) return CMD_ERROR;
|
||||
if (type >= GQT_END) return CMD_ERROR;
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
if (is_client) {
|
||||
|
||||
155
src/goal_gui.cpp
155
src/goal_gui.cpp
@@ -46,6 +46,8 @@ struct GoalListWindow : public Window {
|
||||
this->vscroll = this->GetScrollbar(WID_GOAL_SCROLLBAR);
|
||||
this->FinishInitNested(window_number);
|
||||
this->owner = (Owner)this->window_number;
|
||||
NWidgetStacked *wi = this->GetWidget<NWidgetStacked>(WID_GOAL_SELECT_BUTTONS);
|
||||
wi->SetDisplayedPlane(window_number == INVALID_COMPANY ? 1 : 0);
|
||||
this->OnInvalidateData(0);
|
||||
}
|
||||
|
||||
@@ -63,37 +65,31 @@ struct GoalListWindow : public Window {
|
||||
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
{
|
||||
if (widget != WID_GOAL_LIST) return;
|
||||
switch (widget) {
|
||||
case WID_GOAL_GLOBAL_BUTTON:
|
||||
ShowGoalsList(INVALID_COMPANY);
|
||||
break;
|
||||
|
||||
int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_GOAL_LIST, WD_FRAMERECT_TOP);
|
||||
int num = 0;
|
||||
for (const Goal *s : Goal::Iterate()) {
|
||||
if (s->company == INVALID_COMPANY) {
|
||||
y--;
|
||||
if (y == 0) {
|
||||
this->HandleClick(s);
|
||||
return;
|
||||
case WID_GOAL_COMPANY_BUTTON:
|
||||
ShowGoalsList(_local_company);
|
||||
break;
|
||||
|
||||
case WID_GOAL_LIST: {
|
||||
int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_GOAL_LIST, WD_FRAMERECT_TOP);
|
||||
for (const Goal *s : Goal::Iterate()) {
|
||||
if (s->company == this->window_number) {
|
||||
if (y == 0) {
|
||||
this->HandleClick(s);
|
||||
return;
|
||||
}
|
||||
y--;
|
||||
}
|
||||
}
|
||||
num++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (num == 0) {
|
||||
y--; // "None" line.
|
||||
if (y < 0) return;
|
||||
}
|
||||
|
||||
y -= 2; // "Company specific goals:" line.
|
||||
if (y < 0) return;
|
||||
|
||||
for (const Goal *s : Goal::Iterate()) {
|
||||
if (s->company == this->window_number && s->company != INVALID_COMPANY) {
|
||||
y--;
|
||||
if (y == 0) {
|
||||
this->HandleClick(s);
|
||||
return;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,28 +157,21 @@ struct GoalListWindow : public Window {
|
||||
uint CountLines()
|
||||
{
|
||||
/* Count number of (non) awarded goals. */
|
||||
uint num_global = 0;
|
||||
uint num_company = 0;
|
||||
uint num = 0;
|
||||
for (const Goal *s : Goal::Iterate()) {
|
||||
if (s->company == INVALID_COMPANY) {
|
||||
num_global++;
|
||||
} else if (s->company == this->window_number) {
|
||||
num_company++;
|
||||
}
|
||||
if (s->company == this->window_number) num++;
|
||||
}
|
||||
|
||||
/* Count the 'none' lines. */
|
||||
if (num_global == 0) num_global = 1;
|
||||
if (num_company == 0) num_company = 1;
|
||||
if (num == 0) num = 1;
|
||||
|
||||
/* Global, company and an empty line before the accepted ones. */
|
||||
return 3 + num_global + num_company;
|
||||
return num;
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
||||
{
|
||||
if (widget != WID_GOAL_LIST) return;
|
||||
Dimension d = maxdim(GetStringBoundingBox(STR_GOALS_GLOBAL_TITLE), GetStringBoundingBox(STR_GOALS_COMPANY_TITLE));
|
||||
Dimension d = GetStringBoundingBox(STR_GOALS_NONE);
|
||||
|
||||
resize->height = d.height;
|
||||
|
||||
@@ -193,26 +182,26 @@ struct GoalListWindow : public Window {
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws either the global goals or the company goal section.
|
||||
* This is a helper method for #DrawWidget.
|
||||
* @param[in,out] pos Vertical line number to draw.
|
||||
* @param cap Number of lines to draw in the window.
|
||||
* @param x Left edge of the text line to draw.
|
||||
* @param y Vertical position of the top edge of the window.
|
||||
* @param right Right edge of the text line to draw.
|
||||
* @param global_section Whether the global goals are printed.
|
||||
* Draws a given column of the goal list.
|
||||
* @param column Which column to draw.
|
||||
* @param wid Pointer to the goal list widget.
|
||||
* @param progress_col_width Width of the progress column.
|
||||
* @return max width of drawn text
|
||||
*/
|
||||
void DrawPartialGoalList(int &pos, const int cap, int x, int y, int right, uint progress_col_width, bool global_section, GoalColumn column) const
|
||||
void DrawListColumn(GoalColumn column, NWidgetBase *wid, uint progress_col_width) const
|
||||
{
|
||||
if (column == GC_GOAL && IsInsideMM(pos, 0, cap)) DrawString(x, right, y + pos * FONT_HEIGHT_NORMAL, global_section ? STR_GOALS_GLOBAL_TITLE : STR_GOALS_COMPANY_TITLE);
|
||||
pos++;
|
||||
|
||||
/* Get column draw area. */
|
||||
int y = wid->pos_y + WD_FRAMERECT_TOP;
|
||||
int x = wid->pos_x + WD_FRAMERECT_LEFT;
|
||||
int right = x + wid->current_x - WD_FRAMERECT_RIGHT;
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
|
||||
int pos = -this->vscroll->GetPosition();
|
||||
const int cap = this->vscroll->GetCapacity();
|
||||
|
||||
uint num = 0;
|
||||
for (const Goal *s : Goal::Iterate()) {
|
||||
if (global_section ? s->company == INVALID_COMPANY : (s->company == this->window_number && s->company != INVALID_COMPANY)) {
|
||||
if (s->company == this->window_number) {
|
||||
if (IsInsideMM(pos, 0, cap)) {
|
||||
switch (column) {
|
||||
case GC_GOAL: {
|
||||
@@ -241,38 +230,12 @@ struct GoalListWindow : public Window {
|
||||
|
||||
if (num == 0) {
|
||||
if (column == GC_GOAL && IsInsideMM(pos, 0, cap)) {
|
||||
StringID str = !global_section && this->window_number == INVALID_COMPANY ? STR_GOALS_SPECTATOR_NONE : STR_GOALS_NONE;
|
||||
DrawString(x, right, y + pos * FONT_HEIGHT_NORMAL, str);
|
||||
DrawString(x, right, y + pos * FONT_HEIGHT_NORMAL, STR_GOALS_NONE);
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a given column of the goal list.
|
||||
* @param column Which column to draw.
|
||||
* @param wid Pointer to the goal list widget.
|
||||
* @param progress_col_width Width of the progress column.
|
||||
* @return max width of drawn text
|
||||
*/
|
||||
void DrawListColumn(GoalColumn column, NWidgetBase *wid, uint progress_col_width) const
|
||||
{
|
||||
/* Get column draw area. */
|
||||
int y = wid->pos_y + WD_FRAMERECT_TOP;
|
||||
int x = wid->pos_x + WD_FRAMERECT_LEFT;
|
||||
int right = x + wid->current_x - WD_FRAMERECT_RIGHT;
|
||||
|
||||
int pos = -this->vscroll->GetPosition();
|
||||
const int cap = this->vscroll->GetCapacity();
|
||||
|
||||
/* Draw partial list with global goals. */
|
||||
DrawPartialGoalList(pos, cap, x, y, right, progress_col_width, true, column);
|
||||
|
||||
/* Draw partial list with company goals. */
|
||||
pos++;
|
||||
DrawPartialGoalList(pos, cap, x, y, right, progress_col_width, false, column);
|
||||
}
|
||||
|
||||
void OnPaint() override
|
||||
{
|
||||
this->DrawWidgets();
|
||||
@@ -313,6 +276,8 @@ struct GoalListWindow : public Window {
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
this->vscroll->SetCount(this->CountLines());
|
||||
this->SetWidgetDisabledState(WID_GOAL_COMPANY_BUTTON, _local_company == COMPANY_SPECTATOR);
|
||||
this->SetWidgetDirty(WID_GOAL_COMPANY_BUTTON);
|
||||
this->SetWidgetDirty(WID_GOAL_LIST);
|
||||
}
|
||||
};
|
||||
@@ -322,6 +287,10 @@ static const NWidgetPart _nested_goals_list_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_GOAL_CAPTION), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GOAL_SELECT_BUTTONS),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_GOAL_GLOBAL_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GOALS_GLOBAL_BUTTON, STR_GOALS_GLOBAL_BUTTON_HELPTEXT),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_GOAL_COMPANY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GOALS_COMPANY_BUTTON, STR_GOALS_COMPANY_BUTTON_HELPTEXT),
|
||||
EndContainer(),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
||||
@@ -375,10 +344,16 @@ struct GoalQuestionWindow : public Window {
|
||||
if (n == 3) break;
|
||||
}
|
||||
this->buttons = n;
|
||||
assert(this->buttons > 0 && this->buttons < 4);
|
||||
assert(this->buttons < 4);
|
||||
|
||||
this->CreateNestedTree();
|
||||
this->GetWidget<NWidgetStacked>(WID_GQ_BUTTONS)->SetDisplayedPlane(this->buttons - 1);
|
||||
if (this->buttons == 0) {
|
||||
this->GetWidget<NWidgetStacked>(WID_GQ_BUTTONS)->SetDisplayedPlane(SZSP_HORIZONTAL);
|
||||
this->GetWidget<NWidgetStacked>(WID_GQ_BUTTON_SPACER)->SetDisplayedPlane(SZSP_HORIZONTAL);
|
||||
} else {
|
||||
this->GetWidget<NWidgetStacked>(WID_GQ_BUTTONS)->SetDisplayedPlane(this->buttons - 1);
|
||||
this->GetWidget<NWidgetStacked>(WID_GQ_BUTTON_SPACER)->SetDisplayedPlane(0);
|
||||
}
|
||||
this->FinishInitNested(window_number);
|
||||
}
|
||||
|
||||
@@ -463,7 +438,9 @@ static const NWidgetPart _nested_goal_question_widgets_question[] = {
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_3), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GQ_BUTTON_SPACER),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
@@ -488,7 +465,9 @@ static const NWidgetPart _nested_goal_question_widgets_info[] = {
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_3), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GQ_BUTTON_SPACER),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
@@ -513,7 +492,9 @@ static const NWidgetPart _nested_goal_question_widgets_warning[] = {
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_GQ_BUTTON_3), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GQ_BUTTON_SPACER),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
@@ -538,7 +519,9 @@ static const NWidgetPart _nested_goal_question_widgets_error[] = {
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_GQ_BUTTON_3), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GQ_BUTTON_SPACER),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
@@ -578,6 +561,6 @@ static WindowDesc _goal_question_list_desc[] = {
|
||||
*/
|
||||
void ShowGoalQuestion(uint16 id, byte type, uint32 button_mask, const char *question)
|
||||
{
|
||||
assert(type < GOAL_QUESTION_TYPE_COUNT);
|
||||
assert(type < GQT_END);
|
||||
new GoalQuestionWindow(&_goal_question_list_desc[type], id, type == 3 ? TC_WHITE : TC_BLACK, button_mask, question);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,14 @@
|
||||
#include "core/enum_type.hpp"
|
||||
|
||||
static const uint32 GOAL_QUESTION_BUTTON_COUNT = 18; ///< Amount of buttons available.
|
||||
static const byte GOAL_QUESTION_TYPE_COUNT = 4; ///< Amount of question types.
|
||||
|
||||
enum GoalQuestionType : byte {
|
||||
GQT_QUESTION = 0,
|
||||
GQT_INFORMATION = 1,
|
||||
GQT_WARNING = 2,
|
||||
GQT_ERROR = 3,
|
||||
GQT_END = 4,
|
||||
};
|
||||
|
||||
/** Types of goal destinations */
|
||||
enum GoalType : byte {
|
||||
|
||||
@@ -113,7 +113,7 @@ static NWidgetBase *MakeNWidgetCompanyLines(int *biggest_index)
|
||||
uint line_height = std::max<uint>(GetSpriteSize(SPR_COMPANY_ICON).height, FONT_HEIGHT_NORMAL) + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
||||
|
||||
for (int widnum = WID_GL_FIRST_COMPANY; widnum <= WID_GL_LAST_COMPANY; widnum++) {
|
||||
NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum);
|
||||
NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_BROWN, widnum);
|
||||
panel->SetMinimalSize(246, line_height);
|
||||
panel->SetFill(1, 0);
|
||||
panel->SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP);
|
||||
@@ -125,12 +125,12 @@ static NWidgetBase *MakeNWidgetCompanyLines(int *biggest_index)
|
||||
|
||||
static const NWidgetPart _nested_graph_legend_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_KEY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_KEY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_GL_BACKGROUND),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_GL_BACKGROUND),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
||||
@@ -165,9 +165,15 @@ struct ValuesInterval {
|
||||
struct BaseGraphWindow : Window {
|
||||
protected:
|
||||
static const int GRAPH_MAX_DATASETS = 64;
|
||||
static const int GRAPH_AXIS_LINE_COLOUR = PC_BLACK;
|
||||
static const int GRAPH_BASE_COLOUR = GREY_SCALE(2);
|
||||
static const int GRAPH_GRID_COLOUR = GREY_SCALE(3);
|
||||
static const int GRAPH_AXIS_LINE_COLOUR = GREY_SCALE(1);
|
||||
static const int GRAPH_ZERO_LINE_COLOUR = GREY_SCALE(8);
|
||||
static const int GRAPH_YEAR_LINE_COLOUR = GREY_SCALE(5);
|
||||
static const int GRAPH_NUM_MONTHS = 24; ///< Number of months displayed in the graph.
|
||||
|
||||
static const TextColour GRAPH_AXIS_LABEL_COLOUR = TC_BLACK; ///< colour of the graph axis label.
|
||||
|
||||
static const int MIN_GRAPH_NUM_LINES_Y = 9; ///< Minimal number of horizontal lines to draw.
|
||||
static const int MIN_GRID_PIXEL_SIZE = 20; ///< Minimum distance between graph lines.
|
||||
|
||||
@@ -175,7 +181,6 @@ protected:
|
||||
byte num_dataset;
|
||||
byte num_on_x_axis;
|
||||
byte num_vert_lines;
|
||||
static const TextColour graph_axis_label_colour = TC_BLACK; ///< colour of the graph axis label.
|
||||
|
||||
/* The starting month and year that values are plotted against. If month is
|
||||
* 0xFF, use x_values_start and x_values_increment below instead. */
|
||||
@@ -292,12 +297,10 @@ protected:
|
||||
static_assert(GRAPH_MAX_DATASETS >= (int)NUM_CARGO && GRAPH_MAX_DATASETS >= (int)MAX_COMPANIES);
|
||||
assert(this->num_vert_lines > 0);
|
||||
|
||||
byte grid_colour = _colour_gradient[COLOUR_GREY][4];
|
||||
|
||||
/* Rect r will be adjusted to contain just the graph, with labels being
|
||||
* placed outside the area. */
|
||||
r.top += 5 + GetCharacterHeight(FS_SMALL) / 2;
|
||||
r.bottom -= (this->month == 0xFF ? 1 : 3) * GetCharacterHeight(FS_SMALL) + 4;
|
||||
r.bottom -= (this->month == 0xFF ? 1 : 2) * GetCharacterHeight(FS_SMALL) + 4;
|
||||
r.left += 9;
|
||||
r.right -= 5;
|
||||
|
||||
@@ -326,7 +329,7 @@ protected:
|
||||
x_axis_offset = (int)((r.bottom - r.top) * (double)interval.highest / (double)interval_size);
|
||||
|
||||
/* Draw the background of the graph itself. */
|
||||
GfxFillRect(r.left, r.top, r.right, r.bottom, GREY_SCALE(2));
|
||||
GfxFillRect(r.left, r.top, r.right, r.bottom, GRAPH_BASE_COLOUR);
|
||||
|
||||
/* Draw the vertical grid lines. */
|
||||
|
||||
@@ -334,7 +337,7 @@ protected:
|
||||
x = r.left + x_sep;
|
||||
|
||||
for (int i = 0; i < this->num_vert_lines; i++) {
|
||||
GfxFillRect(x, r.top, x, r.bottom, grid_colour);
|
||||
GfxFillRect(x, r.top, x, r.bottom, GRAPH_GRID_COLOUR);
|
||||
x += x_sep;
|
||||
}
|
||||
|
||||
@@ -343,7 +346,7 @@ protected:
|
||||
|
||||
for (int i = 0; i < (num_hori_lines + 1); i++) {
|
||||
GfxFillRect(r.left - 3, y, r.left - 1, y, GRAPH_AXIS_LINE_COLOUR);
|
||||
GfxFillRect(r.left, y, r.right, y, grid_colour);
|
||||
GfxFillRect(r.left, y, r.right, y, GRAPH_GRID_COLOUR);
|
||||
y -= y_sep;
|
||||
}
|
||||
|
||||
@@ -352,7 +355,7 @@ protected:
|
||||
|
||||
/* Draw the x axis. */
|
||||
y = x_axis_offset + r.top;
|
||||
GfxFillRect(r.left, y, r.right, y, GRAPH_AXIS_LINE_COLOUR);
|
||||
GfxFillRect(r.left, y, r.right, y, GRAPH_ZERO_LINE_COLOUR);
|
||||
|
||||
/* Find the largest value that will be drawn. */
|
||||
if (this->num_on_x_axis == 0) return;
|
||||
@@ -369,13 +372,13 @@ protected:
|
||||
for (int i = 0; i < (num_hori_lines + 1); i++) {
|
||||
SetDParam(0, this->format_str_y_axis);
|
||||
SetDParam(1, y_label);
|
||||
DrawString(r.left - label_width - 4, r.left - 4, y, STR_GRAPH_Y_LABEL, graph_axis_label_colour, SA_RIGHT);
|
||||
DrawString(r.left - label_width - 4, r.left - 4, y, STR_GRAPH_Y_LABEL, GRAPH_AXIS_LABEL_COLOUR, SA_RIGHT);
|
||||
|
||||
y_label -= y_label_separation;
|
||||
y += y_sep;
|
||||
}
|
||||
|
||||
/* draw strings on the x axis */
|
||||
/* Draw x-axis labels and markings for graphs based on financial quarters and years. */
|
||||
if (this->month != 0xFF) {
|
||||
x = r.left;
|
||||
y = r.bottom + 2;
|
||||
@@ -383,26 +386,28 @@ protected:
|
||||
Year year = this->year;
|
||||
for (int i = 0; i < this->num_on_x_axis; i++) {
|
||||
SetDParam(0, month + STR_MONTH_ABBREV_JAN);
|
||||
SetDParam(1, month + STR_MONTH_ABBREV_JAN + 2);
|
||||
SetDParam(2, year);
|
||||
DrawStringMultiLine(x, x + x_sep, y, this->height, month == 0 ? STR_GRAPH_X_LABEL_MONTH_YEAR : STR_GRAPH_X_LABEL_MONTH, graph_axis_label_colour);
|
||||
SetDParam(1, year);
|
||||
DrawStringMultiLine(x, x + x_sep, y, this->height, month == 0 ? STR_GRAPH_X_LABEL_MONTH_YEAR : STR_GRAPH_X_LABEL_MONTH, GRAPH_AXIS_LABEL_COLOUR, SA_LEFT);
|
||||
|
||||
month += 3;
|
||||
if (month >= 12) {
|
||||
month = 0;
|
||||
year++;
|
||||
|
||||
/* Draw a lighter grid line between years. Top and bottom adjustments ensure we don't draw over top and bottom horizontal grid lines. */
|
||||
GfxFillRect(x + x_sep, r.top + 1, x + x_sep, r.bottom - 1, GRAPH_YEAR_LINE_COLOUR);
|
||||
}
|
||||
x += x_sep;
|
||||
}
|
||||
} else {
|
||||
/* Draw the label under the data point rather than on the grid line. */
|
||||
/* Draw x-axis labels for graphs not based on quarterly performance (cargo payment rates). */
|
||||
x = r.left;
|
||||
y = r.bottom + 2;
|
||||
uint16 label = this->x_values_start;
|
||||
|
||||
for (int i = 0; i < this->num_on_x_axis; i++) {
|
||||
SetDParam(0, label);
|
||||
DrawString(x + 1, x + x_sep - 1, y, STR_GRAPH_Y_LABEL_NUMBER, graph_axis_label_colour, SA_HOR_CENTER);
|
||||
DrawString(x + 1, x + x_sep - 1, y, STR_GRAPH_Y_LABEL_NUMBER, GRAPH_AXIS_LABEL_COLOUR, SA_HOR_CENTER);
|
||||
|
||||
label += this->x_values_increment;
|
||||
x += x_sep;
|
||||
@@ -492,13 +497,13 @@ public:
|
||||
|
||||
uint x_label_width = 0;
|
||||
|
||||
/* Draw x-axis labels and markings for graphs based on financial quarters and years. */
|
||||
if (this->month != 0xFF) {
|
||||
byte month = this->month;
|
||||
Year year = this->year;
|
||||
for (int i = 0; i < this->num_on_x_axis; i++) {
|
||||
SetDParam(0, month + STR_MONTH_ABBREV_JAN);
|
||||
SetDParam(1, month + STR_MONTH_ABBREV_JAN + 2);
|
||||
SetDParam(2, year);
|
||||
SetDParam(1, year);
|
||||
x_label_width = std::max(x_label_width, GetStringBoundingBox(month == 0 ? STR_GRAPH_X_LABEL_MONTH_YEAR : STR_GRAPH_X_LABEL_MONTH).width);
|
||||
|
||||
month += 3;
|
||||
@@ -508,7 +513,7 @@ public:
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Draw the label under the data point rather than on the grid line. */
|
||||
/* Draw x-axis labels for graphs not based on quarterly performance (cargo payment rates). */
|
||||
SetDParamMaxValue(0, this->x_values_start + this->num_on_x_axis * this->x_values_increment, 0, FS_SMALL);
|
||||
x_label_width = GetStringBoundingBox(STR_GRAPH_Y_LABEL_NUMBER).width;
|
||||
}
|
||||
@@ -629,19 +634,19 @@ struct OperatingProfitGraphWindow : BaseGraphWindow {
|
||||
|
||||
static const NWidgetPart _nested_operating_profit_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_OPERATING_PROFIT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_OPERATING_PROFIT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_CV_BACKGROUND),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_CV_BACKGROUND),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_CV_GRAPH), SetMinimalSize(576, 160), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 160), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_CV_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@@ -680,19 +685,19 @@ struct IncomeGraphWindow : BaseGraphWindow {
|
||||
|
||||
static const NWidgetPart _nested_income_graph_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_INCOME_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_INCOME_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_CV_BACKGROUND),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_CV_BACKGROUND),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_CV_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_CV_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@@ -729,19 +734,19 @@ struct DeliveredCargoGraphWindow : BaseGraphWindow {
|
||||
|
||||
static const NWidgetPart _nested_delivered_cargo_graph_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_CARGO_DELIVERED_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_CARGO_DELIVERED_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_CV_BACKGROUND),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_CV_BACKGROUND),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_CV_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_CV_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@@ -784,20 +789,20 @@ struct PerformanceHistoryGraphWindow : BaseGraphWindow {
|
||||
|
||||
static const NWidgetPart _nested_performance_history_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_COMPANY_PERFORMANCE_RATINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_PHG_DETAILED_PERFORMANCE), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_PERFORMANCE_DETAIL_KEY, STR_GRAPH_PERFORMANCE_DETAIL_TOOLTIP),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_PHG_KEY), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_COMPANY_PERFORMANCE_RATINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_PHG_DETAILED_PERFORMANCE), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_PERFORMANCE_DETAIL_KEY, STR_GRAPH_PERFORMANCE_DETAIL_TOOLTIP),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_PHG_KEY), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_PHG_BACKGROUND),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_PHG_BACKGROUND),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_PHG_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(WWT_EMPTY, COLOUR_BROWN, WID_PHG_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_PHG_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_PHG_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@@ -834,19 +839,19 @@ struct CompanyValueGraphWindow : BaseGraphWindow {
|
||||
|
||||
static const NWidgetPart _nested_company_value_graph_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_COMPANY_VALUES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_COMPANY_VALUES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_CV_BACKGROUND),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_CV_BACKGROUND),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_CV_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_CV_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@@ -949,7 +954,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
|
||||
bool lowered = !HasBit(_legend_excluded_cargo, cs->Index());
|
||||
|
||||
/* Redraw box if lowered */
|
||||
if (lowered) DrawFrameRect(r.left, y, r.right, y + this->line_height - 1, COLOUR_ORANGE, lowered ? FR_LOWERED : FR_NONE);
|
||||
if (lowered) DrawFrameRect(r.left, y, r.right, y + this->line_height - 1, COLOUR_BROWN, lowered ? FR_LOWERED : FR_NONE);
|
||||
|
||||
byte clk_dif = lowered ? 1 : 0;
|
||||
int rect_x = clk_dif + (rtl ? r.right - 12 : r.left + WD_FRAMERECT_LEFT);
|
||||
@@ -1044,28 +1049,28 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
|
||||
|
||||
static const NWidgetPart _nested_cargo_payment_rates_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_CPR_BACKGROUND), SetMinimalSize(568, 128),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_CPR_BACKGROUND), SetMinimalSize(568, 128),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_GREY, WID_CPR_HEADER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_TITLE, STR_NULL),
|
||||
NWidget(WWT_TEXT, COLOUR_BROWN, WID_CPR_HEADER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_TITLE, STR_NULL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_CPR_GRAPH), SetMinimalSize(495, 0), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CPR_GRAPH), SetMinimalSize(495, 0), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 24), SetFill(0, 1),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_CPR_ENABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_ENABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_ENABLE_ALL), SetFill(1, 0),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_CPR_DISABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_DISABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_DISABLE_ALL), SetFill(1, 0),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CPR_ENABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_ENABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_ENABLE_ALL), SetFill(1, 0),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CPR_DISABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_DISABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_DISABLE_ALL), SetFill(1, 0),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 4),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_MATRIX, COLOUR_ORANGE, WID_CPR_MATRIX), SetResize(0, 2), SetMatrixDataTip(1, 0, STR_GRAPH_CARGO_PAYMENT_TOGGLE_CARGO), SetScrollbar(WID_CPR_MATRIX_SCROLLBAR),
|
||||
NWidget(NWID_VSCROLLBAR, COLOUR_ORANGE, WID_CPR_MATRIX_SCROLLBAR),
|
||||
NWidget(WWT_MATRIX, COLOUR_BROWN, WID_CPR_MATRIX), SetResize(0, 2), SetMatrixDataTip(1, 0, STR_GRAPH_CARGO_PAYMENT_TOGGLE_CARGO), SetScrollbar(WID_CPR_MATRIX_SCROLLBAR),
|
||||
NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_CPR_MATRIX_SCROLLBAR),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 24), SetFill(0, 1),
|
||||
EndContainer(),
|
||||
@@ -1073,9 +1078,9 @@ static const NWidgetPart _nested_cargo_payment_rates_widgets[] = {
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(WD_RESIZEBOX_WIDTH, 0), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_GREY, WID_CPR_FOOTER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_X_LABEL, STR_NULL),
|
||||
NWidget(WWT_TEXT, COLOUR_BROWN, WID_CPR_FOOTER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_X_LABEL, STR_NULL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_CPR_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CPR_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
@@ -1259,12 +1264,12 @@ public:
|
||||
|
||||
static const NWidgetPart _nested_company_league_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_COMPANY_LEAGUE_TABLE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_COMPANY_LEAGUE_TABLE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_CL_BACKGROUND), SetMinimalSize(400, 0), SetMinimalTextLines(15, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_CL_BACKGROUND), SetMinimalSize(400, 0), SetMinimalTextLines(15, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM),
|
||||
};
|
||||
|
||||
static WindowDesc _company_league_desc(
|
||||
@@ -1534,7 +1539,7 @@ static NWidgetBase *MakePerformanceDetailPanels(int *biggest_index)
|
||||
|
||||
NWidgetVertical *vert = new NWidgetVertical(NC_EQUALSIZE);
|
||||
for (int widnum = WID_PRD_SCORE_FIRST; widnum <= WID_PRD_SCORE_LAST; widnum++) {
|
||||
NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum);
|
||||
NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_BROWN, widnum);
|
||||
panel->SetFill(1, 1);
|
||||
panel->SetDataTip(0x0, performance_tips[widnum - WID_PRD_SCORE_FIRST]);
|
||||
vert->Add(panel);
|
||||
@@ -1546,17 +1551,17 @@ static NWidgetBase *MakePerformanceDetailPanels(int *biggest_index)
|
||||
/** Make a number of rows with buttons for each company for the performance rating detail window. */
|
||||
NWidgetBase *MakeCompanyButtonRowsGraphGUI(int *biggest_index)
|
||||
{
|
||||
return MakeCompanyButtonRows(biggest_index, WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST, 8, STR_PERFORMANCE_DETAIL_SELECT_COMPANY_TOOLTIP);
|
||||
return MakeCompanyButtonRows(biggest_index, WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST, COLOUR_BROWN, 8, STR_PERFORMANCE_DETAIL_SELECT_COMPANY_TOOLTIP);
|
||||
}
|
||||
|
||||
static const NWidgetPart _nested_performance_rating_detail_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_PERFORMANCE_DETAIL, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_PERFORMANCE_DETAIL, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN),
|
||||
NWidgetFunction(MakeCompanyButtonRowsGraphGUI), SetPadding(0, 1, 1, 2),
|
||||
EndContainer(),
|
||||
NWidgetFunction(MakePerformanceDetailPanels),
|
||||
|
||||
@@ -741,9 +741,9 @@ public:
|
||||
assert(vehgroup.NumVehicles() > 0);
|
||||
v = vehgroup.vehicles_begin[0];
|
||||
/*
|
||||
No VehicleClicked(v) support for now, because don't want
|
||||
to enable any contextual actions except perhaps clicking/ctrl-clicking to clone orders.
|
||||
*/
|
||||
* No VehicleClicked(v) support for now, because don't want
|
||||
* to enable any contextual actions except perhaps clicking/ctrl-clicking to clone orders.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ struct EndGameWindow : EndGameHighScoreBaseWindow {
|
||||
this->window_number = SP_MULTIPLAYER;
|
||||
this->rank = SaveHighScoreValueNetwork();
|
||||
} else {
|
||||
/* in single player _local company is always valid */
|
||||
/* in singleplayer mode _local company is always valid */
|
||||
const Company *c = Company::Get(_local_company);
|
||||
this->window_number = SP_CUSTOM;
|
||||
this->rank = SaveHighScoreValue(c);
|
||||
@@ -183,7 +183,7 @@ struct HighScoreWindow : EndGameHighScoreBaseWindow {
|
||||
this->SetupHighScoreEndWindow();
|
||||
Point pt = this->GetTopLeft(ScaleGUITrad(640), ScaleGUITrad(480));
|
||||
|
||||
SetDParam(0, ORIGINAL_END_YEAR);
|
||||
SetDParam(0, _settings_game.game_creation.ending_year);
|
||||
DrawStringMultiLine(pt.x + ScaleGUITrad(70), pt.x + ScaleGUITrad(570), pt.y, pt.y + ScaleGUITrad(140), !_networking ? STR_HIGHSCORE_TOP_COMPANIES_WHO_REACHED : STR_HIGHSCORE_TOP_COMPANIES_NETWORK_GAME, TC_FROMSTRING, SA_CENTER);
|
||||
|
||||
/* Draw Highscore peepz */
|
||||
|
||||
@@ -569,8 +569,8 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
|
||||
if (_settings_client.sound.ambient) {
|
||||
switch (m & 7) {
|
||||
case 2: SndPlayTileFx(SND_2D_RIP_2, tile); break;
|
||||
case 6: SndPlayTileFx(SND_29_RIP, tile); break;
|
||||
case 2: SndPlayTileFx(SND_2D_SUGAR_MINE_1, tile); break;
|
||||
case 6: SndPlayTileFx(SND_29_SUGAR_MINE_2, tile); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
byte m = GetAnimationFrame(tile);
|
||||
|
||||
if (_industry_anim_offs_toffee[m] == 0xFF && _settings_client.sound.ambient) {
|
||||
SndPlayTileFx(SND_30_CARTOON_SOUND, tile);
|
||||
SndPlayTileFx(SND_30_TOFFEE_QUARRY, tile);
|
||||
}
|
||||
|
||||
if (++m >= 70) {
|
||||
@@ -635,9 +635,9 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
byte m = GetAnimationFrame(tile) + 1;
|
||||
|
||||
switch (m) {
|
||||
case 1: if (_settings_client.sound.ambient) SndPlayTileFx(SND_2C_MACHINERY, tile); break;
|
||||
case 23: if (_settings_client.sound.ambient) SndPlayTileFx(SND_2B_COMEDY_HIT, tile); break;
|
||||
case 28: if (_settings_client.sound.ambient) SndPlayTileFx(SND_2A_EXTRACT_AND_POP, tile); break;
|
||||
case 1: if (_settings_client.sound.ambient) SndPlayTileFx(SND_2C_TOY_FACTORY_1, tile); break;
|
||||
case 23: if (_settings_client.sound.ambient) SndPlayTileFx(SND_2B_TOY_FACTORY_2, tile); break;
|
||||
case 28: if (_settings_client.sound.ambient) SndPlayTileFx(SND_2A_TOY_FACTORY_3, tile); break;
|
||||
default:
|
||||
if (m >= 50) {
|
||||
int n = GetIndustryAnimationLoop(tile) + 1;
|
||||
@@ -700,7 +700,7 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
byte m = GetAnimationFrame(tile);
|
||||
if (!(m & 0x40)) {
|
||||
SetAnimationFrame(tile, m | 0x40);
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_0B_MINING_MACHINERY, tile);
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_0B_MINE, tile);
|
||||
}
|
||||
if (state & 7) return;
|
||||
} else {
|
||||
@@ -801,7 +801,7 @@ static void TileLoopIndustry_BubbleGenerator(TileIndex tile)
|
||||
{ 49, 59, 60, 65 },
|
||||
};
|
||||
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_2E_EXTRACT_AND_POP, tile);
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_2E_BUBBLE_GENERATOR, tile);
|
||||
|
||||
int dir = Random() & 3;
|
||||
|
||||
@@ -899,7 +899,7 @@ static void TileLoop_Industry(TileIndex tile)
|
||||
|
||||
case GFX_POWERPLANT_SPARKS:
|
||||
if (Chance16(1, 3)) {
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_0C_ELECTRIC_SPARK, tile);
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_0C_POWER_STATION, tile);
|
||||
AddAnimatedTile(tile);
|
||||
}
|
||||
break;
|
||||
@@ -1098,7 +1098,7 @@ static bool SearchLumberMillTrees(TileIndex tile, void *user_data)
|
||||
|
||||
_industry_sound_ctr = 1;
|
||||
_industry_sound_tile = tile;
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_38_CHAINSAW, tile);
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_38_LUMBER_MILL_1, tile);
|
||||
|
||||
DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||
|
||||
@@ -1200,10 +1200,10 @@ void OnTick_Industry()
|
||||
_industry_sound_ctr++;
|
||||
|
||||
if (_industry_sound_ctr == 75) {
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_37_BALLOON_SQUEAK, _industry_sound_tile);
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_37_LUMBER_MILL_2, _industry_sound_tile);
|
||||
} else if (_industry_sound_ctr == 160) {
|
||||
_industry_sound_ctr = 0;
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_36_CARTOON_CRASH, _industry_sound_tile);
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_36_LUMBER_MILL_3, _industry_sound_tile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "smallmap_gui.h"
|
||||
#include "widgets/dropdown_type.h"
|
||||
#include "widgets/industry_widget.h"
|
||||
#include "clear_map.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
@@ -244,6 +245,14 @@ static const NWidgetPart _nested_build_industry_widgets[] = {
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_DARK_GREEN),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SELECTION, COLOUR_DARK_GREEN, WID_DPI_SCENARIO_EDITOR_PANE),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, WID_DPI_CREATE_RANDOM_INDUSTRIES_WIDGET), SetMinimalSize(0, 12), SetFill(1, 0), SetResize(1, 0),
|
||||
SetDataTip(STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES, STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, WID_DPI_REMOVE_ALL_INDUSTRIES_WIDGET), SetMinimalSize(0, 12), SetFill(1, 0), SetResize(1, 0),
|
||||
SetDataTip(STR_FUND_INDUSTRY_REMOVE_ALL_INDUSTRIES, STR_FUND_INDUSTRY_REMOVE_ALL_INDUSTRIES_TOOLTIP),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, WID_DPI_MATRIX_WIDGET), SetMatrixDataTip(1, 0, STR_FUND_INDUSTRY_SELECTION_TOOLTIP), SetFill(1, 0), SetResize(1, 1), SetScrollbar(WID_DPI_SCROLLBAR),
|
||||
NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, WID_DPI_SCROLLBAR),
|
||||
@@ -289,11 +298,6 @@ class BuildIndustryWindow : public Window {
|
||||
this->enabled[i] = false;
|
||||
}
|
||||
|
||||
if (_game_mode == GM_EDITOR) { // give room for the Many Random "button"
|
||||
this->index[this->count] = INVALID_INDUSTRYTYPE;
|
||||
this->enabled[this->count] = true;
|
||||
this->count++;
|
||||
}
|
||||
/* Fill the arrays with industries.
|
||||
* The tests performed after the enabled allow to load the industries
|
||||
* In the same way they are inserted by grf (if any)
|
||||
@@ -392,6 +396,13 @@ public:
|
||||
this->FinishInitNested(0);
|
||||
|
||||
this->SetButtons();
|
||||
|
||||
/* Show scenario editor tools in editor. */
|
||||
if (_game_mode != GM_EDITOR) {
|
||||
auto *se_tools = this->GetWidget<NWidgetStacked>(WID_DPI_SCENARIO_EDITOR_PANE);
|
||||
se_tools->SetDisplayedPlane(SZSP_HORIZONTAL);
|
||||
this->ReInit();
|
||||
}
|
||||
}
|
||||
|
||||
void OnInit() override
|
||||
@@ -578,9 +589,53 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static void AskManyRandomIndustriesCallback(Window *w, bool confirmed)
|
||||
{
|
||||
if (!confirmed) return;
|
||||
|
||||
if (Town::GetNumItems() == 0) {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_INDUSTRIES, STR_ERROR_MUST_FOUND_TOWN_FIRST, WL_INFO);
|
||||
} else {
|
||||
extern void GenerateIndustries();
|
||||
_generating_world = true;
|
||||
GenerateIndustries();
|
||||
_generating_world = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void AskRemoveAllIndustriesCallback(Window *w, bool confirmed)
|
||||
{
|
||||
if (!confirmed) return;
|
||||
|
||||
for (Industry *industry : Industry::Iterate()) delete industry;
|
||||
|
||||
/* Clear farmland. */
|
||||
for (TileIndex tile = 0; tile < MapSize(); tile++) {
|
||||
if (IsTileType(tile, MP_CLEAR) && GetRawClearGround(tile) == CLEAR_FIELDS) {
|
||||
MakeClear(tile, CLEAR_GRASS, 3);
|
||||
}
|
||||
}
|
||||
|
||||
MarkWholeScreenDirty();
|
||||
}
|
||||
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_DPI_CREATE_RANDOM_INDUSTRIES_WIDGET: {
|
||||
assert(_game_mode == GM_EDITOR);
|
||||
this->HandleButtonClick(WID_DPI_CREATE_RANDOM_INDUSTRIES_WIDGET);
|
||||
ShowQuery(STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES_CAPTION, STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES_QUERY, nullptr, AskManyRandomIndustriesCallback);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_DPI_REMOVE_ALL_INDUSTRIES_WIDGET: {
|
||||
assert(_game_mode == GM_EDITOR);
|
||||
this->HandleButtonClick(WID_DPI_REMOVE_ALL_INDUSTRIES_WIDGET);
|
||||
ShowQuery(STR_FUND_INDUSTRY_REMOVE_ALL_INDUSTRIES_CAPTION, STR_FUND_INDUSTRY_REMOVE_ALL_INDUSTRIES_QUERY, nullptr, AskRemoveAllIndustriesCallback);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_DPI_MATRIX_WIDGET: {
|
||||
int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_DPI_MATRIX_WIDGET);
|
||||
if (y < this->count) { // Is it within the boundaries of available data?
|
||||
@@ -610,22 +665,13 @@ public:
|
||||
break;
|
||||
|
||||
case WID_DPI_FUND_WIDGET: {
|
||||
if (this->selected_type == INVALID_INDUSTRYTYPE) {
|
||||
this->HandleButtonClick(WID_DPI_FUND_WIDGET);
|
||||
|
||||
if (Town::GetNumItems() == 0) {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_INDUSTRIES, STR_ERROR_MUST_FOUND_TOWN_FIRST, WL_INFO);
|
||||
if (this->selected_type != INVALID_INDUSTRYTYPE) {
|
||||
if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 2 && GetIndustrySpec(this->selected_type)->IsRawIndustry()) {
|
||||
DoCommandP(0, this->selected_type, InteractiveRandom(), CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY));
|
||||
this->HandleButtonClick(WID_DPI_FUND_WIDGET);
|
||||
} else {
|
||||
extern void GenerateIndustries();
|
||||
_generating_world = true;
|
||||
GenerateIndustries();
|
||||
_generating_world = false;
|
||||
HandlePlacePushButton(this, WID_DPI_FUND_WIDGET, SPR_CURSOR_INDUSTRY, HT_RECT);
|
||||
}
|
||||
} else if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 2 && GetIndustrySpec(this->selected_type)->IsRawIndustry()) {
|
||||
DoCommandP(0, this->selected_type, InteractiveRandom(), CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY));
|
||||
this->HandleButtonClick(WID_DPI_FUND_WIDGET);
|
||||
} else {
|
||||
HandlePlacePushButton(this, WID_DPI_FUND_WIDGET, SPR_CURSOR_INDUSTRY, HT_RECT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
12
src/ini.cpp
12
src/ini.cpp
@@ -92,17 +92,15 @@ bool IniFile::SaveToDisk(const std::string &filename)
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* _tcsncpy = strcpy is TCHAR is char, but isn't when TCHAR is wchar. */
|
||||
# undef strncpy
|
||||
/* Allocate space for one more \0 character. */
|
||||
TCHAR tfilename[MAX_PATH + 1], tfile_new[MAX_PATH + 1];
|
||||
_tcsncpy(tfilename, OTTD2FS(filename.c_str()), MAX_PATH);
|
||||
_tcsncpy(tfile_new, OTTD2FS(file_new.c_str()), MAX_PATH);
|
||||
wchar_t tfilename[MAX_PATH + 1], tfile_new[MAX_PATH + 1];
|
||||
wcsncpy(tfilename, OTTD2FS(filename.c_str()), MAX_PATH);
|
||||
wcsncpy(tfile_new, OTTD2FS(file_new.c_str()), MAX_PATH);
|
||||
/* SHFileOperation wants a double '\0' terminated string. */
|
||||
tfilename[MAX_PATH - 1] = '\0';
|
||||
tfile_new[MAX_PATH - 1] = '\0';
|
||||
tfilename[_tcslen(tfilename) + 1] = '\0';
|
||||
tfile_new[_tcslen(tfile_new) + 1] = '\0';
|
||||
tfilename[wcslen(tfilename) + 1] = '\0';
|
||||
tfile_new[wcslen(tfile_new) + 1] = '\0';
|
||||
|
||||
/* Rename file without any user confirmation. */
|
||||
SHFILEOPSTRUCT shfopt;
|
||||
|
||||
@@ -1062,6 +1062,7 @@ static bool MakeLake(TileIndex tile, void *user_data)
|
||||
TileIndex t2 = tile + TileOffsByDiagDir(d);
|
||||
if (IsWaterTile(t2)) {
|
||||
MakeRiver(tile, Random());
|
||||
MarkTileDirtyByTile(tile);
|
||||
/* Remove desert directly around the river tile. */
|
||||
TileIndex t = tile;
|
||||
CircularTileSearch(&t, RIVER_OFFSET_DESERT_DISTANCE, RiverModifyDesertZone, nullptr);
|
||||
@@ -1135,6 +1136,7 @@ static void River_FoundEndNode(AyStar *aystar, OpenListNode *current)
|
||||
TileIndex tile = path->node.tile;
|
||||
if (!IsWaterTile(tile)) {
|
||||
MakeRiver(tile, Random());
|
||||
MarkTileDirtyByTile(tile);
|
||||
/* Remove desert directly around the river tile. */
|
||||
CircularTileSearch(&tile, RIVER_OFFSET_DESERT_DISTANCE, RiverModifyDesertZone, nullptr);
|
||||
}
|
||||
@@ -1247,6 +1249,7 @@ static bool FlowRiver(TileIndex spring, TileIndex begin)
|
||||
DistanceManhattan(spring, lakeCenter) > _settings_game.game_creation.min_river_length) {
|
||||
end = lakeCenter;
|
||||
MakeRiver(lakeCenter, Random());
|
||||
MarkTileDirtyByTile(lakeCenter);
|
||||
/* Remove desert directly around the river tile. */
|
||||
CircularTileSearch(&lakeCenter, RIVER_OFFSET_DESERT_DISTANCE, RiverModifyDesertZone, nullptr);
|
||||
lakeCenter = end;
|
||||
@@ -1368,8 +1371,11 @@ void GenerateLandscape(byte mode)
|
||||
/* Do not call IncreaseGeneratingWorldProgress() before FixSlopes(),
|
||||
* it allows screen redraw. Drawing of broken slopes crashes the game */
|
||||
FixSlopes();
|
||||
MarkWholeScreenDirty();
|
||||
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
|
||||
|
||||
ConvertGroundTilesIntoWaterTiles();
|
||||
MarkWholeScreenDirty();
|
||||
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
|
||||
|
||||
if (_settings_game.game_creation.landscape == LT_TROPIC) CreateDesertOrRainForest();
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
set(MASTER_LANG_FILE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/english.txt
|
||||
)
|
||||
|
||||
set(LANG_SOURCE_FILES
|
||||
${MASTER_LANG_FILE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/afrikaans.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/arabic_egypt.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/basque.txt
|
||||
@@ -10,7 +15,6 @@ set(LANG_SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/czech.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/danish.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dutch.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/english.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/english_AU.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/english_US.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/esperanto.txt
|
||||
@@ -75,7 +79,7 @@ foreach(LANG_SOURCE_FILE IN LISTS LANG_SOURCE_FILES)
|
||||
-s ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-d ${LANG_BINARY_DIR}
|
||||
${LANG_SOURCE_FILE}
|
||||
DEPENDS strgen
|
||||
DEPENDS strgen ${MASTER_LANG_FILE}
|
||||
MAIN_DEPENDENCY ${LANG_SOURCE_FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Compiling language ${LANG_SOURCE_FILE_NAME_WE}"
|
||||
@@ -103,7 +107,7 @@ add_custom_command_timestamp(OUTPUT ${TABLE_BINARY_DIR}/strings.h
|
||||
COMMAND strgen
|
||||
-s ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-d ${TABLE_BINARY_DIR}
|
||||
DEPENDS strgen ${LANG_SOURCE_FILES}
|
||||
DEPENDS strgen ${MASTER_LANG_FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating table/strings.h"
|
||||
)
|
||||
|
||||
@@ -569,8 +569,8 @@ STR_MONTH_DEC :Desember
|
||||
# Graph window
|
||||
STR_GRAPH_KEY_BUTTON :{BLACK}Sleutel
|
||||
STR_GRAPH_KEY_TOOLTIP :{BLACK}Wys sleutel van grafieke
|
||||
STR_GRAPH_X_LABEL_MONTH :{TINY_FONT}{STRING}{} {STRING}
|
||||
STR_GRAPH_X_LABEL_MONTH_YEAR :{TINY_FONT}{STRING}{} {STRING}{}{NUM}
|
||||
STR_GRAPH_X_LABEL_MONTH :{TINY_FONT}{STRING}
|
||||
STR_GRAPH_X_LABEL_MONTH_YEAR :{TINY_FONT}{STRING}{}{NUM}
|
||||
STR_GRAPH_Y_LABEL :{TINY_FONT}{STRING}
|
||||
STR_GRAPH_Y_LABEL_NUMBER :{TINY_FONT}{COMMA}
|
||||
|
||||
@@ -938,8 +938,6 @@ STR_GAME_OPTIONS_CURRENCY_CNY :Chinese Renminb
|
||||
STR_GAME_OPTIONS_CURRENCY_HKD :Hong Kong Dollar (HKD)
|
||||
############ end of currency region
|
||||
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_FRAME :{BLACK}Pad voertuie
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_TOOLTIP :{BLACK}Kies kant van pad waarop voertuie ry
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT :Bestuur aan linkerkant
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_RIGHT :Bestuur aan regterkant
|
||||
|
||||
@@ -991,6 +989,7 @@ STR_GAME_OPTIONS_RESOLUTION :{BLACK}Skerm re
|
||||
STR_GAME_OPTIONS_RESOLUTION_TOOLTIP :{BLACK}Kies die skerm resolusie om te gebruik
|
||||
STR_GAME_OPTIONS_RESOLUTION_OTHER :ander
|
||||
|
||||
|
||||
STR_GAME_OPTIONS_GUI_ZOOM_FRAME :{BLACK} Koppelvlak groote
|
||||
STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_TOOLTIP :{BLACK} Kies die koppelvlak element groote om te gebruik
|
||||
|
||||
@@ -1004,6 +1003,8 @@ STR_GAME_OPTIONS_FONT_ZOOM_DROPDOWN_NORMAL :Normaal
|
||||
STR_GAME_OPTIONS_FONT_ZOOM_DROPDOWN_2X_ZOOM :Dubbele grootte
|
||||
STR_GAME_OPTIONS_FONT_ZOOM_DROPDOWN_4X_ZOOM :Quad grootte
|
||||
|
||||
|
||||
|
||||
STR_GAME_OPTIONS_BASE_GRF :{BLACK}Basis-grafikastel
|
||||
STR_GAME_OPTIONS_BASE_GRF_TOOLTIP :{BLACK}Kies die basis-grafikastel stel om te gebruik
|
||||
STR_GAME_OPTIONS_BASE_GRF_STATUS :{RED}{NUM} verlore / korrupte ler{P "" s}
|
||||
@@ -1751,6 +1752,8 @@ STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND :{WHITE}... igno
|
||||
STR_CONFIG_ERROR_OUT_OF_MEMORY :{WHITE}Program is uit geheue uit
|
||||
STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}Allokering van {BYTES} kasgeheue vir grafika het gefaal. Die kasgeheue is verminder na {BYTES}. Dit sal OpenTDD stadiger maak. Om geheue-aanvraag te verminder, kan u 32bpp grafika en/of zoom-vlakke afskakel.
|
||||
|
||||
# Video initalization errors
|
||||
|
||||
# Intro window
|
||||
STR_INTRO_CAPTION :{WHITE}OpenTTD {REV}
|
||||
|
||||
@@ -2271,6 +2274,7 @@ STR_MISSING_GRAPHICS_SET_MESSAGE :{BLACK}OpenTTD
|
||||
STR_MISSING_GRAPHICS_YES_DOWNLOAD :{BLACK}Ja, laai die grafika af
|
||||
STR_MISSING_GRAPHICS_NO_QUIT :{BLACK}Nee, verlaat OpenTTD
|
||||
|
||||
|
||||
# Transparency settings window
|
||||
STR_TRANSPARENCY_CAPTION :{WHITE}Deursigtigheid Opsies
|
||||
STR_TRANSPARENT_SIGNS_TOOLTIP :{BLACK}Wissel deursigtigheid vir stasietekens. Ctrl+klik om te sluit
|
||||
@@ -2793,7 +2797,6 @@ STR_MAPGEN_SNOW_LINE_HEIGHT :{BLACK}Sneeu ly
|
||||
STR_MAPGEN_SNOW_LINE_UP :{BLACK}Beweeg die sneeu lyn een op
|
||||
STR_MAPGEN_SNOW_LINE_DOWN :{BLACK}Beweeg die sneeu lyn een af
|
||||
STR_MAPGEN_LAND_GENERATOR :{BLACK}Land genereerder:
|
||||
STR_MAPGEN_TREE_PLACER :{BLACK}Boom algoritme:
|
||||
STR_MAPGEN_TERRAIN_TYPE :{BLACK}Terrein tipe:
|
||||
STR_MAPGEN_QUANTITY_OF_SEA_LAKES :{BLACK}Seevlak:
|
||||
STR_MAPGEN_QUANTITY_OF_RIVERS :{BLACK}Riviere:
|
||||
@@ -3104,13 +3107,10 @@ STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_BRIBE :{YELLOW}Koop di
|
||||
STR_GOALS_CAPTION :{WHITE}{COMPANY} Doelwitte
|
||||
STR_GOALS_SPECTATOR_CAPTION :{WHITE}Globale Doelwitte
|
||||
STR_GOALS_SPECTATOR :Globale doelwitte
|
||||
STR_GOALS_GLOBAL_TITLE :{BLACK}Globale doelwitte:
|
||||
STR_GOALS_TEXT :{ORANGE}{STRING}
|
||||
STR_GOALS_NONE :{ORANGE}- Geen -
|
||||
STR_GOALS_SPECTATOR_NONE :{ORANGE}- Nie van toepassing -
|
||||
STR_GOALS_PROGRESS :{ORANGE}{STRING}
|
||||
STR_GOALS_PROGRESS_COMPLETE :{GREEN}{STRING}
|
||||
STR_GOALS_COMPANY_TITLE :{BLACK}Maatskappy doelwitte:
|
||||
STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Klik op doel om skerm oor die industrie/stad/teël te sentreer. Ctrl+klik maak 'n nuwe venster vir die industrie/stad/teël oop
|
||||
|
||||
# Goal question window
|
||||
|
||||
@@ -538,8 +538,8 @@ STR_MONTH_DEC :ديسمبر
|
||||
# Graph window
|
||||
STR_GRAPH_KEY_BUTTON :{BLACK}مفتاح
|
||||
STR_GRAPH_KEY_TOOLTIP :{BLACK}اظهار مفتاح الرسم البياني
|
||||
STR_GRAPH_X_LABEL_MONTH :{TINY_FONT}{STRING}{} {STRING}
|
||||
STR_GRAPH_X_LABEL_MONTH_YEAR :{TINY_FONT}{STRING}{} {STRING}{}{NUM}
|
||||
STR_GRAPH_X_LABEL_MONTH :{TINY_FONT}{STRING}
|
||||
STR_GRAPH_X_LABEL_MONTH_YEAR :{TINY_FONT}{STRING}{}{NUM}
|
||||
STR_GRAPH_Y_LABEL :{TINY_FONT}{STRING}
|
||||
STR_GRAPH_Y_LABEL_NUMBER :{TINY_FONT}{COMMA}
|
||||
|
||||
@@ -883,10 +883,11 @@ STR_GAME_OPTIONS_CURRENCY_EEK :كرونا اس
|
||||
STR_GAME_OPTIONS_CURRENCY_KRW :وون كوريا الجنوبية (KRW)
|
||||
STR_GAME_OPTIONS_CURRENCY_ZAR :راند جنوب أفريقيا (ZAR)
|
||||
STR_GAME_OPTIONS_CURRENCY_CUSTOM :مخصص ...
|
||||
STR_GAME_OPTIONS_CURRENCY_GEL :(GEL) لاري جورجي
|
||||
STR_GAME_OPTIONS_CURRENCY_CNY :(CNY) الرنمينبي الصيني
|
||||
STR_GAME_OPTIONS_CURRENCY_HKD :(HKD) دولار هونج كونج
|
||||
############ end of currency region
|
||||
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_FRAME :{BLACK}العربات البرية
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_TOOLTIP :{BLACK}اختار الجانب الذي تسير فيه المركبات
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT :القيادة على اليسار
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_RIGHT :القيادة على اليمين
|
||||
|
||||
@@ -938,6 +939,7 @@ STR_GAME_OPTIONS_RESOLUTION :{BLACK}دقة
|
||||
STR_GAME_OPTIONS_RESOLUTION_TOOLTIP :{BLACK}اختر دقة الشاشة
|
||||
STR_GAME_OPTIONS_RESOLUTION_OTHER :اخرى
|
||||
|
||||
|
||||
STR_GAME_OPTIONS_GUI_ZOOM_FRAME :{BLACK}حجم اللوحة
|
||||
STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_TOOLTIP :{BLACK}حدد العنصر المطلوب
|
||||
|
||||
@@ -947,6 +949,8 @@ STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_4X_ZOOM :تقريب ×4
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
STR_GAME_OPTIONS_BASE_GRF :{BLACK} الواجهة الرسومية الاساسية
|
||||
STR_GAME_OPTIONS_BASE_GRF_TOOLTIP :{BLACK} اختر مجموعة الواجهة الرسومية
|
||||
STR_GAME_OPTIONS_BASE_GRF_STATUS :{RED}{NUM} ملف مفقود او غير صالح
|
||||
@@ -1403,6 +1407,8 @@ STR_CONFIG_ERROR_INVALID_GRF_INCOMPATIBLE :غير متطا
|
||||
STR_CONFIG_ERROR_INVALID_GRF_UNKNOWN :مجهول
|
||||
STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_LEVEL :{WHITE}... نسبة الضغط '{STRING}' غير صحيحة
|
||||
|
||||
# Video initalization errors
|
||||
|
||||
# Intro window
|
||||
STR_INTRO_CAPTION :{WHITE}OpenTTD {REV}
|
||||
|
||||
@@ -1428,10 +1434,10 @@ STR_INTRO_TOOLTIP_PLAY_SCENARIO :{BLACK}بدأ
|
||||
STR_INTRO_TOOLTIP_SCENARIO_EDITOR :{BLACK}انشاء خريطة عالم خاصة
|
||||
STR_INTRO_TOOLTIP_MULTIPLAYER :{BLACK} ابدأ لعبة جماعية
|
||||
|
||||
STR_INTRO_TOOLTIP_TEMPERATE :{BLACK}اختيار المناطق الثلجية
|
||||
STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE :{BLACK}اختيار المناطق الصحراوية
|
||||
STR_INTRO_TOOLTIP_TEMPERATE :{BLACK} اختيار المناطق المعتدلة
|
||||
STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE :{BLACK} اختيار المناطق الثلجية
|
||||
STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE :{BLACK}اختيار المناطق الصحراوية
|
||||
STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}اختيار نمط الألعاب
|
||||
STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK} اختيار مناطق عالم الألعب
|
||||
|
||||
STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}عرض خيارات اللعبة
|
||||
STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}إعدادات العرض
|
||||
@@ -1843,6 +1849,7 @@ STR_CONTENT_UNSELECT_ALL_CAPTION :{BLACK} مسح
|
||||
STR_CONTENT_UNSELECT_ALL_CAPTION_TOOLTIP :{BLACK} ضع علامة على المحتوى التي لن يتم تحميلها
|
||||
STR_CONTENT_SEARCH_EXTERNAL :{BLACK}بحث المواقع الخارجية
|
||||
STR_CONTENT_FILTER_TITLE :{BLACK}مُرَشِح:
|
||||
STR_CONTENT_OPEN_URL :{BLACK} زيارة الموقع
|
||||
STR_CONTENT_DOWNLOAD_CAPTION :{BLACK} تحميل
|
||||
STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP :{BLACK} ابدأ تحميل المحتويات المختارة
|
||||
STR_CONTENT_TOTAL_DOWNLOAD_SIZE :{SILVER} حجم البيانات التي سيتم تحميلها: {WHITE}{BYTES}
|
||||
@@ -1894,6 +1901,7 @@ STR_MISSING_GRAPHICS_SET_MESSAGE :{BLACK}تحتا
|
||||
STR_MISSING_GRAPHICS_YES_DOWNLOAD :{BLACK}نعم, حمل الرسومات
|
||||
STR_MISSING_GRAPHICS_NO_QUIT :{BLACK}لا, اغلق اللعبة
|
||||
|
||||
|
||||
# Transparency settings window
|
||||
STR_TRANSPARENCY_CAPTION :{WHITE}خيارات الشفافية
|
||||
STR_TRANSPARENT_SIGNS_TOOLTIP :{BLACK}بدل شفافية اسماء المحطات. مفتاح كنترول للاغلاق.
|
||||
@@ -2032,6 +2040,7 @@ STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_TUNNEL :{BLACK}بناء
|
||||
STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_ROAD :{BLACK}بدل بناء/إزالة الطرق
|
||||
STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS :{BLACK}بدل بناء / ازالة طرق الترام
|
||||
|
||||
STR_ROAD_NAME_TRAM :خط الترام
|
||||
|
||||
# Road depot construction window
|
||||
STR_BUILD_DEPOT_ROAD_ORIENTATION_CAPTION :{WHITE}اتجاه ورشة الصيانة
|
||||
@@ -2354,15 +2363,18 @@ STR_SAVELOAD_OSKTITLE :{BLACK}ادخل
|
||||
# World generation
|
||||
STR_MAPGEN_WORLD_GENERATION_CAPTION :{WHITE}مولد الخريطة
|
||||
STR_MAPGEN_MAPSIZE :{BLACK}حجم الخريطة
|
||||
STR_MAPGEN_MAPSIZE_TOOLTIP :{BLACK} حدد حجم الخريطة بالمربعات. سيكون عدد المربعات المتاحة أصغر قليلاً
|
||||
STR_MAPGEN_BY :{BLACK}*
|
||||
STR_MAPGEN_NUMBER_OF_TOWNS :{BLACK}عدد المدن:
|
||||
STR_MAPGEN_DATE :{BLACK}التاريخ:
|
||||
STR_MAPGEN_NUMBER_OF_INDUSTRIES :{BLACK}عدد المصانع:
|
||||
STR_MAPGEN_MAX_HEIGHTLEVEL :{BLACK} :أقصى ارتفاع للخريطة
|
||||
STR_MAPGEN_MAX_HEIGHTLEVEL_UP :{BLACK} زيادة الارتفاع الأقصى للجبال على الخريطة بواحد
|
||||
STR_MAPGEN_MAX_HEIGHTLEVEL_DOWN :{BLACK} خفض الحد الأقصى للارتفاع الجبال على الخريطة بواحد
|
||||
STR_MAPGEN_SNOW_LINE_HEIGHT :{BLACK} ارتفاع خط الثلج
|
||||
STR_MAPGEN_SNOW_LINE_UP :{BLACK}ارفع خط الثلج مستوى واحد
|
||||
STR_MAPGEN_SNOW_LINE_DOWN :{BLACK}خفض خط الثلج مستوى واحد
|
||||
STR_MAPGEN_LAND_GENERATOR :{BLACK}مولد الخريطة:
|
||||
STR_MAPGEN_TREE_PLACER :{BLACK} لوغاريثم الشجر:
|
||||
STR_MAPGEN_TERRAIN_TYPE :{BLACK} نوع التضاريس
|
||||
STR_MAPGEN_QUANTITY_OF_SEA_LAKES :{BLACK}مستوى البحر
|
||||
STR_MAPGEN_QUANTITY_OF_RIVERS :{BLACK}انهار:
|
||||
@@ -3509,6 +3521,7 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN
|
||||
STR_TEXTFILE_README_CAPTION :{WHITE}{STRING}اقراني {STRING}
|
||||
STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}{STRING} سجل التغيير ل{STRING}
|
||||
STR_TEXTFILE_LICENCE_CAPTION :{WHITE}{STRING}رخصة {STRING}
|
||||
STR_TEXTFILE_WRAP_TEXT :{WHITE}التفاف النص
|
||||
STR_TEXTFILE_VIEW_README :{BLACK}اعرض ملف التعليمات ريدمي
|
||||
STR_TEXTFILE_VIEW_CHANGELOG :{BLACK}اعرض سجل التغييرات
|
||||
STR_TEXTFILE_VIEW_LICENCE :{BLACK}الرخصة
|
||||
|
||||
@@ -555,8 +555,8 @@ STR_MONTH_DEC :Abendua
|
||||
# Graph window
|
||||
STR_GRAPH_KEY_BUTTON :{BLACK}Giltza
|
||||
STR_GRAPH_KEY_TOOLTIP :{BLACK}Erakutsi giltza grafikoetan
|
||||
STR_GRAPH_X_LABEL_MONTH :{TINY_FONT}{STRING}{} {STRING}
|
||||
STR_GRAPH_X_LABEL_MONTH_YEAR :{TINY_FONT}{STRING}{} {STRING}{}{NUM}
|
||||
STR_GRAPH_X_LABEL_MONTH :{TINY_FONT}{STRING}
|
||||
STR_GRAPH_X_LABEL_MONTH_YEAR :{TINY_FONT}{STRING}{}{NUM}
|
||||
STR_GRAPH_Y_LABEL :{TINY_FONT}{STRING}
|
||||
STR_GRAPH_Y_LABEL_NUMBER :{TINY_FONT}{COMMA}
|
||||
|
||||
@@ -909,8 +909,6 @@ STR_GAME_OPTIONS_CURRENCY_GEL :Lari Georgiarra
|
||||
STR_GAME_OPTIONS_CURRENCY_IRR :Rial Iraniarra (IRR)
|
||||
############ end of currency region
|
||||
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_FRAME :{BLACK}Errepideko garraioak
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_TOOLTIP :{BLACK}Aukeratu ibilgailuen gidatzeko norabidea
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT :Ezkerretik gidatu
|
||||
STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_RIGHT :Eskuinetik gidatu
|
||||
|
||||
@@ -962,6 +960,7 @@ STR_GAME_OPTIONS_RESOLUTION :{BLACK}Pantaila
|
||||
STR_GAME_OPTIONS_RESOLUTION_TOOLTIP :{BLACK}Pantailaren resulozioa aukeratu
|
||||
STR_GAME_OPTIONS_RESOLUTION_OTHER :besteak
|
||||
|
||||
|
||||
STR_GAME_OPTIONS_GUI_ZOOM_FRAME :{BLACK}Interfaze tamaina
|
||||
|
||||
STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_NORMAL :Normala
|
||||
@@ -970,6 +969,8 @@ STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_4X_ZOOM :Tamaina laukoit
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
STR_GAME_OPTIONS_BASE_GRF :{BLACK}Grafiko basea markatu
|
||||
STR_GAME_OPTIONS_BASE_GRF_TOOLTIP :{BLACK}Aukeratu erabili beharreko grafiko paketea
|
||||
STR_GAME_OPTIONS_BASE_GRF_STATUS :{RED}{NUM} galdutako/hautsitako artxiboa{P "" k}
|
||||
@@ -1627,6 +1628,8 @@ STR_CONFIG_ERROR_INVALID_BASE_SOUNDS_NOT_FOUND :{WHITE}... jara
|
||||
STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND :{WHITE}... jaramonik ez egiten musika paketeari'{STRING}': ez da aurkitu
|
||||
STR_CONFIG_ERROR_OUT_OF_MEMORY :{WHITE}Memoriaz kanpo
|
||||
|
||||
# Video initalization errors
|
||||
|
||||
# Intro window
|
||||
STR_INTRO_CAPTION :{WHITE}OpenTTD {REV}
|
||||
|
||||
@@ -2137,6 +2140,7 @@ STR_MISSING_GRAPHICS_SET_MESSAGE :{BLACK}OpenTTD-
|
||||
STR_MISSING_GRAPHICS_YES_DOWNLOAD :{BLACK}Bai, grafikoak jaitsi
|
||||
STR_MISSING_GRAPHICS_NO_QUIT :{BLACK}Ez, OpenTTD itxi
|
||||
|
||||
|
||||
# Transparency settings window
|
||||
STR_TRANSPARENCY_CAPTION :{WHITE}Gardentasun aukerak
|
||||
STR_TRANSPARENT_SIGNS_TOOLTIP :{BLACK}Seinaleen gardentasuna aldatu. Ktrl+Klik blokeatzeko
|
||||
@@ -2612,7 +2616,6 @@ STR_MAPGEN_SNOW_LINE_HEIGHT :{BLACK}Elur gar
|
||||
STR_MAPGEN_SNOW_LINE_UP :{BLACK}Igo puntu batean elur garaiera
|
||||
STR_MAPGEN_SNOW_LINE_DOWN :{BLACK}Jeitsi puntu batean elur garaiera
|
||||
STR_MAPGEN_LAND_GENERATOR :{BLACK}Paisaia sortzailea:
|
||||
STR_MAPGEN_TREE_PLACER :{BLACK}Zuhaitz algoritmoa:
|
||||
STR_MAPGEN_TERRAIN_TYPE :{BLACK}Lur mota:
|
||||
STR_MAPGEN_QUANTITY_OF_SEA_LAKES :{BLACK}Itsaso kopurua:
|
||||
STR_MAPGEN_QUANTITY_OF_RIVERS :{BLACK}Errekak:
|
||||
@@ -2906,13 +2909,10 @@ STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_BRIBE :{YELLOW}Udaletx
|
||||
# Goal window
|
||||
STR_GOALS_CAPTION :{WHITE}{COMPANY} Helburuak
|
||||
STR_GOALS_SPECTATOR_CAPTION :{WHITE}Helburu orokorrak
|
||||
STR_GOALS_GLOBAL_TITLE :{BLACK}Helburu orokorrak:
|
||||
STR_GOALS_TEXT :{ORANGE}{STRING}
|
||||
STR_GOALS_NONE :{ORANGE}- Ezer ez -
|
||||
STR_GOALS_SPECTATOR_NONE :{ORANGE}- Ez aplikagarria -
|
||||
STR_GOALS_PROGRESS :{ORANGE}{STRING}
|
||||
STR_GOALS_PROGRESS_COMPLETE :{GREEN}{STRING}
|
||||
STR_GOALS_COMPANY_TITLE :{BLACK}Konpainiaren helburuak:
|
||||
STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Klikatu helburuan ikupegi nagusia industrian/herrian/laukian zentratzeko. Ktrl+Klik ikuspegi lehio berria irekiko du industri/herri/laukiaren kokapenean
|
||||
|
||||
# Goal question window
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user