Commit Graph
571 Commits
Author SHA1 Message Date
Peter NelsonandGitHub f34c45c36d Change: Automatically push/pop colours when formatting a sub-string. (#14006)
Reverts 226a44bf86.

This universally prevents the sub-string from changing colours in the outer string.
2025-12-19 20:17:58 +00:00
Peter NelsonandPeter Nelson b03347f00c Revert: "Change: Support side-by-side fallback FontCaches instead of hierarchical. (#13303)"
This reverts commit 1829f7926d.
2025-12-13 09:09:21 +00:00
Cyprian KlimaszewskiandGitHub 99f04f27de Doc: Update information for receiving a copy of GPL. (#14869) 2025-12-07 11:25:08 +00:00
Peter NelsonandGitHub 1829f7926d Change: Support side-by-side fallback FontCaches instead of hierarchical. (#13303)
The text layouter system can now support using different fonts for different glyphs, including mixing scalable and sprite glyphs.
2025-12-06 10:47:12 +00:00
Rito12andGitHub 6ebe64703f Add: Game units for height. (#14615) 2025-10-24 16:25:16 -04:00
Peter NelsonandGitHub 5d5d27841b Fix: Bootstrap ignored default OpenTTD truetype fonts. (#14684)
Bootstrapping assumed that glyphs must be missing if there is no baseset, ignoring whether there actually are glyphs missing.
2025-09-30 22:16:50 +01:00
Peter NelsonandPeter 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 NelsonandPeter 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
Peter NelsonandGitHub 0dc40877fd Codechange: Initialise/reset font cache with FontSizes bitset. (#14448)
Instead of choosing either "Normal/Small/Large" or "Monospace", use an EnumBitSet to allow any combination.
2025-07-18 18:23:28 +01:00
Peter NelsonandGitHub f6e78a480d Change: Make truncation ellipsis translatable. (#14417) 2025-07-09 22:55:43 +01:00
Peter NelsonandGitHub 4b6d409ee8 Codefix: Out-of-range cargo type passed to a string affected remaining parameters. (#14398)
When the string codes CARGO_TINY, CARGO_SHORT or CARGO_LONG encountered an out-of-range string, they did not read the extra amount parameter. This leads to later parameters being used in the wrong place.

Change the order of operation so that all parameters for these string codes are always read, even if the cargo type is not valid.
2025-06-28 21:50:36 +01:00
Peter NelsonandGitHub 20ed5be905 Codechange: Use FontSizeToName() instead of switch block. (#14395) 2025-06-27 20:38:39 +00:00
Peter NelsonandGitHub 1d8db2223f Fix #14234, 5aa4ad5135: Crash due to unexpected NUL char in string. (#14235)
Gracefully handle an unexpected NUL character in non-debug builds.
2025-05-21 18:47:04 +01:00
Peter NelsonandGitHub 940a7127f8 Fix f8bdc1e612: Empty first parameter of EncodedString was skipped. (#14273)
This would place the remaining parameters one position too early.
2025-05-17 22:55:48 +00:00
froschandfrosch a277cb2b4c Change: [NewGRF] Increase the textstack for all callbacks to 16 registers. 2025-05-09 12:39:11 +02:00
froschandfrosch c6fa5022cb Add: [NewGRF] All callbacks returning D0xx strings, have now the option to return any string id via register 0x100. 2025-05-09 12:39:11 +02:00
Peter NelsonandGitHub ae1f469aac Fix #14234, 16b4e73: Skip PLURAL data if parameter is invalid. (#14236) 2025-05-08 09:06:56 +01:00
froschandfrosch eb9bbb2456 Codechange: Remove direct access to temporary storage from TextRefStack. 2025-05-06 22:24:41 +02:00
froschandfrosch 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
Rubidiumandrubidium42 5e3c7c4146 Codechange: char* -> char * 2025-05-04 10:43:56 +02:00
Rubidiumandrubidium42 d037dbb42a Codechange: use std::string_view for locales 2025-05-03 15:58:14 +02:00
Rubidiumandrubidium42 f4ad614285 Codechange: use std::string_view for FS2OTTD and OTTD2FS 2025-04-29 22:33:32 +02:00
Rubidiumandrubidium42 af25eecc15 Codechange: use const for std::string_view where appropriate 2025-04-29 10:15:18 +02:00
Rubidiumandrubidium42 781187b8a6 Codechange: replace C-style strings with std::string_view related to strings functions 2025-04-27 17:57:42 +02:00
Rubidiumandrubidium42 4476ce804d Codechange: use std::string_view for GetNextParameterString 2025-04-26 16:30:16 +02:00
Loïc GuillouxandGitHub f8bdc1e612 Fix f5ffd47: Don't skip separator while reading a record (#14083) 2025-04-23 17:30:51 +02:00
froschandGitHub 2a62eea005 Codefix: Comment style. (#14064) 2025-04-21 17:25:09 +02:00
froschandGitHub 354ad43edb Codechange: Remove unnecessary string constructions. (#14063) 2025-04-21 16:46:31 +02:00
froschandfrosch f5ffd4789b Codechange: Use StringConsumer in FormatString. 2025-04-14 16:57:41 +02:00
froschandfrosch 131b7c7122 Codechange: Replace Utf8Decode usages with StringConsumer. 2025-04-13 21:59:10 +02:00
froschandfrosch fa284af263 Codechange: Replace remaining Utf8Encode usages with StringBuilder. 2025-04-08 23:10:58 +02:00
froschandfrosch 1d879f3043 Codechange: Use StringBuilder to create the gender-scan-string. 2025-04-08 23:10:58 +02:00
froschandfrosch dd073eb38d Codechange: Use StringBuilder to create encoded strings. 2025-04-08 23:10:58 +02:00
froschandfrosch ad8e9634ec Codechange: Generalize StringBuilder. 2025-04-08 23:10:58 +02:00
froschandGitHub 3f2b58d6e1 Fix: Validate raw strings from game-scripts, and strip invalid and control characters. (#13976) 2025-04-07 19:30:36 +02:00
froschandfrosch f06bfc0dad Codechange: Use Utf8View to const-iterate over strings, if no particular error handling is needed. 2025-04-03 18:43:41 +02:00
froschandGitHub c105adcd96 Codechange: Encode case/gender/plural choice lists without null termination, only length prefix. (#13876) 2025-03-25 20:32:40 +01:00
froschandGitHub ca801d55d5 Fix: [NewGRF] Display an error, if NewGRF reference out-of-bounds string parameters in gender/plural choices. (#13881) 2025-03-23 20:43:12 +01:00
froschandGitHub 5aa4ad5135 Codechange: Pass unformatted strings from GetStringPtr as std::string_view. (#13871) 2025-03-23 19:23:31 +01:00
froschandGitHub 5764eaaacf Fix: [NewGRF] Plurals and genders did not work in NewGRF substrings, and cases in substrings could mess up cases in the parent string. (#13852) 2025-03-22 13:40:43 +01:00
froschandGitHub a4f3ddae5f Fix: [NewGRF] String parameter stack and case selection were not processed for control code 0x81. (#13851) 2025-03-21 18:13:08 +01:00
froschandGitHub 0cd87bc8c1 Fix: Don't add chars with unspecified signedness to pointers. (#13828) 2025-03-15 18:48:26 +01:00
Rubidiumandrubidium42 754311a779 Codechange: use std::move when appropriate 2025-03-13 13:00:24 +01:00
Peter NelsonandPeter Nelson b979f0414c Codechange: Prevent nested encoded strings. 2025-03-04 21:40:39 +00:00
Peter NelsonandPeter Nelson 27761ae431 Cleanup: Remove global string parameters.
Global parameters, and functions for dealing with them, are now gone.
2025-03-04 08:48:35 +00:00
Peter NelsonandPeter Nelson e818fcbf19 Codechange: Allow encoded strings to use as many parameters as necessary. 2025-03-04 08:48:35 +00:00
Peter NelsonandGitHub 6e10584b91 Codechange: Use EncodedStrings for News messages. (#13654) 2025-02-23 20:24:02 +00:00
Peter NelsonandGitHub b28dca2222 Codechange: Preprocess text ref stack parameters. (#13642)
NewGRF text ref stack is now processed in advance, creating parameters as necessary, and then encoding this into an EncodedString.
2025-02-22 22:03:38 +00:00
Peter NelsonandPeter Nelson 0428f8c667 Codechange: Add AppendStringWithArgsInPlace() function. 2025-02-22 10:33:22 +00:00
Peter NelsonandPeter Nelson 04a16a6b68 Codechange: Add GetParamMaxDigits/Value() functions.
Similar to SetDParamMaxDigits/Value(), except the value is returned instead of being set into a parameter.
2025-02-22 10:33:22 +00:00