diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 67902e8feb..558c86d748 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -4219,7 +4219,6 @@ STR_5907 :{SMALLFONT}{BLACK}When enabled, zooming in will centre around the c STR_5908 :Allow arbitrary ride type changes STR_5909 :{SMALLFONT}{BLACK}Allows changing ride type freely. May cause crashes. STR_5910 :Apply -STR_5911 :{OUTLINE}{GREEN}{STRING} ############# # Scenarios # diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index c78c037382..d48ac9d3e0 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -3343,7 +3343,6 @@ enum { STR_CHEAT_ALLOW_ARBITRARY_RIDE_TYPE_CHANGES = 5908, STR_CHEAT_ALLOW_ARBITRARY_RIDE_TYPE_CHANGES_TIP = 5909, STR_APPLY = 5910, - STR_SERVER_GREETING = 5911, // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 diff --git a/src/network/network.cpp b/src/network/network.cpp index 43e3920dc8..127fc5059c 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -94,6 +94,7 @@ 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(); +void network_chat_show_server_greeting(); static void network_get_keys_directory(utf8 *buffer, size_t bufferSize); static void network_get_private_key_path(utf8 *buffer, size_t bufferSize, const utf8 * playerName); static void network_get_public_key_path(utf8 *buffer, size_t bufferSize, const utf8 * playerName, const utf8 * hash); @@ -317,6 +318,7 @@ bool Network::BeginServer(unsigned short port, const char* address) printf("Ready for clients...\n"); network_chat_show_connected_message(); + network_chat_show_server_greeting(); status = NETWORK_STATUS_CONNECTED; listening_port = port; @@ -1952,13 +1954,7 @@ void Network::Client_Handle_GAMEINFO(NetworkConnection& connection, NetworkPacke } json_decref(root); - // Display server greeting if one exists - const char* greeting = network_get_server_greeting(); - if (strcmp(greeting, "") != 0) { - char greeting_formatted[256]; - format_string(greeting_formatted, STR_SERVER_GREETING, &greeting); - chat_history_add(greeting_formatted); - } + network_chat_show_server_greeting(); } namespace Convert @@ -2151,6 +2147,23 @@ void network_chat_show_connected_message() chat_history_add(formatted); } +// Display server greeting if one exists +void network_chat_show_server_greeting() +{ + const char* greeting = gConfigNetwork.server_greeting; + if (!str_is_null_or_empty(greeting)) { + static char greeting_formatted[256]; + char* lineCh = greeting_formatted; + greeting_formatted[0] = 0; + lineCh = utf8_write_codepoint(lineCh, FORMAT_OUTLINE); + lineCh = utf8_write_codepoint(lineCh, FORMAT_GREEN); + char* ptrtext = lineCh; + safe_strcpy(lineCh, greeting, 240); + utf8_remove_format_codes((utf8*)ptrtext, true); + chat_history_add(greeting_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;