OpenTTD Source  13.2.1
bootstrap_gui.cpp File Reference
#include "stdafx.h"
#include "base_media_base.h"
#include "blitter/factory.hpp"
#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. More...
 

Variables

static const struct NWidgetPart _background_widgets []
 Widgets for the background window to prevent smearing. More...
 
static WindowDesc _background_desc (WDP_MANUAL, nullptr, 0, 0, WC_BOOTSTRAP, WC_NONE, 0, _background_widgets, lengthof(_background_widgets))
 Window description for the background window to prevent smearing.
 
static const NWidgetPart _nested_bootstrap_errmsg_widgets []
 Nested widgets for the error window. More...
 
static WindowDesc _bootstrap_errmsg_desc (WDP_CENTER, nullptr, 0, 0, WC_BOOTSTRAP, WC_NONE, WDF_MODAL, _nested_bootstrap_errmsg_widgets, lengthof(_nested_bootstrap_errmsg_widgets))
 Window description for the error window.
 
static const NWidgetPart _nested_bootstrap_download_status_window_widgets []
 Nested widgets for the download window. More...
 
static WindowDesc _bootstrap_download_status_window_desc (WDP_CENTER, nullptr, 0, 0, WC_NETWORK_STATUS_WINDOW, WC_NONE, WDF_MODAL, _nested_bootstrap_download_status_window_widgets, lengthof(_nested_bootstrap_download_status_window_widgets))
 Window description for the download window.
 
static const NWidgetPart _bootstrap_query_widgets []
 The widgets for the query. More...
 
static WindowDesc _bootstrap_query_desc (WDP_CENTER, nullptr, 0, 0, WC_CONFIRM_POPUP_QUERY, WC_NONE, 0, _bootstrap_query_widgets, lengthof(_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 285 of file bootstrap_gui.cpp.

References _network_available, BlitterFactory::GetCurrentBlitter(), and BaseMedia< GraphicsSet >::GetUsedSet().

Variable Documentation

◆ _background_widgets

const struct NWidgetPart _background_widgets[]
static
Initial value:
= {
NWidget(WWT_PANEL, COLOUR_DARK_BLUE, WID_BB_BACKGROUND), SetResize(1, 1),
}

Widgets for the background window to prevent smearing.

Definition at line 34 of file bootstrap_gui.cpp.

◆ _bootstrap_query_widgets

const NWidgetPart _bootstrap_query_widgets[]
static
Initial value:
= {
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_MISSING_GRAPHICS_SET_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BAFD_YES), SetDataTip(STR_MISSING_GRAPHICS_YES_DOWNLOAD, STR_NULL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BAFD_NO), SetDataTip(STR_MISSING_GRAPHICS_NO_QUIT, STR_NULL),
}

The widgets for the query.

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

Definition at line 175 of file bootstrap_gui.cpp.

◆ _nested_bootstrap_download_status_window_widgets

const NWidgetPart _nested_bootstrap_download_status_window_widgets[]
static
Initial value:
= {
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_PANEL, COLOUR_GREY),
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),
}

Nested widgets for the download window.

Definition at line 124 of file bootstrap_gui.cpp.

◆ _nested_bootstrap_errmsg_widgets

const NWidgetPart _nested_bootstrap_errmsg_widgets[]
static
Initial value:
= {
NWidget(WWT_CAPTION, COLOUR_GREY, WID_BEM_CAPTION), SetDataTip(STR_MISSING_GRAPHICS_ERROR_TITLE, STR_NULL),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BEM_QUIT), SetDataTip(STR_MISSING_GRAPHICS_ERROR_QUIT, STR_NULL), SetFill(1, 0),
}

Nested widgets for the error window.

Definition at line 66 of file bootstrap_gui.cpp.

SetPadding
static NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1143
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition: window_gui.h:67
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:73
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:997
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget array.
Definition: widget_type.h:46
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1111
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:104
WID_BAFD_QUESTION
@ WID_BAFD_QUESTION
The question whether to download.
Definition: bootstrap_widget.h:27
WID_BB_BACKGROUND
@ WID_BB_BACKGROUND
Background of the window.
Definition: bootstrap_widget.h:15
WID_NCDS_PROGRESS_BAR
@ WID_NCDS_PROGRESS_BAR
Simple progress bar.
Definition: network_content_widget.h:17
WID_BAFD_NO
@ WID_BAFD_NO
An negative answer to the question.
Definition: bootstrap_widget.h:29
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition: widget_type.h:75
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1096
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
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1229
WID_NCDS_PROGRESS_TEXT
@ WID_NCDS_PROGRESS_TEXT
Text explaining what is happening.
Definition: network_content_widget.h:18
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1014
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
WID_BEM_MESSAGE
@ WID_BEM_MESSAGE
Error message.
Definition: bootstrap_widget.h:21
WID_BAFD_YES
@ WID_BAFD_YES
An affirmative answer to the question.
Definition: bootstrap_widget.h:28
SetPIP
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1191
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1080