diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 423c62bf46..da784465c7 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -860,7 +860,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/lang/dutch.txt b/src/lang/dutch.txt index eff87ff1c8..e9354cda88 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -384,7 +384,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 @@ -2824,11 +2824,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 @@ -4942,6 +4942,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.txt b/src/lang/english.txt index b9a83ce0dd..e354557ff4 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3145,6 +3145,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/lang/english_AU.txt b/src/lang/english_AU.txt index 8f0b96cb72..4a2678d7aa 100644 --- a/src/lang/english_AU.txt +++ b/src/lang/english_AU.txt @@ -2849,7 +2849,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 600bd4dada..4aa69fd9ac 100644 --- a/src/lang/frisian.txt +++ b/src/lang/frisian.txt @@ -1183,6 +1183,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} @@ -2076,6 +2077,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 @@ -2157,6 +2159,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 @@ -2174,6 +2177,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 @@ -2188,6 +2192,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 @@ -2207,6 +2212,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 @@ -2297,6 +2303,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 @@ -2605,10 +2612,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 @@ -2743,7 +2752,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 @@ -2907,6 +2919,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: @@ -3081,6 +3094,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} @@ -3411,6 +3425,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 @@ -3512,6 +3527,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} @@ -3716,7 +3732,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 6f63820698..c2b3bf32ce 100644 --- a/src/lang/portuguese.txt +++ b/src/lang/portuguese.txt @@ -385,7 +385,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 @@ -2825,11 +2825,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 @@ -4943,6 +4943,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 8a91cc0547..8353c72930 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -3003,7 +3003,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 - оценка стоимости покупки. STR_LANDSCAPING_TOOLTIP_RULER_TOOL :{BLACK}Виртуальная линейка для измерения расстояний и высот # Object construction window diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index cdc6b309c9..7c2a1ce7a5 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -170,7 +170,7 @@ void LinkGraphOverlay::RebuildCache(bool incremental) item->from_pt = from_pt; item->to_pt = to_pt; } - this->AddStats(lg.Monthly(edge.Capacity()), lg.Monthly(edge.Usage()), + this->AddStats(c, lg.Monthly(edge.Capacity()), lg.Monthly(edge.Usage()), ge.flows.GetFlowVia(to->index), from->owner == OWNER_NONE || to->owner == OWNER_NONE, item->prop); } @@ -345,11 +345,12 @@ inline bool LinkGraphOverlay::IsLinkVisible(Point pta, Point ptb, const DrawPixe * @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, 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; @@ -417,7 +418,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; @@ -483,6 +484,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 (LinkList::const_reverse_iterator i(this->cached_links.rbegin()); i != this->cached_links.rend(); ++i) { + if (!Station::IsValidID(i->from_id)) continue; + if (!Station::IsValidID(i->to_id)) continue; + + Point pta = i->from_pt; + Point ptb = i->to_pt; + + /* Check the distance from the cursor to the line defined by the two stations. */ + auto check_distance = [&]() -> bool { + int64 a = ((ptb.x - pta.x) * (pta.y - pt.y) - (pta.x - pt.x) * (ptb.y - pta.y)); + return ((a * a) / ((ptb.x - pta.x) * (ptb.x - pta.x) + (ptb.y - pta.y) * (ptb.y - pta.y))) <= 16; + }; + const auto &link = i->prop; + if (link.Usage() > 0 && + pt.x + 2 >= std::min(pta.x, ptb.x) && + pt.x - 2 <= std::max(pta.x, ptb.x) && + check_distance()) { + + static char buf[1024]; + buf[0] = 0; + + /* Fill buf with more information if this is a bidirectional link. */ + for (LinkList::const_reverse_iterator j = std::next(i); j != this->cached_links.rend(); ++j) { + if (j->from_id == i->to_id && j->to_id == i->from_id) { + if (j->prop.Usage() > 0) { + SetDParam(0, j->prop.cargo); + SetDParam(1, j->prop.Usage()); + SetDParam(2, j->prop.Usage() * 100 / (j->prop.capacity + 1)); + GetString(buf, STR_LINKGRAPH_STATS_TOOLTIP_RETURN_EXTENSION, lastof(buf)); + } + break; + } + } + + SetDParam(0, link.cargo); + SetDParam(1, link.Usage()); + SetDParam(2, i->from_id); + SetDParam(3, i->to_id); + SetDParam(4, link.Usage() * 100 / (link.capacity + 1)); + SetDParamStr(5, buf); + GuiShowTooltips(this->window, STR_LINKGRAPH_STATS_TOOLTIP, 0, 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 c6e9f1621c..a73b798045 100644 --- a/src/linkgraph/linkgraph_gui.h +++ b/src/linkgraph/linkgraph_gui.h @@ -19,14 +19,19 @@ #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() : capacity(0), usage(0), planned(0), cargo(CT_INVALID), shared(false) {} + + /** Return the usage of the link to display. */ + uint Usage() const { return std::max(this->usage, this->planned); } uint capacity; ///< Capacity of the link. uint usage; ///< Actual usage of the link. uint planned; ///< Planned usage of the link. + CargoID cargo; ///< Cargo type of the link. bool shared; ///< If this is a shared link to be drawn dashed. }; @@ -74,6 +79,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; } @@ -105,7 +112,7 @@ protected: bool IsPointVisible(Point pt, const DrawPixelInfo *dpi, int padding = 0) const; void GetWidgetDpi(DrawPixelInfo *dpi, uint margin = 0) const; - 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, 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 2291a27777..3a18c6aa2e 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -250,7 +250,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->map_type = (ViewportMapType) _settings_client.gui.default_viewport_map_mode; this->viewport->overlay = new LinkGraphOverlay(this, WID_M_VIEWPORT, 0, 0, 3); @@ -491,6 +491,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/news_gui.cpp b/src/news_gui.cpp index e87f1ab5d9..24b9bf9358 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -309,7 +309,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 : GetReferenceTile(ni->reftype1, ni->ref1), ZOOM_LVL_NEWS); + nvp->InitializeViewport(this, ni->reftype1 == NR_VEHICLE ? 0x80000000 | ni->ref1 : 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_cmd.cpp b/src/town_cmd.cpp index 60fec46843..abc784cb7e 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1317,6 +1317,27 @@ static bool CanRoadContinueIntoNextTile(const Town *t, const TileIndex tile, con return DoCommand(next_tile, rcmd | (rt << 4), t->index, DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD).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. @@ -1381,9 +1402,14 @@ 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; + std::bitset tried; uint n = MAX_BRIDGES; - byte bridge_type = RandomRange (n); + byte bridge_type = RandomRange(n); for (;;) { /* Can we actually build the bridge? */ @@ -1397,14 +1423,14 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi /* Try a different bridge. */ tried[bridge_type] = true; n--; - assert (n + tried.count() == MAX_BRIDGES); + assert(n + tried.count() == MAX_BRIDGES); if (n == 0) break; bridge_type = 0; - uint i = RandomRange (n); + uint i = RandomRange(n); while (tried[bridge_type] || (i-- > 0)) { bridge_type++; - assert (bridge_type < MAX_BRIDGES); + assert(bridge_type < MAX_BRIDGES); } } diff --git a/src/town_gui.cpp b/src/town_gui.cpp index a7fcffde42..2bae45c0b2 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -44,6 +44,7 @@ #include #include "safeguards.h" +#include "zoom_func.h" TownKdtree _town_local_authority_kdtree(&Kdtree_TownXYFunc); @@ -338,7 +339,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)); } ~TownViewWindow() diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 44256ce06a..3095a889dc 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -3566,7 +3566,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 03aba7de8c..fd3d864c67 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -62,8 +62,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 c417843222..7ae629b466 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -28,6 +28,7 @@ #include "table/strings.h" #include "safeguards.h" +#include "zoom_func.h" /** GUI for accessing waypoints and buoys. */ struct WaypointWindow : Window { @@ -100,7 +101,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/window.cpp b/src/window.cpp index 697de3490b..c840ebf4b8 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -3023,6 +3023,7 @@ static void MouseLoop(MouseClick click, int mousewheel) _scrolling_viewport = w; _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; @@ -3032,27 +3033,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. */ @@ -3121,6 +3120,7 @@ void HandleMouseEvents() click = MC_HOVER; _input_events_this_tick++; _mouse_hovering = true; + hover_time = std::chrono::steady_clock::now(); } } } else { diff --git a/src/zoom_func.h b/src/zoom_func.h index 5b2b972bea..05edf3bdd3 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 2e7959a7bd..d954b1b15d 100644 --- a/src/zoom_type.h +++ b/src/zoom_type.h @@ -39,7 +39,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.