aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSalanto <62221668+Salanto@users.noreply.github.com>2022-02-15 15:15:57 +0100
committerGitHub <noreply@github.com>2022-02-15 08:15:57 -0600
commite6f06d8959ff65be11b20dcba27977f8935bb044 (patch)
treeb1eea1a72358189f38959e54030a93d0a7e82cc9 /src
parent5e60f277e9717ac7dcf03e1b276848655f4afa07 (diff)
Add server description to favourites, if supported by server. (#648)
* Allow servers to directly set the server description * Hijack PN packet to add description. * Update lobby.cpp Apply suggested change
Diffstat (limited to 'src')
-rw-r--r--src/lobby.cpp9
-rw-r--r--src/packet_distribution.cpp4
2 files changed, 11 insertions, 2 deletions
diff --git a/src/lobby.cpp b/src/lobby.cpp
index cf7481ac..6816f2f6 100644
--- a/src/lobby.cpp
+++ b/src/lobby.cpp
@@ -431,8 +431,7 @@ void Lobby::on_server_list_clicked(QTreeWidgetItem *p_item, int column)
f_server = ao_app->get_favorite_list().at(n_server);
}
- ui_description->clear();
- ui_description->append_linked(f_server.desc);
+ set_server_description(f_server.desc);
ui_description->moveCursor(QTextCursor::Start);
ui_description->ensureCursorVisible();
@@ -563,6 +562,12 @@ void Lobby::set_player_count(int players_online, int max_players)
ui_player_count->setText(f_string);
}
+void Lobby::set_server_description(const QString& server_description)
+{
+ ui_description->clear();
+ ui_description->append_linked(server_description);
+}
+
void Lobby::enable_connect_button() { ui_connect->setEnabled(true); }
Lobby::~Lobby() {}
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index ac319ef6..0ddadd8c 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -143,6 +143,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
w_lobby->set_player_count(f_contents.at(0).toInt(),
f_contents.at(1).toInt());
+ if (f_contents.size() >= 3) {
+ w_lobby->set_server_description(f_contents.at(2));
+ }
+
if (w_lobby->doubleclicked) {
send_server_packet(new AOPacket("askchaa#%"));
w_lobby->doubleclicked = false;