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.
This commit is contained in:
Crystalwarrior 2020-07-31 00:25:19 +03:00 committed by GitHub
parent 906a600a64
commit 1802f6309f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 8 deletions

View File

@ -122,6 +122,8 @@ void Courtroom::set_char_select_page()
} }
void Courtroom::char_clicked(int n_char) void Courtroom::char_clicked(int n_char)
{
if (n_char != -1)
{ {
QString char_ini_path = QString char_ini_path =
ao_app->get_character_path(char_list.at(n_char).name, "char.ini"); ao_app->get_character_path(char_list.at(n_char).name, "char.ini");
@ -132,6 +134,7 @@ void Courtroom::char_clicked(int n_char)
call_notice("Could not find " + char_ini_path); call_notice("Could not find " + char_ini_path);
return; return;
} }
}
if (n_char != m_cid) { if (n_char != m_cid) {
ao_app->send_server_packet( ao_app->send_server_packet(
@ -144,6 +147,9 @@ void Courtroom::char_clicked(int n_char)
update_character(n_char); update_character(n_char);
enter_courtroom(); 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) void Courtroom::put_button_in_place(int starting, int chars_on_this_page)

View File

@ -4515,7 +4515,6 @@ void Courtroom::on_change_character_clicked()
set_char_select(); set_char_select();
ui_char_select_background->show(); ui_char_select_background->show();
ui_spectator->hide();
} }
void Courtroom::on_reload_theme_clicked() void Courtroom::on_reload_theme_clicked()
@ -4551,7 +4550,10 @@ void Courtroom::on_char_select_right_clicked()
set_char_select_page(); 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() void Courtroom::on_call_mod_clicked()
{ {