Merge branch 'enhanced_viewport_overlay' into jgrpp

# Conflicts:
#	src/vehicle.cpp
This commit is contained in:
Jonathan G Rennison
2017-09-04 01:24:10 +01:00
12 changed files with 212 additions and 204 deletions

View File

@@ -478,6 +478,12 @@ static const byte _vehicle_type_colours[6] = {
};
/** Notify the industry chain window to stop sending newly selected industries. */
/* static */ void SmallMapWindow::BreakIndustryChainLink()
{
InvalidateWindowClassesData(WC_INDUSTRY_CARGOES, NUM_INDUSTRYTYPES);
}
inline Point SmallMapWindow::SmallmapRemapCoords(int x, int y) const
{
Point pt;
@@ -975,6 +981,12 @@ SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : Window(des
this->SetOverlayCargoMask();
}
SmallMapWindow::~SmallMapWindow()
{
delete this->overlay;
this->BreakIndustryChainLink();
}
/**
* Rebuilds the colour indices used for fast access to the smallmap contour colours based on the heightlevel.
*/
@@ -1184,6 +1196,7 @@ void SmallMapWindow::SwitchMapType(SmallMapType map_type)
this->SetupWidgetData();
if (map_type == SMT_LINKSTATS) this->overlay->RebuildCache();
if (map_type != SMT_INDUSTRY) this->BreakIndustryChainLink();
this->SetDirty();
}
@@ -1235,6 +1248,8 @@ void SmallMapWindow::SelectLegendItem(int click_pos, LegendAndColour *legend, in
} else {
legend[click_pos].show_on_map = !legend[click_pos].show_on_map;
}
if (this->map_type == SMT_INDUSTRY) this->BreakIndustryChainLink();
}
/**
@@ -1289,9 +1304,6 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
/* virtual */ void SmallMapWindow::OnClick(Point pt, int widget, int click_count)
{
/* User clicked something, notify the industry chain window to stop sending newly selected industries. */
InvalidateWindowClassesData(WC_INDUSTRY_CARGOES, NUM_INDUSTRYTYPES);
switch (widget) {
case WID_SM_MAP: { // Map window
/*
@@ -1382,6 +1394,7 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
case SMT_INDUSTRY:
tbl = _legend_from_industries;
NotifyAllViewports(VPMT_INDUSTRY);
this->BreakIndustryChainLink();
break;
case SMT_OWNER:
tbl = &(_legend_land_owners[NUM_NO_COMPANY_ENTRIES]);