From 252111512f99e15ace69419b9b491782d0e59663 Mon Sep 17 00:00:00 2001 From: translators Date: Tue, 18 Oct 2022 19:05:11 +0000 Subject: [PATCH 1/7] Update: Translations from eints frisian: 17 changes by Bouke english (au): 1 change by krysclarke russian: 1 change by Ln-Wolf dutch: 4 changes by Bouke portuguese: 4 changes by azulcosta --- src/lang/dutch.txt | 7 ++++--- src/lang/english_AU.txt | 2 +- src/lang/frisian.txt | 18 +++++++++++++++++- src/lang/portuguese.txt | 7 ++++--- src/lang/russian.txt | 2 +- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt index 1dcdc25b73..8960d58e15 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -378,7 +378,7 @@ STR_SCENEDIT_TOOLBAR_ROAD_CONSTRUCTION :{BLACK}Wegenbou STR_SCENEDIT_TOOLBAR_TRAM_CONSTRUCTION :{BLACK}Tramsporen bouwen STR_SCENEDIT_TOOLBAR_PLANT_TREES :{BLACK}Bomen planten. Shift schakelt tussen planten/inschatting van de kosten STR_SCENEDIT_TOOLBAR_PLACE_SIGN :{BLACK}Bord plaatsen -STR_SCENEDIT_TOOLBAR_PLACE_OBJECT :{BLACK}Object plaatsen. Shift schakelt tussen bouwen/inschatting van de kosten +STR_SCENEDIT_TOOLBAR_PLACE_OBJECT :{BLACK}Object plaatsen. Ctrl selecteert een diagonaal gebied. Shift+klik wisselt tussen bouwen/verwachte kosten weergeven. # Scenario editor file menu ###length 7 @@ -2812,11 +2812,11 @@ STR_LANDSCAPING_TOOLBAR :{WHITE}Terreina STR_LANDSCAPING_TOOLTIP_LOWER_A_CORNER_OF_LAND :{BLACK}Verlaag een hoek van het land. Slepen verlaagt de eerste geselecteerde hoek en brengt het geselecteerde gebied naar de hoogte van die hoek. Ctrl selecteert het gebied diagonaal. Shift maakt een inschatting van de kosten STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND :{BLACK}Verhoog een hoek van het land. Slepen verhoogt de eerste geselecteerde hoek en brengt het geselecteerde gebied naar de hoogte van die hoek. Ctrl selecteert het gebied diagonaal. Shift maakt een inschatting van de kosten STR_LANDSCAPING_LEVEL_LAND_TOOLTIP :{BLACK}Land egaliseren op hoogte van eerst geselecteerde hoek. Ctrl selecteert een diagonaal gebied. Shift+klik wisselt tussen bouwen/verwachte kosten weergeven. -STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Land kopen voor toekomstig gebruik. Shift+klik wisselt tussen bouwen/verwachte kosten weergeven. +STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Land kopen voor toekomstig gebruik. Ctrl selecteert een diagonaal gebied. Shift+klik wisselt tussen bouwen/verwachte kosten weergeven. # Object construction window STR_OBJECT_BUILD_CAPTION :{WHITE}Keuze van object -STR_OBJECT_BUILD_TOOLTIP :{BLACK}Object selecteren voor bouwen. Shift+Klik wisselt tussen bouwen/verwachte kosten weergeven. +STR_OBJECT_BUILD_TOOLTIP :{BLACK}Selecteer object om te bouwen. Ctrl selecteert een diagonaal gebied. Shift+klik wisselt tussen bouwen/verwachte kosten weergeven. STR_OBJECT_BUILD_CLASS_TOOLTIP :{BLACK}Hiermee selecteer je de klasse van het te bouwen object STR_OBJECT_BUILD_PREVIEW_TOOLTIP :{BLACK}Bekijk het object STR_OBJECT_BUILD_SIZE :{BLACK}Grootte: {GOLD}{NUM} x {NUM} tegels @@ -4925,6 +4925,7 @@ STR_ERROR_OBJECT_IN_THE_WAY :{WHITE}Object i STR_ERROR_COMPANY_HEADQUARTERS_IN :{WHITE}... hoofdkantoor in de weg STR_ERROR_CAN_T_PURCHASE_THIS_LAND :{WHITE}Kan dit stuk land niet kopen... STR_ERROR_YOU_ALREADY_OWN_IT :{WHITE}... het is al van jou! +STR_ERROR_BUILD_OBJECT_LIMIT_REACHED :{WHITE}... bouwlimiet voor objecten bereikt # Group related errors STR_ERROR_GROUP_CAN_T_CREATE :{WHITE}Kan groep niet creëren... diff --git a/src/lang/english_AU.txt b/src/lang/english_AU.txt index 28445f901a..ef8039ea6e 100644 --- a/src/lang/english_AU.txt +++ b/src/lang/english_AU.txt @@ -2812,7 +2812,7 @@ STR_LANDSCAPING_TOOLBAR :{WHITE}Landscap STR_LANDSCAPING_TOOLTIP_LOWER_A_CORNER_OF_LAND :{BLACK}Lower a corner of land. Dragging lowers the first selected corner and levels the selected area to the new corner height. Ctrl selects the area diagonally. Shift toggles building/showing cost estimate STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND :{BLACK}Raise a corner of land. Dragging raises the first selected corner and levels the selected area to the new corner height. Ctrl selects the area diagonally. Shift toggles building/showing cost estimate STR_LANDSCAPING_LEVEL_LAND_TOOLTIP :{BLACK}Level an area of land to the height of the first selected corner. Ctrl selects the area diagonally. Shift toggles building/showing cost estimate -STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Purchase land for future use. Shift toggles building/showing cost estimate +STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Purchase land for future use. Ctrl selects the area diagonally. Shift toggles building/showing cost estimate # Object construction window STR_OBJECT_BUILD_CAPTION :{WHITE}Object Selection diff --git a/src/lang/frisian.txt b/src/lang/frisian.txt index edc33d5ffc..1ea6d447ae 100644 --- a/src/lang/frisian.txt +++ b/src/lang/frisian.txt @@ -1172,6 +1172,7 @@ STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER :Subsydzjeferman STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER_HELPTEXT :Stel yn hoefolle der betelle wurdt foar subsidiearre ferbinings +STR_CONFIG_SETTING_SUBSIDY_DURATION_VALUE :{NUM} jier ###setting-zero-is-special STR_CONFIG_SETTING_CONSTRUCTION_COSTS :Boukosten: {STRING} @@ -2065,6 +2066,7 @@ STR_NETWORK_START_SERVER_NEW_GAME_NAME_OSKTITLE :{BLACK}Fier in # Network connecting window STR_NETWORK_CONNECTING_CAPTION :{WHITE}Ferbyning meitsje... +STR_NETWORK_CONNECTING_WAITING :{BLACK}{NUM} klïïnt{P "" en} foar dy STR_NETWORK_CONNECTING_DOWNLOADING_1 :{BLACK}{BYTES} Delhelle oant STR_NETWORK_CONNECTING_DOWNLOADING_2 :{BLACK}{BYTES} / {BYTES} delhelle @@ -2145,6 +2147,7 @@ STR_NETWORK_ERROR_CLIENT_NOT_EXPECTED :ûnjildich of STR_NETWORK_ERROR_CLIENT_WRONG_REVISION :ferkearde revyzje STR_NETWORK_ERROR_CLIENT_NAME_IN_USE :namme is al beset STR_NETWORK_ERROR_CLIENT_WRONG_PASSWORD :ferkeard wachtwurd +STR_NETWORK_ERROR_CLIENT_CHEATER :besocht falsk te spieljen STR_NETWORK_ERROR_CLIENT_TOO_MANY_COMMANDS :joech tevolle opdrachten STR_NETWORK_ERROR_CLIENT_TIMEOUT_MAP :kaart delheljen duorret te lang STR_NETWORK_ERROR_CLIENT_TIMEOUT_JOIN :kaart ferwurkje duorret te lang @@ -2162,6 +2165,7 @@ STR_NETWORK_SERVER_MESSAGE_GAME_REASON_GAME_SCRIPT :spulskript STR_NETWORK_MESSAGE_CLIENT_LEAVING :Ferlit STR_NETWORK_MESSAGE_CLIENT_JOINED_ID :*** {STRING} der is ien bykommen(Client #{2:NUM}) STR_NETWORK_MESSAGE_CLIENT_COMPANY_SPECTATE :*** {STRING} is in neie taskôger +STR_NETWORK_MESSAGE_CLIENT_LEFT :*** {STRING} hat it spul ferlitten ({2:STRING}) STR_NETWORK_MESSAGE_NAME_CHANGE :*** {STRING} hat syn/har namme oanpast nei {STRING} STR_NETWORK_MESSAGE_SERVER_SHUTDOWN :{WHITE}Tsjinner hat de ferbining sluten @@ -2176,6 +2180,7 @@ STR_CONTENT_OPEN_URL :{BLACK}Webside STR_CONTENT_OPEN_URL_TOOLTIP :{BLACK}Webside foar dizze ynhâld besykje STR_CONTENT_DOWNLOAD_CAPTION :{BLACK}Delhelje STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP :{BLACK}Begjinne mei delheljen fan selektearre ynhâld +STR_CONTENT_TOTAL_DOWNLOAD_SIZE :{SILVER}Totaal om te delheljen: {WHITE}{BYTES} STR_CONTENT_DETAIL_TITLE :{SILVER}KONTENT INFO ###length 5 @@ -2195,6 +2200,7 @@ STR_CONTENT_TYPE_AI_LIBRARY :AI biblioteek STR_CONTENT_TYPE_SCENARIO :Lânskip STR_CONTENT_TYPE_HEIGHTMAP :Hichtemap STR_CONTENT_TYPE_BASE_SOUNDS :Basislûden +STR_CONTENT_TYPE_BASE_MUSIC :Basisset for musyk STR_CONTENT_TYPE_GAME_SCRIPT :Spulskript STR_CONTENT_TYPE_GS_LIBRARY :GS biblioteek @@ -2285,6 +2291,7 @@ STR_STATION_BUILD_NUMBER_OF_TRACKS :{BLACK}Oantal b STR_STATION_BUILD_NUMBER_OF_TRACKS_TOOLTIP :{BLACK}Selektear oantal banen foar treinstasjon STR_STATION_BUILD_PLATFORM_LENGTH :{BLACK}Stasjon lengte STR_STATION_BUILD_PLATFORM_LENGTH_TOOLTIP :{BLACK}Selektear lengte fan treinstasjon +STR_STATION_BUILD_DRAG_DROP :Sleepe en los litte STR_STATION_BUILD_STATION_TYPE_TOOLTIP :{BLACK}Selektearje type stasjon om te bouwe @@ -2593,10 +2600,12 @@ STR_ABOUT_VERSION :{BLACK}OpenTTD- STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD {COPYRIGHT}2002-{STRING} It OpenTTD team # Framerate display window +STR_FRAMERATE_CURRENT :Aktueel ###length 15 ###length 15 +STR_FRAMETIME_CAPTION_AI :Kompjûterspiler {NUM} {STRING} # Save/load game/scenario @@ -2727,7 +2736,10 @@ STR_NEWGRF_SETTINGS_VERSION :{BLACK}Ferzje: STR_NEWGRF_SETTINGS_MIN_VERSION :{BLACK}Leechte noch wurkjende ferzje: {SILVER}{NUM} STR_NEWGRF_SETTINGS_MD5SUM :{BLACK}MD5sum: {SILVER}{STRING} STR_NEWGRF_SETTINGS_PALETTE :{BLACK}Palet: {SILVER}{STRING} +STR_NEWGRF_SETTINGS_PALETTE_LEGACY :Oarspronklik (W) +STR_NEWGRF_SETTINGS_PALETTE_LEGACY_32BPP :Oarspronklik (W) / 32 bpp STR_NEWGRF_SETTINGS_PARAMETER :{BLACK}Parameters: {SILVER}{STRING} +STR_NEWGRF_SETTINGS_PARAMETER_NONE :Gjin STR_NEWGRF_SETTINGS_NO_INFO :{BLACK}gjin ynformaasje beskikber STR_NEWGRF_SETTINGS_NOT_FOUND :{RED}Keppelt bestând koe net fûn wurde @@ -2891,6 +2903,7 @@ STR_TOWN_VIEW_RENAME_TOWN_BUTTON :Stêdsnamme Fer # Town local authority window STR_LOCAL_AUTHORITY_CAPTION :{WHITE}{TOWN} gemeente +STR_LOCAL_AUTHORITY_ZONE :{BLACK}Sône STR_LOCAL_AUTHORITY_COMPANY_RATINGS :{BLACK}Transportbedrieuwwurdearring: STR_LOCAL_AUTHORITY_COMPANY_RATING :{YELLOW}{COMPANY} {COMPANY_NUM}: {ORANGE}{STRING} STR_LOCAL_AUTHORITY_ACTIONS_TITLE :{BLACK}Mooglike aksjes: @@ -3065,6 +3078,7 @@ STR_FINANCES_SECTION_OTHER :{GOLD}Oaren STR_FINANCES_NEGATIVE_INCOME :{BLACK}-{CURRENCY_LONG} STR_FINANCES_POSITIVE_INCOME :{BLACK}+{CURRENCY_LONG} STR_FINANCES_BANK_BALANCE_TITLE :{WHITE}Jild +STR_FINANCES_OWN_FUNDS_TITLE :{WHITE}Eigen fûnsen STR_FINANCES_LOAN_TITLE :{WHITE}Liening STR_FINANCES_MAX_LOAN :{WHITE}Maksimale Liening: {BLACK}{CURRENCY_LONG} STR_FINANCES_TOTAL_CURRENCY :{BLACK}{CURRENCY_LONG} @@ -3394,6 +3408,7 @@ STR_VEHICLE_VIEW_AIRCRAFT_SEND_TO_DEPOT_TOOLTIP :{BLACK}Stjoer f ###length VEHICLE_TYPES STR_VEHICLE_VIEW_TRAIN_REVERSE_TOOLTIP :{BLACK}Rydrjochting fan trein omkeare +STR_VEHICLE_VIEW_ROAD_VEHICLE_REVERSE_TOOLTIP :Lit fiertug omkeare ###length VEHICLE_TYPES STR_VEHICLE_VIEW_TRAIN_REFIT_TOOLTIP :{BLACK}Trein ombouwe om in oar soart fracht mei te nimmen @@ -3495,6 +3510,7 @@ STR_VEHICLE_DETAIL_TAB_TOTAL_CARGO :{BLACK}Totale F STR_VEHICLE_DETAILS_TRAIN_ARTICULATED_RV_CAPACITY :{BLACK}Kapasiteit: {LTBLUE} # Vehicle refit +STR_REFIT_CAPTION :{WHITE}{VEHICLE} (Ombouwe) STR_REFIT_TITLE :{GOLD}Selektearje it soart fracht om mei te nimmen: STR_REFIT_NEW_CAPACITY_COST_OF_REFIT :{BLACK}Nije kapasiteit: {GOLD}{CARGO_LONG}{}{BLACK}Kosten fan ombou: {RED}{CURRENCY_LONG} STR_REFIT_NEW_CAPACITY_COST_OF_AIRCRAFT_REFIT :{BLACK}Nije kapasiteit: {GOLD}{CARGO_LONG}, {GOLD}{CARGO_LONG}{}{BLACK}kosten fan werfolje: {RED}{CURRENCY_LONG} @@ -3699,7 +3715,7 @@ STR_AI_DEBUG_CONTINUE :{BLACK}Trjochge STR_AI_DEBUG_SELECT_AI_TOOLTIP :{BLACK}Lit debug output fan dizze AI sjen STR_AI_GAME_SCRIPT :{BLACK}Spulskript -STR_ERROR_AI_NO_AI_FOUND :Gjin geskikte compjûterspiler fûn.{}Disse compjûterspiler is in dummy en docht neat.{}Jo kinne compjûterspilers delhelje fan 'Online Inhâld' ôf. +STR_ERROR_AI_NO_AI_FOUND :Gjin geskikte kompjûterspiler fûn.{}Disse kompjûterspiler is in dummy en docht neat.{}Jo kinne kompjûterspilers delhelje fan 'Online Inhâld' ôf. STR_ERROR_AI_DEBUG_SERVER_ONLY :{YELLOW}AI/Spulskript debugskerm is allinich beskikber foar de tsjinner # AI configuration window diff --git a/src/lang/portuguese.txt b/src/lang/portuguese.txt index 38e217199d..eff5172f59 100644 --- a/src/lang/portuguese.txt +++ b/src/lang/portuguese.txt @@ -379,7 +379,7 @@ STR_SCENEDIT_TOOLBAR_ROAD_CONSTRUCTION :{BLACK}Construi STR_SCENEDIT_TOOLBAR_TRAM_CONSTRUCTION :{BLACK}Construção de carris para elétricos STR_SCENEDIT_TOOLBAR_PLANT_TREES :{BLACK}Plantar árvores. Shift alterna contruir/mostrar custo estimado STR_SCENEDIT_TOOLBAR_PLACE_SIGN :{BLACK}Colocar sinais -STR_SCENEDIT_TOOLBAR_PLACE_OBJECT :{BLACK}Colocar objecto. Shift alterna contruir/mostrar custo estimado +STR_SCENEDIT_TOOLBAR_PLACE_OBJECT :{BLACK}Colocar objeto. Ctrl seleciona a área diagonalmente. Shift alterna construir/mostrar custo estimado # Scenario editor file menu ###length 7 @@ -2813,11 +2813,11 @@ STR_LANDSCAPING_TOOLBAR :{WHITE}Terreno STR_LANDSCAPING_TOOLTIP_LOWER_A_CORNER_OF_LAND :{BLACK}Baixar terreno. Ao pressionar e arrastar o cursor, o primeiro ponto selecionado é rebaixado e o terreno da área selecionada é nivelado com a nova altura do primeiro ponto. Ctrl seleciona a área na diagonal. Shift mostra a estimativa de custos. STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND :{BLACK}Elevar terreno. Ao pressionar e arrastar o cursor, o primeiro ponto selecionado é elevado e o terreno da área selecionada é nivelado com a nova altura do primeiro ponto. Ctrl seleciona a área na diagonal. Shift mostra a estimativa de custos. STR_LANDSCAPING_LEVEL_LAND_TOOLTIP :{BLACK}Nívelar uma área de terreno até a altura do primeiro ponto selecionado. Ctrl selecciona a área na diagonal. Shift mostra a estimativa de custos. -STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Comprar terreno para uso futuro. Shift mostra a estimativa de custos. +STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Comprar terreno para uso futuro. Ctrl seleciona a área diagonalmente. Shift alterna entre construir/mostrar custo estimado # Object construction window STR_OBJECT_BUILD_CAPTION :{WHITE}Selecção de Objecto -STR_OBJECT_BUILD_TOOLTIP :{BLACK}Seleccionar objecto para construir. Shift alterna construir/mostrar custo estimado +STR_OBJECT_BUILD_TOOLTIP :{BLACK}Selecionar objeto para construir. Ctrl seleciona a área diagonalmente. Shift alterna construir/mostrar custo estimado STR_OBJECT_BUILD_CLASS_TOOLTIP :{BLACK}Selecionar a classe do objecto a construir STR_OBJECT_BUILD_PREVIEW_TOOLTIP :{BLACK}Pré-visualização do objecto STR_OBJECT_BUILD_SIZE :{BLACK}Tamanho: {GOLD}{NUM} x {NUM} quadrados @@ -4926,6 +4926,7 @@ STR_ERROR_OBJECT_IN_THE_WAY :{WHITE}Objecto STR_ERROR_COMPANY_HEADQUARTERS_IN :{WHITE}... sede de empresa no caminho STR_ERROR_CAN_T_PURCHASE_THIS_LAND :{WHITE}Não é possível comprar esta área de terreno... STR_ERROR_YOU_ALREADY_OWN_IT :{WHITE}... já a possui! +STR_ERROR_BUILD_OBJECT_LIMIT_REACHED :{WHITE}... atingido o limite de construção de objeto # Group related errors STR_ERROR_GROUP_CAN_T_CREATE :{WHITE}Impossível criar grupo... diff --git a/src/lang/russian.txt b/src/lang/russian.txt index 7e068debd9..a7a96a0b1b 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -2987,7 +2987,7 @@ STR_LANDSCAPING_TOOLBAR :{WHITE}Ланд STR_LANDSCAPING_TOOLTIP_LOWER_A_CORNER_OF_LAND :{BLACK}Опустить угол земли. Перетаскивание опускает первый выбранный угол и выравнивает выбранную область до новой высоты угла. Ctrl выбирает область по диагонали. При нажатом Shift - оценка стоимости строительства. STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND :{BLACK}Поднять угол земли. Перетаскивание поднимает первый выбранный угол и выравнивает выбранную область до новой высоты угла. Ctrl выбирает область по диагонали. При нажатом Shift - оценка стоимости строительства. STR_LANDSCAPING_LEVEL_LAND_TOOLTIP :{BLACK}Выровнять землю до высоты первого выбранного угла. Ctrl выбирает область по диагонали. При нажатом Shift - оценка стоимости выравнивания. -STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Покупка земли. При нажатом Shift - оценка стоимости покупки. +STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Покупка земли.{}При нажатом Ctrl выбираются клетки по диагонали.{}При нажатом Shift - оценка стоимости покупки. # Object construction window STR_OBJECT_BUILD_CAPTION :{WHITE}Выбор объекта From 47a998fb0c7fbb6014f368adefbec1b93d5bd3b9 Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Thu, 12 May 2022 10:52:34 -0600 Subject: [PATCH 2/7] Feature: Towns don't build parallel, redundant bridges --- src/town_cmd.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index ef1995b8ca..a07946029c 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1160,6 +1160,27 @@ static bool CanRoadContinueIntoNextTile(const Town *t, const TileIndex tile, con return Command::Do(DC_AUTO | DC_NO_WATER, next_tile, rcmd, rt, DRD_NONE, t->index).Succeeded(); } +/** + * CircularTileSearch proc which checks for a nearby parallel bridge to avoid building redundant bridges. + * @param tile The tile to search. + * @param user_data Reference to the valid direction of the proposed bridge. + * @return true if another bridge exists, else false. + */ +static bool RedundantBridgeExistsNearby(TileIndex tile, void *user_data) +{ + /* Don't look into the void. */ + if (!IsValidTile(tile)) return false; + + /* Only consider bridge head tiles. */ + if (!IsBridgeTile(tile)) return false; + + /* Only consider road bridges. */ + if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return false; + + /* If the bridge is facing the same direction as the proposed bridge, we've found a redundant bridge. */ + return (GetTileSlope(tile) & InclinedSlope(ReverseDiagDir(*(DiagDirection *)user_data))); +} + /** * Grows the town with a bridge. * At first we check if a bridge is reasonable. @@ -1221,6 +1242,11 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi /* Make sure the road can be continued past the bridge. At this point, bridge_tile holds the end tile of the bridge. */ if (!CanRoadContinueIntoNextTile(t, bridge_tile, bridge_dir)) return false; + /* If another parallel bridge exists nearby, this one would be redundant and shouldn't be built. We don't care about flat bridges. */ + TileIndex search = tile; + DiagDirection direction_to_match = bridge_dir; + if (slope != SLOPE_FLAT && CircularTileSearch(&search, bridge_length, 0, 0, RedundantBridgeExistsNearby, &direction_to_match)) return false; + for (uint8 times = 0; times <= 22; times++) { byte bridge_type = RandomRange(MAX_BRIDGES - 1); From 93d2d4590f41ce5e881c3afcdc03c55462129597 Mon Sep 17 00:00:00 2001 From: Bouke Haarsma Date: Sun, 4 Sep 2022 08:55:03 +0200 Subject: [PATCH 3/7] Fix #9995: Adjust viewport zoom level for HiDPI displays On HiDPI screens the zoom level is increased for detailed rendering. This causes hard-coded zoom levels to be off by this adjustment. To fix these default zoom levels, we scale the zoom level based on `_gui_zoom` to get the scaled zoom level. --- src/industry_gui.cpp | 2 +- src/main_gui.cpp | 2 +- src/news_gui.cpp | 2 +- src/town_gui.cpp | 3 ++- src/vehicle_gui.cpp | 2 +- src/viewport_gui.cpp | 4 ++-- src/waypoint_gui.cpp | 3 ++- src/zoom_func.h | 20 ++++++++++++++++++++ src/zoom_type.h | 2 +- 9 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index d69d6c0e0c..cf78f4db90 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -837,7 +837,7 @@ public: this->InitNested(window_number); NWidgetViewport *nvp = this->GetWidget(WID_IV_VIEWPORT); - nvp->InitializeViewport(this, Industry::Get(window_number)->location.GetCenterTile(), ZOOM_LVL_INDUSTRY); + nvp->InitializeViewport(this, Industry::Get(window_number)->location.GetCenterTile(), ScaleZoomGUI(ZOOM_LVL_INDUSTRY)); this->InvalidateData(); } diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 511555ff9e..a102ff684b 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -222,7 +222,7 @@ struct MainWindow : Window ResizeWindow(this, _screen.width, _screen.height); NWidgetViewport *nvp = this->GetWidget(WID_M_VIEWPORT); - nvp->InitializeViewport(this, TileXY(32, 32), ZOOM_LVL_VIEWPORT); + nvp->InitializeViewport(this, TileXY(32, 32), ScaleZoomGUI(ZOOM_LVL_VIEWPORT)); this->viewport->overlay = new LinkGraphOverlay(this, WID_M_VIEWPORT, 0, 0, 3); this->refresh.SetInterval(LINKGRAPH_DELAY); diff --git a/src/news_gui.cpp b/src/news_gui.cpp index a4c4c14082..1a12dad803 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -310,7 +310,7 @@ struct NewsWindow : Window { /* Initialize viewport if it exists. */ NWidgetViewport *nvp = this->GetWidget(WID_N_VIEWPORT); if (nvp != nullptr) { - nvp->InitializeViewport(this, ni->reftype1 == NR_VEHICLE ? 0x80000000 | ni->ref1 : (uint32)GetReferenceTile(ni->reftype1, ni->ref1), ZOOM_LVL_NEWS); + nvp->InitializeViewport(this, ni->reftype1 == NR_VEHICLE ? 0x80000000 | ni->ref1 : (uint32)GetReferenceTile(ni->reftype1, ni->ref1),ScaleZoomGUI(ZOOM_LVL_NEWS)); if (this->ni->flags & NF_NO_TRANSPARENT) nvp->disp_flags |= ND_NO_TRANSPARENCY; if ((this->ni->flags & NF_INCOLOUR) == 0) { nvp->disp_flags |= ND_SHADE_GREY; diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 6206ffc894..216de7e79a 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -40,6 +40,7 @@ #include "table/strings.h" #include "safeguards.h" +#include "zoom_func.h" TownKdtree _town_local_authority_kdtree(&Kdtree_TownXYFunc); @@ -331,7 +332,7 @@ public: this->flags |= WF_DISABLE_VP_SCROLL; NWidgetViewport *nvp = this->GetWidget(WID_TV_VIEWPORT); - nvp->InitializeViewport(this, this->town->xy, ZOOM_LVL_NEWS); + nvp->InitializeViewport(this, this->town->xy, ScaleZoomGUI(ZOOM_LVL_TOWN)); /* disable renaming town in network games if you are not the server */ this->SetWidgetDisabledState(WID_TV_CHANGE_NAME, _networking && !_network_server); diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index e4fc8aa554..41ac89846c 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2736,7 +2736,7 @@ public: } this->FinishInitNested(window_number); this->owner = v->owner; - this->GetWidget(WID_VV_VIEWPORT)->InitializeViewport(this, this->window_number | (1 << 31), _vehicle_view_zoom_levels[v->type]); + this->GetWidget(WID_VV_VIEWPORT)->InitializeViewport(this, this->window_number | (1 << 31), ScaleZoomGUI(_vehicle_view_zoom_levels[v->type])); this->GetWidget(WID_VV_START_STOP)->tool_tip = STR_VEHICLE_VIEW_TRAIN_STATUS_START_STOP_TOOLTIP + v->type; this->GetWidget(WID_VV_RENAME)->tool_tip = STR_VEHICLE_DETAILS_TRAIN_RENAME + v->type; diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp index 5047f04f3f..6f74237d33 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -57,8 +57,8 @@ public: this->InitNested(window_number); NWidgetViewport *nvp = this->GetWidget(WID_EV_VIEWPORT); - nvp->InitializeViewport(this, 0, ZOOM_LVL_VIEWPORT); - if (_settings_client.gui.zoom_min == ZOOM_LVL_VIEWPORT) this->DisableWidget(WID_EV_ZOOM_IN); + nvp->InitializeViewport(this, 0, ScaleZoomGUI(ZOOM_LVL_VIEWPORT)); + if (_settings_client.gui.zoom_min == viewport->zoom) this->DisableWidget(WID_EV_ZOOM_IN); Point pt; if (tile == INVALID_TILE) { diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index 4fca572242..0d688b49d9 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -27,6 +27,7 @@ #include "table/strings.h" #include "safeguards.h" +#include "zoom_func.h" /** GUI for accessing waypoints and buoys. */ struct WaypointWindow : Window { @@ -70,7 +71,7 @@ public: this->flags |= WF_DISABLE_VP_SCROLL; NWidgetViewport *nvp = this->GetWidget(WID_W_VIEWPORT); - nvp->InitializeViewport(this, this->GetCenterTile(), ZOOM_LVL_VIEWPORT); + nvp->InitializeViewport(this, this->GetCenterTile(), ScaleZoomGUI(ZOOM_LVL_VIEWPORT)); this->OnInvalidateData(0); } diff --git a/src/zoom_func.h b/src/zoom_func.h index 0a5113186f..f72c7abae4 100644 --- a/src/zoom_func.h +++ b/src/zoom_func.h @@ -79,6 +79,26 @@ static inline int UnScaleGUI(int value) return UnScaleByZoom(value, ZOOM_LVL_GUI); } +/** + * Scale zoom level relative to GUI zoom. + * @param value zoom level to scale + * @return scaled zoom level + */ +static inline ZoomLevel ScaleZoomGUI(ZoomLevel value) +{ + return std::clamp(ZoomLevel(value + (ZOOM_LVL_GUI - ZOOM_LVL_OUT_4X)), ZOOM_LVL_MIN, ZOOM_LVL_MAX); +} + +/** + * UnScale zoom level relative to GUI zoom. + * @param value zoom level to scale + * @return un-scaled zoom level + */ +static inline ZoomLevel UnScaleZoomGUI(ZoomLevel value) +{ + return std::clamp(ZoomLevel(value - (ZOOM_LVL_GUI - ZOOM_LVL_OUT_4X)), ZOOM_LVL_MIN, ZOOM_LVL_MAX); +} + /** * Scale traditional pixel dimensions to GUI zoom level. * @param value Pixel amount at #ZOOM_LVL_BASE (traditional "normal" interface size). diff --git a/src/zoom_type.h b/src/zoom_type.h index 0945e1cc09..ffa70f7611 100644 --- a/src/zoom_type.h +++ b/src/zoom_type.h @@ -35,7 +35,7 @@ enum ZoomLevel : byte { ZOOM_LVL_VIEWPORT = ZOOM_LVL_OUT_4X, ///< Default zoom level for viewports. ZOOM_LVL_NEWS = ZOOM_LVL_OUT_4X, ///< Default zoom level for the news messages. ZOOM_LVL_INDUSTRY = ZOOM_LVL_OUT_8X, ///< Default zoom level for the industry view. - ZOOM_LVL_TOWN = ZOOM_LVL_OUT_8X, ///< Default zoom level for the town view. + ZOOM_LVL_TOWN = ZOOM_LVL_OUT_4X, ///< Default zoom level for the town view. ZOOM_LVL_AIRCRAFT = ZOOM_LVL_OUT_4X, ///< Default zoom level for the aircraft view. ZOOM_LVL_SHIP = ZOOM_LVL_OUT_4X, ///< Default zoom level for the ship view. ZOOM_LVL_TRAIN = ZOOM_LVL_OUT_4X, ///< Default zoom level for the train view. From 65530a76f6502d9f9bfb9f7e650e9e869cb33908 Mon Sep 17 00:00:00 2001 From: Nicolas Chappe <74881848+nchappe@users.noreply.github.com> Date: Wed, 22 Dec 2021 13:21:19 +0100 Subject: [PATCH 4/7] Codechange: Allow use of SetDParam for tooltips --- src/misc_gui.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 7248efd6a6..1a3ba2b05c 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -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; From e660860d4b36ce6870786130b1861fa8fca808b8 Mon Sep 17 00:00:00 2001 From: Nicolas Chappe <74881848+nchappe@users.noreply.github.com> Date: Thu, 23 Dec 2021 13:50:19 +0100 Subject: [PATCH 5/7] Codechange: Simplify logic of mouse loop --- src/window.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 603bca151f..f1a6c8550c 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2882,27 +2882,25 @@ static void MouseLoop(MouseClick click, int mousewheel) } } - if (vp == nullptr || (w->flags & WF_DISABLE_VP_SCROLL)) { - switch (click) { - case MC_LEFT: - case MC_DOUBLE_LEFT: - DispatchLeftClickEvent(w, x - w->left, y - w->top, click == MC_DOUBLE_LEFT ? 2 : 1); - return; + switch (click) { + case MC_LEFT: + case MC_DOUBLE_LEFT: + DispatchLeftClickEvent(w, x - w->left, y - w->top, click == MC_DOUBLE_LEFT ? 2 : 1); + return; - default: - if (!scrollwheel_scrolling || w == nullptr || w->window_class != WC_SMALLMAP) break; - /* We try to use the scrollwheel to scroll since we didn't touch any of the buttons. - * Simulate a right button click so we can get started. */ - FALLTHROUGH; + default: + if (!scrollwheel_scrolling || w == nullptr || w->window_class != WC_SMALLMAP) break; + /* We try to use the scrollwheel to scroll since we didn't touch any of the buttons. + * Simulate a right button click so we can get started. */ + FALLTHROUGH; - case MC_RIGHT: - DispatchRightClickEvent(w, x - w->left, y - w->top); - return; + case MC_RIGHT: + DispatchRightClickEvent(w, x - w->left, y - w->top); + return; - case MC_HOVER: - DispatchHoverEvent(w, x - w->left, y - w->top); - break; - } + case MC_HOVER: + DispatchHoverEvent(w, x - w->left, y - w->top); + break; } /* We're not doing anything with 2D scrolling, so reset the value. */ From 7c79a2a767af3285008a9eccaf4363d6bd4de307 Mon Sep 17 00:00:00 2001 From: Nicolas Chappe <74881848+nchappe@users.noreply.github.com> Date: Thu, 23 Dec 2021 14:35:27 +0100 Subject: [PATCH 6/7] Change: Do not generate hover events at each frame --- src/window.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/window.cpp b/src/window.cpp index f1a6c8550c..0c3aaa5293 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2969,6 +2969,7 @@ void HandleMouseEvents() click = MC_HOVER; _input_events_this_tick++; _mouse_hovering = true; + hover_time = std::chrono::steady_clock::now(); } } } From 864771ca09d89cef5f765e079f19bcddfe4ac950 Mon Sep 17 00:00:00 2001 From: Nicolas Chappe <74881848+nchappe@users.noreply.github.com> Date: Wed, 18 Aug 2021 16:52:42 +0200 Subject: [PATCH 7/7] Feature: [Linkgraph] Show a tooltip with statistics when hovering a link --- src/lang/english.txt | 5 +++ src/linkgraph/linkgraph_gui.cpp | 64 ++++++++++++++++++++++++++++++--- src/linkgraph/linkgraph_gui.h | 18 +++++++--- src/main_gui.cpp | 6 ++++ src/window.cpp | 1 + 5 files changed, 84 insertions(+), 10 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index 4064c75143..56a1c9df63 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2617,6 +2617,11 @@ STR_LINKGRAPH_LEGEND_UNUSED :{TINY_FONT}{BLA STR_LINKGRAPH_LEGEND_SATURATED :{TINY_FONT}{BLACK}saturated STR_LINKGRAPH_LEGEND_OVERLOADED :{TINY_FONT}{BLACK}overloaded +# Linkgraph tooltip +STR_LINKGRAPH_STATS_TOOLTIP :{BLACK}{CARGO_LONG} to be transported per month from {STATION} to {STATION} ({COMMA}% of capacity){RAW_STRING} +STR_LINKGRAPH_STATS_TOOLTIP_RETURN_EXTENSION :{}{CARGO_LONG} to be transported back ({COMMA}% of capacity) +STR_LINKGRAPH_STATS_TOOLTIP_TIME_EXTENSION :{}Average travel time: {NUM}{NBSP}day{P "" s} + # Base for station construction window(s) STR_STATION_BUILD_COVERAGE_AREA_TITLE :{BLACK}Coverage area highlight STR_STATION_BUILD_COVERAGE_OFF :{BLACK}Off diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index f1fb309c1f..c32c5d395a 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -219,8 +219,10 @@ void LinkGraphOverlay::AddLinks(const Station *from, const Station *to) const LinkGraph &lg = *LinkGraph::Get(ge.link_graph); ConstEdge edge = lg[ge.node][to->goods[c].node]; if (edge.Capacity() > 0) { - this->AddStats(lg.Monthly(edge.Capacity()), lg.Monthly(edge.Usage()), - ge.flows.GetFlowVia(to->index), from->owner == OWNER_NONE || to->owner == OWNER_NONE, + this->AddStats(c, lg.Monthly(edge.Capacity()), lg.Monthly(edge.Usage()), + ge.flows.GetFlowVia(to->index), + edge.TravelTime() / DAY_TICKS, + from->owner == OWNER_NONE || to->owner == OWNER_NONE, this->cached_links[from->index][to->index]); } } @@ -236,14 +238,16 @@ void LinkGraphOverlay::AddLinks(const Station *from, const Station *to) * @param new_shared If the new link is shared. * @param cargo LinkProperties to write the information to. */ -/* static */ void LinkGraphOverlay::AddStats(uint new_cap, uint new_usg, uint new_plan, bool new_shared, LinkProperties &cargo) +/* static */ void LinkGraphOverlay::AddStats(CargoID new_cargo, uint new_cap, uint new_usg, uint new_plan, uint32 time, bool new_shared, LinkProperties &cargo) { /* multiply the numbers by 32 in order to avoid comparing to 0 too often. */ if (cargo.capacity == 0 || - std::max(cargo.usage, cargo.planned) * 32 / (cargo.capacity + 1) < std::max(new_usg, new_plan) * 32 / (new_cap + 1)) { + cargo.Usage() * 32 / (cargo.capacity + 1) < std::max(new_usg, new_plan) * 32 / (new_cap + 1)) { + cargo.cargo = new_cargo; cargo.capacity = new_cap; cargo.usage = new_usg; cargo.planned = new_plan; + cargo.time = time; } if (new_shared) cargo.shared = true; } @@ -289,7 +293,7 @@ void LinkGraphOverlay::DrawLinks(const DrawPixelInfo *dpi) const */ void LinkGraphOverlay::DrawContent(Point pta, Point ptb, const LinkProperties &cargo) const { - uint usage_or_plan = std::min(cargo.capacity * 2 + 1, std::max(cargo.usage, cargo.planned)); + uint usage_or_plan = std::min(cargo.capacity * 2 + 1, cargo.Usage()); int colour = LinkGraphOverlay::LINK_COLOURS[_settings_client.gui.linkgraph_colours][usage_or_plan * lengthof(LinkGraphOverlay::LINK_COLOURS[0]) / (cargo.capacity * 2 + 2)]; int width = ScaleGUITrad(this->scale); int dash = cargo.shared ? width * 4 : 0; @@ -354,6 +358,56 @@ void LinkGraphOverlay::DrawStationDots(const DrawPixelInfo *dpi) const GfxDrawLine(x + w2, y - w1, x + w2, y + w2, border_colour); } +bool LinkGraphOverlay::ShowTooltip(Point pt, TooltipCloseCondition close_cond) +{ + for (auto i(this->cached_links.crbegin()); i != this->cached_links.crend(); ++i) { + if (!Station::IsValidID(i->first)) continue; + Point pta = this->GetStationMiddle(Station::Get(i->first)); + for (auto j(i->second.crbegin()); j != i->second.crend(); ++j) { + if (!Station::IsValidID(j->first)) continue; + if (i->first == j->first) continue; + + /* Check the distance from the cursor to the line defined by the two stations. */ + Point ptb = this->GetStationMiddle(Station::Get(j->first)); + float dist = std::abs((ptb.x - pta.x) * (pta.y - pt.y) - (pta.x - pt.x) * (ptb.y - pta.y)) / + std::sqrt((ptb.x - pta.x) * (ptb.x - pta.x) + (ptb.y - pta.y) * (ptb.y - pta.y)); + const auto &link = j->second; + if (dist <= 4 && link.Usage() > 0 && + pt.x >= std::min(pta.x, ptb.x) && + pt.x <= std::max(pta.x, ptb.x)) { + static char buf[1024]; + char *buf_end = buf; + buf[0] = 0; + /* Fill buf with more information if this is a bidirectional link. */ + auto k = this->cached_links[j->first].find(i->first); + const auto &back = k->second; + if (k != this->cached_links[j->first].end() && back.Usage() > 0) { + SetDParam(0, back.cargo); + SetDParam(1, back.Usage()); + SetDParam(2, back.Usage() * 100 / (back.capacity + 1)); + buf_end = GetString(buf, STR_LINKGRAPH_STATS_TOOLTIP_RETURN_EXTENSION, lastof(buf)); + } + /* Add information about the travel time if known. */ + const auto time = link.time ? back.time ? ((link.time + back.time) / 2) : link.time : back.time; + if (time > 0) { + SetDParam(0, time); + buf_end = GetString(buf_end, STR_LINKGRAPH_STATS_TOOLTIP_TIME_EXTENSION, lastof(buf)); + } + SetDParam(0, link.cargo); + SetDParam(1, link.Usage()); + SetDParam(2, i->first); + SetDParam(3, j->first); + SetDParam(4, link.Usage() * 100 / (link.capacity + 1)); + SetDParamStr(5, buf); + GuiShowTooltips(this->window, STR_LINKGRAPH_STATS_TOOLTIP, 7, nullptr, close_cond); + return true; + } + } + } + GuiShowTooltips(this->window, STR_NULL, 0, nullptr, close_cond); + return false; +} + /** * Determine the middle of a station in the current window. * @param st The station we're looking for. diff --git a/src/linkgraph/linkgraph_gui.h b/src/linkgraph/linkgraph_gui.h index e6b1114008..ef249b9bfd 100644 --- a/src/linkgraph/linkgraph_gui.h +++ b/src/linkgraph/linkgraph_gui.h @@ -19,14 +19,20 @@ #include /** - * Properties of a link between two stations. + * Monthly statistics for a link between two stations. + * Only the cargo type of the most saturated linkgraph is taken into account. */ struct LinkProperties { - LinkProperties() : capacity(0), usage(0), planned(0), shared(false) {} + LinkProperties() : cargo(CT_INVALID), capacity(0), usage(0), planned(0), shared(false) {} + /** Return the usage of the link to display. */ + uint Usage() const { return std::max(this->usage, this->planned); } + + CargoID cargo; ///< Cargo type of the link. uint capacity; ///< Capacity of the link. uint usage; ///< Actual usage of the link. uint planned; ///< Planned usage of the link. + uint32 time; ///< Travel time of the link. bool shared; ///< If this is a shared link to be drawn dashed. }; @@ -50,7 +56,7 @@ public: * @param company_mask Bitmask of companies to be shown. * @param scale Desired thickness of lines and size of station dots. */ - LinkGraphOverlay(const Window *w, uint wid, CargoTypes cargo_mask, uint32 company_mask, uint scale) : + LinkGraphOverlay(Window *w, uint wid, CargoTypes cargo_mask, uint32 company_mask, uint scale) : window(w), widget_id(wid), cargo_mask(cargo_mask), company_mask(company_mask), scale(scale) {} @@ -58,6 +64,8 @@ public: void SetCargoMask(CargoTypes cargo_mask); void SetCompanyMask(uint32 company_mask); + bool ShowTooltip(Point pt, TooltipCloseCondition close_cond); + /** Mark the linkgraph dirty to be rebuilt next time Draw() is called. */ void SetDirty() { this->dirty = true; } @@ -68,7 +76,7 @@ public: uint32 GetCompanyMask() { return this->company_mask; } protected: - const Window *window; ///< Window to be drawn into. + Window *window; ///< Window to be drawn into. const uint widget_id; ///< ID of Widget in Window to be drawn to. CargoTypes cargo_mask; ///< Bitmask of cargos to be displayed. uint32 company_mask; ///< Bitmask of companies to be displayed. @@ -88,7 +96,7 @@ protected: void GetWidgetDpi(DrawPixelInfo *dpi) const; void RebuildCache(); - static void AddStats(uint new_cap, uint new_usg, uint new_flow, bool new_shared, LinkProperties &cargo); + static void AddStats(CargoID new_cargo, uint new_cap, uint new_usg, uint new_flow, uint32 time, bool new_shared, LinkProperties &cargo); static void DrawVertex(int x, int y, int size, int colour, int border_colour); }; diff --git a/src/main_gui.cpp b/src/main_gui.cpp index a102ff684b..33d3d5d311 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -435,6 +435,12 @@ struct MainWindow : Window } } + bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override + { + if (widget != WID_M_VIEWPORT) return false; + return this->viewport->overlay->ShowTooltip(pt, close_cond); + } + /** * Some data on this window has become invalid. * @param data Information about the changed data. diff --git a/src/window.cpp b/src/window.cpp index 0c3aaa5293..6d94dacfb3 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2873,6 +2873,7 @@ static void MouseLoop(MouseClick click, int mousewheel) _scrolling_viewport = true; _cursor.fix_at = (_settings_client.gui.scroll_mode == VSM_VIEWPORT_RMB_FIXED || _settings_client.gui.scroll_mode == VSM_MAP_RMB_FIXED); + DispatchRightClickEvent(w, x - w->left, y - w->top); return; } break;