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
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
MyCard
ygopro-core
Commits
e5a9ad93
Commit
e5a9ad93
authored
May 18, 2018
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify is_extra_link_state
parent
8439bbdc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
67 deletions
+32
-67
card.cpp
card.cpp
+32
-65
card.h
card.h
+0
-2
No files found.
card.cpp
View file @
e5a9ad93
...
@@ -1371,72 +1371,39 @@ int32 card::is_link_state() {
...
@@ -1371,72 +1371,39 @@ int32 card::is_link_state() {
int32
card
::
is_extra_link_state
()
{
int32
card
::
is_extra_link_state
()
{
if
(
current
.
location
!=
LOCATION_MZONE
)
if
(
current
.
location
!=
LOCATION_MZONE
)
return
FALSE
;
return
FALSE
;
card_set
cset
;
uint32
checked
=
1u
<<
current
.
sequence
;
card_set
excset
;
uint32
linked_zone
=
get_mutual_linked_zone
();
for
(
int32
p
=
0
;
p
<
2
;
++
p
)
{
const
auto
&
list_mzone0
=
pduel
->
game_field
->
player
[
current
.
controler
].
list_mzone
;
card
*
pcard1
=
pduel
->
game_field
->
player
[
p
].
list_mzone
[
5
];
const
auto
&
list_mzone1
=
pduel
->
game_field
->
player
[
1
-
current
.
controler
].
list_mzone
;
if
(
pcard1
)
while
(
true
)
{
excset
.
insert
(
pcard1
);
if
(((
linked_zone
>>
5
)
|
(
linked_zone
>>
(
16
+
6
)))
&
((
linked_zone
>>
6
)
|
(
linked_zone
>>
(
16
+
5
)))
&
1
)
card
*
pcard2
=
pduel
->
game_field
->
player
[
p
].
list_mzone
[
6
];
if
(
pcard2
)
excset
.
insert
(
pcard2
);
card
*
pcard3
=
pduel
->
game_field
->
player
[
1
-
p
].
list_mzone
[
5
];
if
(
pcard3
)
excset
.
insert
(
pcard3
);
card
*
pcard4
=
pduel
->
game_field
->
player
[
1
-
p
].
list_mzone
[
6
];
if
(
pcard4
)
excset
.
insert
(
pcard4
);
}
if
(
excset
.
size
()
<
2
)
return
FALSE
;
auto
cit
=
excset
.
begin
();
card
*
pcard
=
*
cit
;
excset
.
erase
(
pcard
);
card_set
linked_group1
;
pcard
->
get_mutual_linked_cards
(
&
linked_group1
);
if
(
!
linked_group1
.
size
())
return
FALSE
;
cset
.
insert
(
pcard
);
return
check_extra_link
(
&
cset
,
&
excset
,
&
linked_group1
);
}
int32
card
::
check_extra_link
(
card_set
*
cset
,
card_set
*
excset
,
card_set
*
linked_group1
)
{
for
(
auto
cit
=
linked_group1
->
begin
();
cit
!=
linked_group1
->
end
();
++
cit
)
{
card
*
pcard
=
*
cit
;
if
(
cset
->
find
(
pcard
)
!=
cset
->
end
())
continue
;
if
(
excset
->
find
(
pcard
)
!=
excset
->
end
())
{
card_set
omitted
;
if
(
check_extra_link_finish
(
cset
,
&
omitted
))
return
TRUE
;
}
card_set
linked_group2
;
pcard
->
get_mutual_linked_cards
(
&
linked_group2
);
if
(
!
linked_group2
.
size
())
continue
;
cset
->
insert
(
pcard
);
int32
result
=
check_extra_link
(
cset
,
excset
,
&
linked_group2
);
cset
->
erase
(
pcard
);
if
(
result
)
return
TRUE
;
return
TRUE
;
}
int32
checking
=
(
int32
)(
linked_zone
&
~
checked
);
return
FALSE
;
if
(
!
checking
)
}
return
FALSE
;
int32
card
::
check_extra_link_finish
(
card_set
*
cset
,
card_set
*
omitted
)
{
int32
rightmost
=
checking
&
(
-
checking
);
if
(
cset
->
find
(
this
)
!=
cset
->
end
())
checked
|=
(
uint32
)
rightmost
;
return
TRUE
;
if
(
rightmost
<
0x10000
)
{
for
(
auto
cit
=
cset
->
begin
();
cit
!=
cset
->
end
();
++
cit
)
{
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
card
*
pcard
=
*
cit
;
if
(
rightmost
&
1
)
{
if
(
omitted
->
find
(
pcard
)
!=
omitted
->
end
())
card
*
pcard
=
list_mzone0
[
i
];
continue
;
linked_zone
|=
pcard
->
get_mutual_linked_zone
();
card_set
linked_group3
;
break
;
pcard
->
get_mutual_linked_cards
(
&
linked_group3
);
}
if
(
!
linked_group3
.
size
())
rightmost
>>=
1
;
continue
;
}
omitted
->
insert
(
pcard
);
}
else
{
int32
result
=
check_extra_link_finish
(
&
linked_group3
,
omitted
);
rightmost
>>=
16
;
omitted
->
erase
(
pcard
);
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
if
(
result
)
if
(
rightmost
&
1
)
{
return
TRUE
;
card
*
pcard
=
list_mzone1
[
i
];
uint32
zone
=
pcard
->
get_mutual_linked_zone
();
linked_zone
|=
(
zone
<<
16
)
|
(
zone
>>
16
);
break
;
}
rightmost
>>=
1
;
}
}
}
}
return
FALSE
;
return
FALSE
;
}
}
...
...
card.h
View file @
e5a9ad93
...
@@ -228,8 +228,6 @@ public:
...
@@ -228,8 +228,6 @@ public:
void
get_mutual_linked_cards
(
card_set
*
cset
);
void
get_mutual_linked_cards
(
card_set
*
cset
);
int32
is_link_state
();
int32
is_link_state
();
int32
is_extra_link_state
();
int32
is_extra_link_state
();
int32
check_extra_link
(
card_set
*
cset
,
card_set
*
excset
,
card_set
*
linked_group1
);
int32
check_extra_link_finish
(
card_set
*
cset
,
card_set
*
omitted
);
int32
is_position
(
int32
pos
);
int32
is_position
(
int32
pos
);
void
set_status
(
uint32
status
,
int32
enabled
);
void
set_status
(
uint32
status
,
int32
enabled
);
int32
get_status
(
uint32
status
);
int32
get_status
(
uint32
status
);
...
...
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