Commit Graph

349 Commits

Author SHA1 Message Date
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
Rubidium 19ec4e8beb Codechange: replace ClampToI32/U16 with ClampTo<int32_t/uint16_t> 2023-05-06 21:26:13 +02:00
Rubidium 969a3dc0f3 Codechange: introduce generic ClampTo function to clamp to the range of a type 2023-05-06 21:26:13 +02:00
Rubidium f74e26ca7e Codechange: replace error/usererror printf variant with fmt variant and rename 2023-04-25 17:55:09 +02:00
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 2023-04-24 15:56:01 +00:00
Peter Nelson 075671bcfc Codechange: Rename DECLARE_ENUM_AS_BIT_SET parameter to enum_type.
It works on enums not masks.
2023-04-24 09:17:37 +01:00
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.
2023-04-23 17:46:14 +01:00
Charles Pigott 6fc28d649e Cleanup: Unused alloca definitions and includes 2023-04-15 16:57:00 +01:00
Charles Pigott 8aea13a85b Codechange: Use fmt for SlErrorCorruptFmt 2023-04-10 18:58:48 +01:00
Rubidium 41ef7c88af Codechange: make a numer of Slope related functions constexpr 2023-04-09 19:00:26 +02:00
Michael Lutz 564de01d66 Remove: SmallMatrix be gone. 2023-02-26 21:41:24 +01:00
Michael Lutz fe27db3dfd Codechange: [Linkgraph] Store edges in each node and not in a global matrix. 2023-02-26 21:41:24 +01:00
Rubidium 4e65ec1dc4 Codechange: do not declare functions in blocks 2023-01-29 20:28:45 +01:00
Rubidium f001e84e5e Codechange: use RAII to automatically restore _cur_dpi after use 2023-01-28 20:33:02 +01:00
Rubidium b7a5d8e296 Codechange: add annotation to selectively force inlining in debug build 2023-01-28 20:32:45 +01:00
Rubidium 1ed0b35520 Fix #10009: bad overflow protection when taking out loans 2023-01-15 12:04:50 +01:00
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.
2022-11-19 21:18:53 +00:00
Peter Nelson 75b222b0d9 Add: RectPadding type.
This is similar to Rect but specifies padding to apply to a Rect.
2022-11-12 18:28:39 +00:00