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

@ -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)

View File

@ -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()
{