mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Allow use of SetDParam for tooltips
This commit is contained in:
parent
93d2d4590f
commit
65530a76f6
|
@ -672,7 +672,7 @@ struct TooltipsWindow : public Window
|
|||
{
|
||||
StringID string_id; ///< String to display as tooltip.
|
||||
byte paramcount; ///< Number of string parameters in #string_id.
|
||||
uint64 params[5]; ///< The string parameters.
|
||||
uint64 params[8]; ///< The string parameters.
|
||||
TooltipCloseCondition close_cond; ///< Condition for closing the window.
|
||||
|
||||
TooltipsWindow(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip) : Window(&_tool_tips_desc)
|
||||
|
@ -681,6 +681,10 @@ struct TooltipsWindow : public Window
|
|||
this->string_id = str;
|
||||
static_assert(sizeof(this->params[0]) == sizeof(params[0]));
|
||||
assert(paramcount <= lengthof(this->params));
|
||||
if (params == nullptr) {
|
||||
_global_string_params.offset = 0;
|
||||
params = _global_string_params.GetDataPointer();
|
||||
}
|
||||
if (paramcount > 0) memcpy(this->params, params, sizeof(this->params[0]) * paramcount);
|
||||
this->paramcount = paramcount;
|
||||
this->close_cond = close_tooltip;
|
||||
|
|
Loading…
Reference in New Issue