summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2019-03-20 02:16:05 +0000
committerPeterN <peter@fuzzle.org>2019-03-20 23:00:32 +0000
commitb3ef06fdf35c4ddadb6396a61aa7f9d1adee2da3 (patch)
tree55bb4f29c36d94636991b6c0cdc01ae1ffae973e /src
parentf5f33da126a072ddacfdb8e5887054f4225d4d86 (diff)
downloadopenttd-b3ef06fdf35c4ddadb6396a61aa7f9d1adee2da3.tar.xz
Fix #7384: Industry Chain tooltips did not display on right-click.
This is fixed by handling the new Window::OnTooltip() event instead of OnHover()
Diffstat (limited to 'src')
-rw-r--r--src/industry_gui.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index a1030122e..78bf3f4a0 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -2753,12 +2753,12 @@ struct IndustryCargoesWindow : public Window {
}
}
- virtual void OnHover(Point pt, int widget)
+ bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond)
{
- if (widget != WID_IC_PANEL) return;
+ if (widget != WID_IC_PANEL) return false;
Point fieldxy, xy;
- if (!CalculatePositionInWidget(pt, &fieldxy, &xy)) return;
+ if (!CalculatePositionInWidget(pt, &fieldxy, &xy)) return false;
const CargoesField *fld = this->fields[fieldxy.y].columns + fieldxy.x;
CargoID cid = INVALID_CARGO;
@@ -2777,9 +2777,9 @@ struct IndustryCargoesWindow : public Window {
case CFT_INDUSTRY:
if (fld->u.industry.ind_type < NUM_INDUSTRYTYPES && (this->ind_cargo >= NUM_INDUSTRYTYPES || fieldxy.x != 2)) {
- GuiShowTooltips(this, STR_INDUSTRY_CARGOES_INDUSTRY_TOOLTIP, 0, NULL, TCC_HOVER);
+ GuiShowTooltips(this, STR_INDUSTRY_CARGOES_INDUSTRY_TOOLTIP, 0, NULL, close_cond);
}
- return;
+ return true;
default:
break;
@@ -2788,8 +2788,11 @@ struct IndustryCargoesWindow : public Window {
const CargoSpec *csp = CargoSpec::Get(cid);
uint64 params[5];
params[0] = csp->name;
- GuiShowTooltips(this, STR_INDUSTRY_CARGOES_CARGO_TOOLTIP, 1, params, TCC_HOVER);
+ GuiShowTooltips(this, STR_INDUSTRY_CARGOES_CARGO_TOOLTIP, 1, params, close_cond);
+ return true;
}
+
+ return false;
}
virtual void OnResize()