aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRosemary Witchaven <32779090+in1tiate@users.noreply.github.com>2022-07-29 11:23:36 -0500
committerGitHub <noreply@github.com>2022-07-29 18:23:36 +0200
commite36d79f7499ca4484585fad7738df4764f3fd0aa (patch)
tree3256a4c8b941817387ef65136232cfbb347849e9
parent834c5ff929d9044fc1237655c5d5ad4ae8a653cf (diff)
Fix or suppress compiler warnings (Qt 5.15 w/MinGW) (#818)
* Major cleanup of screenshake code * Add pre-5.10 support for screenshake math * more compat, uglier too * add surprise tool * we don't need inline functions * only run qsrand on old versions * Squash compiler warnings * >= not > please * only run qsrand on old versions * Squash compiler warnings * >= not > please Co-authored-by: stonedDiscord <Tukz@gmx.de> Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com>
-rw-r--r--include/courtroom.h2
-rw-r--r--src/courtroom.cpp12
-rw-r--r--src/demoserver.cpp4
-rw-r--r--src/discord_rich_presence.cpp3
-rw-r--r--src/networkmanager.cpp5
5 files changed, 23 insertions, 3 deletions
diff --git a/include/courtroom.h b/include/courtroom.h
index 88e60376..479b1051 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -52,7 +52,7 @@
#include <QMessageBox>
#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
-#if QT_VERSION > QT_VERSION_CHECK(5, 10, 0)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
#include <QRandomGenerator> //added in Qt 5.10
#endif
#include <QRegExp>
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 7a65391a..f14cc20e 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -8,8 +8,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
~Qt::WindowMaximizeButtonHint);
ao_app->initBASS();
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) // Needed for pre-5.10 RNG stuff
qsrand(static_cast<uint>(QDateTime::currentMSecsSinceEpoch() / 1000));
+#endif
keepalive_timer = new QTimer(this);
keepalive_timer->start(45000);
@@ -4142,6 +4143,11 @@ void Courtroom::mod_called(QString p_ip)
void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur,
bool steno)
{
+ Q_UNUSED(def);
+ Q_UNUSED(pro);
+ Q_UNUSED(jud);
+ Q_UNUSED(jur);
+ Q_UNUSED(steno);
if (ui_casing->isChecked()) {
ui_server_chatlog->append(msg);
modcall_player->play(ao_app->get_court_sfx("case_call"));
@@ -4946,7 +4952,11 @@ void Courtroom::music_random()
}
if (clist.length() == 0)
return;
+#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
on_music_list_double_clicked(clist.at(qrand() % clist.length()), 1);
+#else
+ on_music_list_double_clicked(clist.at(QRandomGenerator::global()->bounded(0, clist.length())), 1);
+#endif
}
void Courtroom::music_list_expand_all() { ui_music_list->expandAll(); }
diff --git a/src/demoserver.cpp b/src/demoserver.cpp
index c4f8c158..0aefc0cc 100644
--- a/src/demoserver.cpp
+++ b/src/demoserver.cpp
@@ -95,7 +95,11 @@ void DemoServer::recv_data()
}
QStringList packet_list =
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
+#else
+ in_data.split("%", Qt::SkipEmptyParts);
+#endif
for (const QString &packet : packet_list) {
AOPacket ao_packet(packet);
diff --git a/src/discord_rich_presence.cpp b/src/discord_rich_presence.cpp
index cd3a475a..81e5a86c 100644
--- a/src/discord_rich_presence.cpp
+++ b/src/discord_rich_presence.cpp
@@ -106,11 +106,14 @@ void Discord::state_lobby() {}
void Discord::state_server(std::string name, std::string server_id)
{
+ Q_UNUSED(name);
+ Q_UNUSED(server_id);
qDebug() << "Discord RPC: Setting server state";
}
void Discord::state_character(std::string name)
{
+ Q_UNUSED(name);
qDebug() << "Discord RPC: Setting character state";
}
diff --git a/src/networkmanager.cpp b/src/networkmanager.cpp
index 7e039d21..27b3e01a 100644
--- a/src/networkmanager.cpp
+++ b/src/networkmanager.cpp
@@ -240,8 +240,11 @@ void NetworkManager::handle_server_packet(const QString& p_data)
partial_packet = false;
}
}
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
const QStringList packet_list = in_data.split("%", QString::SkipEmptyParts);
+#else
+ const QStringList packet_list = in_data.split("%", Qt::SkipEmptyParts);
+#endif
for (const QString &packet : packet_list) {
AOPacket *f_packet = new AOPacket(packet);