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
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
baichixing
ygopro
Commits
bbec144b
Commit
bbec144b
authored
Dec 16, 2023
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SingleDuel: use inline function
parent
e94a2e03
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
25 deletions
+16
-25
gframe/single_duel.cpp
gframe/single_duel.cpp
+13
-25
gframe/single_duel.h
gframe/single_duel.h
+3
-0
No files found.
gframe/single_duel.cpp
View file @
bbec144b
...
...
@@ -1464,18 +1464,22 @@ void SingleDuel::TimeConfirm(DuelPlayer* dp) {
if
(
time_elapsed
<
10
)
time_elapsed
=
0
;
}
inline
int
SingleDuel
::
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
SingleDuel
::
RefreshMzone
(
int
player
,
int
flag
,
int
use_cache
)
{
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
unsigned
char
query_buffer
[
0x2000
];
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
,
qbuf
,
use_cache
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_MZONE
,
flag
,
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
int
qlen
=
0
;
while
(
qlen
<
len
)
{
...
...
@@ -1493,13 +1497,9 @@ void SingleDuel::RefreshMzone(int player, int flag, int use_cache) {
NetServer
::
ReSendToPlayer
(
*
pit
);
}
void
SingleDuel
::
RefreshSzone
(
int
player
,
int
flag
,
int
use_cache
)
{
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
unsigned
char
query_buffer
[
0x2000
];
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
,
qbuf
,
use_cache
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_SZONE
,
flag
,
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
int
qlen
=
0
;
while
(
qlen
<
len
)
{
...
...
@@ -1517,13 +1517,9 @@ void SingleDuel::RefreshSzone(int player, int flag, int use_cache) {
NetServer
::
ReSendToPlayer
(
*
pit
);
}
void
SingleDuel
::
RefreshHand
(
int
player
,
int
flag
,
int
use_cache
)
{
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
unsigned
char
query_buffer
[
0x2000
];
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
,
qbuf
,
use_cache
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_HAND
,
flag
,
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
int
qlen
=
0
;
while
(
qlen
<
len
)
{
...
...
@@ -1541,26 +1537,18 @@ void SingleDuel::RefreshHand(int player, int flag, int use_cache) {
NetServer
::
ReSendToPlayer
(
*
pit
);
}
void
SingleDuel
::
RefreshGrave
(
int
player
,
int
flag
,
int
use_cache
)
{
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
unsigned
char
query_buffer
[
0x2000
];
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
,
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
]);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
ReSendToPlayer
(
*
pit
);
}
void
SingleDuel
::
RefreshExtra
(
int
player
,
int
flag
,
int
use_cache
)
{
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
unsigned
char
query_buffer
[
0x2000
];
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
,
qbuf
,
use_cache
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_EXTRA
,
flag
,
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
}
void
SingleDuel
::
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
...
...
gframe/single_duel.h
View file @
bbec144b
...
...
@@ -40,6 +40,9 @@ public:
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
void
SingleTimer
(
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
[
2
];
...
...
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