From 640b026534db21b854df83367f2815b857aaa76a Mon Sep 17 00:00:00 2001 From: Leifa <26681464+TrickyLeifa@users.noreply.github.com> Date: Sun, 14 Jul 2024 16:25:25 +0200 Subject: [PATCH] Playerlist fix (#1018) * Commit * Boyfailure code commit * Cooking code spaghetti * Accidental overwrite recursive function call hell * Implemented player list * Add partial moderator widget Sleepy time! Hee-Hoo! * Moderator Dialog - Step 1 - WIP * Appease the clang gods * Clang appeasement policy * *sacrifices goat to clang* * Added player report, reworked implementation, ... * Added player-specific report * Reworked implementation * No longer uses JSON. * Removed preset loader. * Remove unused code. * Safety measures against potential segfault. * Removes unused code --------- Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com> --- src/packet_distribution.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 677b3fd..9ec6fd0 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -7,10 +7,6 @@ #include "networkmanager.h" #include "options.h" -#include -#include -#include - void AOApplication::append_to_demofile(QString packet_string) { if (Options::getInstance().logToDemoFileEnabled() && !log_filename.isEmpty()) @@ -42,16 +38,6 @@ void AOApplication::server_packet_received(AOPacket packet) } #endif - auto convert_to_json = [](QString data) -> QJsonDocument { - QJsonParseError error; - QJsonDocument document = QJsonDocument::fromJson(data.toUtf8(), &error); - if (error.error != QJsonParseError::NoError) - { - qWarning().noquote() << "Invalid or malformed JSON data:" << error.errorString(); - } - return document; - }; - if (header == "decryptor") { if (content.size() == 0) @@ -692,7 +678,7 @@ void AOApplication::server_packet_received(AOPacket packet) } else if (header == "PR") { - if (content.size() < 2) + if (content.size() < 2 || !is_courtroom_constructed()) { return; } @@ -702,7 +688,7 @@ void AOApplication::server_packet_received(AOPacket packet) } else if (header == "PU") { - if (content.size() < 3) + if (content.size() < 3 || !is_courtroom_constructed()) { return; }