Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
Rubidium
a06814c173
Codechange: use std::source_location over __FILE__ and __LINE__ for Random
2024-03-11 20:30:33 +01:00
Rubidium
bab5a8a787
Codechange: use std::source_location over __FILE__ and __LINE__ for Backup
2024-03-10 10:14:20 +01:00
Peter Nelson
2ecc3c90f7
Change: Improve performance of finding free pool slots. ( #12055 )
...
Add a bitmap of used pool slots which allows finding a free pool slot without having to check if each index is already used or not.
Loosely based on a JGRPP patch.
2024-02-17 18:29:21 +00:00
Rubidium
f0c50ad529
Codechange: Add function to get the power of ten for a given number
2024-02-17 14:33:16 +01:00
frosch
b1718478c8
Codechange: Replace old non-standard attributes with C++17/20 standard attributes.
2024-02-02 22:29:28 +01:00
Jonathan G Rennison
c0b8e58404
Codechange: Simplify SetBitIterator
...
Use FindFirstBit and KillFirstBit, allowing simpler iterator equality
Add simple test
2024-02-01 23:05:57 +01:00
Patric Stout
ea8c1d8597
Change: make for smooth-scrolling based on actual time
...
This means if rendering takes a bit longer, scrolling goes a bit
quicker, making travel time always about the same time for the
same distance.
2024-01-25 10:29:48 +01:00
Tyler Trahan
735abfe111
Codechange: Split dates and timers into Economy and Calendar time ( #10700 )
2024-01-22 09:04:34 -05:00
Patric Stout
71b8801b61
Fix bd85f61a: [Linux] don't include sys/random.h on older glibc systems ( #11844 )
2024-01-20 20:43:06 +00:00
Rubidium
086cbd0d72
Codechange: add constexpr to math functions where applicable
2024-01-20 17:30:36 +01:00
Rubidium
dfe70181f1
Codechange: add constexpr to bitmath functions where applicable
2024-01-20 17:30:36 +01:00
Rubidium
4c51534b6a
Remove: LeastCommonMultiple / GreatestCommonDivisor
...
Use std::lcm / std::gcd instead.
2024-01-20 16:45:21 +01:00
Patric Stout
bd85f61a40
Change: use a stronger hash and actual random information to generate Uids
2024-01-20 14:23:03 +01:00
Rubidium
6b21368bc2
Codechange: replace FIND_FIRST_BIT/FindFirstBit2x64 with FindFirstBit
2024-01-19 21:10:39 +01:00
Rubidium
8faaedeff9
Codechange: replace hand written function to find first/last bit with C++ variant
2024-01-19 21:10:39 +01:00
Rubidium
1c694e433d
Codechange: use std::popcount instead of hand written loop
2024-01-19 06:48:55 +01:00
Peter Nelson
ae575a7a5b
Codechange: Store text run positions in vector of points.
...
This simplifies the interlaced vector of x/y positions.
2024-01-19 00:08:31 +00:00
Rubidium
2f8de227dc
Remove: unused OTTD_ALIGNMENT define and ReadLE16(Un)aligned
2024-01-18 23:29:15 +01:00
Rubidium
47c0184a0b
Codechange: replace ROR/ROL with std::rotr/rotl
2024-01-17 23:05:40 +01:00
Patric Stout
fd073a2810
Remove: replace custom span with std::span
2024-01-17 00:25:08 +01:00
Rubidium
aa5ba5bd7f
Codechange: allow certain enumeration to be added
...
Otherwise C++20 doesn't like it.
2024-01-16 23:30:23 +01:00
Peter Nelson
a5b6e17556
Codechange: Make geometry methods constexpr.
2024-01-16 21:57:05 +00:00
Rubidium
3a676a5af0
Codechange: replace static inline with static for non-class functions
2024-01-06 13:37:33 +01:00
Rubidium
e3f49ee7a0
Codechange: coding style fixes
2024-01-04 16:23:54 +01:00
Peter Nelson
102fc6a9d1
Cleanup: iif should be iff (if-and-only-if) ( #11570 )
2023-12-10 12:05:28 +00:00
Peter Nelson
62e4d1e507
Codechange: Dimension must have both width and height.
...
Default parameters allowed Dimension to be constructed with only a width.
Instead use separate empty and width/height constructors to ensure that either none or both are provided.
2023-12-02 15:23:05 +00:00
Peter Nelson
7d48a3f073
Codechange: Move RectPadding::zero definition to header. ( #11461 )
...
This potentially allows better inlining/optimization.
2023-11-16 17:07:29 +00:00
Peter Nelson
d4008850e3
Codechange: Ensure function opening `{` is on new line.
2023-11-09 20:15:38 +00:00
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
Rubidium
c6411168d8
Cleanup: missing spaces before continuation * in some comments
2023-11-01 22:56:11 +01:00
Rubidium
c9276c2959
Codechange: replace x.size() == 0 with x.empty()
2023-10-20 23:05:43 +02:00
Peter Nelson
49dae08a3b
Codechange: Add missing override specifiers.
2023-09-25 21:27:45 +01:00
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
2023-09-19 22:49:59 +02:00
Patric Stout
07730584d7
Codechange: make explicit when a TileIndex is cast to its basetype ( #11190 )
...
This prevents people accidentially assigning a TileIndex to a Date
or any other type they shouldn't.
2023-08-15 18:12:05 +02:00
Patric Stout
299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed ( #10761 )
2023-08-12 18:14:21 +00: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
Patric Stout
ab19882e94
Codechange: hint in all branches of ClampTo to resolve compile-time ( #11130 )
2023-07-12 13:54:44 +00:00
Rubidium
2aa48bfcb3
Add: subspan function to span
2023-06-21 05:46:11 +02:00
Patric Stout
0f3dd9c796
Fix: crash when window can't be placed on low resolution screens. ( #10932 )
...
Co-authored-by: Jonathan G Rennison <j.g.rennison@gmail.com>
2023-06-04 15:39:57 +00:00
PeterN
8a2d550904
Codechange: Use std::reverse instead of custom implementation. ( #10918 )
2023-06-03 23:25:01 +01:00
Rubidium
29b20718ba
Codechange: use Tthis instead of StrongTypedef, so ==/= does not compare/assign different strong typedefs
2023-05-23 20:46:32 +02:00
Rubidium
6f2f38b3ed
Codechange: fmt (and std::format) do explicitly not support enums out-of-the-box
...
That it works for the version we have packaged it pure coincidence, as that is
one of the few versions that due to a bug allow it. So add the appropriate
template specialisations to support it out-of-the-box within OpenTTD.
2023-05-22 14:42:18 +02:00
Rubidium
3323402aaa
Codechange: rename smallvec_type to container_func and use only when needed
2023-05-20 16:53:10 +02:00
Peter Nelson
c38df2d589
Codechange: Use std::map instead of custom SmallMap.
2023-05-18 12:18:30 +01:00
Peter Nelson
56085be9bd
Codechange: Move includes for common STL headers to stdafx.
2023-05-17 10:14:41 +01:00
Patric Stout
199e41c762
Codechange: use default dtor instead of empty ( #10826 )
2023-05-14 23:31:03 +02:00
Peter Nelson
59811ec780
Codechange: Use find_if when finding things.
2023-05-11 07:58:55 +01:00
Rubidium
12085d088c
Cleanup: remove obsolete string_compare_type
2023-05-09 23:14:48 +02:00
Rubidium
68ff3fd062
Change: include fmt.h C++ headers in stdafx.h
...
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
2023-05-08 16:49:23 +02:00