Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
Kubrick
Commits
361f7ac9
Commit
361f7ac9
authored
Jul 24, 2022
by
Nicolas Fella
Browse files
Port away from KRandomSequence
parent
b7f74067
Pipeline
#208573
passed with stage
in 2 minutes and 51 seconds
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/game.cpp
View file @
361f7ac9
...
...
@@ -43,6 +43,7 @@ Game::Game (Kubrick * parent)
smMoveSlice
(
0
),
smMoveDirection
(
CLOCKWISE
),
random
(
QDateTime
::
currentMSecsSinceEpoch
()),
cubeAligned
(
true
),
moveIndex
(
-
1
)
{
...
...
@@ -53,8 +54,6 @@ Game::Game (Kubrick * parent)
smInitInput
();
// Initialise the move-text parsing.
random
.
setSeed
(
0
);
// Zero gets us an arbitrary seed.
setDefaults
();
// Set all options to default values.
restoreState
();
// Restore the last cube and its state.
demoPhase
=
false
;
// No demo yet.
...
...
@@ -1201,7 +1200,7 @@ void Game::startDemo ()
void
Game
::
randomDemo
()
{
double
pickShape
=
random
.
ge
t
Double
();
double
pickShape
=
random
.
ge
nerate
Double
();
// Pick cubes 40% of the time.
cubeSize
[
X
]
=
pickANumber
(
2
,
6
);
...
...
@@ -1631,7 +1630,7 @@ void Game::handleMouseEvent (MouseEvent event, int button, int mX, int mY)
int
Game
::
pickANumber
(
int
lo
,
int
hi
)
{
// Pick an integer in the range (lo..hi).
return
(
lo
+
(
int
)
random
.
getLong
(
hi
-
lo
+
1
)
)
;
return
random
.
bounded
(
lo
,
hi
+
1
);
}
...
...
src/game.h
View file @
361f7ac9
...
...
@@ -25,13 +25,13 @@
// KDE includes
#include
<KStandardGameAction>
// Used only to get internal names of actions.
#include
<KRandomSequence>
// Qt includes
#include
<QObject>
#include
<QString>
#include
<QList>
#include
<QElapsedTimer>
#include
<QRandomGenerator>
// Local includes.
#include
"kubrick.h"
...
...
@@ -192,7 +192,7 @@ private:
Kubrick
*
mainWindow
;
// Main window: used for status, etc.
GameGLView
*
gameGLView
;
// OpenGL view: used to draw 3D cubes.
K
Random
Sequence
random
;
// Random number generator object.
Q
Random
Generator
random
;
// Random number generator object.
Cube
*
cube
;
// The cube that is in play.
float
cubieSize
;
// Size of each cubie in OpenGL co-ordinates.
QList
<
CubeView
*>
cubeViews
;
// Parameters for views of 1-3 cubes.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment