Commit Graph

306 Commits

Author SHA1 Message Date
Rubidium aa7eb089c6 Codechange: make all Providers fully const (Font/Screenshot/Sound) 2025-09-29 23:39:13 +03:00
Peter Nelson a2f3d59707 Codefix: Use of nullptr instead of std::nullopt. (#14590) 2025-09-05 14:05:02 +01:00
Peter Nelson e6323e6760 Fix: File/directory titles not updated if language is changed. (#14542) 2025-08-28 17:42:00 +01:00
Peter Nelson e1a50abcbb Codechange: Move fallback font detection to FontCacheFactory.
Provides a standard interface instead of relying on defines.
2025-08-07 19:38:00 +01:00
Peter Nelson 140f2b291a Codechange: Use ProviderManager interface to register FontCache factories.
This removes use of #ifdefs to select the appropriate loader, and also replaces FontCache self-registration.
2025-08-07 19:38:00 +01:00
Rubidium f2b48bad79 Codechange: remove last (hidden) users of memset 2025-05-11 06:07:01 +02:00
Rubidium a48a5f0cc6 Codechange: replace memcpy with std::copy_n 2025-05-10 16:50:58 +02:00
Rubidium f8aceb6c37 Codechange: use value initialisation over memset 2025-05-09 17:20:41 +02:00
Rubidium 8f1e94c546 Codechange: use C++ initialisation over MemSetT 2025-05-06 20:03:35 +02:00
frosch b20b6da937 Codechange: The compiler ensures static variables are initialised only once, no need to track that manually. 2025-05-06 18:29:41 +02:00
frosch 75a775e59d Codechange: Make GetCurrentLocale return a std::string instead of a reference to a static buffer.
For win32 this is even a fix, because the static buffer was only updated once. Later calls discarded the determined locale.
2025-05-06 18:29:41 +02:00
Rubidium 6189bbc45a Codechange: return std::string_view for convert_from_fs 2025-05-04 15:32:52 +02:00
Rubidium afc1e76575 Codefix: StartNewThread uses char* after returning 2025-05-04 14:05:15 +02:00
frosch 8571af9833 Codechange: Turn ZoomLevel into enum class. 2025-05-03 23:21:09 +02:00
frosch bb767608de Codechange: Pass SpriteType as direct parameter to SpriteEncoder::Encoder. 2025-05-03 18:43:20 +02:00
Rubidium d037dbb42a Codechange: use std::string_view for locales 2025-05-03 15:58:14 +02:00
Rubidium c420ba349d Codechange: use std::string_view over char* 2025-05-02 23:12:43 +02:00
Rubidium fbe80f31fe Codechange: replace char* in GetOptData with std::string_view 2025-04-30 23:49:06 +02:00
frosch 9cf36dac39 Codechange: Use data() instead of c_str(), if no NUL termination is needed. 2025-04-30 19:33:56 +02:00
Rubidium 708e6a512d Codechange: replace char* with C++ style strings 2025-04-30 12:05:04 +02:00
Rubidium f4ad614285 Codechange: use std::string_view for FS2OTTD and OTTD2FS 2025-04-29 22:33:32 +02:00
frosch fda93b6f35 Codechange: Add format_append as short-hand to format_to + back_inserter. 2025-04-29 20:26:23 +02:00
Rubidium af25eecc15 Codechange: use const for std::string_view where appropriate 2025-04-29 10:15:18 +02:00
Rubidium 360670626b Codechange: replace char* with std::string_view 2025-04-28 21:31:12 +02:00
Rubidium 86039a5b69 Codechange: make SetDebugString use C++-style strings and function types 2025-04-25 19:04:22 +02:00
frosch 9229956f04 Codechange: Replace strcasestr with StrContainsIgnoreCase. 2025-04-09 17:19:11 +02:00
frosch f640daee4c Codechange: No need for Utf8Consume and Utf8Encode, if only ASCII characters are checked. 2025-04-03 18:43:41 +02:00
frosch 83401ad5e2 Codechange: Use Utf8View::iterator in StringIterator. 2025-04-03 18:43:41 +02:00
frosch 25005cff16 Codefix: std::string_view::data() is not necessarily null terminated. (#13891) 2025-03-25 20:32:19 +01:00
Rubidium 02f040b22a Codechange: remove unused alloc_func.hpp includes 2025-02-24 20:00:19 +01:00
Jonathan G Rennison 23dc393822 Codechange: Compile fmt internals in a separate translation unit (#13527)
Instead of defining FMT_HEADER_ONLY to include fmt internals
in the headers included by all fmt-using translation units.
2025-02-11 20:11:50 +01:00
Patric Stout 86841ba1f0 Codechange: no longer add "src" to the include-path (#13511) 2025-02-09 19:43:15 +00:00
Peter Nelson ba20ea5d18 Codechange: Use EnumBitSet for SpriteComponent. (#13509) 2025-02-09 18:37:01 +00:00
Loïc Guilloux ef826a048a Codechange: [WIN32] Use language isocode for fallback font detection (#13310) 2025-01-21 15:57:09 +01:00
Loïc Guilloux 4670a62342 Fix: [Win32] Font detection didn't work for locales not supporting code pages (#13306) 2025-01-12 17:23:41 +01:00
Peter Nelson 59680867c3 Codechange: Use structured bindings when iterating font_mapping. 2024-12-20 19:05:08 +00:00
Peter Nelson c78e309b16 Codefix: Use snake_case instead of camelCase in layouters. 2024-12-20 19:05:08 +00:00
Valeri 5d8e98207d Codechange: Use lowercase name for winnls.h (#13170)
Fixes cross-compilation under MXE.
2024-12-13 19:55:53 +01:00
Peter Nelson fe0afef36f Codechange: Use unique_ptr instead of raw pointer for string layouts. (#13128) 2024-11-27 23:38:57 +00:00
Peter Nelson 876d53282e Codechange: Use std::ranges::count(_if). 2024-11-24 10:36:03 +00:00
Peter Nelson e98407973f Fix #12993: Replace known-bugs text with markdown version.
This allows a little bit better formatting/display in game.

(No attempt to check if these are still valid known-bugs...)
2024-10-22 00:34:16 +01:00
Jonathan G Rennison 6ca9ddcffa Codefix: [Win32] String handling in OTTDStringCompare, Win32StringContains
Avoid truncation if CompareStringEx is missing
Fix handling of zero length inputs
2024-10-21 17:34:30 +02:00
Jonathan G Rennison d7a2efd623 Codefix: [Win32] Truncated stack trace symbols were not null-terminated
SymGetSymFromAddr64/IMAGEHLP_SYMBOL64 do not null-terminate
symbols with lengths >= the name buffer size
2024-10-21 17:34:03 +02:00
Peter Nelson e2a796dbcd Codefix: Potential unterminated string returned from convert_to_fs.
Converting from UTF-8 to UTF-16 could have resulted in a buffer overflow if the buffer size was exactly the length of the converted string.

Pass string_view/span to convert_from/to_fs instead, and ensure the buffer is terminated. This replaces passing a pointer to the buffer and the buffer size as separate parameters, allowing the compiler to pass both in one parameter.

Removes use of `lengthof()`.
2024-07-10 20:57:02 +01:00
Peter Nelson b37954722b Codefix: Don't copy path string to itself.
When determining base paths on Windows the path is converted to UCS-16, and then copied into the same buffer.
2024-07-10 20:57:02 +01:00
Peter Nelson 6120165433 Fix #12839: Truncated help text dialog on Windows. (#12844)
Replace fixed-length buffer message conversion with std::string.
2024-07-07 18:05:53 +01:00
glx22 b52f778f20 Codefix: [Win32] Use correct range for version in rc file 2024-06-26 23:02:27 +02:00
Peter Nelson 209b0320d5 Fix #12735: Default fonts should use default font size as-is. (#12814)
Minimum readable font size should only apply to fallback and configured fonts.
2024-06-26 12:45:39 +01:00
Peter Nelson b56775f576 Codechange: Avoid making copies of intermediate layout runs. (#12796)
The vector of runs is not used after it is passed to the ParagraphLayout class, so pass with std::move to avoid an unnecessary copy.
2024-06-17 22:58:52 +01:00
Peter Nelson f9f07e9001 Fix #12775: Text truncated incorrectly on Windows. (#12782)
Caused by a -1 in the wrong place, which moved glyphs left one pixel.
2024-06-14 16:32:31 +01:00