1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-02-02 17:11:20 +01:00

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.
This commit is contained in:
Peter Nelson
2024-07-29 17:58:32 +01:00
committed by Peter Nelson
parent b449839538
commit 3d8d0e0d26
10 changed files with 39 additions and 92 deletions

View File

@@ -31,7 +31,7 @@ enum WarningLevel {
class ErrorMessageData {
protected:
bool is_critical; ///< Whether the error message is critical.
std::vector<StringParameterBackup> params; ///< Backup of parameters of the message strings.
std::vector<StringParameterData> params; ///< Backup of parameters of the message strings.
const GRFFile *textref_stack_grffile; ///< NewGRF that filled the #TextRefStack for the error message.
uint textref_stack_size; ///< Number of uint32_t values to put on the #TextRefStack for the error message.
uint32_t textref_stack[16]; ///< Values to put on the #TextRefStack for the error message.