aboutsummaryrefslogtreecommitdiff
path: root/packet_distribution.cpp
diff options
context:
space:
mode:
authorCerapter <cerap@protonmail.com>2018-09-03 15:55:34 +0200
committerCerapter <cerap@protonmail.com>2018-09-03 15:55:34 +0200
commitbecf58dd4f9432364a64dc7af006b3938245127b (patch)
tree90eea8f6e0cf4da3a3cf3fb2d9285b065e31d7b4 /packet_distribution.cpp
parente45e138fb5c8856e3047b5c60c957782a90f5598 (diff)
Area list added.
- Accessible with the ingame A/M button, or by `/switch_am`. - The music list now only lists music. - The area list lists the areas. - It describes general area properties (playercount, status, CM, locked). - Automatically updates as these change. - Clicking on an area behaves the same way as clicking on an area in the music list previously did.
Diffstat (limited to 'packet_distribution.cpp')
-rw-r--r--packet_distribution.cpp75
1 files changed, 73 insertions, 2 deletions
diff --git a/packet_distribution.cpp b/packet_distribution.cpp
index d2bdcdd9..9de0dfe0 100644
--- a/packet_distribution.cpp
+++ b/packet_distribution.cpp
@@ -353,6 +353,9 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (!courtroom_constructed)
goto end;
+ bool musics_time = false;
+ int areas = 0;
+
for (int n_element = 0 ; n_element < f_contents.size() ; n_element += 2)
{
if (f_contents.at(n_element).toInt() != loaded_music)
@@ -367,7 +370,34 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
w_lobby->set_loading_text("Loading music:\n" + QString::number(loaded_music) + "/" + QString::number(music_list_size));
- w_courtroom->append_music(f_music);
+ if (musics_time)
+ {
+ w_courtroom->append_music(f_music);
+ }
+ else
+ {
+ if (f_music.endsWith(".wav") ||
+ f_music.endsWith(".mp3") ||
+ f_music.endsWith(".mp4") ||
+ f_music.endsWith(".ogg") ||
+ f_music.endsWith(".opus"))
+ {
+ musics_time = true;
+ areas--;
+ w_courtroom->fix_last_area();
+ w_courtroom->append_music(f_music);
+ }
+ else
+ {
+ w_courtroom->append_area(f_music);
+ areas++;
+ }
+ }
+
+ for (int area_n = 0; area_n < areas; area_n++)
+ {
+ w_courtroom->arup_append(0, "Unknown", "Unknown", false);
+ }
int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size;
int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
@@ -426,13 +456,43 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (!courtroom_constructed)
goto end;
+ bool musics_time = false;
+ int areas = 0;
+
for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
{
++loaded_music;
w_lobby->set_loading_text("Loading music:\n" + QString::number(loaded_music) + "/" + QString::number(music_list_size));
- w_courtroom->append_music(f_contents.at(n_element));
+ if (musics_time)
+ {
+ w_courtroom->append_music(f_contents.at(n_element));
+ }
+ else
+ {
+ if (f_contents.at(n_element).endsWith(".wav") ||
+ f_contents.at(n_element).endsWith(".mp3") ||
+ f_contents.at(n_element).endsWith(".mp4") ||
+ f_contents.at(n_element).endsWith(".ogg") ||
+ f_contents.at(n_element).endsWith(".opus"))
+ {
+ musics_time = true;
+ w_courtroom->fix_last_area();
+ w_courtroom->append_music(f_contents.at(n_element));
+ areas--;
+ }
+ else
+ {
+ w_courtroom->append_area(f_contents.at(n_element));
+ areas++;
+ }
+ }
+
+ for (int area_n = 0; area_n < areas; area_n++)
+ {
+ w_courtroom->arup_append(0, "Unknown", "Unknown", false);
+ }
int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size;
int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
@@ -525,6 +585,17 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
w_courtroom->set_evidence_list(f_evi_list);
}
}
+ else if (header == "ARUP")
+ {
+ if (courtroom_constructed)
+ {
+ int arup_type = f_contents.at(0).toInt();
+ for (int n_element = 1 ; n_element < f_contents.size() ; n_element++)
+ {
+ w_courtroom->arup_modify(arup_type, n_element - 1, f_contents.at(n_element));
+ }
+ }
+ }
else if (header == "IL")
{
if (courtroom_constructed && f_contents.size() > 0)