Peter Nelson
8797cc7ef2
Codechange: Replace GroupStatistics' num_engines with std::map. ( #11849 )
...
This removes manual memory management with calloc/free calls, and prevents potentially large arrays being allocated for each group.
5 months ago
Rubidium
1c694e433d
Codechange: use std::popcount instead of hand written loop
5 months ago
Loïc Guilloux
bf4b669628
Fix: [Script] Improve ScriptText validation ( #11721 )
...
The validation is now done in two steps:
- First we get the list of parameters in the same order they used to be in encoded string
- Then we validate the parameter types like FormatString would use them while encoding the string
5 months ago
Rubidium
2d77cf9c80
Codechange: replace StrStartsWith/StrEndsWith with starts_with and ends_with
5 months ago
Patric Stout
bb49112784
Codechange: switch our codebase to C++20
6 months ago
Rubidium
aa5ba5bd7f
Codechange: allow certain enumeration to be added
...
Otherwise C++20 doesn't like it.
6 months ago
Peter Nelson
7737aa6640
Codechange: Make all NWidgetPart arrays constexpr.
...
This ensures that the arrays are not created at runtime and prevents using non-constexpr values.
6 months ago
Loïc Guilloux
b18e78e21d
Change: Redesign script debug window ( #11782 )
6 months ago
Tyler Trahan
68814bd912
Codechange: Rename SIGTYPE_NORMAL to SIGTYPE_BLOCK ( #11788 )
6 months ago
Loïc Guilloux
54b57fbfeb
Codechange: [Script] Use ScriptList::FillList() in more locations ( #11762 )
6 months ago
Loïc Guilloux
28efa65e0c
Revert a2edf52: SQOpsLimiter does a more precise job ( #11754 )
6 months ago
Peter Nelson
400ae65ff2
Codechange: Redefine some cargo-related values in terms of CargoID instead of CargoType.
...
Values used as special filter types are now defined as offsets from NUM_CARGO instead of confusingly reusing CARGO_NO_REFIT/CARGO_AUTO_REFIT types.
6 months ago
Peter Nelson
952d111b94
Codechange: Split CT_INVALID into CT_INVALID and INVALID_CARGO.
...
INVALID_CARGO is a CargoID and should be used for most purposes in game.
CT_INVALID is a CargoType used for defining default properties.
6 months ago
Loïc Guilloux
c86d918921
Add: [Script] Optional filter parameter to more ScriptXXXList constructors ( #11698 )
6 months ago
Peter Nelson
34e8c8e1c1
Codechange: Build station and depot vehicle lists from shared order lists. ( #11676 )
...
The brings some performance advantages:
* No need to iterate all vehicles and check for primary vehicle as only vehicles that can have orders are listed.
* Shared orders only need to be tested once instead of for each vehicle sharing them.
* Vehicle tests only need to be performed on the first shared vehicle instead of all.
6 months ago
glx22
7bfc766f94
Fix: [Script] document return type of member GSIndustry::GetProductionLevel
6 months ago
glx22
707e8001be
Fix #11689 : properly close DOXYGEN_API block
6 months ago
Peter Nelson
91ea8e3fa6
Codechange: Use locals for company/deity mode during script loops. ( #11686 )
6 months ago
Jonathan G Rennison
48b6b1844a
Change: Limit total script ops that can be consumed by a list valuate ( #11670 )
6 months ago
Loïc Guilloux
a672813bb0
Add: [Script] Optional filter parameter to ScriptVehicleList constructor ( #11663 )
6 months ago
Loïc Guilloux
f56a2d0f82
Fix: Missing invalidations on gui.ai_developer_tools change ( #11664 )
6 months ago
Peter Nelson
7124b4eef1
Codechange: Use std::unique_ptr for all NWidgets.
6 months ago
Peter Nelson
a0dfb76e34
Codechange: Replace mishmash of types for widget index with WidgetID.
...
Indices were stored as int, but often passed around as uint/uint8_t and casts.
Now they should all use WidgetID.
6 months ago
Peter Nelson
b86182ab84
Codechange: Use std::map to provide indexed widget access.
...
This removes the need to determine the biggest widget index and replaces C-style memory handling.
6 months ago
Jonathan G Rennison
3b18877b87
Fix #11629 : AirportGetNearestTown for rotated airports ( #11631 )
...
Add rotation parameter to AirportGetNearestTown
Add wrapper for existing stations
Remove unnecessary iterator cloning
6 months ago
Peter Nelson
33ff64ef74
Codechange: Simplify ConvertDateToYMD by returning YearMonthDay instead of outputting to a pointer. ( #11637 )
6 months ago
Loïc Guilloux
6c5a4aa2cb
Fix 2d3af14: Don't draw script log over panel borders ( #11621 )
6 months ago
Loïc Guilloux
af8b8c2cfc
Fix 4a2038e301: fully restore script break filter on reopen ( #11622 )
6 months ago
Loïc Guilloux
2d3af14181
Add: Horizontal scroll for script debug log ( #11597 )
6 months ago
Peter Nelson
0ca4b4e146
Change: Allow opening multiple script debug windows by holding Ctrl.
6 months ago
Peter Nelson
4a2038e301
Codechange: Make script debug window filter state per-window.
6 months ago
Tyler Trahan
e8d2ebb016
Fix: Add missing includes to timers from script implementation files ( #11604 )
6 months ago
SamuXarick
fddcaef74a
Codechange: Use town zone constants instead of magic numbers
6 months ago
Peter Nelson
302e8852c1
Fix: Crash if squirrel compatibility scripts cannot be parsed. ( #11589 )
7 months ago
Loïc Guilloux
7726f8f245
Fix: [Script] Properly store the previous AsyncMode state ( #11587 )
7 months ago
Peter Nelson
bbf3028f89
Fix #11585 : Crash when cleaning AI/GS with nested AsyncMode.
...
Do not throw sanity check when in_shutdown is true. This is also applied to
ExecMode and TestMode as they follow the same pattern.
7 months ago
Peter Nelson
c0ea0589b4
Fix: AirportGetNearestTown incorrectly assumed first TileIterator result was origin. ( #11565 )
...
Not all TileIterators are equal, and some do not start at the top-corner, so the perimeter check was wrong. As the caller already has thie origin tile, use that instead.
7 months ago
Peter Nelson
58c252b81a
Cleanup: Remove unnecessary pressed button offset code.
7 months ago
Peter Nelson
aae6e0481e
Codechange: Rearrange AI/GS debug window following invalidate/set state/draw pattern. ( #11483 )
...
The AI/GS window updated its state as it was drawn, and would redraw again if some state had changed.
Instead, update state either during OnInvalidateData or before any drawing commences.
7 months ago
Peter Nelson
7b0afec11f
Codechange: Use max_element to find highest cargo amount.
7 months ago
Peter Nelson
3f853d8003
Codechange: Use range-for to simplify getting first non-zero value.
...
This reduces indexed array access.
7 months ago
Peter Nelson
c18a1494b7
Codechange: Remove FONT_HEIGHT_... macros. ( #11481 )
...
These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
7 months ago
Peter Nelson
1071acb483
Codechange: Redundant use of char * and c_str(). ( #11454 )
8 months ago
Peter Nelson
d4008850e3
Codechange: Ensure function opening `{` is on new line.
8 months ago
Peter Nelson
ab535c0a86
Codechange: Add base() method to StrongType to allow access to the base type without casting. ( #11445 )
...
This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
8 months ago
Michael Lutz
86e28e79fb
Fix #11402 : Make string filter locale-aware.
8 months ago
Peter Nelson
18fb8e153f
Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
...
This is to allow unit-tests to produce more useful output.
8 months ago
Rubidium
c6411168d8
Cleanup: missing spaces before continuation * in some comments
8 months ago
Rubidium
c9276c2959
Codechange: replace x.size() == 0 with x.empty()
8 months ago
Peter Nelson
fd6f1e844a
Codechange: Avoid emplace_back(new()) into a unique_ptr. ( #11384 )
...
This could theoretically leave an unmanaged pointer in certain circumstances, and directly using
make_unique shows intent.
8 months ago