mirror of https://github.com/OpenRCT2/OpenRCT2.git
Display message with chat shortcut keys upon connection
Works for server as well.
This commit is contained in:
parent
adde88ca92
commit
e232358608
|
@ -4085,6 +4085,7 @@ STR_5778 :Built: {COMMA16} Years Ago
|
|||
STR_5779 :Income: {CURRENCY2DP} per hour
|
||||
STR_5780 :Running cost: {CURRENCY2DP} per hour
|
||||
STR_5781 :Running cost: Unknown
|
||||
STR_5782 :You are now connected. Press '{STRING}' to chat.
|
||||
|
||||
#############
|
||||
# Scenarios #
|
||||
|
|
|
@ -2395,6 +2395,9 @@ enum {
|
|||
STR_RIDE_LIST_RUNNING_COST_LABEL = 5780,
|
||||
STR_RIDE_LIST_RUNNING_COST_UNKNOWN = 5781,
|
||||
|
||||
|
||||
STR_MULTIPLAYER_CONNECTED_CHAT_HINT = 5782,
|
||||
|
||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||
STR_COUNT = 32768
|
||||
};
|
||||
|
|
|
@ -42,6 +42,7 @@ extern "C" {
|
|||
#include "../game.h"
|
||||
#include "../interface/chat.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../interface/keyboard_shortcut.h"
|
||||
#include "../localisation/date.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../network/http.h"
|
||||
|
@ -96,6 +97,8 @@ enum {
|
|||
constexpr int MASTER_SERVER_REGISTER_TIME = 120 * 1000; // 2 minutes
|
||||
constexpr int MASTER_SERVER_HEARTBEAT_TIME = 60 * 1000; // 1 minute
|
||||
|
||||
void network_chat_show_connected_message();
|
||||
|
||||
NetworkPacket::NetworkPacket()
|
||||
{
|
||||
transferred = 0;
|
||||
|
@ -702,6 +705,7 @@ bool Network::BeginServer(unsigned short port, const char* address)
|
|||
player_id = player->id;
|
||||
|
||||
printf("Ready for clients...\n");
|
||||
network_chat_show_connected_message();
|
||||
|
||||
mode = NETWORK_MODE_SERVER;
|
||||
status = NETWORK_STATUS_CONNECTED;
|
||||
|
@ -1758,6 +1762,9 @@ void Network::Client_Handle_MAP(NetworkConnection& connection, NetworkPacket& pa
|
|||
server_srand0_tick = 0;
|
||||
// window_network_status_open("Loaded new map from network");
|
||||
_desynchronised = false;
|
||||
|
||||
// Notify user he is now online and which shortcut key enables chat
|
||||
network_chat_show_connected_message();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2130,6 +2137,18 @@ rct_string_id network_get_group_name_string_id(unsigned int index)
|
|||
return gNetwork.group_list[index]->GetNameStringId();
|
||||
}
|
||||
|
||||
void network_chat_show_connected_message()
|
||||
{
|
||||
char *templateString = (char*)language_get_string(STR_INDIVIDUAL_KEYS_BASE);
|
||||
keyboard_shortcut_format_string(templateString, gShortcutKeys[SHORTCUT_OPEN_CHAT_WINDOW]);
|
||||
utf8 buffer[256];
|
||||
NetworkPlayer server;
|
||||
safe_strcpy((char*)&server.name, "Server", sizeof(server.name));
|
||||
format_string(buffer, STR_MULTIPLAYER_CONNECTED_CHAT_HINT, &templateString);
|
||||
const char *formatted = Network::FormatChat(&server, buffer);
|
||||
chat_history_add(formatted);
|
||||
}
|
||||
|
||||
void game_command_set_player_group(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp)
|
||||
{
|
||||
uint8 playerid = (uint8)*ecx;
|
||||
|
|
|
@ -305,7 +305,7 @@ public:
|
|||
NetworkPlayer* GetPlayerByID(uint8 id);
|
||||
std::vector<std::unique_ptr<NetworkGroup>>::iterator GetGroupIteratorByID(uint8 id);
|
||||
NetworkGroup* GetGroupByID(uint8 id);
|
||||
const char* FormatChat(NetworkPlayer* fromplayer, const char* text);
|
||||
static const char* FormatChat(NetworkPlayer* fromplayer, const char* text);
|
||||
void SendPacketToClients(NetworkPacket& packet, bool front = false);
|
||||
bool CheckSRAND(uint32 tick, uint32 srand0);
|
||||
void KickPlayer(int playerId);
|
||||
|
|
Loading…
Reference in New Issue