mirror of https://github.com/OpenRCT2/OpenRCT2.git
move chat window to separate file
This commit is contained in:
parent
6c571bab00
commit
21334e307c
|
@ -74,8 +74,8 @@
|
|||
<ClCompile Include="..\src\management\news_item.c" />
|
||||
<ClCompile Include="..\src\management\research.c" />
|
||||
<ClCompile Include="..\src\network\http.cpp" />
|
||||
<ClCompile Include="..\src\network\network.cpp" />
|
||||
<ClCompile Include="..\src\network\twitch.cpp" />
|
||||
<ClCompile Include="..\src\network\network.c" />
|
||||
<ClCompile Include="..\src\object.c" />
|
||||
<ClCompile Include="..\src\object_list.c" />
|
||||
<ClCompile Include="..\src\openrct2.c" />
|
||||
|
@ -97,6 +97,7 @@
|
|||
<ClCompile Include="..\src\scenario.c" />
|
||||
<ClCompile Include="..\src\scenario_list.c" />
|
||||
<ClCompile Include="..\src\windows\changelog.c" />
|
||||
<ClCompile Include="..\src\windows\network.c" />
|
||||
<ClCompile Include="..\src\windows\title_command_editor.c" />
|
||||
<ClCompile Include="..\src\windows\title_editor.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
|
||||
|
|
|
@ -499,8 +499,12 @@
|
|||
<Filter>Source\Localisation</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\network\network.c">
|
||||
<ClCompile Include="..\src\network\network.cpp">
|
||||
<Filter>Source\Network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\windows\network.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\drawing\scrolling_text.c">
|
||||
<Filter>Source\Drawing</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -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] = {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
#include <math.h>
|
||||
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<NetworkPacket> 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<NetworkPacket> 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 */
|
|
@ -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
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#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);
|
||||
}
|
Loading…
Reference in New Issue