Commit Graph

366 Commits (a3cfd23cf93aa07f6b131211c6911bb6325dcb37)

Author SHA1 Message Date
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 7 months ago
Rubidium a06814c173 Codechange: use std::source_location over __FILE__ and __LINE__ for Random 7 months ago
Rubidium bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 7 months ago
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.
7 months ago
Rubidium f0c50ad529 Codechange: Add function to get the power of ten for a given number 7 months ago
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 8 months ago
Jonathan G Rennison c0b8e58404 Codechange: Simplify SetBitIterator
Use FindFirstBit and KillFirstBit, allowing simpler iterator equality
Add simple test
8 months ago
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.
8 months ago
Tyler Trahan 735abfe111
Codechange: Split dates and timers into Economy and Calendar time (#10700) 8 months ago
Patric Stout 71b8801b61
Fix bd85f61a: [Linux] don't include sys/random.h on older glibc systems (#11844) 8 months ago
Rubidium 086cbd0d72 Codechange: add constexpr to math functions where applicable 8 months ago
Rubidium dfe70181f1 Codechange: add constexpr to bitmath functions where applicable 8 months ago
Rubidium 4c51534b6a Remove: LeastCommonMultiple / GreatestCommonDivisor
Use std::lcm / std::gcd instead.
8 months ago
Patric Stout bd85f61a40 Change: use a stronger hash and actual random information to generate Uids 8 months ago
Rubidium 6b21368bc2 Codechange: replace FIND_FIRST_BIT/FindFirstBit2x64 with FindFirstBit 8 months ago
Rubidium 8faaedeff9 Codechange: replace hand written function to find first/last bit with C++ variant 8 months ago
Rubidium 1c694e433d Codechange: use std::popcount instead of hand written loop 8 months ago
Peter Nelson ae575a7a5b Codechange: Store text run positions in vector of points.
This simplifies the interlaced vector of x/y positions.
8 months ago
Rubidium 2f8de227dc Remove: unused OTTD_ALIGNMENT define and ReadLE16(Un)aligned 8 months ago
Rubidium 47c0184a0b Codechange: replace ROR/ROL with std::rotr/rotl 9 months ago
Patric Stout fd073a2810 Remove: replace custom span with std::span 9 months ago
Rubidium aa5ba5bd7f Codechange: allow certain enumeration to be added
Otherwise C++20 doesn't like it.
9 months ago
Peter Nelson a5b6e17556 Codechange: Make geometry methods constexpr. 9 months ago
Rubidium 3a676a5af0 Codechange: replace static inline with static for non-class functions 9 months ago
Rubidium e3f49ee7a0 Codechange: coding style fixes 9 months ago
Peter Nelson 102fc6a9d1
Cleanup: iif should be iff (if-and-only-if) (#11570) 10 months ago
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.
10 months ago
Peter Nelson 7d48a3f073
Codechange: Move RectPadding::zero definition to header. (#11461)
This potentially allows better inlining/optimization.
11 months ago
Peter Nelson d4008850e3 Codechange: Ensure function opening `{` is on new line. 11 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
Rubidium c6411168d8 Cleanup: missing spaces before continuation * in some comments 11 months ago
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 11 months ago
Peter Nelson 49dae08a3b Codechange: Add missing override specifiers. 1 year ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 1 year ago
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.
1 year ago
Patric Stout 299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761) 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
Patric Stout ab19882e94
Codechange: hint in all branches of ClampTo to resolve compile-time (#11130) 1 year ago
Rubidium 2aa48bfcb3 Add: subspan function to span 1 year ago
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>
1 year ago
PeterN 8a2d550904
Codechange: Use std::reverse instead of custom implementation. (#10918) 1 year ago
Rubidium 29b20718ba Codechange: use Tthis instead of StrongTypedef, so ==/= does not compare/assign different strong typedefs 1 year ago
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.
1 year ago
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 1 year ago
Peter Nelson c38df2d589 Codechange: Use std::map instead of custom SmallMap. 1 year ago
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 1 year ago
Patric Stout 199e41c762
Codechange: use default dtor instead of empty (#10826) 1 year ago
Peter Nelson 59811ec780 Codechange: Use find_if when finding things. 1 year ago
Rubidium 12085d088c Cleanup: remove obsolete string_compare_type 1 year ago
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.
1 year ago