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
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
Commits
32ac47c2
Commit
32ac47c2
authored
Dec 16, 2023
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TagDuel: use inline function
parent
74d53175
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
34 deletions
+36
-34
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+33
-34
gframe/tag_duel.h
gframe/tag_duel.h
+3
-0
No files found.
gframe/tag_duel.cpp
View file @
32ac47c2
...
...
@@ -1550,13 +1550,22 @@ void TagDuel::TimeConfirm(DuelPlayer* dp) {
if
(
time_elapsed
<
10
)
time_elapsed
=
0
;
}
inline
int
TagDuel
::
WriteUpdateData
(
int
&
player
,
int
location
,
int
&
flag
,
unsigned
char
*&
qbuf
,
int
&
use_cache
)
{
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
location
);
int
len
=
query_field_card
(
pduel
,
player
,
location
,
flag
,
qbuf
,
use_cache
);
return
len
;
}
inline
unsigned
int
GetPosition
(
unsigned
char
*&
qbuf
,
int
offset
)
{
unsigned
int
info
=
*
(
unsigned
int
*
)(
qbuf
+
offset
);
return
info
>>
24
;
}
void
TagDuel
::
RefreshMzone
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x4000
];
auto
qbuf
=
query_buffer
;
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_MZONE
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_MZONE
,
flag
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_MZONE
,
flag
,
qbuf
,
use_cache
);
int
pid
=
(
player
==
0
)
?
0
:
2
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
...
...
@@ -1564,9 +1573,10 @@ void TagDuel::RefreshMzone(int player, int flag, int use_cache) {
while
(
qlen
<
len
)
{
int
clen
=
BufferIO
::
ReadInt32
(
qbuf
);
qlen
+=
clen
;
if
(
clen
==
4
)
if
(
clen
<=
LEN_HEADER
)
continue
;
if
(
qbuf
[
11
]
&
POS_FACEDOWN
)
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
position
&
POS_FACEDOWN
)
memset
(
qbuf
,
0
,
clen
-
4
);
qbuf
+=
clen
-
4
;
}
...
...
@@ -1579,10 +1589,7 @@ void TagDuel::RefreshMzone(int player, int flag, int use_cache) {
void
TagDuel
::
RefreshSzone
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x4000
];
auto
qbuf
=
query_buffer
;
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_SZONE
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_SZONE
,
flag
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_SZONE
,
flag
,
qbuf
,
use_cache
);
int
pid
=
(
player
==
0
)
?
0
:
2
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
...
...
@@ -1590,9 +1597,10 @@ void TagDuel::RefreshSzone(int player, int flag, int use_cache) {
while
(
qlen
<
len
)
{
int
clen
=
BufferIO
::
ReadInt32
(
qbuf
);
qlen
+=
clen
;
if
(
clen
==
4
)
if
(
clen
<=
LEN_HEADER
)
continue
;
if
(
qbuf
[
11
]
&
POS_FACEDOWN
)
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
position
&
POS_FACEDOWN
)
memset
(
qbuf
,
0
,
clen
-
4
);
qbuf
+=
clen
-
4
;
}
...
...
@@ -1605,23 +1613,18 @@ void TagDuel::RefreshSzone(int player, int flag, int use_cache) {
void
TagDuel
::
RefreshHand
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x4000
];
auto
qbuf
=
query_buffer
;
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_HAND
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_HAND
,
flag
|
QUERY_POSITION
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_HAND
,
flag
,
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
int
qlen
=
0
;
while
(
qlen
<
len
)
{
int
slen
=
BufferIO
::
ReadInt32
(
qbuf
);
int
qflag
=
*
(
int
*
)
qbuf
;
int
offset
=
8
;
if
(
!
(
qflag
&
QUERY_CODE
))
offset
-=
4
;
unsigned
position
=
((
*
(
int
*
)(
qbuf
+
offset
))
>>
24
)
&
0xff
;
qlen
+=
slen
;
if
(
slen
<=
LEN_HEADER
)
continue
;
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
!
(
position
&
POS_FACEUP
))
memset
(
qbuf
,
0
,
slen
-
4
);
qbuf
+=
slen
-
4
;
qlen
+=
slen
;
}
for
(
int
i
=
0
;
i
<
4
;
++
i
)
if
(
players
[
i
]
!=
cur_player
[
player
])
...
...
@@ -1632,10 +1635,7 @@ void TagDuel::RefreshHand(int player, int flag, int use_cache) {
void
TagDuel
::
RefreshGrave
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x4000
];
auto
qbuf
=
query_buffer
;
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_GRAVE
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_GRAVE
,
flag
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_GRAVE
,
flag
,
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
NetServer
::
ReSendToPlayer
(
players
[
2
]);
...
...
@@ -1646,25 +1646,24 @@ void TagDuel::RefreshGrave(int player, int flag, int use_cache) {
void
TagDuel
::
RefreshExtra
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x4000
];
auto
qbuf
=
query_buffer
;
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_EXTRA
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_EXTRA
,
flag
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_EXTRA
,
flag
,
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
}
void
TagDuel
::
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
unsigned
char
query_buffer
[
0x4000
];
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
unsigned
char
query_buffer
[
0x1000
];
auto
qbuf
=
query_buffer
;
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_CARD
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
location
);
BufferIO
::
WriteInt8
(
qbuf
,
sequence
);
int
len
=
query_card
(
pduel
,
player
,
location
,
sequence
,
flag
,
(
unsigned
char
*
)
qbuf
,
0
);
int
len
=
query_card
(
pduel
,
player
,
location
,
sequence
,
flag
,
qbuf
,
0
);
auto
position
=
GetPosition
(
qbuf
,
12
);
if
(
location
&
LOCATION_ONFIELD
)
{
int
pid
=
(
player
==
0
)
?
0
:
2
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
if
(
qbuf
[
15
]
&
POS_FACEUP
)
{
if
(
position
&
POS_FACEUP
)
{
pid
=
2
-
pid
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
...
...
@@ -1675,7 +1674,7 @@ void TagDuel::RefreshSingle(int player, int location, int sequence, int flag) {
int
pid
=
(
player
==
0
)
?
0
:
2
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
if
(
location
==
LOCATION_REMOVED
&&
(
qbuf
[
15
]
&
POS_FACEDOWN
))
if
(
location
==
LOCATION_REMOVED
&&
(
position
&
POS_FACEDOWN
))
return
;
if
(
location
&
0x90
)
{
for
(
int
i
=
0
;
i
<
4
;
++
i
)
...
...
gframe/tag_duel.h
View file @
32ac47c2
...
...
@@ -40,6 +40,9 @@ public:
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
void
TagTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
private:
int
WriteUpdateData
(
int
&
player
,
int
location
,
int
&
flag
,
unsigned
char
*&
qbuf
,
int
&
use_cache
);
protected:
DuelPlayer
*
players
[
4
];
...
...
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