Show passworded rooms on lobby (#13301)

This commit is contained in:
Autechre 2021-11-30 22:06:13 +01:00 committed by GitHub
parent 67eb42a8c2
commit af4bdecef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 8 deletions

View File

@ -12643,6 +12643,10 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_SHUTDOWN,
"Show the 'Shutdown' option."
)
MSG_HASH(
MSG_ROOM_PASSWORDED,
"Passworded"
)
MSG_HASH(
MSG_INTERNET,
"Internet"

View File

@ -9713,10 +9713,21 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
for (i = 0; i < net_st->room_count; i++)
{
char country[8];
char passworded[64];
if (*net_st->room_list[i].country)
if (!net_st->room_list[i].lan &&
!string_is_empty(net_st->room_list[i].country))
snprintf(country, sizeof(country),
"(%s)", net_st->room_list[i].country);
else
*country = '\0';
if (net_st->room_list[i].has_password ||
net_st->room_list[i].has_spectate_password)
snprintf(passworded, sizeof(passworded),
"[%s]", msg_hash_to_str(MSG_ROOM_PASSWORDED));
else
*passworded = '\0';
/* Uncomment this to debug mismatched room parameters*/
#if 0
@ -9739,15 +9750,16 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
net_st->room_list[i].timestamp);
#endif
snprintf(s, sizeof(s), "%s: %s%s",
net_st->room_list[i].lan
? msg_hash_to_str(MSG_LOCAL)
: (net_st->room_list[i].host_method
== NETPLAY_HOST_METHOD_MITM
? msg_hash_to_str(MSG_INTERNET_RELAY)
snprintf(s, sizeof(s), "%s%s: %s%s",
passworded,
net_st->room_list[i].lan
? msg_hash_to_str(MSG_LOCAL)
: (net_st->room_list[i].host_method
== NETPLAY_HOST_METHOD_MITM
? msg_hash_to_str(MSG_INTERNET_RELAY)
: msg_hash_to_str(MSG_INTERNET)),
net_st->room_list[i].nickname,
net_st->room_list[i].lan ? "" : country
country
);
if (menu_entries_append_enum(list,

View File

@ -167,6 +167,7 @@ enum msg_file_type
enum msg_hash_enums
{
MSG_UNKNOWN = 0,
MSG_ROOM_PASSWORDED,
MSG_INTERNET,
MSG_INTERNET_RELAY,
MSG_READ_WRITE,