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>
This commit is contained in:
Rosemary Witchaven 2022-07-29 11:23:36 -05:00 committed by GitHub
parent 834c5ff929
commit e36d79f749
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 3 deletions

View File

@ -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>

View File

@ -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(); }

View File

@ -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);

View File

@ -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";
}

View File

@ -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);