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:
		
							parent
							
								
									834c5ff929
								
							
						
					
					
						commit
						e36d79f749
					
				@ -52,7 +52,7 @@
 | 
				
			|||||||
#include <QMessageBox>
 | 
					#include <QMessageBox>
 | 
				
			||||||
#include <QParallelAnimationGroup>
 | 
					#include <QParallelAnimationGroup>
 | 
				
			||||||
#include <QPropertyAnimation>
 | 
					#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
 | 
					#include <QRandomGenerator> //added in Qt 5.10
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#include <QRegExp>
 | 
					#include <QRegExp>
 | 
				
			||||||
 | 
				
			|||||||
@ -8,8 +8,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
				
			|||||||
                       ~Qt::WindowMaximizeButtonHint);
 | 
					                       ~Qt::WindowMaximizeButtonHint);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ao_app->initBASS();
 | 
					  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));
 | 
					  qsrand(static_cast<uint>(QDateTime::currentMSecsSinceEpoch() / 1000));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  keepalive_timer = new QTimer(this);
 | 
					  keepalive_timer = new QTimer(this);
 | 
				
			||||||
  keepalive_timer->start(45000);
 | 
					  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,
 | 
					void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur,
 | 
				
			||||||
                            bool steno)
 | 
					                            bool steno)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  Q_UNUSED(def);
 | 
				
			||||||
 | 
					  Q_UNUSED(pro);
 | 
				
			||||||
 | 
					  Q_UNUSED(jud);
 | 
				
			||||||
 | 
					  Q_UNUSED(jur);
 | 
				
			||||||
 | 
					  Q_UNUSED(steno);
 | 
				
			||||||
  if (ui_casing->isChecked()) {
 | 
					  if (ui_casing->isChecked()) {
 | 
				
			||||||
    ui_server_chatlog->append(msg);
 | 
					    ui_server_chatlog->append(msg);
 | 
				
			||||||
    modcall_player->play(ao_app->get_court_sfx("case_call"));
 | 
					    modcall_player->play(ao_app->get_court_sfx("case_call"));
 | 
				
			||||||
@ -4946,7 +4952,11 @@ void Courtroom::music_random()
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  if (clist.length() == 0)
 | 
					  if (clist.length() == 0)
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
 | 
					#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
 | 
				
			||||||
  on_music_list_double_clicked(clist.at(qrand() % clist.length()), 1);
 | 
					  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(); }
 | 
					void Courtroom::music_list_expand_all() { ui_music_list->expandAll(); }
 | 
				
			||||||
 | 
				
			|||||||
@ -95,7 +95,11 @@ void DemoServer::recv_data()
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QStringList packet_list =
 | 
					    QStringList packet_list =
 | 
				
			||||||
 | 
					#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
 | 
				
			||||||
        in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
 | 
					        in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					        in_data.split("%", Qt::SkipEmptyParts);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (const QString &packet : packet_list) {
 | 
					    for (const QString &packet : packet_list) {
 | 
				
			||||||
        AOPacket ao_packet(packet);
 | 
					        AOPacket ao_packet(packet);
 | 
				
			||||||
 | 
				
			|||||||
@ -106,11 +106,14 @@ void Discord::state_lobby() {}
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void Discord::state_server(std::string name, std::string server_id)
 | 
					void Discord::state_server(std::string name, std::string server_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  Q_UNUSED(name);
 | 
				
			||||||
 | 
					  Q_UNUSED(server_id);
 | 
				
			||||||
  qDebug() << "Discord RPC: Setting server state";
 | 
					  qDebug() << "Discord RPC: Setting server state";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Discord::state_character(std::string name)
 | 
					void Discord::state_character(std::string name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  Q_UNUSED(name);
 | 
				
			||||||
  qDebug() << "Discord RPC: Setting character state";
 | 
					  qDebug() << "Discord RPC: Setting character state";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -240,8 +240,11 @@ void NetworkManager::handle_server_packet(const QString& p_data)
 | 
				
			|||||||
      partial_packet = false;
 | 
					      partial_packet = false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
 | 
				
			||||||
  const QStringList packet_list = in_data.split("%", QString::SkipEmptyParts);
 | 
					  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) {
 | 
					  for (const QString &packet : packet_list) {
 | 
				
			||||||
    AOPacket *f_packet = new AOPacket(packet);
 | 
					    AOPacket *f_packet = new AOPacket(packet);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user