From 1802f6309f5804c221a41fc3a487d759369df0e3 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 31 Jul 2020 00:25:19 +0300 Subject: [PATCH] Make spectator function as a character with ID -1 (#211) - Don't hide spectator button anymore. - Make the spectator button properly send the char switch packet. - Fix the spectator button not properly loading the courtroom and music list etc. --- src/charselect.cpp | 18 ++++++++++++------ src/courtroom.cpp | 6 ++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/charselect.cpp b/src/charselect.cpp index 77e2c95..8e0aab5 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -123,14 +123,17 @@ void Courtroom::set_char_select_page() void Courtroom::char_clicked(int n_char) { - QString char_ini_path = - ao_app->get_character_path(char_list.at(n_char).name, "char.ini"); + if (n_char != -1) + { + QString char_ini_path = + ao_app->get_character_path(char_list.at(n_char).name, "char.ini"); - qDebug() << "char_ini_path" << char_ini_path; + qDebug() << "char_ini_path" << char_ini_path; - if (!file_exists(char_ini_path)) { - call_notice("Could not find " + char_ini_path); - return; + if (!file_exists(char_ini_path)) { + call_notice("Could not find " + char_ini_path); + return; + } } if (n_char != m_cid) { @@ -144,6 +147,9 @@ void Courtroom::char_clicked(int n_char) update_character(n_char); enter_courtroom(); + + if (n_char != -1) + ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); } void Courtroom::put_button_in_place(int starting, int chars_on_this_page) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index bb2177e..ec86902 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -4515,7 +4515,6 @@ void Courtroom::on_change_character_clicked() set_char_select(); ui_char_select_background->show(); - ui_spectator->hide(); } void Courtroom::on_reload_theme_clicked() @@ -4551,7 +4550,10 @@ void Courtroom::on_char_select_right_clicked() set_char_select_page(); } -void Courtroom::on_spectator_clicked() { update_character(-1); } +void Courtroom::on_spectator_clicked() +{ + char_clicked(-1); +} void Courtroom::on_call_mod_clicked() {