Commit cda5c53f authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

KRandom -> QRandomGenerator

parent dc95dad6
......@@ -8,7 +8,7 @@ set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_
project(killbots VERSION ${RELEASE_SERVICE_VERSION})
set (QT_MIN_VERSION "5.7.0")
set (QT_MIN_VERSION "5.10.0")
set (KF5_MIN_VERSION "5.30.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
......
......@@ -24,7 +24,8 @@
#include "sprite.h"
#include "killbots_debug.h"
#include <KRandom>
#include <QRandomGenerator>
#include <array>
......@@ -250,7 +251,8 @@ bool Killbots::Engine::teleportHeroSafely()
refreshSpriteMap();
// Choose a random cell...
const QPoint startPoint = QPoint(KRandom::random() % m_rules->columns(), KRandom::random() % m_rules->rows());
const QPoint startPoint = QPoint(QRandomGenerator::global()->bounded(m_rules->columns()),
QRandomGenerator::global()->bounded(m_rules->rows()));
QPoint point = startPoint;
// ...and step through all the cells on the board looking for a safe cell.
......@@ -452,7 +454,8 @@ QPoint Killbots::Engine::randomEmptyCell() const
{
QPoint point;
do {
point = QPoint(KRandom::random() % m_rules->columns(), KRandom::random() % m_rules->rows());
point = QPoint(QRandomGenerator::global()->bounded(m_rules->columns()),
QRandomGenerator::global()->bounded(m_rules->rows()));
} while (spriteTypeAt(point) != NoSprite || point == m_hero->gridPos());
return point;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment