Codechange: use SetDParam and CopyOutDParam for tooltips
This commit is contained in:
@@ -666,17 +666,13 @@ struct TooltipsWindow : public Window
|
||||
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)
|
||||
TooltipsWindow(Window *parent, StringID str, uint paramcount, TooltipCloseCondition close_tooltip) : Window(&_tool_tips_desc)
|
||||
{
|
||||
this->parent = parent;
|
||||
this->string_id = str;
|
||||
static_assert(sizeof(this->params[0]) == sizeof(params[0]));
|
||||
assert(paramcount <= lengthof(this->params));
|
||||
if (params == nullptr) {
|
||||
params = _global_string_params.GetPointerToOffset(0);
|
||||
}
|
||||
if (paramcount > 0) memcpy(this->params, params, sizeof(this->params[0]) * paramcount);
|
||||
this->paramcount = paramcount;
|
||||
if (paramcount > 0) CopyOutDParam(this->params, this->paramcount);
|
||||
this->close_cond = close_tooltip;
|
||||
|
||||
this->InitNested();
|
||||
@@ -757,17 +753,16 @@ struct TooltipsWindow : public Window
|
||||
* Shows a tooltip
|
||||
* @param parent The window this tooltip is related to.
|
||||
* @param str String to be displayed
|
||||
* @param close_tooltip the condition under which the tooltip closes
|
||||
* @param paramcount number of params to deal with
|
||||
* @param params (optional) up to 5 pieces of additional information that may be added to a tooltip
|
||||
* @param close_tooltip when the left (true) or right (false) mouse button is released
|
||||
*/
|
||||
void GuiShowTooltips(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip)
|
||||
void GuiShowTooltips(Window *parent, StringID str, TooltipCloseCondition close_tooltip, uint paramcount)
|
||||
{
|
||||
CloseWindowById(WC_TOOLTIPS, 0);
|
||||
|
||||
if (str == STR_NULL || !_cursor.in_window) return;
|
||||
|
||||
new TooltipsWindow(parent, str, paramcount, params, close_tooltip);
|
||||
new TooltipsWindow(parent, str, paramcount, close_tooltip);
|
||||
}
|
||||
|
||||
void QueryString::HandleEditBox(Window *w, int wid)
|
||||
|
Reference in New Issue
Block a user