aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2017-02-08 09:21:54 +0100
committerDavid Skoland <davidskoland@gmail.com>2017-02-08 09:21:54 +0100
commit723ef24e4680c2ab9aa35142e26607c600a716e2 (patch)
treee7813cd0e908e9f384142b324cc424c2e96c3cbe
parent85e3938fc6af5d5ca969e47fa0f1a3f0f6305084 (diff)
fixed some crashes and started on music list
-rw-r--r--courtroom.cpp24
-rw-r--r--courtroom.h1
-rw-r--r--emotes.cpp4
-rw-r--r--packet_distribution.cpp7
4 files changed, 29 insertions, 7 deletions
diff --git a/courtroom.cpp b/courtroom.cpp
index 6e8d3b3f..88571afe 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -600,12 +600,36 @@ void Courtroom::enter_courtroom(int p_cid)
ui_flip->show();
}
+ list_music();
+
ui_char_select_background->hide();
ui_ic_chat_message->setEnabled(true);
ui_ic_chat_message->setFocus();
}
+void Courtroom::list_music()
+{
+ ui_music_list->clear();
+
+ for (int n_song = 0 ; n_song < music_list.size() ; ++n_song)
+ {
+ QString i_song = music_list.at(n_song);
+
+ if (i_song.toLower().contains(ui_music_search->text().toLower()))
+ {
+ ui_music_list->addItem(i_song);
+
+ QString song_path = ao_app->get_base_path() + "sounds/music/" + i_song.toLower();
+
+ if (file_exists(song_path))
+ ui_music_list->item(n_song)->setBackground(Qt::green);
+ else
+ ui_music_list->item(n_song)->setBackground(Qt::red);
+ }
+ }
+}
+
void Courtroom::append_ms_chatmessage(QString f_message)
{
const QTextCursor old_cursor = ui_ms_chatlog->textCursor();
diff --git a/courtroom.h b/courtroom.h
index 0478ae69..b1d32d70 100644
--- a/courtroom.h
+++ b/courtroom.h
@@ -56,6 +56,7 @@ public:
QString get_current_char() {return current_char;}
void enter_courtroom(int p_cid);
+ void list_music();
void append_ms_chatmessage(QString f_message);
void append_server_chatmessage(QString f_message);
diff --git a/emotes.cpp b/emotes.cpp
index 25d97e61..c1598aaf 100644
--- a/emotes.cpp
+++ b/emotes.cpp
@@ -104,12 +104,8 @@ void Courtroom::on_emote_clicked(int p_id)
f_emote->set_off(current_char, n_real_emote);
}
- qDebug() << "on_emote_clicked with current_emote " << current_emote;
-
int emote_mod = ao_app->get_emote_mod(current_char, current_emote);
- qDebug() << "on_emote_clicked called with emote mod " << emote_mod;
-
if (emote_mod == 1 ||
emote_mod == 3 ||
emote_mod == 4)
diff --git a/packet_distribution.cpp b/packet_distribution.cpp
index 9697ada3..0b7853e0 100644
--- a/packet_distribution.cpp
+++ b/packet_distribution.cpp
@@ -297,7 +297,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (f_contents.size() < 3)
goto end;
- w_courtroom->enter_courtroom(f_contents.at(2).toInt());
+ if (courtroom_constructed)
+ w_courtroom->enter_courtroom(f_contents.at(2).toInt());
}
else if (header == "MS")
{
@@ -308,8 +309,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
{
if (f_contents.size() < 1)
goto end;
-
- w_courtroom->handle_wtce(f_contents.at(0));
+ if (courtroom_constructed)
+ w_courtroom->handle_wtce(f_contents.at(0));
}
else if (header == "checkconnection")
{