fixed a crash relating to character selection

This commit is contained in:
David Skoland 2017-02-14 09:58:05 +01:00
parent f8dfc603b9
commit e8f413c236
3 changed files with 30 additions and 7 deletions

View File

@ -354,8 +354,10 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_vp_showname, "showname");
QFont pt_8 = ui_vp_showname->font();
QFont pt_9 = ui_vp_showname->font();
QFont pt_10 = ui_vp_showname->font();
pt_8.setPointSize(8);
pt_9.setPointSize(9);
pt_10.setPointSize(10);
ui_vp_showname->setFont(pt_8);
ui_vp_showname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
@ -363,7 +365,11 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_vp_message, "message");
ui_vp_message->setReadOnly(true);
#if (defined (_WIN32) || defined (_WIN64))
ui_vp_message->setFont(pt_10);
#else
ui_vp_message->setFont(pt_9);
#endif
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"color: white");
@ -384,7 +390,11 @@ void Courtroom::set_widgets()
ui_vp_objection->combo_resize(ui_viewport->width(), ui_viewport->height());
set_size_and_pos(ui_ic_chatlog, "ic_chatlog");
#if (defined (_WIN32) || defined (_WIN64))
ui_ic_chatlog->setFont(pt_10);
#else
ui_ic_chatlog->setFont(pt_9);
#endif
ui_ic_chatlog->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"color: white;");
@ -554,7 +564,7 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier)
void Courtroom::set_taken(int n_char, bool p_taken)
{
if (n_char >= char_list.size())
if (n_char > char_list.size())
{
qDebug() << "W: set_taken attempted to set an index bigger than char_list size";
return;
@ -568,6 +578,17 @@ void Courtroom::set_taken(int n_char, bool p_taken)
char_list.replace(n_char, f_char);
}
void Courtroom::done_received()
{
m_cid = -1;
set_char_select_page();
set_mute_list();
show();
}
void Courtroom::set_char_select_page()
{
ui_char_select_background->show();

View File

@ -46,6 +46,8 @@ public:
void set_char_select_page();
void set_background(QString p_background);
void done_received();
void set_mute_list();
//sets desk and bg based on pos in chatmessage

View File

@ -344,6 +344,9 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
}
else if (header == "CharsCheck")
{
if (!courtroom_constructed)
goto end;
for (int n_char = 0 ; n_char < f_contents.size() ; ++n_char)
{
if (f_contents.at(n_char) == "-1")
@ -425,13 +428,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (!courtroom_constructed)
goto end;
w_courtroom->set_char_select_page();
if (lobby_constructed)
w_courtroom->append_ms_chatmessage(w_lobby->get_chatlog());
w_courtroom->append_ms_chatmessage(w_lobby->get_chatlog());
w_courtroom->set_mute_list();
w_courtroom->show();
w_courtroom->done_received();
destruct_lobby();
}