Loïc Guilloux and GitHub
f8bdc1e612
Fix f5ffd47: Don't skip separator while reading a record ( #14083 )
2025-04-23 17:30:51 +02:00
frosch and GitHub
2a62eea005
Codefix: Comment style. ( #14064 )
2025-04-21 17:25:09 +02:00
frosch and GitHub
354ad43edb
Codechange: Remove unnecessary string constructions. ( #14063 )
2025-04-21 16:46:31 +02:00
frosch and frosch
f5ffd4789b
Codechange: Use StringConsumer in FormatString.
2025-04-14 16:57:41 +02:00
frosch and frosch
131b7c7122
Codechange: Replace Utf8Decode usages with StringConsumer.
2025-04-13 21:59:10 +02:00
frosch and frosch
fa284af263
Codechange: Replace remaining Utf8Encode usages with StringBuilder.
2025-04-08 23:10:58 +02:00
frosch and frosch
1d879f3043
Codechange: Use StringBuilder to create the gender-scan-string.
2025-04-08 23:10:58 +02:00
frosch and frosch
dd073eb38d
Codechange: Use StringBuilder to create encoded strings.
2025-04-08 23:10:58 +02:00
frosch and frosch
ad8e9634ec
Codechange: Generalize StringBuilder.
2025-04-08 23:10:58 +02:00
frosch and GitHub
3f2b58d6e1
Fix: Validate raw strings from game-scripts, and strip invalid and control characters. ( #13976 )
2025-04-07 19:30:36 +02:00
frosch and frosch
f06bfc0dad
Codechange: Use Utf8View to const-iterate over strings, if no particular error handling is needed.
2025-04-03 18:43:41 +02:00
frosch and GitHub
c105adcd96
Codechange: Encode case/gender/plural choice lists without null termination, only length prefix. ( #13876 )
2025-03-25 20:32:40 +01:00
frosch and GitHub
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
frosch and GitHub
5aa4ad5135
Codechange: Pass unformatted strings from GetStringPtr as std::string_view. ( #13871 )
2025-03-23 19:23:31 +01:00
frosch and GitHub
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
frosch and GitHub
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
frosch and GitHub
0cd87bc8c1
Fix: Don't add chars with unspecified signedness to pointers. ( #13828 )
2025-03-15 18:48:26 +01:00
Rubidium and rubidium42
754311a779
Codechange: use std::move when appropriate
2025-03-13 13:00:24 +01:00
Peter Nelson and Peter Nelson
b979f0414c
Codechange: Prevent nested encoded strings.
2025-03-04 21:40:39 +00:00
Peter Nelson and Peter 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 Nelson and Peter Nelson
e818fcbf19
Codechange: Allow encoded strings to use as many parameters as necessary.
2025-03-04 08:48:35 +00:00
Peter Nelson and GitHub
6e10584b91
Codechange: Use EncodedStrings for News messages. ( #13654 )
2025-02-23 20:24:02 +00:00
Peter Nelson and GitHub
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 Nelson and Peter Nelson
0428f8c667
Codechange: Add AppendStringWithArgsInPlace() function.
2025-02-22 10:33:22 +00:00
Peter Nelson and Peter 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
Peter Nelson and Peter Nelson
4c99b5b368
Codechange: Return pair from GetBroadestDigit instead of out parameters.
2025-02-22 10:33:22 +00:00
Peter Nelson and GitHub
2d7d085e8e
Codechange: Use EncodedString for error messages. ( #13569 )
2025-02-16 10:04:32 +00:00
Peter Nelson and Peter Nelson
75387b9e2b
Codechange: Use EnumBitSet for StationFacility.
2025-02-13 18:03:13 +00:00
Peter Nelson and Peter Nelson
1f21e9dc74
Codechange: String parameter encoding for regular strings.
...
This allows a string and its parameters to be encoded and stored as just one string, instead of juggling with capturing and restoring string parameters.
The advantage of EncodedStrings over raw strings is they use current language and parameter values at the point of decoding.
2025-02-10 22:49:14 +00:00
Peter Nelson and GitHub
dccc6185b9
Codechange: Change internal format of encoded strings to improve robustness and allow expansion. ( #13499 )
2025-02-09 12:45:50 +00:00
Peter Nelson and Peter Nelson
be00fd4447
Codechange: Use std::array as simple string parameter container.
...
ArrayStringParameters contains extra state that is used when formatting strings which isn't needed when creating parameter lists.
MakeParameters() now returns a std::array which contains only the parameter data. This simpler container is more widely available than before.
2025-02-07 12:30:34 +00:00
Peter Nelson and GitHub
59354576d4
Codechange: Use EnumBitSet for LandscapeTypes and remove LandscapeID. ( #13436 )
2025-02-01 23:09:18 +00:00
merni-ns and rubidium42
9ff485b329
Fix #13304 : Refer to font document in font error message
...
Instead of referring to readme which doesn't say anything about this anymore
2025-02-01 23:51:26 +01:00
Peter Nelson and Peter Nelson
40aeedeade
Codechange: Use EnumBitSet for callback masks.
2025-01-31 17:08:24 +00:00
Rubidium and rubidium42
e894a5880c
Codechange: rename CargoID to CargoType and amend related variables/comments
2025-01-26 18:07:10 +01:00
Loïc Guilloux and GitHub
ef826a048a
Codechange: [WIN32] Use language isocode for fallback font detection ( #13310 )
2025-01-21 15:57:09 +01:00
Rubidium and rubidium42
fe4ca52059
Codechange: replace magic numbers with named constants
2025-01-04 23:20:33 +01:00
Rubidium and rubidium42
76cc3438bf
Codechange: make GetSpecialNameString less magic-number heavy
2025-01-04 21:06:07 +01:00
Rubidium and rubidium42
65731bb964
Codechange: use SPECSTR_..._END over _LAST, to prevent + 1 everywhere
2025-01-04 21:06:07 +01:00
Rubidium and rubidium42
fd7a883cbd
Codechange: make the StringIndex (within a StringTab) a strong type
2025-01-02 21:19:00 +01:00
Peter Nelson and Peter Nelson
2d372fa516
Codechange: NewGRF strings are not StringIDs.
...
Add GRFStringID type and use it when dealing with GRF-local string IDs.
2025-01-02 20:03:40 +00:00
Rubidium and rubidium42
fedfacf472
Codechange: always do StringID + offset, instead of offset + StringID
2025-01-02 17:09:31 +01:00
Peter Nelson and GitHub
3d73c95080
Fix: Potential out-of-bounds reads due to uninitialised string parameters. ( #13153 )
...
If string parameters are not set correctly, FormatString can read out of bounds and crash the game.
This does not fix the root cause, just a nasty symptom.
2024-12-07 15:48:49 +00:00
Peter Nelson and GitHub
cba329d9e2
Add: Translatable list separator. ( #13149 )
...
Some languages should use a separator other than ", " to separate list items, so it is now a translatable string.
2024-12-06 12:32:36 +00:00
Peter Nelson and GitHub
14b986609b
Add: AppendStringInPlace() to append translated string ID into an existing string. ( #12969 )
...
This allows avoiding a string copy when building strings.
2024-10-07 19:05:38 +01:00
Peter Nelson and GitHub
16b4e737a3
Fix 3d8d0e0d26: Don't assume plural parameter is valid. ( #12954 )
...
A crash can occur if the parameter used for a plural isn't a numeric value.
2024-09-21 15:04:35 +01:00
Peter Nelson and GitHub
908ee7292b
Codechange: Replace all FILE * with FileHandle RAII class. ( #12718 )
...
This removes the need to manually ensure all files are closed.
2024-09-16 08:45:26 +01:00
Peter Nelson and Peter Nelson
d1463f415f
Codechange: Treat reading incorrect parameter type as a string error.
...
Previously reading a string as a number would return 0 instead.
2024-09-14 15:31:05 +01:00
Peter Nelson and Peter Nelson
3d8d0e0d26
Codechange: Use std::variant to store string parameter data.
...
This avoids storing two separate values and makes the test for which type is held clearer.
This replaces use of unique_ptr for conditionally storing a string, and is also used in place of StringParameterBackup.
2024-09-14 15:31:05 +01:00
Peter Nelson and Peter Nelson
b449839538
Codechange: Pass span instead of vector to HaveDParamChanged.
2024-09-14 15:31:05 +01:00