Merge branch 'master' into blueprints
This commit is contained in:
122
.changelog
122
.changelog
@@ -1,23 +1,105 @@
|
|||||||
1.11.2 (2021-05-03)
|
12.0-beta2 (2021-08-19)
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
Change: [Win32] Limit hardware accelerated video driver to OpenGL 3.2 or higher (#9077)
|
Feature: [Linkgraph] Prioritize faster routes for passengers, mail and express cargo (#9457)
|
||||||
Change: More improvements to the GUI at different scales (#9075, #9102, #9107, #9133, #9174, #9183)
|
Fix: Wrong town window refreshed when building an airport with noise levels enabled (#9497)
|
||||||
Fix: Query windows could be partially drawn (#9184)
|
Fix: Improve wording of network-related messages (#9494, #9495, #9500)
|
||||||
Fix #9113: Crash when removing an airport that exists in an aircraft's orders (#9182)
|
Fix: [Network] Report reuse of invite-code (#9487)
|
||||||
Fix #9117: [Fluidsynth] Hang when changing song (#9181)
|
Fix: [Network] Connecting with the same client name thrice hangs the server (#9485)
|
||||||
Fix: String validation could leave invalid UTF-8 encoded strings (#9096)
|
|
||||||
Fix: [Network] Out-of-bounds memory access with modified servers sending too short password salts (#9176)
|
|
||||||
Fix: Crash when extra viewport with zero height has sign in view (#9175)
|
12.0-beta1 (2021-08-15)
|
||||||
Fix #9147: Crash when taking screenshots (#9169)
|
------------------------------------------------------------------------
|
||||||
Fix #6598: [Network] Prevent crashes when (re)joining network game by falling back to main menu first (#9163)
|
Feature: [Network] Remove lobby window; pressing "Join Game" now immediately joins a server (#9467)
|
||||||
Fix #9152: Screenshot success popup window was treated as an error (#9159)
|
Feature: [Network] Synchronize server name to clients and display in Online Players window (#9472)
|
||||||
Fix: Fast-forward stuttering when vsync is enabled (#9140)
|
Feature: [Network] Mention you are a spectator in the status bar (#9471)
|
||||||
Fix: [Network, Win32] Network errors were handled badly (#9116)
|
Feature: [Network] No longer require port-forwarding to host a server (#9443, #9447)
|
||||||
Fix: [Network] Savegame transfer could stall in rare cases (#9106)
|
Feature: [Network] Allow setting your server visibility to "invite-only" (#9434)
|
||||||
Fix #9097: [NewGRF] Cargo initial payment variable was being truncated (#9098)
|
Feature: [Network] Join servers based on their invite code (#9432)
|
||||||
Fix: [NewGRF] Industry variable 66 and object variable 46 erroneously truncated the distance (#9088)
|
Feature: Raise the maximum NewGRF limit to 255 (#9428)
|
||||||
Fix: [NewGRF] Industry variables 65 and 66 ignored the parameter, and always used the north tile (#9088)
|
Feature: Persistent rotation of numbered auto/netsave after restart (#9395, #9397)
|
||||||
Fix: Do not include regression test AI in bundle (#9068, #9164)
|
Feature: [NewGRF] Maximum curve speed modifier for rail vehicles (#9346)
|
||||||
Fix #9062: [Win32] Version in executable was not set to current release version (#9066, #9154)
|
Feature: Move sensitive information to secrets.cfg and private information to private.cfg (#9298)
|
||||||
|
Feature: Signed Windows builds (#9294)
|
||||||
|
Feature: [NewGRF] Define refittability of default vehicles using cargo classes (#9148)
|
||||||
|
Feature: Configurable subsidy duration, up to 5000 years (#9081)
|
||||||
|
Feature: [Network] Rework in-game Online Players window (#9067)
|
||||||
|
Feature: [Network] Show previous chat history when the chat message box is open (#9025)
|
||||||
|
Feature: Button to reset game settings to their default values (#8958)
|
||||||
|
Feature: Press Ctrl to build diagonal rivers in Scenario Editor (#8880)
|
||||||
|
Feature: Set wagon replacement per group when using autoreplace (#7441)
|
||||||
|
Add: [Network] Open Online Players window on starting/joining a server (#9479)
|
||||||
|
Add: [Script] Basic information about loaded NewGRFs for scripts (#9464)
|
||||||
|
Add: [AI] Get the number of vehicles in a given group (#9462)
|
||||||
|
Add: [Network] Inform network clients what game-script a server is running (#9441)
|
||||||
|
Add: Hindi translation (#9086)
|
||||||
|
Add: [Network] Ensure players fill in a name instead of defaulting to "Player" (#9080)
|
||||||
|
Change: Allow pause/unpause console command in single player (#9342)
|
||||||
|
Change: Make savegame format self-descriptive and consistent across all objects (#9322, #9335, #9338, #9339)
|
||||||
|
Change: By default, make "unload all" leave stations empty (#9301)
|
||||||
|
Change: Reworked the debug levels and messages for network logs (#9230, #9251)
|
||||||
|
Change: [Emscripten] Set default scrolling mode to non-pointer-locking (#9191)
|
||||||
|
Change: Use neutral pronouns for various strings (#9189, #9203, #9228)
|
||||||
|
Change: Make the town directory horizontally resizable (#9157)
|
||||||
|
Change: Allow non-ASCII currency separators (#9121)
|
||||||
|
Change: [NewGRF] Display a pop-up window for Errors with severity ERROR (#9119)
|
||||||
|
Change: Treat languages as finished, if translations are 75% completed (#9019, #9086)
|
||||||
|
Change: Disable NewGRF window apply button if no change was made (#8934)
|
||||||
|
Fix: [Script] Crash when iterating lists of which the key is larger than 32bit (#9465)
|
||||||
|
Fix: [Network] Desync due to use of unstable sort when distributing cargo production (#9460)
|
||||||
|
Fix #9440: Negative cargo payments not being handled correctly (#9455)
|
||||||
|
Fix: [Network] Crash when joining a server again after a TCP disconnect (#9453)
|
||||||
|
Fix: Don't enable rename button for network clients in build vehicle window (#9452)
|
||||||
|
Fix: Money could underflow and wrap around (#9451)
|
||||||
|
Fix: Parse the console settings the same way as config settings (#9438)
|
||||||
|
Fix: Ensure no more than the allowed number of NewGRFs are loaded from the configuration (#9430)
|
||||||
|
Fix: [NewGRF] Overflow when determining cargo mask for string code 9A 1E (#9423)
|
||||||
|
Fix: Integers for scripts are 64bit, but saved as 32bit (#9415)
|
||||||
|
Fix #9392: [Script] Return a valid value with GetBuildWithRefitCapacity even when AIs are maxed out in vehicles (#9393)
|
||||||
|
Fix #8169: Crash when autoreplacing vehicle with no orders (#9387)
|
||||||
|
Fix: Wrong cargo line position in IndustryCargo window (#9383)
|
||||||
|
Fix: Race-condition during startup of NewGRF scan (#9382)
|
||||||
|
Fix: Don't propagate Shift/Ctrl state till next game-tick (#9381)
|
||||||
|
Fix: Prevent palette updates during copying to the video driver (#9379)
|
||||||
|
Fix: [Network] Determining GetNetworkRevisionString could overflow and underflow its buffer (#9372)
|
||||||
|
Fix #9358: Don't skip empty files in tar archives (#9367)
|
||||||
|
Fix: For old savegames, station bus/truck station cache was not updated (#9366)
|
||||||
|
Fix #9353: [Script] Garbage collecting on priority queues could crash the game (#9356)
|
||||||
|
Fix: Respect the autosave_on_exit setting for Null video driver (#9343)
|
||||||
|
Fix: Compatible NewGRFs in crash-log reported wrong MD5 hash (#9340)
|
||||||
|
Fix: [Script] Ensure the saved script strings are properly validated and terminated (#9336)
|
||||||
|
Fix #9316: Town bridge length limit check incorrect above 250k inhabitants (#9318)
|
||||||
|
Fix: Limit heightmap sizes to 8192x8192 (#9307)
|
||||||
|
Fix #9281: Money generating exploit when buying out a company (#9300)
|
||||||
|
Fix: Part of a tile might not be redrawn when terraforming (#9296)
|
||||||
|
Fix: [OpenGL] Increase timeout when waiting for the GPU to be done with the drawing buffer (#9282)
|
||||||
|
Fix: Vehicles sent in the wrong direction if there is no path to the destination (#9280)
|
||||||
|
Fix #9264: Do not attach temporary wagons to free wagon chains when autoreplacing (#9278)
|
||||||
|
Fix #9267: [Script] Crash during garbage collection (#9275)
|
||||||
|
Fix: Encountering two-way red signals could prune unrelated Pathfinder branches (#9271)
|
||||||
|
Fix #9255: [Network] Crash when hostname is not found (#9259)
|
||||||
|
Fix #9256: Invalid read after free when replacing train chains (#9258)
|
||||||
|
Fix: [Emscripten] Force secure WebSockets over HTTPS (#9248)
|
||||||
|
Fix #9242: Tree tick handler did not scale by map size (#9246)
|
||||||
|
Fix: [Network] Mark server as offline when no longer reachable (#9244)
|
||||||
|
Fix: [Network] Don't rebuild the host-list during iterating the list (#9240)
|
||||||
|
Fix: [Network] Don't mark the last-joined server as a manually added server (#9239)
|
||||||
|
Fix: [Network] Clients leaving because of broken connections was not broadcasted (#9238)
|
||||||
|
Fix: [Network] Check on CIDR for netmask check considered everything valid (#9235)
|
||||||
|
Fix: Creating screenshots on dedicated servers failed (#9232)
|
||||||
|
Fix: Leaking file descriptors for downloaded content (#9229)
|
||||||
|
Fix: Spelling of several town names (#9222)
|
||||||
|
Fix #9209: Game hangs when resizing highscore/news window if the screen is too small (#9210)
|
||||||
|
Fix: [Network] Optimize creating network connections for clients using IPv4 and IPv6 (#9199)
|
||||||
|
Fix #9186: Fix incorrect bounding box height causing station sprite glitch (#9187)
|
||||||
|
Fix: Truncating strings in settings could leave invalid UTF-8 characters (#9121)
|
||||||
|
Fix: Many issues related to window scaling (#9087, #9219)
|
||||||
|
Fix: Invalidate cached vehicle colourmaps when changing liveries setting (#9006)
|
||||||
|
Fix #8981: Don't attempt to re-reserve path if already entering/entered depot (#9000)
|
||||||
|
Fix: Missing 'Town names:' colon in map gen GUI (#8986)
|
||||||
|
Fix: Sorting and filtering industries that produce/accept many cargoes (#8468)
|
||||||
|
Remove: [Network] COMPANY_INFO packets (#9475)
|
||||||
|
Remove: [Network] A server can no longer set a limit to the amount of spectators allowed (#9466)
|
||||||
|
Remove: Arbitrary limit on number of statically loaded NewGRFs (#9431)
|
||||||
|
Remove: [Network] Language and map-name from server information (#9070)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ notifications:
|
|||||||
only-by:
|
only-by:
|
||||||
- DorpsGek
|
- DorpsGek
|
||||||
commit-comment:
|
commit-comment:
|
||||||
|
discussion:
|
||||||
pull-request:
|
pull-request:
|
||||||
issue:
|
issue:
|
||||||
tag-created:
|
tag-created:
|
||||||
|
|||||||
41
.github/ISSUE_TEMPLATE/bug.yaml
vendored
Normal file
41
.github/ISSUE_TEMPLATE/bug.yaml
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
name: Bug Report
|
||||||
|
description: Found a bug in OpenTTD?
|
||||||
|
title: "[Bug]: "
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for taking the time to fill out this bug report!
|
||||||
|
- type: input
|
||||||
|
id: version
|
||||||
|
attributes:
|
||||||
|
label: Version of OpenTTD
|
||||||
|
description: Fill in below what version of OpenTTD you are using, including your OS.
|
||||||
|
placeholder: ex. 1.11.2, Windows 10
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: expected
|
||||||
|
attributes:
|
||||||
|
label: Expected result
|
||||||
|
description: Describe in a few words what you expected to happen.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: actual
|
||||||
|
attributes:
|
||||||
|
label: Actual result
|
||||||
|
description: Describe in a few words what actually happens.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: reproduce
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
description: As detailed as possible, please tell us how we can reproduce this. Feel free to attach a savegame (zip it first) to make it more clear.
|
||||||
|
placeholder: |
|
||||||
|
1. Loaded the attached savegame.
|
||||||
|
2. Click on the button left of that other icon.
|
||||||
|
3. The window doesn't open.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: Suggestions and ideas?
|
||||||
|
url: https://www.tt-forums.net/viewforum.php?f=32
|
||||||
|
about: Have a suggestion or an idea for a cool new feature? Post them on our forum!
|
||||||
37
.github/ISSUE_TEMPLATE/crash.yaml
vendored
Normal file
37
.github/ISSUE_TEMPLATE/crash.yaml
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
name: Crash
|
||||||
|
description: Did OpenTTD crash?
|
||||||
|
title: "[Crash]: "
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for taking the time to fill out this crash report!
|
||||||
|
- type: input
|
||||||
|
id: version
|
||||||
|
attributes:
|
||||||
|
label: Version of OpenTTD
|
||||||
|
description: Fill in below what version of OpenTTD you are using, including your OS.
|
||||||
|
placeholder: ex. 1.11.2, Windows 10
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: reproduce
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
description: Please spend a few words if you can reproduce this problem.
|
||||||
|
placeholder: |
|
||||||
|
1. Bought a new train.
|
||||||
|
2. The game crashed.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: crashlogs
|
||||||
|
attributes:
|
||||||
|
label: Upload crash files
|
||||||
|
description: With the `crash.log`, `crash.dmp`, and `crash.sav` we can analyze the crash in detail; this way you allow us to easier triage and fix the problem.
|
||||||
|
placeholder: |
|
||||||
|
1. Zip the `crash.log`, `crash.dmp` and `crash.sav`.
|
||||||
|
2. Click on this field.
|
||||||
|
3. Drag and drop the zip file in here.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
4
.github/changelog.sh
vendored
4
.github/changelog.sh
vendored
@@ -4,9 +4,9 @@ tag=$(git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null | sed 's@\
|
|||||||
|
|
||||||
# If we are a tag, show the part of the changelog till (but excluding) the last stable
|
# If we are a tag, show the part of the changelog till (but excluding) the last stable
|
||||||
if [ -n "$tag" ]; then
|
if [ -n "$tag" ]; then
|
||||||
grep='^[0-9]\+\.[0-9]\+\.[0-9]\+[^-]'
|
grep='^[0-9]\+\.[0-9]\+[^-]'
|
||||||
next=$(cat changelog.txt | grep '^[0-9]' | awk 'BEGIN { show="false" } // { if (show=="true") print $0; if ($1=="'$tag'") show="true"} ' | grep "$grep" | head -n1 | sed 's/ .*//')
|
next=$(cat changelog.txt | grep '^[0-9]' | awk 'BEGIN { show="false" } // { if (show=="true") print $0; if ($1=="'$tag'") show="true"} ' | grep "$grep" | head -n1 | sed 's/ .*//')
|
||||||
cat changelog.txt | awk 'BEGIN { show="false" } /^[0-9]+.[0-9]+.[0-9]+/ { if ($1=="'$next'") show="false"; if ($1=="'$tag'") show="true";} // { if (show=="true") print $0 }'
|
cat changelog.txt | awk 'BEGIN { show="false" } /^[0-9]+.[0-9]+/ { if ($1=="'$next'") show="false"; if ($1=="'$tag'") show="true";} // { if (show=="true") print $0 }'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
91
.github/workflows/ci-build.yml
vendored
91
.github/workflows/ci-build.yml
vendored
@@ -158,7 +158,7 @@ jobs:
|
|||||||
|
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
env:
|
env:
|
||||||
MACOSX_DEPLOYMENT_TARGET: 10.9
|
MACOSX_DEPLOYMENT_TARGET: 10.14
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -318,3 +318,92 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd ${GITHUB_WORKSPACE}/build
|
cd ${GITHUB_WORKSPACE}/build
|
||||||
ctest --timeout 120
|
ctest --timeout 120
|
||||||
|
|
||||||
|
|
||||||
|
msys2:
|
||||||
|
name: msys2
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- msystem: MINGW64
|
||||||
|
arch: x86_64
|
||||||
|
- msystem: MINGW32
|
||||||
|
arch: i686
|
||||||
|
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup MSYS2
|
||||||
|
uses: msys2/setup-msys2@v2
|
||||||
|
with:
|
||||||
|
msystem: ${{ matrix.msystem }}
|
||||||
|
release: false
|
||||||
|
install: >-
|
||||||
|
git
|
||||||
|
make
|
||||||
|
mingw-w64-${{ matrix.arch }}-cmake
|
||||||
|
mingw-w64-${{ matrix.arch }}-gcc
|
||||||
|
mingw-w64-${{ matrix.arch }}-lzo2
|
||||||
|
mingw-w64-${{ matrix.arch }}-libpng
|
||||||
|
|
||||||
|
- name: Install OpenGFX
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p "C:/Users/Public/Documents/OpenTTD/baseset"
|
||||||
|
cd "C:/Users/Public/Documents/OpenTTD/baseset"
|
||||||
|
|
||||||
|
echo "::group::Download OpenGFX"
|
||||||
|
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
echo "::group::Unpack OpenGFX"
|
||||||
|
unzip opengfx-all.zip
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
rm -f opengfx-all.zip
|
||||||
|
|
||||||
|
- name: Install GCC problem matcher
|
||||||
|
uses: ammaraskar/gcc-problem-matcher@master
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
shell: msys2 {0}
|
||||||
|
run: |
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
|
||||||
|
echo "::group::CMake"
|
||||||
|
cmake .. -G"MSYS Makefiles"
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
echo "::group::Build"
|
||||||
|
echo "Running on $(nproc) cores"
|
||||||
|
cmake --build . -j $(nproc)
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
shell: msys2 {0}
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
ctest -j $(nproc) --timeout 120
|
||||||
|
|
||||||
|
check_annotations:
|
||||||
|
name: Check Annotations
|
||||||
|
needs:
|
||||||
|
- emscripten
|
||||||
|
- linux
|
||||||
|
- macos
|
||||||
|
- windows
|
||||||
|
- msys2
|
||||||
|
|
||||||
|
if: always() && github.event_name == 'pull_request'
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check annotations
|
||||||
|
uses: OpenTTD/actions/annotation-check@v2
|
||||||
|
|||||||
34
.github/workflows/commit-checker.yml
vendored
34
.github/workflows/commit-checker.yml
vendored
@@ -15,37 +15,7 @@ jobs:
|
|||||||
fetch-depth: 4
|
fetch-depth: 4
|
||||||
|
|
||||||
- name: Get pull-request commits
|
- name: Get pull-request commits
|
||||||
run: |
|
uses: OpenTTD/actions/checkout-pull-request@v2
|
||||||
set -x
|
|
||||||
# actions/checkout did a merge checkout of the pull-request. As such, the first
|
|
||||||
# commit is the merge commit. This means that on HEAD^ is the base branch, and
|
|
||||||
# on HEAD^2 are the commits from the pull-request. We now check if those trees
|
|
||||||
# have a common parent. If not, we fetch a few more commits till we do. In result,
|
|
||||||
# the log between HEAD^ and HEAD^2 will be the commits in the pull-request.
|
|
||||||
DEPTH=4
|
|
||||||
while [ -z "$(git merge-base HEAD^ HEAD^2)" ]; do
|
|
||||||
# Prevent infinite recursion
|
|
||||||
if [ ${DEPTH} -gt 256 ]; then
|
|
||||||
echo "No common parent between '${GITHUB_HEAD_REF}' and '${GITHUB_BASE_REF}'." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --deepen=${DEPTH} origin HEAD
|
|
||||||
DEPTH=$(( ${DEPTH} * 4 ))
|
|
||||||
done
|
|
||||||
|
|
||||||
# Just to show which commits we are going to evaluate.
|
|
||||||
git log --oneline HEAD^..HEAD^2
|
|
||||||
|
|
||||||
- name: Checkout commit-checker
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
repository: OpenTTD/OpenTTD-git-hooks
|
|
||||||
path: git-hooks
|
|
||||||
ref: master
|
|
||||||
|
|
||||||
- name: Check commits
|
- name: Check commits
|
||||||
run: |
|
uses: OpenTTD/OpenTTD-git-hooks@main
|
||||||
set -x
|
|
||||||
HOOKS_DIR=./git-hooks/hooks GIT_DIR=.git ./git-hooks/hooks/check-commits.sh HEAD^..HEAD^2
|
|
||||||
echo "Commit checks passed"
|
|
||||||
|
|||||||
43
.github/workflows/release.yml
vendored
43
.github/workflows/release.yml
vendored
@@ -376,14 +376,19 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
- container_image: "ubuntu:18.04"
|
- container_image: "ubuntu:18.04"
|
||||||
bundle_name: "bionic"
|
bundle_name: "bionic"
|
||||||
|
compiler: "g++-8"
|
||||||
- container_image: "ubuntu:20.04"
|
- container_image: "ubuntu:20.04"
|
||||||
bundle_name: "focal"
|
bundle_name: "focal"
|
||||||
|
compiler: "g++"
|
||||||
- container_image: "ubuntu:20.10"
|
- container_image: "ubuntu:20.10"
|
||||||
bundle_name: "groovy"
|
bundle_name: "groovy"
|
||||||
|
compiler: "g++"
|
||||||
- container_image: "debian:buster"
|
- container_image: "debian:buster"
|
||||||
bundle_name: "buster"
|
bundle_name: "buster"
|
||||||
|
compiler: "g++"
|
||||||
- container_image: "debian:bullseye"
|
- container_image: "debian:bullseye"
|
||||||
bundle_name: "bullseye"
|
bundle_name: "bullseye"
|
||||||
|
compiler: "g++"
|
||||||
|
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
container:
|
container:
|
||||||
@@ -409,7 +414,7 @@ jobs:
|
|||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
cmake \
|
cmake \
|
||||||
debhelper \
|
debhelper \
|
||||||
g++ \
|
${{ matrix.compiler }} \
|
||||||
git \
|
git \
|
||||||
make \
|
make \
|
||||||
openssl \
|
openssl \
|
||||||
@@ -436,7 +441,7 @@ jobs:
|
|||||||
cd build
|
cd build
|
||||||
|
|
||||||
echo "::group::CMake"
|
echo "::group::CMake"
|
||||||
cmake ${GITHUB_WORKSPACE} \
|
CXX=${{ matrix.compiler }} cmake ${GITHUB_WORKSPACE} \
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
# EOF
|
# EOF
|
||||||
@@ -474,7 +479,7 @@ jobs:
|
|||||||
|
|
||||||
runs-on: macos-10.15
|
runs-on: macos-10.15
|
||||||
env:
|
env:
|
||||||
MACOSX_DEPLOYMENT_TARGET: 10.9
|
MACOSX_DEPLOYMENT_TARGET: 10.14
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download source
|
- name: Download source
|
||||||
@@ -753,6 +758,21 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
arch: ${{ matrix.host }}
|
arch: ${{ matrix.host }}
|
||||||
|
|
||||||
|
- name: Import code signing certificate
|
||||||
|
shell: powershell
|
||||||
|
# If this is run on a fork, there may not be a certificate set up - continue in this case
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
$tempFile = [System.IO.Path]::GetTempFileName()
|
||||||
|
$bytes = [System.Convert]::FromBase64String($env:WINDOWS_CERTIFICATE_P12)
|
||||||
|
[IO.File]::WriteAllBytes($tempFile, $bytes)
|
||||||
|
$pwd = ConvertTo-SecureString $env:WINDOWS_CERTIFICATE_PASSWORD -AsPlainText -Force
|
||||||
|
Import-PfxCertificate -FilePath $tempFile -CertStoreLocation Cert:\CurrentUser\My -Password $pwd
|
||||||
|
Remove-Item $tempFile
|
||||||
|
env:
|
||||||
|
WINDOWS_CERTIFICATE_P12: ${{ secrets.WINDOWS_CERTIFICATE_P12 }}
|
||||||
|
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
|
||||||
|
|
||||||
- name: Build (with installer)
|
- name: Build (with installer)
|
||||||
if: ${{ false }} #needs.source.outputs.is_tag == 'true'
|
if: ${{ false }} #needs.source.outputs.is_tag == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -768,12 +788,15 @@ jobs:
|
|||||||
-DOPTION_USE_NSIS=ON \
|
-DOPTION_USE_NSIS=ON \
|
||||||
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||||
|
-DWINDOWS_CERTIFICATE_COMMON_NAME="${WINDOWS_CERTIFICATE_COMMON_NAME}" \
|
||||||
# EOF
|
# EOF
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Build"
|
echo "::group::Build"
|
||||||
cmake --build .
|
cmake --build .
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
env:
|
||||||
|
WINDOWS_CERTIFICATE_COMMON_NAME: ${{ secrets.WINDOWS_CERTIFICATE_COMMON_NAME }}
|
||||||
|
|
||||||
- name: Build (without installer)
|
- name: Build (without installer)
|
||||||
if: ${{ true }} # needs.source.outputs.is_tag != 'true'
|
if: ${{ true }} # needs.source.outputs.is_tag != 'true'
|
||||||
@@ -789,12 +812,15 @@ jobs:
|
|||||||
-DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
|
-DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
|
||||||
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||||
|
-DWINDOWS_CERTIFICATE_COMMON_NAME="${WINDOWS_CERTIFICATE_COMMON_NAME}" \
|
||||||
# EOF
|
# EOF
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Build"
|
echo "::group::Build"
|
||||||
cmake --build .
|
cmake --build .
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
env:
|
||||||
|
WINDOWS_CERTIFICATE_COMMON_NAME: ${{ secrets.WINDOWS_CERTIFICATE_COMMON_NAME }}
|
||||||
|
|
||||||
- name: Create bundles
|
- name: Create bundles
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -820,6 +846,17 @@ jobs:
|
|||||||
rm -f bundles/*.sha256
|
rm -f bundles/*.sha256
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
- name: Sign installer
|
||||||
|
if: needs.source.outputs.is_tag == 'true'
|
||||||
|
shell: bash
|
||||||
|
# If this is run on a fork, there may not be a certificate set up - continue in this case
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
cd ${GITHUB_WORKSPACE}/build/bundles
|
||||||
|
../../os/windows/sign.bat *.exe "${WINDOWS_CERTIFICATE_COMMON_NAME}"
|
||||||
|
env:
|
||||||
|
WINDOWS_CERTIFICATE_COMMON_NAME: ${{ secrets.WINDOWS_CERTIFICATE_COMMON_NAME }}
|
||||||
|
|
||||||
- name: Store bundles
|
- name: Store bundles
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.ottdrev
2
.ottdrev
@@ -1 +1 @@
|
|||||||
1.11.2 20210503 0 672f285218c6817784d86f737987b75db4bc78fc 1 1 2021
|
12.0-beta2 20210819 0 778e196b55265c40191186c273b008356136e20d 1 0 2021
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2021-05-03 18:41 UTC
|
2021-08-19 19:24 UTC
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ if(NOT BINARY_NAME)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(${BINARY_NAME}
|
project(${BINARY_NAME}
|
||||||
VERSION 1.11.2
|
VERSION 12.0
|
||||||
)
|
)
|
||||||
|
|
||||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||||
@@ -22,7 +22,7 @@ if (EMSCRIPTEN)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.14)
|
||||||
|
|
||||||
# Use GNUInstallDirs to allow customisation
|
# Use GNUInstallDirs to allow customisation
|
||||||
# but set our own default data and bin dir
|
# but set our own default data and bin dir
|
||||||
@@ -76,7 +76,7 @@ add_custom_target(find_version
|
|||||||
-DCPACK_BINARY_DIR=${CMAKE_BINARY_DIR}
|
-DCPACK_BINARY_DIR=${CMAKE_BINARY_DIR}
|
||||||
-DREV_MAJOR=${PROJECT_VERSION_MAJOR}
|
-DREV_MAJOR=${PROJECT_VERSION_MAJOR}
|
||||||
-DREV_MINOR=${PROJECT_VERSION_MINOR}
|
-DREV_MINOR=${PROJECT_VERSION_MINOR}
|
||||||
-DREV_BUILD=${PROJECT_VERSION_PATCH}
|
-DWINDOWS=${WIN32}
|
||||||
-P "${CMAKE_SOURCE_DIR}/cmake/scripts/FindVersion.cmake"
|
-P "${CMAKE_SOURCE_DIR}/cmake/scripts/FindVersion.cmake"
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
BYPRODUCTS ${GENERATED_SOURCE_FILES}
|
BYPRODUCTS ${GENERATED_SOURCE_FILES}
|
||||||
@@ -242,6 +242,10 @@ target_link_libraries(openttd
|
|||||||
Threads::Threads
|
Threads::Threads
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(HAIKU)
|
||||||
|
target_link_libraries(openttd "be" "network" "midi")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(IPO_FOUND)
|
if(IPO_FOUND)
|
||||||
set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE True)
|
set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE True)
|
||||||
set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL True)
|
set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL True)
|
||||||
@@ -357,17 +361,20 @@ if(WIN32)
|
|||||||
-DUNICODE
|
-DUNICODE
|
||||||
-D_UNICODE
|
-D_UNICODE
|
||||||
-DWITH_UNISCRIBE
|
-DWITH_UNISCRIBE
|
||||||
|
-DPSAPI_VERSION=1
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(openttd
|
target_link_libraries(openttd
|
||||||
ws2_32
|
ws2_32
|
||||||
winmm
|
winmm
|
||||||
imm32
|
imm32
|
||||||
|
usp10
|
||||||
|
psapi
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
add_definitions(-D_SQ64)
|
add_definitions(-DPOINTER_IS_64BIT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CreateRegression)
|
include(CreateRegression)
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
- Ingo von Borstel (planetmaker) - General coding, Support (since 1.1)
|
- Ingo von Borstel (planetmaker) - General coding, Support (since 1.1)
|
||||||
- Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)
|
- Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)
|
||||||
- José Soler (Terkhen) - General coding (since 1.0)
|
- José Soler (Terkhen) - General coding (since 1.0)
|
||||||
- Leif Linse (Zuu) - AI/Game Script (since 1.2)
|
|
||||||
|
|
||||||
### Inactive Developers:
|
### Inactive Developers:
|
||||||
|
|
||||||
@@ -28,6 +27,7 @@
|
|||||||
- Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)
|
- Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)
|
||||||
- Patric Stout (TrueBrain) - NoProgrammer (0.3 - 1.2), sys op (active)
|
- Patric Stout (TrueBrain) - NoProgrammer (0.3 - 1.2), sys op (active)
|
||||||
- Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)
|
- Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)
|
||||||
|
- Leif Linse (Zuu) - AI/Game Script (1.2 - 1.6)
|
||||||
|
|
||||||
### Retired Developers:
|
### Retired Developers:
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ Both 'stable' and 'nightly' versions are available for download:
|
|||||||
- most people should choose the 'stable' version, as this has been more extensively tested
|
- most people should choose the 'stable' version, as this has been more extensively tested
|
||||||
- the 'nightly' version includes the latest changes and features, but may sometimes be less reliable
|
- the 'nightly' version includes the latest changes and features, but may sometimes be less reliable
|
||||||
|
|
||||||
On some platforms OpenTTD will also be available via your OS package manager or a similar service.
|
OpenTTD is also available for free on [Steam](https://store.steampowered.com/app/1536610/OpenTTD/), [GOG.com](https://www.gog.com/game/openttd), and the [Microsoft Store](https://www.microsoft.com/p/openttd-official/9ncjg5rvrr1c). On some platforms OpenTTD will be available via your OS package manager or a similar service.
|
||||||
|
|
||||||
|
|
||||||
## 1.2) OpenTTD gameplay manual
|
## 1.2) OpenTTD gameplay manual
|
||||||
@@ -205,6 +205,9 @@ See the comments in the source files in `src/3rdparty/md5` for the complete lice
|
|||||||
The implementations of Posix `getaddrinfo` and `getnameinfo` for OS/2 in `src/3rdparty/os2` are distributed partly under the GNU Lesser General Public License 2.1, and partly under the (3-clause) BSD license.
|
The implementations of Posix `getaddrinfo` and `getnameinfo` for OS/2 in `src/3rdparty/os2` are distributed partly under the GNU Lesser General Public License 2.1, and partly under the (3-clause) BSD license.
|
||||||
The exact licensing terms can be found in `src/3rdparty/os2/getaddrinfo.c` resp. `src/3rdparty/os2/getnameinfo.c`.
|
The exact licensing terms can be found in `src/3rdparty/os2/getaddrinfo.c` resp. `src/3rdparty/os2/getnameinfo.c`.
|
||||||
|
|
||||||
|
The fmt implementation in `src/3rdparty/fmt` is licensed under the MIT license.
|
||||||
|
See `src/3rdparty/fmt/LICENSE.rst` for the complete license text.
|
||||||
|
|
||||||
|
|
||||||
## 4.0 Credits
|
## 4.0 Credits
|
||||||
|
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
trigger:
|
|
||||||
- master
|
|
||||||
- release/*
|
|
||||||
pr:
|
|
||||||
- master
|
|
||||||
- release/*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
- job: windows
|
|
||||||
displayName: 'Windows'
|
|
||||||
pool:
|
|
||||||
vmImage: 'VS2017-Win2016'
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
Win32:
|
|
||||||
BuildPlatform: 'Win32'
|
|
||||||
Win64:
|
|
||||||
BuildPlatform: 'x64'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- template: azure-pipelines/templates/ci-git-rebase.yml
|
|
||||||
- template: azure-pipelines/templates/windows-dependencies.yml
|
|
||||||
- template: azure-pipelines/templates/ci-opengfx.yml
|
|
||||||
- template: azure-pipelines/templates/windows-build.yml
|
|
||||||
parameters:
|
|
||||||
BuildPlatform: $(BuildPlatform)
|
|
||||||
BuildConfiguration: Debug
|
|
||||||
- script: |
|
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
|
||||||
cd projects
|
|
||||||
call regression.bat
|
|
||||||
displayName: 'Test'
|
|
||||||
|
|
||||||
- job: linux
|
|
||||||
displayName: 'Linux'
|
|
||||||
pool:
|
|
||||||
vmImage: 'ubuntu-16.04'
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
linux-amd64-clang-3.9:
|
|
||||||
Tag: 'linux-amd64-clang-3.9'
|
|
||||||
linux-amd64-gcc-6:
|
|
||||||
Tag: 'linux-amd64-gcc-6'
|
|
||||||
linux-i386-gcc-6:
|
|
||||||
Tag: 'linux-i386-gcc-6'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- template: azure-pipelines/templates/ci-git-rebase.yml
|
|
||||||
# The dockers already have the dependencies installed
|
|
||||||
# The dockers already have OpenGFX installed
|
|
||||||
- template: azure-pipelines/templates/linux-build.yml
|
|
||||||
parameters:
|
|
||||||
Image: compile-farm-ci
|
|
||||||
Tag: $(Tag)
|
|
||||||
|
|
||||||
- job: macos
|
|
||||||
displayName: 'MacOS'
|
|
||||||
pool:
|
|
||||||
vmImage: 'macOS-10.14'
|
|
||||||
|
|
||||||
variables:
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: 10.9
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- template: azure-pipelines/templates/ci-git-rebase.yml
|
|
||||||
- template: azure-pipelines/templates/osx-dependencies.yml
|
|
||||||
- template: azure-pipelines/templates/ci-opengfx.yml
|
|
||||||
- template: azure-pipelines/templates/osx-build.yml
|
|
||||||
- script: 'make regression'
|
|
||||||
displayName: 'Test'
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
trigger:
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- refs/tags/*
|
|
||||||
pr: none
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
- template: azure-pipelines/templates/release.yml
|
|
||||||
parameters:
|
|
||||||
IsStableRelease: true
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
trigger: none
|
|
||||||
pr: none
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
- template: azure-pipelines/templates/release.yml
|
|
||||||
parameters:
|
|
||||||
IsStableRelease: false
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
tag=$(git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null | sed 's@\^0$@@')
|
|
||||||
|
|
||||||
# If we are a tag, show the part of the changelog till (but excluding) the last stable
|
|
||||||
if [ -n "$tag" ]; then
|
|
||||||
grep='^[0-9]\+\.[0-9]\+\.[0-9]\+[^-]'
|
|
||||||
next=$(cat changelog.txt | grep '^[0-9]' | awk 'BEGIN { show="false" } // { if (show=="true") print $0; if ($1=="'$tag'") show="true"} ' | grep "$grep" | head -n1 | sed 's/ .*//')
|
|
||||||
cat changelog.txt | awk 'BEGIN { show="false" } /^[0-9]+.[0-9]+.[0-9]+/ { if ($1=="'$next'") show="false"; if ($1=="'$tag'") show="true";} // { if (show=="true") print $0 }'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# In all other cases, show the git log of the last 7 days
|
|
||||||
revdate=$(git log -1 --pretty=format:"%ci")
|
|
||||||
last_week=$(date -d "$revdate -7days" +"%Y-%m-%d %H:%M")
|
|
||||||
git log --after="${last_week}" --pretty=fuller
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "Usage: $0 <folder-with-bundles>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
FOLDER=$1
|
|
||||||
|
|
||||||
if [ ! -e .version ] || [ ! -e .release_date ]; then
|
|
||||||
echo "This script should be executed in the root of an extracted source tarball"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Find the name based on the version
|
|
||||||
if [ -e .is_stable ]; then
|
|
||||||
isTesting=$(cat .version | grep "RC\|beta" || true)
|
|
||||||
if [ -z "${isTesting}" ]; then
|
|
||||||
NAME="stable"
|
|
||||||
else
|
|
||||||
NAME="testing"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
NAME=$(cat .version | cut -d- -f2 | cut -d- -f-2)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Convert the date to a YAML date
|
|
||||||
DATE=$(cat .release_date | tr ' ' T | sed 's/TUTC/:00-00:00/')
|
|
||||||
VERSION=$(cat .version)
|
|
||||||
BASE="openttd-${VERSION}"
|
|
||||||
|
|
||||||
echo "name: ${NAME}" > manifest.yaml
|
|
||||||
echo "date: ${DATE}" >> manifest.yaml
|
|
||||||
echo "base: ${BASE}-" >> manifest.yaml
|
|
||||||
|
|
||||||
error=""
|
|
||||||
|
|
||||||
FILES=
|
|
||||||
DEV_FILES=
|
|
||||||
for filename in $(ls ${FOLDER} | grep -v ".txt$\|.md$\|sum$" | sort); do
|
|
||||||
case ${filename} in
|
|
||||||
*docs* |\
|
|
||||||
*source* |\
|
|
||||||
*dbg.deb |\
|
|
||||||
*pdb.xz )
|
|
||||||
DEV_FILES="${DEV_FILES} ${filename}"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
FILES="${FILES} ${filename}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# output_files key filename...
|
|
||||||
output_files() {
|
|
||||||
if [ "$#" -lt 2 ]; then return; fi
|
|
||||||
key=$1
|
|
||||||
echo "${key}:" >> manifest.yaml
|
|
||||||
shift
|
|
||||||
while [ "$#" -gt 0 ]; do
|
|
||||||
filename=$1
|
|
||||||
if [ ! -e ${FOLDER}/${filename}.md5sum ] || [ ! -e ${FOLDER}/${filename}.sha1sum ] || [ ! -e ${FOLDER}/${filename}.sha256sum ]; then
|
|
||||||
echo "ERROR: missing checksum file for ${filename}" 1>&2
|
|
||||||
error="y"
|
|
||||||
shift
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "- id: ${filename}" >> manifest.yaml
|
|
||||||
echo " size: $(stat -c"%s" ${FOLDER}/${filename})" >> manifest.yaml
|
|
||||||
echo " md5sum: $(cat ${FOLDER}/${filename}.md5sum | cut -d\ -f1)" >> manifest.yaml
|
|
||||||
echo " sha1sum: $(cat ${FOLDER}/${filename}.sha1sum | cut -d\ -f1)" >> manifest.yaml
|
|
||||||
echo " sha256sum: $(cat ${FOLDER}/${filename}.sha256sum | cut -d\ -f1)" >> manifest.yaml
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
output_files files ${FILES}
|
|
||||||
output_files dev_files ${DEV_FILES}
|
|
||||||
|
|
||||||
if [ -n "${error}" ]; then
|
|
||||||
echo "ERROR: exiting due to earlier errors" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
steps:
|
|
||||||
# Rebase to target branch for every PR. This means users don't have to
|
|
||||||
# rebase every time target branch changes. As long as the PR applies cleanly, we
|
|
||||||
# will validate it.
|
|
||||||
- bash: |
|
|
||||||
git config user.email 'info@openttd.org'
|
|
||||||
git config user.name 'OpenTTD CI'
|
|
||||||
git rebase origin/${SYSTEM_PULLREQUEST_TARGETBRANCH}
|
|
||||||
displayName: 'Rebase to target branch'
|
|
||||||
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
steps:
|
|
||||||
- bash: |
|
|
||||||
set -ex
|
|
||||||
cd bin/baseset
|
|
||||||
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip > opengfx-all.zip
|
|
||||||
unzip opengfx-all.zip
|
|
||||||
rm -f opengfx-all.zip
|
|
||||||
displayName: 'Install OpenGFX'
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
parameters:
|
|
||||||
Image: ''
|
|
||||||
Tag: ''
|
|
||||||
ContainerCommand: ''
|
|
||||||
|
|
||||||
steps:
|
|
||||||
# 'envVars' in the 'Docker@1' task is a bit funky. When you want to use a
|
|
||||||
# variable, you have to quote it. But the quote is also sent directly to
|
|
||||||
# Docker and ends up in the variable, which you don't want. To work around
|
|
||||||
# this, we set the correct variable first (which becomes an env-variable), and
|
|
||||||
# pass that env-variable through to Docker. We cannot use the normal
|
|
||||||
# 'variables' entry, as we are a template. So that results in this bit of
|
|
||||||
# Bash code. Not because it is pretty, but it is the only way we found that
|
|
||||||
# works.
|
|
||||||
- bash: |
|
|
||||||
echo "##vso[task.setvariable variable=TARGET_BRANCH]${SYSTEM_PULLREQUEST_TARGETBRANCH}"
|
|
||||||
echo "Target branch is ${SYSTEM_PULLREQUEST_TARGETBRANCH}"
|
|
||||||
displayName: "Set target branch"
|
|
||||||
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
|
|
||||||
|
|
||||||
- task: Docker@1
|
|
||||||
${{ if eq(parameters.Image, 'compile-farm') }}:
|
|
||||||
displayName: 'Build'
|
|
||||||
${{ if eq(parameters.Image, 'compile-farm-ci') }}:
|
|
||||||
displayName: 'Build and test'
|
|
||||||
# Run the commit-checker only if it is a Pull Request
|
|
||||||
condition: and(succeeded(), or(not(contains(variables['Agent.JobName'], 'commit-checker')), eq(variables['Build.Reason'], 'PullRequest')))
|
|
||||||
inputs:
|
|
||||||
command: 'Run an image'
|
|
||||||
imageName: openttd/${{ parameters.Image }}:${{ parameters.Tag }}
|
|
||||||
volumes: '$(Build.SourcesDirectory):$(Build.SourcesDirectory)'
|
|
||||||
workingDirectory: '$(Build.SourcesDirectory)'
|
|
||||||
containerCommand: ${{ parameters.ContainerCommand }}
|
|
||||||
runInBackground: false
|
|
||||||
envVars: |
|
|
||||||
TARGET_BRANCH
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
steps:
|
|
||||||
# Because we run the compile in a docker (under root), we are not owner
|
|
||||||
# of the 'bundles' folder. Fix that by executing a chown on it.
|
|
||||||
- bash: sudo chown -R $(id -u):$(id -g) bundles
|
|
||||||
displayName: 'Claim bundles folder back'
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
steps:
|
|
||||||
- script: './configure PKG_CONFIG_PATH=/usr/local/lib/pkgconfig --enable-static'
|
|
||||||
displayName: 'Configure'
|
|
||||||
- script: 'make -j2'
|
|
||||||
displayName: 'Build'
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
steps:
|
|
||||||
- script: |
|
|
||||||
set -ex
|
|
||||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config lzo xz libpng freetype
|
|
||||||
# Remove the dynamic libraries of these libraries, to ensure we use
|
|
||||||
# the static versions. That is important, as it is unlikely any
|
|
||||||
# end-user has these brew libraries installed.
|
|
||||||
rm /usr/local/Cellar/lzo/*/lib/*.dylib
|
|
||||||
rm /usr/local/Cellar/xz/*/lib/*.dylib
|
|
||||||
rm /usr/local/Cellar/libpng/*/lib/*.dylib
|
|
||||||
rm /usr/local/Cellar/freetype/*/lib/*.dylib
|
|
||||||
displayName: 'Install dependencies'
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
parameters:
|
|
||||||
CalculateChecksums: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- ${{ if eq(parameters.CalculateChecksums, true) }}:
|
|
||||||
- bash: |
|
|
||||||
set -ex
|
|
||||||
cd bundles
|
|
||||||
for i in $(ls); do
|
|
||||||
openssl dgst -r -md5 -hex $i > $i.md5sum
|
|
||||||
openssl dgst -r -sha1 -hex $i > $i.sha1sum
|
|
||||||
openssl dgst -r -sha256 -hex $i > $i.sha256sum
|
|
||||||
done
|
|
||||||
displayName: 'Calculate checksums'
|
|
||||||
- task: PublishBuildArtifacts@1
|
|
||||||
displayName: 'Publish bundles'
|
|
||||||
inputs:
|
|
||||||
PathtoPublish: bundles/
|
|
||||||
ArtifactName: bundles
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# Fetch the source tarball as prepared by an earlier job. In there is the
|
|
||||||
# version predefined. This ensures we are all going to compile the same
|
|
||||||
# source with the same version.
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- checkout: none
|
|
||||||
- task: DownloadBuildArtifacts@0
|
|
||||||
displayName: 'Download source'
|
|
||||||
inputs:
|
|
||||||
downloadType: specific
|
|
||||||
itemPattern: 'bundles/openttd-*-source.tar.xz'
|
|
||||||
downloadPath: '$(Build.ArtifactStagingDirectory)'
|
|
||||||
- bash: tar --xz -xf ../a/bundles/openttd-*-source.tar.xz --strip-components=1
|
|
||||||
displayName: 'Extracting source'
|
|
||||||
- bash: |
|
|
||||||
set -e
|
|
||||||
VERSION=$(cat .version)
|
|
||||||
echo "${VERSION}"
|
|
||||||
echo "##vso[build.updatebuildnumber]${VERSION}"
|
|
||||||
displayName: 'Change BuildNumber to version'
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
parameters:
|
|
||||||
IsStableRelease: false
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- task: DownloadBuildArtifacts@0
|
|
||||||
displayName: 'Download all bundles'
|
|
||||||
inputs:
|
|
||||||
downloadType: specific
|
|
||||||
itemPattern: 'bundles/*'
|
|
||||||
downloadPath: '$(Build.ArtifactStagingDirectory)'
|
|
||||||
- ${{ if eq(parameters.IsStableRelease, true) }}:
|
|
||||||
- script: |
|
|
||||||
touch .is_stable
|
|
||||||
displayName: 'Mark as stable release'
|
|
||||||
- script: |
|
|
||||||
set -ex
|
|
||||||
./azure-pipelines/manifest.sh ../a/bundles/
|
|
||||||
mkdir -p bundles
|
|
||||||
mv manifest.yaml bundles/
|
|
||||||
displayName: 'Create manifest.yaml'
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
# Set the revisions, and remove the VCS files.
|
|
||||||
# This ensures everything else picks up on the predefined versions, and not
|
|
||||||
# that because of some build process the version all of a sudden changes.
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- script: |
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
if [ -n "${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}" ]; then
|
|
||||||
# We are triggered from a GitHub Pull Request
|
|
||||||
git checkout -B pr${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}
|
|
||||||
elif [ "${BUILD_SOURCEBRANCHNAME}" = "merge" ] || [ "${BUILD_SOURCEBRANCHNAME}" = "head" ]; then
|
|
||||||
# We are manually triggered based on a GitHub Pull Request
|
|
||||||
PULLREQUESTNUMBER=$(echo ${BUILD_SOURCEBRANCH} | cut -d/ -f3)
|
|
||||||
git checkout -B pr${PULLREQUESTNUMBER}
|
|
||||||
else
|
|
||||||
git checkout -B ${BUILD_SOURCEBRANCHNAME}
|
|
||||||
fi
|
|
||||||
|
|
||||||
./findversion.sh > .ottdrev
|
|
||||||
./azure-pipelines/changelog.sh > .changelog
|
|
||||||
TZ='UTC' date +"%Y-%m-%d %H:%M UTC" > .release_date
|
|
||||||
cat .ottdrev | cut -f 1 -d$'\t' > .version
|
|
||||||
echo "Release Date: $(cat .release_date)"
|
|
||||||
echo "Revision: $(cat .ottdrev)"
|
|
||||||
echo "Version: $(cat .version)"
|
|
||||||
displayName: 'Create version files'
|
|
||||||
- script: |
|
|
||||||
set -e
|
|
||||||
VERSION=$(cat .version)
|
|
||||||
echo "${VERSION}"
|
|
||||||
echo "##vso[build.updatebuildnumber]${VERSION}"
|
|
||||||
displayName: 'Change BuildNumber to version'
|
|
||||||
- script: find . -iname .hg -or -iname .git -or -iname .svn | xargs rm -rf
|
|
||||||
displayName: 'Remove VCS information'
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
parameters:
|
|
||||||
# If this is false, not all targets are triggered. For example:
|
|
||||||
# The NSIS installer for Windows and the creation of debs only work for
|
|
||||||
# releases. Not for any other type of binary. So they are skilled if this
|
|
||||||
# is set to false.
|
|
||||||
IsStableRelease: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
- job: source
|
|
||||||
displayName: 'Source'
|
|
||||||
pool:
|
|
||||||
vmImage: 'ubuntu-16.04'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- template: release-prepare-source.yml
|
|
||||||
- script: |
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# Rename the folder to openttd-NNN-source
|
|
||||||
mkdir openttd-$(Build.BuildNumber)
|
|
||||||
find . -maxdepth 1 -not -name . -not -name openttd-$(Build.BuildNumber) -exec mv {} openttd-$(Build.BuildNumber)/ \;
|
|
||||||
# Copy back release_date, as it is needed for the template 'release-bundles'
|
|
||||||
cp openttd-$(Build.BuildNumber)/.release_date .release_date
|
|
||||||
|
|
||||||
mkdir bundles
|
|
||||||
tar --xz -cf bundles/openttd-$(Build.BuildNumber)-source.tar.xz openttd-$(Build.BuildNumber)
|
|
||||||
zip -9 -r -q bundles/openttd-$(Build.BuildNumber)-source.zip openttd-$(Build.BuildNumber)
|
|
||||||
displayName: 'Create bundle'
|
|
||||||
- template: release-bundles.yml
|
|
||||||
|
|
||||||
- job: meta
|
|
||||||
displayName: 'Metadata'
|
|
||||||
pool:
|
|
||||||
vmImage: 'ubuntu-16.04'
|
|
||||||
dependsOn: source
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- template: release-fetch-source.yml
|
|
||||||
- script: |
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
mkdir -p bundles
|
|
||||||
cp .changelog bundles/changelog.txt
|
|
||||||
cp .release_date bundles/released.txt
|
|
||||||
cp README.md bundles/README.md
|
|
||||||
displayName: 'Copy meta files'
|
|
||||||
- template: release-bundles.yml
|
|
||||||
parameters:
|
|
||||||
CalculateChecksums: false
|
|
||||||
|
|
||||||
- job: docs
|
|
||||||
displayName: 'Docs'
|
|
||||||
pool:
|
|
||||||
vmImage: 'ubuntu-16.04'
|
|
||||||
dependsOn: source
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- template: release-fetch-source.yml
|
|
||||||
- template: linux-build.yml
|
|
||||||
parameters:
|
|
||||||
Image: compile-farm
|
|
||||||
ContainerCommand: '$(Build.BuildNumber)'
|
|
||||||
Tag: docs
|
|
||||||
- template: linux-claim-bundles.yml
|
|
||||||
- template: release-bundles.yml
|
|
||||||
|
|
||||||
- job: windows
|
|
||||||
displayName: 'Windows'
|
|
||||||
pool:
|
|
||||||
vmImage: 'VS2017-Win2016'
|
|
||||||
dependsOn: source
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
Win32:
|
|
||||||
BuildPlatform: 'Win32'
|
|
||||||
BundlePlatform: 'win32'
|
|
||||||
Win64:
|
|
||||||
BuildPlatform: 'x64'
|
|
||||||
BundlePlatform: 'win64'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- template: release-fetch-source.yml
|
|
||||||
- template: windows-dependencies.yml
|
|
||||||
- template: windows-dependency-zip.yml
|
|
||||||
- ${{ if eq(parameters.IsStableRelease, true) }}:
|
|
||||||
- template: windows-dependency-nsis.yml
|
|
||||||
- template: windows-build.yml
|
|
||||||
parameters:
|
|
||||||
BuildPlatform: $(BuildPlatform)
|
|
||||||
BuildConfiguration: Release
|
|
||||||
- bash: |
|
|
||||||
set -ex
|
|
||||||
make -f Makefile.msvc bundle_pdb bundle_zip PLATFORM=$(BundlePlatform) BUNDLE_NAME=openttd-$(Build.BuildNumber)-windows-$(BundlePlatform)
|
|
||||||
displayName: 'Create bundles'
|
|
||||||
- ${{ if eq(parameters.IsStableRelease, true) }}:
|
|
||||||
- bash: |
|
|
||||||
set -ex
|
|
||||||
# NSIS will be part of the Hosted image in the next update. Till then, we set the PATH ourself
|
|
||||||
export PATH="${PATH}:/c/Program Files (x86)/NSIS"
|
|
||||||
make -f Makefile.msvc bundle_exe PLATFORM=$(BundlePlatform) BUNDLE_NAME=openttd-$(Build.BuildNumber)-windows-$(BundlePlatform)
|
|
||||||
displayName: 'Create installer bundle'
|
|
||||||
- template: release-bundles.yml
|
|
||||||
|
|
||||||
- ${{ if eq(parameters.IsStableRelease, true) }}:
|
|
||||||
- job: linux_stable
|
|
||||||
displayName: 'Linux'
|
|
||||||
pool:
|
|
||||||
vmImage: 'ubuntu-16.04'
|
|
||||||
dependsOn: source
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
linux-ubuntu-xenial-i386-gcc:
|
|
||||||
Tag: 'linux-ubuntu-xenial-i386-gcc'
|
|
||||||
linux-ubuntu-xenial-amd64-gcc:
|
|
||||||
Tag: 'linux-ubuntu-xenial-amd64-gcc'
|
|
||||||
linux-ubuntu-bionic-i386-gcc:
|
|
||||||
Tag: 'linux-ubuntu-bionic-i386-gcc'
|
|
||||||
linux-ubuntu-bionic-amd64-gcc:
|
|
||||||
Tag: 'linux-ubuntu-bionic-amd64-gcc'
|
|
||||||
linux-ubuntu-focal-amd64-gcc:
|
|
||||||
Tag: 'linux-ubuntu-focal-amd64-gcc'
|
|
||||||
linux-debian-stretch-i386-gcc:
|
|
||||||
Tag: 'linux-debian-stretch-i386-gcc'
|
|
||||||
linux-debian-stretch-amd64-gcc:
|
|
||||||
Tag: 'linux-debian-stretch-amd64-gcc'
|
|
||||||
linux-debian-buster-i386-gcc:
|
|
||||||
Tag: 'linux-debian-buster-i386-gcc'
|
|
||||||
linux-debian-buster-amd64-gcc:
|
|
||||||
Tag: 'linux-debian-buster-amd64-gcc'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- template: release-fetch-source.yml
|
|
||||||
- template: linux-build.yml
|
|
||||||
parameters:
|
|
||||||
Image: compile-farm
|
|
||||||
ContainerCommand: '$(Build.BuildNumber)'
|
|
||||||
Tag: $(Tag)
|
|
||||||
- template: linux-claim-bundles.yml
|
|
||||||
- template: release-bundles.yml
|
|
||||||
|
|
||||||
- job: macos
|
|
||||||
displayName: 'MacOS'
|
|
||||||
pool:
|
|
||||||
vmImage: 'macOS-10.14'
|
|
||||||
dependsOn: source
|
|
||||||
|
|
||||||
variables:
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: 10.9
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- template: release-fetch-source.yml
|
|
||||||
- template: osx-dependencies.yml
|
|
||||||
- template: osx-build.yml
|
|
||||||
- script: 'make bundle_zip bundle_dmg BUNDLE_NAME=openttd-$(Build.BuildNumber)-macosx'
|
|
||||||
displayName: 'Create bundles'
|
|
||||||
- template: release-bundles.yml
|
|
||||||
|
|
||||||
- job: manifest
|
|
||||||
displayName: 'Manifest'
|
|
||||||
pool:
|
|
||||||
vmImage: 'ubuntu-16.04'
|
|
||||||
dependsOn:
|
|
||||||
- source
|
|
||||||
- docs
|
|
||||||
- windows
|
|
||||||
- ${{ if eq(parameters.IsStableRelease, true) }}:
|
|
||||||
- linux_stable
|
|
||||||
- macos
|
|
||||||
# "Skipped" is not a status, and is not succeeded. So it seems to be
|
|
||||||
# considered failed. So we trigger if all the earlier jobs are done (which
|
|
||||||
# might be succeeded, failed, or skipped), and run this job. This is not
|
|
||||||
# optimal, but given the rules, it is the only way to get this to work (as
|
|
||||||
# some jobs might be skipped).
|
|
||||||
condition: succeededOrFailed()
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- template: release-fetch-source.yml
|
|
||||||
- template: release-manifest.yml
|
|
||||||
${{ if eq(parameters.IsStableRelease, true) }}:
|
|
||||||
parameters:
|
|
||||||
IsStableRelease: true
|
|
||||||
- template: release-bundles.yml
|
|
||||||
parameters:
|
|
||||||
CalculateChecksums: false
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
parameters:
|
|
||||||
BuildPlatform: ''
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- task: VSBuild@1
|
|
||||||
displayName: 'Build'
|
|
||||||
inputs:
|
|
||||||
solution: 'projects/openttd_vs141.sln'
|
|
||||||
platform: ${{ parameters.BuildPlatform }}
|
|
||||||
configuration: ${{ parameters.BuildConfiguration }}
|
|
||||||
maximumCpuCount: true
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
parameters:
|
|
||||||
condition: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- bash: |
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
mkdir nsis-plugin; cd nsis-plugin
|
|
||||||
curl -L https://devs.openttd.org/~truebrain/nsis-plugins/Nsis7z.zip > Nsis7z.zip
|
|
||||||
unzip Nsis7z.zip
|
|
||||||
cp -R Plugins/* "/c/Program Files (x86)/NSIS/Plugins/"
|
|
||||||
cd ..; rm -rf nsis-plugin
|
|
||||||
|
|
||||||
mkdir nsis-plugin; cd nsis-plugin
|
|
||||||
curl -L https://devs.openttd.org/~truebrain/nsis-plugins/NsisGetVersion.zip > NsisGetVersion.zip
|
|
||||||
unzip NsisGetVersion.zip
|
|
||||||
cp -R Plugins/* "/c/Program Files (x86)/NSIS/Plugins/x86-ansi/"
|
|
||||||
cd ..; rm -rf nsis-plugin
|
|
||||||
|
|
||||||
mkdir nsis-plugin; cd nsis-plugin
|
|
||||||
curl -L https://devs.openttd.org/~truebrain/nsis-plugins/NsisFindProc.zip > NsisFindProc.zip
|
|
||||||
unzip NsisFindProc.zip
|
|
||||||
cp -R *.dll "/c/Program Files (x86)/NSIS/Plugins/x86-ansi/"
|
|
||||||
cd ..; rm -rf nsis-plugin
|
|
||||||
displayName: 'Install NSIS with the 7z, GetVersion, and FindProc plugins'
|
|
||||||
condition: and(succeeded(), ${{ parameters.condition }})
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
steps:
|
|
||||||
- bash: |
|
|
||||||
set -ex
|
|
||||||
choco install zip
|
|
||||||
displayName: 'Install zip'
|
|
||||||
@@ -12,6 +12,7 @@ set(AI_COMPAT_SOURCE_FILES
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.9.nut
|
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.9.nut
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.10.nut
|
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.10.nut
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.11.nut
|
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.11.nut
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/compat_12.nut
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(AI_COMPAT_SOURCE_FILE IN LISTS AI_COMPAT_SOURCE_FILES)
|
foreach(AI_COMPAT_SOURCE_FILE IN LISTS AI_COMPAT_SOURCE_FILES)
|
||||||
|
|||||||
@@ -4,3 +4,5 @@
|
|||||||
* 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.
|
* 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/>.
|
* 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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
AILog.Info("1.11 API compatibility in effect.");
|
||||||
|
|||||||
@@ -4,14 +4,3 @@
|
|||||||
* 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.
|
* 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/>.
|
* 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 splash.h Functions to support splash screens for OSX. */
|
|
||||||
|
|
||||||
#ifndef SPLASH_H
|
|
||||||
#define SPLASH_H
|
|
||||||
|
|
||||||
#define SPLASH_IMAGE_FILE "splash.png"
|
|
||||||
|
|
||||||
void DisplaySplashImage();
|
|
||||||
|
|
||||||
#endif /* SPLASH_H */
|
|
||||||
@@ -9,6 +9,7 @@ set(GS_COMPAT_SOURCE_FILES
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.9.nut
|
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.9.nut
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.10.nut
|
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.10.nut
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.11.nut
|
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.11.nut
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/compat_12.nut
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(GS_COMPAT_SOURCE_FILE IN LISTS GS_COMPAT_SOURCE_FILES)
|
foreach(GS_COMPAT_SOURCE_FILE IN LISTS GS_COMPAT_SOURCE_FILES)
|
||||||
|
|||||||
@@ -4,3 +4,5 @@
|
|||||||
* 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.
|
* 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/>.
|
* 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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
GSLog.Info("1.11 API compatibility in effect.");
|
||||||
|
|||||||
6
bin/game/compat_12.nut
Normal file
6
bin/game/compat_12.nut
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
119
changelog.txt
119
changelog.txt
@@ -1,3 +1,108 @@
|
|||||||
|
12.0-beta2 (2021-08-19)
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
Feature: [Linkgraph] Prioritize faster routes for passengers, mail and express cargo (#9457)
|
||||||
|
Fix: Wrong town window refreshed when building an airport with noise levels enabled (#9497)
|
||||||
|
Fix: Improve wording of network-related messages (#9494, #9495, #9500)
|
||||||
|
Fix: [Network] Report reuse of invite-code (#9487)
|
||||||
|
Fix: [Network] Connecting with the same client name thrice hangs the server (#9485)
|
||||||
|
|
||||||
|
|
||||||
|
12.0-beta1 (2021-08-15)
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
Feature: [Network] Remove lobby window; pressing "Join Game" now immediately joins a server (#9467)
|
||||||
|
Feature: [Network] Synchronize server name to clients and display in Online Players window (#9472)
|
||||||
|
Feature: [Network] Mention you are a spectator in the status bar (#9471)
|
||||||
|
Feature: [Network] No longer require port-forwarding to host a server (#9443, #9447)
|
||||||
|
Feature: [Network] Allow setting your server visibility to "invite-only" (#9434)
|
||||||
|
Feature: [Network] Join servers based on their invite code (#9432)
|
||||||
|
Feature: Raise the maximum NewGRF limit to 255 (#9428)
|
||||||
|
Feature: Persistent rotation of numbered auto/netsave after restart (#9395, #9397)
|
||||||
|
Feature: [NewGRF] Maximum curve speed modifier for rail vehicles (#9346)
|
||||||
|
Feature: Move sensitive information to secrets.cfg and private information to private.cfg (#9298)
|
||||||
|
Feature: Signed Windows builds (#9294)
|
||||||
|
Feature: [NewGRF] Define refittability of default vehicles using cargo classes (#9148)
|
||||||
|
Feature: Configurable subsidy duration, up to 5000 years (#9081)
|
||||||
|
Feature: [Network] Rework in-game Online Players window (#9067)
|
||||||
|
Feature: [Network] Show previous chat history when the chat message box is open (#9025)
|
||||||
|
Feature: Button to reset game settings to their default values (#8958)
|
||||||
|
Feature: Press Ctrl to build diagonal rivers in Scenario Editor (#8880)
|
||||||
|
Feature: Set wagon replacement per group when using autoreplace (#7441)
|
||||||
|
Add: [Network] Open Online Players window on starting/joining a server (#9479)
|
||||||
|
Add: [Script] Basic information about loaded NewGRFs for scripts (#9464)
|
||||||
|
Add: [AI] Get the number of vehicles in a given group (#9462)
|
||||||
|
Add: [Network] Inform network clients what game-script a server is running (#9441)
|
||||||
|
Add: Hindi translation (#9086)
|
||||||
|
Add: [Network] Ensure players fill in a name instead of defaulting to "Player" (#9080)
|
||||||
|
Change: Allow pause/unpause console command in single player (#9342)
|
||||||
|
Change: Make savegame format self-descriptive and consistent across all objects (#9322, #9335, #9338, #9339)
|
||||||
|
Change: By default, make "unload all" leave stations empty (#9301)
|
||||||
|
Change: Reworked the debug levels and messages for network logs (#9230, #9251)
|
||||||
|
Change: [Emscripten] Set default scrolling mode to non-pointer-locking (#9191)
|
||||||
|
Change: Use neutral pronouns for various strings (#9189, #9203, #9228)
|
||||||
|
Change: Make the town directory horizontally resizable (#9157)
|
||||||
|
Change: Allow non-ASCII currency separators (#9121)
|
||||||
|
Change: [NewGRF] Display a pop-up window for Errors with severity ERROR (#9119)
|
||||||
|
Change: Treat languages as finished, if translations are 75% completed (#9019, #9086)
|
||||||
|
Change: Disable NewGRF window apply button if no change was made (#8934)
|
||||||
|
Fix: [Script] Crash when iterating lists of which the key is larger than 32bit (#9465)
|
||||||
|
Fix: [Network] Desync due to use of unstable sort when distributing cargo production (#9460)
|
||||||
|
Fix #9440: Negative cargo payments not being handled correctly (#9455)
|
||||||
|
Fix: [Network] Crash when joining a server again after a TCP disconnect (#9453)
|
||||||
|
Fix: Don't enable rename button for network clients in build vehicle window (#9452)
|
||||||
|
Fix: Money could underflow and wrap around (#9451)
|
||||||
|
Fix: Parse the console settings the same way as config settings (#9438)
|
||||||
|
Fix: Ensure no more than the allowed number of NewGRFs are loaded from the configuration (#9430)
|
||||||
|
Fix: [NewGRF] Overflow when determining cargo mask for string code 9A 1E (#9423)
|
||||||
|
Fix: Integers for scripts are 64bit, but saved as 32bit (#9415)
|
||||||
|
Fix #9392: [Script] Return a valid value with GetBuildWithRefitCapacity even when AIs are maxed out in vehicles (#9393)
|
||||||
|
Fix #8169: Crash when autoreplacing vehicle with no orders (#9387)
|
||||||
|
Fix: Wrong cargo line position in IndustryCargo window (#9383)
|
||||||
|
Fix: Race-condition during startup of NewGRF scan (#9382)
|
||||||
|
Fix: Don't propagate Shift/Ctrl state till next game-tick (#9381)
|
||||||
|
Fix: Prevent palette updates during copying to the video driver (#9379)
|
||||||
|
Fix: [Network] Determining GetNetworkRevisionString could overflow and underflow its buffer (#9372)
|
||||||
|
Fix #9358: Don't skip empty files in tar archives (#9367)
|
||||||
|
Fix: For old savegames, station bus/truck station cache was not updated (#9366)
|
||||||
|
Fix #9353: [Script] Garbage collecting on priority queues could crash the game (#9356)
|
||||||
|
Fix: Respect the autosave_on_exit setting for Null video driver (#9343)
|
||||||
|
Fix: Compatible NewGRFs in crash-log reported wrong MD5 hash (#9340)
|
||||||
|
Fix: [Script] Ensure the saved script strings are properly validated and terminated (#9336)
|
||||||
|
Fix #9316: Town bridge length limit check incorrect above 250k inhabitants (#9318)
|
||||||
|
Fix: Limit heightmap sizes to 8192x8192 (#9307)
|
||||||
|
Fix #9281: Money generating exploit when buying out a company (#9300)
|
||||||
|
Fix: Part of a tile might not be redrawn when terraforming (#9296)
|
||||||
|
Fix: [OpenGL] Increase timeout when waiting for the GPU to be done with the drawing buffer (#9282)
|
||||||
|
Fix: Vehicles sent in the wrong direction if there is no path to the destination (#9280)
|
||||||
|
Fix #9264: Do not attach temporary wagons to free wagon chains when autoreplacing (#9278)
|
||||||
|
Fix #9267: [Script] Crash during garbage collection (#9275)
|
||||||
|
Fix: Encountering two-way red signals could prune unrelated Pathfinder branches (#9271)
|
||||||
|
Fix #9255: [Network] Crash when hostname is not found (#9259)
|
||||||
|
Fix #9256: Invalid read after free when replacing train chains (#9258)
|
||||||
|
Fix: [Emscripten] Force secure WebSockets over HTTPS (#9248)
|
||||||
|
Fix #9242: Tree tick handler did not scale by map size (#9246)
|
||||||
|
Fix: [Network] Mark server as offline when no longer reachable (#9244)
|
||||||
|
Fix: [Network] Don't rebuild the host-list during iterating the list (#9240)
|
||||||
|
Fix: [Network] Don't mark the last-joined server as a manually added server (#9239)
|
||||||
|
Fix: [Network] Clients leaving because of broken connections was not broadcasted (#9238)
|
||||||
|
Fix: [Network] Check on CIDR for netmask check considered everything valid (#9235)
|
||||||
|
Fix: Creating screenshots on dedicated servers failed (#9232)
|
||||||
|
Fix: Leaking file descriptors for downloaded content (#9229)
|
||||||
|
Fix: Spelling of several town names (#9222)
|
||||||
|
Fix #9209: Game hangs when resizing highscore/news window if the screen is too small (#9210)
|
||||||
|
Fix: [Network] Optimize creating network connections for clients using IPv4 and IPv6 (#9199)
|
||||||
|
Fix #9186: Fix incorrect bounding box height causing station sprite glitch (#9187)
|
||||||
|
Fix: Truncating strings in settings could leave invalid UTF-8 characters (#9121)
|
||||||
|
Fix: Many issues related to window scaling (#9087, #9219)
|
||||||
|
Fix: Invalidate cached vehicle colourmaps when changing liveries setting (#9006)
|
||||||
|
Fix #8981: Don't attempt to re-reserve path if already entering/entered depot (#9000)
|
||||||
|
Fix: Missing 'Town names:' colon in map gen GUI (#8986)
|
||||||
|
Fix: Sorting and filtering industries that produce/accept many cargoes (#8468)
|
||||||
|
Remove: [Network] COMPANY_INFO packets (#9475)
|
||||||
|
Remove: [Network] A server can no longer set a limit to the amount of spectators allowed (#9466)
|
||||||
|
Remove: Arbitrary limit on number of statically loaded NewGRFs (#9431)
|
||||||
|
Remove: [Network] Language and map-name from server information (#9070)
|
||||||
|
|
||||||
|
|
||||||
1.11.2 (2021-05-03)
|
1.11.2 (2021-05-03)
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
Change: [Win32] Limit hardware accelerated video driver to OpenGL 3.2 or higher (#9077)
|
Change: [Win32] Limit hardware accelerated video driver to OpenGL 3.2 or higher (#9077)
|
||||||
@@ -2294,7 +2399,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
|
|||||||
- Fix: [NewGRF] Additional text in fund industry window is NewGRF supplied and thus should have a default colour (r22631)
|
- Fix: [NewGRF] Additional text in fund industry window is NewGRF supplied and thus should have a default colour (r22631)
|
||||||
- Fix: Also initialise _old_vds with newgame settings; TTD savegames do not contain these settings [FS#4622] (r22626)
|
- Fix: Also initialise _old_vds with newgame settings; TTD savegames do not contain these settings [FS#4622] (r22626)
|
||||||
- Fix: Do not zero the orders of disaster vehicles when converting savegames [FS#4642] (r22625)
|
- Fix: Do not zero the orders of disaster vehicles when converting savegames [FS#4642] (r22625)
|
||||||
- Fix: When closing an AI company the local player cheated to, we need to cheat him to another company [FS#4654] (r22624, r22623)
|
- Fix: When closing an AI company the local player cheated to, we need to cheat them to another company [FS#4654] (r22624, r22623)
|
||||||
- Fix: When closing down companies their shares in other companies must be sold even if share trading is disabled at that point of time (r22622)
|
- Fix: When closing down companies their shares in other companies must be sold even if share trading is disabled at that point of time (r22622)
|
||||||
- Fix: When asking the user to confirm an unsafe unpausing, there is no need to execute a command if 'no' is chosen. This also prevents crashing when clicking unpause while the confirm window is shown (r22621)
|
- Fix: When asking the user to confirm an unsafe unpausing, there is no need to execute a command if 'no' is chosen. This also prevents crashing when clicking unpause while the confirm window is shown (r22621)
|
||||||
- Fix: Enforce refit orders to be 'always go to depot' orders; service-only and stop-in-depot orders make no sense with refitting [FS#4651] (r22620)
|
- Fix: Enforce refit orders to be 'always go to depot' orders; service-only and stop-in-depot orders make no sense with refitting [FS#4651] (r22620)
|
||||||
@@ -3016,7 +3121,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
|
|||||||
- Fix: Chat message caused glitch when rejoining a network game [FS#3757] (r19629)
|
- Fix: Chat message caused glitch when rejoining a network game [FS#3757] (r19629)
|
||||||
- Fix: Desync when a command is received and in the queue while a client starts joining, i.e. save the game state. This can happen in two ways: with frame_freq > 1 a command received in a previous frame might not be executed yet or when a command is received in the same frame as the join but before the savegame is made. In both cases the joining client would not get all commands to get in-sync with the server (and the other clients) (r19620)
|
- Fix: Desync when a command is received and in the queue while a client starts joining, i.e. save the game state. This can happen in two ways: with frame_freq > 1 a command received in a previous frame might not be executed yet or when a command is received in the same frame as the join but before the savegame is made. In both cases the joining client would not get all commands to get in-sync with the server (and the other clients) (r19620)
|
||||||
- Fix: Company related graphs were not updated correctly after changing the company colour [FS#3763] (r19615)
|
- Fix: Company related graphs were not updated correctly after changing the company colour [FS#3763] (r19615)
|
||||||
- Fix: Possible invalid read when server moves client to spectators before he finishes joining [FS#3755] (r19613)
|
- Fix: Possible invalid read when server moves client to spectators before they finish joining [FS#3755] (r19613)
|
||||||
- Fix: Crash when opening a savegame with a waypoint from around 0.4.0 [FS#3756] (r19612)
|
- Fix: Crash when opening a savegame with a waypoint from around 0.4.0 [FS#3756] (r19612)
|
||||||
- Fix: Improve joining behaviour; kicking clients when entering passwords that was just cleared, 'connection lost' for people failing the password, access restriction circumvention [CVE-2010-0401] [FS#3754] (r19610, r19609, r19608, r19607, r19606)
|
- Fix: Improve joining behaviour; kicking clients when entering passwords that was just cleared, 'connection lost' for people failing the password, access restriction circumvention [CVE-2010-0401] [FS#3754] (r19610, r19609, r19608, r19607, r19606)
|
||||||
- Fix: Desync debugging; false positives in the cache validity checks and saving/loading the command stream (r19619, r19617, r19602, r19601, r19600, r19596, r19593, r19592, r19589, r19587, r19586)
|
- Fix: Desync debugging; false positives in the cache validity checks and saving/loading the command stream (r19619, r19617, r19602, r19601, r19600, r19596, r19593, r19592, r19589, r19587, r19586)
|
||||||
@@ -3371,7 +3476,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
|
|||||||
- Fix: Do not account for path reservation costs when entering a signal block via a 'block' signal. This way you will not get double penalties, both red signals and reservation costs, for the block signalled tracks [FS#2722] (r18535)
|
- Fix: Do not account for path reservation costs when entering a signal block via a 'block' signal. This way you will not get double penalties, both red signals and reservation costs, for the block signalled tracks [FS#2722] (r18535)
|
||||||
- Fix: [NewGRF] An industry NewGRF that defined a too small size for action0 prop 0A could cause a crash (r18527)
|
- Fix: [NewGRF] An industry NewGRF that defined a too small size for action0 prop 0A could cause a crash (r18527)
|
||||||
- Fix: Allegro does not like to work with extmidi, so warn the user about that [FS#3272] (r18520)
|
- Fix: Allegro does not like to work with extmidi, so warn the user about that [FS#3272] (r18520)
|
||||||
- Fix: When you pass a signal at danger, in a PBS controlled area, do not try to do the 'safe' thing and stop, but continue going; the user wanted the train to pass the signal at danger so (s)he has to suffer the consequences. Of course one can always stop the train manually [FS#2891] (r18515)
|
- Fix: When you pass a signal at danger, in a PBS controlled area, do not try to do the 'safe' thing and stop, but continue going; the user wanted the train to pass the signal at danger so they have to suffer the consequences. Of course one can always stop the train manually [FS#2891] (r18515)
|
||||||
- Fix: No error message was created for the first fatal NewGRF error [FS#3368] (r18506)
|
- Fix: No error message was created for the first fatal NewGRF error [FS#3368] (r18506)
|
||||||
- Fix: Improve airport movement on several airports [FS#3169] (r18505)
|
- Fix: Improve airport movement on several airports [FS#3169] (r18505)
|
||||||
- Fix: Autoreplace and autorenew always reset their cargo sub type to 0. Now find a sub cargo type with the exact same name and use that, otherwise fallback to 0. So cargo sub types can be maintained via autoreplace *if* the new vehicle supports the same cargo sub type [FS#3159] (r18499)
|
- Fix: Autoreplace and autorenew always reset their cargo sub type to 0. Now find a sub cargo type with the exact same name and use that, otherwise fallback to 0. So cargo sub types can be maintained via autoreplace *if* the new vehicle supports the same cargo sub type [FS#3159] (r18499)
|
||||||
@@ -3854,7 +3959,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
|
|||||||
- Fix: Make the join/spectate command require to be connected to a network game; in SP it could lead to crashes (r15514)
|
- Fix: Make the join/spectate command require to be connected to a network game; in SP it could lead to crashes (r15514)
|
||||||
- Fix: Generating a map with the original map generator with freeform edges on resulted in a crash [FS#2641] (r15511)
|
- Fix: Generating a map with the original map generator with freeform edges on resulted in a crash [FS#2641] (r15511)
|
||||||
- Fix: Pre-0.5 OpenTTD stored new_nonstop and full_load_any in a different way, savegame conversion was not working for them (r15500)
|
- Fix: Pre-0.5 OpenTTD stored new_nonstop and full_load_any in a different way, savegame conversion was not working for them (r15500)
|
||||||
- Fix: Crash when opening the game options when the currently loaded base graphics pack has less than 2 valid graphics files. For example when someone replaces all his/her original base graphics with custom work (but keeps the name) or renames the dos ones to windows or vice versa [FS#2630] (r15476)
|
- Fix: Crash when opening the game options when the currently loaded base graphics pack has less than 2 valid graphics files. For example when someone replaces all their original base graphics with custom work (but keeps the name) or renames the dos ones to windows or vice versa [FS#2630] (r15476)
|
||||||
|
|
||||||
|
|
||||||
0.7.0-beta1 (2009-02-16)
|
0.7.0-beta1 (2009-02-16)
|
||||||
@@ -4616,7 +4721,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
|
|||||||
- Fix: Switching players (using the cheat) crashed on Big Endian machines [FS#1150] (r11023)
|
- Fix: Switching players (using the cheat) crashed on Big Endian machines [FS#1150] (r11023)
|
||||||
- Fix: The canal border determination did not take oil rigs into consideration (r11022)
|
- Fix: The canal border determination did not take oil rigs into consideration (r11022)
|
||||||
- Fix: Do not display income/expenses when they do not belong to a 'valid' tile, like the money cheat/giving money [FS#1175] (r11021)
|
- Fix: Do not display income/expenses when they do not belong to a 'valid' tile, like the money cheat/giving money [FS#1175] (r11021)
|
||||||
- Fix: One could not give money when (s)he had too much money or rather: when casting the amount of money to an int32 becomes negative [FS#1174] (r11020)
|
- Fix: One could not give money when they had too much money or rather: when casting the amount of money to an int32 becomes negative [FS#1174] (r11020)
|
||||||
- Fix: When determining the gender of a string, do not assume that the gender is in the front of the string when there can be case switching code at that location [FS#1104] (r10792)
|
- Fix: When determining the gender of a string, do not assume that the gender is in the front of the string when there can be case switching code at that location [FS#1104] (r10792)
|
||||||
- Fix: Determining whether there is a tunnel going under the lowered area is only needed in two directions instead of all four, so take the directions (one for each axis) to the nearest border (along the given axis) [FS#1058] (r10686)
|
- Fix: Determining whether there is a tunnel going under the lowered area is only needed in two directions instead of all four, so take the directions (one for each axis) to the nearest border (along the given axis) [FS#1058] (r10686)
|
||||||
- Fix: Graphical glitches when the 'link landscape toolbar' patch is turned on when opening one of the construction toolbars [FS#1076] (r10685)
|
- Fix: Graphical glitches when the 'link landscape toolbar' patch is turned on when opening one of the construction toolbars [FS#1076] (r10685)
|
||||||
@@ -4677,7 +4782,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
|
|||||||
- Fix: Do not unconditionally assume that a tile has a depot (r11027)
|
- Fix: Do not unconditionally assume that a tile has a depot (r11027)
|
||||||
- Fix: Give a more correct error when building some things on tile 0 [FS#1173] (r11024)
|
- Fix: Give a more correct error when building some things on tile 0 [FS#1173] (r11024)
|
||||||
- Fix: Do not display income/expenses when they do not belong to a 'valid' tile, like the money cheat and giving money [FS#1175] (r11021)
|
- Fix: Do not display income/expenses when they do not belong to a 'valid' tile, like the money cheat and giving money [FS#1175] (r11021)
|
||||||
- Fix: One could not give money when (s)he had too much money [FS#1174] (r11020)
|
- Fix: One could not give money when they had too much money [FS#1174] (r11020)
|
||||||
- Fix: Disallow buying/selling shares in your own company or a bankrupt company [FS#1169] (r11018)
|
- Fix: Disallow buying/selling shares in your own company or a bankrupt company [FS#1169] (r11018)
|
||||||
- Fix: Crash when quitting the game in one of the end score windows [FS#1218] (r11071)
|
- Fix: Crash when quitting the game in one of the end score windows [FS#1218] (r11071)
|
||||||
|
|
||||||
@@ -5637,7 +5742,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
|
|||||||
- Fix: Vehicles slow down under bridge if the track is on a foundation
|
- Fix: Vehicles slow down under bridge if the track is on a foundation
|
||||||
- Fix: You can no longer change name of waypoints whom are owned by somebody else
|
- Fix: You can no longer change name of waypoints whom are owned by somebody else
|
||||||
- Fix: Shares are now also sold when a company goes bankrupt [SF#1090313]
|
- Fix: Shares are now also sold when a company goes bankrupt [SF#1090313]
|
||||||
- Fix: It is no longer possible to crash trains of other companies by building a depot close to a station; trains do no longer enter tiles that do not belong to his owner [SF#1087701]
|
- Fix: It is no longer possible to crash trains of other companies by building a depot close to a station; trains do no longer enter tiles that do not belong to their owner [SF#1087701]
|
||||||
- Fix: Crashed trains are not reported to have too few orders any more [SF#1087403]
|
- Fix: Crashed trains are not reported to have too few orders any more [SF#1087403]
|
||||||
- Fix: Backup-order-list was not closed with an OT_NOTHING, [SF#1086375]
|
- Fix: Backup-order-list was not closed with an OT_NOTHING, [SF#1086375]
|
||||||
- Fix: Docks now have a button to display the catchment area [SF#1085255]
|
- Fix: Docks now have a button to display the catchment area [SF#1085255]
|
||||||
|
|||||||
@@ -74,6 +74,13 @@ This is usable for any OpenTTD servers
|
|||||||
|
|
||||||
== CHANGELOG ==
|
== CHANGELOG ==
|
||||||
|
|
||||||
|
*** 12.0-beta2 (19 Aug 2021) ***
|
||||||
|
- Fixed crash when building airport with no valid airport type selected.
|
||||||
|
- Renamed a bunch of setttings in the config file adding cm_* prefix to distinguish them from vanilla ones.
|
||||||
|
- Removed setting to show train length in old format in the depot (new one is more usable now).
|
||||||
|
- Removed setting to disable ending the polyrail with double click (it's always disabled).
|
||||||
|
- Removed setting to disable starting-stopping vehicles with ctrl-click (seems pointless).
|
||||||
|
|
||||||
*** 1.11.2 (3 May 2021) ***
|
*** 1.11.2 (3 May 2021) ***
|
||||||
- OpenTTD update.
|
- OpenTTD update.
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ macro(compile_flags)
|
|||||||
add_compile_options(/Zc:rvalueCast)
|
add_compile_options(/Zc:rvalueCast)
|
||||||
|
|
||||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
# Enable multi-threaded compilation.
|
add_compile_options(
|
||||||
add_compile_options(/MP)
|
/MP # Enable multi-threaded compilation.
|
||||||
|
/FC # Display the full path of source code files passed to the compiler in diagnostics.
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -156,7 +158,7 @@ macro(compile_flags)
|
|||||||
message(FATAL_ERROR "No warning flags are set for this compiler yet; please consider creating a Pull Request to add support for this compiler.")
|
message(FATAL_ERROR "No warning flags are set for this compiler yet; please consider creating a Pull Request to add support for this compiler.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32 AND NOT HAIKU)
|
||||||
# rdynamic is used to get useful stack traces from crash reports.
|
# rdynamic is used to get useful stack traces from crash reports.
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -139,6 +139,13 @@ elseif(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-windows-${CPACK_SYSTEM_NAME}")
|
set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-windows-${CPACK_SYSTEM_NAME}")
|
||||||
|
|
||||||
|
if(WINDOWS_CERTIFICATE_COMMON_NAME)
|
||||||
|
add_custom_command(TARGET openttd
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND "${CMAKE_SOURCE_DIR}/os/windows/sign.bat" "$<TARGET_FILE:openttd>" "${WINDOWS_CERTIFICATE_COMMON_NAME}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
# With FHS, we can create deb/rpm/... Without it, they would be horribly broken
|
# 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
|
# and not work. The other way around is also true; with FHS they are not
|
||||||
|
|||||||
@@ -11,12 +11,13 @@ source_group("Network Core" REGULAR_EXPRESSION "src/network/core/")
|
|||||||
source_group("OSX" REGULAR_EXPRESSION "src/os/macosx/")
|
source_group("OSX" REGULAR_EXPRESSION "src/os/macosx/")
|
||||||
source_group("Pathfinder" REGULAR_EXPRESSION "src/pathfinder/")
|
source_group("Pathfinder" REGULAR_EXPRESSION "src/pathfinder/")
|
||||||
source_group("Save/Load handlers" REGULAR_EXPRESSION "src/saveload/")
|
source_group("Save/Load handlers" REGULAR_EXPRESSION "src/saveload/")
|
||||||
|
source_group("Save/Load handlers\\Compat" REGULAR_EXPRESSION "src/saveload/compat/")
|
||||||
source_group("Sound" REGULAR_EXPRESSION "src/sound/")
|
source_group("Sound" REGULAR_EXPRESSION "src/sound/")
|
||||||
source_group("Sprite loaders" REGULAR_EXPRESSION "src/spriteloader/")
|
source_group("Sprite loaders" REGULAR_EXPRESSION "src/spriteloader/")
|
||||||
source_group("Squirrel" REGULAR_EXPRESSION "src/3rdparty/squirrel/squirrel/")
|
source_group("Squirrel" REGULAR_EXPRESSION "src/3rdparty/squirrel/squirrel/")
|
||||||
source_group("Tables" REGULAR_EXPRESSION "src/table/")
|
source_group("Tables" REGULAR_EXPRESSION "src/table/")
|
||||||
source_group("Video" REGULAR_EXPRESSION "src/video/")
|
source_group("Video" REGULAR_EXPRESSION "src/video/")
|
||||||
source_group("Video/GL" REGULAR_EXPRESSION "src/3rdparty/opengl/")
|
source_group("Video\\GL" REGULAR_EXPRESSION "src/3rdparty/opengl/")
|
||||||
source_group("Widgets" REGULAR_EXPRESSION "src/widgets/")
|
source_group("Widgets" REGULAR_EXPRESSION "src/widgets/")
|
||||||
source_group("Windows files" REGULAR_EXPRESSION "src/os/windows/|\.rc$")
|
source_group("Windows files" REGULAR_EXPRESSION "src/os/windows/|\.rc$")
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ function(set_options)
|
|||||||
|
|
||||||
option(OPTION_DEDICATED "Build dedicated server only (no GUI)" OFF)
|
option(OPTION_DEDICATED "Build dedicated server only (no GUI)" OFF)
|
||||||
option(OPTION_INSTALL_FHS "Install with Filesystem Hierarchy Standard folders" ${DEFAULT_OPTION_INSTALL_FHS})
|
option(OPTION_INSTALL_FHS "Install with Filesystem Hierarchy Standard folders" ${DEFAULT_OPTION_INSTALL_FHS})
|
||||||
option(OPTION_USE_ASSERTS "Use assertions; leave enabled for nightlies, betas, and RCs" OFF)
|
option(OPTION_USE_ASSERTS "Use assertions; leave enabled for nightlies, betas, and RCs" ON)
|
||||||
if(EMSCRIPTEN)
|
if(EMSCRIPTEN)
|
||||||
# Although pthreads is supported, it is not in a way yet that is
|
# Although pthreads is supported, it is not in a way yet that is
|
||||||
# useful for us.
|
# useful for us.
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ endif()
|
|||||||
if(NOT REV_MINOR)
|
if(NOT REV_MINOR)
|
||||||
set(REV_MINOR 0)
|
set(REV_MINOR 0)
|
||||||
endif()
|
endif()
|
||||||
if(NOT REV_BUILD)
|
|
||||||
set(REV_BUILD 0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Finds the current version of the current folder.
|
# Finds the current version of the current folder.
|
||||||
@@ -138,7 +135,7 @@ else()
|
|||||||
configure_file("${CMAKE_SOURCE_DIR}/src/rev.cpp.in"
|
configure_file("${CMAKE_SOURCE_DIR}/src/rev.cpp.in"
|
||||||
"${FIND_VERSION_BINARY_DIR}/rev.cpp")
|
"${FIND_VERSION_BINARY_DIR}/rev.cpp")
|
||||||
|
|
||||||
if(WIN32)
|
if(WINDOWS)
|
||||||
message(STATUS "Generating ottdres.rc")
|
message(STATUS "Generating ottdres.rc")
|
||||||
configure_file("${CMAKE_SOURCE_DIR}/src/os/windows/ottdres.rc.in"
|
configure_file("${CMAKE_SOURCE_DIR}/src/os/windows/ottdres.rc.in"
|
||||||
"${FIND_VERSION_BINARY_DIR}/ottdres.rc")
|
"${FIND_VERSION_BINARY_DIR}/ottdres.rc")
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ endmacro()
|
|||||||
macro(dump_class_templates NAME)
|
macro(dump_class_templates NAME)
|
||||||
string(REGEX REPLACE "^Script" "" REALNAME ${NAME})
|
string(REGEX REPLACE "^Script" "" REALNAME ${NAME})
|
||||||
|
|
||||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline ${NAME} *GetParam(ForceType<${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (${NAME} *)instance; }")
|
string(APPEND SQUIRREL_EXPORT "\n template <> inline ${NAME} *GetParam(ForceType<${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return (${NAME} *)instance; }")
|
||||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline ${NAME} &GetParam(ForceType<${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(${NAME} *)instance; }")
|
string(APPEND SQUIRREL_EXPORT "\n template <> inline ${NAME} &GetParam(ForceType<${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return *(${NAME} *)instance; }")
|
||||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline const ${NAME} *GetParam(ForceType<const ${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (${NAME} *)instance; }")
|
string(APPEND SQUIRREL_EXPORT "\n template <> inline const ${NAME} *GetParam(ForceType<const ${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return (${NAME} *)instance; }")
|
||||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline const ${NAME} &GetParam(ForceType<const ${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(${NAME} *)instance; }")
|
string(APPEND SQUIRREL_EXPORT "\n template <> inline const ${NAME} &GetParam(ForceType<const ${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return *(${NAME} *)instance; }")
|
||||||
if("${NAME}" STREQUAL "ScriptEvent")
|
if("${NAME}" STREQUAL "ScriptEvent")
|
||||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline int Return<${NAME} *>(HSQUIRRELVM vm, ${NAME} *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, \"${REALNAME}\", res, nullptr, DefSQDestructorCallback<${NAME}>, true); return 1; }")
|
string(APPEND SQUIRREL_EXPORT "\n template <> inline int Return<${NAME} *>(HSQUIRRELVM vm, ${NAME} *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, \"${REALNAME}\", res, nullptr, DefSQDestructorCallback<${NAME}>, true); return 1; }")
|
||||||
elseif("${NAME}" STREQUAL "ScriptText")
|
elseif("${NAME}" STREQUAL "ScriptText")
|
||||||
|
|||||||
557
docs/company_colour_indexes.html
Normal file
557
docs/company_colour_indexes.html
Normal file
@@ -0,0 +1,557 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
||||||
|
<!-- derived from Iron Horse branch at https://github.com/andythenorth/iron-horse/tree/company_colour_indexes -->
|
||||||
|
<head>
|
||||||
|
<title>OpenTTD Company Colour Indexes</title>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<style>
|
||||||
|
th {
|
||||||
|
vertical-align: top;
|
||||||
|
border-bottom: solid 1px #ddd;
|
||||||
|
padding-top: 30px;
|
||||||
|
padding-right: 15px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
tr.top td {
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
tr.bottom td {
|
||||||
|
border-bottom: solid 1px #ddd;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
td {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
border: solid 1px #000;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
|
margin-left: 0px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Company Colour Indexes</h1>
|
||||||
|
<p>Hex / dec indexes into the DOS palette</p>
|
||||||
|
<p>
|
||||||
|
Visual representation of values derived from <a href="https://github.com/frosch123/TTDViewer/blob/master/src/recolor.xml#L186">https://github.com/frosch123/TTDViewer/blob/master/src/recolor.xml#L186</a>
|
||||||
|
</p>
|
||||||
|
<table style="margin-top:30px;">
|
||||||
|
<tbody>
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_DARK_BLUE</th>
|
||||||
|
<td><span style="background-color:rgb( 8, 24, 88)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 12, 36, 104)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 20, 52, 124)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 28, 68, 140)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 40, 92, 164)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 56, 120, 188)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 72, 152, 216)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(100, 172, 224)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0xc6</td>
|
||||||
|
<td>0xc7</td>
|
||||||
|
<td>0xc8</td>
|
||||||
|
<td>0xc9</td>
|
||||||
|
<td>0xca</td>
|
||||||
|
<td>0xcb</td>
|
||||||
|
<td>0xcc</td>
|
||||||
|
<td>0xcd</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>198</td>
|
||||||
|
<td>199</td>
|
||||||
|
<td>200</td>
|
||||||
|
<td>201</td>
|
||||||
|
<td>202</td>
|
||||||
|
<td>203</td>
|
||||||
|
<td>204</td>
|
||||||
|
<td>205</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_PALE_GREEN</th>
|
||||||
|
<td><span style="background-color:rgb( 16, 52, 24)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 32, 72, 44)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 56, 96, 72)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 76, 116, 88)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 96, 136, 108)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(120, 164, 136)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(152, 192, 168)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(184, 220, 200)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x60</td>
|
||||||
|
<td>0x61</td>
|
||||||
|
<td>0x62</td>
|
||||||
|
<td>0x63</td>
|
||||||
|
<td>0x64</td>
|
||||||
|
<td>0x65</td>
|
||||||
|
<td>0x66</td>
|
||||||
|
<td>0x67</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>96</td>
|
||||||
|
<td>97</td>
|
||||||
|
<td>98</td>
|
||||||
|
<td>99</td>
|
||||||
|
<td>100</td>
|
||||||
|
<td>101</td>
|
||||||
|
<td>102</td>
|
||||||
|
<td>103</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_PINK</th>
|
||||||
|
<td><span style="background-color:rgb(112, 16, 32)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(136, 32, 52)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(160, 56, 76)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(188, 84, 108)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(204, 104, 124)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(220, 132, 144)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(236, 156, 164)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 188, 192)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x2a</td>
|
||||||
|
<td>0x2b</td>
|
||||||
|
<td>0x2c</td>
|
||||||
|
<td>0x2d</td>
|
||||||
|
<td>0x2e</td>
|
||||||
|
<td>0x2f</td>
|
||||||
|
<td>0x30</td>
|
||||||
|
<td>0x31</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>42</td>
|
||||||
|
<td>43</td>
|
||||||
|
<td>44</td>
|
||||||
|
<td>45</td>
|
||||||
|
<td>46</td>
|
||||||
|
<td>47</td>
|
||||||
|
<td>48</td>
|
||||||
|
<td>49</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_YELLOW</th>
|
||||||
|
<td><span style="background-color:rgb(128, 68, 8)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(156, 96, 16)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(184, 120, 24)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(212, 156, 32)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(232, 184, 16)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 212, 0)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 248, 128)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 252, 192)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x3e</td>
|
||||||
|
<td>0x3f</td>
|
||||||
|
<td>0x40</td>
|
||||||
|
<td>0x41</td>
|
||||||
|
<td>0x42</td>
|
||||||
|
<td>0x43</td>
|
||||||
|
<td>0x44</td>
|
||||||
|
<td>0x45</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>62</td>
|
||||||
|
<td>63</td>
|
||||||
|
<td>64</td>
|
||||||
|
<td>65</td>
|
||||||
|
<td>66</td>
|
||||||
|
<td>67</td>
|
||||||
|
<td>68</td>
|
||||||
|
<td>69</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_RED</th>
|
||||||
|
<td><span style="background-color:rgb( 92, 0, 0)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(128, 0, 0)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(160, 0, 0)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(196, 0, 0)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(224, 0, 0)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 52, 52)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 100, 88)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 144, 124)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0xb3</td>
|
||||||
|
<td>0xb4</td>
|
||||||
|
<td>0xb5</td>
|
||||||
|
<td>0xb6</td>
|
||||||
|
<td>0xb7</td>
|
||||||
|
<td>0xa4</td>
|
||||||
|
<td>0xa5</td>
|
||||||
|
<td>0xa6</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>179</td>
|
||||||
|
<td>180</td>
|
||||||
|
<td>181</td>
|
||||||
|
<td>182</td>
|
||||||
|
<td>183</td>
|
||||||
|
<td>164</td>
|
||||||
|
<td>165</td>
|
||||||
|
<td>166</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_LIGHT_BLUE</th>
|
||||||
|
<td><span style="background-color:rgb( 16, 64, 96)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 24, 80, 108)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 40, 96, 120)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 52, 112, 132)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 80, 140, 160)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(116, 172, 192)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(156, 204, 220)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(204, 240, 252)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x9a</td>
|
||||||
|
<td>0x9b</td>
|
||||||
|
<td>0x9c</td>
|
||||||
|
<td>0x9d</td>
|
||||||
|
<td>0x9e</td>
|
||||||
|
<td>0x9f</td>
|
||||||
|
<td>0xa0</td>
|
||||||
|
<td>0xa1</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>154</td>
|
||||||
|
<td>155</td>
|
||||||
|
<td>156</td>
|
||||||
|
<td>157</td>
|
||||||
|
<td>158</td>
|
||||||
|
<td>159</td>
|
||||||
|
<td>160</td>
|
||||||
|
<td>161</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_GREEN</th>
|
||||||
|
<td><span style="background-color:rgb( 32, 80, 4)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 48, 96, 4)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 64, 112, 12)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 84, 132, 20)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 92, 156, 52)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(108, 176, 64)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(124, 200, 76)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(144, 224, 92)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x52</td>
|
||||||
|
<td>0x53</td>
|
||||||
|
<td>0x54</td>
|
||||||
|
<td>0x55</td>
|
||||||
|
<td>0xce</td>
|
||||||
|
<td>0xcf</td>
|
||||||
|
<td>0xd0</td>
|
||||||
|
<td>0xd1</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>82</td>
|
||||||
|
<td>83</td>
|
||||||
|
<td>84</td>
|
||||||
|
<td>85</td>
|
||||||
|
<td>206</td>
|
||||||
|
<td>207</td>
|
||||||
|
<td>208</td>
|
||||||
|
<td>209</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_DARK_GREEN</th>
|
||||||
|
<td><span style="background-color:rgb( 28, 52, 24)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 44, 68, 32)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 60, 88, 48)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 80, 104, 60)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(104, 124, 76)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(128, 148, 92)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(152, 176, 108)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(180, 204, 124)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x58</td>
|
||||||
|
<td>0x59</td>
|
||||||
|
<td>0x5a</td>
|
||||||
|
<td>0x5b</td>
|
||||||
|
<td>0x5c</td>
|
||||||
|
<td>0x5d</td>
|
||||||
|
<td>0x5e</td>
|
||||||
|
<td>0x5f</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>88</td>
|
||||||
|
<td>89</td>
|
||||||
|
<td>90</td>
|
||||||
|
<td>91</td>
|
||||||
|
<td>92</td>
|
||||||
|
<td>93</td>
|
||||||
|
<td>94</td>
|
||||||
|
<td>95</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_BLUE</th>
|
||||||
|
<td><span style="background-color:rgb( 0, 52, 160)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 0, 72, 184)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 0, 96, 212)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 24, 120, 220)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 56, 144, 232)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 88, 168, 240)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(128, 196, 252)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(188, 224, 252)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x92</td>
|
||||||
|
<td>0x93</td>
|
||||||
|
<td>0x94</td>
|
||||||
|
<td>0x95</td>
|
||||||
|
<td>0x96</td>
|
||||||
|
<td>0x97</td>
|
||||||
|
<td>0x98</td>
|
||||||
|
<td>0x99</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>146</td>
|
||||||
|
<td>147</td>
|
||||||
|
<td>148</td>
|
||||||
|
<td>149</td>
|
||||||
|
<td>150</td>
|
||||||
|
<td>151</td>
|
||||||
|
<td>152</td>
|
||||||
|
<td>153</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_CREAM</th>
|
||||||
|
<td><span style="background-color:rgb(116, 68, 40)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(136, 84, 56)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(164, 96, 64)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(184, 112, 80)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(204, 128, 96)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(212, 148, 112)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(224, 168, 128)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(236, 188, 148)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x72</td>
|
||||||
|
<td>0x73</td>
|
||||||
|
<td>0x74</td>
|
||||||
|
<td>0x75</td>
|
||||||
|
<td>0x76</td>
|
||||||
|
<td>0x77</td>
|
||||||
|
<td>0x78</td>
|
||||||
|
<td>0x79</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>114</td>
|
||||||
|
<td>115</td>
|
||||||
|
<td>116</td>
|
||||||
|
<td>117</td>
|
||||||
|
<td>118</td>
|
||||||
|
<td>119</td>
|
||||||
|
<td>120</td>
|
||||||
|
<td>121</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_MAUVE</th>
|
||||||
|
<td><span style="background-color:rgb( 36, 40, 68)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 48, 52, 84)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 64, 64, 100)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 80, 80, 116)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(100, 100, 136)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(132, 132, 164)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(172, 172, 192)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(212, 212, 224)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x80</td>
|
||||||
|
<td>0x81</td>
|
||||||
|
<td>0x82</td>
|
||||||
|
<td>0x83</td>
|
||||||
|
<td>0x84</td>
|
||||||
|
<td>0x85</td>
|
||||||
|
<td>0x86</td>
|
||||||
|
<td>0x87</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>128</td>
|
||||||
|
<td>129</td>
|
||||||
|
<td>130</td>
|
||||||
|
<td>131</td>
|
||||||
|
<td>132</td>
|
||||||
|
<td>133</td>
|
||||||
|
<td>134</td>
|
||||||
|
<td>135</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_PURPLE</th>
|
||||||
|
<td><span style="background-color:rgb( 40, 20, 112)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 64, 44, 144)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 88, 64, 172)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(104, 76, 196)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(120, 88, 224)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(140, 104, 252)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(160, 136, 252)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(188, 168, 252)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x88</td>
|
||||||
|
<td>0x89</td>
|
||||||
|
<td>0x8a</td>
|
||||||
|
<td>0x8b</td>
|
||||||
|
<td>0x8c</td>
|
||||||
|
<td>0x8d</td>
|
||||||
|
<td>0x8e</td>
|
||||||
|
<td>0x8f</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>136</td>
|
||||||
|
<td>137</td>
|
||||||
|
<td>138</td>
|
||||||
|
<td>139</td>
|
||||||
|
<td>140</td>
|
||||||
|
<td>141</td>
|
||||||
|
<td>142</td>
|
||||||
|
<td>143</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_ORANGE</th>
|
||||||
|
<td><span style="background-color:rgb(184, 120, 24)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(204, 136, 8)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(228, 144, 4)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 156, 0)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 176, 48)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 196, 100)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 216, 152)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(244, 220, 176)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x40</td>
|
||||||
|
<td>0xc0</td>
|
||||||
|
<td>0xc1</td>
|
||||||
|
<td>0xc2</td>
|
||||||
|
<td>0xc3</td>
|
||||||
|
<td>0xc4</td>
|
||||||
|
<td>0xc5</td>
|
||||||
|
<td>0x27</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>64</td>
|
||||||
|
<td>192</td>
|
||||||
|
<td>193</td>
|
||||||
|
<td>194</td>
|
||||||
|
<td>195</td>
|
||||||
|
<td>196</td>
|
||||||
|
<td>197</td>
|
||||||
|
<td>39</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_BROWN</th>
|
||||||
|
<td><span style="background-color:rgb( 72, 44, 4)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 88, 60, 20)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(104, 80, 44)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(124, 104, 72)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(152, 132, 92)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(184, 160, 120)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(212, 188, 148)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(244, 220, 176)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x20</td>
|
||||||
|
<td>0x21</td>
|
||||||
|
<td>0x22</td>
|
||||||
|
<td>0x23</td>
|
||||||
|
<td>0x24</td>
|
||||||
|
<td>0x25</td>
|
||||||
|
<td>0x26</td>
|
||||||
|
<td>0x27</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>32</td>
|
||||||
|
<td>33</td>
|
||||||
|
<td>34</td>
|
||||||
|
<td>35</td>
|
||||||
|
<td>36</td>
|
||||||
|
<td>37</td>
|
||||||
|
<td>38</td>
|
||||||
|
<td>39</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_GREY</th>
|
||||||
|
<td><span style="background-color:rgb( 64, 64, 64)"></span></td>
|
||||||
|
<td><span style="background-color:rgb( 80, 80, 80)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(100, 100, 100)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(116, 116, 116)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(132, 132, 132)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(148, 148, 148)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(168, 168, 168)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(184, 184, 184)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x4</td>
|
||||||
|
<td>0x5</td>
|
||||||
|
<td>0x6</td>
|
||||||
|
<td>0x7</td>
|
||||||
|
<td>0x8</td>
|
||||||
|
<td>0x9</td>
|
||||||
|
<td>0xa</td>
|
||||||
|
<td>0xb</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>4</td>
|
||||||
|
<td>5</td>
|
||||||
|
<td>6</td>
|
||||||
|
<td>7</td>
|
||||||
|
<td>8</td>
|
||||||
|
<td>9</td>
|
||||||
|
<td>10</td>
|
||||||
|
<td>11</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="top">
|
||||||
|
<th rowspan="3">COLOUR_WHITE</th>
|
||||||
|
<td><span style="background-color:rgb(132, 132, 132)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(148, 148, 148)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(168, 168, 168)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(184, 184, 184)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(200, 200, 200)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(216, 216, 216)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(232, 232, 232)"></span></td>
|
||||||
|
<td><span style="background-color:rgb(252, 252, 252)"></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0x8</td>
|
||||||
|
<td>0x9</td>
|
||||||
|
<td>0xa</td>
|
||||||
|
<td>0xb</td>
|
||||||
|
<td>0xc</td>
|
||||||
|
<td>0xd</td>
|
||||||
|
<td>0xe</td>
|
||||||
|
<td>0xf</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="bottom">
|
||||||
|
<td>8</td>
|
||||||
|
<td>9</td>
|
||||||
|
<td>10</td>
|
||||||
|
<td>11</td>
|
||||||
|
<td>12</td>
|
||||||
|
<td>13</td>
|
||||||
|
<td>14</td>
|
||||||
|
<td>15</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
83
docs/game_coordinator.md
Normal file
83
docs/game_coordinator.md
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
# Game Coordinator
|
||||||
|
|
||||||
|
To allow two players to play together, OpenTTD uses a Game Coordinator to
|
||||||
|
facilitate this.
|
||||||
|
|
||||||
|
When a server starts, it can register itself to the Game Coordinator. This
|
||||||
|
happens when `server_game_type` is set to either `invite-only` or `public`.
|
||||||
|
Upon registration, the Game Coordinator probes the network of the server, and
|
||||||
|
assigns the server an unique code, called an `invite code`.
|
||||||
|
|
||||||
|
When a client wants to join a server, it asks the Game Coordinator to help
|
||||||
|
with this by giving it the `invite code` of the server. The Game Coordinator
|
||||||
|
will, in this order, attempt several ways to connect the client and server
|
||||||
|
together:
|
||||||
|
|
||||||
|
## 1) Via direct IPv4 / IPv6
|
||||||
|
|
||||||
|
Upon registration, the Game Coordinator probes the server to see if a
|
||||||
|
direction connection to the server is possible based on the game port. It
|
||||||
|
tries this over the public IPv4 and IPv6, as announced by the server.
|
||||||
|
If either (or both) are successful, a client will always be asked to try
|
||||||
|
these direct IPs first when it wants to connect to this server.
|
||||||
|
|
||||||
|
- If the server is IPv4 only, the client is only asked to connect via IPv4.
|
||||||
|
- If the server is IPv6 only, the client is only asked to connect via IPv6.
|
||||||
|
- If the server is both IPv4 and IPv6, the client is asked to connect to to
|
||||||
|
one of those first. If that fails, it is asked to connect to the other.
|
||||||
|
Whether it tries IPv4 or IPv6 first, strongly depends on several network
|
||||||
|
infrastructure related events. The biggest influence is the network
|
||||||
|
latency over both protocols to the OpenTTD infrastructure.
|
||||||
|
|
||||||
|
In the end, if either the server is not reachable directly from the Internet
|
||||||
|
or the client fails to connect to either one of them, the connection attempt
|
||||||
|
continues with the next available method.
|
||||||
|
|
||||||
|
## 2) Via STUN
|
||||||
|
|
||||||
|
When a client wants to join a server via STUN, both the client and server
|
||||||
|
are asked to create a connection to the STUN server (normally
|
||||||
|
`stun.openttd.org`) via both IPv4 and IPv6. If the client or server has no
|
||||||
|
IPv4 or IPv6, it will not make a connection attempt via that protocol.
|
||||||
|
|
||||||
|
The STUN server collects the public IPv4 and/or IPv6 of the client and server,
|
||||||
|
together with the port the connection came in from. For most NAT gateways it
|
||||||
|
holds true that as long as you use the same local IP + port, your public
|
||||||
|
IP + port will remain the same, and allow for bi-directional communication.
|
||||||
|
And this fact is used to later on pair the client and server.
|
||||||
|
|
||||||
|
The STUN server reports this information directly to the Game Coordinator
|
||||||
|
(this in contrast to most STUN implementation, where this information is
|
||||||
|
first reported back to the peer itself, which has to relay it back to the
|
||||||
|
coordinator. OpenTTD skips this step, as the STUN server can directly talk to
|
||||||
|
the Game Coordinator). When the Game Coordinator sees a matching pair (in
|
||||||
|
terms of IPv4 / IPv6), it will ask both the client and server to connect to
|
||||||
|
their peer based on this public IP + port.
|
||||||
|
|
||||||
|
As the NAT gateway forwards the traffic on the public IP + port to the local
|
||||||
|
port, this creates a bi-directional socket between client and server. The
|
||||||
|
connection to the STUN server can now safely be closed, and the client and
|
||||||
|
server can continue to talk to each other.
|
||||||
|
|
||||||
|
Some NAT gateways do not allow this method; for those this attempt will fail,
|
||||||
|
and this also means that it is not possible to create a connection between
|
||||||
|
the client and server.
|
||||||
|
|
||||||
|
## 3) Via TURN
|
||||||
|
|
||||||
|
As a last resort, the Game Coordinator can decide to connect the client and
|
||||||
|
server together via TURN. TURN is a relay service, relaying the messages
|
||||||
|
between client and server.
|
||||||
|
|
||||||
|
As the client and server can already connect to the Game Coordinator, it is
|
||||||
|
very likely this is successful.
|
||||||
|
|
||||||
|
It is important to note that a relay service has full view of the traffic
|
||||||
|
send between client and server, and as such it is important that you trust
|
||||||
|
the relay service used.
|
||||||
|
For official binaries, this relay service is hosted by openttd.org. The relay
|
||||||
|
service as hosted by openttd.org only validates it is relaying valid OpenTTD
|
||||||
|
packets and does no further inspection of the payload itself.
|
||||||
|
Although in our experience most patch-packs also use the services as offered
|
||||||
|
by openttd.org, it is possible they use different services. Please be mindful
|
||||||
|
about this.
|
||||||
@@ -79,7 +79,7 @@ the array so you can quickly see what is used and what is not.
|
|||||||
<tr>
|
<tr>
|
||||||
<td rowspan="2">0</td>
|
<td rowspan="2">0</td>
|
||||||
<td class="caption">ground</td>
|
<td class="caption">ground</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 type">XXXX</span> <span class="used" title="Presence and direction of bridge above">XX</span> <span class="used" title="Tropic Zone: only meaningful 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=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" 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="free">OOOO OOOO OOOO OOOO</span></td>
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ Last updated: 2011-02-16
|
|||||||
- click add server
|
- click add server
|
||||||
- type in the ip address or hostname
|
- type in the ip address or hostname
|
||||||
- if you want to add a port use :<port>
|
- if you want to add a port use :<port>
|
||||||
|
- If you want to play and you have the invite code of the game server you
|
||||||
|
want connect to.
|
||||||
|
- click add server
|
||||||
|
- type in the invite code
|
||||||
- Now you can select a company and press: "Join company", to help that company
|
- Now you can select a company and press: "Join company", to help that company
|
||||||
- Or you can press "Spectate game", to spectate the game
|
- Or you can press "Spectate game", to spectate the game
|
||||||
- Or you can press "New company", and start your own company (if there are
|
- Or you can press "New company", and start your own company (if there are
|
||||||
@@ -110,9 +114,10 @@ Last updated: 2011-02-16
|
|||||||
- You can let your server automatically restart a map when, let's say, year 2030
|
- You can let your server automatically restart a map when, let's say, year 2030
|
||||||
is reached. See 'set restart_game_date' for detail.
|
is reached. See 'set restart_game_date' for detail.
|
||||||
|
|
||||||
- If you want to be on the server-list, enable Advertising. To do this, select
|
- If you want to be on the server-list, make your server public. You can do
|
||||||
'Internet (advertise)' in the Start Server menu, or type in console:
|
this either from the Start Server GUI, via the in-game Online Players GUI,
|
||||||
'set server_advertise 1'.
|
or by typing in the console:
|
||||||
|
'set server_game_type public'.
|
||||||
|
|
||||||
- You can protect your server with a password via the console: 'set server_pw',
|
- You can protect your server with a password via the console: 'set server_pw',
|
||||||
or via the Start Server menu.
|
or via the Start Server menu.
|
||||||
|
|||||||
214
docs/savegame_format.md
Normal file
214
docs/savegame_format.md
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
# OpenTTD's Savegame Format
|
||||||
|
|
||||||
|
Last updated: 2021-06-15
|
||||||
|
|
||||||
|
## Outer container
|
||||||
|
|
||||||
|
Savegames for OpenTTD start with an outer container, to contain the compressed data for the rest of the savegame.
|
||||||
|
|
||||||
|
`[0..3]` - The first four bytes indicate what compression is used.
|
||||||
|
In ASCII, these values are possible:
|
||||||
|
|
||||||
|
- `OTTD` - Compressed with LZO (deprecated, only really old savegames would use this).
|
||||||
|
- `OTTN` - No compression.
|
||||||
|
- `OTTZ` - Compressed with zlib.
|
||||||
|
- `OTTX` - Compressed with LZMA.
|
||||||
|
|
||||||
|
`[4..5]` - The next two bytes indicate which savegame version used.
|
||||||
|
|
||||||
|
`[6..7]` - The next two bytes can be ignored, and were only used in really old savegames.
|
||||||
|
|
||||||
|
`[8..N]` - Next follows a binary blob which is compressed with the indicated compression algorithm.
|
||||||
|
|
||||||
|
The rest of this document talks about this decompressed blob of data.
|
||||||
|
|
||||||
|
## Data types
|
||||||
|
|
||||||
|
The savegame is written in Big Endian, so when we talk about a 16-bit unsigned integer (`uint16`), we mean it is stored in Big Endian.
|
||||||
|
|
||||||
|
The following types are valid:
|
||||||
|
|
||||||
|
- `1` - `int8` / `SLE_FILE_I8` -8-bit signed integer
|
||||||
|
- `2` - `uint8` / `SLE_FILE_U8` - 8-bit unsigned integer
|
||||||
|
- `3` - `int16` / `SLE_FILE_I16` - 16-bit signed integer
|
||||||
|
- `4` - `uint16` / `SLE_FILE_U16` - 16-bit unsigned integer
|
||||||
|
- `5` - `int32` / `SLE_FILE_I32` - 32-bit signed integer
|
||||||
|
- `6` - `uint32` / `SLE_FILE_U32` - 32-bit unsigned integer
|
||||||
|
- `7` - `int64` / `SLE_FILE_I64` - 64-bit signed integer
|
||||||
|
- `8` - `uint64` / `SLE_FILE_U64` - 64-bit unsigned integer
|
||||||
|
- `9` - `StringID` / `SLE_FILE_STRINGID` - a StringID inside the OpenTTD's string table
|
||||||
|
- `10` - `str` / `SLE_FILE_STRING` - a string (prefixed with a length-field)
|
||||||
|
- `11` - `struct` / `SLE_FILE_STRUCT` - a struct
|
||||||
|
|
||||||
|
### Gamma value
|
||||||
|
|
||||||
|
There is also a field-type called `gamma`.
|
||||||
|
This is most often used for length-fields, and uses as few bytes as possible to store an integer.
|
||||||
|
For values <= 127, it uses a single byte.
|
||||||
|
For values > 127, it uses two bytes and sets the highest bit to high.
|
||||||
|
For values > 32767, it uses three bytes and sets the two highest bits to high.
|
||||||
|
And this continues till the value fits.
|
||||||
|
In a more visual approach:
|
||||||
|
```
|
||||||
|
0xxxxxxx
|
||||||
|
10xxxxxx xxxxxxxx
|
||||||
|
110xxxxx xxxxxxxx xxxxxxxx
|
||||||
|
1110xxxx xxxxxxxx xxxxxxxx xxxxxxxx
|
||||||
|
11110--- xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
|
||||||
|
```
|
||||||
|
|
||||||
|
## Chunks
|
||||||
|
|
||||||
|
Savegames for OpenTTD store their data in chunks.
|
||||||
|
Each chunk contains data for a certain part of the game, for example "Companies", "Vehicles", etc.
|
||||||
|
|
||||||
|
`[0..3]` - Each chunk starts with four bytes to indicate the tag.
|
||||||
|
If the tag is `\x00\x00\x00\x00` it means the end of the savegame is reached.
|
||||||
|
An example of a valid tag is `PLYR` when looking at it via ASCII, which contains the information of all the companies.
|
||||||
|
|
||||||
|
`[4..4]` - Next follows a byte where the lower 4 bits contain the type.
|
||||||
|
The possible valid types are:
|
||||||
|
|
||||||
|
- `0` - `CH_RIFF` - This chunk is a binary blob.
|
||||||
|
- `1` - `CH_ARRAY` - This chunk is a list of items.
|
||||||
|
- `2` - `CH_SPARSE_ARRAY` - This chunk is a list of items.
|
||||||
|
- `3` - `CH_TABLE` - This chunk is self-describing list of items.
|
||||||
|
- `4` - `CH_SPARSE_TABLE` - This chunk is self-describing list of items.
|
||||||
|
|
||||||
|
Now per type the format is (slightly) different.
|
||||||
|
|
||||||
|
### CH_RIFF
|
||||||
|
|
||||||
|
(since savegame version 295, this chunk type is only used for MAP-chunks, containing bit-information about each tile on the map)
|
||||||
|
|
||||||
|
A `CH_RIFF` starts with an `uint24` which together with the upper-bits of the type defines the length of the chunk.
|
||||||
|
In pseudo-code:
|
||||||
|
|
||||||
|
```
|
||||||
|
type = read uint8
|
||||||
|
if type == 0
|
||||||
|
length = read uint24
|
||||||
|
length |= ((type >> 4) << 24)
|
||||||
|
```
|
||||||
|
|
||||||
|
The next `length` bytes are part of the chunk.
|
||||||
|
What those bytes mean depends on the tag of the chunk; further details per chunk can be found in the source-code.
|
||||||
|
|
||||||
|
### CH_ARRAY / CH_SPARSE_ARRAY
|
||||||
|
|
||||||
|
(this chunk type is deprecated since savegame version 295 and is no longer in use)
|
||||||
|
|
||||||
|
`[0..G1]` - A `CH_ARRAY` / `CH_SPARSE_ARRAY` starts with a `gamma`, indicating the size of the next item plus one.
|
||||||
|
If this size value is zero, it indicates the end of the list.
|
||||||
|
This indicates the full length of the next item minus one.
|
||||||
|
In psuedo-code:
|
||||||
|
|
||||||
|
```
|
||||||
|
loop
|
||||||
|
size = read gamma - 1
|
||||||
|
if size == -1
|
||||||
|
break loop
|
||||||
|
read <size> bytes
|
||||||
|
```
|
||||||
|
|
||||||
|
`[]` - For `CH_ARRAY` there is an implicit index.
|
||||||
|
The loop starts at zero, and every iteration adds one to the index.
|
||||||
|
For entries in the game that were not allocated, the `size` will be zero.
|
||||||
|
|
||||||
|
`[G1+1..G2]` - For `CH_SPARSE_ARRAY` there is an explicit index.
|
||||||
|
The `gamma` following the size indicates the index.
|
||||||
|
|
||||||
|
The content of the item is a binary blob, and similar to `CH_RIFF`, it depends on the tag of the chunk what it means.
|
||||||
|
Please check the source-code for further details.
|
||||||
|
|
||||||
|
### CH_TABLE / CH_SPARSE_TABLE
|
||||||
|
|
||||||
|
(this chunk type only exists since savegame version 295)
|
||||||
|
|
||||||
|
Both `CH_TABLE` and `CH_SPARSE_TABLE` are very similar to `CH_ARRAY` / `CH_SPARSE_ARRAY` respectively.
|
||||||
|
The only change is that the chunk starts with a header.
|
||||||
|
This header describes the chunk in details; with the header you know the meaning of each byte in the binary blob that follows.
|
||||||
|
|
||||||
|
`[0..G]` - The header starts with a `gamma` to indicate the size of all the headers in this chunk plus one.
|
||||||
|
If this size value is zero, it means there is no header, which should never be the case.
|
||||||
|
|
||||||
|
Next follows a list of `(type, key)` pairs:
|
||||||
|
|
||||||
|
- `[0..0]` - Type of the field.
|
||||||
|
- `[1..G]` - `gamma` to indicate length of key.
|
||||||
|
- `[G+1..N]` - Key (in UTF-8) of the field.
|
||||||
|
|
||||||
|
If at any point `type` is zero, the list stops (and no `key` follows).
|
||||||
|
|
||||||
|
The `type`'s lower 4 bits indicate the data-type (see chapter above).
|
||||||
|
The `type`'s 5th bit (so `0x10`) indicates if the field is a list, and if this field in every record starts with a `gamma` to indicate how many times the `type` is repeated.
|
||||||
|
|
||||||
|
If the `type` indicates either a `struct` or `str`, the `0x10` flag is also always set.
|
||||||
|
|
||||||
|
As the savegame format allows (list of) structs in structs, if any `struct` type is found, this header will be followed by a header of that struct.
|
||||||
|
This nesting of structs is stored depth-first, so given this table:
|
||||||
|
|
||||||
|
```
|
||||||
|
type | key
|
||||||
|
-----------------
|
||||||
|
uint8 | counter
|
||||||
|
struct | substruct1
|
||||||
|
struct | substruct2
|
||||||
|
```
|
||||||
|
|
||||||
|
With `substruct1` being like:
|
||||||
|
|
||||||
|
```
|
||||||
|
type | key
|
||||||
|
-----------------
|
||||||
|
uint8 | counter
|
||||||
|
struct | substruct3
|
||||||
|
```
|
||||||
|
|
||||||
|
The headers will be, in order: `table`, `substruct1`, `substruct3`, `substruct2`, each ending with a `type` is zero field.
|
||||||
|
|
||||||
|
After reading all the fields of all the headers, there is a list of records.
|
||||||
|
To read this, see `CH_ARRAY` / `CH_SPARSE_ARRAY` for details.
|
||||||
|
|
||||||
|
As each `type` has a well defined length, you can read the records even without knowing anything about the chunk-tag yourself.
|
||||||
|
|
||||||
|
Do remember, that if the `type` had the `0x10` flag active, the field in the record first has a `gamma` to indicate how many times that `type` is repeated.
|
||||||
|
|
||||||
|
#### Guidelines for network-compatible patch-packs
|
||||||
|
|
||||||
|
For network-compatible patch-packs (client-side patches that can play together with unpatched clients) we advise to prefix the field-name with `__<shortname>` when introducing new fields to an existing chunk.
|
||||||
|
|
||||||
|
Example: you have an extra setting called `auto_destroy_rivers` you want to store in the savegame for your patched client called `mypp`.
|
||||||
|
We advise you to call this setting `__mypp_auto_destroy_rivers` in the settings chunk.
|
||||||
|
|
||||||
|
Doing it this way ensures that a savegame created by these patch-packs can still safely be loaded by unpatched clients.
|
||||||
|
They will simply ignore the field and continue loading the savegame as usual.
|
||||||
|
The prefix is strongly advised to avoid conflicts with future-settings in an unpatched client or conflicts with other patch-packs.
|
||||||
|
|
||||||
|
## Scripts custom data format
|
||||||
|
|
||||||
|
Script chunks (`AIPL` and `GSDT`) use `CH_TABLE` chunk type.
|
||||||
|
|
||||||
|
At the end of each record there's an `uint8` to indicate if there's custom data (1) or not (0).
|
||||||
|
|
||||||
|
There are 6 data types for scripts, called `script-data-type`.
|
||||||
|
When saving, each `script-data-type` starts with the type marker saved as `uint8` followed by the actual data.
|
||||||
|
- `0` - `SQSL_INT`:
|
||||||
|
- an `int64` with the actual value (`int32` before savegame version 296).
|
||||||
|
- `1` - `SQSL_STRING`:
|
||||||
|
- an `uint8` with the string length.
|
||||||
|
- a list of `int8` for the string itself.
|
||||||
|
- `2` - `SQSL_ARRAY`:
|
||||||
|
- each element saved as `script-data-type`.
|
||||||
|
- an `SQSL_ARRAY_TABLE_END` (0xFF) marker (`uint8`).
|
||||||
|
- `3` - `SQSL_TABLE`:
|
||||||
|
- for each element:
|
||||||
|
- key saved as `script-data-type`.
|
||||||
|
- value saved as `script-data-type`.
|
||||||
|
- an `SQSL_ARRAY_TABLE_END` (0xFF) marker (`uint8`).
|
||||||
|
- `4` - `SQSL_BOOL`:
|
||||||
|
- an `uint8` with 0 (false) or 1 (true).
|
||||||
|
- `5` - `SQSL_NULL`:
|
||||||
|
- (no data follows)
|
||||||
|
|
||||||
|
The first data type is always a `SQSL_TABLE`.
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
OpenTTD's known bugs
|
OpenTTD's known bugs
|
||||||
Last updated: 2021-04-01
|
|
||||||
Release version: 1.11.0
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -4,7 +4,7 @@
|
|||||||
// 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/>.
|
// 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/>.
|
||||||
//
|
//
|
||||||
-1 * 0 0C "OpenTTD GUI graphics"
|
-1 * 0 0C "OpenTTD GUI graphics"
|
||||||
-1 * 3 05 15 \b 186 // OPENTTD_SPRITE_COUNT
|
-1 * 3 05 15 \b 191 // OPENTTD_SPRITE_COUNT
|
||||||
-1 sprites/openttdgui.png 8bpp 66 8 64 31 -31 7 normal
|
-1 sprites/openttdgui.png 8bpp 66 8 64 31 -31 7 normal
|
||||||
-1 sprites/openttdgui.png 8bpp 146 8 64 31 -31 7 normal
|
-1 sprites/openttdgui.png 8bpp 146 8 64 31 -31 7 normal
|
||||||
-1 sprites/openttdgui.png 8bpp 226 8 64 31 -31 7 normal
|
-1 sprites/openttdgui.png 8bpp 226 8 64 31 -31 7 normal
|
||||||
@@ -191,3 +191,8 @@
|
|||||||
-1 sprites/openttdgui_convert_tram.png 8bpp 24 0 32 32 0 0 normal
|
-1 sprites/openttdgui_convert_tram.png 8bpp 24 0 32 32 0 0 normal
|
||||||
-1 sprites/openttdgui.png 8bpp 513 440 10 10 0 0 normal
|
-1 sprites/openttdgui.png 8bpp 513 440 10 10 0 0 normal
|
||||||
-1 sprites/openttdgui.png 8bpp 526 440 10 10 0 0 normal
|
-1 sprites/openttdgui.png 8bpp 526 440 10 10 0 0 normal
|
||||||
|
-1 sprites/openttdgui.png 8bpp 539 440 12 10 0 0 normal
|
||||||
|
-1 sprites/openttdgui.png 8bpp 553 440 12 10 0 0 normal
|
||||||
|
-1 sprites/openttdgui.png 8bpp 567 440 12 10 0 0 normal
|
||||||
|
-1 sprites/openttdgui.png 8bpp 581 440 10 10 0 0 normal
|
||||||
|
-1 sprites/openttdgui.png 8bpp 593 440 10 10 0 0 normal
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 44 KiB |
Binary file not shown.
@@ -1,11 +0,0 @@
|
|||||||
# 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/>.
|
|
||||||
|
|
||||||
#
|
|
||||||
# Awk script to automatically remove duplicate Comment[i]= lines
|
|
||||||
#
|
|
||||||
|
|
||||||
BEGIN { FS = "="; last = "" }
|
|
||||||
{ if (last != $1) { print $0 }; last = $1 }
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
# http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html
|
|
||||||
[Desktop Entry]
|
|
||||||
Type=Application
|
|
||||||
Version=1.0
|
|
||||||
Name=!!MENU_NAME!!
|
|
||||||
Icon=!!TTD!!
|
|
||||||
Exec=!!TTD!!
|
|
||||||
Terminal=false
|
|
||||||
Categories=!!MENU_GROUP!!
|
|
||||||
Comment=A clone of Transport Tycoon Deluxe
|
|
||||||
Keywords=game;simulation;transport;tycoon;deluxe;economics;multiplayer;money;train;ship;bus;truck;aircraft;cargo;
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# 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/>.
|
|
||||||
|
|
||||||
#
|
|
||||||
# Awk script to automatically generate a comment lines for
|
|
||||||
# a translated desktop shortcut. If it does not exist there
|
|
||||||
# is no output.
|
|
||||||
#
|
|
||||||
|
|
||||||
/##isocode/ { lang = $2; next }
|
|
||||||
/STR_DESKTOP_SHORTCUT_COMMENT/ { sub("^[^:]*:", "", $0); print "Comment[" lang "]=" $0; sub("_.*", "", lang); print "Comment[" lang "]=" $0; next}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# LibLZMA is a recent addition to the emscripten SDK, so it is possible
|
# LibLZMA is a recent addition to the emscripten SDK, so it is possible
|
||||||
# someone hasn't updated his SDK yet. Test out if the SDK supports LibLZMA.
|
# someone hasn't updated their SDK yet. Test out if the SDK supports LibLZMA.
|
||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
set(CMAKE_REQUIRED_FLAGS "-sUSE_LIBLZMA=1")
|
set(CMAKE_REQUIRED_FLAGS "-sUSE_LIBLZMA=1")
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,15 @@ Module['websocket'] = { url: function(host, port, proto) {
|
|||||||
* If you run your own server you can setup your own WebSocket proxy in
|
* If you run your own server you can setup your own WebSocket proxy in
|
||||||
* front of it and let people connect to your server via the proxy. You
|
* front of it and let people connect to your server via the proxy. You
|
||||||
* are best to add another "if" statement as above for this. */
|
* are best to add another "if" statement as above for this. */
|
||||||
return null;
|
|
||||||
|
if (location.protocol === 'https:') {
|
||||||
|
/* Insecure WebSockets do not work over HTTPS, so we force
|
||||||
|
* secure ones. */
|
||||||
|
return 'wss://';
|
||||||
|
} else {
|
||||||
|
/* Use the default provided by Emscripten. */
|
||||||
|
return null;
|
||||||
|
}
|
||||||
} };
|
} };
|
||||||
|
|
||||||
Module.preRun.push(function() {
|
Module.preRun.push(function() {
|
||||||
@@ -65,10 +73,14 @@ Module.preRun.push(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.openttd_server_list = function() {
|
window.openttd_server_list = function() {
|
||||||
add_server = Module.cwrap("em_openttd_add_server", null, ["string", "number"]);
|
add_server = Module.cwrap("em_openttd_add_server", null, ["string"]);
|
||||||
|
|
||||||
/* Add servers that support WebSocket here. Example:
|
/* Add servers that support WebSocket here. Examples:
|
||||||
* add_server("localhost", 3979); */
|
* add_server("localhost");
|
||||||
|
* add_server("localhost:3979");
|
||||||
|
* add_server("127.0.0.1:3979");
|
||||||
|
* add_server("[::1]:3979");
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
var leftButtonDown = false;
|
var leftButtonDown = false;
|
||||||
|
|||||||
@@ -85,6 +85,8 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
/* OpenTTD draws the cursor itself */
|
||||||
|
cursor: none !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
18
os/windows/sign.bat
Normal file
18
os/windows/sign.bat
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
@echo off
|
||||||
|
REM Signing script
|
||||||
|
REM Arguments: sign.bat exe_to_sign certificate_subject_name
|
||||||
|
|
||||||
|
REM This is a loose wrapper around the Microsoft signtool application (included in the Windows SDK).
|
||||||
|
REM See https://docs.microsoft.com/en-us/dotnet/framework/tools/signtool-exe for more details.
|
||||||
|
|
||||||
|
REM Path to signtool.exe
|
||||||
|
IF NOT DEFINED SIGNTOOL_PATH (SET SIGNTOOL_PATH=signtool)
|
||||||
|
|
||||||
|
REM URL of the timestamp server
|
||||||
|
IF NOT DEFINED SIGNTOOL_TIMESTAMP_URL (SET SIGNTOOL_TIMESTAMP_URL=http://timestamp.digicert.com)
|
||||||
|
|
||||||
|
REM Sign with SHA-1 for Windows 7 and below
|
||||||
|
"%SIGNTOOL_PATH%" sign -v -n %2 -t %SIGNTOOL_TIMESTAMP_URL% %1
|
||||||
|
|
||||||
|
REM Sign with SHA-256 for Windows 8 and above
|
||||||
|
"%SIGNTOOL_PATH%" sign -v -n %2 -tr %SIGNTOOL_TIMESTAMP_URL% -fd sha256 -td sha256 -as %1
|
||||||
@@ -4,7 +4,7 @@ class Regression extends AIInfo {
|
|||||||
function GetShortName() { return "REGR"; }
|
function GetShortName() { return "REGR"; }
|
||||||
function GetDescription() { return "This runs regression-tests on some commands. On the same map the result should always be the same."; }
|
function GetDescription() { return "This runs regression-tests on some commands. On the same map the result should always be the same."; }
|
||||||
function GetVersion() { return 1; }
|
function GetVersion() { return 1; }
|
||||||
function GetAPIVersion() { return "1.11"; }
|
function GetAPIVersion() { return "12"; }
|
||||||
function GetDate() { return "2007-03-18"; }
|
function GetDate() { return "2007-03-18"; }
|
||||||
function CreateInstance() { return "Regression"; }
|
function CreateInstance() { return "Regression"; }
|
||||||
function UseAsRandomAI() { return false; }
|
function UseAsRandomAI() { return false; }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class StationList extends AIInfo {
|
|||||||
function GetShortName() { return "REGS"; }
|
function GetShortName() { return "REGS"; }
|
||||||
function GetDescription() { return "This runs stationlist-tests on some commands. On the same map the result should always be the same."; }
|
function GetDescription() { return "This runs stationlist-tests on some commands. On the same map the result should always be the same."; }
|
||||||
function GetVersion() { return 1; }
|
function GetVersion() { return 1; }
|
||||||
function GetAPIVersion() { return "1.11"; }
|
function GetAPIVersion() { return "12"; }
|
||||||
function GetDate() { return "2007-03-18"; }
|
function GetDate() { return "2007-03-18"; }
|
||||||
function CreateInstance() { return "StationList"; }
|
function CreateInstance() { return "StationList"; }
|
||||||
function UseAsRandomAI() { return false; }
|
function UseAsRandomAI() { return false; }
|
||||||
|
|||||||
1
src/3rdparty/CMakeLists.txt
vendored
1
src/3rdparty/CMakeLists.txt
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
add_subdirectory(fmt)
|
||||||
add_subdirectory(md5)
|
add_subdirectory(md5)
|
||||||
add_subdirectory(squirrel)
|
add_subdirectory(squirrel)
|
||||||
add_subdirectory(opengl)
|
add_subdirectory(opengl)
|
||||||
|
|||||||
5
src/3rdparty/fmt/CMakeLists.txt
vendored
Normal file
5
src/3rdparty/fmt/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
add_files(
|
||||||
|
core.h
|
||||||
|
format.h
|
||||||
|
format-inl.h
|
||||||
|
)
|
||||||
27
src/3rdparty/fmt/LICENSE.rst
vendored
Normal file
27
src/3rdparty/fmt/LICENSE.rst
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright (c) 2012 - present, Victor Zverovich
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is 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 Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
--- Optional exception to the license ---
|
||||||
|
|
||||||
|
As an exception, if, as a result of your compiling your source code, portions
|
||||||
|
of this Software are embedded into a machine-executable object form of such
|
||||||
|
source code, you may redistribute such embedded portions in such object form
|
||||||
|
without including the above copyright and permission notices.
|
||||||
2122
src/3rdparty/fmt/core.h
vendored
Normal file
2122
src/3rdparty/fmt/core.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2801
src/3rdparty/fmt/format-inl.h
vendored
Normal file
2801
src/3rdparty/fmt/format-inl.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3960
src/3rdparty/fmt/format.h
vendored
Normal file
3960
src/3rdparty/fmt/format.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp
vendored
4
src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp
vendored
@@ -17,7 +17,7 @@ void sqstd_printcallstack(HSQUIRRELVM v)
|
|||||||
SQFloat f;
|
SQFloat f;
|
||||||
const SQChar *s;
|
const SQChar *s;
|
||||||
SQInteger level=1; //1 is to skip this function that is level 0
|
SQInteger level=1; //1 is to skip this function that is level 0
|
||||||
const SQChar *name=0;
|
const SQChar *name=nullptr;
|
||||||
SQInteger seq=0;
|
SQInteger seq=0;
|
||||||
pf(v,"\nCALLSTACK\n");
|
pf(v,"\nCALLSTACK\n");
|
||||||
while(SQ_SUCCEEDED(sq_stackinfos(v,level,&si)))
|
while(SQ_SUCCEEDED(sq_stackinfos(v,level,&si)))
|
||||||
@@ -116,7 +116,7 @@ static SQInteger _sqstd_aux_printerror(HSQUIRRELVM v)
|
|||||||
{
|
{
|
||||||
SQPRINTFUNCTION pf = sq_getprintfunc(v);
|
SQPRINTFUNCTION pf = sq_getprintfunc(v);
|
||||||
if(pf) {
|
if(pf) {
|
||||||
const SQChar *sErr = 0;
|
const SQChar *sErr = nullptr;
|
||||||
if(sq_gettop(v)>=1) {
|
if(sq_gettop(v)>=1) {
|
||||||
if(SQ_SUCCEEDED(sq_getstring(v,2,&sErr))) {
|
if(SQ_SUCCEEDED(sq_getstring(v,2,&sErr))) {
|
||||||
pf(v,"\nAN ERROR HAS OCCURRED [%s]\n",sErr);
|
pf(v,"\nAN ERROR HAS OCCURRED [%s]\n",sErr);
|
||||||
|
|||||||
4
src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp
vendored
4
src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp
vendored
@@ -88,7 +88,7 @@ static SQRegFunction mathlib_funcs[] = {
|
|||||||
#endif /* EXPORT_DEFAULT_SQUIRREL_FUNCTIONS */
|
#endif /* EXPORT_DEFAULT_SQUIRREL_FUNCTIONS */
|
||||||
_DECL_FUNC(fabs,2,".n"),
|
_DECL_FUNC(fabs,2,".n"),
|
||||||
_DECL_FUNC(abs,2,".n"),
|
_DECL_FUNC(abs,2,".n"),
|
||||||
{0,0,0,0},
|
{nullptr,nullptr,0,nullptr},
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
@@ -98,7 +98,7 @@ static SQRegFunction mathlib_funcs[] = {
|
|||||||
SQRESULT sqstd_register_mathlib(HSQUIRRELVM v)
|
SQRESULT sqstd_register_mathlib(HSQUIRRELVM v)
|
||||||
{
|
{
|
||||||
SQInteger i=0;
|
SQInteger i=0;
|
||||||
while(mathlib_funcs[i].name!=0) {
|
while(mathlib_funcs[i].name!=nullptr) {
|
||||||
sq_pushstring(v,mathlib_funcs[i].name,-1);
|
sq_pushstring(v,mathlib_funcs[i].name,-1);
|
||||||
sq_newclosure(v,mathlib_funcs[i].f,0);
|
sq_newclosure(v,mathlib_funcs[i].f,0);
|
||||||
sq_setparamscheck(v,mathlib_funcs[i].nparamscheck,mathlib_funcs[i].typemask);
|
sq_setparamscheck(v,mathlib_funcs[i].nparamscheck,mathlib_funcs[i].typemask);
|
||||||
|
|||||||
58
src/3rdparty/squirrel/squirrel/sqapi.cpp
vendored
58
src/3rdparty/squirrel/squirrel/sqapi.cpp
vendored
@@ -60,11 +60,11 @@ HSQUIRRELVM sq_open(SQInteger initialstacksize)
|
|||||||
v = (SQVM *)SQ_MALLOC(sizeof(SQVM));
|
v = (SQVM *)SQ_MALLOC(sizeof(SQVM));
|
||||||
new (v) SQVM(ss);
|
new (v) SQVM(ss);
|
||||||
ss->_root_vm = v;
|
ss->_root_vm = v;
|
||||||
if(v->Init(NULL, initialstacksize)) {
|
if(v->Init(nullptr, initialstacksize)) {
|
||||||
return v;
|
return v;
|
||||||
} else {
|
} else {
|
||||||
sq_delete(v, SQVM);
|
sq_delete(v, SQVM);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ HSQUIRRELVM sq_newthread(HSQUIRRELVM friendvm, SQInteger initialstacksize)
|
|||||||
return v;
|
return v;
|
||||||
} else {
|
} else {
|
||||||
sq_delete(v, SQVM);
|
sq_delete(v, SQVM);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ void sq_close(HSQUIRRELVM v)
|
|||||||
SQRESULT sq_compile(HSQUIRRELVM v,SQLEXREADFUNC read,SQUserPointer p,const SQChar *sourcename,SQBool raiseerror)
|
SQRESULT sq_compile(HSQUIRRELVM v,SQLEXREADFUNC read,SQUserPointer p,const SQChar *sourcename,SQBool raiseerror)
|
||||||
{
|
{
|
||||||
SQObjectPtr o;
|
SQObjectPtr o;
|
||||||
if(Compile(v, read, p, sourcename, o, raiseerror?true:false, _ss(v)->_debuginfo)) {
|
if(Compile(v, read, p, sourcename, o, raiseerror != 0, _ss(v)->_debuginfo)) {
|
||||||
v->Push(SQClosure::Create(_ss(v), _funcproto(o)));
|
v->Push(SQClosure::Create(_ss(v), _funcproto(o)));
|
||||||
return SQ_OK;
|
return SQ_OK;
|
||||||
}
|
}
|
||||||
@@ -144,12 +144,12 @@ SQRESULT sq_compile(HSQUIRRELVM v,SQLEXREADFUNC read,SQUserPointer p,const SQCha
|
|||||||
|
|
||||||
void sq_enabledebuginfo(HSQUIRRELVM v, SQBool enable)
|
void sq_enabledebuginfo(HSQUIRRELVM v, SQBool enable)
|
||||||
{
|
{
|
||||||
_ss(v)->_debuginfo = enable?true:false;
|
_ss(v)->_debuginfo = enable != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sq_notifyallexceptions(HSQUIRRELVM v, SQBool enable)
|
void sq_notifyallexceptions(HSQUIRRELVM v, SQBool enable)
|
||||||
{
|
{
|
||||||
_ss(v)->_notifyallexceptions = enable?true:false;
|
_ss(v)->_notifyallexceptions = enable != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sq_addref(HSQUIRRELVM v,HSQOBJECT *po)
|
void sq_addref(HSQUIRRELVM v,HSQOBJECT *po)
|
||||||
@@ -178,7 +178,7 @@ const SQChar *sq_objtostring(HSQOBJECT *o)
|
|||||||
if(sq_type(*o) == OT_STRING) {
|
if(sq_type(*o) == OT_STRING) {
|
||||||
return _stringval(*o);
|
return _stringval(*o);
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SQInteger sq_objtointeger(HSQOBJECT *o)
|
SQInteger sq_objtointeger(HSQOBJECT *o)
|
||||||
@@ -224,7 +224,7 @@ void sq_pushinteger(HSQUIRRELVM v,SQInteger n)
|
|||||||
|
|
||||||
void sq_pushbool(HSQUIRRELVM v,SQBool b)
|
void sq_pushbool(HSQUIRRELVM v,SQBool b)
|
||||||
{
|
{
|
||||||
v->Push(b?true:false);
|
v->Push(b != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sq_pushfloat(HSQUIRRELVM v,SQFloat n)
|
void sq_pushfloat(HSQUIRRELVM v,SQFloat n)
|
||||||
@@ -256,7 +256,7 @@ void sq_newarray(HSQUIRRELVM v,SQInteger size)
|
|||||||
|
|
||||||
SQRESULT sq_newclass(HSQUIRRELVM v,SQBool hasbase)
|
SQRESULT sq_newclass(HSQUIRRELVM v,SQBool hasbase)
|
||||||
{
|
{
|
||||||
SQClass *baseclass = NULL;
|
SQClass *baseclass = nullptr;
|
||||||
if(hasbase) {
|
if(hasbase) {
|
||||||
SQObjectPtr &base = stack_get(v,-1);
|
SQObjectPtr &base = stack_get(v,-1);
|
||||||
if(type(base) != OT_CLASS)
|
if(type(base) != OT_CLASS)
|
||||||
@@ -555,7 +555,7 @@ SQRESULT sq_getbool(HSQUIRRELVM v,SQInteger idx,SQBool *b)
|
|||||||
|
|
||||||
SQRESULT sq_getstring(HSQUIRRELVM v,SQInteger idx,const SQChar **c)
|
SQRESULT sq_getstring(HSQUIRRELVM v,SQInteger idx,const SQChar **c)
|
||||||
{
|
{
|
||||||
SQObjectPtr *o = NULL;
|
SQObjectPtr *o = nullptr;
|
||||||
_GETSAFE_OBJ(v, idx, OT_STRING,o);
|
_GETSAFE_OBJ(v, idx, OT_STRING,o);
|
||||||
*c = _stringval(*o);
|
*c = _stringval(*o);
|
||||||
return SQ_OK;
|
return SQ_OK;
|
||||||
@@ -563,7 +563,7 @@ SQRESULT sq_getstring(HSQUIRRELVM v,SQInteger idx,const SQChar **c)
|
|||||||
|
|
||||||
SQRESULT sq_getthread(HSQUIRRELVM v,SQInteger idx,HSQUIRRELVM *thread)
|
SQRESULT sq_getthread(HSQUIRRELVM v,SQInteger idx,HSQUIRRELVM *thread)
|
||||||
{
|
{
|
||||||
SQObjectPtr *o = NULL;
|
SQObjectPtr *o = nullptr;
|
||||||
_GETSAFE_OBJ(v, idx, OT_THREAD,o);
|
_GETSAFE_OBJ(v, idx, OT_THREAD,o);
|
||||||
*thread = _thread(*o);
|
*thread = _thread(*o);
|
||||||
return SQ_OK;
|
return SQ_OK;
|
||||||
@@ -598,7 +598,7 @@ SQInteger sq_getsize(HSQUIRRELVM v, SQInteger idx)
|
|||||||
|
|
||||||
SQRESULT sq_getuserdata(HSQUIRRELVM v,SQInteger idx,SQUserPointer *p,SQUserPointer *typetag)
|
SQRESULT sq_getuserdata(HSQUIRRELVM v,SQInteger idx,SQUserPointer *p,SQUserPointer *typetag)
|
||||||
{
|
{
|
||||||
SQObjectPtr *o = NULL;
|
SQObjectPtr *o = nullptr;
|
||||||
_GETSAFE_OBJ(v, idx, OT_USERDATA,o);
|
_GETSAFE_OBJ(v, idx, OT_USERDATA,o);
|
||||||
(*p) = _userdataval(*o);
|
(*p) = _userdataval(*o);
|
||||||
if(typetag) *typetag = _userdata(*o)->_typetag;
|
if(typetag) *typetag = _userdata(*o)->_typetag;
|
||||||
@@ -637,7 +637,7 @@ SQRESULT sq_gettypetag(HSQUIRRELVM v,SQInteger idx,SQUserPointer *typetag)
|
|||||||
|
|
||||||
SQRESULT sq_getuserpointer(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p)
|
SQRESULT sq_getuserpointer(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p)
|
||||||
{
|
{
|
||||||
SQObjectPtr *o = NULL;
|
SQObjectPtr *o = nullptr;
|
||||||
_GETSAFE_OBJ(v, idx, OT_USERPOINTER,o);
|
_GETSAFE_OBJ(v, idx, OT_USERPOINTER,o);
|
||||||
(*p) = _userpointer(*o);
|
(*p) = _userpointer(*o);
|
||||||
return SQ_OK;
|
return SQ_OK;
|
||||||
@@ -666,13 +666,13 @@ SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p,SQUserP
|
|||||||
SQObjectPtr &o = stack_get(v,idx);
|
SQObjectPtr &o = stack_get(v,idx);
|
||||||
if(type(o) != OT_INSTANCE) return sq_throwerror(v,"the object is not a class instance");
|
if(type(o) != OT_INSTANCE) return sq_throwerror(v,"the object is not a class instance");
|
||||||
(*p) = _instance(o)->_userpointer;
|
(*p) = _instance(o)->_userpointer;
|
||||||
if(typetag != 0) {
|
if(typetag != nullptr) {
|
||||||
SQClass *cl = _instance(o)->_class;
|
SQClass *cl = _instance(o)->_class;
|
||||||
do{
|
do{
|
||||||
if(cl->_typetag == typetag)
|
if(cl->_typetag == typetag)
|
||||||
return SQ_OK;
|
return SQ_OK;
|
||||||
cl = cl->_base;
|
cl = cl->_base;
|
||||||
}while(cl != NULL);
|
}while(cl != nullptr);
|
||||||
return sq_throwerror(v,"invalid type tag");
|
return sq_throwerror(v,"invalid type tag");
|
||||||
}
|
}
|
||||||
return SQ_OK;
|
return SQ_OK;
|
||||||
@@ -724,7 +724,7 @@ SQRESULT sq_newslot(HSQUIRRELVM v, SQInteger idx, SQBool bstatic)
|
|||||||
if(type(self) == OT_TABLE || type(self) == OT_CLASS) {
|
if(type(self) == OT_TABLE || type(self) == OT_CLASS) {
|
||||||
SQObjectPtr &key = v->GetUp(-2);
|
SQObjectPtr &key = v->GetUp(-2);
|
||||||
if(type(key) == OT_NULL) return sq_throwerror(v, "null is not a valid key");
|
if(type(key) == OT_NULL) return sq_throwerror(v, "null is not a valid key");
|
||||||
v->NewSlot(self, key, v->GetUp(-1),bstatic?true:false);
|
v->NewSlot(self, key, v->GetUp(-1),bstatic != 0);
|
||||||
v->Pop(2);
|
v->Pop(2);
|
||||||
}
|
}
|
||||||
return SQ_OK;
|
return SQ_OK;
|
||||||
@@ -801,14 +801,14 @@ SQRESULT sq_setdelegate(HSQUIRRELVM v,SQInteger idx)
|
|||||||
if(!_table(self)->SetDelegate(_table(mt))) return sq_throwerror(v, "delagate cycle");
|
if(!_table(self)->SetDelegate(_table(mt))) return sq_throwerror(v, "delagate cycle");
|
||||||
v->Pop();}
|
v->Pop();}
|
||||||
else if(type(mt)==OT_NULL) {
|
else if(type(mt)==OT_NULL) {
|
||||||
_table(self)->SetDelegate(NULL); v->Pop(); }
|
_table(self)->SetDelegate(nullptr); v->Pop(); }
|
||||||
else return sq_aux_invalidtype(v,type);
|
else return sq_aux_invalidtype(v,type);
|
||||||
break;
|
break;
|
||||||
case OT_USERDATA:
|
case OT_USERDATA:
|
||||||
if(type(mt)==OT_TABLE) {
|
if(type(mt)==OT_TABLE) {
|
||||||
_userdata(self)->SetDelegate(_table(mt)); v->Pop(); }
|
_userdata(self)->SetDelegate(_table(mt)); v->Pop(); }
|
||||||
else if(type(mt)==OT_NULL) {
|
else if(type(mt)==OT_NULL) {
|
||||||
_userdata(self)->SetDelegate(NULL); v->Pop(); }
|
_userdata(self)->SetDelegate(nullptr); v->Pop(); }
|
||||||
else return sq_aux_invalidtype(v, type);
|
else return sq_aux_invalidtype(v, type);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -909,7 +909,7 @@ const SQChar *sq_getlocal(HSQUIRRELVM v,SQUnsignedInteger level,SQUnsignedIntege
|
|||||||
}
|
}
|
||||||
SQVM::CallInfo &ci=v->_callsstack[lvl];
|
SQVM::CallInfo &ci=v->_callsstack[lvl];
|
||||||
if(type(ci._closure)!=OT_CLOSURE)
|
if(type(ci._closure)!=OT_CLOSURE)
|
||||||
return NULL;
|
return nullptr;
|
||||||
SQClosure *c=_closure(ci._closure);
|
SQClosure *c=_closure(ci._closure);
|
||||||
SQFunctionProto *func=_funcproto(c->_function);
|
SQFunctionProto *func=_funcproto(c->_function);
|
||||||
if(func->_noutervalues > (SQInteger)idx) {
|
if(func->_noutervalues > (SQInteger)idx) {
|
||||||
@@ -919,7 +919,7 @@ const SQChar *sq_getlocal(HSQUIRRELVM v,SQUnsignedInteger level,SQUnsignedIntege
|
|||||||
idx -= func->_noutervalues;
|
idx -= func->_noutervalues;
|
||||||
return func->GetLocal(v,stackbase,idx,(SQInteger)(ci._ip-func->_instructions)-1);
|
return func->GetLocal(v,stackbase,idx,(SQInteger)(ci._ip-func->_instructions)-1);
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sq_pushobject(HSQUIRRELVM v,HSQOBJECT obj)
|
void sq_pushobject(HSQUIRRELVM v,HSQOBJECT obj)
|
||||||
@@ -929,7 +929,7 @@ void sq_pushobject(HSQUIRRELVM v,HSQOBJECT obj)
|
|||||||
|
|
||||||
void sq_resetobject(HSQOBJECT *po)
|
void sq_resetobject(HSQOBJECT *po)
|
||||||
{
|
{
|
||||||
po->_unVal.pUserPointer=NULL;po->_type=OT_NULL;
|
po->_unVal.pUserPointer=nullptr;po->_type=OT_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SQRESULT sq_throwerror(HSQUIRRELVM v,const SQChar *err)
|
SQRESULT sq_throwerror(HSQUIRRELVM v,const SQChar *err)
|
||||||
@@ -975,7 +975,7 @@ SQRESULT sq_call(HSQUIRRELVM v,SQInteger params,SQBool retval,SQBool raiseerror,
|
|||||||
v->_can_suspend = suspend >= 0;
|
v->_can_suspend = suspend >= 0;
|
||||||
if (v->_can_suspend) v->_ops_till_suspend = suspend;
|
if (v->_can_suspend) v->_ops_till_suspend = suspend;
|
||||||
|
|
||||||
if(v->Call(v->GetUp(-(params+1)),params,v->_top-params,res,raiseerror?true:false,v->_can_suspend)){
|
if(v->Call(v->GetUp(-(params+1)),params,v->_top-params,res,raiseerror != 0,v->_can_suspend)){
|
||||||
if(!v->_suspended) {
|
if(!v->_suspended) {
|
||||||
v->Pop(params);//pop closure and args
|
v->Pop(params);//pop closure and args
|
||||||
}
|
}
|
||||||
@@ -1051,7 +1051,7 @@ void sq_setcompilererrorhandler(HSQUIRRELVM v,SQCOMPILERERROR f)
|
|||||||
|
|
||||||
SQRESULT sq_writeclosure(HSQUIRRELVM v,SQWRITEFUNC w,SQUserPointer up)
|
SQRESULT sq_writeclosure(HSQUIRRELVM v,SQWRITEFUNC w,SQUserPointer up)
|
||||||
{
|
{
|
||||||
SQObjectPtr *o = NULL;
|
SQObjectPtr *o = nullptr;
|
||||||
_GETSAFE_OBJ(v, -1, OT_CLOSURE,o);
|
_GETSAFE_OBJ(v, -1, OT_CLOSURE,o);
|
||||||
unsigned short tag = SQ_BYTECODE_STREAM_TAG;
|
unsigned short tag = SQ_BYTECODE_STREAM_TAG;
|
||||||
if(w(up,&tag,2) != 2)
|
if(w(up,&tag,2) != 2)
|
||||||
@@ -1093,7 +1093,7 @@ SQInteger sq_collectgarbage(HSQUIRRELVM v)
|
|||||||
const SQChar *sq_getfreevariable(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval)
|
const SQChar *sq_getfreevariable(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval)
|
||||||
{
|
{
|
||||||
SQObjectPtr &self = stack_get(v,idx);
|
SQObjectPtr &self = stack_get(v,idx);
|
||||||
const SQChar *name = NULL;
|
const SQChar *name = nullptr;
|
||||||
if(type(self) == OT_CLOSURE) {
|
if(type(self) == OT_CLOSURE) {
|
||||||
if(_closure(self)->_outervalues.size()>nval) {
|
if(_closure(self)->_outervalues.size()>nval) {
|
||||||
v->Push(_closure(self)->_outervalues[nval]);
|
v->Push(_closure(self)->_outervalues[nval]);
|
||||||
@@ -1131,7 +1131,7 @@ SQRESULT sq_setfreevariable(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval)
|
|||||||
|
|
||||||
SQRESULT sq_setattributes(HSQUIRRELVM v,SQInteger idx)
|
SQRESULT sq_setattributes(HSQUIRRELVM v,SQInteger idx)
|
||||||
{
|
{
|
||||||
SQObjectPtr *o = NULL;
|
SQObjectPtr *o = nullptr;
|
||||||
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
|
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
|
||||||
SQObjectPtr &key = stack_get(v,-2);
|
SQObjectPtr &key = stack_get(v,-2);
|
||||||
SQObjectPtr &val = stack_get(v,-1);
|
SQObjectPtr &val = stack_get(v,-1);
|
||||||
@@ -1153,7 +1153,7 @@ SQRESULT sq_setattributes(HSQUIRRELVM v,SQInteger idx)
|
|||||||
|
|
||||||
SQRESULT sq_getattributes(HSQUIRRELVM v,SQInteger idx)
|
SQRESULT sq_getattributes(HSQUIRRELVM v,SQInteger idx)
|
||||||
{
|
{
|
||||||
SQObjectPtr *o = NULL;
|
SQObjectPtr *o = nullptr;
|
||||||
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
|
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
|
||||||
SQObjectPtr &key = stack_get(v,-1);
|
SQObjectPtr &key = stack_get(v,-1);
|
||||||
SQObjectPtr attrs;
|
SQObjectPtr attrs;
|
||||||
@@ -1173,7 +1173,7 @@ SQRESULT sq_getattributes(HSQUIRRELVM v,SQInteger idx)
|
|||||||
|
|
||||||
SQRESULT sq_getbase(HSQUIRRELVM v,SQInteger idx)
|
SQRESULT sq_getbase(HSQUIRRELVM v,SQInteger idx)
|
||||||
{
|
{
|
||||||
SQObjectPtr *o = NULL;
|
SQObjectPtr *o = nullptr;
|
||||||
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
|
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
|
||||||
if(_class(*o)->_base)
|
if(_class(*o)->_base)
|
||||||
v->Push(SQObjectPtr(_class(*o)->_base));
|
v->Push(SQObjectPtr(_class(*o)->_base));
|
||||||
@@ -1184,7 +1184,7 @@ SQRESULT sq_getbase(HSQUIRRELVM v,SQInteger idx)
|
|||||||
|
|
||||||
SQRESULT sq_getclass(HSQUIRRELVM v,SQInteger idx)
|
SQRESULT sq_getclass(HSQUIRRELVM v,SQInteger idx)
|
||||||
{
|
{
|
||||||
SQObjectPtr *o = NULL;
|
SQObjectPtr *o = nullptr;
|
||||||
_GETSAFE_OBJ(v, idx, OT_INSTANCE,o);
|
_GETSAFE_OBJ(v, idx, OT_INSTANCE,o);
|
||||||
v->Push(SQObjectPtr(_instance(*o)->_class));
|
v->Push(SQObjectPtr(_instance(*o)->_class));
|
||||||
return SQ_OK;
|
return SQ_OK;
|
||||||
@@ -1192,7 +1192,7 @@ SQRESULT sq_getclass(HSQUIRRELVM v,SQInteger idx)
|
|||||||
|
|
||||||
SQRESULT sq_createinstance(HSQUIRRELVM v,SQInteger idx)
|
SQRESULT sq_createinstance(HSQUIRRELVM v,SQInteger idx)
|
||||||
{
|
{
|
||||||
SQObjectPtr *o = NULL;
|
SQObjectPtr *o = nullptr;
|
||||||
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
|
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
|
||||||
v->Push(_class(*o)->CreateInstance());
|
v->Push(_class(*o)->CreateInstance());
|
||||||
return SQ_OK;
|
return SQ_OK;
|
||||||
|
|||||||
50
src/3rdparty/squirrel/squirrel/sqbaselib.cpp
vendored
50
src/3rdparty/squirrel/squirrel/sqbaselib.cpp
vendored
@@ -248,29 +248,29 @@ static SQRegFunction base_funcs[]={
|
|||||||
{"getconsttable",base_getconsttable,1, NULL},
|
{"getconsttable",base_getconsttable,1, NULL},
|
||||||
{"setconsttable",base_setconsttable,2, NULL},
|
{"setconsttable",base_setconsttable,2, NULL},
|
||||||
#endif
|
#endif
|
||||||
{"assert",base_assert,2, NULL},
|
{"assert",base_assert,2, nullptr},
|
||||||
{"print",base_print,2, NULL},
|
{"print",base_print,2, nullptr},
|
||||||
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
|
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
|
||||||
{"compilestring",base_compilestring,-2, ".ss"},
|
{"compilestring",base_compilestring,-2, ".ss"},
|
||||||
{"newthread",base_newthread,2, ".c"},
|
{"newthread",base_newthread,2, ".c"},
|
||||||
{"suspend",base_suspend,-1, NULL},
|
{"suspend",base_suspend,-1, NULL},
|
||||||
#endif
|
#endif
|
||||||
{"array",base_array,-2, ".n"},
|
{"array",base_array,-2, ".n"},
|
||||||
{"type",base_type,2, NULL},
|
{"type",base_type,2, nullptr},
|
||||||
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
|
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
|
||||||
{"dummy",base_dummy,0,NULL},
|
{"dummy",base_dummy,0,NULL},
|
||||||
#ifndef NO_GARBAGE_COLLECTOR
|
#ifndef NO_GARBAGE_COLLECTOR
|
||||||
{"collectgarbage",base_collectgarbage,1, "t"},
|
{"collectgarbage",base_collectgarbage,1, "t"},
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
{0,0,0,0}
|
{nullptr,nullptr,0,nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
void sq_base_register(HSQUIRRELVM v)
|
void sq_base_register(HSQUIRRELVM v)
|
||||||
{
|
{
|
||||||
SQInteger i=0;
|
SQInteger i=0;
|
||||||
sq_pushroottable(v);
|
sq_pushroottable(v);
|
||||||
while(base_funcs[i].name!=0) {
|
while(base_funcs[i].name!=nullptr) {
|
||||||
sq_pushstring(v,base_funcs[i].name,-1);
|
sq_pushstring(v,base_funcs[i].name,-1);
|
||||||
sq_newclosure(v,base_funcs[i].f,0);
|
sq_newclosure(v,base_funcs[i].f,0);
|
||||||
sq_setnativeclosurename(v,-1,base_funcs[i].name);
|
sq_setnativeclosurename(v,-1,base_funcs[i].name);
|
||||||
@@ -415,10 +415,10 @@ SQRegFunction SQSharedState::_table_default_delegate_funcz[]={
|
|||||||
{"rawset",table_rawset,3, "t"},
|
{"rawset",table_rawset,3, "t"},
|
||||||
{"rawdelete",table_rawdelete,2, "t"},
|
{"rawdelete",table_rawdelete,2, "t"},
|
||||||
{"rawin",container_rawexists,2, "t"},
|
{"rawin",container_rawexists,2, "t"},
|
||||||
{"weakref",obj_delegate_weakref,1, NULL },
|
{"weakref",obj_delegate_weakref,1, nullptr },
|
||||||
{"tostring",default_delegate_tostring,1, "."},
|
{"tostring",default_delegate_tostring,1, "."},
|
||||||
{"clear",obj_clear,1, "."},
|
{"clear",obj_clear,1, "."},
|
||||||
{0,0,0,0}
|
{nullptr,nullptr,0,nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
//ARRAY DEFAULT DELEGATE///////////////////////////////////////
|
//ARRAY DEFAULT DELEGATE///////////////////////////////////////
|
||||||
@@ -624,10 +624,10 @@ SQRegFunction SQSharedState::_array_default_delegate_funcz[]={
|
|||||||
{"reverse",array_reverse,1, "a"},
|
{"reverse",array_reverse,1, "a"},
|
||||||
{"sort",array_sort,-1, "ac"},
|
{"sort",array_sort,-1, "ac"},
|
||||||
{"slice",array_slice,-1, "ann"},
|
{"slice",array_slice,-1, "ann"},
|
||||||
{"weakref",obj_delegate_weakref,1, NULL },
|
{"weakref",obj_delegate_weakref,1, nullptr },
|
||||||
{"tostring",default_delegate_tostring,1, "."},
|
{"tostring",default_delegate_tostring,1, "."},
|
||||||
{"clear",obj_clear,1, "."},
|
{"clear",obj_clear,1, "."},
|
||||||
{0,0,0,0}
|
{nullptr,nullptr,0,nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
//STRING DEFAULT DELEGATE//////////////////////////
|
//STRING DEFAULT DELEGATE//////////////////////////
|
||||||
@@ -687,8 +687,8 @@ SQRegFunction SQSharedState::_string_default_delegate_funcz[]={
|
|||||||
{"find",string_find,-2, "s s n "},
|
{"find",string_find,-2, "s s n "},
|
||||||
{"tolower",string_tolower,1, "s"},
|
{"tolower",string_tolower,1, "s"},
|
||||||
{"toupper",string_toupper,1, "s"},
|
{"toupper",string_toupper,1, "s"},
|
||||||
{"weakref",obj_delegate_weakref,1, NULL },
|
{"weakref",obj_delegate_weakref,1, nullptr },
|
||||||
{0,0,0,0}
|
{nullptr,nullptr,0,nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
//INTEGER DEFAULT DELEGATE//////////////////////////
|
//INTEGER DEFAULT DELEGATE//////////////////////////
|
||||||
@@ -697,8 +697,8 @@ SQRegFunction SQSharedState::_number_default_delegate_funcz[]={
|
|||||||
{"tofloat",default_delegate_tofloat,1, "n|b"},
|
{"tofloat",default_delegate_tofloat,1, "n|b"},
|
||||||
{"tostring",default_delegate_tostring,1, "."},
|
{"tostring",default_delegate_tostring,1, "."},
|
||||||
{"tochar",number_delegate_tochar,1, "n|b"},
|
{"tochar",number_delegate_tochar,1, "n|b"},
|
||||||
{"weakref",obj_delegate_weakref,1, NULL },
|
{"weakref",obj_delegate_weakref,1, nullptr },
|
||||||
{0,0,0,0}
|
{nullptr,nullptr,0,nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
//CLOSURE DEFAULT DELEGATE//////////////////////////
|
//CLOSURE DEFAULT DELEGATE//////////////////////////
|
||||||
@@ -782,11 +782,11 @@ SQRegFunction SQSharedState::_closure_default_delegate_funcz[]={
|
|||||||
{"pcall",closure_pcall,-1, "c"},
|
{"pcall",closure_pcall,-1, "c"},
|
||||||
{"acall",closure_acall,2, "ca"},
|
{"acall",closure_acall,2, "ca"},
|
||||||
{"pacall",closure_pacall,2, "ca"},
|
{"pacall",closure_pacall,2, "ca"},
|
||||||
{"weakref",obj_delegate_weakref,1, NULL },
|
{"weakref",obj_delegate_weakref,1, nullptr },
|
||||||
{"tostring",default_delegate_tostring,1, "."},
|
{"tostring",default_delegate_tostring,1, "."},
|
||||||
{"bindenv",closure_bindenv,2, "c x|y|t"},
|
{"bindenv",closure_bindenv,2, "c x|y|t"},
|
||||||
{"getinfos",closure_getinfos,1, "c"},
|
{"getinfos",closure_getinfos,1, "c"},
|
||||||
{0,0,0,0}
|
{nullptr,nullptr,0,nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
//GENERATOR DEFAULT DELEGATE
|
//GENERATOR DEFAULT DELEGATE
|
||||||
@@ -803,9 +803,9 @@ static SQInteger generator_getstatus(HSQUIRRELVM v)
|
|||||||
|
|
||||||
SQRegFunction SQSharedState::_generator_default_delegate_funcz[]={
|
SQRegFunction SQSharedState::_generator_default_delegate_funcz[]={
|
||||||
{"getstatus",generator_getstatus,1, "g"},
|
{"getstatus",generator_getstatus,1, "g"},
|
||||||
{"weakref",obj_delegate_weakref,1, NULL },
|
{"weakref",obj_delegate_weakref,1, nullptr },
|
||||||
{"tostring",default_delegate_tostring,1, "."},
|
{"tostring",default_delegate_tostring,1, "."},
|
||||||
{0,0,0,0}
|
{nullptr,nullptr,0,nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
//THREAD DEFAULT DELEGATE
|
//THREAD DEFAULT DELEGATE
|
||||||
@@ -889,9 +889,9 @@ SQRegFunction SQSharedState::_thread_default_delegate_funcz[] = {
|
|||||||
{"call", thread_call, -1, "v"},
|
{"call", thread_call, -1, "v"},
|
||||||
{"wakeup", thread_wakeup, -1, "v"},
|
{"wakeup", thread_wakeup, -1, "v"},
|
||||||
{"getstatus", thread_getstatus, 1, "v"},
|
{"getstatus", thread_getstatus, 1, "v"},
|
||||||
{"weakref",obj_delegate_weakref,1, NULL },
|
{"weakref",obj_delegate_weakref,1, nullptr },
|
||||||
{"tostring",default_delegate_tostring,1, "."},
|
{"tostring",default_delegate_tostring,1, "."},
|
||||||
{0,0,0,0},
|
{nullptr,nullptr,0,nullptr},
|
||||||
};
|
};
|
||||||
|
|
||||||
static SQInteger class_getattributes(HSQUIRRELVM v)
|
static SQInteger class_getattributes(HSQUIRRELVM v)
|
||||||
@@ -919,10 +919,10 @@ SQRegFunction SQSharedState::_class_default_delegate_funcz[] = {
|
|||||||
{"getattributes", class_getattributes, 2, "y."},
|
{"getattributes", class_getattributes, 2, "y."},
|
||||||
{"setattributes", class_setattributes, 3, "y.."},
|
{"setattributes", class_setattributes, 3, "y.."},
|
||||||
{"rawin",container_rawexists,2, "y"},
|
{"rawin",container_rawexists,2, "y"},
|
||||||
{"weakref",obj_delegate_weakref,1, NULL },
|
{"weakref",obj_delegate_weakref,1, nullptr },
|
||||||
{"tostring",default_delegate_tostring,1, "."},
|
{"tostring",default_delegate_tostring,1, "."},
|
||||||
{"instance",class_instance,1, "y"},
|
{"instance",class_instance,1, "y"},
|
||||||
{0,0,0,0}
|
{nullptr,nullptr,0,nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
static SQInteger instance_getclass(HSQUIRRELVM v)
|
static SQInteger instance_getclass(HSQUIRRELVM v)
|
||||||
@@ -935,9 +935,9 @@ static SQInteger instance_getclass(HSQUIRRELVM v)
|
|||||||
SQRegFunction SQSharedState::_instance_default_delegate_funcz[] = {
|
SQRegFunction SQSharedState::_instance_default_delegate_funcz[] = {
|
||||||
{"getclass", instance_getclass, 1, "x"},
|
{"getclass", instance_getclass, 1, "x"},
|
||||||
{"rawin",container_rawexists,2, "x"},
|
{"rawin",container_rawexists,2, "x"},
|
||||||
{"weakref",obj_delegate_weakref,1, NULL },
|
{"weakref",obj_delegate_weakref,1, nullptr },
|
||||||
{"tostring",default_delegate_tostring,1, "."},
|
{"tostring",default_delegate_tostring,1, "."},
|
||||||
{0,0,0,0}
|
{nullptr,nullptr,0,nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
static SQInteger weakref_ref(HSQUIRRELVM v)
|
static SQInteger weakref_ref(HSQUIRRELVM v)
|
||||||
@@ -949,9 +949,9 @@ static SQInteger weakref_ref(HSQUIRRELVM v)
|
|||||||
|
|
||||||
SQRegFunction SQSharedState::_weakref_default_delegate_funcz[] = {
|
SQRegFunction SQSharedState::_weakref_default_delegate_funcz[] = {
|
||||||
{"ref",weakref_ref,1, "r"},
|
{"ref",weakref_ref,1, "r"},
|
||||||
{"weakref",obj_delegate_weakref,1, NULL },
|
{"weakref",obj_delegate_weakref,1, nullptr },
|
||||||
{"tostring",default_delegate_tostring,1, "."},
|
{"tostring",default_delegate_tostring,1, "."},
|
||||||
{0,0,0,0}
|
{nullptr,nullptr,0,nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
18
src/3rdparty/squirrel/squirrel/sqclass.cpp
vendored
18
src/3rdparty/squirrel/squirrel/sqclass.cpp
vendored
@@ -15,8 +15,8 @@
|
|||||||
SQClass::SQClass(SQSharedState *ss,SQClass *base)
|
SQClass::SQClass(SQSharedState *ss,SQClass *base)
|
||||||
{
|
{
|
||||||
_base = base;
|
_base = base;
|
||||||
_typetag = 0;
|
_typetag = nullptr;
|
||||||
_hook = NULL;
|
_hook = nullptr;
|
||||||
_udsize = 0;
|
_udsize = 0;
|
||||||
_metamethods.resize(MT_LAST); //size it to max size
|
_metamethods.resize(MT_LAST); //size it to max size
|
||||||
if(_base) {
|
if(_base) {
|
||||||
@@ -34,7 +34,13 @@ SQClass::SQClass(SQSharedState *ss,SQClass *base)
|
|||||||
|
|
||||||
void SQClass::Finalize() {
|
void SQClass::Finalize() {
|
||||||
_attributes = _null_;
|
_attributes = _null_;
|
||||||
_defaultvalues.resize(0);
|
/* SQInstance's Finalize depends on the size of this sqvector, so instead of
|
||||||
|
* resizing, all SQObjectPtrs are set to "null" so it holds no references to
|
||||||
|
* other objects anymore. That way everything gets released properly. */
|
||||||
|
for (SQUnsignedInteger i = 0; i < _defaultvalues.size(); i++) {
|
||||||
|
_defaultvalues[i].val = _null_;
|
||||||
|
_defaultvalues[i].attrs = _null_;
|
||||||
|
}
|
||||||
_methods.resize(0);
|
_methods.resize(0);
|
||||||
_metamethods.resize(0);
|
_metamethods.resize(0);
|
||||||
__ObjRelease(_members);
|
__ObjRelease(_members);
|
||||||
@@ -133,8 +139,8 @@ bool SQClass::GetAttributes(const SQObjectPtr &key,SQObjectPtr &outval)
|
|||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
void SQInstance::Init(SQSharedState *ss)
|
void SQInstance::Init(SQSharedState *ss)
|
||||||
{
|
{
|
||||||
_userpointer = NULL;
|
_userpointer = nullptr;
|
||||||
_hook = NULL;
|
_hook = nullptr;
|
||||||
__ObjAddRef(_class);
|
__ObjAddRef(_class);
|
||||||
_delegate = _class->_members;
|
_delegate = _class->_members;
|
||||||
INIT_CHAIN();
|
INIT_CHAIN();
|
||||||
@@ -190,7 +196,7 @@ bool SQInstance::GetMetaMethod(SQVM *v,SQMetaMethod mm,SQObjectPtr &res)
|
|||||||
bool SQInstance::InstanceOf(SQClass *trg)
|
bool SQInstance::InstanceOf(SQClass *trg)
|
||||||
{
|
{
|
||||||
SQClass *parent = _class;
|
SQClass *parent = _class;
|
||||||
while(parent != NULL) {
|
while(parent != nullptr) {
|
||||||
if(parent == trg)
|
if(parent == trg)
|
||||||
return true;
|
return true;
|
||||||
parent = parent->_base;
|
parent = parent->_base;
|
||||||
|
|||||||
2
src/3rdparty/squirrel/squirrel/sqclosure.h
vendored
2
src/3rdparty/squirrel/squirrel/sqclosure.h
vendored
@@ -45,7 +45,7 @@ struct SQGenerator : public CHAINABLE_OBJ
|
|||||||
{
|
{
|
||||||
enum SQGeneratorState{eRunning,eSuspended,eDead};
|
enum SQGeneratorState{eRunning,eSuspended,eDead};
|
||||||
private:
|
private:
|
||||||
SQGenerator(SQSharedState *ss,SQClosure *closure){_closure=closure;_state=eRunning;_ci._generator=NULL;INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this);}
|
SQGenerator(SQSharedState *ss,SQClosure *closure){_closure=closure;_state=eRunning;_ci._generator=nullptr;INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this);}
|
||||||
public:
|
public:
|
||||||
static SQGenerator *Create(SQSharedState *ss,SQClosure *closure){
|
static SQGenerator *Create(SQSharedState *ss,SQClosure *closure){
|
||||||
SQGenerator *nc=(SQGenerator*)SQ_MALLOC(sizeof(SQGenerator));
|
SQGenerator *nc=(SQGenerator*)SQ_MALLOC(sizeof(SQGenerator));
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ typedef sqvector<ExpState> ExpStateVec;
|
|||||||
class SQCompiler
|
class SQCompiler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SQCompiler(SQVM *v, SQLEXREADFUNC rg, SQUserPointer up, const SQChar* sourcename, bool raiseerror, bool lineinfo) : _token(0), _fs(NULL), _lex(_ss(v), rg, up, ThrowError, this), _debugline(0), _debugop(0)
|
SQCompiler(SQVM *v, SQLEXREADFUNC rg, SQUserPointer up, const SQChar* sourcename, bool raiseerror, bool lineinfo) : _token(0), _fs(nullptr), _lex(_ss(v), rg, up, ThrowError, this), _debugline(0), _debugop(0)
|
||||||
{
|
{
|
||||||
_vm=v;
|
_vm=v;
|
||||||
_sourcename = SQString::Create(_ss(v), sourcename);
|
_sourcename = SQString::Create(_ss(v), sourcename);
|
||||||
@@ -164,7 +164,7 @@ public:
|
|||||||
_debugline = 1;
|
_debugline = 1;
|
||||||
_debugop = 0;
|
_debugop = 0;
|
||||||
|
|
||||||
SQFuncState funcstate(_ss(_vm), NULL,ThrowError,this);
|
SQFuncState funcstate(_ss(_vm), nullptr,ThrowError,this);
|
||||||
funcstate._name = SQString::Create(_ss(_vm), "main");
|
funcstate._name = SQString::Create(_ss(_vm), "main");
|
||||||
_fs = &funcstate;
|
_fs = &funcstate;
|
||||||
_fs->AddParameter(_fs->CreateString("this"));
|
_fs->AddParameter(_fs->CreateString("this"));
|
||||||
@@ -835,8 +835,7 @@ public:
|
|||||||
nkeys++;
|
nkeys++;
|
||||||
SQInteger val = _fs->PopTarget();
|
SQInteger val = _fs->PopTarget();
|
||||||
SQInteger key = _fs->PopTarget();
|
SQInteger key = _fs->PopTarget();
|
||||||
SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
|
[[maybe_unused]] SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
|
||||||
(void)attrs; // assert only
|
|
||||||
assert((hasattrs && attrs == key-1) || !hasattrs);
|
assert((hasattrs && attrs == key-1) || !hasattrs);
|
||||||
unsigned char flags = (hasattrs?NEW_SLOT_ATTRIBUTES_FLAG:0)|(isstatic?NEW_SLOT_STATIC_FLAG:0);
|
unsigned char flags = (hasattrs?NEW_SLOT_ATTRIBUTES_FLAG:0)|(isstatic?NEW_SLOT_STATIC_FLAG:0);
|
||||||
SQInteger table = _fs->TopTarget(); //<<BECAUSE OF THIS NO COMMON EMIT FUNC IS POSSIBLE
|
SQInteger table = _fs->TopTarget(); //<<BECAUSE OF THIS NO COMMON EMIT FUNC IS POSSIBLE
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ SQInstructionDesc g_InstrDesc[]={
|
|||||||
{"_OP_NEWSLOTA"},
|
{"_OP_NEWSLOTA"},
|
||||||
{"_OP_SCOPE_END"}
|
{"_OP_SCOPE_END"}
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
void DumpLiteral(SQObjectPtr &o)
|
void DumpLiteral(SQObjectPtr &o)
|
||||||
{
|
{
|
||||||
switch(type(o)){
|
switch(type(o)){
|
||||||
@@ -90,6 +90,7 @@ void DumpLiteral(SQObjectPtr &o)
|
|||||||
default: printf("(%s %p)",GetTypeName(o),(void*)_rawval(o));break; break; //shut up compiler
|
default: printf("(%s %p)",GetTypeName(o),(void*)_rawval(o));break; break; //shut up compiler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SQFuncState::SQFuncState(SQSharedState *ss,SQFuncState *parent,CompilerErrorFunc efunc,void *ed)
|
SQFuncState::SQFuncState(SQSharedState *ss,SQFuncState *parent,CompilerErrorFunc efunc,void *ed)
|
||||||
{
|
{
|
||||||
|
|||||||
4
src/3rdparty/squirrel/squirrel/sqlexer.cpp
vendored
4
src/3rdparty/squirrel/squirrel/sqlexer.cpp
vendored
@@ -87,7 +87,7 @@ SQLexer::SQLexer(SQSharedState *ss, SQLEXREADFUNC rg, SQUserPointer up,CompilerE
|
|||||||
_prevtoken = -1;
|
_prevtoken = -1;
|
||||||
_curtoken = -1;
|
_curtoken = -1;
|
||||||
|
|
||||||
_svalue = NULL;
|
_svalue = nullptr;
|
||||||
_nvalue = 0;
|
_nvalue = 0;
|
||||||
_fvalue = 0;
|
_fvalue = 0;
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ const SQChar *SQLexer::Tok2Str(SQInteger tok)
|
|||||||
if(((SQInteger)_integer(val)) == tok)
|
if(((SQInteger)_integer(val)) == tok)
|
||||||
return _stringval(key);
|
return _stringval(key);
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SQLexer::LexBlockComment()
|
void SQLexer::LexBlockComment()
|
||||||
|
|||||||
10
src/3rdparty/squirrel/squirrel/sqobject.cpp
vendored
10
src/3rdparty/squirrel/squirrel/sqobject.cpp
vendored
@@ -41,7 +41,7 @@ const SQChar *IdType2Name(SQObjectType type)
|
|||||||
case _RT_INSTANCE: return "instance";
|
case _RT_INSTANCE: return "instance";
|
||||||
case _RT_WEAKREF: return "weakref";
|
case _RT_WEAKREF: return "weakref";
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,13 +101,13 @@ SQRefCounted::~SQRefCounted()
|
|||||||
{
|
{
|
||||||
if(_weakref) {
|
if(_weakref) {
|
||||||
_weakref->_obj._type = OT_NULL;
|
_weakref->_obj._type = OT_NULL;
|
||||||
_weakref->_obj._unVal.pRefCounted = NULL;
|
_weakref->_obj._unVal.pRefCounted = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SQWeakRef::Release() {
|
void SQWeakRef::Release() {
|
||||||
if(ISREFCOUNTED(_obj._type)) {
|
if(ISREFCOUNTED(_obj._type)) {
|
||||||
_obj._unVal.pRefCounted->_weakref = NULL;
|
_obj._unVal.pRefCounted->_weakref = nullptr;
|
||||||
}
|
}
|
||||||
sq_delete(this,SQWeakRef);
|
sq_delete(this,SQWeakRef);
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ bool SQGenerator::Yield(SQVM *v)
|
|||||||
for(SQInteger j = nvargs - 1; j >= 0; j--) {
|
for(SQInteger j = nvargs - 1; j >= 0; j--) {
|
||||||
_vargsstack.push_back(v->_vargsstack[vargsbase+j]);
|
_vargsstack.push_back(v->_vargsstack[vargsbase+j]);
|
||||||
}
|
}
|
||||||
_ci._generator=NULL;
|
_ci._generator=nullptr;
|
||||||
for(SQInteger i=0;i<_ci._etraps;i++) {
|
for(SQInteger i=0;i<_ci._etraps;i++) {
|
||||||
_etraps.push_back(v->_etraps.top());
|
_etraps.push_back(v->_etraps.top());
|
||||||
v->_etraps.pop_back();
|
v->_etraps.pop_back();
|
||||||
@@ -204,7 +204,7 @@ void SQArray::Extend(const SQArray *a){
|
|||||||
const SQChar* SQFunctionProto::GetLocal(SQVM *vm,SQUnsignedInteger stackbase,SQUnsignedInteger nseq,SQUnsignedInteger nop)
|
const SQChar* SQFunctionProto::GetLocal(SQVM *vm,SQUnsignedInteger stackbase,SQUnsignedInteger nseq,SQUnsignedInteger nop)
|
||||||
{
|
{
|
||||||
SQUnsignedInteger nvars=_nlocalvarinfos;
|
SQUnsignedInteger nvars=_nlocalvarinfos;
|
||||||
const SQChar *res=NULL;
|
const SQChar *res=nullptr;
|
||||||
if(nvars>=nseq){
|
if(nvars>=nseq){
|
||||||
for(SQUnsignedInteger i=0;i<nvars;i++){
|
for(SQUnsignedInteger i=0;i<nvars;i++){
|
||||||
if(_localvarinfos[i]._start_op<=nop && _localvarinfos[i]._end_op>=nop)
|
if(_localvarinfos[i]._start_op<=nop && _localvarinfos[i]._end_op>=nop)
|
||||||
|
|||||||
6
src/3rdparty/squirrel/squirrel/sqobject.h
vendored
6
src/3rdparty/squirrel/squirrel/sqobject.h
vendored
@@ -56,7 +56,7 @@ enum SQMetaMethod{
|
|||||||
|
|
||||||
struct SQRefCounted
|
struct SQRefCounted
|
||||||
{
|
{
|
||||||
SQRefCounted() { _uiRef = 0; _weakref = NULL; }
|
SQRefCounted() { _uiRef = 0; _weakref = nullptr; }
|
||||||
virtual ~SQRefCounted();
|
virtual ~SQRefCounted();
|
||||||
SQWeakRef *GetWeakRef(SQObjectType type);
|
SQWeakRef *GetWeakRef(SQObjectType type);
|
||||||
SQUnsignedInteger _uiRef;
|
SQUnsignedInteger _uiRef;
|
||||||
@@ -134,7 +134,7 @@ struct SQObjectPtr : public SQObject
|
|||||||
{
|
{
|
||||||
SQ_OBJECT_RAWINIT()
|
SQ_OBJECT_RAWINIT()
|
||||||
_type=OT_NULL;
|
_type=OT_NULL;
|
||||||
_unVal.pUserPointer=NULL;
|
_unVal.pUserPointer=nullptr;
|
||||||
}
|
}
|
||||||
SQObjectPtr(const SQObjectPtr &o)
|
SQObjectPtr(const SQObjectPtr &o)
|
||||||
{
|
{
|
||||||
@@ -281,7 +281,7 @@ struct SQObjectPtr : public SQObject
|
|||||||
tOldType = _type;
|
tOldType = _type;
|
||||||
unOldVal = _unVal;
|
unOldVal = _unVal;
|
||||||
_type = OT_NULL;
|
_type = OT_NULL;
|
||||||
_unVal.pUserPointer = NULL;
|
_unVal.pUserPointer = nullptr;
|
||||||
__Release(tOldType,unOldVal);
|
__Release(tOldType,unOldVal);
|
||||||
}
|
}
|
||||||
inline SQObjectPtr& operator=(SQInteger i)
|
inline SQObjectPtr& operator=(SQInteger i)
|
||||||
|
|||||||
44
src/3rdparty/squirrel/squirrel/sqstate.cpp
vendored
44
src/3rdparty/squirrel/squirrel/sqstate.cpp
vendored
@@ -79,12 +79,12 @@ SQTable *CreateDefaultDelegate(SQSharedState *ss,SQRegFunction *funcz)
|
|||||||
{
|
{
|
||||||
SQInteger i=0;
|
SQInteger i=0;
|
||||||
SQTable *t=SQTable::Create(ss,0);
|
SQTable *t=SQTable::Create(ss,0);
|
||||||
while(funcz[i].name!=0){
|
while(funcz[i].name!=nullptr){
|
||||||
SQNativeClosure *nc = SQNativeClosure::Create(ss,funcz[i].f);
|
SQNativeClosure *nc = SQNativeClosure::Create(ss,funcz[i].f);
|
||||||
nc->_nparamscheck = funcz[i].nparamscheck;
|
nc->_nparamscheck = funcz[i].nparamscheck;
|
||||||
nc->_name = SQString::Create(ss,funcz[i].name);
|
nc->_name = SQString::Create(ss,funcz[i].name);
|
||||||
if(funcz[i].typemask && !CompileTypemask(nc->_typecheck,funcz[i].typemask))
|
if(funcz[i].typemask && !CompileTypemask(nc->_typecheck,funcz[i].typemask))
|
||||||
return NULL;
|
return nullptr;
|
||||||
t->NewSlot(SQString::Create(ss,funcz[i].name),nc);
|
t->NewSlot(SQString::Create(ss,funcz[i].name),nc);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -93,15 +93,15 @@ SQTable *CreateDefaultDelegate(SQSharedState *ss,SQRegFunction *funcz)
|
|||||||
|
|
||||||
SQSharedState::SQSharedState()
|
SQSharedState::SQSharedState()
|
||||||
{
|
{
|
||||||
_compilererrorhandler = NULL;
|
_compilererrorhandler = nullptr;
|
||||||
_printfunc = NULL;
|
_printfunc = nullptr;
|
||||||
_debuginfo = false;
|
_debuginfo = false;
|
||||||
_notifyallexceptions = false;
|
_notifyallexceptions = false;
|
||||||
_scratchpad=NULL;
|
_scratchpad=nullptr;
|
||||||
_scratchpadsize=0;
|
_scratchpadsize=0;
|
||||||
_collectable_free_processing = false;
|
_collectable_free_processing = false;
|
||||||
#ifndef NO_GARBAGE_COLLECTOR
|
#ifndef NO_GARBAGE_COLLECTOR
|
||||||
_gc_chain=NULL;
|
_gc_chain=nullptr;
|
||||||
#endif
|
#endif
|
||||||
sq_new(_stringtable,SQStringTable);
|
sq_new(_stringtable,SQStringTable);
|
||||||
sq_new(_metamethods,SQObjectPtrVec);
|
sq_new(_metamethods,SQObjectPtrVec);
|
||||||
@@ -189,7 +189,7 @@ SQSharedState::~SQSharedState()
|
|||||||
_refs_table.Finalize();
|
_refs_table.Finalize();
|
||||||
#ifndef NO_GARBAGE_COLLECTOR
|
#ifndef NO_GARBAGE_COLLECTOR
|
||||||
SQCollectable *t = _gc_chain;
|
SQCollectable *t = _gc_chain;
|
||||||
SQCollectable *nx = NULL;
|
SQCollectable *nx = nullptr;
|
||||||
if(t) {
|
if(t) {
|
||||||
t->_uiRef++;
|
t->_uiRef++;
|
||||||
while(t) {
|
while(t) {
|
||||||
@@ -299,7 +299,7 @@ SQInteger SQSharedState::CollectGarbage(SQVM *vm)
|
|||||||
EnqueueMarkObject(_instance_default_delegate,queue);
|
EnqueueMarkObject(_instance_default_delegate,queue);
|
||||||
EnqueueMarkObject(_weakref_default_delegate,queue);
|
EnqueueMarkObject(_weakref_default_delegate,queue);
|
||||||
|
|
||||||
SQCollectable *tchain=NULL;
|
SQCollectable *tchain=nullptr;
|
||||||
|
|
||||||
while (!queue.IsEmpty()) {
|
while (!queue.IsEmpty()) {
|
||||||
SQCollectable *q = queue.Pop();
|
SQCollectable *q = queue.Pop();
|
||||||
@@ -309,7 +309,7 @@ SQInteger SQSharedState::CollectGarbage(SQVM *vm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SQCollectable *t = _gc_chain;
|
SQCollectable *t = _gc_chain;
|
||||||
SQCollectable *nx = NULL;
|
SQCollectable *nx = nullptr;
|
||||||
if(t) {
|
if(t) {
|
||||||
t->_uiRef++;
|
t->_uiRef++;
|
||||||
while(t) {
|
while(t) {
|
||||||
@@ -340,7 +340,7 @@ SQInteger SQSharedState::CollectGarbage(SQVM *vm)
|
|||||||
#ifndef NO_GARBAGE_COLLECTOR
|
#ifndef NO_GARBAGE_COLLECTOR
|
||||||
void SQCollectable::AddToChain(SQCollectable **chain,SQCollectable *c)
|
void SQCollectable::AddToChain(SQCollectable **chain,SQCollectable *c)
|
||||||
{
|
{
|
||||||
c->_prev = NULL;
|
c->_prev = nullptr;
|
||||||
c->_next = *chain;
|
c->_next = *chain;
|
||||||
if(*chain) (*chain)->_prev = c;
|
if(*chain) (*chain)->_prev = c;
|
||||||
*chain = c;
|
*chain = c;
|
||||||
@@ -352,8 +352,8 @@ void SQCollectable::RemoveFromChain(SQCollectable **chain,SQCollectable *c)
|
|||||||
else *chain = c->_next;
|
else *chain = c->_next;
|
||||||
if(c->_next)
|
if(c->_next)
|
||||||
c->_next->_prev = c->_prev;
|
c->_next->_prev = c->_prev;
|
||||||
c->_next = NULL;
|
c->_next = nullptr;
|
||||||
c->_prev = NULL;
|
c->_prev = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -483,16 +483,16 @@ RefTable::RefNode *RefTable::Get(SQObject &obj,SQHash &mainpos,RefNode **prev,bo
|
|||||||
{
|
{
|
||||||
RefNode *ref;
|
RefNode *ref;
|
||||||
mainpos = ::HashObj(obj)&(_numofslots-1);
|
mainpos = ::HashObj(obj)&(_numofslots-1);
|
||||||
*prev = NULL;
|
*prev = nullptr;
|
||||||
for (ref = _buckets[mainpos]; ref; ) {
|
for (ref = _buckets[mainpos]; ref; ) {
|
||||||
if(_rawval(ref->obj) == _rawval(obj) && type(ref->obj) == type(obj))
|
if(_rawval(ref->obj) == _rawval(obj) && type(ref->obj) == type(obj))
|
||||||
break;
|
break;
|
||||||
*prev = ref;
|
*prev = ref;
|
||||||
ref = ref->next;
|
ref = ref->next;
|
||||||
}
|
}
|
||||||
if(ref == NULL && add) {
|
if(ref == nullptr && add) {
|
||||||
if(_numofslots == _slotused) {
|
if(_numofslots == _slotused) {
|
||||||
assert(_freelist == 0);
|
assert(_freelist == nullptr);
|
||||||
Resize(_numofslots*2);
|
Resize(_numofslots*2);
|
||||||
mainpos = ::HashObj(obj)&(_numofslots-1);
|
mainpos = ::HashObj(obj)&(_numofslots-1);
|
||||||
}
|
}
|
||||||
@@ -510,16 +510,16 @@ void RefTable::AllocNodes(SQUnsignedInteger size)
|
|||||||
RefNode *temp = nodes;
|
RefNode *temp = nodes;
|
||||||
SQUnsignedInteger n;
|
SQUnsignedInteger n;
|
||||||
for(n = 0; n < size - 1; n++) {
|
for(n = 0; n < size - 1; n++) {
|
||||||
bucks[n] = NULL;
|
bucks[n] = nullptr;
|
||||||
temp->refs = 0;
|
temp->refs = 0;
|
||||||
new (&temp->obj) SQObjectPtr;
|
new (&temp->obj) SQObjectPtr;
|
||||||
temp->next = temp+1;
|
temp->next = temp+1;
|
||||||
temp++;
|
temp++;
|
||||||
}
|
}
|
||||||
bucks[n] = NULL;
|
bucks[n] = nullptr;
|
||||||
temp->refs = 0;
|
temp->refs = 0;
|
||||||
new (&temp->obj) SQObjectPtr;
|
new (&temp->obj) SQObjectPtr;
|
||||||
temp->next = NULL;
|
temp->next = nullptr;
|
||||||
_freelist = nodes;
|
_freelist = nodes;
|
||||||
_nodes = nodes;
|
_nodes = nodes;
|
||||||
_buckets = bucks;
|
_buckets = bucks;
|
||||||
@@ -543,7 +543,7 @@ SQStringTable::SQStringTable()
|
|||||||
SQStringTable::~SQStringTable()
|
SQStringTable::~SQStringTable()
|
||||||
{
|
{
|
||||||
SQ_FREE(_strings,sizeof(SQString*)*_numofslots);
|
SQ_FREE(_strings,sizeof(SQString*)*_numofslots);
|
||||||
_strings = NULL;
|
_strings = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SQStringTable::AllocNodes(SQInteger size)
|
void SQStringTable::AllocNodes(SQInteger size)
|
||||||
@@ -580,8 +580,8 @@ SQString::SQString(const SQChar *news, SQInteger len)
|
|||||||
_val[len] = '\0';
|
_val[len] = '\0';
|
||||||
_len = len;
|
_len = len;
|
||||||
_hash = ::_hashstr(news,(size_t)len);
|
_hash = ::_hashstr(news,(size_t)len);
|
||||||
_next = NULL;
|
_next = nullptr;
|
||||||
_sharedstate = NULL;
|
_sharedstate = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SQStringTable::Resize(SQInteger size)
|
void SQStringTable::Resize(SQInteger size)
|
||||||
@@ -605,7 +605,7 @@ void SQStringTable::Resize(SQInteger size)
|
|||||||
void SQStringTable::Remove(SQString *bs)
|
void SQStringTable::Remove(SQString *bs)
|
||||||
{
|
{
|
||||||
SQString *s;
|
SQString *s;
|
||||||
SQString *prev=NULL;
|
SQString *prev=nullptr;
|
||||||
SQHash h = bs->_hash&(_numofslots - 1);
|
SQHash h = bs->_hash&(_numofslots - 1);
|
||||||
|
|
||||||
for (s = _strings[h]; s; ){
|
for (s = _strings[h]; s; ){
|
||||||
|
|||||||
12
src/3rdparty/squirrel/squirrel/sqtable.cpp
vendored
12
src/3rdparty/squirrel/squirrel/sqtable.cpp
vendored
@@ -18,7 +18,7 @@ SQTable::SQTable(SQSharedState *ss,SQInteger nInitialSize)
|
|||||||
while(nInitialSize>pow2size)pow2size=pow2size<<1;
|
while(nInitialSize>pow2size)pow2size=pow2size<<1;
|
||||||
AllocNodes(pow2size);
|
AllocNodes(pow2size);
|
||||||
_usednodes = 0;
|
_usednodes = 0;
|
||||||
_delegate = NULL;
|
_delegate = nullptr;
|
||||||
INIT_CHAIN();
|
INIT_CHAIN();
|
||||||
ADD_TO_CHAIN(&_sharedstate->_gc_chain,this);
|
ADD_TO_CHAIN(&_sharedstate->_gc_chain,this);
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ void SQTable::AllocNodes(SQInteger nSize)
|
|||||||
_HashNode *nodes=(_HashNode *)SQ_MALLOC(sizeof(_HashNode)*nSize);
|
_HashNode *nodes=(_HashNode *)SQ_MALLOC(sizeof(_HashNode)*nSize);
|
||||||
for(SQInteger i=0;i<nSize;i++){
|
for(SQInteger i=0;i<nSize;i++){
|
||||||
new (&nodes[i]) _HashNode;
|
new (&nodes[i]) _HashNode;
|
||||||
nodes[i].next=NULL;
|
nodes[i].next=nullptr;
|
||||||
}
|
}
|
||||||
_numofnodes=nSize;
|
_numofnodes=nSize;
|
||||||
_nodes=nodes;
|
_nodes=nodes;
|
||||||
@@ -120,7 +120,7 @@ bool SQTable::NewSlot(const SQObjectPtr &key,const SQObjectPtr &val)
|
|||||||
if (mp > n && (othern = &_nodes[mph]) != mp){
|
if (mp > n && (othern = &_nodes[mph]) != mp){
|
||||||
/* yes; move colliding node into free position */
|
/* yes; move colliding node into free position */
|
||||||
while (othern->next != mp){
|
while (othern->next != mp){
|
||||||
assert(othern->next != NULL);
|
assert(othern->next != nullptr);
|
||||||
othern = othern->next; /* find previous */
|
othern = othern->next; /* find previous */
|
||||||
}
|
}
|
||||||
othern->next = n; /* redo the chain with `n' in place of `mp' */
|
othern->next = n; /* redo the chain with `n' in place of `mp' */
|
||||||
@@ -129,7 +129,7 @@ bool SQTable::NewSlot(const SQObjectPtr &key,const SQObjectPtr &val)
|
|||||||
n->next = mp->next;
|
n->next = mp->next;
|
||||||
mp->key = _null_;
|
mp->key = _null_;
|
||||||
mp->val = _null_;
|
mp->val = _null_;
|
||||||
mp->next = NULL; /* now `mp' is free */
|
mp->next = nullptr; /* now `mp' is free */
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
/* new node will go into free position */
|
/* new node will go into free position */
|
||||||
@@ -141,7 +141,7 @@ bool SQTable::NewSlot(const SQObjectPtr &key,const SQObjectPtr &val)
|
|||||||
mp->key = key;
|
mp->key = key;
|
||||||
|
|
||||||
for (;;) { /* correct `firstfree' */
|
for (;;) { /* correct `firstfree' */
|
||||||
if (type(_firstfree->key) == OT_NULL && _firstfree->next == NULL) {
|
if (type(_firstfree->key) == OT_NULL && _firstfree->next == nullptr) {
|
||||||
mp->val = val;
|
mp->val = val;
|
||||||
_usednodes++;
|
_usednodes++;
|
||||||
return true; /* OK; table still has a free place */
|
return true; /* OK; table still has a free place */
|
||||||
@@ -190,7 +190,7 @@ void SQTable::_ClearNodes()
|
|||||||
void SQTable::Finalize()
|
void SQTable::Finalize()
|
||||||
{
|
{
|
||||||
_ClearNodes();
|
_ClearNodes();
|
||||||
SetDelegate(NULL);
|
SetDelegate(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SQTable::Clear()
|
void SQTable::Clear()
|
||||||
|
|||||||
8
src/3rdparty/squirrel/squirrel/sqtable.h
vendored
8
src/3rdparty/squirrel/squirrel/sqtable.h
vendored
@@ -27,7 +27,7 @@ struct SQTable : public SQDelegable
|
|||||||
private:
|
private:
|
||||||
struct _HashNode
|
struct _HashNode
|
||||||
{
|
{
|
||||||
_HashNode() { next = NULL; }
|
_HashNode() { next = nullptr; }
|
||||||
SQObjectPtr val;
|
SQObjectPtr val;
|
||||||
SQObjectPtr key;
|
SQObjectPtr key;
|
||||||
_HashNode *next;
|
_HashNode *next;
|
||||||
@@ -47,14 +47,14 @@ public:
|
|||||||
{
|
{
|
||||||
SQTable *newtable = (SQTable*)SQ_MALLOC(sizeof(SQTable));
|
SQTable *newtable = (SQTable*)SQ_MALLOC(sizeof(SQTable));
|
||||||
new (newtable) SQTable(ss, nInitialSize);
|
new (newtable) SQTable(ss, nInitialSize);
|
||||||
newtable->_delegate = NULL;
|
newtable->_delegate = nullptr;
|
||||||
return newtable;
|
return newtable;
|
||||||
}
|
}
|
||||||
void Finalize() override;
|
void Finalize() override;
|
||||||
SQTable *Clone();
|
SQTable *Clone();
|
||||||
~SQTable()
|
~SQTable()
|
||||||
{
|
{
|
||||||
SetDelegate(NULL);
|
SetDelegate(nullptr);
|
||||||
REMOVE_FROM_CHAIN(&_sharedstate->_gc_chain, this);
|
REMOVE_FROM_CHAIN(&_sharedstate->_gc_chain, this);
|
||||||
for (SQInteger i = 0; i < _numofnodes; i++) _nodes[i].~_HashNode();
|
for (SQInteger i = 0; i < _numofnodes; i++) _nodes[i].~_HashNode();
|
||||||
SQ_FREE(_nodes, _numofnodes * sizeof(_HashNode));
|
SQ_FREE(_nodes, _numofnodes * sizeof(_HashNode));
|
||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
}while((n = n->next));
|
}while((n = n->next));
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
bool Get(const SQObjectPtr &key,SQObjectPtr &val);
|
bool Get(const SQObjectPtr &key,SQObjectPtr &val);
|
||||||
void Remove(const SQObjectPtr &key);
|
void Remove(const SQObjectPtr &key);
|
||||||
|
|||||||
6
src/3rdparty/squirrel/squirrel/squserdata.h
vendored
6
src/3rdparty/squirrel/squirrel/squserdata.h
vendored
@@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
struct SQUserData : SQDelegable
|
struct SQUserData : SQDelegable
|
||||||
{
|
{
|
||||||
SQUserData(SQSharedState *ss, SQInteger size){ _delegate = 0; _hook = NULL; INIT_CHAIN(); ADD_TO_CHAIN(&_ss(this)->_gc_chain, this); _size = size; _typetag = 0;
|
SQUserData(SQSharedState *ss, SQInteger size){ _delegate = nullptr; _hook = nullptr; INIT_CHAIN(); ADD_TO_CHAIN(&_ss(this)->_gc_chain, this); _size = size; _typetag = nullptr;
|
||||||
}
|
}
|
||||||
~SQUserData()
|
~SQUserData()
|
||||||
{
|
{
|
||||||
REMOVE_FROM_CHAIN(&_ss(this)->_gc_chain, this);
|
REMOVE_FROM_CHAIN(&_ss(this)->_gc_chain, this);
|
||||||
SetDelegate(NULL);
|
SetDelegate(nullptr);
|
||||||
}
|
}
|
||||||
static SQUserData* Create(SQSharedState *ss, SQInteger size)
|
static SQUserData* Create(SQSharedState *ss, SQInteger size)
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@ struct SQUserData : SQDelegable
|
|||||||
}
|
}
|
||||||
#ifndef NO_GARBAGE_COLLECTOR
|
#ifndef NO_GARBAGE_COLLECTOR
|
||||||
void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue);
|
void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue);
|
||||||
void Finalize(){SetDelegate(NULL);}
|
void Finalize(){SetDelegate(nullptr);}
|
||||||
#endif
|
#endif
|
||||||
void Release() {
|
void Release() {
|
||||||
if (_hook) _hook(_val,_size);
|
if (_hook) _hook(_val,_size);
|
||||||
|
|||||||
2
src/3rdparty/squirrel/squirrel/squtils.h
vendored
2
src/3rdparty/squirrel/squirrel/squtils.h
vendored
@@ -18,7 +18,7 @@ template<typename T> class sqvector
|
|||||||
public:
|
public:
|
||||||
sqvector()
|
sqvector()
|
||||||
{
|
{
|
||||||
_vals = NULL;
|
_vals = nullptr;
|
||||||
_size = 0;
|
_size = 0;
|
||||||
_allocated = 0;
|
_allocated = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
30
src/3rdparty/squirrel/squirrel/sqvm.cpp
vendored
30
src/3rdparty/squirrel/squirrel/sqvm.cpp
vendored
@@ -33,7 +33,7 @@ void SQVM::ClearStack(SQInteger last_top)
|
|||||||
tOldType = o._type;
|
tOldType = o._type;
|
||||||
unOldVal = o._unVal;
|
unOldVal = o._unVal;
|
||||||
o._type = OT_NULL;
|
o._type = OT_NULL;
|
||||||
o._unVal.pUserPointer = NULL;
|
o._unVal.pUserPointer = nullptr;
|
||||||
__Release(tOldType,unOldVal);
|
__Release(tOldType,unOldVal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ SQVM::SQVM(SQSharedState *ss)
|
|||||||
_suspended_target=-1;
|
_suspended_target=-1;
|
||||||
_suspended_root = SQFalse;
|
_suspended_root = SQFalse;
|
||||||
_suspended_traps=0;
|
_suspended_traps=0;
|
||||||
_foreignptr=NULL;
|
_foreignptr=nullptr;
|
||||||
_nnativecalls=0;
|
_nnativecalls=0;
|
||||||
_lasterror = _null_;
|
_lasterror = _null_;
|
||||||
_errorhandler = _null_;
|
_errorhandler = _null_;
|
||||||
@@ -115,12 +115,12 @@ SQVM::SQVM(SQSharedState *ss)
|
|||||||
_can_suspend = false;
|
_can_suspend = false;
|
||||||
_in_stackoverflow = false;
|
_in_stackoverflow = false;
|
||||||
_ops_till_suspend = 0;
|
_ops_till_suspend = 0;
|
||||||
_callsstack = NULL;
|
_callsstack = nullptr;
|
||||||
_callsstacksize = 0;
|
_callsstacksize = 0;
|
||||||
_alloccallsstacksize = 0;
|
_alloccallsstacksize = 0;
|
||||||
_top = 0;
|
_top = 0;
|
||||||
_stackbase = 0;
|
_stackbase = 0;
|
||||||
ci = NULL;
|
ci = nullptr;
|
||||||
INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this);
|
INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,7 +379,7 @@ bool SQVM::StartCall(SQClosure *closure,SQInteger target,SQInteger args,SQIntege
|
|||||||
|
|
||||||
if (!tailcall) {
|
if (!tailcall) {
|
||||||
CallInfo lc = {};
|
CallInfo lc = {};
|
||||||
lc._generator = NULL;
|
lc._generator = nullptr;
|
||||||
lc._etraps = 0;
|
lc._etraps = 0;
|
||||||
lc._prevstkbase = (SQInt32) ( stackbase - _stackbase );
|
lc._prevstkbase = (SQInt32) ( stackbase - _stackbase );
|
||||||
lc._target = (SQInt32) target;
|
lc._target = (SQInt32) target;
|
||||||
@@ -437,7 +437,7 @@ bool SQVM::Return(SQInteger _arg0, SQInteger _arg1, SQObjectPtr &retval)
|
|||||||
|
|
||||||
while (last_top > oldstackbase) _stack._vals[last_top--].Null();
|
while (last_top > oldstackbase) _stack._vals[last_top--].Null();
|
||||||
assert(oldstackbase >= _stackbase);
|
assert(oldstackbase >= _stackbase);
|
||||||
return broot?true:false;
|
return broot != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _RET_ON_FAIL(exp) { if(!exp) return false; }
|
#define _RET_ON_FAIL(exp) { if(!exp) return false; }
|
||||||
@@ -557,7 +557,7 @@ bool SQVM::DELEGATE_OP(SQObjectPtr &trg,SQObjectPtr &o1,SQObjectPtr &o2)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OT_NULL:
|
case OT_NULL:
|
||||||
_table(o1)->SetDelegate(NULL);
|
_table(o1)->SetDelegate(nullptr);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Raise_Error("using '%s' as delegate", GetTypeName(o2));
|
Raise_Error("using '%s' as delegate", GetTypeName(o2));
|
||||||
@@ -627,7 +627,7 @@ bool SQVM::GETVARGV_OP(SQObjectPtr &target,SQObjectPtr &index,CallInfo *ci)
|
|||||||
|
|
||||||
bool SQVM::CLASS_OP(SQObjectPtr &target,SQInteger baseclass,SQInteger attributes)
|
bool SQVM::CLASS_OP(SQObjectPtr &target,SQInteger baseclass,SQInteger attributes)
|
||||||
{
|
{
|
||||||
SQClass *base = NULL;
|
SQClass *base = nullptr;
|
||||||
SQObjectPtr attrs;
|
SQObjectPtr attrs;
|
||||||
if(baseclass != -1) {
|
if(baseclass != -1) {
|
||||||
if(type(_stack._vals[_stackbase+baseclass]) != OT_CLASS) { Raise_Error("trying to inherit from a %s",GetTypeName(_stack._vals[_stackbase+baseclass])); return false; }
|
if(type(_stack._vals[_stackbase+baseclass]) != OT_CLASS) { Raise_Error("trying to inherit from a %s",GetTypeName(_stack._vals[_stackbase+baseclass])); return false; }
|
||||||
@@ -653,7 +653,7 @@ bool SQVM::CLASS_OP(SQObjectPtr &target,SQInteger baseclass,SQInteger attributes
|
|||||||
bool SQVM::IsEqual(SQObjectPtr &o1,SQObjectPtr &o2,bool &res)
|
bool SQVM::IsEqual(SQObjectPtr &o1,SQObjectPtr &o2,bool &res)
|
||||||
{
|
{
|
||||||
if(type(o1) == type(o2)) {
|
if(type(o1) == type(o2)) {
|
||||||
res = ((_rawval(o1) == _rawval(o2)?true:false));
|
res = ((_rawval(o1) == _rawval(o2)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(sq_isnumeric(o1) && sq_isnumeric(o2)) {
|
if(sq_isnumeric(o1) && sq_isnumeric(o2)) {
|
||||||
@@ -708,7 +708,7 @@ bool SQVM::Execute(SQObjectPtr &closure, SQInteger target, SQInteger nargs, SQIn
|
|||||||
temp_reg = closure;
|
temp_reg = closure;
|
||||||
if(!StartCall(_closure(temp_reg), _top - nargs, nargs, stackbase, false)) {
|
if(!StartCall(_closure(temp_reg), _top - nargs, nargs, stackbase, false)) {
|
||||||
//call the handler if there are no calls in the stack, if not relies on the previous node
|
//call the handler if there are no calls in the stack, if not relies on the previous node
|
||||||
if(ci == NULL) CallErrorHandler(_lasterror);
|
if(ci == nullptr) CallErrorHandler(_lasterror);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_funcproto(_closure(temp_reg)->_function)->_bgenerator) {
|
if (_funcproto(_closure(temp_reg)->_function)->_bgenerator) {
|
||||||
@@ -1028,7 +1028,7 @@ common_call:
|
|||||||
case _OP_THROW: Raise_Error(TARGET); SQ_THROW();
|
case _OP_THROW: Raise_Error(TARGET); SQ_THROW();
|
||||||
case _OP_CLASS: _GUARD(CLASS_OP(TARGET,arg1,arg2)); continue;
|
case _OP_CLASS: _GUARD(CLASS_OP(TARGET,arg1,arg2)); continue;
|
||||||
case _OP_NEWSLOTA:
|
case _OP_NEWSLOTA:
|
||||||
bool bstatic = (arg0&NEW_SLOT_STATIC_FLAG)?true:false;
|
bool bstatic = (arg0&NEW_SLOT_STATIC_FLAG) != 0;
|
||||||
if(type(STK(arg1)) == OT_CLASS) {
|
if(type(STK(arg1)) == OT_CLASS) {
|
||||||
if(type(_class(STK(arg1))->_metamethods[MT_NEWMEMBER]) != OT_NULL ) {
|
if(type(_class(STK(arg1))->_metamethods[MT_NEWMEMBER]) != OT_NULL ) {
|
||||||
Push(STK(arg1)); Push(STK(arg2)); Push(STK(arg3));
|
Push(STK(arg1)); Push(STK(arg2)); Push(STK(arg3));
|
||||||
@@ -1160,7 +1160,7 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
|
|||||||
_top = stackbase + nargs;
|
_top = stackbase + nargs;
|
||||||
CallInfo lci = {};
|
CallInfo lci = {};
|
||||||
lci._closure = nclosure;
|
lci._closure = nclosure;
|
||||||
lci._generator = NULL;
|
lci._generator = nullptr;
|
||||||
lci._etraps = 0;
|
lci._etraps = 0;
|
||||||
lci._prevstkbase = (SQInt32) (stackbase - _stackbase);
|
lci._prevstkbase = (SQInt32) (stackbase - _stackbase);
|
||||||
lci._ncalls = 1;
|
lci._ncalls = 1;
|
||||||
@@ -1471,9 +1471,7 @@ bool SQVM::DeleteSlot(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr
|
|||||||
|
|
||||||
bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams,SQInteger stackbase,SQObjectPtr &outres,SQBool raiseerror,SQBool can_suspend)
|
bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams,SQInteger stackbase,SQObjectPtr &outres,SQBool raiseerror,SQBool can_suspend)
|
||||||
{
|
{
|
||||||
#ifdef WITH_ASSERT
|
[[maybe_unused]] SQInteger prevstackbase = _stackbase;
|
||||||
SQInteger prevstackbase = _stackbase;
|
|
||||||
#endif
|
|
||||||
switch(type(closure)) {
|
switch(type(closure)) {
|
||||||
case OT_CLOSURE: {
|
case OT_CLOSURE: {
|
||||||
assert(!can_suspend || this->_can_suspend);
|
assert(!can_suspend || this->_can_suspend);
|
||||||
@@ -1504,11 +1502,9 @@ bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams,SQInteger stackbase,SQObj
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef WITH_ASSERT
|
|
||||||
if(!_suspended) {
|
if(!_suspended) {
|
||||||
assert(_stackbase == prevstackbase);
|
assert(_stackbase == prevstackbase);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -310,6 +310,8 @@ add_files(
|
|||||||
rail_gui.h
|
rail_gui.h
|
||||||
rail_map.h
|
rail_map.h
|
||||||
rail_type.h
|
rail_type.h
|
||||||
|
random_access_file.cpp
|
||||||
|
random_access_file_type.h
|
||||||
rev.h
|
rev.h
|
||||||
road.cpp
|
road.cpp
|
||||||
road.h
|
road.h
|
||||||
@@ -337,6 +339,8 @@ add_files(
|
|||||||
settings_gui.cpp
|
settings_gui.cpp
|
||||||
settings_gui.h
|
settings_gui.h
|
||||||
settings_internal.h
|
settings_internal.h
|
||||||
|
settings_table.h
|
||||||
|
settings_table.cpp
|
||||||
settings_type.h
|
settings_type.h
|
||||||
ship.h
|
ship.h
|
||||||
ship_cmd.cpp
|
ship_cmd.cpp
|
||||||
@@ -466,6 +470,7 @@ add_files(
|
|||||||
viewport_type.h
|
viewport_type.h
|
||||||
void_cmd.cpp
|
void_cmd.cpp
|
||||||
void_map.h
|
void_map.h
|
||||||
|
walltime_func.h
|
||||||
water.h
|
water.h
|
||||||
water_cmd.cpp
|
water_cmd.cpp
|
||||||
water_map.h
|
water_map.h
|
||||||
|
|||||||
@@ -114,7 +114,7 @@
|
|||||||
cur_company.Restore();
|
cur_company.Restore();
|
||||||
|
|
||||||
InvalidateWindowData(WC_AI_DEBUG, 0, -1);
|
InvalidateWindowData(WC_AI_DEBUG, 0, -1);
|
||||||
DeleteWindowById(WC_AI_SETTINGS, company);
|
CloseWindowById(WC_AI_SETTINGS, company);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void AI::Pause(CompanyID company)
|
/* static */ void AI::Pause(CompanyID company)
|
||||||
@@ -207,7 +207,7 @@
|
|||||||
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
|
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
|
||||||
if (_settings_game.ai_config[c] != nullptr && _settings_game.ai_config[c]->HasScript()) {
|
if (_settings_game.ai_config[c] != nullptr && _settings_game.ai_config[c]->HasScript()) {
|
||||||
if (!_settings_game.ai_config[c]->ResetInfo(true)) {
|
if (!_settings_game.ai_config[c]->ResetInfo(true)) {
|
||||||
DEBUG(script, 0, "After a reload, the AI by the name '%s' was no longer found, and removed from the list.", _settings_game.ai_config[c]->GetName());
|
Debug(script, 0, "After a reload, the AI by the name '{}' was no longer found, and removed from the list.", _settings_game.ai_config[c]->GetName());
|
||||||
_settings_game.ai_config[c]->Change(nullptr);
|
_settings_game.ai_config[c]->Change(nullptr);
|
||||||
if (Company::IsValidAiID(c)) {
|
if (Company::IsValidAiID(c)) {
|
||||||
/* The code belonging to an already running AI was deleted. We can only do
|
/* The code belonging to an already running AI was deleted. We can only do
|
||||||
@@ -224,7 +224,7 @@
|
|||||||
}
|
}
|
||||||
if (_settings_newgame.ai_config[c] != nullptr && _settings_newgame.ai_config[c]->HasScript()) {
|
if (_settings_newgame.ai_config[c] != nullptr && _settings_newgame.ai_config[c]->HasScript()) {
|
||||||
if (!_settings_newgame.ai_config[c]->ResetInfo(false)) {
|
if (!_settings_newgame.ai_config[c]->ResetInfo(false)) {
|
||||||
DEBUG(script, 0, "After a reload, the AI by the name '%s' was no longer found, and removed from the list.", _settings_newgame.ai_config[c]->GetName());
|
Debug(script, 0, "After a reload, the AI by the name '{}' was no longer found, and removed from the list.", _settings_newgame.ai_config[c]->GetName());
|
||||||
_settings_newgame.ai_config[c]->Change(nullptr);
|
_settings_newgame.ai_config[c]->Change(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ struct AIListWindow : public Window {
|
|||||||
}
|
}
|
||||||
InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
|
InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
|
||||||
InvalidateWindowClassesData(WC_AI_SETTINGS);
|
InvalidateWindowClassesData(WC_AI_SETTINGS);
|
||||||
DeleteWindowByClass(WC_QUERY_STRING);
|
CloseWindowByClass(WC_QUERY_STRING);
|
||||||
InvalidateWindowClassesData(WC_TEXTFILE);
|
InvalidateWindowClassesData(WC_TEXTFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,13 +190,13 @@ struct AIListWindow : public Window {
|
|||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_AIL_LIST: { // Select one of the AIs
|
case WID_AIL_LIST: { // Select one of the AIs
|
||||||
int sel = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_AIL_LIST, 0, this->line_height) - 1;
|
int sel = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_AIL_LIST) - 1;
|
||||||
if (sel < (int)this->info_list->size()) {
|
if (sel < (int)this->info_list->size()) {
|
||||||
this->selected = sel;
|
this->selected = sel;
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
if (click_count > 1) {
|
if (click_count > 1) {
|
||||||
this->ChangeAI();
|
this->ChangeAI();
|
||||||
delete this;
|
this->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -204,12 +204,12 @@ struct AIListWindow : public Window {
|
|||||||
|
|
||||||
case WID_AIL_ACCEPT: {
|
case WID_AIL_ACCEPT: {
|
||||||
this->ChangeAI();
|
this->ChangeAI();
|
||||||
delete this;
|
this->Close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WID_AIL_CANCEL:
|
case WID_AIL_CANCEL:
|
||||||
delete this;
|
this->Close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ struct AIListWindow : public Window {
|
|||||||
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
||||||
{
|
{
|
||||||
if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) {
|
if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) {
|
||||||
delete this;
|
this->Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ static WindowDesc _ai_list_desc(
|
|||||||
*/
|
*/
|
||||||
static void ShowAIListWindow(CompanyID slot)
|
static void ShowAIListWindow(CompanyID slot)
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_AI_LIST);
|
CloseWindowByClass(WC_AI_LIST);
|
||||||
new AIListWindow(&_ai_list_desc, slot);
|
new AIListWindow(&_ai_list_desc, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,7 +444,7 @@ struct AISettingsWindow : public Window {
|
|||||||
if (!this->IsEditableItem(config_item)) return;
|
if (!this->IsEditableItem(config_item)) return;
|
||||||
|
|
||||||
if (this->clicked_row != num) {
|
if (this->clicked_row != num) {
|
||||||
DeleteChildWindows(WC_QUERY_STRING);
|
this->CloseChildWindows(WC_QUERY_STRING);
|
||||||
HideDropDownMenu(this);
|
HideDropDownMenu(this);
|
||||||
this->clicked_row = num;
|
this->clicked_row = num;
|
||||||
this->clicked_dropdown = false;
|
this->clicked_dropdown = false;
|
||||||
@@ -518,7 +518,7 @@ struct AISettingsWindow : public Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case WID_AIS_ACCEPT:
|
case WID_AIS_ACCEPT:
|
||||||
delete this;
|
this->Close();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_AIS_RESET:
|
case WID_AIS_RESET:
|
||||||
@@ -584,7 +584,7 @@ struct AISettingsWindow : public Window {
|
|||||||
{
|
{
|
||||||
this->RebuildVisibleSettings();
|
this->RebuildVisibleSettings();
|
||||||
HideDropDownMenu(this);
|
HideDropDownMenu(this);
|
||||||
DeleteChildWindows(WC_QUERY_STRING);
|
this->CloseChildWindows(WC_QUERY_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -628,8 +628,8 @@ static WindowDesc _ai_settings_desc(
|
|||||||
*/
|
*/
|
||||||
static void ShowAISettingsWindow(CompanyID slot)
|
static void ShowAISettingsWindow(CompanyID slot)
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_AI_LIST);
|
CloseWindowByClass(WC_AI_LIST);
|
||||||
DeleteWindowByClass(WC_AI_SETTINGS);
|
CloseWindowByClass(WC_AI_SETTINGS);
|
||||||
new AISettingsWindow(&_ai_settings_desc, slot);
|
new AISettingsWindow(&_ai_settings_desc, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -655,7 +655,7 @@ struct ScriptTextfileWindow : public TextfileWindow {
|
|||||||
{
|
{
|
||||||
const char *textfile = GetConfig(slot)->GetTextfile(file_type, slot);
|
const char *textfile = GetConfig(slot)->GetTextfile(file_type, slot);
|
||||||
if (textfile == nullptr) {
|
if (textfile == nullptr) {
|
||||||
delete this;
|
this->Close();
|
||||||
} else {
|
} else {
|
||||||
this->LoadTextfile(textfile, (slot == OWNER_DEITY) ? GAME_DIR : AI_DIR);
|
this->LoadTextfile(textfile, (slot == OWNER_DEITY) ? GAME_DIR : AI_DIR);
|
||||||
}
|
}
|
||||||
@@ -669,7 +669,7 @@ struct ScriptTextfileWindow : public TextfileWindow {
|
|||||||
*/
|
*/
|
||||||
void ShowScriptTextfileWindow(TextfileType file_type, CompanyID slot)
|
void ShowScriptTextfileWindow(TextfileType file_type, CompanyID slot)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_TEXTFILE, file_type);
|
CloseWindowById(WC_TEXTFILE, file_type);
|
||||||
new ScriptTextfileWindow(file_type, slot);
|
new ScriptTextfileWindow(file_type, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -744,10 +744,11 @@ struct AIConfigWindow : public Window {
|
|||||||
this->OnInvalidateData(0);
|
this->OnInvalidateData(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
~AIConfigWindow()
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_AI_LIST);
|
CloseWindowByClass(WC_AI_LIST);
|
||||||
DeleteWindowByClass(WC_AI_SETTINGS);
|
CloseWindowByClass(WC_AI_SETTINGS);
|
||||||
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetStringParameters(int widget) const override
|
void SetStringParameters(int widget) const override
|
||||||
@@ -784,6 +785,7 @@ struct AIConfigWindow : public Window {
|
|||||||
|
|
||||||
case WID_AIC_LIST:
|
case WID_AIC_LIST:
|
||||||
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
|
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
|
||||||
|
resize->height = this->line_height;
|
||||||
size->height = 8 * this->line_height;
|
size->height = 8 * this->line_height;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -895,7 +897,7 @@ struct AIConfigWindow : public Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case WID_AIC_LIST: { // Select a slot
|
case WID_AIC_LIST: { // Select a slot
|
||||||
this->selected_slot = (CompanyID)this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget, 0, this->line_height);
|
this->selected_slot = (CompanyID)this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget);
|
||||||
this->InvalidateData();
|
this->InvalidateData();
|
||||||
if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
|
if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
|
||||||
break;
|
break;
|
||||||
@@ -928,7 +930,7 @@ struct AIConfigWindow : public Window {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_AIC_CLOSE:
|
case WID_AIC_CLOSE:
|
||||||
delete this;
|
this->Close();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_AIC_CONTENT_DOWNLOAD:
|
case WID_AIC_CONTENT_DOWNLOAD:
|
||||||
@@ -970,7 +972,7 @@ struct AIConfigWindow : public Window {
|
|||||||
/** Open the AI config window. */
|
/** Open the AI config window. */
|
||||||
void ShowAIConfigWindow()
|
void ShowAIConfigWindow()
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_GAME_OPTIONS);
|
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||||
new AIConfigWindow();
|
new AIConfigWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1262,7 +1264,7 @@ struct AIDebugWindow : public Window {
|
|||||||
this->highlight_row = -1; // The highlight of one AI make little sense for another AI.
|
this->highlight_row = -1; // The highlight of one AI make little sense for another AI.
|
||||||
|
|
||||||
/* Close AI settings window to prevent confusion */
|
/* Close AI settings window to prevent confusion */
|
||||||
DeleteWindowByClass(WC_AI_SETTINGS);
|
CloseWindowByClass(WC_AI_SETTINGS);
|
||||||
|
|
||||||
this->InvalidateData(-1);
|
this->InvalidateData(-1);
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
static bool CheckAPIVersion(const char *api_version)
|
static bool CheckAPIVersion(const char *api_version)
|
||||||
{
|
{
|
||||||
static const std::set<std::string> versions = { "0.7", "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11" };
|
static const std::set<std::string> versions = { "0.7", "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11", "12" };
|
||||||
return versions.find(api_version) != versions.end();
|
return versions.find(api_version) != versions.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; }
|
|||||||
{
|
{
|
||||||
/* Get the AIInfo */
|
/* Get the AIInfo */
|
||||||
SQUserPointer instance = nullptr;
|
SQUserPointer instance = nullptr;
|
||||||
if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, 0)) || instance == nullptr) return sq_throwerror(vm, "Pass an instance of a child class of AIInfo to RegisterAI");
|
if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, nullptr)) || instance == nullptr) return sq_throwerror(vm, "Pass an instance of a child class of AIInfo to RegisterAI");
|
||||||
AIInfo *info = (AIInfo *)instance;
|
AIInfo *info = (AIInfo *)instance;
|
||||||
|
|
||||||
SQInteger res = ScriptInfo::Constructor(vm, info);
|
SQInteger res = ScriptInfo::Constructor(vm, info);
|
||||||
@@ -89,7 +89,7 @@ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; }
|
|||||||
if (info->engine->MethodExists(*info->SQ_instance, "GetAPIVersion")) {
|
if (info->engine->MethodExists(*info->SQ_instance, "GetAPIVersion")) {
|
||||||
if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "GetAPIVersion", &info->api_version, MAX_GET_OPS)) return SQ_ERROR;
|
if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "GetAPIVersion", &info->api_version, MAX_GET_OPS)) return SQ_ERROR;
|
||||||
if (!CheckAPIVersion(info->api_version)) {
|
if (!CheckAPIVersion(info->api_version)) {
|
||||||
DEBUG(script, 1, "Loading info.nut from (%s.%d): GetAPIVersion returned invalid version", info->GetName(), info->GetVersion());
|
Debug(script, 1, "Loading info.nut from ({}.{}): GetAPIVersion returned invalid version", info->GetName(), info->GetVersion());
|
||||||
return SQ_ERROR;
|
return SQ_ERROR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -107,7 +107,7 @@ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; }
|
|||||||
{
|
{
|
||||||
/* Get the AIInfo */
|
/* Get the AIInfo */
|
||||||
SQUserPointer instance;
|
SQUserPointer instance;
|
||||||
sq_getinstanceup(vm, 2, &instance, 0);
|
sq_getinstanceup(vm, 2, &instance, nullptr);
|
||||||
AIInfo *info = (AIInfo *)instance;
|
AIInfo *info = (AIInfo *)instance;
|
||||||
info->api_version = nullptr;
|
info->api_version = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ AIInfo *AIScannerInfo::SelectRandomAI() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (num_random_ais == 0) {
|
if (num_random_ais == 0) {
|
||||||
DEBUG(script, 0, "No suitable AI found, loading 'dummy' AI.");
|
Debug(script, 0, "No suitable AI found, loading 'dummy' AI.");
|
||||||
return this->info_dummy;
|
return this->info_dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1025,7 +1025,7 @@ static bool AircraftController(Aircraft *v)
|
|||||||
if (count == 0) return false;
|
if (count == 0) return false;
|
||||||
|
|
||||||
/* If the plane will be a few subpixels away from the destination after
|
/* If the plane will be a few subpixels away from the destination after
|
||||||
* this movement loop, start nudging him towards the exact position for
|
* this movement loop, start nudging it towards the exact position for
|
||||||
* the whole loop. Otherwise, heavily depending on the speed of the plane,
|
* the whole loop. Otherwise, heavily depending on the speed of the plane,
|
||||||
* it is possible we totally overshoot the target, causing the plane to
|
* it is possible we totally overshoot the target, causing the plane to
|
||||||
* make a loop, and trying again, and again, and again .. */
|
* make a loop, and trying again, and again, and again .. */
|
||||||
@@ -1786,7 +1786,7 @@ static bool AirportMove(Aircraft *v, const AirportFTAClass *apc)
|
|||||||
{
|
{
|
||||||
/* error handling */
|
/* error handling */
|
||||||
if (v->pos >= apc->nofelements) {
|
if (v->pos >= apc->nofelements) {
|
||||||
DEBUG(misc, 0, "[Ap] position %d is not valid for current airport. Max position is %d", v->pos, apc->nofelements-1);
|
Debug(misc, 0, "[Ap] position {} is not valid for current airport. Max position is {}", v->pos, apc->nofelements-1);
|
||||||
assert(v->pos < apc->nofelements);
|
assert(v->pos < apc->nofelements);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1825,7 +1825,7 @@ static bool AirportMove(Aircraft *v, const AirportFTAClass *apc)
|
|||||||
current = current->next;
|
current = current->next;
|
||||||
} while (current != nullptr);
|
} while (current != nullptr);
|
||||||
|
|
||||||
DEBUG(misc, 0, "[Ap] cannot move further on Airport! (pos %d state %d) for vehicle %d", v->pos, v->state, v->index);
|
Debug(misc, 0, "[Ap] cannot move further on Airport! (pos {} state {}) for vehicle {}", v->pos, v->state, v->index);
|
||||||
NOT_REACHED();
|
NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,10 +84,11 @@ struct BuildAirToolbarWindow : Window {
|
|||||||
this->last_user_action = WIDGET_LIST_END;
|
this->last_user_action = WIDGET_LIST_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
~BuildAirToolbarWindow()
|
void Close() override
|
||||||
{
|
{
|
||||||
if (this->IsWidgetLowered(WID_AT_AIRPORT)) SetViewportCatchmentStation(nullptr, true);
|
if (this->IsWidgetLowered(WID_AT_AIRPORT)) SetViewportCatchmentStation(nullptr, true);
|
||||||
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
|
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
|
||||||
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,7 +105,7 @@ struct BuildAirToolbarWindow : Window {
|
|||||||
WID_AT_AIRPORT,
|
WID_AT_AIRPORT,
|
||||||
WIDGET_LIST_END);
|
WIDGET_LIST_END);
|
||||||
if (!can_build) {
|
if (!can_build) {
|
||||||
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
CloseWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
||||||
|
|
||||||
/* Show in the tooltip why this button is disabled. */
|
/* Show in the tooltip why this button is disabled. */
|
||||||
this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
|
this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
|
||||||
@@ -166,8 +167,8 @@ struct BuildAirToolbarWindow : Window {
|
|||||||
|
|
||||||
this->RaiseButtons();
|
this->RaiseButtons();
|
||||||
|
|
||||||
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
CloseWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
|
|
||||||
citymania::AbortStationPlacement();
|
citymania::AbortStationPlacement();
|
||||||
}
|
}
|
||||||
@@ -227,7 +228,7 @@ Window *ShowBuildAirToolbar()
|
|||||||
{
|
{
|
||||||
if (!Company::IsValidID(_local_company)) return nullptr;
|
if (!Company::IsValidID(_local_company)) return nullptr;
|
||||||
|
|
||||||
DeleteWindowByClass(WC_BUILD_TOOLBAR);
|
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||||
return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
|
return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,9 +287,10 @@ public:
|
|||||||
if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
|
if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~BuildAirportWindow()
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
|
this->PickerWindowBase::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetStringParameters(int widget) const override
|
void SetStringParameters(int widget) const override
|
||||||
@@ -495,7 +497,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_AP_AIRPORT_LIST: {
|
case WID_AP_AIRPORT_LIST: {
|
||||||
int num_clicked = this->vscroll->GetPosition() + (pt.y - this->nested_array[widget]->pos_y) / this->line_height;
|
int num_clicked = this->vscroll->GetPosition() + (pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y) / this->line_height;
|
||||||
if (num_clicked >= this->vscroll->GetCount()) break;
|
if (num_clicked >= this->vscroll->GetCount()) break;
|
||||||
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(num_clicked);
|
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(num_clicked);
|
||||||
if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);
|
if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "command_func.h"
|
#include "command_func.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "autoreplace_base.h"
|
#include "autoreplace_base.h"
|
||||||
|
#include "core/bitmath_func.hpp"
|
||||||
#include "core/pool_func.hpp"
|
#include "core/pool_func.hpp"
|
||||||
|
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
@@ -64,7 +65,7 @@ void RemoveAllEngineReplacement(EngineRenewList *erl)
|
|||||||
EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group, bool *replace_when_old)
|
EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group, bool *replace_when_old)
|
||||||
{
|
{
|
||||||
const EngineRenew *er = GetEngineReplacement(erl, engine, group);
|
const EngineRenew *er = GetEngineReplacement(erl, engine, group);
|
||||||
if (er == nullptr && (group == DEFAULT_GROUP || (Group::IsValidID(group) && !Group::Get(group)->replace_protection))) {
|
if (er == nullptr && (group == DEFAULT_GROUP || (Group::IsValidID(group) && !HasBit(Group::Get(group)->flags, GroupFlags::GF_REPLACE_PROTECTION)))) {
|
||||||
/* We didn't find anything useful in the vehicle's own group so we will try ALL_GROUP */
|
/* We didn't find anything useful in the vehicle's own group so we will try ALL_GROUP */
|
||||||
er = GetEngineReplacement(erl, engine, ALL_GROUP);
|
er = GetEngineReplacement(erl, engine, ALL_GROUP);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ static int GetIncompatibleRefitOrderIdForAutoreplace(const Vehicle *v, EngineID
|
|||||||
const Vehicle *u = (v->type == VEH_TRAIN) ? v->First() : v;
|
const Vehicle *u = (v->type == VEH_TRAIN) ? v->First() : v;
|
||||||
|
|
||||||
const OrderList *orders = u->orders.list;
|
const OrderList *orders = u->orders.list;
|
||||||
|
if (orders == nullptr) return -1;
|
||||||
for (VehicleOrderID i = 0; i < orders->GetNumOrders(); i++) {
|
for (VehicleOrderID i = 0; i < orders->GetNumOrders(); i++) {
|
||||||
o = orders->GetOrderAt(i);
|
o = orders->GetOrderAt(i);
|
||||||
if (!o->IsRefit()) continue;
|
if (!o->IsRefit()) continue;
|
||||||
@@ -596,8 +597,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
|
|||||||
assert(RailVehInfo(wagon->engine_type)->railveh_type == RAILVEH_WAGON);
|
assert(RailVehInfo(wagon->engine_type)->railveh_type == RAILVEH_WAGON);
|
||||||
|
|
||||||
/* Sell wagon */
|
/* Sell wagon */
|
||||||
CommandCost ret = DoCommand(0, wagon->index, 0, DC_EXEC, GetCmdSellVeh(wagon));
|
[[maybe_unused]] CommandCost ret = DoCommand(0, wagon->index, 0, DC_EXEC, GetCmdSellVeh(wagon));
|
||||||
(void)ret; // assert only
|
|
||||||
assert(ret.Succeeded());
|
assert(ret.Succeeded());
|
||||||
new_vehs[i] = nullptr;
|
new_vehs[i] = nullptr;
|
||||||
|
|
||||||
@@ -614,6 +614,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
|
|||||||
/* Success ! */
|
/* Success ! */
|
||||||
if ((flags & DC_EXEC) != 0 && new_head != old_head) {
|
if ((flags & DC_EXEC) != 0 && new_head != old_head) {
|
||||||
*chain = new_head;
|
*chain = new_head;
|
||||||
|
AI::NewEvent(old_head->owner, new ScriptEventVehicleAutoReplaced(old_head->index, new_head->index));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Transfer cargo of old vehicles and sell them */
|
/* Transfer cargo of old vehicles and sell them */
|
||||||
@@ -631,10 +632,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
|
|||||||
cost.AddCost(DoCommand(0, w->index, 0, flags | DC_AUTOREPLACE, GetCmdSellVeh(w)));
|
cost.AddCost(DoCommand(0, w->index, 0, flags | DC_AUTOREPLACE, GetCmdSellVeh(w)));
|
||||||
if ((flags & DC_EXEC) != 0) {
|
if ((flags & DC_EXEC) != 0) {
|
||||||
old_vehs[i] = nullptr;
|
old_vehs[i] = nullptr;
|
||||||
if (i == 0) {
|
if (i == 0) old_head = nullptr;
|
||||||
AI::NewEvent(old_head->owner, new ScriptEventVehicleAutoReplaced(old_head->index, new_head->index));
|
|
||||||
old_head = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,8 +650,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
|
|||||||
assert(Train::From(old_head)->GetNextUnit() == nullptr);
|
assert(Train::From(old_head)->GetNextUnit() == nullptr);
|
||||||
|
|
||||||
for (int i = num_units - 1; i > 0; i--) {
|
for (int i = num_units - 1; i > 0; i--) {
|
||||||
CommandCost ret = CmdMoveVehicle(old_vehs[i], old_head, DC_EXEC | DC_AUTOREPLACE, false);
|
[[maybe_unused]] CommandCost ret = CmdMoveVehicle(old_vehs[i], old_head, DC_EXEC | DC_AUTOREPLACE, false);
|
||||||
(void)ret; // assert only
|
|
||||||
assert(ret.Succeeded());
|
assert(ret.Succeeded());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -717,7 +714,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
|
|||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||||
if (v == nullptr) return CMD_ERROR;
|
if (v == nullptr) return CMD_ERROR;
|
||||||
@@ -741,6 +738,9 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
|
|||||||
const Company *c = Company::Get(_current_company);
|
const Company *c = Company::Get(_current_company);
|
||||||
bool wagon_removal = c->settings.renew_keep_length;
|
bool wagon_removal = c->settings.renew_keep_length;
|
||||||
|
|
||||||
|
const Group *g = Group::GetIfValid(v->group_id);
|
||||||
|
if (g != nullptr) wagon_removal = HasBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL);
|
||||||
|
|
||||||
/* Test whether any replacement is set, before issuing a whole lot of commands that would end in nothing changed */
|
/* Test whether any replacement is set, before issuing a whole lot of commands that would end in nothing changed */
|
||||||
Vehicle *w = v;
|
Vehicle *w = v;
|
||||||
bool any_replacements = false;
|
bool any_replacements = false;
|
||||||
@@ -807,7 +807,7 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
|
|||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Company *c = Company::GetIfValid(_current_company);
|
Company *c = Company::GetIfValid(_current_company);
|
||||||
if (c == nullptr) return CMD_ERROR;
|
if (c == nullptr) return CMD_ERROR;
|
||||||
|
|||||||
@@ -375,8 +375,18 @@ public:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
|
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
|
||||||
const Company *c = Company::Get(_local_company);
|
bool remove_wagon;
|
||||||
SetDParam(0, c->settings.renew_keep_length ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
|
const Group *g = Group::GetIfValid(this->sel_group);
|
||||||
|
if (g != nullptr) {
|
||||||
|
remove_wagon = HasBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL);
|
||||||
|
SetDParam(0, STR_GROUP_NAME);
|
||||||
|
SetDParam(1, sel_group);
|
||||||
|
} else {
|
||||||
|
const Company *c = Company::Get(_local_company);
|
||||||
|
remove_wagon = c->settings.renew_keep_length;
|
||||||
|
SetDParam(0, STR_GROUP_DEFAULT_TRAINS + this->window_number);
|
||||||
|
}
|
||||||
|
SetDParam(2, remove_wagon ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,9 +538,16 @@ public:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: // toggle renew_keep_length
|
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
|
||||||
DoCommandP(0, GetCompanySettingIndex("company.renew_keep_length"), Company::Get(_local_company)->settings.renew_keep_length ? 0 : 1, CMD_CHANGE_COMPANY_SETTING);
|
const Group *g = Group::GetIfValid(this->sel_group);
|
||||||
|
if (g != nullptr) {
|
||||||
|
DoCommandP(0, this->sel_group | (GroupFlags::GF_REPLACE_WAGON_REMOVAL << 16), (HasBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL) ? 0 : 1) | (_ctrl_pressed << 1), CMD_SET_GROUP_FLAG);
|
||||||
|
} else {
|
||||||
|
// toggle renew_keep_length
|
||||||
|
DoCommandP(0, 0, Company::Get(_local_company)->settings.renew_keep_length ? 0 : 1, CMD_CHANGE_COMPANY_SETTING, nullptr, "company.renew_keep_length");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WID_RV_START_REPLACE: { // Start replacing
|
case WID_RV_START_REPLACE: { // Start replacing
|
||||||
if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
|
if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
|
||||||
@@ -628,6 +645,20 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
|
||||||
|
{
|
||||||
|
if (widget != WID_RV_TRAIN_WAGONREMOVE_TOGGLE) return false;
|
||||||
|
|
||||||
|
if (Group::IsValidID(this->sel_group)) {
|
||||||
|
uint64 params[1];
|
||||||
|
params[0] = STR_REPLACE_REMOVE_WAGON_HELP;
|
||||||
|
GuiShowTooltips(this, STR_REPLACE_REMOVE_WAGON_GROUP_HELP, 1, params, close_cond);
|
||||||
|
} else {
|
||||||
|
GuiShowTooltips(this, STR_REPLACE_REMOVE_WAGON_HELP, 0, nullptr, close_cond);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void OnResize() override
|
void OnResize() override
|
||||||
{
|
{
|
||||||
this->vscroll[0]->SetCapacityFromWidget(this, WID_RV_LEFT_MATRIX);
|
this->vscroll[0]->SetCapacityFromWidget(this, WID_RV_LEFT_MATRIX);
|
||||||
@@ -833,7 +864,7 @@ static WindowDesc _replace_vehicle_desc(
|
|||||||
*/
|
*/
|
||||||
void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype)
|
void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_REPLACE_VEHICLE, vehicletype);
|
CloseWindowById(WC_REPLACE_VEHICLE, vehicletype);
|
||||||
WindowDesc *desc;
|
WindowDesc *desc;
|
||||||
switch (vehicletype) {
|
switch (vehicletype) {
|
||||||
case VEH_TRAIN: desc = &_replace_rail_vehicle_desc; break;
|
case VEH_TRAIN: desc = &_replace_rail_vehicle_desc; break;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user