OpenTTD Source: src/bootstrap_gui.cpp File Reference

OpenTTD Source 15.3

Data Structures | Functions | Variables
bootstrap_gui.cpp File Reference

Barely used user interface for bootstrapping OpenTTD, i.e. More...

`#include "stdafx.h"`
`#include "base_media_base.h"`
`#include "base_media_graphics.h"`
`#include "blitter/factory.hpp"`
`#include "error_func.h"`
`#include "core/geometry_func.hpp"`
`#include "error.h"`
`#include "fontcache.h"`
`#include "gfx_func.h"`
`#include "network/network.h"`
`#include "network/network_content_gui.h"`
`#include "openttd.h"`
`#include "strings_func.h"`
`#include "video/video_driver.hpp"`
`#include "window_func.h"`
`#include "widgets/bootstrap_widget.h"`
`#include "table/strings.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
class | BootstrapBackground
| The background for the game. More...
class | BootstrapErrorWindow
| The window for a failed bootstrap. More...
struct | BootstrapContentDownloadStatusWindow
| Window for showing the download status of content. More...
class | BootstrapAskForDownloadWindow
| The window for the query. More...

## Functions
bool | HandleBootstrap ()
| Handle all procedures for bootstrapping OpenTTD without a base graphics set.

## Variables
static constexpr std::initializer_list< NWidgetPart > | _background_widgets
| Widgets for the background window to prevent smearing.
static WindowDesc | _background_desc (WDP_MANUAL, {}, 0, 0, WC_BOOTSTRAP, WC_NONE, WindowDefaultFlag::NoClose, _background_widgets)
| Window description for the background window to prevent smearing.
static constexpr std::initializer_list< NWidgetPart > | _nested_bootstrap_errmsg_widgets
| Nested widgets for the error window.
static WindowDesc | _bootstrap_errmsg_desc (WDP_CENTER, {}, 0, 0, WC_BOOTSTRAP, WC_NONE, {WindowDefaultFlag::Modal, WindowDefaultFlag::NoClose}, _nested_bootstrap_errmsg_widgets)
| Window description for the error window.
static constexpr std::initializer_list< NWidgetPart > | _nested_bootstrap_download_status_window_widgets
| Nested widgets for the download window.
static WindowDesc | _bootstrap_download_status_window_desc (WDP_CENTER, {}, 0, 0, WC_NETWORK_STATUS_WINDOW, WC_NONE, {WindowDefaultFlag::Modal, WindowDefaultFlag::NoClose}, _nested_bootstrap_download_status_window_widgets)
| Window description for the download window.
static constexpr std::initializer_list< NWidgetPart > | _bootstrap_query_widgets
| The widgets for the query.
static WindowDesc | _bootstrap_query_desc (WDP_CENTER, {}, 0, 0, WC_CONFIRM_POPUP_QUERY, WC_NONE, WindowDefaultFlag::NoClose, _bootstrap_query_widgets)
| The window description for the query.

## Detailed Description

Barely used user interface for bootstrapping OpenTTD, i.e.

downloading the required content.

Definition in file bootstrap_gui.cpp.

## Function Documentation

## ◆ HandleBootstrap()

bool HandleBootstrap | ( |  | ) |

Handle all procedures for bootstrapping OpenTTD without a base graphics set.

This requires all kinds of trickery that is needed to avoid the use of sprites from the base graphics set which are pretty interwoven.

Returns
  True if a base set exists, otherwise false.

Definition at line 363 of file bootstrap_gui.cpp.

References _network_available, CheckForMissingGlyphs(), BlitterFactory::GetCurrentBlitter(), VideoDriver::GetInstance(), BaseMedia< GraphicsSet >::GetUsedSet(), InitializeUnicodeGlyphMap(), VideoDriver::MainLoop(), SetColourGradient(), and BaseMedia< GraphicsSet >::SetSet().

Referenced by openttd_main().

## Variable Documentation

## ◆ _background_widgets

constexpr std::initializer_list<NWidgetPart> _background_widgets
| staticconstexpr

Initial value:
= {
NWidget(WWT_PANEL, COLOUR_DARK_BLUE, WID_BB_BACKGROUND), SetResize(1, 1),
EndContainer(),
}
WID_BB_BACKGROUND
@ WID_BB_BACKGROUND
Background of the window.
Definition bootstrap_widget.h:15
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition widget_type.h:1232
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
Definition widget_type.h:1427
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition widget_type.h:1148
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:39

Widgets for the background window to prevent smearing.

Definition at line 36 of file bootstrap_gui.cpp.

## ◆ _bootstrap_query_widgets

constexpr std::initializer_list<NWidgetPart> _bootstrap_query_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CAPTION, COLOUR_GREY), SetStringTip(STR_MISSING_GRAPHICS_SET_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, WID_BAFD_QUESTION), EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BAFD_YES), SetStringTip(STR_MISSING_GRAPHICS_YES_DOWNLOAD),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BAFD_NO), SetStringTip(STR_MISSING_GRAPHICS_NO_QUIT),
EndContainer(),
}
WID_BAFD_QUESTION
@ WID_BAFD_QUESTION
The question whether to download.
Definition bootstrap_widget.h:27
WID_BAFD_NO
@ WID_BAFD_NO
An negative answer to the question.
Definition bootstrap_widget.h:29
WID_BAFD_YES
@ WID_BAFD_YES
An affirmative answer to the question.
Definition bootstrap_widget.h:28
SetStringTip
constexpr NWidgetPart SetStringTip(StringID string, StringID tip={})
Widget part function for setting the string and tooltip.
Definition widget_type.h:1243
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition widget_type.h:105
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:66
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:52

The widgets for the query.

It has no close box as that sprite does not exist yet.

Definition at line 177 of file bootstrap_gui.cpp.

## ◆ _nested_bootstrap_download_status_window_widgets

constexpr std::initializer_list<NWidgetPart> _nested_bootstrap_download_status_window_widgets
| staticconstexpr

Initial value:
= {
NWidget(WWT_CAPTION, COLOUR_GREY), SetStringTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup),
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_BAR), SetFill(1, 0),
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_TEXT), SetFill(1, 0), SetMinimalSize(350, 0),
EndContainer(),
EndContainer(),
}
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition window_gui.h:93
SetFill
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition widget_type.h:1222
SetPIP
constexpr NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post)
Widget part function for setting a pre/inter/post spaces.
Definition widget_type.h:1378
SetPadding
constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
Widget part function for setting additional space around a widget.
Definition widget_type.h:1335
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition widget_type.h:1159
WID_NCDS_PROGRESS_TEXT
@ WID_NCDS_PROGRESS_TEXT
Text explaining what is happening.
Definition network_content_widget.h:18
WID_NCDS_PROGRESS_BAR
@ WID_NCDS_PROGRESS_BAR
Simple progress bar.
Definition network_content_widget.h:17
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition widget_type.h:68
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget tree.
Definition widget_type.h:37

Nested widgets for the download window.

Definition at line 126 of file bootstrap_gui.cpp.

## ◆ _nested_bootstrap_errmsg_widgets

constexpr std::initializer_list<NWidgetPart> _nested_bootstrap_errmsg_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_BEM_CAPTION), SetStringTip(STR_MISSING_GRAPHICS_ERROR_TITLE),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, WID_BEM_MESSAGE), EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BEM_QUIT), SetStringTip(STR_MISSING_GRAPHICS_ERROR_QUIT), SetFill(1, 0),
EndContainer(),
}
WID_BEM_MESSAGE
@ WID_BEM_MESSAGE
Error message.
Definition bootstrap_widget.h:21
WID_BEM_QUIT
@ WID_BEM_QUIT
Quit button.
Definition bootstrap_widget.h:22
WID_BEM_CAPTION
@ WID_BEM_CAPTION
Caption of the window.
Definition bootstrap_widget.h:20

Nested widgets for the error window.

Definition at line 69 of file bootstrap_gui.cpp.