From 2e4f0117b067c6d795a7d42fe23162d41260ff74 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 9 May 2019 23:49:20 +0200 Subject: Text is now advanced based on graphemes, rather than bytes. --- src/courtroom.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index be7629b..c313a98 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2024,6 +2024,7 @@ void Courtroom::chat_tick() //do not perform heavy operations here QString f_message = m_chatmessage[MESSAGE]; + f_message.remove(0, tick_pos); // Due to our new text speed system, we always need to stop the timer now. chat_tick_timer->stop(); @@ -2038,7 +2039,7 @@ void Courtroom::chat_tick() f_message.remove(0,2); } - if (tick_pos >= f_message.size()) + if (f_message.size() == 0) { text_state = 2; if (anim_state != 4) @@ -2050,7 +2051,16 @@ void Courtroom::chat_tick() else { - QString f_character = f_message.at(tick_pos); + QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_message); + QString f_character; + + tbf.toNextBoundary(); + + if (tbf.position() == -1) + f_character = f_message; + else + f_character = f_message.left(tbf.position()); + f_character = f_character.toHtmlEscaped(); if (f_character == " ") @@ -2265,7 +2275,7 @@ void Courtroom::chat_tick() if(blank_blip) qDebug() << "blank_blip found true"; - if (f_message.at(tick_pos) != ' ' || blank_blip) + if (f_character != ' ' || blank_blip) { if (blip_pos % blip_rate == 0 && !formatting_char) @@ -2277,7 +2287,7 @@ void Courtroom::chat_tick() ++blip_pos; } - ++tick_pos; + tick_pos += f_character.length(); // Restart the timer, but according to the newly set speeds, if there were any. // Keep the speed at bay. @@ -2304,6 +2314,7 @@ void Courtroom::chat_tick() } } + void Courtroom::show_testimony() { if (!testimony_in_progress || m_chatmessage[SIDE] != "wit") -- cgit From c8a4f69d144d4be59a1fd07151579d923bcc8a6e Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 10 May 2019 20:49:59 +0200 Subject: Fix escaped HTML characters fucking up the grapheme cluster sizes. --- src/courtroom.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c313a98..ce82f88 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2053,6 +2053,7 @@ void Courtroom::chat_tick() { QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_message); QString f_character; + int f_char_length; tbf.toNextBoundary(); @@ -2061,8 +2062,10 @@ void Courtroom::chat_tick() else f_character = f_message.left(tbf.position()); + f_char_length = f_character.length(); f_character = f_character.toHtmlEscaped(); + if (f_character == " ") ui_vp_message->insertPlainText(" "); @@ -2155,7 +2158,7 @@ void Courtroom::chat_tick() else { next_character_is_not_special = true; - tick_pos--; + tick_pos -= f_char_length; } } @@ -2176,7 +2179,7 @@ void Courtroom::chat_tick() else { next_character_is_not_special = true; - tick_pos--; + tick_pos -= f_char_length; } } @@ -2287,7 +2290,7 @@ void Courtroom::chat_tick() ++blip_pos; } - tick_pos += f_character.length(); + tick_pos += f_char_length; // Restart the timer, but according to the newly set speeds, if there were any. // Keep the speed at bay. -- cgit From 1f9a1bdd5d17d56fc3bfd4f5a35e3df476e74477 Mon Sep 17 00:00:00 2001 From: cents02 Date: Fri, 31 May 2019 21:47:47 +0000 Subject: Fixed issues #47 on both client and server --- src/courtroom.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c313a98..c798885 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2707,6 +2707,7 @@ void Courtroom::on_ooc_return_pressed() } else { + other_charid = -1; append_server_chatmessage("CLIENT", "You are no longer paired with anyone.", "1"); } } @@ -2992,6 +2993,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) QListWidgetItem *f_item = ui_pair_list->item(p_index.row()); QString f_char = f_item->text(); QString real_char; + int f_cid = -1; if (f_char.endsWith(" [x]")) { @@ -2999,17 +3001,19 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_item->setText(real_char); } else - real_char = f_char; - - int f_cid = -1; - - for (int n_char = 0 ; n_char < char_list.size() ; n_char++) { + real_char = f_char; + for (int n_char = 0 ; n_char < char_list.size() ; n_char++) + { if (char_list.at(n_char).name == real_char) f_cid = n_char; + } } - if (f_cid < 0 || f_cid >= char_list.size()) + + + + if (f_cid < -2 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; return; @@ -3028,8 +3032,10 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) for (int i = 0; i < ui_pair_list->count(); i++) { ui_pair_list->item(i)->setText(sorted_pair_list.at(i)); } - + if(other_charid != -1) + { f_item->setText(real_char + " [x]"); + } } void Courtroom::on_music_list_double_clicked(QModelIndex p_model) -- cgit From 09d8e9e7a45d8c7d9557253e1fb48f3e9bd9c894 Mon Sep 17 00:00:00 2001 From: cents02 Date: Fri, 31 May 2019 21:52:22 +0000 Subject: Update courtroom.cpp --- src/courtroom.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c798885..9fd52d8 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3009,10 +3009,6 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_cid = n_char; } } - - - - if (f_cid < -2 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; @@ -3037,7 +3033,6 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_item->setText(real_char + " [x]"); } } - void Courtroom::on_music_list_double_clicked(QModelIndex p_model) { if (is_muted) -- cgit From ae8552578020dcd515e1fe80f2b95e6be461744c Mon Sep 17 00:00:00 2001 From: cents02 Date: Mon, 3 Jun 2019 09:00:24 +0000 Subject: Resolved requests/issues. --- src/courtroom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 9fd52d8..020a54c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3009,7 +3009,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_cid = n_char; } } - if (f_cid < -2 || f_cid >= char_list.size()) + if (f_cid < -1 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; return; @@ -3030,7 +3030,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) } if(other_charid != -1) { - f_item->setText(real_char + " [x]"); + f_item->setText(real_char + " [x]"); } } void Courtroom::on_music_list_double_clicked(QModelIndex p_model) -- cgit From f826ba390bcf11427aab5058728ad7dbd3f699a6 Mon Sep 17 00:00:00 2001 From: cents02 Date: Sun, 30 Jun 2019 21:47:48 +0000 Subject: New feature! /save_case . Takes two parameters, name and cr status. E.g: /save_case case1 lfp . It takes court evidence but leaves the doc and cmdoc options blank to be entered manually(if anybody actually puts anything). --- src/courtroom.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 020a54c..581ce5a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2864,6 +2864,58 @@ void Courtroom::on_ooc_return_pressed() ui_ooc_chat_message->clear(); return; } + else if(ooc_message.startsWith("/save_case")) + { + QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); + + QDir casefolder("base/cases"); + if (!casefolder.exists()) + { + QDir::current().mkdir("base/" + casefolder.dirName()); + append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it.", "1"); + ui_ooc_chat_message->clear(); + return; + } + QStringList caseslist = casefolder.entryList(); + caseslist.removeOne("."); + caseslist.removeOne(".."); + caseslist.replaceInStrings(".ini",""); + + if (command.size() < 2) + { + append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!" + caseslist.join(", "), "1"); + ui_ooc_chat_message->clear(); + return; + } + + + if (command.size() > 3) + { + append_server_chatmessage("CLIENT", "Too many arguments to save a case! You only need a filename without extension and the courtroom status!", "1"); + ui_ooc_chat_message->clear(); + return; + } + QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat); + casefile.setValue("author",ui_ooc_chat_name->text()); + casefile.setValue("cmdoc",""); + casefile.setValue("doc", ""); + casefile.setValue("status",command[2]); + casefile.sync(); + for(int i = local_evidence_list.size() - 1; i >= 0; i--) + { + casefile.beginGroup(QString::number(i)); + casefile.sync(); + casefile.setValue("name",local_evidence_list[i].name); + casefile.setValue("description",local_evidence_list[i].description); + casefile.setValue("image",local_evidence_list[i].image); + casefile.endGroup(); + } + casefile.sync(); + append_server_chatmessage("CLIENT", "Succesfully saved, edit doc and cmdoc link on the ini!", "1"); + ui_ooc_chat_message->clear(); + return; + + } QStringList packet_contents; packet_contents.append(ui_ooc_chat_name->text()); @@ -3009,7 +3061,11 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_cid = n_char; } } - if (f_cid < -1 || f_cid >= char_list.size()) + + + + + if (f_cid < -2 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; return; @@ -3030,9 +3086,10 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) } if(other_charid != -1) { - f_item->setText(real_char + " [x]"); + f_item->setText(real_char + " [x]"); } } + void Courtroom::on_music_list_double_clicked(QModelIndex p_model) { if (is_muted) -- cgit From 099fea176c018c4aa6b9e7887e4f154866dc2c7d Mon Sep 17 00:00:00 2001 From: cents02 Date: Sun, 30 Jun 2019 22:09:12 +0000 Subject: Indentation --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 581ce5a..da05fe9 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3086,7 +3086,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) } if(other_charid != -1) { - f_item->setText(real_char + " [x]"); + f_item->setText(real_char + " [x]"); } } -- cgit From ca3f113377f85296538f42c355ab2308c05ca982 Mon Sep 17 00:00:00 2001 From: cents02 Date: Mon, 1 Jul 2019 18:50:30 +0000 Subject: Fixed evidence not recognizing subfolder issue. Can support 1 folder tho. --- src/evidence.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/evidence.cpp b/src/evidence.cpp index 4e79664..14234d8 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -205,8 +205,16 @@ void Courtroom::on_evidence_image_button_clicked() QString filename = filenames.at(0); QStringList split_filename = filename.split("/"); + if(split_filename.at(split_filename.size() - 2) == "evidence") + { + filename = split_filename.at(split_filename.size() - 1); + } + else { + + filename = split_filename.at(split_filename.size() - 2) + "/" + split_filename.at(split_filename.size() - 1); + } + - filename = split_filename.at(split_filename.size() - 1); ui_evidence_image_name->setText(filename); -- cgit From d07dd1d5fe42f0120d4d5ff1050fcd082123b2e9 Mon Sep 17 00:00:00 2001 From: cents02 Date: Wed, 3 Jul 2019 08:48:04 +0000 Subject: Permanent and not temporary solution for evidence. Supports up to infite subfolders. --- src/evidence.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/evidence.cpp b/src/evidence.cpp index 14234d8..ebef749 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -188,11 +188,12 @@ void Courtroom::on_evidence_image_name_edited() void Courtroom::on_evidence_image_button_clicked() { + QDir dir(ao_app->get_base_path() + "evidence"); QFileDialog dialog(this); dialog.setFileMode(QFileDialog::ExistingFile); dialog.setNameFilter(tr("Images (*.png)")); dialog.setViewMode(QFileDialog::List); - dialog.setDirectory(ao_app->get_base_path() + "evidence"); + dialog.setDirectory(dir); QStringList filenames; @@ -203,21 +204,8 @@ void Courtroom::on_evidence_image_button_clicked() return; QString filename = filenames.at(0); - - QStringList split_filename = filename.split("/"); - if(split_filename.at(split_filename.size() - 2) == "evidence") - { - filename = split_filename.at(split_filename.size() - 1); - } - else { - - filename = split_filename.at(split_filename.size() - 2) + "/" + split_filename.at(split_filename.size() - 1); - } - - - + filename = dir.relativeFilePath(filename); ui_evidence_image_name->setText(filename); - on_evidence_image_name_edited(); } -- cgit From 432069844a2073f8d3d5fdfff5c760acacc9a734 Mon Sep 17 00:00:00 2001 From: cents02 Date: Sun, 7 Jul 2019 22:32:57 +0000 Subject: Revert "More bug fixing." This reverts commit ca84ba516fc892deaeafc18b23ad5a06822b29f5 --- src/courtroom.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 2d5cf15..344516a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2886,7 +2886,7 @@ void Courtroom::on_ooc_return_pressed() if (command.size() < 2) { - append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!" + caseslist.join(", "), "1"); + append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!", "1"); ui_ooc_chat_message->clear(); return; } @@ -2906,6 +2906,8 @@ void Courtroom::on_ooc_return_pressed() casefile.sync(); for(int i = local_evidence_list.size() - 1; i >= 0; i--) { + QString clean_evidence_dsc = local_evidence_list[i].description.replace(QRegularExpression("..."), ""); + clean_evidence_dsc = clean_evidence_dsc.replace(clean_evidence_dsc.lastIndexOf(">"), 1, ""); casefile.beginGroup(QString::number(i)); casefile.sync(); casefile.setValue("name",local_evidence_list[i].name); -- cgit From b15c6f15f0b13bce4ef7305efa08c1d257401def Mon Sep 17 00:00:00 2001 From: Windrammer Date: Thu, 11 Jul 2019 09:05:26 -0600 Subject: Fix bug #82 causing a client crash if /save_case was used without providing a courtroom state --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 344516a..3d812e0 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2884,7 +2884,7 @@ void Courtroom::on_ooc_return_pressed() caseslist.removeOne(".."); caseslist.replaceInStrings(".ini",""); - if (command.size() < 2) + if (command.size() < 3) { append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!", "1"); ui_ooc_chat_message->clear(); -- cgit From 5eccabcad15a52691228aded1d9c1fd5074fb70e Mon Sep 17 00:00:00 2001 From: David Skoland Date: Fri, 12 Jul 2019 23:00:25 +0000 Subject: Less insane debugging; minor refactoring (!75) --- src/aoapplication.cpp | 14 +++++++------- src/aoevidencebutton.cpp | 2 ++ src/charselect.cpp | 28 ++++++++++++++-------------- src/courtroom.cpp | 10 ++-------- src/discord_rich_presence.cpp | 4 ++-- src/hardware_functions.cpp | 7 +++---- src/networkmanager.cpp | 16 +++++++++------- src/packet_distribution.cpp | 10 ++++++++++ 8 files changed, 49 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index d7c3e66..4ef1edd 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -37,9 +37,9 @@ void AOApplication::construct_lobby() w_lobby = new Lobby(this); lobby_constructed = true; - QRect screenGeometry = QApplication::desktop()->screenGeometry(); - int x = (screenGeometry.width()-w_lobby->width()) / 2; - int y = (screenGeometry.height()-w_lobby->height()) / 2; + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + int x = (geometry.width()-w_lobby->width()) / 2; + int y = (geometry.height()-w_lobby->height()) / 2; w_lobby->move(x, y); if (is_discord_enabled()) @@ -72,9 +72,9 @@ void AOApplication::construct_courtroom() w_courtroom = new Courtroom(this); courtroom_constructed = true; - QRect screenGeometry = QApplication::desktop()->screenGeometry(); - int x = (screenGeometry.width()-w_courtroom->width()) / 2; - int y = (screenGeometry.height()-w_courtroom->height()) / 2; + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + int x = (geometry.width()-w_courtroom->width()) / 2; + int y = (geometry.height()-w_courtroom->height()) / 2; w_courtroom->move(x, y); } @@ -161,7 +161,7 @@ void AOApplication::ms_connect_finished(bool connected, bool will_retry) { if (lobby_constructed) w_lobby->append_error("Error connecting to master server. Will try again in " - + QString::number(net_manager->ms_reconnect_delay_ms / 1000.f) + " seconds."); + + QString::number(net_manager->ms_reconnect_delay) + " seconds."); } else { diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp index 924aeb8..15b598f 100644 --- a/src/aoevidencebutton.cpp +++ b/src/aoevidencebutton.cpp @@ -86,6 +86,7 @@ void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e) evidence_double_clicked(m_id); } +/* void AOEvidenceButton::dragLeaveEvent(QMouseEvent *e) { //QWidget::dragLeaveEvent(e); @@ -99,6 +100,7 @@ void AOEvidenceButton::dragEnterEvent(QMouseEvent *e) qDebug() << "drag enter event"; } +*/ void AOEvidenceButton::enterEvent(QEvent * e) { diff --git a/src/charselect.cpp b/src/charselect.cpp index 8e1b912..4987cf5 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -44,7 +44,6 @@ void Courtroom::construct_char_select() set_size_and_pos(ui_char_buttons, "char_buttons"); - connect (char_button_mapper, SIGNAL(mapped(int)), this, SLOT(char_clicked(int))); connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked())); connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked())); @@ -52,9 +51,9 @@ void Courtroom::construct_char_select() connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked())); - connect(ui_char_search, SIGNAL(textEdited(const QString&)), this, SLOT(on_char_search_changed(const QString&))); - connect(ui_char_passworded, SIGNAL(stateChanged(int)), this, SLOT(on_char_passworded_clicked(int))); - connect(ui_char_taken, SIGNAL(stateChanged(int)), this, SLOT(on_char_taken_clicked(int))); + connect(ui_char_search, SIGNAL(textEdited(const QString&)), this, SLOT(on_char_search_changed())); + connect(ui_char_passworded, SIGNAL(stateChanged(int)), this, SLOT(on_char_passworded_clicked())); + connect(ui_char_taken, SIGNAL(stateChanged(int)), this, SLOT(on_char_taken_clicked())); } void Courtroom::set_char_select() @@ -197,14 +196,15 @@ void Courtroom::character_loading_finished() // Later on, we'll be revealing buttons as we need them. for (int n = 0; n < char_list.size(); n++) { - AOCharButton* character = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); - character->reset(); - character->hide(); - character->set_image(char_list.at(n).name); - ui_char_button_list.append(character); + AOCharButton* char_button = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); + char_button->reset(); + char_button->hide(); + char_button->set_image(char_list.at(n).name); + ui_char_button_list.append(char_button); - connect(character, SIGNAL(clicked()), char_button_mapper, SLOT(map())); - char_button_mapper->setMapping(character, ui_char_button_list.size() - 1); + connect(char_button, &AOCharButton::clicked, [this, n](){ + this->char_clicked(n); + }); // This part here serves as a way of showing to the player that the game is still running, it is // just loading the pictures of the characters. @@ -252,17 +252,17 @@ void Courtroom::filter_character_list() set_char_select_page(); } -void Courtroom::on_char_search_changed(const QString& newtext) +void Courtroom::on_char_search_changed() { filter_character_list(); } -void Courtroom::on_char_passworded_clicked(int newstate) +void Courtroom::on_char_passworded_clicked() { filter_character_list(); } -void Courtroom::on_char_taken_clicked(int newstate) +void Courtroom::on_char_taken_clicked() { filter_character_list(); } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3d812e0..a8e9739 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -6,7 +6,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() // Change the default audio output device to be the one the user has given // in his config.ini file for now. - int a = 0; + unsigned int a = 0; BASS_DEVICEINFO info; if (ao_app->get_audio_output_device() == "default") @@ -21,7 +21,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() if (ao_app->get_audio_output_device() == info.name) { BASS_SetDevice(a); - BASS_Init(a, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); + BASS_Init(static_cast(a), 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); load_bass_opus_plugin(); qDebug() << info.name << "was set as the default audio output device."; break; @@ -49,8 +49,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() testimony_hide_timer = new QTimer(this); testimony_hide_timer->setSingleShot(true); - char_button_mapper = new QSignalMapper(this); - music_player = new AOMusicPlayer(this, ao_app); music_player->set_volume(0); sfx_player = new AOSfxPlayer(this, ao_app); @@ -2223,11 +2221,7 @@ void Courtroom::chat_tick() case INLINE_GREY: ui_vp_message->insertHtml("" + f_character + ""); break; - default: - ui_vp_message->insertHtml(f_character); - break; } - } else { diff --git a/src/discord_rich_presence.cpp b/src/discord_rich_presence.cpp index 10f5833..ac14bb2 100644 --- a/src/discord_rich_presence.cpp +++ b/src/discord_rich_presence.cpp @@ -11,10 +11,10 @@ Discord::Discord() qInfo() << "Discord RPC ready"; }; handlers.disconnected = [](int errorCode, const char* message) { - qInfo() << "Discord RPC disconnected! " << message; + qInfo() << "Discord RPC disconnected! " << message << errorCode; }; handlers.errored = [](int errorCode, const char* message) { - qWarning() << "Discord RPC errored out! " << message; + qWarning() << "Discord RPC errored out! " << message << errorCode; }; qInfo() << "Initializing Discord RPC"; Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr); diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp index ebba6ab..5d6b6ff 100644 --- a/src/hardware_functions.cpp +++ b/src/hardware_functions.cpp @@ -5,12 +5,12 @@ #if (defined (_WIN32) || defined (_WIN64)) #include -DWORD dwVolSerial; -BOOL bIsRetrieved; +static DWORD dwVolSerial; +static BOOL bIsRetrieved; QString get_hdid() { - bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), NULL, NULL, &dwVolSerial, NULL, NULL, NULL, NULL); + bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), nullptr, 0, &dwVolSerial, nullptr, nullptr, nullptr, 0); if (bIsRetrieved) return QString::number(dwVolSerial, 16); @@ -18,7 +18,6 @@ QString get_hdid() //a totally random string //what could possibly go wrong return "gxsps32sa9fnwic92mfbs0"; - } #elif (defined (LINUX) || defined (__linux__)) diff --git a/src/networkmanager.cpp b/src/networkmanager.cpp index 288a900..5b16db4 100644 --- a/src/networkmanager.cpp +++ b/src/networkmanager.cpp @@ -78,9 +78,9 @@ void NetworkManager::ship_server_packet(QString p_packet) void NetworkManager::handle_ms_packet() { - char buffer[buffer_max_size]; - std::memset(buffer, 0, buffer_max_size); - ms_socket->read(buffer, buffer_max_size); + char buffer[BUFFER_MAX_SIZE]; + std::memset(buffer, 0, BUFFER_MAX_SIZE); + ms_socket->read(buffer, BUFFER_MAX_SIZE); QString in_data = buffer; @@ -137,7 +137,9 @@ void NetworkManager::on_srv_lookup() for (const QDnsServiceRecord &record : srv_records) { +#ifdef DEBUG_NETWORK qDebug() << "Connecting to " << record.target() << ":" << record.port(); +#endif ms_socket->connectToHost(record.target(), record.port()); QTime timer; timer.start(); @@ -206,7 +208,7 @@ void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error) emit ms_connect_finished(false, true); - ms_reconnect_timer->start(ms_reconnect_delay_ms); + ms_reconnect_timer->start(ms_reconnect_delay * 1000); } void NetworkManager::retry_ms_connect() @@ -217,9 +219,9 @@ void NetworkManager::retry_ms_connect() void NetworkManager::handle_server_packet() { - char buffer[buffer_max_size]; - std::memset(buffer, 0, buffer_max_size); - server_socket->read(buffer, buffer_max_size); + char buffer[BUFFER_MAX_SIZE]; + std::memset(buffer, 0, BUFFER_MAX_SIZE); + server_socket->read(buffer, BUFFER_MAX_SIZE); QString in_data = buffer; diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 68d2fb9..942c275 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -14,8 +14,10 @@ void AOApplication::ms_packet_received(AOPacket *p_packet) QString header = p_packet->get_header(); QStringList f_contents = p_packet->get_contents(); +#ifdef DEBUG_NETWORK if (header != "CHECK") qDebug() << "R(ms):" << p_packet->to_string(); +#endif if (header == "ALL") { @@ -127,8 +129,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet) QStringList f_contents = p_packet->get_contents(); QString f_packet = p_packet->to_string(); +#ifdef DEBUG_NETWORK if (header != "checkconnection") qDebug() << "R:" << f_packet; +#endif if (header == "decryptor") { @@ -677,7 +681,9 @@ void AOApplication::send_ms_packet(AOPacket *p_packet) net_manager->ship_ms_packet(f_packet); +#ifdef DEBUG_NETWORK qDebug() << "S(ms):" << f_packet; +#endif delete p_packet; } @@ -691,14 +697,18 @@ void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded) if (encryption_needed) { +#ifdef DEBUG_NETWORK qDebug() << "S(e):" << f_packet; +#endif p_packet->encrypt_header(s_decryptor); f_packet = p_packet->to_string(); } else { +#ifdef DEBUG_NETWORK qDebug() << "S:" << f_packet; +#endif } net_manager->ship_server_packet(f_packet); -- cgit