Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
2ab3b55
Codechange: Early continue for cargos not moved by this station
2TallTyler Jul 21, 2025
20067d2
Doc: Update station rating comments and doxygen.
2TallTyler Jul 21, 2025
d07ff71
Fix ed67aedabf: Wrong button type for town menu in scenario editor to…
PeterN Sep 21, 2025
030bbc6
Update: Translations from eints
Sep 21, 2025
70d4182
Fix #14631, Fix 1cb0cbcb6c: Waypoint customs spec not allocated prope…
PeterN Sep 21, 2025
ce166bb
Codechange: Demagicify main toolbar button type.
PeterN Sep 21, 2025
69697a6
Fix 8c58fb1efdc: Doubled beep sounds when clicking toolbar buttons.
PeterN Sep 21, 2025
13ab9c1
Fix 6e90b828c6: Off-by-one in Rect::CentreTo. (#14643)
PeterN Sep 21, 2025
29012c3
Codechange: Move settings entry size global variables. (#14644)
PeterN Sep 21, 2025
a7b06fc
Codechange: Don't use Point for non-2D coordinate. (#14645)
PeterN Sep 21, 2025
71eba48
Codechange: Deduplicate DrawButtonDropdown. (#14646)
PeterN Sep 21, 2025
1278f62
Codechange: Call shorter variant of DrawFrameRect and GfxFillRect. (#…
PeterN Sep 21, 2025
1229a49
Codechange: Add constant for INVALID_WIDGET. (#14649)
PeterN Sep 21, 2025
853dc24
Update: Translations from eints
Sep 22, 2025
43e65d0
Codefix: Incorrect naming and location of widget names for build dock…
PeterN Sep 22, 2025
2b16411
Codechange: Use EnumBitSet for TownFlags. (#14651)
PeterN Sep 22, 2025
484ed10
Codechange: Make TownRatingCheckType an enum class. (#14652)
PeterN Sep 23, 2025
6ad7c1c
Fix d85f4b3ebf: Incorrect row height in network server list. (#14653)
PeterN Sep 23, 2025
bec4e71
Update: Translations from eints
Sep 24, 2025
ecb761f
Codechange: Simplified structure of yapf_ship_regions. (#14640)
Kuhnovic Sep 24, 2025
42c9f84
Fix 3ac1a2f1e4: Game crash due to invalid vehicle type information. (…
PeterN Sep 24, 2025
80e58e7
Fix #14607: Bridge-over-station discrepancy depending on build order.…
PeterN Sep 24, 2025
6401855
Fix bff8501: Gcc 15 warns about duplicate type. (#14660)
Kuhnovic Sep 26, 2025
f4f1beb
Codechange: Moved PruneIntermediateNodeBranch to rail pathfinder. (#1…
Kuhnovic Sep 26, 2025
aa6fb0e
Codechange: Simplified logic of ship leaving a depot. (#14661)
Kuhnovic Sep 26, 2025
5822c8c
Codechange: Set YAPF startup nodes directly. (#14663)
Kuhnovic Sep 26, 2025
0b99a0b
Feature: Draw infinite water when all borders are water (#13289)
2TallTyler Sep 26, 2025
41837d0
Change: Record and show multiple errors for each NewGRF. (#14658)
PeterN Sep 26, 2025
18e2807
Fix: League Table layout broken with RTL languages. (#14667)
PeterN Sep 27, 2025
910eeef
Update: Translations from eints
Sep 27, 2025
5e7cb08
Fix #14549: changing interface scale could underflow map zoom
rubidium42 Sep 24, 2025
69ea970
Codefix 18e28077cc: Local variable icon shadowed member variable icon…
PeterN Sep 27, 2025
0aaeb6f
Codechange: Rename TrackFollowers to follower. (#14664)
PeterN Sep 27, 2025
bfe5fb7
Codechange: FlatSet's contains() should be const. (#14665)
PeterN Sep 27, 2025
9307e19
Fix #14604: Clearing tiles to build objects did not update town ratin…
JGRennison Sep 27, 2025
f64e1cd
Fix: Industry accept/produce when not contiguous range from 0 (#14555)
JGRennison Sep 27, 2025
e58fdb8
Codefix: shadowing of variables
rubidium42 Sep 27, 2025
380f9e8
Change: Prefer normal/medium weight font in FontConfig fallback detec…
PeterN Sep 27, 2025
6d3f396
Codechange: Add WithX/WithY methods to Rect.
PeterN Sep 21, 2025
31eec71
Codechange: Use Rect WithX/WithY in some places.
PeterN Sep 21, 2025
37f7374
Update: Translations from eints
Sep 28, 2025
cb1c240
Codechange: Rework network client list buttons.
PeterN Sep 25, 2025
81530e2
Change: Support interface scaling in network client list buttons.
PeterN Sep 25, 2025
ff67482
Codechange: Replace Rect CentreTo with CentreToHeight. (#14675)
PeterN Sep 28, 2025
5ed8f12
Codechange: Cleanup unnecessary includes of spritecache.h (#14678)
PeterN Sep 28, 2025
126669e
Codechange: Make GetRail/RoadTypeInfoIndex() a member method.
PeterN Sep 9, 2025
ca8fb69
Codechange: Use std algorithm when allocating rail/road type.
PeterN Sep 9, 2025
2913635
Codechange: Initialise rail/road types with range-for.
PeterN Sep 9, 2025
c822049
Change: replace the "(City)" identifier in the town directory with th…
Moth-Tolias Sep 28, 2025
8eaf511
Update: Translations from eints
Sep 29, 2025
f8aa2e6
Add: Include build cost in rail/road dropdowns. (#14599)
PeterN Sep 29, 2025
dcc3a67
Fix 9cdf740097: Don't make copy of format providers when making a scr…
PeterN Sep 29, 2025
aa7eb08
Codechange: make all Providers fully const (Font/Screenshot/Sound)
rubidium42 Sep 29, 2025
8a8ebab
Change: Provide road and rail overlay sprites for bridge decks. (#14557)
PeterN Sep 29, 2025
3087194
Codechange: Use Rects for group window drawing.
PeterN Sep 28, 2025
42084ca
Change: Make groups window group list aware of interface scaling.
PeterN Sep 28, 2025
9eacb88
Update: Translations from eints
Sep 30, 2025
5d5d278
Fix: Bootstrap ignored default OpenTTD truetype fonts. (#14684)
PeterN Sep 30, 2025
632ab6a
Update: Translations from eints
Oct 1, 2025
97674ac
Fix f6c5da4cad: dump_info should not reverse non-ASCII label. (#14697)
PeterN Oct 3, 2025
4d40966
Codechange: Use FlatSet to store and test alternate rail/road types.
PeterN Sep 7, 2025
6fdacb0
Codechange: Use find/find_if to search for rail/road types by label.
PeterN Oct 1, 2025
c9fbc41
Codechange: Script list iterator tidying. (#14698)
PeterN Oct 5, 2025
a617d00
Codechange: Dereference with `x->` instead of `(*x).` (#14700)
PeterN Oct 5, 2025
f935e34
Codefix: Remove double SetDirty() calls.
Rito13 Oct 8, 2025
8e05515
Codefix: Make sure safeguards.h is the last included non-table header…
PeterN Oct 11, 2025
a949197
Fix ef71ce0a9d: Crash when user enters a blank line in the console. (…
PeterN Oct 15, 2025
c627c64
Update: Translations from eints
Oct 16, 2025
bf3a07c
Codechange: Silence uninitialized variable warning from GCC. (#14715)
PeterN Oct 19, 2025
75ca1e3
Fix a46a3a97f3: Incorrect parameter order for CmdSetCompanyManagerFace.
PeterN Oct 3, 2025
9f7f314
Codechange: [Script] Add regression test for company president gender.
PeterN Oct 3, 2025
2396353
Codechange: Optimize FlowRiver (#13264)
SamuXarick Oct 22, 2025
8e8eebd
Doc: Define policy on AI usage in OpenTTD development (#14537)
2TallTyler Oct 23, 2025
5c89dff
Codechange: Iterate road/tram masks instead of checking each type. (#…
PeterN Oct 23, 2025
fd32d14
Codechange: Remove StationIDStack and SmallStack.
PeterN Oct 11, 2025
d6eff80
Codechange: Use single vector for next station order.
PeterN Oct 16, 2025
e4b0e84
Doc 80666a0: Fix typo in game script changelog (#14714)
SamuXarick Oct 24, 2025
a19f6c0
Codechange: Add prefix to dependabot commits (#14691)
glx22 Oct 24, 2025
06b830d
Codechange: Prefer string equality instead of comparison. (#14727)
PeterN Oct 24, 2025
813cde3
Fix: Don't set set town index for depot tiles. (#14729)
PeterN Oct 24, 2025
6fc4bef
Fix #14240: Remember previous GUI scale when toggling auto-detect (#1…
OllieBechstein Oct 24, 2025
2212169
Fix: Do not pre-fill industry production history for unused productio…
JGRennison Oct 24, 2025
6ebe647
Add: Game units for height. (#14615)
Rito13 Oct 24, 2025
70bf841
Add: Show height difference in bridge is too low error message. (#14614)
Rito13 Oct 24, 2025
a1920fc
Change: Scale towns/industries by amount of land tiles. (#10063)
PeterN Oct 24, 2025
7b703f6
Update: Translations from eints
Oct 25, 2025
1522c9f
Update: Translations from eints
Oct 26, 2025
b43cdcb
Update: Translations from eints
Oct 27, 2025
d1376d0
Fix #14737: Don't scale custom town and industry counts by land area …
2TallTyler Oct 27, 2025
6295310
Update: Translations from eints
Oct 28, 2025
534918c
Codechange: Simplify YAPF debug helpers a little. (#14741)
PeterN Oct 28, 2025
3b02761
Update: Translations from eints
Oct 29, 2025
3ebedec
Add: [Script] Auto-convert ObjectType bool to integer when setting va…
SamuXarick Oct 29, 2025
3f19240
Doc 313c6c4: [Script] GetAllRailTypes and GetRailType are from Script…
SamuXarick Oct 30, 2025
038c4d2
Codechange: Make driver probe behave the same as loading by name. (#1…
PeterN Oct 30, 2025
20fd2b5
Codefix: Add missing 'this->' in ScriptList (#14747)
SamuXarick Oct 31, 2025
8ea347a
Remove: Rail type cost from replace vehicle window. (#14748)
Rito13 Oct 31, 2025
7c855c6
Update: Translations from eints
Nov 1, 2025
34bbae0
Codechange: Use enum/EnumBitSet for livery in use flags. (#14746)
PeterN Nov 1, 2025
66b6d71
Codechange: Use std::initializer_list for NWidgetPart data. (#14749)
PeterN Nov 1, 2025
00cdf1b
Codefix: Clear m6 more thoroughly when making tiles.
PeterN Oct 25, 2025
9001d4a
Codefix: Clear m8 when making tiles.
PeterN Oct 26, 2025
f759b69
Codechange: Use helper function for company recolour offset (#14740)
Rito13 Nov 3, 2025
8226548
Fix fd32d1447e: Test for empty shares became inverted. (#14751)
PeterN Nov 3, 2025
3befbdd
Update: Translations from eints
Nov 4, 2025
06d8e03
Codechange: Use std-find instead of for-loops in strgen. (#14754)
PeterN Nov 4, 2025
6d5f150
Fix: BaseBitSet bit iteration for values which don't fit in 32 bits (…
JGRennison Nov 4, 2025
94052a6
Update: Translations from eints
Nov 6, 2025
f052ef2
Update: Translations from eints
Nov 7, 2025
d48463d
Fix #14763: Crash if NewGRF currency separator is not valid. (#14764)
PeterN Nov 9, 2025
9c338cf
Codefix 8f14894: Correct the comment for GetClassBadge function. (#14…
Rito13 Nov 9, 2025
b563c34
Codefix 6d495d1: [Actions] vcpkg caching for codeql requires some per…
glx22 Nov 9, 2025
376a39f
Change: Use proper tooltip strings for freeform edge toggles. (#14765)
PeterN Nov 9, 2025
744543e
Update: Translations from eints
Nov 10, 2025
aa6c694
Fix c2d4098afa: Unconfigured badge classes should be visible in colum…
PeterN Nov 10, 2025
ca866cc
Fix 394adb654e: Incorrect spacing for badges in dropdown lists. (#14768)
PeterN Nov 10, 2025
ae41372
Update: Translations from eints
Nov 11, 2025
c4b16cb
Update: Translations from eints
Nov 12, 2025
120afd2
Codefix 394adb6: Make newgrf_badge_gui.cpp file docs compatible with …
Rito13 Nov 12, 2025
dbe3297
Update: Translations from eints
Nov 13, 2025
c38aa9c
Fix #14701: Company colour remap for sprites in badge filter dropdown…
Rito13 Nov 13, 2025
7662105
Change: Clamp terraform toolbar to main toolbar (#14725)
mmtunligit Nov 13, 2025
2693e63
Update: Translations from eints
Nov 14, 2025
459d213
Update: Translations from eints
Nov 15, 2025
2b24444
Codechange: Detect crashes during regression (#14774)
glx22 Nov 15, 2025
d61a21c
Codechange: Use enum class for command-related enums. (#14775)
PeterN Nov 15, 2025
05c40a6
Fix #14777: authorized_key: Correctly target key type for add/remove
MuxyDuGoulp Nov 15, 2025
06d2f44
Codechange: HighScore sorting to use std::vector (#14779)
SamuXarick Nov 15, 2025
2132907
Update: Translations from eints
Nov 16, 2025
438ac28
Codechange: Pass rail and roadtypes separate for tunnel and bridge co…
PeterN Sep 26, 2025
832abe3
Codechange: Pass rail/road info by reference when resolving GUI sprites.
PeterN Sep 7, 2025
1d09497
Codechange: Use iteration to set up date-introduced rail/road types.
PeterN Sep 7, 2025
dff5323
Codechange: Store rail/road type infrastructure counts in maps.
PeterN Sep 7, 2025
5a9cf80
Codechange: Allocate map railtypes dynamically.
PeterN Sep 7, 2025
768f470
Codechange: Allocate map roadtypes dynamically.
PeterN Sep 16, 2025
3a1a56d
Codechange: Keep track of infrastructure 'cost' for unowned road pieces.
PeterN Sep 26, 2025
684b1c2
Feature: Increase rail and road type definitions limit.
PeterN Sep 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ updates:
actions:
patterns:
- "*"
commit-message:
prefix: "Upgrade: "
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
actions: read
contents: read
security-events: write
packages: read

steps:
- name: Checkout
Expand Down
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,29 @@ These include:
You may also want the guide to [compiling OpenTTD](./COMPILING.md).


## Use of AI

OpenTTD is a labour of love, created by people.

Please refrain from submitting issues or pull requests that have been generated by an LLM or other fully-automated tools.
Any submission that is in violation of this policy will be closed, and the submitter may be blocked from this repository without warning.

If you submit an issue, you need to understand what your issue description is saying.
You need to be able to answer questions about your bug report or feature request.
Using an AI tool to _proofread_ your issue/comment text is acceptable. Using an AI tool to _write_ your issue/comment text is not.

If you submit a pull request, you need to understand what every line of code you've changed does.
If you can't explain why your PR is doing something, then do not submit it.
Using an AI tool to generate entire lines of code is unacceptable.

The rationale behind this policy is that automated contributions are a waste of the maintainers' time.
Humans spend their time and brainpower reviewing every submission.
Issues or pull requests generated by automation tools create an imbalance of effort between the submitter and the reviewer.
Nobody learns anything when a maintainer reviews code written by an LLM.

Additionally, AI-generated code conflicts with this project's license (GPL v2), since you cannot truly release code for use if you didn't author it yourself.


## Project goals

### What are the goals of the official branch?
Expand Down
11 changes: 11 additions & 0 deletions cmake/scripts/Regression.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ if(EDITBIN_EXECUTABLE)
execute_process(COMMAND ${EDITBIN_EXECUTABLE} /nologo /subsystem:console ${OPENTTD_EXECUTABLE})
endif()

# Remove previous crash files
file(GLOB CRASH_FILES "regression/crash*")
file(REMOVE ${CRASH_FILES})

# Run the regression test
execute_process(COMMAND ${OPENTTD_EXECUTABLE}
-x
Expand All @@ -40,6 +44,13 @@ execute_process(COMMAND ${OPENTTD_EXECUTABLE}
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Detect any crash
file(GLOB CRASH_FILES "regression/crash*.log")
if (CRASH_FILES)
file(READ ${CRASH_FILES} CRASH_LOG)
message(FATAL_ERROR "OpenTTD crashed: ${CRASH_LOG}")
endif()

if(REGRESSION_OUTPUT)
message(FATAL_ERROR "Unexpected output: ${REGRESSION_OUTPUT}")
endif()
Expand Down
Binary file modified media/baseset/openttd.grf
Binary file not shown.
2 changes: 1 addition & 1 deletion media/baseset/openttd.grf.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
eb8390a0569e66ec417c64ad254f9d05
b779126d7cd1567eb09a0a7871f70a71
2 changes: 2 additions & 0 deletions media/baseset/openttd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ if(GRFCODEC_FOUND)
${CMAKE_CURRENT_SOURCE_DIR}/airport_preview.nfo
${CMAKE_CURRENT_SOURCE_DIR}/aqueduct.nfo
${CMAKE_CURRENT_SOURCE_DIR}/autorail.nfo
${CMAKE_CURRENT_SOURCE_DIR}/bridge_decks.nfo
${CMAKE_CURRENT_SOURCE_DIR}/canals.nfo
${CMAKE_CURRENT_SOURCE_DIR}/chars.nfo
${CMAKE_CURRENT_SOURCE_DIR}/elrails.nfo
Expand All @@ -31,6 +32,7 @@ if(GRFCODEC_FOUND)
${CMAKE_CURRENT_SOURCE_DIR}/airport_preview.png
${CMAKE_CURRENT_SOURCE_DIR}/aqueduct.png
${CMAKE_CURRENT_SOURCE_DIR}/autorail.png
${CMAKE_CURRENT_SOURCE_DIR}/bridge_decks.png
${CMAKE_CURRENT_SOURCE_DIR}/canals.png
${CMAKE_CURRENT_SOURCE_DIR}/canal_locks.png
${CMAKE_CURRENT_SOURCE_DIR}/chars.png
Expand Down
36 changes: 36 additions & 0 deletions media/baseset/openttd/bridge_decks.nfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// 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 "Bridge decks"
-1 * 3 05 1B 18

-1 sprites/bridge_decks.png 8bpp 96 16 64 31 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 16 16 64 31 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 176 16 64 39 -31 -8 normal
-1 sprites/bridge_decks.png 8bpp 256 16 64 23 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 336 16 64 23 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 416 16 64 39 -31 -8 normal

-1 sprites/bridge_decks.png 8bpp 96 71 64 31 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 16 71 64 31 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 176 71 64 39 -31 -8 normal
-1 sprites/bridge_decks.png 8bpp 256 71 64 23 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 336 71 64 23 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 416 71 64 39 -31 -8 normal

-1 sprites/bridge_decks.png 8bpp 96 126 64 31 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 16 126 64 31 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 176 126 64 39 -31 -8 normal
-1 sprites/bridge_decks.png 8bpp 256 126 64 23 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 336 126 64 23 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 416 126 64 39 -31 -8 normal

// X and Y axis are swapped for road surface.
-1 sprites/bridge_decks.png 8bpp 16 181 64 31 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 96 181 64 31 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 176 181 64 39 -31 -8 normal
-1 sprites/bridge_decks.png 8bpp 256 181 64 23 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 336 181 64 23 -31 0 normal
-1 sprites/bridge_decks.png 8bpp 416 181 64 39 -31 -8 normal
Binary file added media/baseset/openttd/bridge_decks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions media/baseset/openttd/openttd.nfo
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,4 @@
#include "palette.nfo"
#include "road_waypoints.nfo"
#include "overlay_rocks.nfo"
#include "bridge_decks.nfo"
16 changes: 16 additions & 0 deletions regression/regression/main.nut
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,21 @@ function Regression::Company()
}
}

function Regression::CompanyGender()
{
print("");
print("--Company Gender--");
/* Check gender switching behaviour matches API. */
print(" GetPresidentGender(): " + AICompany.GetPresidentGender(AICompany.COMPANY_SELF));
print(" SetPresidentGender(): " + AICompany.SetPresidentGender(AICompany.GENDER_MALE));
print(" GetPresidentGender(): " + AICompany.GetPresidentGender(AICompany.COMPANY_SELF));
print(" SetPresidentGender(): " + AICompany.SetPresidentGender(AICompany.GENDER_FEMALE));
print(" GetPresidentGender(): " + AICompany.GetPresidentGender(AICompany.COMPANY_SELF));
/* Setting to existing gender should fail. */
print(" SetPresidentGender(): " + AICompany.SetPresidentGender(AICompany.GENDER_FEMALE));
print(" GetPresidentGender(): " + AICompany.GetPresidentGender(AICompany.COMPANY_SELF));
}

function Regression::Engine()
{
local j = 0;
Expand Down Expand Up @@ -2096,6 +2111,7 @@ function Regression::Start()
this.Vehicle();
/* Order has to be after Vehicle */
this.Order();
this.CompanyGender();
print("");
print(" First Subsidy Test");
PrintSubsidy(0);
Expand Down
11 changes: 10 additions & 1 deletion regression/regression/result.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10006,6 +10006,15 @@ ERROR: IsEnd() is invalid as Begin() is never called
foreach():
20 => 23596

--Company Gender--
GetPresidentGender(): 1
SetPresidentGender(): true
GetPresidentGender(): 0
SetPresidentGender(): true
GetPresidentGender(): 1
SetPresidentGender(): false
GetPresidentGender(): 1

First Subsidy Test
--Subsidy (0) --
IsValidSubsidy(): true
Expand Down Expand Up @@ -10107,7 +10116,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
constructor failed with: excessive CPU usage in list filter function
Your script made an error: excessive CPU usage in valuator function

*FUNCTION [Start()] regression/main.nut line [2168]
*FUNCTION [Start()] regression/main.nut line [2184]

[Infinite] CLOSURE
[list] INSTANCE
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ add_files(
transparency.h
transparency_gui.cpp
transparency_gui.h
transport_mapping.hpp
transport_type.h
tree_cmd.cpp
tree_cmd.h
Expand Down
2 changes: 1 addition & 1 deletion src/ai/ai_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


/** Widgets for the configure AI window. */
static constexpr NWidgetPart _nested_ai_config_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_ai_config_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_MAUVE),
NWidget(WWT_CAPTION, COLOUR_MAUVE), SetStringTip(STR_AI_CONFIG_CAPTION_AI, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
Expand Down
2 changes: 1 addition & 1 deletion src/ai/ai_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,5 @@ AILibrary *AIScannerLibrary::FindLibrary(const std::string &library, int version
ScriptInfoList::iterator it = this->info_list.find(library_name);
if (it == this->info_list.end()) return nullptr;

return static_cast<AILibrary *>((*it).second);
return static_cast<AILibrary *>(it->second);
}
11 changes: 6 additions & 5 deletions src/aircraft_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "news_func.h"
#include "newgrf_engine.h"
#include "newgrf_sound.h"
#include "spritecache.h"
#include "error_func.h"
#include "strings_func.h"
#include "command_func.h"
Expand Down Expand Up @@ -136,7 +135,9 @@ static StationID FindNearestHangar(const Aircraft *v)
next_dest = Station::GetIfValid(v->current_order.GetDestination().ToStationID());
} else {
last_dest = GetTargetAirportIfValid(v);
next_dest = Station::GetIfValid(v->GetNextStoppingStation().value);
std::vector<StationID> next_station;
v->GetNextStoppingStation(next_station);
if (!next_station.empty()) next_dest = Station::GetIfValid(next_station.back());
}
}

Expand Down Expand Up @@ -200,7 +201,7 @@ void GetRotorImage(const Aircraft *v, EngineImageType image_type, VehicleSpriteS
static void GetAircraftIcon(EngineID engine, EngineImageType image_type, VehicleSpriteSeq *result)
{
const Engine *e = Engine::Get(engine);
uint8_t spritenum = e->u.air.image_index;
uint8_t spritenum = e->VehInfo<AircraftVehicleInfo>().image_index;

if (IsCustomVehicleSpriteNum(spritenum)) {
GetCustomVehicleIcon(engine, DIR_W, image_type, result);
Expand Down Expand Up @@ -267,7 +268,7 @@ void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height, int &xoff
*/
CommandCost CmdBuildAircraft(DoCommandFlags flags, TileIndex tile, const Engine *e, Vehicle **ret)
{
const AircraftVehicleInfo *avi = &e->u.air;
const AircraftVehicleInfo *avi = &e->VehInfo<AircraftVehicleInfo>();
const Station *st = Station::GetByTile(tile);

/* Prevent building aircraft types at places which can't handle them */
Expand Down Expand Up @@ -438,7 +439,7 @@ static void CheckIfAircraftNeedsService(Aircraft *v)
Money Aircraft::GetRunningCost() const
{
const Engine *e = this->GetEngine();
uint cost_factor = GetVehicleProperty(this, PROP_AIRCRAFT_RUNNING_COST_FACTOR, e->u.air.running_cost);
uint cost_factor = GetVehicleProperty(this, PROP_AIRCRAFT_RUNNING_COST_FACTOR, e->VehInfo<AircraftVehicleInfo>().running_cost);
return GetPrice(PR_RUNNING_AIRCRAFT, cost_factor, e->GetGRF());
}

Expand Down
1 change: 0 additions & 1 deletion src/aircraft_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "strings_func.h"
#include "vehicle_func.h"
#include "window_gui.h"
#include "spritecache.h"
#include "zoom_func.h"

#include "table/strings.h"
Expand Down
13 changes: 9 additions & 4 deletions src/airport_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static void PlaceAirport(TileIndex tile)

/** Airport build toolbar window handler. */
struct BuildAirToolbarWindow : Window {
int last_user_action = INVALID_WID_AT; // Last started user action.
WidgetID last_user_action = INVALID_WIDGET; // Last started user action.

BuildAirToolbarWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
{
Expand Down Expand Up @@ -161,6 +161,11 @@ struct BuildAirToolbarWindow : Window {
VpSelectTilesWithMethod(pt.x, pt.y, select_method);
}

Point OnInitialPosition(int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override
{
return AlignInitialConstructionToolbar(sm_width);
}

void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override
{
if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) {
Expand Down Expand Up @@ -197,7 +202,7 @@ struct BuildAirToolbarWindow : Window {
}, AirportToolbarGlobalHotkeys};
};

static constexpr NWidgetPart _nested_air_toolbar_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_air_toolbar_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetStringTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
Expand All @@ -211,7 +216,7 @@ static constexpr NWidgetPart _nested_air_toolbar_widgets[] = {
};

static WindowDesc _air_toolbar_desc(
WDP_ALIGN_TOOLBAR, "toolbar_air", 0, 0,
WDP_MANUAL, "toolbar_air", 0, 0,
WC_BUILD_TOOLBAR, WC_NONE,
WindowDefaultFlag::Construction,
_nested_air_toolbar_widgets,
Expand Down Expand Up @@ -580,7 +585,7 @@ class BuildAirportWindow : public PickerWindowBase {
}};
};

static constexpr NWidgetPart _nested_build_airport_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_build_airport_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetStringTip(STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
Expand Down
8 changes: 4 additions & 4 deletions src/articulated_vehicles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@ void AddArticulatedParts(Vehicle *first)
t->track = front->track;
t->railtypes = front->railtypes;

t->spritenum = e_artic->u.rail.image_index;
t->spritenum = e_artic->VehInfo<RailVehicleInfo>().image_index;
if (e_artic->CanCarryCargo()) {
t->cargo_type = e_artic->GetDefaultCargoType();
t->cargo_cap = e_artic->u.rail.capacity; // Callback 36 is called when the consist is finished
t->cargo_cap = e_artic->VehInfo<RailVehicleInfo>().capacity; // Callback 36 is called when the consist is finished
} else {
t->cargo_type = front->cargo_type; // Needed for livery selection
t->cargo_cap = 0;
Expand All @@ -392,11 +392,11 @@ void AddArticulatedParts(Vehicle *first)
rv->roadtype = front->roadtype;
rv->compatible_roadtypes = front->compatible_roadtypes;

rv->spritenum = e_artic->u.road.image_index;
rv->spritenum = e_artic->VehInfo<RoadVehicleInfo>().image_index;
if (e_artic->CanCarryCargo()) {
rv->cargo_type = e_artic->GetDefaultCargoType();
assert(IsValidCargoType(rv->cargo_type));
rv->cargo_cap = e_artic->u.road.capacity; // Callback 36 is called when the consist is finished
rv->cargo_cap = e_artic->VehInfo<RoadVehicleInfo>().capacity; // Callback 36 is called when the consist is finished
} else {
rv->cargo_type = front->cargo_type; // Needed for livery selection
rv->cargo_cap = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/autoreplace_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@ bool CheckAutoreplaceValidity(EngineID from, EngineID to, CompanyID company)
switch (type) {
case VEH_TRAIN: {
/* make sure the railtypes are compatible */
if (!GetAllCompatibleRailTypes(e_from->u.rail.railtypes).Any(GetAllCompatibleRailTypes(e_to->u.rail.railtypes))) return false;
if (!GetAllCompatibleRailTypes(e_from->VehInfo<RailVehicleInfo>().railtypes).Any(GetAllCompatibleRailTypes(e_to->VehInfo<RailVehicleInfo>().railtypes))) return false;

/* make sure we do not replace wagons with engines or vice versa */
if ((e_from->u.rail.railveh_type == RAILVEH_WAGON) != (e_to->u.rail.railveh_type == RAILVEH_WAGON)) return false;
if ((e_from->VehInfo<RailVehicleInfo>().railveh_type == RAILVEH_WAGON) != (e_to->VehInfo<RailVehicleInfo>().railveh_type == RAILVEH_WAGON)) return false;
break;
}

case VEH_ROAD:
/* make sure the roadtypes are compatible */
if (!GetRoadTypeInfo(e_from->u.road.roadtype)->powered_roadtypes.Any(GetRoadTypeInfo(e_to->u.road.roadtype)->powered_roadtypes)) return false;
if (!GetRoadTypeInfo(e_from->VehInfo<RoadVehicleInfo>().roadtype)->powered_roadtypes.Any(GetRoadTypeInfo(e_to->VehInfo<RoadVehicleInfo>().roadtype)->powered_roadtypes)) return false;

/* make sure that we do not replace a tram with a normal road vehicles or vice versa */
if (e_from->info.misc_flags.Test(EngineMiscFlag::RoadIsTram) != e_to->info.misc_flags.Test(EngineMiscFlag::RoadIsTram)) return false;
break;

case VEH_AIRCRAFT:
/* make sure that we do not replace a plane with a helicopter or vice versa */
if ((e_from->u.air.subtype & AIR_CTOL) != (e_to->u.air.subtype & AIR_CTOL)) return false;
if ((e_from->VehInfo<AircraftVehicleInfo>().subtype & AIR_CTOL) != (e_to->VehInfo<AircraftVehicleInfo>().subtype & AIR_CTOL)) return false;
break;

default: break;
Expand Down
4 changes: 2 additions & 2 deletions src/autoreplace_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
CommandCost CmdAutoreplaceVehicle(DoCommandFlags flags, VehicleID veh_id);
CommandCost CmdSetAutoReplace(DoCommandFlags flags, GroupID id_g, EngineID old_engine_type, EngineID new_engine_type, bool when_old);

DEF_CMD_TRAIT(CMD_AUTOREPLACE_VEHICLE, CmdAutoreplaceVehicle, {}, CMDT_VEHICLE_MANAGEMENT)
DEF_CMD_TRAIT(CMD_SET_AUTOREPLACE, CmdSetAutoReplace, {}, CMDT_VEHICLE_MANAGEMENT)
DEF_CMD_TRAIT(CMD_AUTOREPLACE_VEHICLE, CmdAutoreplaceVehicle, {}, CommandType::VehicleManagement)
DEF_CMD_TRAIT(CMD_SET_AUTOREPLACE, CmdSetAutoReplace, {}, CommandType::VehicleManagement)

#endif /* AUTOREPLACE_CMD_H */
Loading
Loading