summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_chat_gui.cpp8
-rw-r--r--src/network/network_content_gui.cpp17
-rw-r--r--src/network/network_content_gui.h2
-rw-r--r--src/network/network_gui.cpp54
4 files changed, 41 insertions, 40 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 062858e11..5e7d11821 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -296,7 +296,7 @@ struct NetworkChatWindow : public Window {
* @param type The type of destination.
* @param dest The actual destination index.
*/
- NetworkChatWindow(const WindowDesc *desc, DestType type, int dest) : message_editbox(NETWORK_CHAT_LENGTH)
+ NetworkChatWindow(WindowDesc *desc, DestType type, int dest) : Window(desc), message_editbox(NETWORK_CHAT_LENGTH)
{
this->dtype = type;
this->dest = dest;
@@ -312,7 +312,7 @@ struct NetworkChatWindow : public Window {
assert((uint)this->dtype < lengthof(chat_captions));
this->dest_string = chat_captions[this->dtype];
- this->InitNested(desc, type);
+ this->InitNested(type);
this->SetFocusedWidget(WID_NC_TEXTBOX);
InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height);
@@ -459,7 +459,7 @@ struct NetworkChatWindow : public Window {
free(pre_buf);
}
- virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
+ virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
{
Point pt = { 0, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height };
return pt;
@@ -540,7 +540,7 @@ static const NWidgetPart _nested_chat_window_widgets[] = {
};
/** The description of the chat window. */
-static const WindowDesc _chat_window_desc(
+static WindowDesc _chat_window_desc(
WDP_MANUAL, 640, 14, // x, y, width, height
WC_SEND_NETWORK_MSG, WC_NONE,
0,
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index a7c503a60..ba30199ae 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -91,20 +91,20 @@ static const NWidgetPart _nested_network_content_download_status_window_widgets[
};
/** Window description for the download window */
-static const WindowDesc _network_content_download_status_window_desc(
+static WindowDesc _network_content_download_status_window_desc(
WDP_CENTER, 0, 0,
WC_NETWORK_STATUS_WINDOW, WC_NONE,
WDF_MODAL,
_nested_network_content_download_status_window_widgets, lengthof(_nested_network_content_download_status_window_widgets)
);
-BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(const WindowDesc *desc) :
- cur_id(UINT32_MAX)
+BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(WindowDesc *desc) :
+ Window(desc), cur_id(UINT32_MAX)
{
_network_content_client.AddCallback(this);
_network_content_client.DownloadSelectedContent(this->total_files, this->total_bytes);
- this->InitNested(desc, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
+ this->InitNested(WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
}
BaseNetworkContentDownloadStatusWindow::~BaseNetworkContentDownloadStatusWindow()
@@ -472,15 +472,16 @@ public:
* @param desc the window description to pass to Window's constructor.
* @param select_all Whether the select all button is allowed or not.
*/
- NetworkContentListWindow(const WindowDesc *desc, bool select_all) :
+ NetworkContentListWindow(WindowDesc *desc, bool select_all) :
+ Window(desc),
auto_select(select_all),
filter_editbox(EDITBOX_MAX_SIZE),
selected(NULL),
list_pos(0)
{
- this->CreateNestedTree(desc);
+ this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_NCL_SCROLLBAR);
- this->FinishInitNested(desc, WN_NETWORK_WINDOW_CONTENT_LIST);
+ this->FinishInitNested(WN_NETWORK_WINDOW_CONTENT_LIST);
this->GetWidget<NWidgetStacked>(WID_NCL_SEL_ALL_UPDATE)->SetDisplayedPlane(select_all);
@@ -1031,7 +1032,7 @@ static const NWidgetPart _nested_network_content_list_widgets[] = {
};
/** Window description of the content list */
-static const WindowDesc _network_content_list_desc(
+static WindowDesc _network_content_list_desc(
WDP_CENTER, 630, 460,
WC_NETWORK_WINDOW, WC_NONE,
0,
diff --git a/src/network/network_content_gui.h b/src/network/network_content_gui.h
index 6650eb14a..212fcec04 100644
--- a/src/network/network_content_gui.h
+++ b/src/network/network_content_gui.h
@@ -32,7 +32,7 @@ public:
* Create the window with the given description.
* @param desc The description of the window.
*/
- BaseNetworkContentDownloadStatusWindow(const WindowDesc *desc);
+ BaseNetworkContentDownloadStatusWindow(WindowDesc *desc);
/**
* Free everything associated with this window.
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index dae8764be..80cdcda83 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -449,14 +449,14 @@ protected:
}
public:
- NetworkGameWindow(const WindowDesc *desc) : name_editbox(NETWORK_CLIENT_NAME_LENGTH), filter_editbox(120)
+ NetworkGameWindow(WindowDesc *desc) : Window(desc), name_editbox(NETWORK_CLIENT_NAME_LENGTH), filter_editbox(120)
{
this->list_pos = SLP_INVALID;
this->server = NULL;
- this->CreateNestedTree(desc);
+ this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_NG_SCROLLBAR);
- this->FinishInitNested(desc, WN_NETWORK_WINDOW_GAME);
+ this->FinishInitNested(WN_NETWORK_WINDOW_GAME);
this->querystrings[WID_NG_CLIENT] = &this->name_editbox;
this->name_editbox.text.Assign(_settings_client.network.client_name);
@@ -1011,7 +1011,7 @@ static const NWidgetPart _nested_network_game_widgets[] = {
EndContainer(),
};
-static const WindowDesc _network_game_window_desc(
+static WindowDesc _network_game_window_desc(
WDP_CENTER, 1000, 730,
WC_NETWORK_WINDOW, WC_NONE,
0,
@@ -1040,9 +1040,9 @@ struct NetworkStartServerWindow : public Window {
byte widget_id; ///< The widget that has the pop-up input menu
QueryString name_editbox; ///< Server name editbox.
- NetworkStartServerWindow(const WindowDesc *desc) : name_editbox(NETWORK_NAME_LENGTH)
+ NetworkStartServerWindow(WindowDesc *desc) : Window(desc), name_editbox(NETWORK_NAME_LENGTH)
{
- this->InitNested(desc, WN_NETWORK_WINDOW_START);
+ this->InitNested(WN_NETWORK_WINDOW_START);
this->querystrings[WID_NSS_GAMENAME] = &this->name_editbox;
this->name_editbox.text.Assign(_settings_client.network.server_name);
@@ -1326,7 +1326,7 @@ static const NWidgetPart _nested_network_start_server_window_widgets[] = {
EndContainer(),
};
-static const WindowDesc _network_start_server_window_desc(
+static WindowDesc _network_start_server_window_desc(
WDP_CENTER, 0, 0,
WC_NETWORK_WINDOW, WC_NONE,
0,
@@ -1347,12 +1347,12 @@ struct NetworkLobbyWindow : public Window {
NetworkCompanyInfo company_info[MAX_COMPANIES];
Scrollbar *vscroll;
- NetworkLobbyWindow(const WindowDesc *desc, NetworkGameList *ngl) :
- Window(), company(INVALID_COMPANY), server(ngl)
+ NetworkLobbyWindow(WindowDesc *desc, NetworkGameList *ngl) :
+ Window(desc), company(INVALID_COMPANY), server(ngl)
{
- this->CreateNestedTree(desc);
+ this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_NL_SCROLLBAR);
- this->FinishInitNested(desc, WN_NETWORK_WINDOW_LOBBY);
+ this->FinishInitNested(WN_NETWORK_WINDOW_LOBBY);
this->OnResize();
}
@@ -1615,7 +1615,7 @@ static const NWidgetPart _nested_network_lobby_window_widgets[] = {
EndContainer(),
};
-static const WindowDesc _network_lobby_window_desc(
+static WindowDesc _network_lobby_window_desc(
WDP_CENTER, 0, 0,
WC_NETWORK_WINDOW, WC_NONE,
0,
@@ -1664,7 +1664,7 @@ static const NWidgetPart _nested_client_list_popup_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY, WID_CLP_PANEL), EndContainer(),
};
-static const WindowDesc _client_list_popup_desc(
+static WindowDesc _client_list_popup_desc(
WDP_AUTO, 0, 0,
WC_CLIENT_LIST_POPUP, WC_CLIENT_LIST,
0,
@@ -1727,8 +1727,8 @@ struct NetworkClientListPopupWindow : Window {
action->proc = proc;
}
- NetworkClientListPopupWindow(const WindowDesc *desc, int x, int y, ClientID client_id) :
- Window(),
+ NetworkClientListPopupWindow(WindowDesc *desc, int x, int y, ClientID client_id) :
+ Window(desc),
sel_index(0), client_id(client_id)
{
this->desired_location.x = x;
@@ -1758,11 +1758,11 @@ struct NetworkClientListPopupWindow : Window {
this->AddAction(STR_NETWORK_CLIENTLIST_BAN, &ClientList_Ban);
}
- this->InitNested(desc, client_id);
+ this->InitNested(client_id);
CLRBITS(this->flags, WF_WHITE_BORDER);
}
- virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
+ virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
{
return this->desired_location;
}
@@ -1840,7 +1840,7 @@ static const NWidgetPart _nested_client_list_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY, WID_CL_PANEL), SetMinimalSize(250, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), SetResize(1, 1), EndContainer(),
};
-static const WindowDesc _client_list_desc(
+static WindowDesc _client_list_desc(
WDP_AUTO, 0, 0,
WC_CLIENT_LIST, WC_NONE,
0,
@@ -1856,11 +1856,11 @@ struct NetworkClientListWindow : Window {
uint server_client_width;
uint company_icon_width;
- NetworkClientListWindow(const WindowDesc *desc, WindowNumber window_number) :
- Window(),
+ NetworkClientListWindow(WindowDesc *desc, WindowNumber window_number) :
+ Window(desc),
selected_item(-1)
{
- this->InitNested(desc, window_number);
+ this->InitNested(window_number);
}
/**
@@ -2009,10 +2009,10 @@ uint32 _network_join_bytes_total; ///< The total number of bytes to downlo
struct NetworkJoinStatusWindow : Window {
NetworkPasswordType password_type;
- NetworkJoinStatusWindow(const WindowDesc *desc) : Window()
+ NetworkJoinStatusWindow(WindowDesc *desc) : Window(desc)
{
this->parent = FindWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
- this->InitNested(desc, WN_NETWORK_STATUS_WINDOW_JOIN);
+ this->InitNested(WN_NETWORK_STATUS_WINDOW_JOIN);
}
virtual void DrawWidget(const Rect &r, int widget) const
@@ -2112,7 +2112,7 @@ static const NWidgetPart _nested_network_join_status_window_widgets[] = {
EndContainer(),
};
-static const WindowDesc _network_join_status_window_desc(
+static WindowDesc _network_join_status_window_desc(
WDP_CENTER, 0, 0,
WC_NETWORK_STATUS_WINDOW, WC_NONE,
WDF_MODAL,
@@ -2143,9 +2143,9 @@ void ShowNetworkNeedPassword(NetworkPasswordType npt)
struct NetworkCompanyPasswordWindow : public Window {
QueryString password_editbox; ///< Password editbox.
- NetworkCompanyPasswordWindow(const WindowDesc *desc, Window *parent) : password_editbox(lengthof(_settings_client.network.default_company_pass))
+ NetworkCompanyPasswordWindow(WindowDesc *desc, Window *parent) : Window(desc), password_editbox(lengthof(_settings_client.network.default_company_pass))
{
- this->InitNested(desc, 0);
+ this->InitNested(0);
this->parent = parent;
this->querystrings[WID_NCP_PASSWORD] = &this->password_editbox;
@@ -2206,7 +2206,7 @@ static const NWidgetPart _nested_network_company_password_window_widgets[] = {
EndContainer(),
};
-static const WindowDesc _network_company_password_window_desc(
+static WindowDesc _network_company_password_window_desc(
WDP_AUTO, 0, 0,
WC_COMPANY_PASSWORD_WINDOW, WC_NONE,
0,