Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-core
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
nanahira
ygopro-core
Commits
ad00f8bf
Commit
ad00f8bf
authored
May 14, 2024
by
mercury233
Committed by
GitHub
May 14, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix card_operation_sort undefined behavior (#589)
parent
476c8892
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
card.cpp
card.cpp
+7
-5
No files found.
card.cpp
View file @
ad00f8bf
...
...
@@ -106,11 +106,13 @@ bool card::card_operation_sort(card* c1, card* c2) {
return
true
;
}
// faceup deck cards should go at the very first
if
(
c1
->
current
.
position
!=
c2
->
current
.
position
)
{
if
(
c1
->
current
.
position
&
POS_FACEUP
)
return
false
;
auto
c1_faceup
=
c1
->
current
.
position
&
POS_FACEUP
;
auto
c2_faceup
=
c2
->
current
.
position
&
POS_FACEUP
;
if
(
c1_faceup
||
c2_faceup
)
{
if
(
c1_faceup
&&
c2_faceup
)
return
c1
->
current
.
sequence
>
c2
->
current
.
sequence
;
else
return
true
;
return
c2_faceup
;
}
// sort deck as card property
auto
c1_type
=
c1
->
data
.
type
&
0x7
;
...
...
@@ -120,7 +122,7 @@ bool card::card_operation_sort(card* c1, card* c2) {
return
c1_type
>
c2_type
;
if
(
c1_type
&
TYPE_MONSTER
)
{
if
(
c1
->
data
.
level
!=
c2
->
data
.
level
)
return
c1
->
data
.
level
>
c2
->
data
.
level
;
return
c1
->
data
.
level
<
c2
->
data
.
level
;
// TODO: more sorts here
}
if
(
c1
->
data
.
code
!=
c2
->
data
.
code
)
...
...
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