diff options
| author | Crystalwarrior <Varsash@Gmail.com> | 2020-07-31 00:25:19 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-30 16:25:19 -0500 |
| commit | 1802f6309f5804c221a41fc3a487d759369df0e3 (patch) | |
| tree | 76a14d47db57ab361df53a0df84c4d1e87f5f4a7 /src | |
| parent | 906a600a6433531010e6e6493ebaf786823edb8c (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/charselect.cpp | 18 | ||||
| -rw-r--r-- | src/courtroom.cpp | 6 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/charselect.cpp b/src/charselect.cpp index 77e2c95a..8e0aab5e 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 bb2177ee..ec869020 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() { |
