Commit Graph

269 Commits

Author SHA1 Message Date
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.
2023-11-06 20:29:35 +00:00
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.
2023-10-20 18:40:26 +01:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
PeterN acd7d3c913
Codechange: Rename *Railtype* to *RailType* for consistency. (#11287) 2023-09-11 08:55:12 +00:00
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 2023-09-10 08:40:25 -04:00
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.
2023-09-09 23:21:21 +02:00
Patric Stout 299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761) 2023-08-12 18:14:21 +00:00
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>
2023-08-06 12:57:10 -04:00
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
2023-07-19 19:30:14 +02:00
rubidium42 9f6fec01cd
Codechange: rename cargo aging days to periods, as they are not really days (#11112) 2023-07-12 13:20:02 -04:00
Peter Nelson 76516d7f70 Codechange: Use IsValidCargoID/IsValidCargoType.
IsValidCargoType() is used only for unmapped IDs.
2023-05-22 20:43:40 +01:00
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 2023-05-20 16:53:10 +02:00
Rubidium fb856e16c1 Codechange: replace some min/clamp constructs to ClampTo 2023-05-06 21:26:13 +02:00
Rubidium 19ec4e8beb Codechange: replace ClampToI32/U16 with ClampTo<int32_t/uint16_t> 2023-05-06 21:26:13 +02:00
Peter Nelson 7ccdefa1c1 Change: Increase vehicle random data from 8 to 16 bits. 2023-05-04 21:42:28 +01:00
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 2023-04-24 15:56:01 +00:00
Rubidium 7088f5b7c7 Codechange: use string/fmt instead of printf for grfmsg 2023-04-18 23:21:08 +02:00
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.
2023-01-14 21:15:23 +01:00
Peter Nelson efa20dd969 Change: Support engine property 0xC6 in purchase list. 2022-12-25 16:41:58 +00:00
frosch 111a47af0d Codechange: rename 'info_view' to 'rotor_in_gui', because it is only used by helicopters. 2021-10-23 14:45:08 +02:00
frosch bc984d9af5 Codechange: remove redundant 'info_view' parameter, it can be derived from 'image_type'. 2021-10-23 14:45:08 +02:00
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)."
2021-08-15 12:14:53 +02:00
Vít Šefl 2183fd4dab
Feature: [NewGRF] Maximum curve speed modifier for rail vehicles (#9346) 2021-08-15 11:17:05 +02:00
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
Peter Nelson f785a70a2b Cleanup: Use std::vector in RealSpriteGroup. 2021-05-02 09:41:01 +01:00
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.
2021-04-30 12:03:07 +01:00
Johannes E. Krause 3ac43582c2 Codechange: [NewGRF] Make it more explicit which parts of the TTD vehicle structure (var 80+) are not implemented 2021-02-13 16:07:23 +00:00
Johannes E. Krause f1bc4d8407 Add: [NewGRF] Vehicle variable 4A now also returns, whether the current tile has catenary. 2021-01-10 21:24:38 +01:00
frosch 868d84bbfc Add: [NewGRF] vehicle variable 63 to test the tracktype of the current tile against a given tracktype. 2021-01-10 21:24:38 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 2020-12-27 10:55:42 +00:00
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.
2020-01-26 13:45:51 +01:00
glx 1f6b3a37f9 Codechange: Replace FOR_ALL_ENGINES with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
JMcKiern 04f659e768 Fix: Some typos found using codespell 2019-09-29 21:27:32 +01:00
peter1138 c02ef3e456 Feature: Add NotRoadTypes (NRT) 2019-05-01 21:36:27 +02:00
glx 801cbea9cc Codechange: use std::sort() for all std::vector types 2019-04-13 12:49:18 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 2019-03-26 20:15:57 +00:00
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson 2bc2de9034 Codechange: Replaced SmallVector::Find() with std::find() 2019-03-26 20:15:57 +00:00
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
Henry Wilson 097328c3d7 Codechange: Replaced SmallVector::Get() const with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson f3938fdb83 Codechange: Replaced SmallVector::Reset() with std::vector::clear() + shrink_to_fit() 2019-03-26 20:15:57 +00:00
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 2019-03-26 20:15:57 +00:00
frosch d9d669dcf8 (svn r27984) -Codechange: Make ScopeResolver constructors/destructors inlineable. Speedup sprite resolving by about 8 percent. 2018-03-11 13:19:41 +00:00
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.
2017-10-25 15:38:14 +00:00
frosch 117e73751c (svn r27668) -Feature: [NewGRF] Allow composing vehicles from multiple sprites. 2016-10-16 14:59:44 +00:00
frosch d2393b4f6c (svn r27666) -Codechange: Pass vehicle sprites around using a struct VehicleSpriteSeq. 2016-10-16 14:57:56 +00:00
frosch c97d3c322f (svn r27075) -Fix [FS#6182]: Variable 47 used the carge translation table of the wrong GRF in case of callback 1D. 2014-12-07 14:13:21 +00:00