Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YGOPRO-520DIY
ygopro
Commits
14bd1f7f
Commit
14bd1f7f
authored
Sep 05, 2021
by
salix5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove rand(), random_shuffle()
parent
b62918d8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
4 deletions
+10
-4
gframe/client_field.cpp
gframe/client_field.cpp
+2
-1
gframe/client_field.h
gframe/client_field.h
+2
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+2
-2
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+2
-1
gframe/sound_manager.h
gframe/sound_manager.h
+2
-0
No files found.
gframe/client_field.cpp
View file @
14bd1f7f
...
@@ -35,6 +35,7 @@ ClientField::ClientField() {
...
@@ -35,6 +35,7 @@ ClientField::ClientField() {
mzone
[
p
].
resize
(
7
,
0
);
mzone
[
p
].
resize
(
7
,
0
);
szone
[
p
].
resize
(
8
,
0
);
szone
[
p
].
resize
(
8
,
0
);
}
}
rnd
.
reset
(
std
::
random_device
()());
}
}
void
ClientField
::
Clear
()
{
void
ClientField
::
Clear
()
{
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
...
@@ -409,7 +410,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
...
@@ -409,7 +410,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
}
}
}
}
if
(
has_card_in_grave
)
{
if
(
has_card_in_grave
)
{
std
::
random_shuffle
(
selectable_cards
.
begin
(),
selectable_cards
.
end
()
);
rnd
.
shuffle_vector
(
selectable_cards
);
}
}
}
}
int
startpos
;
int
startpos
;
...
...
gframe/client_field.h
View file @
14bd1f7f
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define CLIENT_FIELD_H
#define CLIENT_FIELD_H
#include "config.h"
#include "config.h"
#include "../ocgcore/mtrandom.h"
#include <vector>
#include <vector>
#include <set>
#include <set>
#include <map>
#include <map>
...
@@ -83,6 +84,7 @@ public:
...
@@ -83,6 +84,7 @@ public:
bool
deck_reversed
;
bool
deck_reversed
;
bool
conti_selecting
;
bool
conti_selecting
;
bool
cant_check_grave
;
bool
cant_check_grave
;
mt19937
rnd
;
ClientField
();
ClientField
();
void
Clear
();
void
Clear
();
...
...
gframe/duelclient.cpp
View file @
14bd1f7f
...
@@ -2172,7 +2172,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2172,7 +2172,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
soundManager
.
PlaySoundEffect
(
SOUND_SHUFFLE
);
soundManager
.
PlaySoundEffect
(
SOUND_SHUFFLE
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
auto
cit
=
mainGame
->
dField
.
deck
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
deck
[
player
].
end
();
++
cit
)
{
for
(
auto
cit
=
mainGame
->
dField
.
deck
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
deck
[
player
].
end
();
++
cit
)
{
(
*
cit
)
->
dPos
=
irr
::
core
::
vector3df
(
r
and
()
*
0.4
f
/
RAND_MAX
-
0.2
f
,
0
,
0
);
(
*
cit
)
->
dPos
=
irr
::
core
::
vector3df
(
r
nd
.
rand
()
*
0.4
f
/
rnd
.
rand_max
-
0.2
f
,
0
,
0
);
(
*
cit
)
->
dRot
=
irr
::
core
::
vector3df
(
0
,
0
,
0
);
(
*
cit
)
->
dRot
=
irr
::
core
::
vector3df
(
0
,
0
,
0
);
(
*
cit
)
->
is_moving
=
true
;
(
*
cit
)
->
is_moving
=
true
;
(
*
cit
)
->
aniFrame
=
3
;
(
*
cit
)
->
aniFrame
=
3
;
...
@@ -2244,7 +2244,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2244,7 +2244,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
auto
cit
=
mainGame
->
dField
.
extra
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
extra
[
player
].
end
();
++
cit
)
{
for
(
auto
cit
=
mainGame
->
dField
.
extra
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
extra
[
player
].
end
();
++
cit
)
{
if
(
!
((
*
cit
)
->
position
&
POS_FACEUP
))
{
if
(
!
((
*
cit
)
->
position
&
POS_FACEUP
))
{
(
*
cit
)
->
dPos
=
irr
::
core
::
vector3df
(
r
and
()
*
0.4
f
/
RAND_MAX
-
0.2
f
,
0
,
0
);
(
*
cit
)
->
dPos
=
irr
::
core
::
vector3df
(
r
nd
.
rand
()
*
0.4
f
/
rnd
.
rand_max
-
0.2
f
,
0
,
0
);
(
*
cit
)
->
dRot
=
irr
::
core
::
vector3df
(
0
,
0
,
0
);
(
*
cit
)
->
dRot
=
irr
::
core
::
vector3df
(
0
,
0
,
0
);
(
*
cit
)
->
is_moving
=
true
;
(
*
cit
)
->
is_moving
=
true
;
(
*
cit
)
->
aniFrame
=
3
;
(
*
cit
)
->
aniFrame
=
3
;
...
...
gframe/sound_manager.cpp
View file @
14bd1f7f
...
@@ -11,6 +11,7 @@ bool SoundManager::Init() {
...
@@ -11,6 +11,7 @@ bool SoundManager::Init() {
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
bgm_scene
=
-
1
;
bgm_scene
=
-
1
;
RefreshBGMList
();
RefreshBGMList
();
rnd
.
reset
((
unsigned
int
)
time
(
nullptr
));
engineSound
=
irrklang
::
createIrrKlangDevice
();
engineSound
=
irrklang
::
createIrrKlangDevice
();
engineMusic
=
irrklang
::
createIrrKlangDevice
();
engineMusic
=
irrklang
::
createIrrKlangDevice
();
if
(
!
engineSound
||
!
engineMusic
)
{
if
(
!
engineSound
||
!
engineMusic
)
{
...
@@ -222,7 +223,7 @@ void SoundManager::PlayBGM(int scene) {
...
@@ -222,7 +223,7 @@ void SoundManager::PlayBGM(int scene) {
if
(
count
<=
0
)
if
(
count
<=
0
)
return
;
return
;
bgm_scene
=
scene
;
bgm_scene
=
scene
;
int
bgm
=
r
and
()
%
count
;
int
bgm
=
r
nd
.
get_random_integer
(
0
,
count
-
1
)
;
auto
name
=
BGMList
[
scene
][
bgm
].
c_str
();
auto
name
=
BGMList
[
scene
][
bgm
].
c_str
();
wchar_t
fname
[
1024
];
wchar_t
fname
[
1024
];
myswprintf
(
fname
,
L"./sound/BGM/%ls"
,
name
);
myswprintf
(
fname
,
L"./sound/BGM/%ls"
,
name
);
...
...
gframe/sound_manager.h
View file @
14bd1f7f
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define SOUNDMANAGER_H
#define SOUNDMANAGER_H
#include "game.h"
#include "game.h"
#include "../ocgcore/mtrandom.h"
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
#include <irrKlang.h>
#include <irrKlang.h>
#endif
#endif
...
@@ -12,6 +13,7 @@ class SoundManager {
...
@@ -12,6 +13,7 @@ class SoundManager {
private:
private:
std
::
vector
<
std
::
wstring
>
BGMList
[
8
];
std
::
vector
<
std
::
wstring
>
BGMList
[
8
];
int
bgm_scene
;
int
bgm_scene
;
mt19937
rnd
;
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
irrklang
::
ISoundEngine
*
engineSound
;
irrklang
::
ISoundEngine
*
engineSound
;
irrklang
::
ISoundEngine
*
engineMusic
;
irrklang
::
ISoundEngine
*
engineMusic
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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