diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj
index baa73155fe..090335e301 100644
--- a/projects/openrct2.vcxproj
+++ b/projects/openrct2.vcxproj
@@ -74,8 +74,8 @@
+
-
@@ -97,6 +97,7 @@
+
diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters
index b851bb9a90..a1068acb6d 100644
--- a/projects/openrct2.vcxproj.filters
+++ b/projects/openrct2.vcxproj.filters
@@ -499,8 +499,12 @@
Source\Localisation
+
Source\Network
+
+ Source\Windows
+
Source\Drawing
diff --git a/src/interface/keyboard_shortcut.c b/src/interface/keyboard_shortcut.c
index 8ee523a996..c9b21da0e5 100644
--- a/src/interface/keyboard_shortcut.c
+++ b/src/interface/keyboard_shortcut.c
@@ -496,7 +496,7 @@ static void shortcut_open_cheat_window()
static void shortcut_open_chat_window()
{
- network_open_chat_box();
+ window_chat_open();
}
static const shortcut_action shortcut_table[SHORTCUT_COUNT] = {
diff --git a/src/interface/window.h b/src/interface/window.h
index cefafd28df..cd99df869c 100644
--- a/src/interface/window.h
+++ b/src/interface/window.h
@@ -611,6 +611,7 @@ void window_banner_open(rct_windownumber number);
void window_sign_open(rct_windownumber number);
void window_sign_small_open(rct_windownumber number);
void window_cheats_open();
+void window_chat_open();
void window_research_open();
void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dpi, int baseWidgetIndex);
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 578530ec69..5198e846c6 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -23,8 +23,8 @@
#include
extern "C" {
#include "../addresses.h"
+#include "../common.h"
#include "../game.h"
-#include "../interface/window.h"
#include "../localisation/date.h"
#include "../localisation/localisation.h"
#include "../management/news_item.h"
@@ -418,6 +418,15 @@ void network_send_map()
SDL_RWclose(rw);
}
+void network_send_chat(const char* text)
+{
+ NetworkConnection& networkconnection = gNetworkStatus == NETWORK_CLIENT ? _serverConnection : _clientConnection;
+ std::unique_ptr packet = networkconnection.AllocatePacket();
+ packet->Write((uint32)NETWORK_COMMAND_CHAT);
+ packet->Write((uint8*)text, strlen(text) + 1);
+ networkconnection.QueuePacket(std::move(packet));
+}
+
void network_send_gamecmd(uint32 command, uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp)
{
NetworkConnection& networkconnection = gNetworkStatus == NETWORK_CLIENT ? _serverConnection : _clientConnection;
@@ -442,68 +451,4 @@ void network_print_error()
LocalFree(s);
}
-static void window_chat_host_emptysub() { }
-
-static void window_chat_host_textinput()
-{
- rct_window *w;
- short widgetIndex;
- uint8 result;
- char *text;
-
- window_textinput_get_registers(w, widgetIndex, result, text);
-
- if (!result)
- return;
-
- std::unique_ptr packet = _clientConnection.AllocatePacket();
- packet->Write((uint32)NETWORK_COMMAND_CHAT);
- packet->Write((uint8*)text, strlen(text) + 1);
- _clientConnection.QueuePacket(std::move(packet));
-
- window_close(w);
-}
-
-static void* window_chat_host_events[] = {
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_textinput,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub,
- window_chat_host_emptysub
-};
-
-void network_open_chat_box()
-{
- rct_window *w;
- w = window_create(0, 0, 0, 0, (uint32*)window_chat_host_events, WC_CHAT_HOST, 0);
- w->colours[0] = 1;
- w->colours[1] = 1;
- w->colours[2] = 0;
- w->number = 0;
- window_text_input_open(w, 0, 6000, 6001, STR_NONE, 0, 64);
-}
-
#endif /* DISABLE_NETWORK */
\ No newline at end of file
diff --git a/src/network/network.h b/src/network/network.h
index f2e758f8ae..e969b38501 100644
--- a/src/network/network.h
+++ b/src/network/network.h
@@ -113,10 +113,9 @@ void network_update();
void network_send_tick();
void network_send_map();
+void network_send_chat(const char* text);
void network_send_gamecmd(uint32 command, uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp);
-void network_open_chat_box();
-
void network_print_error();
#ifdef __cplusplus
diff --git a/src/windows/network.c b/src/windows/network.c
new file mode 100644
index 0000000000..00ff064b3b
--- /dev/null
+++ b/src/windows/network.c
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2014 Ted John
+ * OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
+ *
+ * This file is part of OpenRCT2.
+ *
+ * OpenRCT2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *****************************************************************************/
+
+#include "../interface/window.h"
+#include "../localisation/localisation.h"
+#include "../network/network.h"
+
+static void window_chat_host_emptysub() { }
+
+static void window_chat_host_textinput()
+{
+ rct_window *w;
+ short widgetIndex;
+ uint8 result;
+ char *text;
+
+ window_textinput_get_registers(w, widgetIndex, result, text);
+
+ if (!result)
+ return;
+
+ network_send_chat(text);
+
+ window_close(w);
+}
+
+static void* window_chat_host_events[] = {
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_textinput,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub,
+ window_chat_host_emptysub
+};
+
+void window_chat_open()
+{
+ rct_window *w;
+ w = window_create(0, 0, 0, 0, (uint32*)window_chat_host_events, WC_CHAT_HOST, 0);
+ w->colours[0] = 1;
+ w->colours[1] = 1;
+ w->colours[2] = 0;
+ w->number = 0;
+ window_text_input_open(w, 0, 6000, 6001, STR_NONE, 0, 64);
+}
\ No newline at end of file