Peter Nelson
33ff64ef74
Codechange: Simplify ConvertDateToYMD by returning YearMonthDay instead of outputting to a pointer. ( #11637 )
9 months ago
Peter Nelson
bd3b28551e
Codechange: Replace reliability magic numbers with constants.
...
These are derived as a percentage of UINT16_MAX.
9 months ago
Peter Nelson
7b2c143df0
Fix: Prevent underflow if engine base life is less than 8 years.
9 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.
11 months ago
Tyler Trahan
f49ffaaaea
Fix e4fd99a
, Fix #11270 : Vehicle max age is not subject to leap years ( #11372 )
11 months ago
Peter Nelson
5869f790d8
Fix: Check for engine variant loops during NewGRF initialization. ( #11343 )
...
Invalid NewGRFs could set up an engine variant loop that never ends. This
was checked for in some places that evaluated variants, but not all. In
most cases this would result in the engines not appearing, but could
potentially cause an infinite loop and crash.
Instead, during NewGRF initialization detect loops and remove invalid
variants before setting display flags.
12 months ago
PeterN
acd7d3c913
Codechange: Rename *Railtype* to *RailType* for consistency. ( #11287 )
1 year ago
Tyler Trahan
77173a6a10
Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes
1 year ago
Tyler Trahan
fca2b37726
Codechange: Move Ticks into their own class
1 year ago
Patric Stout
299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed ( #10761 )
1 year ago
Tyler Trahan
e4fd99a33a
Codechange: Use DateAtStartOfYear() instead of multiplying by DAYS_IN_LEAP_YEAR ( #11174 )
1 year 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
1 year ago
Peter Nelson
76516d7f70
Codechange: Use IsValidCargoID/IsValidCargoType.
...
IsValidCargoType() is used only for unmapped IDs.
1 year ago
Peter Nelson
bf9caa425b
Change: Units-system can convert from N to kN, don't preconvert.
...
This allows force to passed as is and avoid premature rounding.
The AI function "GetMaxTractiveEffort" still needs to return kN to avoid breaking the API.
1 year ago
Tyler Trahan
0fc21b5686
Fix: Engine age is in months, not days ( #10773 )
1 year ago
Tyler Trahan
6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar ( #10753 )
1 year ago
Tyler Trahan
930f0a16d8
Codechange: Define Date/Year/Month/Day within TimerGameCalendar class
1 year ago
PeterN
1697dff744
Change: Hide all variants from UI when (display) parent is hidden. ( #10708 )
1 year ago
Patric Stout
7aa2b9ab0a
Codechange: move all date-related variables inside the timer ( #10706 )
1 year ago
aeonofdiscord
36f5fe19fe
Fix #10665 : CheckEngines should ignore wagons when determining available vehicles at the start date. ( #10673 )
1 year ago
Patric Stout
3ebc7ad16e
Codechange: migrate all game-time-related timers to the new framework
1 year ago
Peter Nelson
65e0b0dcb7
Codechange: Be consistent with how company masks are set to all.
1 year ago
Michael Lutz
05ed9f56fd
Feature: [NewGRF] Engine name callback.
2 years ago
glx22
012fd2be0d
Codechange: Suppress warnings when asserts are disabled
2 years ago
Peter Nelson
cbf48c4dd9
Change: Add extra random seed to StartupEngines().
...
This means that calling reset_engines will rerandomise introduction dates
and reliability.
Probably not necessary.
2 years ago
Peter Nelson
74180efe7f
Change: Attempt to improve randomisation of reliability
2 years ago
Peter Nelson
3485709f53
Add: Additional vehicle flags to control variants.
2 years ago
Peter Nelson
898dadadb2
Change: Mark build/autoreplace windows dirty less often in monthy loop.
...
These window classes were marked dirty for every engine that had
reliability calculated every month.
2 years ago
Peter Nelson
c11db7d593
Change: Clear last variant when engine becomes unavailable.
2 years ago
peter1138
d7f561a400
Change: Add variant property to engines.
2 years ago
frosch
acf9d786f1
Fix: [NewGRF] Default value of RailVehicleInfo::railveh_type was inconsistent with other default properties. ( #9967 )
...
If a NewGRF assigned neither "power" nor "dual-headed" properties,
then "railveh_type" defaulted to "singlehead-engine", while "power=0" said "it's a wagon".
2 years ago
Michael Lutz
21675ec7e2
Codechange: Un-bitstuff vehicle/engine commands.
3 years ago
Michael Lutz
7048e1522f
Codechange: Move flags in CommandProc in front of the command arguments.
3 years ago
Michael Lutz
33ca4f2b99
Codechange: Let the compile generate the master command table out of templated command traits.
...
This is using a non-intrusive type-traits like templated system, which
allows compile-time validation that the command table and the command
enum match up.
3 years ago
Patric Stout
28e90769f7
Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had
...
While at it, replace OTTD_ASSERT with WITH_ASSERT, as this
is always set if assert() is valid. No matter if NDEBUG is set
or not.
3 years ago
glx22
5799402f7a
Codechange: Rename window related DeleteXXX to match new behaviour
3 years ago
rubidium42
2e136285e1
Codechange: move from C-string to std::string for DoCommand
3 years ago
rubidium42
661728558e
Codechange: let IsUnique.* functions accept std::string
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
dP
7c7c6cde03
Fix: Do not unlock railtypes when enabling wagons with GameScript
3 years ago
Patric Stout
fece1c57ca
Codechange: Suppress warnings when asserts are disabled ( #8917 )
4 years ago
dP
d8dfa1613f
Fix: Recompute road/railtype availability after disabling the engine
4 years ago
Patric Stout
5f591c86fe
Fix 85a49a0d: invalidate airport toolbar when new planes become available ( #8532 )
...
Otherwise if the airport button is disabled, it will remain disabled
until you close/open the toolbar again.
4 years ago
Charles Pigott
9b800a96ed
Codechange: Remove min/max functions in favour of STL variants ( #8502 )
4 years ago
frosch
b08d8c7edb
Cleanup 9f42358: Make also reliability_start randomised independent of introduction date.
4 years ago
frosch
d24a9a9df5
Cleanup 8139b14: Move a comment back to the line it belongs to, and add a comment for new code.
4 years ago
SamuXarick
9f423586ad
Change #8325 : Make engine reliability independent of introduction date ( #8470 )
4 years ago
Charles Pigott
860c270c73
Codechange: Replace assert_compile macro with static_assert
4 years ago
Michael Lutz
79240eab1e
Codechange: Make use of the improved C++17 emplace_back function.
4 years ago
Michael Lutz
63ccb36ef3
Codechange: Use std::string for most of the user-settable custom names.
4 years ago