Commit Graph

332 Commits (9c49a6124928993a93b7eedbcee0f3c975e4060b)

Author SHA1 Message Date
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
Rubidium 19ec4e8beb Codechange: replace ClampToI32/U16 with ClampTo<int32_t/uint16_t> 1 year ago
Rubidium 969a3dc0f3 Codechange: introduce generic ClampTo function to clamp to the range of a type 1 year ago
Rubidium f74e26ca7e Codechange: replace error/usererror printf variant with fmt variant and rename 1 year ago
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 1 year ago
Peter Nelson 075671bcfc Codechange: Rename DECLARE_ENUM_AS_BIT_SET parameter to enum_type.
It works on enums not masks.
1 year ago
PeterN 9910240f0e
Cleanup: Remove obsolete (Make)EnumPropsT. (#10697)
This was used by the command system to help extract p1/p2 parameters, which no longer happens.
1 year ago
Charles Pigott 6fc28d649e Cleanup: Unused alloca definitions and includes 1 year ago
Charles Pigott 8aea13a85b Codechange: Use fmt for SlErrorCorruptFmt 1 year ago
Rubidium 41ef7c88af Codechange: make a numer of Slope related functions constexpr 1 year ago
Michael Lutz 564de01d66 Remove: SmallMatrix be gone. 2 years ago
Michael Lutz fe27db3dfd Codechange: [Linkgraph] Store edges in each node and not in a global matrix. 2 years ago
Rubidium 4e65ec1dc4 Codechange: do not declare functions in blocks 2 years ago
Rubidium f001e84e5e Codechange: use RAII to automatically restore _cur_dpi after use 2 years ago
Rubidium b7a5d8e296 Codechange: add annotation to selectively force inlining in debug build 2 years ago
Rubidium 1ed0b35520 Fix #10009: bad overflow protection when taking out loans 2 years ago
PeterN a7adadcf9b
Fix: Indent production in industry window and resolve button issues. (#10184)
Industry production used to be indented, although a different amount than
the industry accepts list. This is now added back, with the standard indent
width.

Additionally the cheat-mode production modifier buttons now support RTL and
the list height now takes account of the button height.
2 years ago
Peter Nelson 75b222b0d9 Add: RectPadding type.
This is similar to Rect but specifies padding to apply to a Rect.
2 years ago
Peter Nelson d8e01f8aa5 Codechange: Add some Rect helpers.
Shrink/Expand/Translate are marked nodiscard as they provide a new Rect
rather than modifying the original Rect.
2 years ago
Michael Lutz 13528bfcd0 Codechange: Un-bitstuff all remaining commands. 3 years ago
Michael Lutz 6fe445e6c0 Codechange: Un-bitstuff station/depot/waypoint commands. 3 years ago
Michael Lutz 21675ec7e2 Codechange: Un-bitstuff vehicle/engine commands. 3 years ago
Michael Lutz a05fd7aa50 Change: [Network] Transfer command data as serialized byte stream without fixed structure.
The data will be transmitted as the length followed by the serialized data. This allows the command
data to be different for every command type in the future.
3 years ago
Michael Lutz b0990fcff7 Codechange: Make TileIndex a "strong" typedef to give it a distinct type.
This is accomplished by changing it to a single member struct with the
appropriate operator overloads to make it all work with not too much
source modifications.
3 years ago
Michael Lutz 5ddfdc8516 Codechange: Declare our custom enum operators as constexpr. 3 years ago
Michael Lutz 39e8783f4b Fix: Template syntax error when using 'span' with a container type. 3 years ago
frosch bc22e9333e
Fix: if vehicles only refit to cargo-slots >= 32, the default cargo was wrong. (#9744) 3 years ago
Tyler Trahan 48c1c7f221 Cleanup: Fix typo in overflowsafe_type comment 3 years ago
Loïc Guilloux 8a083cd7f8
Fix 68f2213: Don't use GetPoolSize() for end of pool iterator (#9461) 3 years ago
Charles Pigott f1dfc2f482 Codechange: Make OverflowSafeInt constexpr 3 years ago
Charles Pigott 549a58731f Codechange: Remove (unused) ability to specify min/max of OverflowSafeInt 3 years ago
Charles Pigott e6e2a67aa1 Codechange: Use GCC/clang builtins for overflow safety when supported 3 years ago
Charles Pigott 3d0d9edafd Fix: OverflowSafeInt could underflow
Notably, a company with an extremely negative amount of money would
suddenly become very rich
3 years ago
Charles Pigott 1e439979f7 Fix: OverflowSafeInt negation not handling INT64_MIN
INT64_MIN negated is above INT64_MAX, and would overflow.
Instead, when negating INT64_MIN make it INT64_MAX.
This does mean that -(-(INT64_MIN)) != INT64_MIN.
3 years ago
glx22 ce813ce644 Cleanup: Remove now unused FOR_EACH_SET_BIT_EX macro 3 years ago