Add new minimap mode showing industries, height and farms at the same time
This commit is contained in:
@@ -75,6 +75,7 @@ This is usable for any OpenTTD servers
|
|||||||
== CHANGELOG ==
|
== CHANGELOG ==
|
||||||
|
|
||||||
*** next
|
*** next
|
||||||
|
- Add new map mode showing industries, height and farms at the same time.
|
||||||
- Show engine id in build window in newgrf developer mode.
|
- Show engine id in build window in newgrf developer mode.
|
||||||
|
|
||||||
*** 1.10.1 (15 Apr 2020) ***
|
*** 1.10.1 (15 Apr 2020) ***
|
||||||
|
|||||||
@@ -907,6 +907,8 @@
|
|||||||
<ClCompile Include="..\src\citymania\base64.cpp" />
|
<ClCompile Include="..\src\citymania\base64.cpp" />
|
||||||
<ClInclude Include="..\src\citymania\highlight.hpp" />
|
<ClInclude Include="..\src\citymania\highlight.hpp" />
|
||||||
<ClCompile Include="..\src\citymania\highlight.cpp" />
|
<ClCompile Include="..\src\citymania\highlight.cpp" />
|
||||||
|
<ClInclude Include="..\src\citymania\minimap.hpp" />
|
||||||
|
<ClCompile Include="..\src\citymania\minimap.cpp" />
|
||||||
<ClInclude Include="..\src\citymania\station_ui.hpp" />
|
<ClInclude Include="..\src\citymania\station_ui.hpp" />
|
||||||
<ClCompile Include="..\src\citymania\station_ui.cpp" />
|
<ClCompile Include="..\src\citymania\station_ui.cpp" />
|
||||||
<ClInclude Include="..\src\newgrf_revisions.hpp" />
|
<ClInclude Include="..\src\newgrf_revisions.hpp" />
|
||||||
|
|||||||
@@ -1812,6 +1812,12 @@
|
|||||||
<ClCompile Include="..\src\citymania\highlight.cpp">
|
<ClCompile Include="..\src\citymania\highlight.cpp">
|
||||||
<Filter>CityMania files</Filter>
|
<Filter>CityMania files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClInclude Include="..\src\citymania\minimap.hpp">
|
||||||
|
<Filter>CityMania files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClCompile Include="..\src\citymania\minimap.cpp">
|
||||||
|
<Filter>CityMania files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClInclude Include="..\src\citymania\station_ui.hpp">
|
<ClInclude Include="..\src\citymania\station_ui.hpp">
|
||||||
<Filter>CityMania files</Filter>
|
<Filter>CityMania files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -907,6 +907,8 @@
|
|||||||
<ClCompile Include="..\src\citymania\base64.cpp" />
|
<ClCompile Include="..\src\citymania\base64.cpp" />
|
||||||
<ClInclude Include="..\src\citymania\highlight.hpp" />
|
<ClInclude Include="..\src\citymania\highlight.hpp" />
|
||||||
<ClCompile Include="..\src\citymania\highlight.cpp" />
|
<ClCompile Include="..\src\citymania\highlight.cpp" />
|
||||||
|
<ClInclude Include="..\src\citymania\minimap.hpp" />
|
||||||
|
<ClCompile Include="..\src\citymania\minimap.cpp" />
|
||||||
<ClInclude Include="..\src\citymania\station_ui.hpp" />
|
<ClInclude Include="..\src\citymania\station_ui.hpp" />
|
||||||
<ClCompile Include="..\src\citymania\station_ui.cpp" />
|
<ClCompile Include="..\src\citymania\station_ui.cpp" />
|
||||||
<ClInclude Include="..\src\newgrf_revisions.hpp" />
|
<ClInclude Include="..\src\newgrf_revisions.hpp" />
|
||||||
|
|||||||
@@ -1812,6 +1812,12 @@
|
|||||||
<ClCompile Include="..\src\citymania\highlight.cpp">
|
<ClCompile Include="..\src\citymania\highlight.cpp">
|
||||||
<Filter>CityMania files</Filter>
|
<Filter>CityMania files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClInclude Include="..\src\citymania\minimap.hpp">
|
||||||
|
<Filter>CityMania files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClCompile Include="..\src\citymania\minimap.cpp">
|
||||||
|
<Filter>CityMania files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClInclude Include="..\src\citymania\station_ui.hpp">
|
<ClInclude Include="..\src\citymania\station_ui.hpp">
|
||||||
<Filter>CityMania files</Filter>
|
<Filter>CityMania files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -907,6 +907,8 @@
|
|||||||
<ClCompile Include="..\src\citymania\base64.cpp" />
|
<ClCompile Include="..\src\citymania\base64.cpp" />
|
||||||
<ClInclude Include="..\src\citymania\highlight.hpp" />
|
<ClInclude Include="..\src\citymania\highlight.hpp" />
|
||||||
<ClCompile Include="..\src\citymania\highlight.cpp" />
|
<ClCompile Include="..\src\citymania\highlight.cpp" />
|
||||||
|
<ClInclude Include="..\src\citymania\minimap.hpp" />
|
||||||
|
<ClCompile Include="..\src\citymania\minimap.cpp" />
|
||||||
<ClInclude Include="..\src\citymania\station_ui.hpp" />
|
<ClInclude Include="..\src\citymania\station_ui.hpp" />
|
||||||
<ClCompile Include="..\src\citymania\station_ui.cpp" />
|
<ClCompile Include="..\src\citymania\station_ui.cpp" />
|
||||||
<ClInclude Include="..\src\newgrf_revisions.hpp" />
|
<ClInclude Include="..\src\newgrf_revisions.hpp" />
|
||||||
|
|||||||
@@ -1812,6 +1812,12 @@
|
|||||||
<ClCompile Include="..\src\citymania\highlight.cpp">
|
<ClCompile Include="..\src\citymania\highlight.cpp">
|
||||||
<Filter>CityMania files</Filter>
|
<Filter>CityMania files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClInclude Include="..\src\citymania\minimap.hpp">
|
||||||
|
<Filter>CityMania files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClCompile Include="..\src\citymania\minimap.cpp">
|
||||||
|
<Filter>CityMania files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClInclude Include="..\src\citymania\station_ui.hpp">
|
<ClInclude Include="..\src\citymania\station_ui.hpp">
|
||||||
<Filter>CityMania files</Filter>
|
<Filter>CityMania files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -620,6 +620,8 @@ citymania/base64.h
|
|||||||
citymania/base64.cpp
|
citymania/base64.cpp
|
||||||
citymania/highlight.hpp
|
citymania/highlight.hpp
|
||||||
citymania/highlight.cpp
|
citymania/highlight.cpp
|
||||||
|
citymania/minimap.hpp
|
||||||
|
citymania/minimap.cpp
|
||||||
citymania/station_ui.hpp
|
citymania/station_ui.hpp
|
||||||
citymania/station_ui.cpp
|
citymania/station_ui.cpp
|
||||||
newgrf_revisions.hpp
|
newgrf_revisions.hpp
|
||||||
|
|||||||
@@ -5517,3 +5517,4 @@ STR_CM_CONFIG_SETTING_OPEN_VEHICLE_FOR_SHARED_CLONE_HELPTEXT :Open vehicle windo
|
|||||||
STR_CM_CONFIG_SETTING_OPEN_ORDERS_FOR_NEW_VEHICLES :Open orders window for new vehicles: {STRING2}
|
STR_CM_CONFIG_SETTING_OPEN_ORDERS_FOR_NEW_VEHICLES :Open orders window for new vehicles: {STRING2}
|
||||||
STR_CM_CONFIG_SETTING_OPEN_ORDERS_FOR_NEW_VEHICLES_HELPTEXT :Automatically open oreders windown along with a vehicle window for a new vehicles
|
STR_CM_CONFIG_SETTING_OPEN_ORDERS_FOR_NEW_VEHICLES_HELPTEXT :Automatically open oreders windown along with a vehicle window for a new vehicles
|
||||||
STR_CM_PURCHASE_ENGINE_ID :{BLACK}Engine ID: {GOLD}{NUM}
|
STR_CM_PURCHASE_ENGINE_ID :{BLACK}Engine ID: {GOLD}{NUM}
|
||||||
|
STR_CM_SMALLMAP_TOOLTIP_SHOW_IMBA_ON_MAP :{BLACK}Show industries on map combined with land contours and vegetation
|
||||||
|
|||||||
@@ -83,4 +83,4 @@ const byte _openttd_revision_tagged = 1;
|
|||||||
const uint32 _openttd_newgrf_version = 1 << 28 | 10 << 24 | 0 << 20 | 1 << 19 | 28004;
|
const uint32 _openttd_newgrf_version = 1 << 28 | 10 << 24 | 0 << 20 | 1 << 19 | 28004;
|
||||||
|
|
||||||
|
|
||||||
const char _citymania_version[] = "20200514-master-m9ab73e459d 14.05.20";
|
const char _citymania_version[] = "20200514-master-mafcf064445 18.05.20";
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
|
#include "citymania/minimap.hpp"
|
||||||
|
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
static int _smallmap_industry_count; ///< Number of used industries
|
static int _smallmap_industry_count; ///< Number of used industries
|
||||||
@@ -232,6 +234,7 @@ static const LegendAndColour * const _legend_table[] = {
|
|||||||
_legend_routes,
|
_legend_routes,
|
||||||
_legend_vegetation,
|
_legend_vegetation,
|
||||||
_legend_land_owners,
|
_legend_land_owners,
|
||||||
|
_legend_from_industries,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MKCOLOUR(x) TO_LE32X(x)
|
#define MKCOLOUR(x) TO_LE32X(x)
|
||||||
@@ -265,6 +268,7 @@ static SmallMapColourScheme _heightmap_schemes[] = {
|
|||||||
{nullptr, _green_map_heights, lengthof(_green_map_heights), MKCOLOUR_XXXX(0x54)}, ///< Green colour scheme.
|
{nullptr, _green_map_heights, lengthof(_green_map_heights), MKCOLOUR_XXXX(0x54)}, ///< Green colour scheme.
|
||||||
{nullptr, _dark_green_map_heights, lengthof(_dark_green_map_heights), MKCOLOUR_XXXX(0x62)}, ///< Dark green colour scheme.
|
{nullptr, _dark_green_map_heights, lengthof(_dark_green_map_heights), MKCOLOUR_XXXX(0x62)}, ///< Dark green colour scheme.
|
||||||
{nullptr, _violet_map_heights, lengthof(_violet_map_heights), MKCOLOUR_XXXX(0x81)}, ///< Violet colour scheme.
|
{nullptr, _violet_map_heights, lengthof(_violet_map_heights), MKCOLOUR_XXXX(0x81)}, ///< Violet colour scheme.
|
||||||
|
{nullptr, citymania::_yellow_map_heights, lengthof(citymania::_yellow_map_heights), MKCOLOUR_XXXX(0xC1)},
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -579,6 +583,31 @@ static inline uint32 GetSmallMapOwnerPixels(TileIndex tile, TileType t)
|
|||||||
return MKCOLOUR_XXXX(_legend_land_owners[_company_to_list_pos[o]].colour);
|
return MKCOLOUR_XXXX(_legend_land_owners[_company_to_list_pos[o]].colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint32 CM_GetSmallMapIMBAPixels(TileIndex tile, TileType t)
|
||||||
|
{
|
||||||
|
const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour];
|
||||||
|
switch (t) {
|
||||||
|
// case MP_TREES:
|
||||||
|
// if (GetTreeGround(tile) == TREE_GROUND_SNOW_DESERT || GetTreeGround(tile) == TREE_GROUND_ROUGH_SNOW) {
|
||||||
|
// return (_settings_game.game_creation.landscape == LT_ARCTIC) ? MKCOLOUR_XYYX(PC_LIGHT_BLUE, PC_TREES) : MKCOLOUR_XYYX(PC_ORANGE, PC_TREES);
|
||||||
|
// }
|
||||||
|
// return MKCOLOUR_XYYX(PC_GRASS_LAND, PC_TREES);
|
||||||
|
|
||||||
|
case MP_CLEAR:
|
||||||
|
if (IsClearGround(tile, CLEAR_FIELDS) || IsClearGround(tile, CLEAR_DESERT)) {
|
||||||
|
const SmallMapColourScheme *cs = &_heightmap_schemes[3];
|
||||||
|
return cs->height_colours[TileHeight(tile)];
|
||||||
|
}
|
||||||
|
// if (IsClearGround(tile, CLEAR_SNOW))
|
||||||
|
// return _vegetation_clear_bits[GetClearGround(tile)];
|
||||||
|
FALLTHROUGH;
|
||||||
|
|
||||||
|
default:
|
||||||
|
const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour];
|
||||||
|
return ApplyMask(cs->height_colours[TileHeight(tile)], &_smallmap_vehicles_andor[t]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Vehicle colours in #SMT_VEHICLES mode. Indexed by #VehicleType. */
|
/** Vehicle colours in #SMT_VEHICLES mode. Indexed by #VehicleType. */
|
||||||
static const byte _vehicle_type_colours[6] = {
|
static const byte _vehicle_type_colours[6] = {
|
||||||
PC_RED, PC_YELLOW, PC_LIGHT_BLUE, PC_WHITE, PC_BLACK, PC_RED
|
PC_RED, PC_YELLOW, PC_LIGHT_BLUE, PC_WHITE, PC_BLACK, PC_RED
|
||||||
@@ -761,7 +790,7 @@ inline uint32 SmallMapWindow::GetTileColours(const TileArea &ta) const
|
|||||||
|
|
||||||
case MP_INDUSTRY:
|
case MP_INDUSTRY:
|
||||||
/* Special handling of industries while in "Industries" smallmap view. */
|
/* Special handling of industries while in "Industries" smallmap view. */
|
||||||
if (this->map_type == SMT_INDUSTRY) {
|
if (this->map_type == SMT_INDUSTRY || this->map_type == CM_SMT_IMBA) {
|
||||||
/* If industry is allowed to be seen, use its colour on the map.
|
/* If industry is allowed to be seen, use its colour on the map.
|
||||||
* This has the highest priority above any value in _tiletype_importance. */
|
* This has the highest priority above any value in _tiletype_importance. */
|
||||||
IndustryType type = Industry::GetByTile(ti)->type;
|
IndustryType type = Industry::GetByTile(ti)->type;
|
||||||
@@ -810,6 +839,9 @@ inline uint32 SmallMapWindow::GetTileColours(const TileArea &ta) const
|
|||||||
case SMT_OWNER:
|
case SMT_OWNER:
|
||||||
return GetSmallMapOwnerPixels(tile, et);
|
return GetSmallMapOwnerPixels(tile, et);
|
||||||
|
|
||||||
|
case CM_SMT_IMBA:
|
||||||
|
return CM_GetSmallMapIMBAPixels(tile, et);
|
||||||
|
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1032,6 +1064,7 @@ void SmallMapWindow::SetupWidgetData()
|
|||||||
int plane;
|
int plane;
|
||||||
switch (this->map_type) {
|
switch (this->map_type) {
|
||||||
case SMT_INDUSTRY:
|
case SMT_INDUSTRY:
|
||||||
|
case CM_SMT_IMBA:
|
||||||
legend_tooltip = STR_SMALLMAP_TOOLTIP_INDUSTRY_SELECTION;
|
legend_tooltip = STR_SMALLMAP_TOOLTIP_INDUSTRY_SELECTION;
|
||||||
enable_all_tooltip = STR_SMALLMAP_TOOLTIP_ENABLE_ALL_INDUSTRIES;
|
enable_all_tooltip = STR_SMALLMAP_TOOLTIP_ENABLE_ALL_INDUSTRIES;
|
||||||
disable_all_tooltip = STR_SMALLMAP_TOOLTIP_DISABLE_ALL_INDUSTRIES;
|
disable_all_tooltip = STR_SMALLMAP_TOOLTIP_DISABLE_ALL_INDUSTRIES;
|
||||||
@@ -1064,6 +1097,7 @@ void SmallMapWindow::SetupWidgetData()
|
|||||||
this->GetWidget<NWidgetCore>(WID_SM_ENABLE_ALL)->SetDataTip(STR_SMALLMAP_ENABLE_ALL, enable_all_tooltip);
|
this->GetWidget<NWidgetCore>(WID_SM_ENABLE_ALL)->SetDataTip(STR_SMALLMAP_ENABLE_ALL, enable_all_tooltip);
|
||||||
this->GetWidget<NWidgetCore>(WID_SM_DISABLE_ALL)->SetDataTip(STR_SMALLMAP_DISABLE_ALL, disable_all_tooltip);
|
this->GetWidget<NWidgetCore>(WID_SM_DISABLE_ALL)->SetDataTip(STR_SMALLMAP_DISABLE_ALL, disable_all_tooltip);
|
||||||
this->GetWidget<NWidgetStacked>(WID_SM_SELECT_BUTTONS)->SetDisplayedPlane(plane);
|
this->GetWidget<NWidgetStacked>(WID_SM_SELECT_BUTTONS)->SetDisplayedPlane(plane);
|
||||||
|
this->SetWidgetDisabledState(WID_SM_SHOW_HEIGHT, this->map_type == CM_SMT_IMBA);
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : Window(desc), refresh(GUITimer(FORCE_REFRESH_PERIOD))
|
SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : Window(desc), refresh(GUITimer(FORCE_REFRESH_PERIOD))
|
||||||
@@ -1136,7 +1170,7 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
|
|||||||
uint num_columns = 1;
|
uint num_columns = 1;
|
||||||
for (const LegendAndColour *tbl = _legend_table[i]; !tbl->end; ++tbl) {
|
for (const LegendAndColour *tbl = _legend_table[i]; !tbl->end; ++tbl) {
|
||||||
StringID str;
|
StringID str;
|
||||||
if (i == SMT_INDUSTRY) {
|
if (i == SMT_INDUSTRY || i == CM_SMT_IMBA) {
|
||||||
SetDParam(0, tbl->legend);
|
SetDParam(0, tbl->legend);
|
||||||
SetDParam(1, IndustryPool::MAX_SIZE);
|
SetDParam(1, IndustryPool::MAX_SIZE);
|
||||||
str = STR_SMALLMAP_INDUSTRY;
|
str = STR_SMALLMAP_INDUSTRY;
|
||||||
@@ -1220,6 +1254,7 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
|
|||||||
StringID string = STR_NULL;
|
StringID string = STR_NULL;
|
||||||
switch (this->map_type) {
|
switch (this->map_type) {
|
||||||
case SMT_INDUSTRY:
|
case SMT_INDUSTRY:
|
||||||
|
case CM_SMT_IMBA:
|
||||||
string = STR_SMALLMAP_INDUSTRY;
|
string = STR_SMALLMAP_INDUSTRY;
|
||||||
break;
|
break;
|
||||||
case SMT_LINKSTATS:
|
case SMT_LINKSTATS:
|
||||||
@@ -1233,7 +1268,7 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const LegendAndColour *tbl = _legend_table[this->map_type]; !tbl->end; ++tbl) {
|
for (const LegendAndColour *tbl = _legend_table[this->map_type]; !tbl->end; ++tbl) {
|
||||||
if (tbl->col_break || ((this->map_type == SMT_INDUSTRY || this->map_type == SMT_OWNER || this->map_type == SMT_LINKSTATS) && i++ >= number_of_rows)) {
|
if (tbl->col_break || ((this->map_type == SMT_INDUSTRY || this->map_type == SMT_OWNER || this->map_type == SMT_LINKSTATS || this->map_type == CM_SMT_IMBA) && i++ >= number_of_rows)) {
|
||||||
/* Column break needed, continue at top, COLUMN_WIDTH pixels
|
/* Column break needed, continue at top, COLUMN_WIDTH pixels
|
||||||
* (one "row") to the right. */
|
* (one "row") to the right. */
|
||||||
x += rtl ? -(int)this->column_width : this->column_width;
|
x += rtl ? -(int)this->column_width : this->column_width;
|
||||||
@@ -1245,6 +1280,7 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
|
|||||||
|
|
||||||
switch (this->map_type) {
|
switch (this->map_type) {
|
||||||
case SMT_INDUSTRY:
|
case SMT_INDUSTRY:
|
||||||
|
case CM_SMT_IMBA:
|
||||||
/* Industry name must be formatted, since it's not in tiny font in the specs.
|
/* Industry name must be formatted, since it's not in tiny font in the specs.
|
||||||
* So, draw with a parameter and use the STR_SMALLMAP_INDUSTRY string, which is tiny font */
|
* So, draw with a parameter and use the STR_SMALLMAP_INDUSTRY string, which is tiny font */
|
||||||
SetDParam(0, tbl->legend);
|
SetDParam(0, tbl->legend);
|
||||||
@@ -1284,6 +1320,13 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
|
|||||||
|
|
||||||
y += row_height;
|
y += row_height;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CM_WID_SM_IMBA: {
|
||||||
|
uint offset = this->IsWidgetLowered(CM_WID_SM_IMBA) ? 1 : 0;
|
||||||
|
Dimension d = GetSpriteSize(SPR_IMG_INDUSTRY);
|
||||||
|
DrawSprite(SPR_IMG_INDUSTRY, PAL_NONE, (r.left + r.right - d.width) / 2 + offset, (r.top + r.bottom - d.height) / 2 + offset);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1301,7 +1344,7 @@ void SmallMapWindow::SwitchMapType(SmallMapType map_type)
|
|||||||
this->SetupWidgetData();
|
this->SetupWidgetData();
|
||||||
|
|
||||||
if (map_type == SMT_LINKSTATS) this->overlay->SetDirty();
|
if (map_type == SMT_LINKSTATS) this->overlay->SetDirty();
|
||||||
if (map_type != SMT_INDUSTRY) this->BreakIndustryChainLink();
|
if (map_type != SMT_INDUSTRY && map_type != CM_SMT_IMBA) this->BreakIndustryChainLink();
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1355,6 +1398,7 @@ void SmallMapWindow::SelectLegendItem(int click_pos, LegendAndColour *legend, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this->map_type == SMT_INDUSTRY) this->BreakIndustryChainLink();
|
if (this->map_type == SMT_INDUSTRY) this->BreakIndustryChainLink();
|
||||||
|
if (this->map_type == CM_SMT_IMBA) this->BreakIndustryChainLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1393,7 +1437,7 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
|
|||||||
/* virtual */ void SmallMapWindow::OnMouseOver(Point pt, int widget)
|
/* virtual */ void SmallMapWindow::OnMouseOver(Point pt, int widget)
|
||||||
{
|
{
|
||||||
IndustryType new_highlight = INVALID_INDUSTRYTYPE;
|
IndustryType new_highlight = INVALID_INDUSTRYTYPE;
|
||||||
if (widget == WID_SM_LEGEND && this->map_type == SMT_INDUSTRY) {
|
if (widget == WID_SM_LEGEND && (this->map_type == SMT_INDUSTRY || this->map_type == CM_SMT_IMBA)) {
|
||||||
int industry_pos = GetPositionOnLegend(pt);
|
int industry_pos = GetPositionOnLegend(pt);
|
||||||
if (industry_pos >= 0 && industry_pos < _smallmap_industry_count) {
|
if (industry_pos >= 0 && industry_pos < _smallmap_industry_count) {
|
||||||
new_highlight = _legend_from_industries[industry_pos].type;
|
new_highlight = _legend_from_industries[industry_pos].type;
|
||||||
@@ -1439,6 +1483,7 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
|
|||||||
case WID_SM_ROUTES: // Show transport routes
|
case WID_SM_ROUTES: // Show transport routes
|
||||||
case WID_SM_VEGETATION: // Show vegetation
|
case WID_SM_VEGETATION: // Show vegetation
|
||||||
case WID_SM_OWNERS: // Show land owners
|
case WID_SM_OWNERS: // Show land owners
|
||||||
|
case CM_WID_SM_IMBA:
|
||||||
this->SwitchMapType((SmallMapType)(widget - WID_SM_CONTOUR));
|
this->SwitchMapType((SmallMapType)(widget - WID_SM_CONTOUR));
|
||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
break;
|
break;
|
||||||
@@ -1458,12 +1503,12 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_SM_LEGEND: // Legend
|
case WID_SM_LEGEND: // Legend
|
||||||
if (this->map_type == SMT_INDUSTRY || this->map_type == SMT_LINKSTATS || this->map_type == SMT_OWNER) {
|
if (this->map_type == SMT_INDUSTRY || this->map_type == SMT_LINKSTATS || this->map_type == SMT_OWNER || this->map_type == CM_SMT_IMBA) {
|
||||||
int click_pos = this->GetPositionOnLegend(pt);
|
int click_pos = this->GetPositionOnLegend(pt);
|
||||||
if (click_pos < 0) break;
|
if (click_pos < 0) break;
|
||||||
|
|
||||||
/* If industry type small map*/
|
/* If industry type small map*/
|
||||||
if (this->map_type == SMT_INDUSTRY) {
|
if (this->map_type == SMT_INDUSTRY || this->map_type == CM_SMT_IMBA) {
|
||||||
/* If click on industries label, find right industry type and enable/disable it. */
|
/* If click on industries label, find right industry type and enable/disable it. */
|
||||||
if (click_pos < _smallmap_industry_count) {
|
if (click_pos < _smallmap_industry_count) {
|
||||||
this->SelectLegendItem(click_pos, _legend_from_industries, _smallmap_industry_count);
|
this->SelectLegendItem(click_pos, _legend_from_industries, _smallmap_industry_count);
|
||||||
@@ -1487,6 +1532,7 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
|
|||||||
LegendAndColour *tbl = nullptr;
|
LegendAndColour *tbl = nullptr;
|
||||||
switch (this->map_type) {
|
switch (this->map_type) {
|
||||||
case SMT_INDUSTRY:
|
case SMT_INDUSTRY:
|
||||||
|
case CM_SMT_IMBA:
|
||||||
tbl = _legend_from_industries;
|
tbl = _legend_from_industries;
|
||||||
this->BreakIndustryChainLink();
|
this->BreakIndustryChainLink();
|
||||||
break;
|
break;
|
||||||
@@ -1535,7 +1581,7 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
|
|||||||
|
|
||||||
case 0: {
|
case 0: {
|
||||||
extern std::bitset<NUM_INDUSTRYTYPES> _displayed_industries;
|
extern std::bitset<NUM_INDUSTRYTYPES> _displayed_industries;
|
||||||
if (this->map_type != SMT_INDUSTRY) this->SwitchMapType(SMT_INDUSTRY);
|
if (this->map_type != CM_SMT_IMBA) this->SwitchMapType(CM_SMT_IMBA);
|
||||||
|
|
||||||
for (int i = 0; i != _smallmap_industry_count; i++) {
|
for (int i = 0; i != _smallmap_industry_count; i++) {
|
||||||
_legend_from_industries[i].show_on_map = _displayed_industries.test(_legend_from_industries[i].type);
|
_legend_from_industries[i].show_on_map = _displayed_industries.test(_legend_from_industries[i].type);
|
||||||
@@ -1675,7 +1721,7 @@ Point SmallMapWindow::GetStationMiddle(const Station *st) const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallMapWindow::SmallMapType SmallMapWindow::map_type = SMT_CONTOUR;
|
SmallMapWindow::SmallMapType SmallMapWindow::map_type = CM_SMT_IMBA;
|
||||||
bool SmallMapWindow::show_towns = true;
|
bool SmallMapWindow::show_towns = true;
|
||||||
int SmallMapWindow::max_heightlevel = -1;
|
int SmallMapWindow::max_heightlevel = -1;
|
||||||
|
|
||||||
@@ -1772,8 +1818,8 @@ static const NWidgetPart _nested_smallmap_bar[] = {
|
|||||||
SetDataTip(SPR_IMG_ZOOMIN, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_IN), SetFill(1, 1),
|
SetDataTip(SPR_IMG_ZOOMIN, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_IN), SetFill(1, 1),
|
||||||
NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_SM_CENTERMAP),
|
NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_SM_CENTERMAP),
|
||||||
SetDataTip(SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER), SetFill(1, 1),
|
SetDataTip(SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER), SetFill(1, 1),
|
||||||
NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_BLANK),
|
NWidget(WWT_IMGBTN, COLOUR_BROWN, CM_WID_SM_IMBA),
|
||||||
SetDataTip(SPR_DOT_SMALL, STR_NULL), SetFill(1, 1),
|
SetDataTip(SPR_IMG_SHOW_COUNTOURS, STR_CM_SMALLMAP_TOOLTIP_SHOW_IMBA_ON_MAP), SetFill(1, 1),
|
||||||
NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_CONTOUR),
|
NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_CONTOUR),
|
||||||
SetDataTip(SPR_IMG_SHOW_COUNTOURS, STR_SMALLMAP_TOOLTIP_SHOW_LAND_CONTOURS_ON_MAP), SetFill(1, 1),
|
SetDataTip(SPR_IMG_SHOW_COUNTOURS, STR_SMALLMAP_TOOLTIP_SHOW_LAND_CONTOURS_ON_MAP), SetFill(1, 1),
|
||||||
NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_VEHICLES),
|
NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_VEHICLES),
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ protected:
|
|||||||
SMT_ROUTES,
|
SMT_ROUTES,
|
||||||
SMT_VEGETATION,
|
SMT_VEGETATION,
|
||||||
SMT_OWNER,
|
SMT_OWNER,
|
||||||
|
CM_SMT_IMBA,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Available kinds of zoomlevel changes. */
|
/** Available kinds of zoomlevel changes. */
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ enum SmallMapWidgets {
|
|||||||
WID_SM_ROUTES, ///< Button to select the routes view.
|
WID_SM_ROUTES, ///< Button to select the routes view.
|
||||||
WID_SM_VEGETATION, ///< Button to select the vegetation view.
|
WID_SM_VEGETATION, ///< Button to select the vegetation view.
|
||||||
WID_SM_OWNERS, ///< Button to select the owners view.
|
WID_SM_OWNERS, ///< Button to select the owners view.
|
||||||
|
CM_WID_SM_IMBA, ///< CityMania IMBA mode (Industries, Contour, Vegetation)
|
||||||
WID_SM_CENTERMAP, ///< Button to move smallmap center to main window center.
|
WID_SM_CENTERMAP, ///< Button to move smallmap center to main window center.
|
||||||
WID_SM_TOGGLETOWNNAME, ///< Toggle button to display town names.
|
WID_SM_TOGGLETOWNNAME, ///< Toggle button to display town names.
|
||||||
WID_SM_SELECT_BUTTONS, ///< Selection widget for the buttons present in some smallmap modes.
|
WID_SM_SELECT_BUTTONS, ///< Selection widget for the buttons present in some smallmap modes.
|
||||||
|
|||||||
Reference in New Issue
Block a user