MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / MakePerformanceDetailPanels

Function MakePerformanceDetailPanels

src/graph_gui.cpp:2003–2029  ·  view source on GitHub ↗

* Make a vertical list of panels for outputting score details. * @return Panel with performance details. */

Source from the content-addressed store, hash-verified

2001 * @return Panel with performance details.
2002 */
2003static std::unique_ptr<NWidgetBase> MakePerformanceDetailPanels()
2004{
2005 auto realtime = TimerGameEconomy::UsingWallclockUnits();
2006 const StringID performance_tips[] = {
2007 realtime ? STR_PERFORMANCE_DETAIL_VEHICLES_TOOLTIP_PERIODS : STR_PERFORMANCE_DETAIL_VEHICLES_TOOLTIP_YEARS,
2008 STR_PERFORMANCE_DETAIL_STATIONS_TOOLTIP,
2009 realtime ? STR_PERFORMANCE_DETAIL_MIN_PROFIT_TOOLTIP_PERIODS : STR_PERFORMANCE_DETAIL_MIN_PROFIT_TOOLTIP_YEARS,
2010 STR_PERFORMANCE_DETAIL_MIN_INCOME_TOOLTIP,
2011 STR_PERFORMANCE_DETAIL_MAX_INCOME_TOOLTIP,
2012 STR_PERFORMANCE_DETAIL_DELIVERED_TOOLTIP,
2013 STR_PERFORMANCE_DETAIL_CARGO_TOOLTIP,
2014 STR_PERFORMANCE_DETAIL_MONEY_TOOLTIP,
2015 STR_PERFORMANCE_DETAIL_LOAN_TOOLTIP,
2016 STR_PERFORMANCE_DETAIL_TOTAL_TOOLTIP,
2017 };
2018
2019 static_assert(lengthof(performance_tips) == SCORE_END - SCORE_BEGIN);
2020
2021 auto vert = std::make_unique<NWidgetVertical>(NWidContainerFlag::EqualSize);
2022 for (WidgetID widnum = WID_PRD_SCORE_FIRST; widnum <= WID_PRD_SCORE_LAST; widnum++) {
2023 auto panel = std::make_unique<NWidgetBackground>(WWT_PANEL, COLOUR_BROWN, widnum);
2024 panel->SetFill(1, 1);
2025 panel->SetToolTip(performance_tips[widnum - WID_PRD_SCORE_FIRST]);
2026 vert->Add(std::move(panel));
2027 }
2028 return vert;
2029}
2030
2031/** Make a number of rows with buttons for each company for the performance rating detail window. */
2032std::unique_ptr<NWidgetBase> MakeCompanyButtonRowsGraphGUI()

Callers

nothing calls this directly

Calls 3

SetFillMethod · 0.80
SetToolTipMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected