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
920c69a1
Commit
920c69a1
authored
Jul 24, 2024
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix rand
parent
058daeed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
gframe/game.cpp
gframe/game.cpp
+4
-2
gframe/image_manager.cpp
gframe/image_manager.cpp
+4
-2
No files found.
gframe/game.cpp
View file @
920c69a1
...
@@ -90,8 +90,10 @@ bool Game::Initialize() {
...
@@ -90,8 +90,10 @@ bool Game::Initialize() {
size_t
count
=
skins
.
size
();
size_t
count
=
skins
.
size
();
if
(
count
>
0
)
{
if
(
count
>
0
)
{
int
index
=
-
1
;
int
index
=
-
1
;
if
(
gameConf
.
skin_index
<
0
)
if
(
gameConf
.
skin_index
<
0
)
{
index
=
rand
()
%
count
;
std
::
random_device
rd
;
index
=
rd
()
%
count
;
}
else
if
((
size_t
)
gameConf
.
skin_index
<=
skins
.
size
())
else
if
((
size_t
)
gameConf
.
skin_index
<=
skins
.
size
())
index
=
skins
.
size
()
-
gameConf
.
skin_index
;
// reverse index
index
=
skins
.
size
()
-
gameConf
.
skin_index
;
// reverse index
if
(
index
>=
0
)
if
(
index
>=
0
)
...
...
gframe/image_manager.cpp
View file @
920c69a1
...
@@ -71,8 +71,9 @@ irr::video::ITexture* ImageManager::GetRandomImage(int image_type) {
...
@@ -71,8 +71,9 @@ irr::video::ITexture* ImageManager::GetRandomImage(int image_type) {
return
NULL
;
return
NULL
;
char
ImageName
[
1024
];
char
ImageName
[
1024
];
wchar_t
fname
[
1024
];
wchar_t
fname
[
1024
];
std
::
random_device
rd
;
if
(
saved_image_id
[
image_type
]
==
-
1
)
if
(
saved_image_id
[
image_type
]
==
-
1
)
saved_image_id
[
image_type
]
=
r
an
d
()
%
count
;
saved_image_id
[
image_type
]
=
rd
()
%
count
;
int
image_id
=
saved_image_id
[
image_type
];
int
image_id
=
saved_image_id
[
image_type
];
auto
name
=
ImageList
[
image_type
][
image_id
].
c_str
();
auto
name
=
ImageList
[
image_type
][
image_id
].
c_str
();
myswprintf
(
fname
,
L"./textures/%ls"
,
name
);
myswprintf
(
fname
,
L"./textures/%ls"
,
name
);
...
@@ -85,8 +86,9 @@ irr::video::ITexture* ImageManager::GetRandomImage(int image_type, s32 width, s3
...
@@ -85,8 +86,9 @@ irr::video::ITexture* ImageManager::GetRandomImage(int image_type, s32 width, s3
return
NULL
;
return
NULL
;
char
ImageName
[
1024
];
char
ImageName
[
1024
];
wchar_t
fname
[
1024
];
wchar_t
fname
[
1024
];
std
::
random_device
rd
;
if
(
saved_image_id
[
image_type
]
==
-
1
)
if
(
saved_image_id
[
image_type
]
==
-
1
)
saved_image_id
[
image_type
]
=
r
an
d
()
%
count
;
saved_image_id
[
image_type
]
=
rd
()
%
count
;
int
image_id
=
saved_image_id
[
image_type
];
int
image_id
=
saved_image_id
[
image_type
];
auto
name
=
ImageList
[
image_type
][
image_id
].
c_str
();
auto
name
=
ImageList
[
image_type
][
image_id
].
c_str
();
myswprintf
(
fname
,
L"./textures/%ls"
,
name
);
myswprintf
(
fname
,
L"./textures/%ls"
,
name
);
...
...
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