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
2222c76a
Commit
2222c76a
authored
Dec 08, 2023
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update card::get_infos()
parent
3ca0ac3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
208 additions
and
98 deletions
+208
-98
card.cpp
card.cpp
+206
-96
card.h
card.h
+2
-2
No files found.
card.cpp
View file @
2222c76a
...
@@ -121,139 +121,249 @@ card::card(duel* pd) {
...
@@ -121,139 +121,249 @@ card::card(duel* pd) {
spsummon_code
=
0
;
spsummon_code
=
0
;
current
.
controler
=
PLAYER_NONE
;
current
.
controler
=
PLAYER_NONE
;
}
}
constexpr
void
update_cache
(
uint32
&
tdata
,
uint32
&
cache
,
int32
*&
p
,
uint32
&
query_flag
,
const
uint32
flag
)
{
if
(
tdata
!=
cache
)
{
cache
=
tdata
;
*
p
=
tdata
;
++
p
;
}
else
query_flag
&=
~
flag
;
}
int32
card
::
get_infos
(
byte
*
buf
,
uint32
query_flag
,
int32
use_cache
)
{
int32
card
::
get_infos
(
byte
*
buf
,
uint32
query_flag
,
int32
use_cache
)
{
int32
*
p
=
(
int32
*
)
buf
;
int32
*
p
=
(
int32
*
)
buf
;
int32
tdata
=
0
;
std
::
pair
<
int32
,
int32
>
atk_def
(
-
10
,
-
10
);
std
::
pair
<
int32
,
int32
>
atk_def
(
-
10
,
-
10
);
std
::
pair
<
int32
,
int32
>
base_atk_def
(
-
10
,
-
10
);
if
((
query_flag
&
QUERY_ATTACK
)
||
(
query_flag
&
QUERY_DEFENSE
))
{
atk_def
=
get_atk_def
();
}
if
((
query_flag
&
QUERY_BASE_ATTACK
)
||
(
query_flag
&
QUERY_BASE_DEFENSE
))
{
base_atk_def
=
get_base_atk_def
();
}
p
+=
2
;
p
+=
2
;
if
(
query_flag
&
QUERY_CODE
)
*
p
++
=
data
.
code
;
if
(
query_flag
&
QUERY_CODE
)
{
if
(
query_flag
&
QUERY_POSITION
)
*
p
++
=
get_info_location
();
*
p
=
data
.
code
;
++
p
;
}
if
(
query_flag
&
QUERY_POSITION
)
{
*
p
=
get_info_location
();
++
p
;
}
if
(
!
use_cache
)
{
if
(
!
use_cache
)
{
if
(
query_flag
&
QUERY_ALIAS
)
q_cache
.
alias
=
*
p
++
=
get_code
();
if
(
query_flag
&
QUERY_ALIAS
)
{
if
(
query_flag
&
QUERY_TYPE
)
q_cache
.
type
=
*
p
++
=
get_type
();
*
p
=
get_code
();
if
(
query_flag
&
QUERY_LEVEL
)
q_cache
.
level
=
*
p
++
=
get_level
();
q_cache
.
current_code
=
*
p
;
if
(
query_flag
&
QUERY_RANK
)
q_cache
.
rank
=
*
p
++
=
get_rank
();
++
p
;
if
(
query_flag
&
QUERY_ATTRIBUTE
)
q_cache
.
attribute
=
*
p
++
=
get_attribute
();
}
if
(
query_flag
&
QUERY_RACE
)
q_cache
.
race
=
*
p
++
=
get_race
();
if
(
query_flag
&
QUERY_TYPE
)
{
*
p
=
get_type
();
q_cache
.
type
=
*
p
;
++
p
;
}
if
(
query_flag
&
QUERY_LEVEL
)
{
*
p
=
get_level
();
q_cache
.
level
=
*
p
;
++
p
;
}
if
(
query_flag
&
QUERY_RANK
)
{
*
p
=
get_rank
();
q_cache
.
rank
=
*
p
;
++
p
;
}
if
(
query_flag
&
QUERY_ATTRIBUTE
)
{
*
p
=
get_attribute
();
q_cache
.
attribute
=
*
p
;
++
p
;
}
if
(
query_flag
&
QUERY_RACE
)
{
*
p
=
get_race
();
q_cache
.
race
=
*
p
;
++
p
;
}
if
(
query_flag
&
QUERY_ATTACK
)
{
if
(
query_flag
&
QUERY_ATTACK
)
{
atk_def
=
get_atk_def
();
*
p
=
atk_def
.
first
;
q_cache
.
attack
=
*
p
++
=
atk_def
.
first
;
q_cache
.
attack
=
atk_def
.
first
;
++
p
;
}
}
if
(
query_flag
&
QUERY_DEFENSE
)
{
if
(
query_flag
&
QUERY_DEFENSE
)
{
if
(
atk_def
.
second
==
-
10
)
*
p
=
atk_def
.
second
;
q_cache
.
defense
=
*
p
++
=
get_defense
();
q_cache
.
defense
=
atk_def
.
second
;
else
++
p
;
q_cache
.
defense
=
*
p
++
=
atk_def
.
second
;
}
if
(
query_flag
&
QUERY_BASE_ATTACK
)
{
*
p
=
base_atk_def
.
first
;
q_cache
.
base_attack
=
base_atk_def
.
first
;
++
p
;
}
if
(
query_flag
&
QUERY_BASE_DEFENSE
)
{
*
p
=
base_atk_def
.
second
;
q_cache
.
base_defense
=
base_atk_def
.
second
;
++
p
;
}
if
(
query_flag
&
QUERY_REASON
)
{
*
p
=
current
.
reason
;
q_cache
.
reason
=
current
.
reason
;
++
p
;
}
}
if
(
query_flag
&
QUERY_BASE_ATTACK
)
q_cache
.
base_attack
=
*
p
++
=
get_base_attack
();
if
(
query_flag
&
QUERY_BASE_DEFENSE
)
q_cache
.
base_defense
=
*
p
++
=
get_base_defense
();
if
(
query_flag
&
QUERY_REASON
)
q_cache
.
reason
=
*
p
++
=
current
.
reason
;
}
}
else
{
else
{
if
((
query_flag
&
QUERY_ALIAS
)
&&
((
uint32
)(
tdata
=
get_code
())
!=
q_cache
.
alias
))
{
if
((
query_flag
&
QUERY_ALIAS
))
{
q_cache
.
alias
=
tdata
;
uint32
tdata
=
get_code
();
*
p
++
=
tdata
;
update_cache
(
tdata
,
q_cache
.
current_code
,
p
,
query_flag
,
QUERY_ALIAS
);
}
else
query_flag
&=
~
QUERY_ALIAS
;
}
if
((
query_flag
&
QUERY_TYPE
)
&&
((
uint32
)(
tdata
=
get_type
())
!=
q_cache
.
type
))
{
if
((
query_flag
&
QUERY_TYPE
))
{
q_cache
.
type
=
tdata
;
uint32
tdata
=
get_type
();
*
p
++
=
tdata
;
update_cache
(
tdata
,
q_cache
.
type
,
p
,
query_flag
,
QUERY_TYPE
);
}
else
query_flag
&=
~
QUERY_TYPE
;
}
if
((
query_flag
&
QUERY_LEVEL
)
&&
((
uint32
)(
tdata
=
get_level
())
!=
q_cache
.
level
))
{
if
((
query_flag
&
QUERY_LEVEL
))
{
q_cache
.
level
=
tdata
;
uint32
tdata
=
get_level
();
*
p
++
=
tdata
;
update_cache
(
tdata
,
q_cache
.
level
,
p
,
query_flag
,
QUERY_LEVEL
);
}
else
query_flag
&=
~
QUERY_LEVEL
;
}
if
((
query_flag
&
QUERY_RANK
)
&&
((
uint32
)(
tdata
=
get_rank
())
!=
q_cache
.
rank
))
{
if
((
query_flag
&
QUERY_RANK
))
{
q_cache
.
rank
=
tdata
;
uint32
tdata
=
get_rank
();
*
p
++
=
tdata
;
update_cache
(
tdata
,
q_cache
.
rank
,
p
,
query_flag
,
QUERY_RANK
);
}
else
query_flag
&=
~
QUERY_RANK
;
}
if
((
query_flag
&
QUERY_ATTRIBUTE
)
&&
((
uint32
)(
tdata
=
get_attribute
())
!=
q_cache
.
attribute
))
{
if
((
query_flag
&
QUERY_ATTRIBUTE
))
{
q_cache
.
attribute
=
tdata
;
uint32
tdata
=
get_attribute
();
*
p
++
=
tdata
;
update_cache
(
tdata
,
q_cache
.
attribute
,
p
,
query_flag
,
QUERY_ATTRIBUTE
);
}
else
query_flag
&=
~
QUERY_ATTRIBUTE
;
}
if
((
query_flag
&
QUERY_RACE
)
&&
((
uint32
)(
tdata
=
get_race
())
!=
q_cache
.
race
))
{
if
((
query_flag
&
QUERY_RACE
))
{
q_cache
.
race
=
tdata
;
uint32
tdata
=
get_race
();
*
p
++
=
tdata
;
update_cache
(
tdata
,
q_cache
.
race
,
p
,
query_flag
,
QUERY_RACE
);
}
else
query_flag
&=
~
QUERY_RACE
;
}
if
((
query_flag
&
QUERY_ATTACK
)
&&
((
tdata
=
get_attack
())
!=
q_cache
.
attack
))
{
if
((
query_flag
&
QUERY_ATTACK
))
{
q_cache
.
attack
=
tdata
;
if
(
atk_def
.
first
!=
q_cache
.
attack
)
{
*
p
++
=
tdata
;
q_cache
.
attack
=
atk_def
.
first
;
}
else
query_flag
&=
~
QUERY_ATTACK
;
*
p
=
atk_def
.
first
;
if
((
query_flag
&
QUERY_DEFENSE
)
&&
((
tdata
=
get_defense
())
!=
q_cache
.
defense
))
{
++
p
;
q_cache
.
defense
=
tdata
;
}
*
p
++
=
tdata
;
else
}
else
query_flag
&=
~
QUERY_DEFENSE
;
query_flag
&=
~
QUERY_ATTACK
;
if
((
query_flag
&
QUERY_BASE_ATTACK
)
&&
((
tdata
=
get_base_attack
())
!=
q_cache
.
base_attack
))
{
}
q_cache
.
base_attack
=
tdata
;
if
((
query_flag
&
QUERY_DEFENSE
))
{
*
p
++
=
tdata
;
if
(
atk_def
.
second
!=
q_cache
.
defense
)
{
}
else
query_flag
&=
~
QUERY_BASE_ATTACK
;
q_cache
.
defense
=
atk_def
.
second
;
if
((
query_flag
&
QUERY_BASE_DEFENSE
)
&&
((
tdata
=
get_base_defense
())
!=
q_cache
.
base_defense
))
{
*
p
=
atk_def
.
second
;
q_cache
.
base_defense
=
tdata
;
++
p
;
*
p
++
=
tdata
;
}
}
else
query_flag
&=
~
QUERY_BASE_DEFENSE
;
else
if
((
query_flag
&
QUERY_REASON
)
&&
((
uint32
)(
tdata
=
current
.
reason
)
!=
q_cache
.
reason
))
{
query_flag
&=
~
QUERY_DEFENSE
;
q_cache
.
reason
=
tdata
;
}
*
p
++
=
tdata
;
if
((
query_flag
&
QUERY_BASE_ATTACK
))
{
}
else
query_flag
&=
~
QUERY_REASON
;
if
(
base_atk_def
.
first
!=
q_cache
.
base_attack
)
{
}
q_cache
.
base_attack
=
base_atk_def
.
first
;
if
(
query_flag
&
QUERY_REASON_CARD
)
*
p
=
base_atk_def
.
first
;
*
p
++
=
current
.
reason_card
?
current
.
reason_card
->
get_info_location
()
:
0
;
++
p
;
}
else
query_flag
&=
~
QUERY_BASE_ATTACK
;
}
if
((
query_flag
&
QUERY_BASE_DEFENSE
))
{
if
(
base_atk_def
.
second
!=
q_cache
.
base_defense
)
{
q_cache
.
base_defense
=
base_atk_def
.
second
;
*
p
=
base_atk_def
.
second
;
++
p
;
}
else
query_flag
&=
~
QUERY_BASE_DEFENSE
;
}
if
((
query_flag
&
QUERY_REASON
))
{
uint32
tdata
=
current
.
reason
;
update_cache
(
tdata
,
q_cache
.
reason
,
p
,
query_flag
,
QUERY_REASON
);
}
}
if
(
query_flag
&
QUERY_REASON_CARD
)
{
*
p
=
current
.
reason_card
?
current
.
reason_card
->
get_info_location
()
:
0
;
++
p
;
}
if
(
query_flag
&
QUERY_EQUIP_CARD
)
{
if
(
query_flag
&
QUERY_EQUIP_CARD
)
{
if
(
equiping_target
)
if
(
equiping_target
)
{
*
p
++
=
equiping_target
->
get_info_location
();
*
p
=
equiping_target
->
get_info_location
();
++
p
;
}
else
else
query_flag
&=
~
QUERY_EQUIP_CARD
;
query_flag
&=
~
QUERY_EQUIP_CARD
;
}
}
if
(
query_flag
&
QUERY_TARGET_CARD
)
{
if
(
query_flag
&
QUERY_TARGET_CARD
)
{
*
p
++
=
(
int32
)
effect_target_cards
.
size
();
*
p
=
(
int32
)
effect_target_cards
.
size
();
for
(
auto
&
pcard
:
effect_target_cards
)
++
p
;
*
p
++
=
pcard
->
get_info_location
();
for
(
auto
&
pcard
:
effect_target_cards
)
{
*
p
=
pcard
->
get_info_location
();
++
p
;
}
}
}
if
(
query_flag
&
QUERY_OVERLAY_CARD
)
{
if
(
query_flag
&
QUERY_OVERLAY_CARD
)
{
*
p
++
=
(
int32
)
xyz_materials
.
size
();
*
p
=
(
int32
)
xyz_materials
.
size
();
for
(
auto
&
xcard
:
xyz_materials
)
++
p
;
*
p
++
=
xcard
->
data
.
code
;
for
(
auto
&
xcard
:
xyz_materials
)
{
*
p
=
xcard
->
data
.
code
;
++
p
;
}
}
}
if
(
query_flag
&
QUERY_COUNTERS
)
{
if
(
query_flag
&
QUERY_COUNTERS
)
{
*
p
++
=
(
int32
)
counters
.
size
();
*
p
=
(
int32
)
counters
.
size
();
for
(
const
auto
&
cmit
:
counters
)
++
p
;
*
p
++
=
cmit
.
first
+
((
cmit
.
second
[
0
]
+
cmit
.
second
[
1
])
<<
16
);
for
(
const
auto
&
cmit
:
counters
)
{
*
p
=
cmit
.
first
+
((
cmit
.
second
[
0
]
+
cmit
.
second
[
1
])
<<
16
);
++
p
;
}
}
if
(
query_flag
&
QUERY_OWNER
)
{
*
p
=
owner
;
++
p
;
}
}
if
(
query_flag
&
QUERY_OWNER
)
*
p
++
=
owner
;
if
(
query_flag
&
QUERY_STATUS
)
{
if
(
query_flag
&
QUERY_STATUS
)
{
tdata
=
status
&
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
|
STATUS_PROC_COMPLETE
);
uint32
tdata
=
status
&
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
|
STATUS_PROC_COMPLETE
);
if
(
!
use_cache
||
(
tdata
!=
q_cache
.
status
))
{
if
(
!
use_cache
||
(
tdata
!=
q_cache
.
status
))
{
q_cache
.
status
=
tdata
;
q_cache
.
status
=
tdata
;
*
p
++
=
tdata
;
*
p
=
tdata
;
}
else
++
p
;
}
else
query_flag
&=
~
QUERY_STATUS
;
query_flag
&=
~
QUERY_STATUS
;
}
}
if
(
!
use_cache
)
{
if
(
!
use_cache
)
{
if
(
query_flag
&
QUERY_LSCALE
)
q_cache
.
lscale
=
*
p
++
=
get_lscale
();
if
(
query_flag
&
QUERY_LSCALE
)
{
if
(
query_flag
&
QUERY_RSCALE
)
q_cache
.
rscale
=
*
p
++
=
get_rscale
();
*
p
=
get_lscale
();
q_cache
.
lscale
=
*
p
;
++
p
;
}
if
(
query_flag
&
QUERY_RSCALE
)
{
*
p
=
get_rscale
();
q_cache
.
rscale
=
*
p
;
++
p
;
}
if
(
query_flag
&
QUERY_LINK
)
{
if
(
query_flag
&
QUERY_LINK
)
{
q_cache
.
link
=
*
p
++
=
get_link
();
*
p
=
get_link
();
q_cache
.
link_marker
=
*
p
++
=
get_link_marker
();
q_cache
.
link
=
*
p
;
++
p
;
*
p
=
get_link_marker
();
q_cache
.
link_marker
=
*
p
;
++
p
;
}
}
}
}
else
{
else
{
if
((
query_flag
&
QUERY_LSCALE
)
&&
((
uint32
)(
tdata
=
get_lscale
())
!=
q_cache
.
lscale
)
)
{
if
((
query_flag
&
QUERY_LSCALE
))
{
q_cache
.
lscale
=
tdata
;
uint32
tdata
=
get_lscale
()
;
*
p
++
=
tdata
;
update_cache
(
tdata
,
q_cache
.
lscale
,
p
,
query_flag
,
QUERY_LSCALE
)
;
}
else
query_flag
&=
~
QUERY_LSCALE
;
}
if
((
query_flag
&
QUERY_RSCALE
)
&&
((
uint32
)(
tdata
=
get_rscale
())
!=
q_cache
.
rscale
)
)
{
if
((
query_flag
&
QUERY_RSCALE
))
{
q_cache
.
rscale
=
tdata
;
uint32
tdata
=
get_rscale
()
;
*
p
++
=
tdata
;
update_cache
(
tdata
,
q_cache
.
rscale
,
p
,
query_flag
,
QUERY_RSCALE
)
;
}
else
query_flag
&=
~
QUERY_RSCALE
;
}
if
(
query_flag
&
QUERY_LINK
)
{
if
(
query_flag
&
QUERY_LINK
)
{
uint32
link
=
get_link
();
uint32
link
=
get_link
();
uint32
link_marker
=
get_link_marker
();
uint32
link_marker
=
get_link_marker
();
if
((
link
!=
q_cache
.
link
)
||
(
link_marker
!=
q_cache
.
link_marker
))
{
if
((
link
!=
q_cache
.
link
)
||
(
link_marker
!=
q_cache
.
link_marker
))
{
q_cache
.
link
=
link
;
q_cache
.
link
=
link
;
*
p
++
=
(
int32
)
link
;
*
p
=
(
int32
)
link
;
++
p
;
q_cache
.
link_marker
=
link_marker
;
q_cache
.
link_marker
=
link_marker
;
*
p
++
=
(
int32
)
link_marker
;
*
p
=
(
int32
)
link_marker
;
}
else
query_flag
&=
~
QUERY_LINK
;
++
p
;
}
else
query_flag
&=
~
QUERY_LINK
;
}
}
}
}
int32
*
finalize
=
(
int32
*
)
buf
;
int32
*
finalize
=
(
int32
*
)
buf
;
...
...
card.h
View file @
2222c76a
...
@@ -76,8 +76,8 @@ struct card_state {
...
@@ -76,8 +76,8 @@ struct card_state {
};
};
struct
query_cache
{
struct
query_cache
{
uint32
code
;
uint32
data_
code
;
uint32
alias
;
uint32
current_code
;
uint32
type
;
uint32
type
;
uint32
level
;
uint32
level
;
uint32
rank
;
uint32
rank
;
...
...
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