Peter Nelson
97e2bc612c
Codechange: Rename and move SpriteGroup-specific cargo types into a namespace.
...
These 'cargo types' have special defined uses and must not be used elsewhere. This makes it clearer that they are special.
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
Peter Nelson
ddd609ce9b
Feature: Randomize direction of rail vehicle on build based on probability callback. ( #11489 )
...
This allows NewGRF authors to indicate that the game should randomly flip rail vehicles on build, without needing to use random bits nor duplicate sprites to handle it themselves.
To use this functionality, test for callback 162 (CBID_VEHICLE_BUILD_PROBABILITY) and var10 = 0 (values other than 0 are reserved for future use), and return a value between 0 and 100 inclusive.
The return value is a percentage chance of reversing the vehicle. A value of 0 will always build a forward facing vehicle, and 100 will always build a reverse facing vehicle.
7 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
Peter Nelson
429a6f58e7
Codechange: Use max_element to find best cargo (sub-)type in NewGRF var 42. ( #11370 )
...
This replaces two manual loops to find the best cargo (sub-)type.
8 months ago
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
9 months ago
PeterN
acd7d3c913
Codechange: Rename *Railtype* to *RailType* for consistency. ( #11287 )
10 months ago
Tyler Trahan
77173a6a10
Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes
10 months ago
Patric Stout
30172fc037
Codechange: cleanup CargoPacket in terms of variable/function names ( #11278 )
...
Over the years, things got reused and changed, making the current
names somewhat unclear in what they actually mean and do.
10 months ago
Patric Stout
299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed ( #10761 )
11 months ago
Tyler Trahan
9a602ff304
Fix #10334 : Store separate newgrf-safe version of date_of_last_service. ( #11124 )
...
This value is not changed when the date cheat is used, which caused issues with changing properties based on service date.
Co-authored-by: Peter Nelson <peter1138@openttd.org>
11 months ago
Rubidium
eaae0bb5e7
Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
...
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
12 months ago
rubidium42
9f6fec01cd
Codechange: rename cargo aging days to periods, as they are not really days ( #11112 )
12 months ago
Peter Nelson
76516d7f70
Codechange: Use IsValidCargoID/IsValidCargoType.
...
IsValidCargoType() is used only for unmapped IDs.
1 year ago
Rubidium
3323402aaa
Codechange: rename smallvec_type to container_func and use only when needed
1 year ago
Rubidium
fb856e16c1
Codechange: replace some min/clamp constructs to ClampTo
1 year ago
Rubidium
19ec4e8beb
Codechange: replace ClampToI32/U16 with ClampTo<int32_t/uint16_t>
1 year ago
Peter Nelson
7ccdefa1c1
Change: Increase vehicle random data from 8 to 16 bits.
1 year ago
Patric Stout
7aa2b9ab0a
Codechange: move all date-related variables inside the timer ( #10706 )
1 year ago
Rubidium
7088f5b7c7
Codechange: use string/fmt instead of printf for grfmsg
1 year ago
Rubidium
90f1768006
Codechange: add non-nullptr asserts in cases where it should never be nullptr
...
Though where similar calls are checked for nullptr as in those instances of
the use of that function it can actually return nullptr. In other words, write
down the assumption that the function never returns nullptr in an assert.
1 year ago
Peter Nelson
efa20dd969
Change: Support engine property 0xC6 in purchase list.
2 years ago
frosch
111a47af0d
Codechange: rename 'info_view' to 'rotor_in_gui', because it is only used by helicopters.
3 years ago
frosch
bc984d9af5
Codechange: remove redundant 'info_view' parameter, it can be derived from 'image_type'.
3 years ago
Michael Lutz
ee333a9549
Fix 2183fd4d: [NewGRF] Use divide instead of right shift for signed numbers. ( #9480 )
...
"For negative a, the value of a >> b is implementation-defined (in most implementations, this performs arithmetic right shift, so that the result remains negative)."
3 years ago
Vít Šefl
2183fd4dab
Feature: [NewGRF] Maximum curve speed modifier for rail vehicles ( #9346 )
3 years ago
rubidium42
55a11710a6
Codechange: convert printf DEBUG statements to fmt Debug statements
3 years ago
Peter Nelson
f785a70a2b
Cleanup: Use std::vector in RealSpriteGroup.
3 years ago
PeterN
3dbd6475fe
Codechange: Use C++ features for train wagon overrides. ( #9141 )
...
This removes the need for C-style array management and allows use of iterators to perform wagon override lookups.
3 years ago
Johannes E. Krause
3ac43582c2
Codechange: [NewGRF] Make it more explicit which parts of the TTD vehicle structure (var 80+) are not implemented
3 years ago
Johannes E. Krause
f1bc4d8407
Add: [NewGRF] Vehicle variable 4A now also returns, whether the current tile has catenary.
4 years ago
frosch
868d84bbfc
Add: [NewGRF] vehicle variable 63 to test the tracktype of the current tile against a given tracktype.
4 years ago
Charles Pigott
9b800a96ed
Codechange: Remove min/max functions in favour of STL variants ( #8502 )
4 years ago
Charles Pigott
860c270c73
Codechange: Replace assert_compile macro with static_assert
4 years ago
Niels Martin Hansen
c8779fb311
Feature: NewGRF callback profiling ( #7868 )
...
Adds a console command newgrf_profile to collect some profiling data about NewGRF action 2 callbacks and produce a CSV file.
4 years ago
glx
1f6b3a37f9
Codechange: Replace FOR_ALL_ENGINES with range-based for loops
5 years ago
S. D. Cloudt
13cc8a0cee
Cleanup: Removed SVN headers
5 years ago
JMcKiern
04f659e768
Fix: Some typos found using codespell
5 years ago
peter1138
c02ef3e456
Feature: Add NotRoadTypes (NRT)
5 years ago
glx
801cbea9cc
Codechange: use std::sort() for all std::vector types
5 years ago
Henry Wilson
7c8e7c6b6e
Codechange: Use null pointer literal instead of the NULL macro
5 years ago
Henry Wilson
c01a2e2a81
Codechange: Removed SmallVector completely
5 years ago
Henry Wilson
ab711e6942
Codechange: Replaced SmallVector::[Begin|End]() with std alternatives
5 years ago
Henry Wilson
2bc2de9034
Codechange: Replaced SmallVector::Find() with std::find()
5 years ago
Henry Wilson
a0f36a50e6
Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back()
5 years ago
Henry Wilson
097328c3d7
Codechange: Replaced SmallVector::Get() const with std alternatives
5 years ago
Henry Wilson
f3938fdb83
Codechange: Replaced SmallVector::Reset() with std::vector::clear() + shrink_to_fit()
5 years ago
Henry Wilson
a690936ed7
Codechange: Replace SmallVector::Length() with std::vector::size()
5 years ago
frosch
d9d669dcf8
(svn r27984) -Codechange: Make ScopeResolver constructors/destructors inlineable. Speedup sprite resolving by about 8 percent.
6 years ago
frosch
82ae414e8d
(svn r27928) -Fix: [NewGRF] While executing random triggers, var 5F should include the new triggers.
...
-Fix: [NewGRF] Reset used random triggers only after all A123 chains have been resolved, so that all RA2 in all chains can test the shard triggers. This also includes multiple RA2 in the same A123 chain.
-Fix: [NewGRF] Industry random triggers are stored per tile, even when randomising the shared random bits of the parent industry.
7 years ago