Fix: [Network] show query errors in the server listing instead of error popup (#9506)

When you are query several servers at once, it is rather unclear
for which server you got a popup. Instead, show any errors on the
server itself.

This is only true for the query-part. Joining a server still gives
an error popup to tell you about any issue.
This commit is contained in:
Patric Stout
2021-08-23 20:16:22 +02:00
committed by GitHub
parent e31b5d3870
commit dc5b7b996c
6 changed files with 62 additions and 32 deletions

View File

@@ -14,17 +14,26 @@
#include "core/game_info.h"
#include "network_type.h"
/** The status a server can be in. */
enum NetworkGameListStatus {
NGLS_OFFLINE, ///< Server is offline (or cannot be queried).
NGLS_ONLINE, ///< Server is online.
NGLS_FULL, ///< Server is full and cannot be queried.
NGLS_BANNED, ///< You are banned from this server.
NGLS_TOO_OLD, ///< Server is too old to query.
};
/** Structure with information shown in the game list (GUI) */
struct NetworkGameList {
NetworkGameList(const std::string &connection_string) : connection_string(connection_string) {}
NetworkGameInfo info = {}; ///< The game information of this server
std::string connection_string; ///< Address of the server
bool online = false; ///< False if the server did not respond (default status)
bool manually = false; ///< True if the server was added manually
uint8 retries = 0; ///< Number of retries (to stop requerying)
int version = 0; ///< Used to see which servers are no longer available on the Game Coordinator and can be removed.
NetworkGameList *next = nullptr; ///< Next pointer to make a linked game list
NetworkGameInfo info = {}; ///< The game information of this server.
std::string connection_string; ///< Address of the server.
NetworkGameListStatus status = NGLS_OFFLINE; ///< Stats of the server.
bool manually = false; ///< True if the server was added manually.
uint8 retries = 0; ///< Number of retries (to stop requerying).
int version = 0; ///< Used to see which servers are no longer available on the Game Coordinator and can be removed.
NetworkGameList *next = nullptr; ///< Next pointer to make a linked game list.
};
extern NetworkGameList *_network_game_list;