mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
(svn r23479) -Codechange: keep a copy of raw strings from the parameters of the error messages
This commit is contained in:
parent
c06a3555fb
commit
e88a982fc6
@ -76,6 +76,7 @@ class ErrorMessageData {
|
|||||||
protected:
|
protected:
|
||||||
uint duration; ///< Length of display of the message. 0 means forever,
|
uint duration; ///< Length of display of the message. 0 means forever,
|
||||||
uint64 decode_params[20]; ///< Parameters of the message strings.
|
uint64 decode_params[20]; ///< Parameters of the message strings.
|
||||||
|
const char *strings[20]; ///< Copies of raw strings that were used.
|
||||||
uint textref_stack_size; ///< Number of uint32 values to put on the #TextRefStack for the error message.
|
uint textref_stack_size; ///< Number of uint32 values to put on the #TextRefStack for the error message.
|
||||||
uint32 textref_stack[16]; ///< Values to put on the #TextRefStack for the error message.
|
uint32 textref_stack[16]; ///< Values to put on the #TextRefStack for the error message.
|
||||||
StringID summary_msg; ///< General error message showed in first line. Must be valid.
|
StringID summary_msg; ///< General error message showed in first line. Must be valid.
|
||||||
@ -91,6 +92,18 @@ public:
|
|||||||
ErrorMessageData(const ErrorMessageData &data)
|
ErrorMessageData(const ErrorMessageData &data)
|
||||||
{
|
{
|
||||||
*this = data;
|
*this = data;
|
||||||
|
for (size_t i = 0; i < lengthof(this->strings); i++) {
|
||||||
|
if (this->strings[i] != NULL) {
|
||||||
|
this->strings[i] = strdup(this->strings[i]);
|
||||||
|
this->decode_params[i] = (size_t)this->strings[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Free all the strings. */
|
||||||
|
~ErrorMessageData()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < lengthof(this->strings); i++) free(this->strings[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,7 +124,7 @@ public:
|
|||||||
{
|
{
|
||||||
this->position.x = x;
|
this->position.x = x;
|
||||||
this->position.y = y;
|
this->position.y = y;
|
||||||
CopyOutDParam(this->decode_params, 0, lengthof(this->decode_params));
|
CopyOutDParam(this->decode_params, this->strings, detailed_msg == INVALID_STRING_ID ? summary_msg : detailed_msg, lengthof(this->decode_params));
|
||||||
if (textref_stack_size > 0) {
|
if (textref_stack_size > 0) {
|
||||||
MemCpyT(this->textref_stack, textref_stack, textref_stack_size);
|
MemCpyT(this->textref_stack, textref_stack, textref_stack_size);
|
||||||
}
|
}
|
||||||
@ -312,6 +325,7 @@ void UnshowCriticalError()
|
|||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
if (w->IsCritical()) _errors.push_front(*w);
|
if (w->IsCritical()) _errors.push_front(*w);
|
||||||
_window_system_initialized = false;
|
_window_system_initialized = false;
|
||||||
|
delete w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user