Compare commits
No commits in common. "master" and "15.0-beta1" have entirely different histories.
master
...
15.0-beta1
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -50,6 +50,7 @@ Describe here
|
||||
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.
|
||||
* The bug fix is important enough to be backported? (label: 'backport requested')
|
||||
* This PR touches english.txt or translations? Check the [guidelines](https://github.com/OpenTTD/OpenTTD/blob/master/docs/eints.md)
|
||||
* This PR affects the save game format? (label 'savegame upgrade')
|
||||
* This PR affects the GS/AI API? (label 'needs review: Script API')
|
||||
* ai_changelog.hpp, game_changelog.hpp need updating.
|
||||
* The compatibility wrappers (compat_*.nut) need updating.
|
||||
|
36
.github/changelog.py
vendored
@ -1,36 +0,0 @@
|
||||
import sys
|
||||
|
||||
"""
|
||||
This script assumes changelogs use the following format:
|
||||
## <major>.x (eg. "## 15.x") to indicate a major version series
|
||||
### <major>.<minor>[-<suffix>] <date etc> (eg. "## 15.0 (2025-04-01)", "### 15.1-beta1 (2024-12-25)") to indicate an individual version
|
||||
"""
|
||||
|
||||
def main():
|
||||
current_version = sys.argv[1]
|
||||
stable_version = current_version.split("-")[0]
|
||||
major_version = current_version.split(".")[0]
|
||||
# set when current version is found
|
||||
current_found = False
|
||||
|
||||
with open("changelog.md", "r") as file:
|
||||
for line in file:
|
||||
if line.startswith("### "):
|
||||
if not line.startswith(f"### {current_version} ") and not current_found:
|
||||
# First version in changelog should be the current one
|
||||
sys.stderr.write(f"Changelog doesn't start with current version ({current_version})\n")
|
||||
sys.exit(1)
|
||||
if not line.startswith(f"### {stable_version}"):
|
||||
# Reached a previous stable version
|
||||
break
|
||||
if line.startswith(f"### {current_version} "):
|
||||
current_found = True
|
||||
elif line.startswith("## "):
|
||||
if not line.startswith(f"## {major_version}.x"):
|
||||
# Reached a previous major version
|
||||
break
|
||||
|
||||
print(line.rstrip())
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
16
.github/changelog.sh
vendored
Executable file
@ -0,0 +1,16 @@
|
||||
#!/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]\+[^-]'
|
||||
next=$(cat changelog.md | 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.md | 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
|
||||
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
|
2
.github/unused-strings.py
vendored
@ -158,7 +158,7 @@ def scan_source_files(path, strings_found):
|
||||
# Most files we can just open, but some use magic, that requires the
|
||||
# G++ preprocessor before we can make sense out of it.
|
||||
if new_path == "src/table/cargo_const.h":
|
||||
p = subprocess.run(["g++", "-E", "-DCHECK_UNUSED_STRINGS", new_path], stdout=subprocess.PIPE)
|
||||
p = subprocess.run(["g++", "-E", new_path], stdout=subprocess.PIPE)
|
||||
output = p.stdout.decode()
|
||||
else:
|
||||
with open(new_path) as fp:
|
||||
|
12
.github/workflows/ci-emscripten.yml
vendored
@ -12,8 +12,7 @@ jobs:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
# If you change this version, change the numbers in the cache step,
|
||||
# .github/workflows/preview-build.yml (2x) and os/emscripten/Dockerfile too.
|
||||
# If you change this version, change the number in the cache step too.
|
||||
image: emscripten/emsdk:3.1.57
|
||||
|
||||
steps:
|
||||
@ -24,18 +23,9 @@ jobs:
|
||||
run: |
|
||||
git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
|
||||
- name: Update to modern GCC
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y gcc-12 g++-12
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100
|
||||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100
|
||||
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
# If you change this version, change the numbers in the image configuration step,
|
||||
# .github/workflows/preview-build.yml (2x) and os/emscripten/Dockerfile too.
|
||||
path: /emsdk/upstream/emscripten/cache
|
||||
key: 3.1.57-${{ runner.os }}
|
||||
|
||||
|
22
.github/workflows/ci-nightly.yml
vendored
@ -9,6 +9,27 @@ env:
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: GCC - SDL1.2
|
||||
compiler: gcc
|
||||
cxxcompiler: g++
|
||||
libraries: libsdl1.2-dev
|
||||
|
||||
name: Linux (${{ matrix.name }})
|
||||
|
||||
uses: ./.github/workflows/ci-linux.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
compiler: ${{ matrix.compiler }}
|
||||
cxxcompiler: ${{ matrix.cxxcompiler }}
|
||||
libraries: ${{ matrix.libraries }}
|
||||
extra-cmake-parameters:
|
||||
|
||||
macos:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@ -48,6 +69,7 @@ jobs:
|
||||
check_annotations:
|
||||
name: Check Annotations
|
||||
needs:
|
||||
- linux
|
||||
- macos
|
||||
- mingw
|
||||
|
||||
|
1
.github/workflows/codeql.yml
vendored
@ -87,7 +87,6 @@ jobs:
|
||||
with:
|
||||
languages: cpp
|
||||
config-file: ./.github/codeql/codeql-config.yml
|
||||
trap-caching: false
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
|
12
.github/workflows/preview-build.yml
vendored
@ -20,8 +20,7 @@ jobs:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
# If you change this version, change the numbers in the cache step,
|
||||
# .github/workflows/ci-emscripten.yml (2x) and os/emscripten/Dockerfile too.
|
||||
# If you change this version, change the number in the cache step too.
|
||||
image: emscripten/emsdk:3.1.57
|
||||
|
||||
steps:
|
||||
@ -35,19 +34,10 @@ jobs:
|
||||
git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
git checkout -b pr${{ github.event.pull_request.number }}
|
||||
|
||||
- name: Update to modern GCC
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y gcc-12 g++-12
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100
|
||||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100
|
||||
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /emsdk/upstream/emscripten/cache
|
||||
# If you change this version, change the numbers in the image configuration step,
|
||||
# .github/workflows/ci-emscripten.yml (2x) and os/emscripten/Dockerfile too.
|
||||
key: 3.1.57-${{ runner.os }}
|
||||
|
||||
- name: Add liblzma support
|
||||
|
19
.github/workflows/rebase-checker.yml
vendored
@ -1,19 +0,0 @@
|
||||
name: "Update 'work: needs rebase' label status"
|
||||
on:
|
||||
# So that PRs touching the same files as the push are updated
|
||||
push:
|
||||
# So that the `dirtyLabel` is removed if conflicts are resolve
|
||||
# We recommend `pull_request_target` so that github secrets are available.
|
||||
# In `pull_request` we wouldn't be able to change labels of fork PRs
|
||||
pull_request_target:
|
||||
types: [synchronize]
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check if prs are in need of a rebase
|
||||
uses: eps1lon/actions-label-merge-conflict@v3
|
||||
with:
|
||||
dirtyLabel: "work: needs rebase"
|
||||
repoToken: "${{ secrets.GITHUB_TOKEN }}"
|
6
.github/workflows/release-linux.yml
vendored
@ -71,10 +71,10 @@ jobs:
|
||||
# dependencies as possible. We do it before anything else is installed,
|
||||
# to make sure it doesn't pick up on any of the drivers.
|
||||
echo "::group::Install fluidsynth"
|
||||
wget https://github.com/FluidSynth/fluidsynth/archive/v2.4.4.tar.gz
|
||||
tar xf v2.4.4.tar.gz
|
||||
wget https://github.com/FluidSynth/fluidsynth/archive/v2.3.3.tar.gz
|
||||
tar xf v2.3.3.tar.gz
|
||||
(
|
||||
cd fluidsynth-2.4.4
|
||||
cd fluidsynth-2.3.3
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
|
||||
|
2
.github/workflows/release-macos.yml
vendored
@ -86,7 +86,7 @@ jobs:
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Import code signing certificates
|
||||
uses: Apple-Actions/import-codesign-certs@v5
|
||||
uses: Apple-Actions/import-codesign-certs@v3
|
||||
with:
|
||||
# The certificates in a PKCS12 file encoded as a base64 string
|
||||
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
|
||||
|
11
.github/workflows/release-source.yml
vendored
@ -90,10 +90,10 @@ jobs:
|
||||
|
||||
- name: Generate metadata
|
||||
id: metadata
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::Prepare metadata files"
|
||||
cmake -DGENERATE_OTTDREV=1 -P cmake/scripts/FindVersion.cmake
|
||||
./.github/changelog.sh > .changelog
|
||||
TZ='UTC' date +"%Y-%m-%d %H:%M UTC" > .release_date
|
||||
cat .ottdrev | cut -f 1 -d$'\t' > .version
|
||||
|
||||
@ -103,8 +103,6 @@ jobs:
|
||||
|
||||
FOLDER="${{ env.FOLDER_RELEASES }}"
|
||||
TRIGGER_TYPE="new-tag"
|
||||
|
||||
python3 ./.github/changelog.py "$(cat .version)" > .changelog
|
||||
else
|
||||
IS_TAG="false"
|
||||
|
||||
@ -126,13 +124,6 @@ jobs:
|
||||
FOLDER="${{ env.FOLDER_BRANCHES }}/${BRANCH}"
|
||||
TRIGGER_TYPE="new-branch"
|
||||
fi
|
||||
|
||||
# For nightlies / branches, use the git log of the last 7 days as changelog.
|
||||
revdate=$(git log -1 --pretty=format:"%ci")
|
||||
last_week=$(date -d "$revdate -7days" +"%Y-%m-%d %H:%M")
|
||||
echo "## Version $(cat .version) - changes since ${last_week}" > .changelog
|
||||
echo "" >> .changelog
|
||||
git log --oneline --after="${last_week}" >> .changelog
|
||||
fi
|
||||
|
||||
mkdir -p build/bundles
|
||||
|
5
.github/workflows/upload-gog.yml
vendored
@ -62,10 +62,9 @@ jobs:
|
||||
|
||||
echo "::group::Unpack OpenGFX"
|
||||
unzip opengfx-all.zip
|
||||
tar xf opengfx-*.tar
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f opengfx-all.zip opengfx-*.tar
|
||||
rm -f opengfx-all.zip
|
||||
|
||||
- name: Install OpenMSX
|
||||
shell: bash
|
||||
@ -77,7 +76,7 @@ jobs:
|
||||
curl -L https://cdn.openttd.org/openmsx-releases/0.4.2/openmsx-0.4.2-all.zip -o openmsx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Unpack OpenMSX"
|
||||
echo "::group::Unpack OpenGFX"
|
||||
unzip openmsx-all.zip
|
||||
tar xf openmsx-*.tar
|
||||
echo "::endgroup::"
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
if(NOT BINARY_NAME)
|
||||
set(BINARY_NAME openttd)
|
||||
@ -51,6 +51,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS YES)
|
||||
# An empty target for the tools
|
||||
add_custom_target(tools)
|
||||
|
||||
include(Endian)
|
||||
add_endian_definition()
|
||||
|
||||
include(CompileFlags)
|
||||
compile_flags()
|
||||
|
||||
@ -132,17 +135,18 @@ endif()
|
||||
|
||||
# Breakpad doesn't support emscripten.
|
||||
if(NOT EMSCRIPTEN)
|
||||
find_package(unofficial-breakpad NO_MODULE)
|
||||
find_package(unofficial-breakpad)
|
||||
endif()
|
||||
|
||||
if(NOT OPTION_DEDICATED)
|
||||
if(WIN32)
|
||||
find_package(Xaudio2)
|
||||
else()
|
||||
if(NOT WIN32)
|
||||
find_package(Allegro)
|
||||
if(NOT APPLE)
|
||||
find_package(Freetype)
|
||||
find_package(SDL2)
|
||||
if(NOT SDL2_FOUND)
|
||||
find_package(SDL)
|
||||
endif()
|
||||
find_package(Fluidsynth)
|
||||
if(Freetype_FOUND)
|
||||
find_package(Fontconfig)
|
||||
@ -173,6 +177,7 @@ if(MSVC)
|
||||
endif()
|
||||
|
||||
find_package(SSE)
|
||||
find_package(Xaudio2)
|
||||
|
||||
find_package(Grfcodec)
|
||||
|
||||
@ -182,8 +187,8 @@ check_ipo_supported(RESULT IPO_FOUND)
|
||||
show_options()
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT OPTION_DEDICATED)
|
||||
if(NOT SDL2_FOUND AND NOT ALLEGRO_FOUND)
|
||||
message(FATAL_ERROR "SDL2 or Allegro is required for this platform")
|
||||
if(NOT SDL_FOUND AND NOT SDL2_FOUND AND NOT ALLEGRO_FOUND)
|
||||
message(FATAL_ERROR "SDL, SDL2 or Allegro is required for this platform")
|
||||
endif()
|
||||
if(HARFBUZZ_FOUND AND NOT ICU_i18n_FOUND)
|
||||
message(WARNING "HarfBuzz depends on ICU i18n to function; HarfBuzz will be disabled")
|
||||
@ -231,6 +236,8 @@ endif()
|
||||
include(CTest)
|
||||
include(SourceList)
|
||||
|
||||
# Needed by rev.cpp
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src)
|
||||
# Needed by everything that uses Squirrel
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src/3rdparty/squirrel/include)
|
||||
|
||||
@ -260,7 +267,6 @@ target_precompile_headers(openttd_lib
|
||||
src/stdafx.h
|
||||
src/core/format.hpp
|
||||
)
|
||||
set_source_files_properties(src/3rdparty/fmt/format.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
||||
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/bin)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/src)
|
||||
@ -300,6 +306,7 @@ if(IPO_FOUND)
|
||||
set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO True)
|
||||
endif()
|
||||
set_target_properties(openttd PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
process_compile_flags()
|
||||
|
||||
include(LinkPackage)
|
||||
link_package(PNG TARGET PNG::PNG ENCOURAGED)
|
||||
@ -313,11 +320,12 @@ if(NOT WIN32 AND NOT EMSCRIPTEN)
|
||||
endif()
|
||||
|
||||
if(NOT EMSCRIPTEN)
|
||||
link_package(unofficial-breakpad TARGET unofficial::breakpad::libbreakpad_client)
|
||||
link_package(unofficial-breakpad TARGET unofficial::breakpad::libbreakpad_client ENCOURAGED)
|
||||
endif()
|
||||
|
||||
if(NOT OPTION_DEDICATED)
|
||||
link_package(Fluidsynth)
|
||||
link_package(SDL)
|
||||
link_package(SDL2 TARGET SDL2::SDL2)
|
||||
link_package(Allegro)
|
||||
link_package(FREETYPE TARGET Freetype::Freetype)
|
||||
@ -390,7 +398,6 @@ if(EMSCRIPTEN)
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/desync.md@/docs/desync.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/directory_structure.md@/docs/directory_structure.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/eints.md@/docs/eints.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/fonts.md@/docs/fonts.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/linkgraph.md@/docs/linkgraph.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/logging_and_performance_metrics.md@/docs/logging_and_performance_metrics.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/multiplayer.md@/docs/multiplayer.md")
|
||||
|
@ -10,8 +10,6 @@ What is simple to some might appear very complicated to others. Documentation he
|
||||
* Function names use [CamelCase](http://www.wikipedia.org/wiki/Camelcase) without underscores.
|
||||
* Opening curly bracket **{** for a function starts on the next line.
|
||||
* Use Foo() instead of Foo(void).
|
||||
* Prefer using "const" for reference and compound parameters when appropriate.
|
||||
* If a member function can be a const function, make it so.
|
||||
```c++
|
||||
void ThisIsAFunction()
|
||||
{
|
||||
@ -294,6 +292,7 @@ OpenTTD used to vertically-align inline Doxygen comments as shown above. OpenTTD
|
||||
* Put a space before and after binary operators: "a + b", "a == b", "a & b", "a <<= b", etc.. Exceptions are ".", "->" and "[]" (no spaces) and "," (just space after it).
|
||||
* Put parenthesis where it improves readability: "*(b++)" instead of "*b++", and "if ((a & b) && c == 2)" instead of "if (a & b && c == 2)".
|
||||
* Do not put external declarations in implementation (i.e. cpp) files.
|
||||
* Use const where possible.
|
||||
* Do not typedef enums and structs.
|
||||
* Don't treat non-flags as flags: use "if (char_pointer != nullptr && *char_pointer != '\0')", not "if (char_pointer && *char_pointer)".
|
||||
* Use "free(p)" instead of "if (p != nullptr) free(p)". "free(nullptr)" doesn't hurt anyone.
|
||||
|
@ -12,7 +12,6 @@
|
||||
- Remko Bijker (Rubidium) - Coder and way more (since 0.4.5)
|
||||
- Patric Stout (TrueBrain) - NoProgrammer (since 0.3), sys op
|
||||
- Tyler Trahan (2TallTyler) - General / Time Lord (since 13)
|
||||
- Richard Wheeler (zephyris) - Precision pixel production (since 15)
|
||||
|
||||
### Inactive Developers:
|
||||
|
||||
|
@ -310,7 +310,7 @@ INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED = WITH_ZLIB \
|
||||
WITH_LZO \
|
||||
WITH_LIBLZMA \
|
||||
WITH_SDL2 \
|
||||
WITH_SDL \
|
||||
WITH_PNG \
|
||||
WITH_FONTCONFIG \
|
||||
WITH_FREETYPE \
|
||||
|
16
README.md
@ -37,10 +37,12 @@ Both 'stable' and 'nightly' versions are available for download:
|
||||
|
||||
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
|
||||
|
||||
OpenTTD has a [community-maintained wiki](https://wiki.openttd.org/), including a gameplay manual and tips.
|
||||
|
||||
|
||||
## 1.3) Supported platforms
|
||||
|
||||
OpenTTD has been ported to several platforms and operating systems.
|
||||
@ -54,7 +56,6 @@ The currently supported platforms are:
|
||||
Other platforms may also work (in particular various BSD systems), but we don't actively test or maintain these.
|
||||
|
||||
### 1.3.1) Legacy support
|
||||
|
||||
Platforms, languages and compilers change.
|
||||
We'll keep support going on old platforms as long as someone is interested in supporting them, except where it means the project can't move forward to keep up with language and compiler features.
|
||||
|
||||
@ -71,6 +72,7 @@ For some platforms these will be downloaded during the installation process if r
|
||||
|
||||
For some platforms, you will need to refer to [the installation guide](https://wiki.openttd.org/en/Manual/Installation).
|
||||
|
||||
|
||||
### 1.4.1) Free graphics and sound files
|
||||
|
||||
The free data files, split into OpenGFX for graphics, OpenSFX for sounds and
|
||||
@ -83,6 +85,7 @@ OpenMSX for music can be found at:
|
||||
Please follow the readme of these packages about the installation procedure.
|
||||
The Windows installer can optionally download and install these packages.
|
||||
|
||||
|
||||
### 1.4.2) Original Transport Tycoon Deluxe graphics and sound files
|
||||
|
||||
If you want to play with the original Transport Tycoon Deluxe data files you have to copy the data files from the CD-ROM into the baseset/ directory.
|
||||
@ -97,6 +100,7 @@ You need to copy the following files:
|
||||
- trgir.grf or TRGI.GRF
|
||||
- trgtr.grf or TRGT.GRF
|
||||
|
||||
|
||||
### 1.4.3) Original Transport Tycoon Deluxe music
|
||||
|
||||
If you want the Transport Tycoon Deluxe music, copy the appropriate files from the original game into the baseset folder.
|
||||
@ -104,6 +108,7 @@ If you want the Transport Tycoon Deluxe music, copy the appropriate files from t
|
||||
- TTD for DOS: The GM.CAT file
|
||||
- Transport Tycoon Original: The GM.CAT file, but rename it to GM-TTO.CAT
|
||||
|
||||
|
||||
## 1.5) Add-on content / mods
|
||||
|
||||
OpenTTD features multiple types of add-on content, which modify gameplay in different ways.
|
||||
@ -112,6 +117,7 @@ Most types of add-on content can be downloaded within OpenTTD via the 'Check Onl
|
||||
|
||||
Add-on content can also be installed manually, but that's more complicated; the [OpenTTD wiki](https://wiki.openttd.org/) may offer help with that, or the [OpenTTD directory structure guide](./docs/directory_structure.md).
|
||||
|
||||
|
||||
### 1.5.1) Social Integration
|
||||
|
||||
OpenTTD has the ability to load plugins to integrate with Social Platforms like Steam, Discord, etc.
|
||||
@ -120,6 +126,7 @@ To enable such integration, the plugin for the specific platform has to be downl
|
||||
|
||||
See [OpenTTD's website](https://www.openttd.org), under Downloads, for what plugins are available.
|
||||
|
||||
|
||||
### 1.6) OpenTTD directories
|
||||
|
||||
OpenTTD uses its own directory structure to store game data, add-on content etc.
|
||||
@ -130,6 +137,7 @@ For more information, see the [directory structure guide](./docs/directory_struc
|
||||
|
||||
If you want to compile OpenTTD from source, instructions can be found in [COMPILING.md](./COMPILING.md).
|
||||
|
||||
|
||||
## 2.0) Contact and Community
|
||||
|
||||
'Official' channels
|
||||
@ -152,10 +160,12 @@ You can play OpenTTD with others, either cooperatively or competitively.
|
||||
|
||||
See the [multiplayer documentation](./docs/multiplayer.md) for more details.
|
||||
|
||||
|
||||
### 2.2) Contributing to OpenTTD
|
||||
|
||||
We welcome contributors to OpenTTD. More information for contributors can be found in [CONTRIBUTING.md](./CONTRIBUTING.md)
|
||||
|
||||
|
||||
### 2.3) Reporting bugs
|
||||
|
||||
Good bug reports are very helpful. We have a [guide to reporting bugs](./CONTRIBUTING.md#bug-reports) to help with this.
|
||||
@ -163,10 +173,12 @@ Good bug reports are very helpful. We have a [guide to reporting bugs](./CONTRI
|
||||
Desyncs in multiplayer are complex to debug and report (some software development skils are required).
|
||||
Instructions can be found in [debugging and reporting desyncs](./docs/debugging_desyncs.md).
|
||||
|
||||
|
||||
### 2.4) Translating
|
||||
|
||||
OpenTTD is translated into many languages. Translations are added and updated via the [online translation tool](https://translator.openttd.org).
|
||||
|
||||
|
||||
## 3.0) Licensing
|
||||
|
||||
OpenTTD is licensed under the GNU General Public License version 2.0.
|
||||
@ -203,6 +215,6 @@ See `src/3rdparty/openttd_social_integration_api/LICENSE` for the complete licen
|
||||
The atomic datatype support detection in `cmake/3rdparty/llvm/CheckAtomic.cmake` is licensed under the Apache 2.0 license.
|
||||
See `cmake/3rdparty/llvm/LICENSE.txt` for the complete license text.
|
||||
|
||||
## 4.0) Credits
|
||||
## 4.0 Credits
|
||||
|
||||
See [CREDITS.md](./CREDITS.md)
|
||||
|
@ -15,6 +15,7 @@ set(AI_COMPAT_SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_12.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_13.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_14.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_15.nut
|
||||
)
|
||||
|
||||
foreach(AI_COMPAT_SOURCE_FILE IN LISTS AI_COMPAT_SOURCE_FILES)
|
||||
|
@ -5,8 +5,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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.0 to 0.7. */
|
||||
|
||||
AILog.Info("0.7 API compatibility in effect:");
|
||||
AILog.Info(" - AITown::GetLastMonthProduction's behaviour has slightly changed.");
|
||||
AILog.Info(" - AISubsidy::GetDestination returns STATION_INVALID for awarded subsidies.");
|
||||
AILog.Info(" - AISubsidy::GetSource returns STATION_INVALID for awarded subsidies.");
|
||||
@ -96,158 +95,158 @@ AIEngine.IsValidEngine <- function(engine_id)
|
||||
return AIEngine.IsBuildable(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetNameCompat0_7 <- AIEngine.GetName;
|
||||
AIEngine._GetName <- AIEngine.GetName;
|
||||
AIEngine.GetName <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return null;
|
||||
return AIEngine.GetNameCompat0_7(engine_id);
|
||||
return AIEngine._GetName(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetCargoTypeCompat0_7 <- AIEngine.GetCargoType;
|
||||
AIEngine._GetCargoType <- AIEngine.GetCargoType;
|
||||
AIEngine.GetCargoType <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return 255;
|
||||
return AIEngine.GetCargoTypeCompat0_7(engine_id);
|
||||
return AIEngine._GetCargoType(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.CanRefitCargoCompat0_7 <- AIEngine.CanRefitCargo;
|
||||
AIEngine._CanRefitCargo <- AIEngine.CanRefitCargo;
|
||||
AIEngine.CanRefitCargo <- function(engine_id, cargo_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.CanRefitCargoCompat0_7(engine_id, cargo_id);
|
||||
return AIEngine._CanRefitCargo(engine_id, cargo_id);
|
||||
}
|
||||
|
||||
AIEngine.CanPullCargoCompat0_7 <- AIEngine.CanPullCargo;
|
||||
AIEngine._CanPullCargo <- AIEngine.CanPullCargo;
|
||||
AIEngine.CanPullCargo <- function(engine_id, cargo_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.CanPullCargoCompat0_7(engine_id, cargo_id);
|
||||
return AIEngine._CanPullCargo(engine_id, cargo_id);
|
||||
}
|
||||
|
||||
AIEngine.GetCapacityCompat0_7 <- AIEngine.GetCapacity;
|
||||
AIEngine._GetCapacity <- AIEngine.GetCapacity;
|
||||
AIEngine.GetCapacity <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetCapacityCompat0_7(engine_id);
|
||||
return AIEngine._GetCapacity(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetReliabilityCompat0_7 <- AIEngine.GetReliability;
|
||||
AIEngine._GetReliability <- AIEngine.GetReliability;
|
||||
AIEngine.GetReliability <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetReliabilityCompat0_7(engine_id);
|
||||
return AIEngine._GetReliability(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetMaxSpeedCompat0_7 <- AIEngine.GetMaxSpeed;
|
||||
AIEngine._GetMaxSpeed <- AIEngine.GetMaxSpeed;
|
||||
AIEngine.GetMaxSpeed <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetMaxSpeedCompat0_7(engine_id);
|
||||
return AIEngine._GetMaxSpeed(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetPriceCompat0_7 <- AIEngine.GetPrice;
|
||||
AIEngine._GetPrice <- AIEngine.GetPrice;
|
||||
AIEngine.GetPrice <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetPriceCompat0_7(engine_id);
|
||||
return AIEngine._GetPrice(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetMaxAgeCompat0_7 <- AIEngine.GetMaxAge;
|
||||
AIEngine._GetMaxAge <- AIEngine.GetMaxAge;
|
||||
AIEngine.GetMaxAge <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetMaxAgeCompat0_7(engine_id);
|
||||
return AIEngine._GetMaxAge(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetRunningCostCompat0_7 <- AIEngine.GetRunningCost;
|
||||
AIEngine._GetRunningCost <- AIEngine.GetRunningCost;
|
||||
AIEngine.GetRunningCost <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetRunningCostCompat0_7(engine_id);
|
||||
return AIEngine._GetRunningCost(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetPowerCompat0_7 <- AIEngine.GetPower;
|
||||
AIEngine._GetPower <- AIEngine.GetPower;
|
||||
AIEngine.GetPower <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetPowerCompat0_7(engine_id);
|
||||
return AIEngine._GetPower(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetWeightCompat0_7 <- AIEngine.GetWeight;
|
||||
AIEngine._GetWeight <- AIEngine.GetWeight;
|
||||
AIEngine.GetWeight <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetWeightCompat0_7(engine_id);
|
||||
return AIEngine._GetWeight(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetMaxTractiveEffortCompat0_7 <- AIEngine.GetMaxTractiveEffort;
|
||||
AIEngine._GetMaxTractiveEffort <- AIEngine.GetMaxTractiveEffort;
|
||||
AIEngine.GetMaxTractiveEffort <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetMaxTractiveEffortCompat0_7(engine_id);
|
||||
return AIEngine._GetMaxTractiveEffort(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetDesignDateCompat0_7 <- AIEngine.GetDesignDate;
|
||||
AIEngine._GetDesignDate <- AIEngine.GetDesignDate;
|
||||
AIEngine.GetDesignDate <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetDesignDateCompat0_7(engine_id);
|
||||
return AIEngine._GetDesignDate(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetVehicleTypeCompat0_7 <- AIEngine.GetVehicleType;
|
||||
AIEngine._GetVehicleType <- AIEngine.GetVehicleType;
|
||||
AIEngine.GetVehicleType <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return AIVehicle.VT_INVALID;
|
||||
return AIEngine.GetVehicleTypeCompat0_7(engine_id);
|
||||
return AIEngine._GetVehicleType(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.IsWagonCompat0_7 <- AIEngine.IsWagon;
|
||||
AIEngine._IsWagon <- AIEngine.IsWagon;
|
||||
AIEngine.IsWagon <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.IsWagonCompat0_7(engine_id);
|
||||
return AIEngine._IsWagon(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.CanRunOnRailCompat0_7 <- AIEngine.CanRunOnRail;
|
||||
AIEngine._CanRunOnRail <- AIEngine.CanRunOnRail;
|
||||
AIEngine.CanRunOnRail <- function(engine_id, track_rail_type)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.CanRunOnRailCompat0_7(engine_id, track_rail_type);
|
||||
return AIEngine._CanRunOnRail(engine_id, track_rail_type);
|
||||
}
|
||||
|
||||
AIEngine.HasPowerOnRailCompat0_7 <- AIEngine.HasPowerOnRail;
|
||||
AIEngine._HasPowerOnRail <- AIEngine.HasPowerOnRail;
|
||||
AIEngine.HasPowerOnRail <- function(engine_id, track_rail_type)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.HasPowerOnRailCompat0_7(engine_id, track_rail_type);
|
||||
return AIEngine._HasPowerOnRail(engine_id, track_rail_type);
|
||||
}
|
||||
|
||||
AIEngine.GetRoadTypeCompat0_7 <- AIEngine.GetRoadType;
|
||||
AIEngine._GetRoadType <- AIEngine.GetRoadType;
|
||||
AIEngine.GetRoadType <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return AIRoad.ROADTYPE_INVALID;
|
||||
return AIEngine.GetRoadTypeCompat0_7(engine_id);
|
||||
return AIEngine._GetRoadType(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetRailTypeCompat0_7 <- AIEngine.GetRailType;
|
||||
AIEngine._GetRailType <- AIEngine.GetRailType;
|
||||
AIEngine.GetRailType <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return AIRail.RAILTYPE_INVALID;
|
||||
return AIEngine.GetRailTypeCompat0_7(engine_id);
|
||||
return AIEngine._GetRailType(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.IsArticulatedCompat0_7 <- AIEngine.IsArticulated;
|
||||
AIEngine._IsArticulated <- AIEngine.IsArticulated;
|
||||
AIEngine.IsArticulated <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.IsArticulatedCompat0_7(engine_id);
|
||||
return AIEngine._IsArticulated(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetPlaneTypeCompat0_7 <- AIEngine.GetPlaneType;
|
||||
AIEngine._GetPlaneType <- AIEngine.GetPlaneType;
|
||||
AIEngine.GetPlaneType <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetPlaneTypeCompat0_7(engine_id);
|
||||
return AIEngine._GetPlaneType(engine_id);
|
||||
}
|
||||
|
||||
_AIWaypointList <- AIWaypointList;
|
||||
@ -257,3 +256,139 @@ class AIWaypointList extends _AIWaypointList {
|
||||
::_AIWaypointList.constructor(AIWaypoint.WAYPOINT_RAIL);
|
||||
}
|
||||
}
|
||||
|
||||
AIRoad._BuildRoadStation <- AIRoad.BuildRoadStation;
|
||||
AIRoad.BuildRoadStation <- function(tile, front, road_veh_type, station_id)
|
||||
{
|
||||
if (AIRoad.IsRoadStationTile(tile) && AICompany.IsMine(AITile.GetOwner(tile))) return false;
|
||||
|
||||
return AIRoad._BuildRoadStation(tile, front, road_veh_type, station_id);
|
||||
}
|
||||
|
||||
AIRoad._BuildDriveThroughRoadStation <- AIRoad.BuildDriveThroughRoadStation;
|
||||
AIRoad.BuildDriveThroughRoadStation <- function(tile, front, road_veh_type, station_id)
|
||||
{
|
||||
if (AIRoad.IsRoadStationTile(tile) && AICompany.IsMine(AITile.GetOwner(tile))) return false;
|
||||
|
||||
return AIRoad._BuildDriveThroughRoadStation(tile, front, road_veh_type, station_id);
|
||||
}
|
||||
|
||||
AIBridgeList.HasNext <-
|
||||
AIBridgeList_Length.HasNext <-
|
||||
AICargoList.HasNext <-
|
||||
AICargoList_IndustryAccepting.HasNext <-
|
||||
AICargoList_IndustryProducing.HasNext <-
|
||||
AIDepotList.HasNext <-
|
||||
AIEngineList.HasNext <-
|
||||
AIGroupList.HasNext <-
|
||||
AIIndustryList.HasNext <-
|
||||
AIIndustryList_CargoAccepting.HasNext <-
|
||||
AIIndustryList_CargoProducing.HasNext <-
|
||||
AIIndustryTypeList.HasNext <-
|
||||
AIList.HasNext <-
|
||||
AIRailTypeList.HasNext <-
|
||||
AISignList.HasNext <-
|
||||
AIStationList.HasNext <-
|
||||
AIStationList_Vehicle.HasNext <-
|
||||
AISubsidyList.HasNext <-
|
||||
AITileList.HasNext <-
|
||||
AITileList_IndustryAccepting.HasNext <-
|
||||
AITileList_IndustryProducing.HasNext <-
|
||||
AITileList_StationType.HasNext <-
|
||||
AITownList.HasNext <-
|
||||
AIVehicleList.HasNext <-
|
||||
AIVehicleList_DefaultGroup.HasNext <-
|
||||
AIVehicleList_Group.HasNext <-
|
||||
AIVehicleList_SharedOrders.HasNext <-
|
||||
AIVehicleList_Station.HasNext <-
|
||||
AIWaypointList.HasNext <-
|
||||
AIWaypointList_Vehicle.HasNext <-
|
||||
function()
|
||||
{
|
||||
return !this.IsEnd();
|
||||
}
|
||||
|
||||
AIIndustry._IsCargoAccepted <- AIIndustry.IsCargoAccepted;
|
||||
AIIndustry.IsCargoAccepted <- function(industry_id, cargo_id)
|
||||
{
|
||||
return AIIndustry._IsCargoAccepted(industry_id, cargo_id) != AIIndustry.CAS_NOT_ACCEPTED;
|
||||
}
|
||||
|
||||
AIAbstractList <- AIList;
|
||||
|
||||
AIList.ChangeItem <- AIList.SetValue;
|
||||
|
||||
AIRail.ERR_NONUNIFORM_STATIONS_DISABLED <- 0xFFFF;
|
||||
|
||||
AICompany.GetCompanyValue <- function(company)
|
||||
{
|
||||
return AICompany.GetQuarterlyCompanyValue(company, AICompany.CURRENT_QUARTER);
|
||||
}
|
||||
|
||||
AITown.GetLastMonthTransported <- AITown.GetLastMonthSupplied;
|
||||
|
||||
AIEvent.AI_ET_INVALID <- AIEvent.ET_INVALID;
|
||||
AIEvent.AI_ET_TEST <- AIEvent.ET_TEST;
|
||||
AIEvent.AI_ET_SUBSIDY_OFFER <- AIEvent.ET_SUBSIDY_OFFER;
|
||||
AIEvent.AI_ET_SUBSIDY_OFFER_EXPIRED <- AIEvent.ET_SUBSIDY_OFFER_EXPIRED;
|
||||
AIEvent.AI_ET_SUBSIDY_AWARDED <- AIEvent.ET_SUBSIDY_AWARDED;
|
||||
AIEvent.AI_ET_SUBSIDY_EXPIRED <- AIEvent.ET_SUBSIDY_EXPIRED;
|
||||
AIEvent.AI_ET_ENGINE_PREVIEW <- AIEvent.ET_ENGINE_PREVIEW;
|
||||
AIEvent.AI_ET_COMPANY_NEW <- AIEvent.ET_COMPANY_NEW;
|
||||
AIEvent.AI_ET_COMPANY_IN_TROUBLE <- AIEvent.ET_COMPANY_IN_TROUBLE;
|
||||
AIEvent.AI_ET_COMPANY_MERGER <- AIEvent.ET_COMPANY_MERGER;
|
||||
AIEvent.AI_ET_COMPANY_BANKRUPT <- AIEvent.ET_COMPANY_BANKRUPT;
|
||||
AIEvent.AI_ET_VEHICLE_CRASHED <- AIEvent.ET_VEHICLE_CRASHED;
|
||||
AIEvent.AI_ET_VEHICLE_LOST <- AIEvent.ET_VEHICLE_LOST;
|
||||
AIEvent.AI_ET_VEHICLE_WAITING_IN_DEPOT <- AIEvent.ET_VEHICLE_WAITING_IN_DEPOT;
|
||||
AIEvent.AI_ET_VEHICLE_UNPROFITABLE <- AIEvent.ET_VEHICLE_UNPROFITABLE;
|
||||
AIEvent.AI_ET_INDUSTRY_OPEN <- AIEvent.ET_INDUSTRY_OPEN;
|
||||
AIEvent.AI_ET_INDUSTRY_CLOSE <- AIEvent.ET_INDUSTRY_CLOSE;
|
||||
AIEvent.AI_ET_ENGINE_AVAILABLE <- AIEvent.ET_ENGINE_AVAILABLE;
|
||||
AIEvent.AI_ET_STATION_FIRST_VEHICLE <- AIEvent.ET_STATION_FIRST_VEHICLE;
|
||||
AIEvent.AI_ET_DISASTER_ZEPPELINER_CRASHED <- AIEvent.ET_DISASTER_ZEPPELINER_CRASHED;
|
||||
AIEvent.AI_ET_DISASTER_ZEPPELINER_CLEARED <- AIEvent.ET_DISASTER_ZEPPELINER_CLEARED;
|
||||
AIOrder.AIOF_NONE <- AIOrder.OF_NONE
|
||||
AIOrder.AIOF_NON_STOP_INTERMEDIATE <- AIOrder.OF_NON_STOP_INTERMEDIATE
|
||||
AIOrder.AIOF_NON_STOP_DESTINATION <- AIOrder.OF_NON_STOP_DESTINATION
|
||||
AIOrder.AIOF_UNLOAD <- AIOrder.OF_UNLOAD
|
||||
AIOrder.AIOF_TRANSFER <- AIOrder.OF_TRANSFER
|
||||
AIOrder.AIOF_NO_UNLOAD <- AIOrder.OF_NO_UNLOAD
|
||||
AIOrder.AIOF_FULL_LOAD <- AIOrder.OF_FULL_LOAD
|
||||
AIOrder.AIOF_FULL_LOAD_ANY <- AIOrder.OF_FULL_LOAD_ANY
|
||||
AIOrder.AIOF_NO_LOAD <- AIOrder.OF_NO_LOAD
|
||||
AIOrder.AIOF_SERVICE_IF_NEEDED <- AIOrder.OF_SERVICE_IF_NEEDED
|
||||
AIOrder.AIOF_STOP_IN_DEPOT <- AIOrder.OF_STOP_IN_DEPOT
|
||||
AIOrder.AIOF_GOTO_NEAREST_DEPOT <- AIOrder.OF_GOTO_NEAREST_DEPOT
|
||||
AIOrder.AIOF_NON_STOP_FLAGS <- AIOrder.OF_NON_STOP_FLAGS
|
||||
AIOrder.AIOF_UNLOAD_FLAGS <- AIOrder.OF_UNLOAD_FLAGS
|
||||
AIOrder.AIOF_LOAD_FLAGS <- AIOrder.OF_LOAD_FLAGS
|
||||
AIOrder.AIOF_DEPOT_FLAGS <- AIOrder.OF_DEPOT_FLAGS
|
||||
AIOrder.AIOF_INVALID <- AIOrder.OF_INVALID
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
AIBridge._GetName <- AIBridge.GetName;
|
||||
AIBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.9 adds parent_group_id to CreateGroup function */
|
||||
AIGroup._CreateGroup <- AIGroup.CreateGroup;
|
||||
AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,22 +5,22 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.1 to 1.0. */
|
||||
AILog.Info("1.0 API compatibility in effect.");
|
||||
|
||||
AIRoad.BuildRoadStationCompat1_0 <- AIRoad.BuildRoadStation;
|
||||
AIRoad._BuildRoadStation <- AIRoad.BuildRoadStation;
|
||||
AIRoad.BuildRoadStation <- function(tile, front, road_veh_type, station_id)
|
||||
{
|
||||
if (AIRoad.IsRoadStationTile(tile) && AICompany.IsMine(AITile.GetOwner(tile))) return false;
|
||||
|
||||
return AIRoad.BuildRoadStationCompat1_0(tile, front, road_veh_type, station_id);
|
||||
return AIRoad._BuildRoadStation(tile, front, road_veh_type, station_id);
|
||||
}
|
||||
|
||||
AIRoad.BuildDriveThroughRoadStationCompat1_0 <- AIRoad.BuildDriveThroughRoadStation;
|
||||
AIRoad._BuildDriveThroughRoadStation <- AIRoad.BuildDriveThroughRoadStation;
|
||||
AIRoad.BuildDriveThroughRoadStation <- function(tile, front, road_veh_type, station_id)
|
||||
{
|
||||
if (AIRoad.IsRoadStationTile(tile) && AICompany.IsMine(AITile.GetOwner(tile))) return false;
|
||||
|
||||
return AIRoad.BuildDriveThroughRoadStationCompat1_0(tile, front, road_veh_type, station_id);
|
||||
return AIRoad._BuildDriveThroughRoadStation(tile, front, road_veh_type, station_id);
|
||||
}
|
||||
|
||||
AIBridgeList.HasNext <-
|
||||
@ -59,10 +59,10 @@ function()
|
||||
return !this.IsEnd();
|
||||
}
|
||||
|
||||
AIIndustry.IsCargoAcceptedCompat1_0 <- AIIndustry.IsCargoAccepted;
|
||||
AIIndustry._IsCargoAccepted <- AIIndustry.IsCargoAccepted;
|
||||
AIIndustry.IsCargoAccepted <- function(industry_id, cargo_id)
|
||||
{
|
||||
return AIIndustry.IsCargoAcceptedCompat1_0(industry_id, cargo_id) != AIIndustry.CAS_NOT_ACCEPTED;
|
||||
return AIIndustry._IsCargoAccepted(industry_id, cargo_id) != AIIndustry.CAS_NOT_ACCEPTED;
|
||||
}
|
||||
|
||||
AIAbstractList <- AIList;
|
||||
@ -70,3 +70,77 @@ AIAbstractList <- AIList;
|
||||
AIList.ChangeItem <- AIList.SetValue;
|
||||
|
||||
AIRail.ERR_NONUNIFORM_STATIONS_DISABLED <- 0xFFFF;
|
||||
|
||||
AICompany.GetCompanyValue <- function(company)
|
||||
{
|
||||
return AICompany.GetQuarterlyCompanyValue(company, AICompany.CURRENT_QUARTER);
|
||||
}
|
||||
|
||||
AITown.GetLastMonthTransported <- AITown.GetLastMonthSupplied;
|
||||
|
||||
AIEvent.AI_ET_INVALID <- AIEvent.ET_INVALID;
|
||||
AIEvent.AI_ET_TEST <- AIEvent.ET_TEST;
|
||||
AIEvent.AI_ET_SUBSIDY_OFFER <- AIEvent.ET_SUBSIDY_OFFER;
|
||||
AIEvent.AI_ET_SUBSIDY_OFFER_EXPIRED <- AIEvent.ET_SUBSIDY_OFFER_EXPIRED;
|
||||
AIEvent.AI_ET_SUBSIDY_AWARDED <- AIEvent.ET_SUBSIDY_AWARDED;
|
||||
AIEvent.AI_ET_SUBSIDY_EXPIRED <- AIEvent.ET_SUBSIDY_EXPIRED;
|
||||
AIEvent.AI_ET_ENGINE_PREVIEW <- AIEvent.ET_ENGINE_PREVIEW;
|
||||
AIEvent.AI_ET_COMPANY_NEW <- AIEvent.ET_COMPANY_NEW;
|
||||
AIEvent.AI_ET_COMPANY_IN_TROUBLE <- AIEvent.ET_COMPANY_IN_TROUBLE;
|
||||
AIEvent.AI_ET_COMPANY_ASK_MERGER <- AIEvent.ET_COMPANY_ASK_MERGER;
|
||||
AIEvent.AI_ET_COMPANY_MERGER <- AIEvent.ET_COMPANY_MERGER;
|
||||
AIEvent.AI_ET_COMPANY_BANKRUPT <- AIEvent.ET_COMPANY_BANKRUPT;
|
||||
AIEvent.AI_ET_VEHICLE_CRASHED <- AIEvent.ET_VEHICLE_CRASHED;
|
||||
AIEvent.AI_ET_VEHICLE_LOST <- AIEvent.ET_VEHICLE_LOST;
|
||||
AIEvent.AI_ET_VEHICLE_WAITING_IN_DEPOT <- AIEvent.ET_VEHICLE_WAITING_IN_DEPOT;
|
||||
AIEvent.AI_ET_VEHICLE_UNPROFITABLE <- AIEvent.ET_VEHICLE_UNPROFITABLE;
|
||||
AIEvent.AI_ET_INDUSTRY_OPEN <- AIEvent.ET_INDUSTRY_OPEN;
|
||||
AIEvent.AI_ET_INDUSTRY_CLOSE <- AIEvent.ET_INDUSTRY_CLOSE;
|
||||
AIEvent.AI_ET_ENGINE_AVAILABLE <- AIEvent.ET_ENGINE_AVAILABLE;
|
||||
AIEvent.AI_ET_STATION_FIRST_VEHICLE <- AIEvent.ET_STATION_FIRST_VEHICLE;
|
||||
AIEvent.AI_ET_DISASTER_ZEPPELINER_CRASHED <- AIEvent.ET_DISASTER_ZEPPELINER_CRASHED;
|
||||
AIEvent.AI_ET_DISASTER_ZEPPELINER_CLEARED <- AIEvent.ET_DISASTER_ZEPPELINER_CLEARED;
|
||||
AIOrder.AIOF_NONE <- AIOrder.OF_NONE
|
||||
AIOrder.AIOF_NON_STOP_INTERMEDIATE <- AIOrder.OF_NON_STOP_INTERMEDIATE
|
||||
AIOrder.AIOF_NON_STOP_DESTINATION <- AIOrder.OF_NON_STOP_DESTINATION
|
||||
AIOrder.AIOF_UNLOAD <- AIOrder.OF_UNLOAD
|
||||
AIOrder.AIOF_TRANSFER <- AIOrder.OF_TRANSFER
|
||||
AIOrder.AIOF_NO_UNLOAD <- AIOrder.OF_NO_UNLOAD
|
||||
AIOrder.AIOF_FULL_LOAD <- AIOrder.OF_FULL_LOAD
|
||||
AIOrder.AIOF_FULL_LOAD_ANY <- AIOrder.OF_FULL_LOAD_ANY
|
||||
AIOrder.AIOF_NO_LOAD <- AIOrder.OF_NO_LOAD
|
||||
AIOrder.AIOF_SERVICE_IF_NEEDED <- AIOrder.OF_SERVICE_IF_NEEDED
|
||||
AIOrder.AIOF_STOP_IN_DEPOT <- AIOrder.OF_STOP_IN_DEPOT
|
||||
AIOrder.AIOF_GOTO_NEAREST_DEPOT <- AIOrder.OF_GOTO_NEAREST_DEPOT
|
||||
AIOrder.AIOF_NON_STOP_FLAGS <- AIOrder.OF_NON_STOP_FLAGS
|
||||
AIOrder.AIOF_UNLOAD_FLAGS <- AIOrder.OF_UNLOAD_FLAGS
|
||||
AIOrder.AIOF_LOAD_FLAGS <- AIOrder.OF_LOAD_FLAGS
|
||||
AIOrder.AIOF_DEPOT_FLAGS <- AIOrder.OF_DEPOT_FLAGS
|
||||
AIOrder.AIOF_INVALID <- AIOrder.OF_INVALID
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
AIBridge._GetName <- AIBridge.GetName;
|
||||
AIBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.9 adds parent_group_id to CreateGroup function */
|
||||
AIGroup._CreateGroup <- AIGroup.CreateGroup;
|
||||
AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,7 +5,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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.2 to 1.1. */
|
||||
AILog.Info("1.1 API compatibility in effect.");
|
||||
|
||||
AICompany.GetCompanyValue <- function(company)
|
||||
{
|
||||
@ -54,3 +54,30 @@ AIOrder.AIOF_UNLOAD_FLAGS <- AIOrder.OF_UNLOAD_FLAGS
|
||||
AIOrder.AIOF_LOAD_FLAGS <- AIOrder.OF_LOAD_FLAGS
|
||||
AIOrder.AIOF_DEPOT_FLAGS <- AIOrder.OF_DEPOT_FLAGS
|
||||
AIOrder.AIOF_INVALID <- AIOrder.OF_INVALID
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
AIBridge._GetName <- AIBridge.GetName;
|
||||
AIBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.9 adds parent_group_id to CreateGroup function */
|
||||
AIGroup._CreateGroup <- AIGroup.CreateGroup;
|
||||
AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,17 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.11 to 1.10. */
|
||||
AILog.Info("1.10 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,17 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 12 to 1.11. */
|
||||
AILog.Info("1.11 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,31 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.3 to 1.2. */
|
||||
AILog.Info("1.2 API compatibility in effect.");
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
AIBridge._GetName <- AIBridge.GetName;
|
||||
AIBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.9 adds parent_group_id to CreateGroup function */
|
||||
AIGroup._CreateGroup <- AIGroup.CreateGroup;
|
||||
AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,31 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.4 to 1.3. */
|
||||
AILog.Info("1.3 API compatibility in effect.");
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
AIBridge._GetName <- AIBridge.GetName;
|
||||
AIBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.9 adds parent_group_id to CreateGroup function */
|
||||
AIGroup._CreateGroup <- AIGroup.CreateGroup;
|
||||
AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,31 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.5 to 1.4. */
|
||||
AILog.Info("1.4 API compatibility in effect.");
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
AIBridge._GetName <- AIBridge.GetName;
|
||||
AIBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.9 adds parent_group_id to CreateGroup function */
|
||||
AIGroup._CreateGroup <- AIGroup.CreateGroup;
|
||||
AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,31 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.6 to 1.5. */
|
||||
AILog.Info("1.5 API compatibility in effect.");
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
AIBridge._GetName <- AIBridge.GetName;
|
||||
AIBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.9 adds parent_group_id to CreateGroup function */
|
||||
AIGroup._CreateGroup <- AIGroup.CreateGroup;
|
||||
AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,31 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.7 to 1.6. */
|
||||
AILog.Info("1.6 API compatibility in effect.");
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
AIBridge._GetName <- AIBridge.GetName;
|
||||
AIBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.9 adds parent_group_id to CreateGroup function */
|
||||
AIGroup._CreateGroup <- AIGroup.CreateGroup;
|
||||
AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,31 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.8 to 1.7. */
|
||||
AILog.Info("1.7 API compatibility in effect.");
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
AIBridge._GetName <- AIBridge.GetName;
|
||||
AIBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.9 adds parent_group_id to CreateGroup function */
|
||||
AIGroup._CreateGroup <- AIGroup.CreateGroup;
|
||||
AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,16 +5,31 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.9 to 1.8. */
|
||||
AILog.Info("1.8 API compatibility in effect.");
|
||||
|
||||
AIBridge.GetNameCompat1_8 <- AIBridge.GetName;
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
AIBridge._GetName <- AIBridge.GetName;
|
||||
AIBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return AIBridge.GetNameCompat1_8(bridge_id, AIVehicle.VT_RAIL);
|
||||
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
AIGroup.CreateGroupCompat1_8 <- AIGroup.CreateGroup;
|
||||
/* 1.9 adds parent_group_id to CreateGroup function */
|
||||
AIGroup._CreateGroup <- AIGroup.CreateGroup;
|
||||
AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup.CreateGroupCompat1_8(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,17 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.10 to 1.9. */
|
||||
AILog.Info("1.9 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,14 +5,15 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 13 to 12. */
|
||||
AILog.Info("12 API compatibility in effect.");
|
||||
|
||||
AIRoad.HasRoadTypeCompat12 <- AIRoad.HasRoadType;
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad.HasRoadTypeCompat12(tile, rt)) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -5,4 +5,4 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 14 to 13. */
|
||||
AILog.Info("13 API compatibility in effect.");
|
||||
|
@ -5,42 +5,4 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 15 to 14. */
|
||||
|
||||
AIBridge.GetBridgeID <- AIBridge.GetBridgeType;
|
||||
|
||||
class AICompat14 {
|
||||
function Text(text)
|
||||
{
|
||||
if (typeof text == "string") return text;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
AIBaseStation.SetNameCompat14 <- AIBaseStation.SetName;
|
||||
AIBaseStation.SetName <- function(id, name) { return AIBaseStation.SetNameCompat14(id, AICompat14.Text(name)); }
|
||||
|
||||
AICompany.SetNameCompat14 <- AICompany.SetName;
|
||||
AICompany.SetName <- function(name) { return AICompany.SetNameCompat14(AICompat14.Text(name)); }
|
||||
AICompany.SetPresidentNameCompat14 <- AICompany.SetPresidentName;
|
||||
AICompany.SetPresidentName <- function(name) { return AICompany.SetPresidentNameCompat14(AICompat14.Text(name)); }
|
||||
|
||||
AIGroup.SetNameCompat14 <- AIGroup.SetName;
|
||||
AIGroup.SetName <- function(id, name) { return AIGroup.SetNameCompat14(id, AICompat14.Text(name)); }
|
||||
|
||||
AISign.BuildSignCompat14 <- AISign.BuildSign;
|
||||
AISign.BuildSign <- function(id, name) { return AISign.BuildSignCompat14(id, AICompat14.Text(name)); }
|
||||
|
||||
AITown.FoundTownCompat14 <- AITown.FoundTown;
|
||||
AITown.FoundTown <- function(tile, size, city, layout, name) { return AITown.FoundTownCompat14(tile, size, city, layout, AICompat14.Text(name)); }
|
||||
|
||||
AIVehicle.SetNameCompat14 <- AIVehicle.SetName;
|
||||
AIVehicle.SetName <- function(id, name) { return AIVehicle.SetNameCompat14(id, AICompat14.Text(name)); }
|
||||
|
||||
AIObject.constructorCompat14 <- AIObject.constructor;
|
||||
foreach(name, object in CompatScriptRootTable) {
|
||||
if (type(object) != "class") continue;
|
||||
if (!object.rawin("constructor")) continue;
|
||||
if (object.constructor != AIObject.constructorCompat14) continue;
|
||||
object.constructor <- function() : (name) { AILog.Error("'" + name + "' is not instantiable"); }
|
||||
}
|
||||
AILog.Info("14 API compatibility in effect.");
|
||||
|
@ -4,17 +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.
|
||||
* 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 newgrf_stringmapping.h NewGRF string mapping definition. */
|
||||
|
||||
#ifndef NEWGRF_STRINGMAPPING_H
|
||||
#define NEWGRF_STRINGMAPPING_H
|
||||
|
||||
#include "../strings_type.h"
|
||||
#include "../newgrf_text_type.h"
|
||||
|
||||
void AddStringForMapping(GRFStringID source, std::function<void(StringID)> &&func);
|
||||
void AddStringForMapping(GRFStringID source, StringID *target);
|
||||
void FinaliseStringMapping();
|
||||
|
||||
#endif /* NEWGRF_STRINGMAPPING_H */
|
@ -12,6 +12,7 @@ set(GS_COMPAT_SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_12.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_13.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_14.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_15.nut
|
||||
)
|
||||
|
||||
foreach(GS_COMPAT_SOURCE_FILE IN LISTS GS_COMPAT_SOURCE_FILES)
|
||||
|
@ -5,10 +5,24 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.11 to 1.10. */
|
||||
GSLog.Info("1.10 API compatibility in effect.");
|
||||
|
||||
GSCompany.ChangeBankBalanceCompat1_10 <- GSCompany.ChangeBankBalance;
|
||||
/* 1.11 adds a tile parameter. */
|
||||
GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance;
|
||||
GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany.ChangeBankBalanceCompat1_10(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,5 +5,17 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 12 to 1.11. */
|
||||
GSLog.Info("1.11 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,46 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.3 to 1.2. */
|
||||
GSLog.Info("1.2 API compatibility in effect.");
|
||||
|
||||
GSTown._SetGrowthRate <- GSTown.SetGrowthRate;
|
||||
GSTown.SetGrowthRate <- function(town_id, days_between_town_growth)
|
||||
{
|
||||
/* Growth rate 0 caused resetting the custom growth rate. While this was undocumented, it was used nevertheless (ofc). */
|
||||
if (days_between_town_growth == 0) days_between_town_growth = GSTown.TOWN_GROWTH_NORMAL;
|
||||
return GSTown._SetGrowthRate(town_id, days_between_town_growth);
|
||||
}
|
||||
|
||||
/* 1.5 adds a game element reference to the news. */
|
||||
GSNews._Create <- GSNews.Create;
|
||||
GSNews.Create <- function(type, text, company)
|
||||
{
|
||||
return GSNews._Create(type, text, company, GSNews.NR_NONE, 0);
|
||||
}
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
GSBridge._GetName <- GSBridge.GetName;
|
||||
GSBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.11 adds a tile parameter. */
|
||||
GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance;
|
||||
GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,12 +5,46 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.4 to 1.3. */
|
||||
GSLog.Info("1.3 API compatibility in effect.");
|
||||
|
||||
GSTown.SetGrowthRateCompat1_3 <- GSTown.SetGrowthRate;
|
||||
GSTown._SetGrowthRate <- GSTown.SetGrowthRate;
|
||||
GSTown.SetGrowthRate <- function(town_id, days_between_town_growth)
|
||||
{
|
||||
/* Growth rate 0 caused resetting the custom growth rate. While this was undocumented, it was used nevertheless (ofc). */
|
||||
if (days_between_town_growth == 0) days_between_town_growth = GSTown.TOWN_GROWTH_NORMAL;
|
||||
return GSTown.SetGrowthRateCompat1_3(town_id, days_between_town_growth);
|
||||
return GSTown._SetGrowthRate(town_id, days_between_town_growth);
|
||||
}
|
||||
|
||||
/* 1.5 adds a game element reference to the news. */
|
||||
GSNews._Create <- GSNews.Create;
|
||||
GSNews.Create <- function(type, text, company)
|
||||
{
|
||||
return GSNews._Create(type, text, company, GSNews.NR_NONE, 0);
|
||||
}
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
GSBridge._GetName <- GSBridge.GetName;
|
||||
GSBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.11 adds a tile parameter. */
|
||||
GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance;
|
||||
GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,10 +5,38 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.5 to 1.4 */
|
||||
GSLog.Info("1.4 API compatibility in effect.");
|
||||
|
||||
GSNews.CreateCompat1_4 <- GSNews.Create;
|
||||
/* 1.5 adds a game element reference to the news. */
|
||||
GSNews._Create <- GSNews.Create;
|
||||
GSNews.Create <- function(type, text, company)
|
||||
{
|
||||
return GSNews.CreateCompat1_4(type, text, company, GSNews.NR_NONE, 0);
|
||||
return GSNews._Create(type, text, company, GSNews.NR_NONE, 0);
|
||||
}
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
GSBridge._GetName <- GSBridge.GetName;
|
||||
GSBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.11 adds a tile parameter. */
|
||||
GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance;
|
||||
GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,31 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.6 to 1.5. */
|
||||
GSLog.Info("1.5 API compatibility in effect.");
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
GSBridge._GetName <- GSBridge.GetName;
|
||||
GSBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.11 adds a tile parameter. */
|
||||
GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance;
|
||||
GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,31 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.7 to 1.6. */
|
||||
GSLog.Info("1.6 API compatibility in effect.");
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
GSBridge._GetName <- GSBridge.GetName;
|
||||
GSBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.11 adds a tile parameter. */
|
||||
GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance;
|
||||
GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,31 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.8 to 1.7. */
|
||||
GSLog.Info("1.7 API compatibility in effect.");
|
||||
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
GSBridge._GetName <- GSBridge.GetName;
|
||||
GSBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.11 adds a tile parameter. */
|
||||
GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance;
|
||||
GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,10 +5,31 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.9 to 1.8. */
|
||||
GSLog.Info("1.8 API compatibility in effect.");
|
||||
|
||||
GSBridge.GetNameCompat1_8 <- GSBridge.GetName;
|
||||
/* 1.9 adds a vehicle type parameter. */
|
||||
GSBridge._GetName <- GSBridge.GetName;
|
||||
GSBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return GSBridge.GetNameCompat1_8(bridge_id, GSVehicle.VT_RAIL);
|
||||
return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
/* 1.11 adds a tile parameter. */
|
||||
GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance;
|
||||
GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,4 +5,24 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.10 to 1.9. */
|
||||
GSLog.Info("1.9 API compatibility in effect.");
|
||||
|
||||
/* 1.11 adds a tile parameter. */
|
||||
GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance;
|
||||
GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -5,14 +5,15 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 13 to 12. */
|
||||
GSLog.Info("12 API compatibility in effect.");
|
||||
|
||||
GSRoad.HasRoadTypeCompat12 <- GSRoad.HasRoadType;
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad.HasRoadTypeCompat12(tile, rt)) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -5,4 +5,4 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 14 to 13. */
|
||||
GSLog.Info("13 API compatibility in effect.");
|
||||
|
@ -5,87 +5,4 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 15 to 14. */
|
||||
|
||||
GSBridge.GetBridgeID <- GSBridge.GetBridgeType;
|
||||
|
||||
/* Emulate old GSText parameter padding behaviour */
|
||||
GSText.SCRIPT_TEXT_MAX_PARAMETERS <- 20;
|
||||
|
||||
class GSCompat14 {
|
||||
function Text(text)
|
||||
{
|
||||
if (typeof text == "string") return text;
|
||||
if (typeof text == "instance" && text instanceof GSText) return text;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
GSBaseStation.SetNameCompat14 <- GSBaseStation.SetName;
|
||||
GSBaseStation.SetName <- function(id, name) { return GSBaseStation.SetNameCompat14(id, GSCompat14.Text(name)); }
|
||||
|
||||
GSCompany.SetNameCompat14 <- GSCompany.SetName;
|
||||
GSCompany.SetName <- function(name) { return GSCompany.SetNameCompat14(GSCompat14.Text(name)); }
|
||||
GSCompany.SetPresidentNameCompat14 <- GSCompany.SetPresidentName;
|
||||
GSCompany.SetPresidentName <- function(name) { return GSCompany.SetPresidentNameCompat14(GSCompat14.Text(name)); }
|
||||
|
||||
GSGoal.NewCompat14 <- GSGoal.New;
|
||||
GSGoal.New <- function(company, goal, type, dest) { return GSGoal.NewCompat14(company, GSCompat14.Text(goal), type, dest); }
|
||||
GSGoal.SetTextCompat14 <- GSGoal.SetText;
|
||||
GSGoal.SetText <- function(id, goal) { return GSGoal.SetTextCompat14(id, GSCompat14.Text(goal)); }
|
||||
GSGoal.SetProgressCompat14 <- GSGoal.SetProgress;
|
||||
GSGoal.SetProgress <- function(id, progress) { return GSGoal.SetProgressCompat14(id, GSCompat14.Text(progress)); }
|
||||
GSGoal.QuestionCompat14 <- GSGoal.Question;
|
||||
GSGoal.Question <- function(id, company, question, type, buttons) { return GSGoal.QuestionCompat14(id, company, GSCompat14.Text(question), type, buttons); }
|
||||
GSGoal.QuestionClientCompat14 <- GSGoal.QuestionClient;
|
||||
GSGoal.QuestionClient <- function(id, target, is_client, question, type, buttons) { return GSGoal.QuestionClientCompat14(id, target, is_client, GSCompat14.Text(question), type, buttons); }
|
||||
|
||||
GSGroup.SetNameCompat14 <- GSGroup.SetName;
|
||||
GSGroup.SetName <- function(id, name) { return GSGroup.SetNameCompat14(id, GSCompat14.Text(name)); }
|
||||
|
||||
GSIndustry.SetTextCompat14 <- GSIndustry.SetText;
|
||||
GSIndustry.SetText <- function(id, text) { return GSIndustry.SetTextCompat14(id, GSCompat14.Text(text)); }
|
||||
GSIndustry.SetProductionLevelCompat14 <- GSIndustry.SetProductionLevel;
|
||||
GSIndustry.SetProductionLevel <- function(id, level, news, text) { return GSIndustry.SetProductionLevelCompat14(id, level, news, GSCompat14.Text(text)); }
|
||||
|
||||
GSLeagueTable.NewCompat14 <- GSLeagueTable.New;
|
||||
GSLeagueTable.New <- function(title, header, footer) { return GSLeagueTable.NewCompat14(GSCompat14.Text(title), GSCompat14.Text(header), GSCompat14.Text(footer)); }
|
||||
GSLeagueTable.NewElementCompat14 <- GSLeagueTable.NewElement;
|
||||
GSLeagueTable.NewElement <- function(table, rating, company, text, score, type, target) { return GSLeagueTable.NewElementCompat14(table, rating, company, GSCompat14.Text(text), GSCompat14.Text(score), type, target); }
|
||||
GSLeagueTable.UpdateElementDataCompat14 <- GSLeagueTable.UpdateElementData;
|
||||
GSLeagueTable.UpdateElementData <- function(element, company, text, type, target) { return GSLeagueTable.UpdateElementDataCompat14(element, company, GSCompat14.Text(text), type, target); }
|
||||
GSLeagueTable.UpdateElementScoreCompat14 <- GSLeagueTable.UpdateElementScore;
|
||||
GSLeagueTable.UpdateElementScore <- function(element, rating, score) { return GSLeagueTable.UpdateElementScoreCompat14(element, rating, GSCompat14.Text(score)); }
|
||||
|
||||
GSNews.CreateCompat14 <- GSNews.Create;
|
||||
GSNews.Create <- function(type, text, company, ref_type, ref) { return GSNews.CreateCompat14(type, GSCompat14.Text(text), company, ref_type, ref); }
|
||||
|
||||
GSSign.BuildSignCompat14 <- GSSign.BuildSign;
|
||||
GSSign.BuildSign <- function(id, name) { return GSSign.BuildSignCompat14(id, GSCompat14.Text(name)); }
|
||||
|
||||
GSStoryPage.NewCompat14 <- GSStoryPage.New;
|
||||
GSStoryPage.New <- function(company, title) { return GSStoryPage.NewCompat14(company, GSCompat14.Text(title)); }
|
||||
GSStoryPage.NewElementCompat14 <- GSStoryPage.NewElement;
|
||||
GSStoryPage.NewElement <- function(page, type, ref, text) { return GSStoryPage.NewElementCompat14(page, type, ref, GSCompat14.Text(text)); }
|
||||
GSStoryPage.UpdateElementCompat14 <- GSStoryPage.UpdateElement;
|
||||
GSStoryPage.UpdateElement <- function(id, ref, text) { return GSStoryPage.UpdateElementCompat14(id, ref, GSCompat14.Text(text)); }
|
||||
GSStoryPage.SetTitleCompat14 <- GSStoryPage.SetTitle;
|
||||
GSStoryPage.SetTitle <- function(page, tile) { return GSStoryPage.SetTitleCompat14(page, GSCompat14.Text(title)); }
|
||||
|
||||
GSTown.SetNameCompat14 <- GSTown.SetName;
|
||||
GSTown.SetName <- function(id, name) { return GSTown.SetNameCompat14(id, GSCompat14.Text(name)); }
|
||||
GSTown.SetTextCompat14 <- GSTown.SetText;
|
||||
GSTown.SetText <- function(id, text) { return GSTown.SetTextCompat14(id, GSCompat14.Text(text)); }
|
||||
GSTown.FoundTownCompat14 <- GSTown.FoundTown;
|
||||
GSTown.FoundTown <- function(tile, size, city, layout, name) { return GSTown.FoundTownCompat14(tile, size, city, layout, GSCompat14.Text(name)); }
|
||||
|
||||
GSVehicle.SetNameCompat14 <- GSVehicle.SetName;
|
||||
GSVehicle.SetName <- function(id, name) { return GSVehicle.SetNameCompat14(id, GSCompat14.Text(name)); }
|
||||
|
||||
GSObject.constructorCompat14 <- GSObject.constructor;
|
||||
foreach(name, object in CompatScriptRootTable) {
|
||||
if (type(object) != "class") continue;
|
||||
if (!object.rawin("constructor")) continue;
|
||||
if (object.constructor != GSObject.constructorCompat14) continue;
|
||||
object.constructor <- function() : (name) { GSLog.Error("'" + name + "' is not instantiable"); }
|
||||
}
|
||||
GSLog.Info("14 API compatibility in effect.");
|
||||
|
6
bin/game/compat_15.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/>.
|
||||
*/
|
103
changelog.md
@ -1,108 +1,5 @@
|
||||
## 15.x
|
||||
|
||||
### 15.0-beta2 (2025-04-13)
|
||||
|
||||
- Feature: Snow-covered rocks are now visible (#13627)
|
||||
- Feature: Generate more rocks on steep slopes during map generation or heightmap import (#13462)
|
||||
- Feature: Prevent towns from upgrading individually-placed houses (#13270)
|
||||
- Feature: [Win32] Touchpad two-finger map scrolling (#13172)
|
||||
- Feature: NewGRF Badges (#13073)
|
||||
- Add: [NewGRF] Add road-/tram-/rail-type variable 0x45 to get mutual road-/tram-/rail-type on same tile (#13934)
|
||||
- Add: [Script] Newer Cargo Classes (#13779)
|
||||
- Add: Show hyperlink destination tooltips in text window (#13742)
|
||||
- Add: [Script] Saving/loading ScriptList (#13556)
|
||||
- Add: Press Ctrl to build diagonal canals in game mode (#13432)
|
||||
- Add: Sandbox settings to Sandbox Options window (#13268)
|
||||
- Add: Setting to allow placing houses manually in-game (#13266)
|
||||
- Add: [Script] Event for when a company's president name changes (#13208)
|
||||
- Add: Ability to toggle visibility of station signs by facility (#13207)
|
||||
- Add: [Script] ScriptEventCompanyRename (#12878)
|
||||
- Add: Ukrainian Hryvnia currency (#12877)
|
||||
- Add: Convert 32bpp-only sprites to 8bpp when needed (#11602)
|
||||
- Change: [Script] Start GS (but don't run it) when generating world in scenario editor (#13961)
|
||||
- Change: [Script] Add vehicle owner to crash event (#13878)
|
||||
- Change: Make tree placement at world generation look more organic (#13515)
|
||||
- Change: [MacOS] Put the icon in a rounded rectangle (#13446)
|
||||
- Change: [Script] GetWaypointID to return the StationID of any waypoint (#13407)
|
||||
- Change: Draw company manager face jacket after collar (#13390)
|
||||
- Change: Don't distinguish between bus and truck stops when removing them (#13384)
|
||||
- Change: [Script] Rename BridgeID to BridgeType in the script API (#13352)
|
||||
- Change: Add fonts document to help window (#13305)
|
||||
- Change: Log changes to sandbox settings (#13267)
|
||||
- Change: When player joins network company, use its name instead of number in chat (#13263)
|
||||
- Change: [Win32] Draw window title bar according to current Windows light/dark theme (#13196)
|
||||
- Change: Restore wider spacers in main toolbars (#12039)
|
||||
- Fix: NewGRF Global variables 0D, 0E and 1E refer to wrong GRFFile (#13986)
|
||||
- Fix #13980: Allow diagonal selection for road convert (#13983)
|
||||
- Fix: Validate raw strings from game-scripts, and strip invalid and control characters (#13976)
|
||||
- Fix: Capitalise "Disabled" for the "maximum non-sticky open windows" setting (#13975)
|
||||
- Fix: Frame widget with label had incorrect spacing (#13967)
|
||||
- Fix: StringFilter included quotes in the search and failed (#13965)
|
||||
- Fix #13955: Make graphs respect RTL (#13957)
|
||||
- Fix: Numbers were left-aligned for RTL languages in several windows (#13959)
|
||||
- Fix: MayHaveRoad claimed rail station tiles had road, so the custom stationspec index would be read as roadtype (#13949)
|
||||
- Fix: [Script] Prevent cloning of API instances (#13947)
|
||||
- Fix: Reference to the correct section of the README, if a graphics or a sound set is incomplete (#13946)
|
||||
- Fix: Draw the bevel around the music track name as inset (#13935)
|
||||
- Fix #13923: Padding in music GUI was asymmetric, so it looked different for LTR and RTL languages (#13933)
|
||||
- Fix #13928: BuildOilRig did not properly set airport rotation (#13929)
|
||||
- Fix: SDL2 application name hint was not effective (#13926)
|
||||
- Fix #13921: [Win32] Don't try close an already closed event handle during destruction (#13924)
|
||||
- Fix #13921: Don't reject MIDI files with a valid file magic value (#13924)
|
||||
- Fix #13912: Multitile buildings break apart in house picker (#13914)
|
||||
- Fix #13908: Require double click on order to change stop location (#13913)
|
||||
- Fix #13910: Invalidate content of house picker window if language is changed (#13911)
|
||||
- Fix: [Script] Reset instance when changing running scripts in scenario editor (#13906)
|
||||
- Fix: [Script] Only run the gamescript GameLoop() in-game (#13896)
|
||||
- Fix #13893: Reversed all x-axis labels for company related and industry production graphs in wallclock mode (#13894)
|
||||
- Fix #13842: Close industry production graph if industry is removed (#13890)
|
||||
- Fix #11528: Starting autorail dragging from existing track tiles resulted in adding non-continuous tracks (#13885)
|
||||
- Fix: Autoreplace rail/road list only listed buildable types (#13887)
|
||||
- Fix: [NewGRF] Display an error, if NewGRF reference out-of-bounds string parameters in gender/plural choices (#13881)
|
||||
- Fix #13849: Settings in old saves could be overridden by defaults (#13874)
|
||||
- Fix #13562: Removed cost estimation message from money cheat (#13857)
|
||||
- Fix: [NewGRF] Plurals and genders did not work in strings with cases or substrings (#13853, #13852)
|
||||
- Fix: [NewGRF] String parameter stack and case selection were not processed for control code 0x81 (#13851)
|
||||
- Fix #13839: Incorrect colour of first company legend in smallmap window (#13841)
|
||||
- Fix: i circumflex width in TrueType small font (#13836)
|
||||
- Fix: Don't show owner of non-existent road (#13824)
|
||||
- Fix: Error message window timeout doesn't match setting (#13812)
|
||||
- Fix #13795: Crash in vehicle list of 32-bit platforms (#13796)
|
||||
- Fix: [Script] Company rename event sometimes had the wrong name (#13794)
|
||||
- Fix: Improve manager face randomisation (#13776)
|
||||
- Fix #13740: [Script] Handle implicit orders for jump orders (#13753)
|
||||
- Fix #13749: Default service intervals were not updated when changing timekeeping unit (#13751)
|
||||
- Fix #13725: Use proper query strings for changing timetable values (#13737)
|
||||
- Fix #11226: Don't draw story page elements that won't be visible (#13736)
|
||||
- Fix: More AI than max_no_competitors could start with competitors_interval=0 (#13670)
|
||||
- Fix: League table window ignored the minimal size in its widget description (#13629)
|
||||
- Fix: Incorrect snow density when making rocks snowy (#13626)
|
||||
- Fix: NewGRF vehicles display loading sprites when not actually loading or unloading (#13554)
|
||||
- Fix #12925: Prevent cost estimates for settings changes (#13550)
|
||||
- Fix: [Script] Report errors happening during 'Load()' (#13537)
|
||||
- Fix: [Script] Improve type checking of parameters (#13522)
|
||||
- Fix: [Script] Don't set CommandCallback for asynchronous commands (#13501)
|
||||
- Fix: Missing error messages with sell- and autoreplace-all commands (#13469)
|
||||
- Fix: Too many trees when generating trees at same height (#13460)
|
||||
- Fix #12912: Company inaugurated year in wallclock mode was not saved (#13448)
|
||||
- Fix: [Script] Wrong return value for failed preconditions Vehicle::CloneVehicle (#13445)
|
||||
- Fix #13140: Scale initial industry production estimate by cargo scale (#13427)
|
||||
- Fix #13384: Crash when remove bus/truck stop tool used on road waypoints (#13391)
|
||||
- Fix #12987: Historical houses now always spawn completed (#13332)
|
||||
- Fix: [Win32] Font detection didn't work for locales not supporting code pages (#13306)
|
||||
- Fix: Restore ability to disable service interval (#13281)
|
||||
- Fix: Hide company settings from console commands (#13269)
|
||||
- Fix: Disable service interval widgets for non-owned vehicles (#13260)
|
||||
- Fix #13225: Cargo payment graph key toggled wrong data sets (#13226)
|
||||
- Fix: Rail station tile flags were not set early enough (#13203)
|
||||
- Fix #13199: -f command line parameter does not need a value (#13200)
|
||||
- Fix: Missing water region invalidation after flooding a half tile with rail in the highest corner (#13047)
|
||||
- Fix: Strip control codes before sorting NewGRF names (#13034)
|
||||
- Fix #12968: Added back ability to create unremovable houses (#12989)
|
||||
- Remove: Drop support for UCS2/UTF-16 encoded scripts (#13992)
|
||||
- Remove: Support for SDL1.2 (#13298)
|
||||
|
||||
|
||||
### 15.0-beta1 (2024-12-24)
|
||||
|
||||
- Feature: Town, industry and vehicle window zoom with mouse wheel (#12810, #12809, #12797)
|
||||
|
@ -80,10 +80,6 @@ macro(compile_flags)
|
||||
|
||||
# We use 'ABCD' multichar for SaveLoad chunks identifiers
|
||||
-Wno-multichar
|
||||
|
||||
# Prevent optimisation supposing enums are in a range specified by the standard
|
||||
# For details, see http://gcc.gnu.org/PR43680 and PR#5246.
|
||||
-fno-strict-enums
|
||||
)
|
||||
|
||||
# Ninja processes the output so the output from the compiler
|
||||
@ -110,6 +106,10 @@ macro(compile_flags)
|
||||
# about its own optimized code in some places.
|
||||
"-fno-strict-overflow"
|
||||
|
||||
# Prevent optimisation supposing enums are in a range specified by the standard
|
||||
# For details, see http://gcc.gnu.org/PR43680
|
||||
"-fno-tree-vrp"
|
||||
|
||||
# -flifetime-dse=2 (default since GCC 6) doesn't play
|
||||
# well with our custom pool item allocator
|
||||
"$<$<BOOL:${LIFETIME_DSE_FOUND}>:-flifetime-dse=1>"
|
||||
|
14
cmake/Endian.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
# Add the definitions to indicate which endian we are building for.
|
||||
#
|
||||
# add_endian_definition()
|
||||
#
|
||||
function(add_endian_definition)
|
||||
include(TestBigEndian)
|
||||
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
|
||||
|
||||
if(IS_BIG_ENDIAN)
|
||||
add_definitions(-DTTD_ENDIAN=TTD_BIG_ENDIAN)
|
||||
else()
|
||||
add_definitions(-DTTD_ENDIAN=TTD_LITTLE_ENDIAN)
|
||||
endif()
|
||||
endfunction()
|
@ -43,8 +43,29 @@ find_library(LZO_LIBRARY
|
||||
PATHS ${PC_LZO_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
include(FixVcpkgLibrary)
|
||||
FixVcpkgLibrary(LZO)
|
||||
# With vcpkg, the library path should contain both 'debug' and 'optimized'
|
||||
# entries (see target_link_libraries() documentation for more information)
|
||||
#
|
||||
# NOTE: we only patch up when using vcpkg; the same issue might happen
|
||||
# when not using vcpkg, but this is non-trivial to fix, as we have no idea
|
||||
# what the paths are. With vcpkg we do. And we only official support vcpkg
|
||||
# with Windows.
|
||||
#
|
||||
# NOTE: this is based on the assumption that the debug file has the same
|
||||
# name as the optimized file. This is not always the case, but so far
|
||||
# experiences has shown that in those case vcpkg CMake files do the right
|
||||
# thing.
|
||||
if(VCPKG_TOOLCHAIN AND LZO_LIBRARY AND LZO_LIBRARY MATCHES "${VCPKG_INSTALLED_DIR}")
|
||||
if(LZO_LIBRARY MATCHES "/debug/")
|
||||
set(LZO_LIBRARY_DEBUG ${LZO_LIBRARY})
|
||||
string(REPLACE "/debug/lib/" "/lib/" LZO_LIBRARY_RELEASE ${LZO_LIBRARY})
|
||||
else()
|
||||
set(LZO_LIBRARY_RELEASE ${LZO_LIBRARY})
|
||||
string(REPLACE "/lib/" "/debug/lib/" LZO_LIBRARY_DEBUG ${LZO_LIBRARY})
|
||||
endif()
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(LZO)
|
||||
endif()
|
||||
|
||||
set(LZO_VERSION ${PC_LZO_VERSION})
|
||||
|
||||
|
@ -4,9 +4,6 @@ find_library(Ogg_LIBRARY
|
||||
NAMES ogg
|
||||
)
|
||||
|
||||
include(FixVcpkgLibrary)
|
||||
FixVcpkgLibrary(Ogg)
|
||||
|
||||
set(Ogg_COMPILE_OPTIONS "" CACHE STRING "Extra compile options of ogg")
|
||||
|
||||
set(Ogg_LINK_LIBRARIES "" CACHE STRING "Extra link libraries of ogg")
|
||||
@ -36,6 +33,5 @@ if (Ogg_FOUND)
|
||||
INTERFACE_LINK_LIBRARIES "${Ogg_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_FLAGS "${Ogg_LINK_FLAGS}"
|
||||
)
|
||||
FixVcpkgTarget(Ogg Ogg::ogg)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -4,9 +4,6 @@ find_library(Opus_LIBRARY
|
||||
NAMES opus
|
||||
)
|
||||
|
||||
include(FixVcpkgLibrary)
|
||||
FixVcpkgLibrary(Opus)
|
||||
|
||||
set(Opus_COMPILE_OPTIONS "" CACHE STRING "Extra compile options of opus")
|
||||
|
||||
set(Opus_LINK_LIBRARIES "" CACHE STRING "Extra link libraries of opus")
|
||||
@ -36,6 +33,5 @@ if (Opus_FOUND)
|
||||
INTERFACE_LINK_LIBRARIES "${Opus_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_FLAGS "${Opus_LINK_FLAGS}"
|
||||
)
|
||||
FixVcpkgTarget(Opus Opus::opus)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -4,9 +4,6 @@ find_library(OpusFile_LIBRARY
|
||||
NAMES opusfile
|
||||
)
|
||||
|
||||
include(FixVcpkgLibrary)
|
||||
FixVcpkgLibrary(OpusFile)
|
||||
|
||||
set(OpusFile_COMPILE_OPTIONS "" CACHE STRING "Extra compile options of opusfile")
|
||||
|
||||
set(OpusFile_LINK_LIBRARIES "" CACHE STRING "Extra link libraries of opusfile")
|
||||
@ -39,6 +36,5 @@ if (OpusFile_FOUND)
|
||||
INTERFACE_LINK_LIBRARIES "Ogg::ogg;Opus::opus;${OpusFile_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_FLAGS "${OpusFile_LINK_FLAGS}"
|
||||
)
|
||||
FixVcpkgTarget(OpusFile OpusFile::opusfile)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -2,7 +2,6 @@
|
||||
# SSE version (SSE 2.0, SSSE 3.0).
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_FLAGS "")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
@ -16,5 +15,3 @@ check_cxx_source_compiles("
|
||||
int main() { return 0; }"
|
||||
SSE_FOUND
|
||||
)
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||
|
@ -1,7 +1,6 @@
|
||||
# Autodetect if xaudio2 can be used.
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_FLAGS "")
|
||||
|
||||
check_cxx_source_compiles("
|
||||
@ -18,5 +17,3 @@ check_cxx_source_compiles("
|
||||
int main() { printf(\"%s\\\\n\", XAUDIO2_DLL_A); return 0; }"
|
||||
XAUDIO2_FOUND
|
||||
)
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||
|
@ -1,40 +0,0 @@
|
||||
macro(FixVcpkgLibrary NAME)
|
||||
# With vcpkg, the library path should contain both 'debug' and 'optimized'
|
||||
# entries (see target_link_libraries() documentation for more information)
|
||||
#
|
||||
# NOTE: we only patch up when using vcpkg; the same issue might happen
|
||||
# when not using vcpkg, but this is non-trivial to fix, as we have no idea
|
||||
# what the paths are. With vcpkg we do. And we only official support vcpkg
|
||||
# with Windows.
|
||||
#
|
||||
# NOTE: this is based on the assumption that the debug file has the same
|
||||
# name as the optimized file. This is not always the case, but so far
|
||||
# experiences has shown that in those case vcpkg CMake files do the right
|
||||
# thing.
|
||||
if(VCPKG_TOOLCHAIN AND ${NAME}_LIBRARY AND ${NAME}_LIBRARY MATCHES "${VCPKG_INSTALLED_DIR}")
|
||||
if(${NAME}_LIBRARY MATCHES "/debug/")
|
||||
set(${NAME}_LIBRARY_DEBUG ${${NAME}_LIBRARY})
|
||||
string(REPLACE "/debug/lib/" "/lib/" ${NAME}_LIBRARY_RELEASE ${${NAME}_LIBRARY})
|
||||
else()
|
||||
set(${NAME}_LIBRARY_RELEASE ${${NAME}_LIBRARY})
|
||||
string(REPLACE "/lib/" "/debug/lib/" ${NAME}_LIBRARY_DEBUG ${${NAME}_LIBRARY})
|
||||
endif()
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(${NAME})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(FixVcpkgTarget NAME TARGET)
|
||||
if(EXISTS "${${NAME}_LIBRARY_RELEASE}")
|
||||
set_property(TARGET ${TARGET} APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${${NAME}_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
if(EXISTS "${${NAME}_LIBRARY_DEBUG}")
|
||||
set_property(TARGET ${TARGET} APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${${NAME}_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
endfunction()
|
@ -62,7 +62,6 @@ install(FILES
|
||||
${CMAKE_SOURCE_DIR}/docs/desync.md
|
||||
${CMAKE_SOURCE_DIR}/docs/directory_structure.md
|
||||
${CMAKE_SOURCE_DIR}/docs/eints.md
|
||||
${CMAKE_SOURCE_DIR}/docs/fonts.md
|
||||
${CMAKE_SOURCE_DIR}/docs/game_coordinator.md
|
||||
${CMAKE_SOURCE_DIR}/docs/linkgraph.md
|
||||
${CMAKE_SOURCE_DIR}/docs/logging_and_performance_metrics.md
|
||||
|
@ -46,3 +46,44 @@ endfunction()
|
||||
function(add_test_files)
|
||||
_add_files_tgt(openttd_test ${ARGV})
|
||||
endfunction()
|
||||
|
||||
# This function works around an 'issue' with CMake, where
|
||||
# set_source_files_properties() only works in the scope of the file. We want
|
||||
# to set properties for the source file on a more global level. To solve this,
|
||||
# this function records the flags you want, and a macro adds them in the root
|
||||
# CMakeLists.txt.
|
||||
# See this URL for more information on the issue:
|
||||
# http://cmake.3232098.n2.nabble.com/scope-of-set-source-files-properties-td4766111.html
|
||||
#
|
||||
# set_compile_flags([file1 ...] COMPILE_FLAGS cflag [cflag ...])
|
||||
#
|
||||
function(set_compile_flags)
|
||||
cmake_parse_arguments(PARAM "" "" "COMPILE_FLAGS" ${ARGN})
|
||||
set(PARAM_FILES "${PARAM_UNPARSED_ARGUMENTS}")
|
||||
|
||||
get_property(SOURCE_PROPERTIES GLOBAL PROPERTY source_properties)
|
||||
|
||||
foreach(FILE IN LISTS PARAM_FILES)
|
||||
list(APPEND SOURCE_PROPERTIES "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}::${PARAM_COMPILE_FLAGS}")
|
||||
endforeach()
|
||||
|
||||
set_property(GLOBAL PROPERTY source_properties "${SOURCE_PROPERTIES}")
|
||||
endfunction()
|
||||
|
||||
# Call this macro in the same CMakeLists.txt and after add_executable().
|
||||
# This makes sure all the COMPILE_FLAGS of set_compile_flags() are set
|
||||
# correctly.
|
||||
#
|
||||
# process_compile_flags()
|
||||
#
|
||||
function(process_compile_flags)
|
||||
get_property(SOURCE_PROPERTIES GLOBAL PROPERTY source_properties)
|
||||
|
||||
foreach(ENTRY ${SOURCE_PROPERTIES})
|
||||
string(REPLACE "::" ";" ENTRY "${ENTRY}")
|
||||
list(GET ENTRY 0 FILE)
|
||||
list(GET ENTRY 1 PROPERTIES)
|
||||
|
||||
set_source_files_properties(${FILE} PROPERTIES COMPILE_FLAGS ${PROPERTIES})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
#
|
||||
# Create a single baseset meta file with the correct translations.
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
#
|
||||
# Create a single GRF file based on sprites/<grfname>.nfo and sprites/*.png
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
#
|
||||
# Create a desktop file with the correct translations.
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
if(NOT REV_MAJOR)
|
||||
set(REV_MAJOR 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
#
|
||||
# CMake script to automatically generate the enums in script_window.hpp
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
#
|
||||
# Runs a single regressoion test
|
||||
@ -87,7 +87,12 @@ set(ERROR NO)
|
||||
list(LENGTH REGRESSION_EXPECTED REGRESSION_EXPECTED_LENGTH)
|
||||
|
||||
# Compare the output
|
||||
foreach(RESULT EXPECTED IN ZIP_LISTS REGRESSION_RESULT REGRESSION_EXPECTED)
|
||||
foreach(RESULT IN LISTS REGRESSION_RESULT)
|
||||
unset(EXPECTED)
|
||||
if(ARGC LESS REGRESSION_EXPECTED_LENGTH)
|
||||
list(GET REGRESSION_EXPECTED ${ARGC} EXPECTED)
|
||||
endif()
|
||||
|
||||
math(EXPR ARGC "${ARGC} + 1")
|
||||
|
||||
if(NOT RESULT STREQUAL EXPECTED)
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
if(NOT SCRIPT_API_SOURCE_FILE)
|
||||
message(FATAL_ERROR "Script needs SCRIPT_API_SOURCE_FILE defined")
|
||||
@ -17,48 +17,38 @@ if(NOT APILC)
|
||||
endif()
|
||||
|
||||
macro(dump_fileheader)
|
||||
get_filename_component(SCRIPT_API_FILE_NAME "${SCRIPT_API_FILE}" NAME_WE)
|
||||
string(APPEND SQUIRREL_EXPORT "\n#include \"../${SCRIPT_API_FILE_NAME}.hpp\"")
|
||||
get_filename_component(SCRIPT_API_FILE_NAME "${SCRIPT_API_FILE}" NAME)
|
||||
string(APPEND SQUIRREL_EXPORT "\n#include \"../${SCRIPT_API_FILE_NAME}\"")
|
||||
if(NOT "${APIUC}" STREQUAL "Template")
|
||||
string(REPLACE "script_" "template_" SCRIPT_API_FILE_NAME "${SCRIPT_API_FILE_NAME}")
|
||||
string(APPEND SQUIRREL_EXPORT "\n#include \"../template/${SCRIPT_API_FILE_NAME}.sq.hpp\"")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(open_namespace)
|
||||
if(NOT NAMESPACE_OPENED)
|
||||
string(APPEND SQUIRREL_EXPORT "\nnamespace SQConvert {")
|
||||
set(NAMESPACE_OPENED TRUE)
|
||||
string(APPEND SQUIRREL_EXPORT "\n#include \"../template/${SCRIPT_API_FILE_NAME}.sq\"")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(dump_class_templates NAME)
|
||||
string(REGEX REPLACE "^Script" "" REALNAME ${NAME})
|
||||
|
||||
string(APPEND SQUIRREL_EXPORT "\n\ttemplate <> struct Param<${NAME} *> { static inline ${NAME} *Get(HSQUIRRELVM vm, int index) { return static_cast<${NAME} *>(Squirrel::GetRealInstance(vm, index, \"${REALNAME}\")); } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\ttemplate <> struct Param<${NAME} &> { static inline ${NAME} &Get(HSQUIRRELVM vm, int index) { return *static_cast<${NAME} *>(Squirrel::GetRealInstance(vm, index, \"${REALNAME}\")); } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\ttemplate <> struct Param<const ${NAME} *> { static inline const ${NAME} *Get(HSQUIRRELVM vm, int index) { return static_cast<${NAME} *>(Squirrel::GetRealInstance(vm, index, \"${REALNAME}\")); } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\ttemplate <> struct Param<const ${NAME} &> { static inline const ${NAME} &Get(HSQUIRRELVM vm, int index) { return *static_cast<${NAME} *>(Squirrel::GetRealInstance(vm, index, \"${REALNAME}\")); } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<${NAME} *> { static inline ${NAME} *Get(HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return (${NAME} *)instance; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<${NAME} &> { static inline ${NAME} &Get(HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return *(${NAME} *)instance; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<const ${NAME} *> { static inline const ${NAME} *Get(HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return (${NAME} *)instance; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<const ${NAME} &> { static inline const ${NAME} &Get(HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return *(${NAME} *)instance; } };")
|
||||
if("${NAME}" STREQUAL "ScriptEvent")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\ttemplate <> struct Return<${NAME} *> { static inline int Set(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 <> struct Return<${NAME} *> { static inline int Set(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")
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\ttemplate <> struct Param<Text *> {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\tstatic inline Text *Get(HSQUIRRELVM vm, int index) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\t\tif (sq_gettype(vm, index) == OT_INSTANCE) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\t\t\treturn Param<ScriptText *>::Get(vm, index);")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\t\t}")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\t\tif (sq_gettype(vm, index) == OT_STRING) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\t\t\treturn new RawText(Param<const std::string &>::Get(vm, index));")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\t\t}")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\t\tif (sq_gettype(vm, index) == OT_NULL) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\t\t\treturn nullptr;")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\t\t}")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\t\tthrow sq_throwerror(vm, fmt::format(\"parameter {} has an invalid type ; expected: 'Text'\", index - 1));")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t\t}")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t};")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<Text *> {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n static inline Text *Get(HSQUIRRELVM vm, int index) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n if (sq_gettype(vm, index) == OT_INSTANCE) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n return Param<ScriptText *>::Get(vm, index);")
|
||||
string(APPEND SQUIRREL_EXPORT "\n }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n if (sq_gettype(vm, index) == OT_STRING) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n return new RawText(Param<const std::string &>::Get(vm, index));")
|
||||
string(APPEND SQUIRREL_EXPORT "\n }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n return nullptr;")
|
||||
string(APPEND SQUIRREL_EXPORT "\n }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n };")
|
||||
else()
|
||||
string(APPEND SQUIRREL_EXPORT "\n\ttemplate <> struct Return<${NAME} *> { static inline int Set(HSQUIRRELVM vm, ${NAME} *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, \"${REALNAME}\", res, nullptr, DefSQDestructorCallback<${NAME}>, true); return 1; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Return<${NAME} *> { static inline int Set(HSQUIRRELVM vm, ${NAME} *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, \"${REALNAME}\", res, nullptr, DefSQDestructorCallback<${NAME}>, true); return 1; } };")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@ -73,6 +63,7 @@ macro(reset_reader)
|
||||
unset(STATIC_METHODS)
|
||||
unset(CLS)
|
||||
unset(START_SQUIRREL_DEFINE_ON_NEXT_LINE)
|
||||
set(CLS_LEVEL 0)
|
||||
unset(CLS_IN_API)
|
||||
endmacro()
|
||||
|
||||
@ -81,9 +72,6 @@ reset_reader()
|
||||
file(STRINGS "${SCRIPT_API_FILE}" SOURCE_LINES)
|
||||
|
||||
set(NUM_LINE 0)
|
||||
set(CLS_LEVEL 0)
|
||||
set(BRACE_LEVEL 0)
|
||||
|
||||
macro(doxygen_check)
|
||||
if(NOT "${DOXYGEN_SKIP}" STREQUAL "")
|
||||
message(FATAL_ERROR "${SCRIPT_API_FILE}:${NUM_LINE}: a DOXYGEN_API block was not properly closed")
|
||||
@ -119,7 +107,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
if("${LINE}" MATCHES "^([\t ]*)\\* @api (.*)$")
|
||||
if("${LINE}" MATCHES "^([ ]*)\\* @api (.*)$")
|
||||
set(LINE ${CMAKE_MATCH_2})
|
||||
# By default, classes are not selected
|
||||
if(NOT CLS_LEVEL)
|
||||
@ -157,28 +145,22 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
# Count braces to skip function bodies
|
||||
string(REGEX REPLACE "[^{]" "" OPENING_BRACES "${LINE}")
|
||||
string(LENGTH "${OPENING_BRACES}" OPENING_BRACES)
|
||||
string(REGEX REPLACE "[^}]" "" CLOSING_BRACES "${LINE}")
|
||||
string(LENGTH "${CLOSING_BRACES}" CLOSING_BRACES)
|
||||
math(EXPR BRACE_LEVEL "${BRACE_LEVEL} + ${OPENING_BRACES} - ${CLOSING_BRACES}")
|
||||
|
||||
# Ignore forward declarations of classes
|
||||
if("${LINE}" MATCHES "^(\t*)class(.*);")
|
||||
if("${LINE}" MATCHES "^( *)class(.*);")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
# We only want to have public functions exported for now
|
||||
if("${LINE}" MATCHES "^(\t*)class (.*) (: public|: protected|: private|:) ([^ ]*)")
|
||||
if("${LINE}" MATCHES "^( *)class (.*) (: public|: protected|: private|:) ([^ ]*)")
|
||||
if(NOT CLS_LEVEL)
|
||||
if(NOT DEFINED API_SELECTED)
|
||||
message(WARNING "${SCRIPT_API_FILE}:${NUM_LINE}: Class '${CMAKE_MATCH_2}' has no @api. It won't be published to any API.")
|
||||
message(WARNING "Class '${CMAKE_MATCH_2}' has no @api. It won't be published to any API.")
|
||||
set(API_SELECTED FALSE)
|
||||
endif()
|
||||
unset(IS_PUBLIC)
|
||||
unset(CLS_PARAMS)
|
||||
set(CLS_TYPES "x")
|
||||
unset(CLS_PARAM_0)
|
||||
set(CLS_PARAM_1 1)
|
||||
set(CLS_PARAM_2 "x")
|
||||
set(CLS_IN_API ${API_SELECTED})
|
||||
unset(API_SELECTED)
|
||||
set(CLS "${CMAKE_MATCH_2}")
|
||||
@ -196,19 +178,19 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
math(EXPR CLS_LEVEL "${CLS_LEVEL} + 1")
|
||||
continue()
|
||||
endif()
|
||||
if("${LINE}" MATCHES "^(\t*)public")
|
||||
if("${LINE}" MATCHES "^( *)public")
|
||||
if(CLS_LEVEL EQUAL 1)
|
||||
set(IS_PUBLIC TRUE)
|
||||
endif()
|
||||
continue()
|
||||
endif()
|
||||
if("${LINE}" MATCHES "^(\t*)protected")
|
||||
if("${LINE}" MATCHES "^( *)protected")
|
||||
if(CLS_LEVEL EQUAL 1)
|
||||
unset(IS_PUBLIC)
|
||||
endif()
|
||||
continue()
|
||||
endif()
|
||||
if("${LINE}" MATCHES "^(\t*)private")
|
||||
if("${LINE}" MATCHES "^( *)private")
|
||||
if(CLS_LEVEL EQUAL 1)
|
||||
unset(IS_PUBLIC)
|
||||
endif()
|
||||
@ -236,7 +218,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
endif()
|
||||
|
||||
# We need to make specialized conversions for structs
|
||||
if("${LINE}" MATCHES "^(\t*)struct ([^ ]*)")
|
||||
if("${LINE}" MATCHES "^( *)struct ([^ ]*)")
|
||||
math(EXPR CLS_LEVEL "${CLS_LEVEL} + 1")
|
||||
|
||||
# Check if we want to publish this struct
|
||||
@ -258,7 +240,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
endif()
|
||||
|
||||
# We need to make specialized conversions for enums
|
||||
if("${LINE}" MATCHES "^(\t*)enum ([^ ]*)")
|
||||
if("${LINE}" MATCHES "^( *)enum ([^ ]*)")
|
||||
math(EXPR CLS_LEVEL "${CLS_LEVEL} + 1")
|
||||
|
||||
# Check if we want to publish this enum
|
||||
@ -281,7 +263,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
endif()
|
||||
|
||||
# Maybe the end of the class, if so we can start with the Squirrel export pretty soon
|
||||
if(BRACE_LEVEL LESS CLS_LEVEL)
|
||||
if("${LINE}" MATCHES "};")
|
||||
math(EXPR CLS_LEVEL "${CLS_LEVEL} - 1")
|
||||
if(CLS_LEVEL)
|
||||
unset(IN_ENUM)
|
||||
@ -295,7 +277,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
endif()
|
||||
|
||||
# Empty/white lines. When we may do the Squirrel export, do that export.
|
||||
if("${LINE}" MATCHES "^([ \t]*)$")
|
||||
if("${LINE}" MATCHES "^([ ]*)$")
|
||||
if(NOT START_SQUIRREL_DEFINE_ON_NEXT_LINE)
|
||||
continue()
|
||||
endif()
|
||||
@ -319,17 +301,38 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
|
||||
if("${APIUC}" STREQUAL "Template")
|
||||
# First check whether we have enums to print
|
||||
if(DEFINED ENUMS)
|
||||
if(NOT NAMESPACE_OPENED)
|
||||
string(APPEND SQUIRREL_EXPORT "\nnamespace SQConvert {")
|
||||
set(NAMESPACE_OPENED TRUE)
|
||||
endif()
|
||||
string(APPEND SQUIRREL_EXPORT "\n /* Allow enums to be used as Squirrel parameters */")
|
||||
foreach(ENUM IN LISTS ENUMS)
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<${ENUM}> { static inline ${ENUM} Get(HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (${ENUM})tmp; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Return<${ENUM}> { static inline int Set(HSQUIRRELVM vm, ${ENUM} res) { sq_pushinteger(vm, res); return 1; } };")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Then check whether we have structs/classes to print
|
||||
if(DEFINED STRUCTS)
|
||||
open_namespace()
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t/* Allow inner classes/structs to be used as Squirrel parameters */")
|
||||
if(NOT NAMESPACE_OPENED)
|
||||
string(APPEND SQUIRREL_EXPORT "\nnamespace SQConvert {")
|
||||
set(NAMESPACE_OPENED TRUE)
|
||||
endif()
|
||||
string(APPEND SQUIRREL_EXPORT "\n /* Allow inner classes/structs to be used as Squirrel parameters */")
|
||||
foreach(STRUCT IN LISTS STRUCTS)
|
||||
dump_class_templates(${STRUCT})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
open_namespace()
|
||||
string(APPEND SQUIRREL_EXPORT "\n\t/* Allow ${CLS} to be used as Squirrel parameter */")
|
||||
if(NOT NAMESPACE_OPENED)
|
||||
string(APPEND SQUIRREL_EXPORT "\nnamespace SQConvert {")
|
||||
set(NAMESPACE_OPENED TRUE)
|
||||
else()
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
endif()
|
||||
string(APPEND SQUIRREL_EXPORT "\n /* Allow ${CLS} to be used as Squirrel parameter */")
|
||||
dump_class_templates(${CLS})
|
||||
|
||||
string(APPEND SQUIRREL_EXPORT "\n} // namespace SQConvert")
|
||||
@ -339,23 +342,23 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
endif()
|
||||
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
string(APPEND SQUIRREL_EXPORT "\ntemplate <> SQInteger PushClassName<${CLS}, ScriptType::${APIUC}>(HSQUIRRELVM vm) { sq_pushstring(vm, \"${API_CLS}\"); return 1; }")
|
||||
string(APPEND SQUIRREL_EXPORT "\ntemplate <> const char *GetClassName<${CLS}, ScriptType::${APIUC}>() { return \"${API_CLS}\"; }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
|
||||
# Then do the registration functions of the class.
|
||||
string(APPEND SQUIRREL_EXPORT "\nvoid SQ${API_CLS}_Register(Squirrel &engine)")
|
||||
string(APPEND SQUIRREL_EXPORT "\nvoid SQ${API_CLS}_Register(Squirrel *engine)")
|
||||
string(APPEND SQUIRREL_EXPORT "\n{")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tDefSQClass<${CLS}, ScriptType::${APIUC}> SQ${API_CLS}(\"${API_CLS}\");")
|
||||
if("${SUPER_CLS}" STREQUAL "Text")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tSQ${API_CLS}.PreRegister(engine);")
|
||||
string(APPEND SQUIRREL_EXPORT "\n DefSQClass<${CLS}, ScriptType::${APIUC}> SQ${API_CLS}(\"${API_CLS}\");")
|
||||
if("${SUPER_CLS}" STREQUAL "Text" OR "${SUPER_CLS}" STREQUAL "ScriptObject" OR "${SUPER_CLS}" STREQUAL "AIAbstractiveList::Valuator")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.PreRegister(engine);")
|
||||
else()
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tSQ${API_CLS}.PreRegister(engine, \"${API_SUPER_CLS}\");")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.PreRegister(engine, \"${API_SUPER_CLS}\");")
|
||||
endif()
|
||||
if((DEFINED CLS_PARAMS OR DEFINED METHODS) AND NOT "${SUPER_CLS}" MATCHES "^ScriptEvent" AND NOT "${CLS}" STREQUAL "ScriptEvent")
|
||||
if("${CLS_TYPES}" STREQUAL "v")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tSQ${API_CLS}.AddSQAdvancedConstructor(engine);")
|
||||
if(NOT "${SUPER_CLS}" MATCHES "^ScriptEvent")
|
||||
if("${CLS_PARAM_2}" STREQUAL "v")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.AddSQAdvancedConstructor(engine);")
|
||||
else()
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tSQ${API_CLS}.AddConstructor<void (${CLS}::*)(${CLS_PARAMS})>(engine, \"${CLS_TYPES}\");")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.AddConstructor<void (${CLS}::*)(${CLS_PARAM_0}), ${CLS_PARAM_1}>(engine, \"${CLS_PARAM_2}\");")
|
||||
endif()
|
||||
endif()
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
@ -375,7 +378,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
foreach(i RANGE ${LEN})
|
||||
string(APPEND SPACES " ")
|
||||
endforeach()
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tSQ${API_CLS}.DefSQConst(engine, ${CLS}::${ENUM_VALUE},${SPACES}\"${ENUM_VALUE}\");")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQConst(engine, ${CLS}::${ENUM_VALUE},${SPACES}\"${ENUM_VALUE}\");")
|
||||
endforeach()
|
||||
if(MLEN)
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
@ -396,7 +399,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
foreach(i RANGE ${LEN})
|
||||
string(APPEND SPACES " ")
|
||||
endforeach()
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tSQ${API_CLS}.DefSQConst(engine, ${CLS}::${CONST_VALUE},${SPACES}\"${CONST_VALUE}\");")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQConst(engine, ${CLS}::${CONST_VALUE},${SPACES}\"${CONST_VALUE}\");")
|
||||
endforeach()
|
||||
if(MLEN)
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
@ -422,7 +425,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
foreach(i RANGE ${LEN})
|
||||
string(APPEND SPACES " ")
|
||||
endforeach()
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tScriptError::RegisterErrorMap(${ENUM_STRING},${SPACES}${CLS}::${ENUM_ERROR});")
|
||||
string(APPEND SQUIRREL_EXPORT "\n ScriptError::RegisterErrorMap(${ENUM_STRING},${SPACES}${CLS}::${ENUM_ERROR});")
|
||||
endforeach()
|
||||
if(MLEN)
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
@ -443,7 +446,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
foreach(i RANGE ${LEN})
|
||||
string(APPEND SPACES " ")
|
||||
endforeach()
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tScriptError::RegisterErrorMapString(${CLS}::${ENUM_ERROR_TO_STRING},${SPACES}\"${ENUM_ERROR_TO_STRING}\");")
|
||||
string(APPEND SQUIRREL_EXPORT "\n ScriptError::RegisterErrorMapString(${CLS}::${ENUM_ERROR_TO_STRING},${SPACES}\"${ENUM_ERROR_TO_STRING}\");")
|
||||
endforeach()
|
||||
if(MLEN)
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
@ -462,7 +465,8 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
foreach(STATIC_METHOD IN LISTS STATIC_METHODS)
|
||||
string(REPLACE ":" ";" STATIC_METHOD "${STATIC_METHOD}")
|
||||
list(GET STATIC_METHOD 0 FUNCNAME)
|
||||
list(GET STATIC_METHOD 1 TYPES)
|
||||
list(GET STATIC_METHOD 1 ARGC)
|
||||
list(GET STATIC_METHOD 2 TYPES)
|
||||
string(LENGTH "${FUNCNAME}" LEN)
|
||||
math(EXPR LEN "${MLEN} - ${LEN}")
|
||||
if("${TYPES}" STREQUAL "v")
|
||||
@ -477,9 +481,9 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
string(APPEND SPACES " ")
|
||||
endforeach()
|
||||
if("${TYPES}" STREQUAL "v")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tSQ${API_CLS}.DefSQAdvancedStaticMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\");")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQAdvancedStaticMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\");")
|
||||
else()
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tSQ${API_CLS}.DefSQStaticMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\",${SPACES}\"${TYPES}\");")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQStaticMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\",${SPACES}${ARGC}, \"${TYPES}\");")
|
||||
endif()
|
||||
endforeach()
|
||||
if(MLEN)
|
||||
@ -499,7 +503,8 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
foreach(METHOD IN LISTS METHODS)
|
||||
string(REPLACE ":" ";" METHOD "${METHOD}")
|
||||
list(GET METHOD 0 FUNCNAME)
|
||||
list(GET METHOD 1 TYPES)
|
||||
list(GET METHOD 1 ARGC)
|
||||
list(GET METHOD 2 TYPES)
|
||||
string(LENGTH "${FUNCNAME}" LEN)
|
||||
math(EXPR LEN "${MLEN} - ${LEN}")
|
||||
if("${TYPES}" STREQUAL "v")
|
||||
@ -514,16 +519,16 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
string(APPEND SPACES " ")
|
||||
endforeach()
|
||||
if("${TYPES}" STREQUAL "v")
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tSQ${API_CLS}.DefSQAdvancedMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\");")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQAdvancedMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\");")
|
||||
else()
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tSQ${API_CLS}.DefSQMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\",${SPACES}\"${TYPES}\");")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.DefSQMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\",${SPACES}${ARGC}, \"${TYPES}\");")
|
||||
endif()
|
||||
endforeach()
|
||||
if(MLEN)
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
endif()
|
||||
|
||||
string(APPEND SQUIRREL_EXPORT "\n\tSQ${API_CLS}.PostRegister(engine);")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.PostRegister(engine);")
|
||||
string(APPEND SQUIRREL_EXPORT "\n}")
|
||||
|
||||
reset_reader()
|
||||
@ -536,13 +541,9 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
if(NOT BRACE_LEVEL EQUAL CLS_LEVEL)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
# Add enums
|
||||
if(IN_ENUM)
|
||||
string(REGEX MATCH "([^,\t ]+)" ENUM_VALUE "${LINE}")
|
||||
string(REGEX MATCH "([^, ]+)" ENUM_VALUE "${LINE}")
|
||||
list(APPEND ENUM_VALUES "${ENUM_VALUE}")
|
||||
|
||||
# Check if this a special error enum
|
||||
@ -550,12 +551,12 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
if("${ENUM}" MATCHES ".*::ErrorMessages")
|
||||
# syntax:
|
||||
# enum ErrorMessages {
|
||||
#\tERR_SOME_ERROR,\t// [STR_ITEM1, STR_ITEM2, ...]
|
||||
# ERR_SOME_ERROR, // [STR_ITEM1, STR_ITEM2, ...]
|
||||
# }
|
||||
|
||||
# Set the mappings
|
||||
if("${LINE}" MATCHES "\\[(.*)\\]")
|
||||
string(REGEX REPLACE "[ \t]" "" MAPPINGS "${CMAKE_MATCH_1}")
|
||||
string(REGEX REPLACE "[ ]" "" MAPPINGS "${CMAKE_MATCH_1}")
|
||||
string(REPLACE "," ";" MAPPINGS "${MAPPINGS}")
|
||||
|
||||
foreach(MAPPING IN LISTS MAPPINGS)
|
||||
@ -569,11 +570,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
endif()
|
||||
|
||||
# Add a const (non-enum) value
|
||||
if("${LINE}" MATCHES "^[ \t]*static const [^ ]+ ([^ ]+) = -?\\(?[^ ]*\\)?[^ ]+;")
|
||||
list(APPEND CONST_VALUES "${CMAKE_MATCH_1}")
|
||||
continue()
|
||||
endif()
|
||||
if("${LINE}" MATCHES "^[ \t]*static constexpr [^ ]+ ([^ ]+) = -?\\(?[^ ]*\\)?[^ ]+;")
|
||||
if("${LINE}" MATCHES "^[ ]*static const [^ ]+ ([^ ]+) = -?\\(?[^ ]*\\)?[^ ]+;")
|
||||
list(APPEND CONST_VALUES "${CMAKE_MATCH_1}")
|
||||
continue()
|
||||
endif()
|
||||
@ -585,43 +582,41 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
endif()
|
||||
if("${LINE}" MATCHES "~")
|
||||
if(DEFINED API_SELECTED)
|
||||
message(WARNING "${SCRIPT_API_FILE}:${NUM_LINE}: Destructor for '${CLS}' has @api. Tag ignored.")
|
||||
message(WARNING "Destructor for '${CLS}' has @api. Tag ignored.")
|
||||
unset(API_SELECTED)
|
||||
endif()
|
||||
continue()
|
||||
endif()
|
||||
|
||||
unset(IS_STATIC)
|
||||
if("${LINE}" MATCHES "static ")
|
||||
if("${LINE}" MATCHES "static")
|
||||
set(IS_STATIC TRUE)
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE "(virtual|static|const)[ \t]+" "" LINE "${LINE}")
|
||||
string(REGEX REPLACE "(virtual|static|const)[ ]+" "" LINE "${LINE}")
|
||||
string(REGEX REPLACE "{.*" "" LINE "${LINE}")
|
||||
set(PARAM_S "${LINE}")
|
||||
string(REGEX REPLACE "\\*" "" LINE "${LINE}")
|
||||
string(REGEX REPLACE "\\(.*" "" LINE "${LINE}")
|
||||
|
||||
# Parameters start at first "(". Further "(" will appear in ctor lists.
|
||||
string(REGEX MATCH "\\(.*" PARAM_S "${PARAM_S}")
|
||||
string(REGEX REPLACE ".*\\(" "" PARAM_S "${PARAM_S}")
|
||||
string(REGEX REPLACE "\\).*" "" PARAM_S "${PARAM_S}")
|
||||
string(REGEX REPLACE "^\\(" "" PARAM_S "${PARAM_S}")
|
||||
|
||||
string(REGEX MATCH "([^ \t]+)( ([^ ]+))?" RESULT "${LINE}")
|
||||
string(REGEX MATCH "([^ ]+)( ([^ ]+))?" RESULT "${LINE}")
|
||||
set(FUNCTYPE "${CMAKE_MATCH_1}")
|
||||
set(FUNCNAME "${CMAKE_MATCH_3}")
|
||||
if("${FUNCTYPE}" STREQUAL "${CLS}" AND NOT FUNCNAME)
|
||||
if(DEFINED API_SELECTED)
|
||||
message(WARNING "${SCRIPT_API_FILE}:${NUM_LINE}: Constructor for '${CLS}' has @api. Tag ignored.")
|
||||
message(WARNING "Constructor for '${CLS}' has @api. Tag ignored.")
|
||||
unset(API_SELECTED)
|
||||
endif()
|
||||
set(CLS_PARAMS "${PARAM_S}")
|
||||
set(CLS_PARAM_0 "${PARAM_S}")
|
||||
if(NOT PARAM_S)
|
||||
continue()
|
||||
endif()
|
||||
elseif(NOT FUNCNAME)
|
||||
continue()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(REPLACE "," ";" PARAMS "${PARAM_S}")
|
||||
if(IS_STATIC)
|
||||
@ -630,7 +625,9 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
set(TYPES "x")
|
||||
endif()
|
||||
|
||||
set(LEN 1)
|
||||
foreach(PARAM IN LISTS PARAMS)
|
||||
math(EXPR LEN "${LEN} + 1")
|
||||
string(STRIP "${PARAM}" PARAM)
|
||||
if("${PARAM}" MATCHES "\\*|&")
|
||||
if("${PARAM}" MATCHES "^char")
|
||||
@ -669,12 +666,13 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
unset(API_SELECTED)
|
||||
|
||||
if("${FUNCTYPE}" STREQUAL "${CLS}" AND NOT FUNCNAME)
|
||||
set(CLS_TYPES "${TYPES}")
|
||||
set(CLS_PARAM_1 ${LEN})
|
||||
set(CLS_PARAM_2 "${TYPES}")
|
||||
elseif("${FUNCNAME}" MATCHES "^_" AND NOT "${TYPES}" STREQUAL "v")
|
||||
elseif(IS_STATIC)
|
||||
list(APPEND STATIC_METHODS "${FUNCNAME}:${TYPES}")
|
||||
list(APPEND STATIC_METHODS "${FUNCNAME}:${LEN}:${TYPES}")
|
||||
else()
|
||||
list(APPEND METHODS "${FUNCNAME}:${TYPES}")
|
||||
list(APPEND METHODS "${FUNCNAME}:${LEN}:${TYPES}")
|
||||
endif()
|
||||
continue()
|
||||
endif()
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
if(NOT INCLUDES_SOURCE_FILE)
|
||||
message(FATAL_ERROR "Script needs INCLUDES_SOURCE_FILE defined")
|
||||
@ -19,7 +19,7 @@ endif()
|
||||
file(READ "${API_FILES}" SCRIPT_API_BINARY_FILES)
|
||||
|
||||
foreach(FILE IN LISTS SCRIPT_API_BINARY_FILES)
|
||||
file(STRINGS "${FILE}" LINES REGEX "^void SQ${APIUC}.*_Register\\(Squirrel &engine\\)$")
|
||||
file(STRINGS "${FILE}" LINES REGEX "^void SQ${APIUC}.*_Register\\(Squirrel \\*engine\\)$")
|
||||
if(LINES)
|
||||
string(REGEX REPLACE ".*api/${APILC}/(.*)" "#include \"\\1\"" FILE "${FILE}")
|
||||
list(APPEND SQUIRREL_INCLUDES "${FILE}")
|
||||
@ -28,7 +28,7 @@ foreach(FILE IN LISTS SCRIPT_API_BINARY_FILES)
|
||||
continue()
|
||||
endif()
|
||||
string(REGEX REPLACE "^.*void " " " LINE "${LINE}")
|
||||
string(REGEX REPLACE "Squirrel &" "" LINE "${LINE}")
|
||||
string(REGEX REPLACE "Squirrel \\*" "" LINE "${LINE}")
|
||||
list(APPEND SQUIRREL_REGISTER "${LINE}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
@ -223,7 +223,7 @@ Last updated: 2024-03-26
|
||||
|
||||
## 5.1) Receiving chat
|
||||
|
||||
Register `ADMIN_UPDATE_CHAT` at `AdminUpdateFrequency::Automatic` to receive chat.
|
||||
Register `ADMIN_UPDATE_CHAT` at `ADMIN_FREQUENCY_AUTOMATIC` to receive chat.
|
||||
The application will be able to receive all chat the server can see.
|
||||
|
||||
The configuration option `network.server_admin_chat` specifies whether
|
||||
|
@ -1,62 +0,0 @@
|
||||
# Fonts for OpenTTD
|
||||
|
||||
OpenTTD uses four different fonts:
|
||||
- a medium font (used for most texts in the game)
|
||||
- a small font (used for the smallmap legend etc)
|
||||
- a large font (used for news headlines etc)
|
||||
- a monospace font (used for text files such as NewGRF readmes).
|
||||
|
||||
You can use the following types of fonts with OpenTTD:
|
||||
|
||||
## OpenTTD's default fonts
|
||||
|
||||
These fonts are OpenTTD Sans (small and medium), OpenTTD Serif (large) and OpenTTD Mono (monospace). They are distributed as part of OpenTTD since version 14. The font files are included in the baseset directory of OpenTTD.
|
||||
|
||||
These fonts are active by default and support the Latin, Greek and Cyrillic scripts at present.
|
||||
|
||||
## Traditional sprite fonts
|
||||
|
||||
These are the classic bitmap fonts included as part of the base graphics. They support only the Latin script.
|
||||
|
||||
These fonts can be activated in the Graphics section of the Game options window, by enabling the option "Use traditional sprite fonts".
|
||||
|
||||
## System fonts
|
||||
|
||||
These are fonts installed on your computer. OpenTTD tries to automatically detect and activate a suitable system font in case you have selected a language not supported by the default fonts. However, if this fails, you may have to set a font manually.
|
||||
|
||||
There are two ways to manually set system fonts, using the `font` console command or editing the openttd.cfg file.
|
||||
|
||||
### Using the console
|
||||
|
||||
Open the console. On most keyboards, this is done by pressing the key to the left of 1 (\` on most English keyboards).
|
||||
|
||||
The command to change a font is `font [medium|small|large|mono] [<font name>] [<size>]`.
|
||||
For example, `font large "Times New Roman" 16`.
|
||||
|
||||
The font name should be enclosed in double quotes if it contains spaces. Note that the size provided is multiplied by the interface scaling factor.
|
||||
|
||||
You can reset the font and size to the defaults by providing the font name "" (a blank font name). This will result in the OpenTTD default font or sprite font (depending on the setting) if you are using a supported language, or a default font determined by your OS otherwise.
|
||||
|
||||
You can view the current font configuration by running the command `font` without any arguments.
|
||||
|
||||
For more information, run the command `help font`.
|
||||
|
||||
### Using openttd.cfg
|
||||
|
||||
In openttd.cfg, the following settings under the `[misc]` section determine the font (this is just an example):
|
||||
```
|
||||
small_font =
|
||||
medium_font = Arial Bold
|
||||
large_font = Times New Roman
|
||||
mono_font =
|
||||
small_size = 6
|
||||
medium_size = 10
|
||||
large_size = 18
|
||||
mono_size = 10
|
||||
```
|
||||
|
||||
If these settings are not present, you can add them under the `[misc]` section.
|
||||
|
||||
If any font names are left blank, the default font and size are used.
|
||||
|
||||
If you cannot find the openttd.cfg file, see [the directory structure guide](./directory_structure.md).
|
@ -64,7 +64,7 @@
|
||||
<tr bgcolor="#CCCCCC"><td colspan="2">Only meaningful in tropic climate. It contains the definition of the available zones</td></tr>
|
||||
<tr><td style="width: 5em;"><tt>00</tt></td><td>normal</td></tr>
|
||||
<tr><td><tt>01</tt></td><td>desert</td></tr>
|
||||
<tr><td><tt>02</tt></td><td>rainforest</td></tr>
|
||||
<tr><td><tt>02</tt></td><td>rain forest</td></tr>
|
||||
</table>
|
||||
In any other climate these 2 bits are theoretically free of use, however using them does not seem useful.
|
||||
</li>
|
||||
@ -721,8 +721,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<li>m3 bit 6 : free</li>
|
||||
<li>m3 bit 5 : The house is protected from the town upgrading it</li>
|
||||
<li>m3 bits 6..5 : free</li>
|
||||
<li>m3 bits 4..0 : triggers activated <a href="#newhouses">(newhouses)</a></li>
|
||||
<li>m4 : free</li>
|
||||
<li>m5 : see m3 bit 7</li>
|
||||
|
@ -156,7 +156,7 @@ the array so you can quickly see what is used and what is not.
|
||||
<td class="caption">finished house</td>
|
||||
<td class="bits" rowspan=2><span class="used" title="House random bits">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="pool" title="Town index on pool">XXXX XXXX XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="House is complete/in construction (see m5)">1</span><span class="free">O</span><span class="used" title="The house is protected from the town upgrading it.">X</span><span class="usable" title="Activated triggers (bits 2..4 don't have a meaning)">X XX</span><span class="used" title="Activated triggers (bits 2..4 don't have a meaning)">XX</span></td>
|
||||
<td class="bits"><span class="used" title="House is complete/in construction (see m5)">1</span><span class="free">OO</span><span class="usable" title="Activated triggers (bits 2..4 don't have a meaning)">X XX</span><span class="used" title="Activated triggers (bits 2..4 don't have a meaning)">XX</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Age in years, clamped at 255">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="abuse" title="Newhouses activated: periodic processing time remaining; if not, lift position for houses 04 and 05">XXXX XX</span><span class="used" title="Animated tile state">XX</span></td>
|
||||
@ -165,7 +165,7 @@ the array so you can quickly see what is used and what is not.
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">house under construction</td>
|
||||
<td class="bits"><span class="used" title="House is complete/in construction (see m5)">O</span><span class="used" title="House type (m4 + m3[6])">X</span><span class="used" title="The house is protected from the town upgrading it.">X</span><span class="usable" title="Activated triggers (bits 2..4 don't have a meaning)">X XX</span><span class="used" title="Activated triggers (bits 2..4 don't have a meaning)">XX</span></td>
|
||||
<td class="bits"><span class="used" title="House is complete/in construction (see m5)">O</span><span class="used" title="House type (m4 + m3[6])">X</span><span class="free">O</span><span class="usable" title="Activated triggers (bits 2..4 don't have a meaning)">X XX</span><span class="used" title="Activated triggers (bits 2..4 don't have a meaning)">XX</span></td>
|
||||
<td class="bits"><span class="free">OOO</span><span class="used" title="Construction stage">X X</span><span class="used" title="Construction counter">XXX</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -16,11 +16,8 @@
|
||||
; - `openttd -I <name>` starts OpenTTD with the given set (case sensitive)
|
||||
; - adding `graphicsset = <name>` to the misc section of openttd.cfg makes
|
||||
; OpenTTD start with that graphics set by default
|
||||
; - `grfid -m` can give the GRF file MD5 checksums that you need
|
||||
; - The `--md5` output option for `nmlc` can also give the MD5 if you are
|
||||
; encoding from an nml source
|
||||
; - Simple file MD5 checksums, eg. using `md5sum` are not correct for grf
|
||||
; container versions other than 1
|
||||
; - there is a command line tool for all platforms called md5sum that can
|
||||
; create the MD5 checksum you need.
|
||||
; - all files specified in this file are search relatively to the path where
|
||||
; this file is found, i.e. if the graphics files are in a subdir you have
|
||||
; to add that subdir to the names in this file to! It will NOT search for
|
||||
@ -47,8 +44,6 @@ description.en_US = howdie
|
||||
palette = DOS
|
||||
; preferred blitter, optional; either 8bpp (default) or 32bpp.
|
||||
blitter = 8bpp
|
||||
; url, optional
|
||||
url = https://github.com/my/baseset
|
||||
|
||||
; The files section lists the files that replace sprites.
|
||||
; The file names are case sensitive.
|
||||
|
@ -8,10 +8,10 @@ This guide is for OpenTTD developers/maintainers, to release a new version of Op
|
||||
|
||||
* If this is an RC1 (first Release Candidate) build, create a new branch `release/nn` where `nn` is the major version number, then apply changes similar to [PR#9573](https://github.com/OpenTTD/OpenTTD/pull/9573). You also need to forwardport the changelog, as in [PR#10113](https://github.com/OpenTTD/OpenTTD/pull/10113).
|
||||
* Update the version in `CMakeLists.txt` in the master branch, heading for the next major release, e.g. from 14.0 to 15.0.
|
||||
* Add the new version to `ApiVersions` in `src/ai/ai_info.hpp` and `src/game/game_info.hpp`.
|
||||
* Add the new version to `src/script/api/ai_changelog.hpp` and `src/script/api/game_changelog.hpp`.
|
||||
* Update the version of regression in `bin/ai/regression/regression_info.nut`.
|
||||
* Add a new (empty) AI compatibility script in `bin/ai/` and `bin/game/` for the version of the branch.
|
||||
* Add a new (empty) AI compatibility script in `bin/ai/`
|
||||
* Add the new version to CheckAPIVersion in `src/ai/ai_info.cpp` and `src/game/game_info.cpp`
|
||||
* Add the new version to `src/script/api/ai_changelog.hpp` and `src/script/api/game_changelog.hpp`
|
||||
* Update the version of regression in `bin/ai/regression/regression_info.nut`
|
||||
* Add a note to `src/saveload/saveload.h` about which savegame version is used in the branch.
|
||||
|
||||
* If this is a later RC or release build and the release branch already exists, you'll need to backport fixes and language from master to this branch, which were merged after the branch diverged from master. You can use these two helper scripts: https://github.com/OpenTTD/scripts/tree/main/backport
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
## Table of contents
|
||||
|
||||
- 1.0) [About](#10-about)
|
||||
- 2.0) [Known bugs](#20-known-bugs)
|
||||
- 1.0) About
|
||||
- 2.0) Known bugs
|
||||
|
||||
## 1.0) About
|
||||
|
||||
@ -12,7 +12,7 @@ that are the same as these. If you do, do not act surprised, because
|
||||
we WILL flame you!
|
||||
|
||||
The current list of known bugs that we intend to fix can be found in our
|
||||
bug tracking system at [https://github.com/OpenTTD/OpenTTD/issues](https://github.com/OpenTTD/OpenTTD/issues)
|
||||
bug tracking system at https://github.com/OpenTTD/OpenTTD/issues
|
||||
Also check the closed bugs when searching for your bug in this system as we
|
||||
might have fixed the bug in the mean time.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# OpenTTD TrueType font
|
||||
|
||||
The OpenTTD TrueType font was created by Zephyris and is maintained on [Github](https://github.com/OpenTTD/OpenTTD-TTF).
|
||||
The OpenTTD TrueType font was created by Zephyris and is maintained on [Github](https://github.com/zephyris/openttd-ttf).
|
||||
It is licensed under GPL-2.0.
|
||||
|
||||
The currently included files correspond to release v0.7.
|
||||
The currently included files correspond to release v0.6.
|
||||
|
@ -1 +1 @@
|
||||
a4a727b03a7cd07ee0499231f7f233f4
|
||||
8bc3926cb50e19747de498357417d973
|
||||
|
@ -18,7 +18,6 @@ if(GRFCODEC_FOUND)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/oneway.nfo
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttd.nfo
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttdgui.nfo
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/overlay_rocks.nfo
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/palette.nfo
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/roadstops.nfo
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/road_waypoints.nfo
|
||||
@ -43,11 +42,6 @@ if(GRFCODEC_FOUND)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttdgui_convert_road.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttdgui_convert_tram.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttdgui_group_livery.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/overlay_rocks.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/overlay_snowy_rocks_1.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/overlay_snowy_rocks_2.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/overlay_snowy_rocks_3.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/overlay_snowy_rocks_4.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/roadstops.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/road_waypoints.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/signals.png
|
||||
|
@ -671,9 +671,9 @@
|
||||
|
||||
// U+2026: Horizontal Ellipsis
|
||||
-1 * 18 12 04 00 01 26 20 01 01 26 20 02 01 26 20 03 01 26 20
|
||||
-1 sprites/chars.png 8bpp 560 370 9 12 0 -1 normal
|
||||
-1 sprites/chars.png 8bpp 560 370 11 12 0 -1 normal
|
||||
-1 sprites/chars.png 8bpp 560 390 5 7 0 0 normal
|
||||
-1 sprites/chars.png 8bpp 560 400 14 21 0 -2 normal
|
||||
-1 sprites/chars.png 8bpp 560 400 15 21 0 -2 normal
|
||||
-1 sprites/mono.png 8bpp 265 270 7 13 0 0 normal
|
||||
|
||||
// U+2039: Single Left-Pointing Angle Quotation Mark
|
||||
@ -840,7 +840,3 @@
|
||||
-1 sprites/chars.png 8bpp 630 400 6 21 0 -2 normal
|
||||
-1 sprites/mono.png 8bpp 325 270 7 13 0 0 normal
|
||||
-1 sprites/mono.png 8bpp 340 270 7 13 0 0 normal
|
||||
|
||||
// U+E29D: Small left arrow
|
||||
-1 * 6 12 01 01 01 9D E2
|
||||
-1 sprites/chars.png 8bpp 10 430 5 5 0 1 normal
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@ -99,4 +99,3 @@
|
||||
#include "tunnel_portals.nfo"
|
||||
#include "palette.nfo"
|
||||
#include "road_waypoints.nfo"
|
||||
#include "overlay_rocks.nfo"
|
||||
|
@ -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/>.
|
||||
//
|
||||
-1 * 0 0C "OpenTTD GUI graphics"
|
||||
-1 * 3 05 15 \b 192 // 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 146 8 64 31 -31 7 normal
|
||||
-1 sprites/openttdgui.png 8bpp 226 8 64 31 -31 7 normal
|
||||
@ -196,4 +196,3 @@
|
||||
-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
|
||||
-1 sprites/openttdgui.png 8bpp 605 440 8 10 0 0 normal
|
||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 44 KiB |
@ -1,112 +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/>.
|
||||
//
|
||||
-1 * 0 0C "Overlay rocks"
|
||||
-1 * 3 05 1A 5F
|
||||
|
||||
// Plain overlay rocks (unused...)
|
||||
-1 sprites/overlay_rocks.png 8bpp 1 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 81 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 161 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 241 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 321 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 401 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 481 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 561 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 641 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 721 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 801 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 881 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 961 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 1041 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 1121 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 1201 1 64 47 -31 -16 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 1281 1 64 15 -31 0 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 1361 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_rocks.png 8bpp 1441 1 64 31 -31 -8 normal
|
||||
|
||||
// Snowy rocks level 0
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 1 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 81 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 161 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 241 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 321 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 401 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 481 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 561 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 641 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 721 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 801 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 881 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 961 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 1041 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 1121 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 1201 1 64 47 -31 -16 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 1281 1 64 15 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 1361 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_1.png 8bpp 1441 1 64 31 -31 -8 normal
|
||||
|
||||
// Snowy rocks level 1
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 1 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 81 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 161 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 241 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 321 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 401 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 481 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 561 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 641 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 721 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 801 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 881 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 961 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 1041 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 1121 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 1201 1 64 47 -31 -16 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 1281 1 64 15 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 1361 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_2.png 8bpp 1441 1 64 31 -31 -8 normal
|
||||
|
||||
// Snowy rocks level 2
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 1 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 81 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 161 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 241 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 321 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 401 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 481 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 561 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 641 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 721 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 801 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 881 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 961 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 1041 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 1121 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 1201 1 64 47 -31 -16 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 1281 1 64 15 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 1361 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_3.png 8bpp 1441 1 64 31 -31 -8 normal
|
||||
|
||||
// Snowy rocks level 4
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 1 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 81 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 161 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 241 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 321 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 401 1 64 31 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 481 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 561 1 64 23 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 641 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 721 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 801 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 881 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 961 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 1041 1 64 39 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 1121 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 1201 1 64 47 -31 -16 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 1281 1 64 15 -31 0 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 1361 1 64 31 -31 -8 normal
|
||||
-1 sprites/overlay_snowy_rocks_4.png 8bpp 1441 1 64 31 -31 -8 normal
|
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 8.4 KiB |
@ -1,12 +1,3 @@
|
||||
# If you change this version, change the numbers in .github/workflows/ci-emscripten.yml (2x)
|
||||
# and .github/workflows/preview-build.yml (2x) too.
|
||||
FROM emscripten/emsdk:3.1.57
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y gcc-12 g++-12 \
|
||||
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \
|
||||
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY ports/liblzma.py /emsdk/upstream/emscripten/tools/ports/contrib/liblzma.py
|
||||
|
@ -1,7 +1,6 @@
|
||||
# LibLZMA is a custom addition to the emscripten SDK, so it is possible
|
||||
# someone patched their SDK. Test out if the SDK supports LibLZMA.
|
||||
include(CheckCXXSourceCompiles)
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_FLAGS "--use-port=contrib.liblzma")
|
||||
|
||||
check_cxx_source_compiles("
|
||||
@ -19,5 +18,3 @@ if (LIBLZMA_FOUND)
|
||||
else()
|
||||
message(WARNING "You are using an emscripten SDK without LibLZMA support. Many savegames won't be able to load in OpenTTD. Please copy liblzma.py to your ports/contrib folder in your local emsdk installation.")
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||
|
@ -24,7 +24,7 @@ if (!$Env:AZURE_CODESIGN_ENDPOINT -or !$Env:AZURE_CODESIGN_ACCOUNT_NAME -or !$En
|
||||
exit
|
||||
}
|
||||
|
||||
Install-Module -Name TrustedSigning -Scope CurrentUser -RequiredVersion 0.5.3 -Force -Repository PSGallery
|
||||
Install-Module -Name AzureCodeSigning -Scope CurrentUser -RequiredVersion 0.3.0 -Force -Repository PSGallery
|
||||
|
||||
$params = @{}
|
||||
|
||||
@ -37,4 +37,4 @@ $params["FileDigest"] = "SHA256"
|
||||
$params["TimestampRfc3161"] = "http://timestamp.acs.microsoft.com"
|
||||
$params["TimestampDigest"] = "SHA256"
|
||||
|
||||
Invoke-TrustedSigning @params
|
||||
Invoke-AzureCodeSigning @params
|
||||
|
@ -17,10 +17,6 @@ function Regression::TestInit()
|
||||
print(" IsValid(vehicle.plane_speed): " + AIGameSettings.IsValid("vehicle.plane_speed"));
|
||||
print(" vehicle.plane_speed: " + AIGameSettings.GetValue("vehicle.plane_speed"));
|
||||
require("require.nut");
|
||||
print(" TestEnum.value1: " + ::TestEnum.value1);
|
||||
print(" test_constant: " + ::test_constant);
|
||||
print(" TestEnum.value2: " + TestEnum.value2);
|
||||
print(" test_constant: " + test_constant);
|
||||
print(" min(6, 3): " + min(6, 3));
|
||||
print(" min(3, 6): " + min(3, 6));
|
||||
print(" max(6, 3): " + max(6, 3));
|
||||
@ -269,15 +265,15 @@ function Regression::Bridge()
|
||||
print(" Valid Bridges: " + j);
|
||||
|
||||
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33160));
|
||||
print(" GetBridgeType(): " + AIBridge.GetBridgeType(33160));
|
||||
print(" GetBridgeID(): " + AIBridge.GetBridgeID(33160));
|
||||
print(" RemoveBridge(): " + AIBridge.RemoveBridge(33155));
|
||||
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
|
||||
print(" GetOtherBridgeEnd(): " + AIBridge.GetOtherBridgeEnd(33160));
|
||||
print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VT_ROAD, 5, 33160, 33155));
|
||||
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33160));
|
||||
print(" GetBridgeType(): " + AIBridge.GetBridgeType(33160));
|
||||
print(" GetBridgeID(): " + AIBridge.GetBridgeID(33160));
|
||||
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33155));
|
||||
print(" GetBridgeType(): " + AIBridge.GetBridgeType(33155));
|
||||
print(" GetBridgeID(): " + AIBridge.GetBridgeID(33155));
|
||||
print(" GetOtherBridgeEnd(): " + AIBridge.GetOtherBridgeEnd(33160));
|
||||
print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VT_ROAD, 5, 33160, 33155));
|
||||
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
|
||||
@ -828,13 +824,6 @@ function Regression::List()
|
||||
print(" []:");
|
||||
print(" 4000 => " + list[4000]);
|
||||
|
||||
print(" clone:");
|
||||
local list3 = clone list;
|
||||
print(" Clone ListDump:");
|
||||
foreach (idx, val in list3) {
|
||||
print(" " + idx + " => " + val);
|
||||
}
|
||||
|
||||
list.Clear();
|
||||
print(" IsEmpty(): " + list.IsEmpty());
|
||||
|
||||
@ -867,12 +856,6 @@ function Regression::List()
|
||||
it = list.Next();
|
||||
print(" " + it + " => " + list.GetValue(it));
|
||||
}
|
||||
|
||||
print(" Clone ListDump:");
|
||||
foreach (idx, val in list3) {
|
||||
print(" " + idx + " => " + val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function Regression::Map()
|
||||
@ -1034,28 +1017,6 @@ function Regression::Order()
|
||||
foreach (idx, val in list) {
|
||||
print(" " + idx + " => " + val);
|
||||
}
|
||||
list = AIVehicleList_Station(3, AIVehicle.VT_ROAD);
|
||||
print(" Count(): " + list.Count());
|
||||
list.Valuate(AIVehicle.GetLocation);
|
||||
print(" Location ListDump:");
|
||||
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||
print(" " + i + " => " + list.GetValue(i));
|
||||
}
|
||||
print(" foreach():");
|
||||
foreach (idx, val in list) {
|
||||
print(" " + idx + " => " + val);
|
||||
}
|
||||
list = AIVehicleList_Station(3, AIVehicle.VT_RAIL);
|
||||
print(" Count(): " + list.Count());
|
||||
list.Valuate(AIVehicle.GetLocation);
|
||||
print(" Location ListDump:");
|
||||
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||
print(" " + i + " => " + list.GetValue(i));
|
||||
}
|
||||
print(" foreach():");
|
||||
foreach (idx, val in list) {
|
||||
print(" " + idx + " => " + val);
|
||||
}
|
||||
}
|
||||
|
||||
function Regression::RailTypeList()
|
||||
@ -1714,22 +1675,13 @@ function Regression::TownList()
|
||||
}
|
||||
|
||||
print(" HasStatue(): " + AITown.HasStatue(list.Begin()));
|
||||
print(" GetRoadReworkDuration(): " + AITown.GetRoadReworkDuration(list.Begin()));
|
||||
print(" GetExclusiveRightsCompany(): " + AITown.GetExclusiveRightsCompany(list.Begin()));
|
||||
print(" GetExclusiveRightsDuration(): " + AITown.GetExclusiveRightsDuration(list.Begin()));
|
||||
print(" IsActionAvailable(BUILD_STATUE): " + AITown.IsActionAvailable(list.Begin(), AITown.TOWN_ACTION_BUILD_STATUE));
|
||||
print(" PerformTownAction(BUILD_STATUE): " + AITown.PerformTownAction(list.Begin(), AITown.TOWN_ACTION_BUILD_STATUE));
|
||||
print(" IsActionAvailable(BUILD_STATUE): " + AITown.IsActionAvailable(list.Begin(), AITown.TOWN_ACTION_BUILD_STATUE));
|
||||
print(" HasStatue(): " + AITown.HasStatue(list.Begin()));
|
||||
print(" GetRoadReworkDuration(): " + AITown.GetRoadReworkDuration(list.Begin()));
|
||||
print(" IsActionAvailable(ROAD_REBUILD): " + AITown.IsActionAvailable(list.Begin(), AITown.TOWN_ACTION_ROAD_REBUILD));
|
||||
print(" PerformTownAction(ROAD_REBUILD): " + AITown.PerformTownAction(list.Begin(), AITown.TOWN_ACTION_ROAD_REBUILD));
|
||||
print(" IsActionAvailable(ROAD_REBUILD): " + AITown.IsActionAvailable(list.Begin(), AITown.TOWN_ACTION_ROAD_REBUILD));
|
||||
print(" GetRoadReworkDuration(): " + AITown.GetRoadReworkDuration(list.Begin()));
|
||||
print(" GetExclusiveRightsCompany(): " + AITown.GetExclusiveRightsCompany(list.Begin()));
|
||||
print(" GetExclusiveRightsDuration(): " + AITown.GetExclusiveRightsDuration(list.Begin()));
|
||||
print(" IsActionAvailable(BUY_RIGHTS): " + AITown.IsActionAvailable(list.Begin(), AITown.TOWN_ACTION_BUY_RIGHTS));
|
||||
print(" PerformTownAction(BUY_RIGHTS): " + AITown.PerformTownAction(list.Begin(), AITown.TOWN_ACTION_BUY_RIGHTS));
|
||||
print(" IsActionAvailable(BUY_RIGHTS): " + AITown.IsActionAvailable(list.Begin(), AITown.TOWN_ACTION_BUY_RIGHTS));
|
||||
print(" GetExclusiveRightsCompany(): " + AITown.GetExclusiveRightsCompany(list.Begin()));
|
||||
print(" GetExclusiveRightsDuration(): " + AITown.GetExclusiveRightsDuration(list.Begin()));
|
||||
}
|
||||
|
||||
function Regression::Tunnel()
|
||||
@ -2023,33 +1975,6 @@ function Regression::Math()
|
||||
print(" 13725 > -2147483648: " + ( 13725 > -2147483648));
|
||||
}
|
||||
|
||||
function Regression::PriorityQueue()
|
||||
{
|
||||
print("");
|
||||
print("--PriorityQueue--");
|
||||
local queue = AIPriorityQueue();
|
||||
print(" IsEmpty(): " + queue.IsEmpty());
|
||||
print(" Count(): " + queue.Count());
|
||||
print(" --Insert--")
|
||||
for (local i = 0; i < 10; i++) {
|
||||
print(" Insert(" + i + ", " + i + "): " + queue.Insert(i, i));
|
||||
}
|
||||
print(" Exists(5): " + queue.Exists(5));
|
||||
print(" Insert(5, 5): "+ queue.Insert(5, 5));
|
||||
print(" IsEmpty(): " + queue.IsEmpty());
|
||||
print(" Count(): " + queue.Count());
|
||||
local item = queue.Peek();
|
||||
print(" Peek(): " + item);
|
||||
print(" Count(): " + queue.Count());
|
||||
local item2 = queue.Pop();
|
||||
print(" Pop(): " + item2);
|
||||
print(" Count(): " + queue.Count());
|
||||
print(" " + item + " == " + item2 + " : " + (item == item2));
|
||||
print(" Clear(): " + queue.Clear());
|
||||
print(" IsEmpty(): " + queue.IsEmpty());
|
||||
print(" Count(): " + queue.Count());
|
||||
}
|
||||
|
||||
function Regression::Start()
|
||||
{
|
||||
this.TestInit();
|
||||
@ -2110,34 +2035,6 @@ function Regression::Start()
|
||||
print(" VehicleID: " + c.GetVehicleID());
|
||||
} break;
|
||||
|
||||
case AIEvent.ET_COMPANY_RENAMED: {
|
||||
local c = AIEventCompanyRenamed.Convert(e);
|
||||
print(" EventName: CompanyRenamed");
|
||||
print(" CompanyID: " + c.GetCompanyID());
|
||||
print(" CompanyName: " + c.GetNewName());
|
||||
} break;
|
||||
|
||||
case AIEvent.ET_PRESIDENT_RENAMED: {
|
||||
local c = AIEventPresidentRenamed.Convert(e);
|
||||
print(" EventName: PresidentRenamed");
|
||||
print(" CompanyID: " + c.GetCompanyID());
|
||||
print(" PresidentName: " + c.GetNewName());
|
||||
} break;
|
||||
|
||||
case AIEvent.ET_EXCLUSIVE_TRANSPORT_RIGHTS: {
|
||||
local c = AIEventExclusiveTransportRights.Convert(e);
|
||||
print(" EventName: ExclusiveTransportRights");
|
||||
print(" CompanyID: " + c.GetCompanyID());
|
||||
print(" TownID: " + c.GetTownID());
|
||||
} break;
|
||||
|
||||
case AIEvent.ET_ROAD_RECONSTRUCTION: {
|
||||
local c = AIEventRoadReconstruction.Convert(e);
|
||||
print(" EventName: RoadReconstruction");
|
||||
print(" CompanyID: " + c.GetCompanyID());
|
||||
print(" TownID: " + c.GetTownID());
|
||||
} break;
|
||||
|
||||
default:
|
||||
print(" Unknown Event");
|
||||
break;
|
||||
@ -2146,18 +2043,12 @@ function Regression::Start()
|
||||
print(" IsEventWaiting: false");
|
||||
|
||||
this.Math();
|
||||
this.PriorityQueue();
|
||||
|
||||
/* Check Valuate() is actually limited, MUST BE THE LAST TEST. */
|
||||
print("--Valuate() with excessive CPU usage--")
|
||||
local list = AIList();
|
||||
list.AddItem(0, 0);
|
||||
local Infinite = function(id) { while(true); }
|
||||
try {
|
||||
list = AIIndustryList(Infinite);
|
||||
} catch (e) {
|
||||
print("constructor failed with: " + e);
|
||||
}
|
||||
list.Valuate(Infinite);
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,2 @@
|
||||
print(" Required this file");
|
||||
|
||||
const test_constant = 1;
|
||||
|
||||
enum TestEnum {
|
||||
value0,
|
||||
value1,
|
||||
value2
|
||||
};
|
||||
|