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
b1488e04
Commit
b1488e04
authored
Jan 27, 2025
by
Chen Bill
Committed by
GitHub
Jan 27, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update card::card_operation_sort (#713)
* rename to deck_seq * update card::card_operation_sort * use std::swap
parent
9c58f321
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
21 deletions
+20
-21
card.cpp
card.cpp
+4
-4
field.cpp
field.cpp
+3
-4
field.h
field.h
+1
-1
playerop.cpp
playerop.cpp
+12
-12
No files found.
card.cpp
View file @
b1488e04
...
@@ -82,12 +82,12 @@ bool card::card_operation_sort(card* c1, card* c2) {
...
@@ -82,12 +82,12 @@ bool card::card_operation_sort(card* c1, card* c2) {
}
}
if
(
c1
->
current
.
location
!=
c2
->
current
.
location
)
if
(
c1
->
current
.
location
!=
c2
->
current
.
location
)
return
c1
->
current
.
location
<
c2
->
current
.
location
;
return
c1
->
current
.
location
<
c2
->
current
.
location
;
if
(
c1
->
current
.
location
&
LOCATION_OVERLAY
)
{
if
(
c1
->
current
.
location
==
LOCATION_OVERLAY
)
{
if
(
c1
->
overlay_target
&&
c2
->
overlay_target
&&
c1
->
overlay_target
->
current
.
sequence
!=
c2
->
overlay_target
->
current
.
sequence
)
if
(
c1
->
overlay_target
&&
c2
->
overlay_target
&&
c1
->
overlay_target
->
current
.
sequence
!=
c2
->
overlay_target
->
current
.
sequence
)
return
c1
->
overlay_target
->
current
.
sequence
<
c2
->
overlay_target
->
current
.
sequence
;
return
c1
->
overlay_target
->
current
.
sequence
<
c2
->
overlay_target
->
current
.
sequence
;
else
else
return
c1
->
current
.
sequence
<
c2
->
current
.
sequence
;
return
c1
->
current
.
sequence
<
c2
->
current
.
sequence
;
}
else
if
(
c1
->
current
.
location
&
LOCATION_DECK
&&
pduel
->
game_field
->
is_select_hide_deck_sequence
(
cp1
))
{
}
else
if
(
c1
->
current
.
location
==
LOCATION_DECK
&&
pduel
->
game_field
->
is_select_hide_deck_sequence
(
cp1
))
{
// if deck reversed and the card being at the top, it should go first
// if deck reversed and the card being at the top, it should go first
if
(
pduel
->
game_field
->
core
.
deck_reversed
)
{
if
(
pduel
->
game_field
->
core
.
deck_reversed
)
{
if
(
c1
->
current
.
sequence
==
pduel
->
game_field
->
player
[
cp1
].
list_main
.
size
()
-
1
)
if
(
c1
->
current
.
sequence
==
pduel
->
game_field
->
player
[
cp1
].
list_main
.
size
()
-
1
)
...
@@ -105,8 +105,8 @@ bool card::card_operation_sort(card* c1, card* c2) {
...
@@ -105,8 +105,8 @@ bool card::card_operation_sort(card* c1, card* c2) {
return
c2_faceup
;
return
c2_faceup
;
}
}
// sort deck as card property
// sort deck as card property
auto
c1_type
=
c1
->
data
.
type
&
0x7
;
auto
c1_type
=
c1
->
data
.
type
&
(
TYPE_MONSTER
|
TYPE_SPELL
|
TYPE_TRAP
)
;
auto
c2_type
=
c2
->
data
.
type
&
0x7
;
auto
c2_type
=
c2
->
data
.
type
&
(
TYPE_MONSTER
|
TYPE_SPELL
|
TYPE_TRAP
)
;
// monster should go before spell, and then trap
// monster should go before spell, and then trap
if
(
c1_type
!=
c2_type
)
if
(
c1_type
!=
c2_type
)
return
c1_type
>
c2_type
;
return
c1_type
>
c2_type
;
...
...
field.cpp
View file @
b1488e04
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include "effect.h"
#include "effect.h"
#include "interpreter.h"
#include "interpreter.h"
#include <cstring>
#include <cstring>
#include <algorithm>
int32_t
field
::
field_used_count
[
32
]
=
{
0
,
1
,
1
,
2
,
1
,
2
,
2
,
3
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
};
int32_t
field
::
field_used_count
[
32
]
=
{
0
,
1
,
1
,
2
,
1
,
2
,
2
,
3
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
};
...
@@ -1094,11 +1095,9 @@ void field::reverse_deck(uint8_t playerid) {
...
@@ -1094,11 +1095,9 @@ void field::reverse_deck(uint8_t playerid) {
if
(
count
==
0
)
if
(
count
==
0
)
return
;
return
;
for
(
int32_t
i
=
0
;
i
<
count
/
2
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
count
/
2
;
++
i
)
{
card
*
tmp
=
player
[
playerid
].
list_main
[
i
];
player
[
playerid
].
list_main
[
i
]
->
current
.
sequence
=
count
-
1
-
i
;
tmp
->
current
.
sequence
=
count
-
1
-
i
;
player
[
playerid
].
list_main
[
count
-
1
-
i
]
->
current
.
sequence
=
i
;
player
[
playerid
].
list_main
[
count
-
1
-
i
]
->
current
.
sequence
=
i
;
player
[
playerid
].
list_main
[
i
]
=
player
[
playerid
].
list_main
[
count
-
1
-
i
];
std
::
swap
(
player
[
playerid
].
list_main
[
i
],
player
[
playerid
].
list_main
[
count
-
1
-
i
]);
player
[
playerid
].
list_main
[
count
-
1
-
i
]
=
tmp
;
}
}
}
}
void
field
::
refresh_player_info
(
uint8_t
playerid
)
{
void
field
::
refresh_player_info
(
uint8_t
playerid
)
{
...
...
field.h
View file @
b1488e04
...
@@ -348,7 +348,7 @@ struct processor {
...
@@ -348,7 +348,7 @@ struct processor {
uint8_t
current_player
{
PLAYER_NONE
};
uint8_t
current_player
{
PLAYER_NONE
};
uint8_t
conti_player
{
PLAYER_NONE
};
uint8_t
conti_player
{
PLAYER_NONE
};
uint8_t
select_deck_sequence_revealed
{
FALSE
};
uint8_t
select_deck_sequence_revealed
{
FALSE
};
uint8_t
selecting_player
{
PLAYER_NONE
};
uint8_t
selecting_player
{
0
};
activity_map
summon_counter
;
activity_map
summon_counter
;
activity_map
normalsummon_counter
;
activity_map
normalsummon_counter
;
activity_map
spsummon_counter
;
activity_map
spsummon_counter
;
...
...
playerop.cpp
View file @
b1488e04
...
@@ -261,10 +261,10 @@ int32_t field::select_card(uint16_t step, uint8_t playerid, uint8_t cancelable,
...
@@ -261,10 +261,10 @@ int32_t field::select_card(uint16_t step, uint8_t playerid, uint8_t cancelable,
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
uint8_t
deck_seq
_pointer
=
0
;
uint8_t
deck_seq
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
_pointer
));
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
));
}
}
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
...
@@ -305,15 +305,15 @@ int32_t field::select_unselect_card(uint16_t step, uint8_t playerid, uint8_t can
...
@@ -305,15 +305,15 @@ int32_t field::select_unselect_card(uint16_t step, uint8_t playerid, uint8_t can
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
uint8_t
deck_seq
_pointer
=
0
;
uint8_t
deck_seq
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
_pointer
));
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
));
}
}
pduel
->
write_buffer8
((
uint8_t
)
core
.
unselect_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
unselect_cards
.
size
());
for
(
auto
&
pcard
:
core
.
unselect_cards
)
{
for
(
auto
&
pcard
:
core
.
unselect_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
_pointer
));
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
));
}
}
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
...
@@ -530,12 +530,12 @@ int32_t field::select_tribute(uint16_t step, uint8_t playerid, uint8_t cancelabl
...
@@ -530,12 +530,12 @@ int32_t field::select_tribute(uint16_t step, uint8_t playerid, uint8_t cancelabl
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
uint8_t
deck_seq
_pointer
=
0
;
uint8_t
deck_seq
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
_pointer
));
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
));
pduel
->
write_buffer8
(
pcard
->
release_param
);
pduel
->
write_buffer8
(
pcard
->
release_param
);
}
}
return
FALSE
;
return
FALSE
;
...
@@ -605,12 +605,12 @@ int32_t field::select_counter(uint16_t step, uint8_t playerid, uint16_t countert
...
@@ -605,12 +605,12 @@ int32_t field::select_counter(uint16_t step, uint8_t playerid, uint16_t countert
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
core
.
selecting_player
=
playerid
;
core
.
selecting_player
=
playerid
;
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
uint8_t
deck_seq
_pointer
=
0
;
uint8_t
deck_seq
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
_pointer
));
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
));
pduel
->
write_buffer16
(
pcard
->
get_counter
(
countertype
));
pduel
->
write_buffer16
(
pcard
->
get_counter
(
countertype
));
}
}
return
FALSE
;
return
FALSE
;
...
@@ -663,12 +663,12 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
...
@@ -663,12 +663,12 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
must_select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
must_select_cards
.
size
());
uint8_t
deck_seq
_pointer
=
0
;
uint8_t
deck_seq
=
0
;
for
(
auto
&
pcard
:
core
.
must_select_cards
)
{
for
(
auto
&
pcard
:
core
.
must_select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
_pointer
));
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
));
pduel
->
write_buffer32
(
pcard
->
sum_param
);
pduel
->
write_buffer32
(
pcard
->
sum_param
);
}
}
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
...
@@ -676,7 +676,7 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
...
@@ -676,7 +676,7 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
_pointer
));
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
));
pduel
->
write_buffer32
(
pcard
->
sum_param
);
pduel
->
write_buffer32
(
pcard
->
sum_param
);
}
}
return
FALSE
;
return
FALSE
;
...
...
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