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
3ff00b50
Commit
3ff00b50
authored
May 30, 2024
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update DuelMode::UpdateDeck
parent
27b2e125
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
gframe/network.h
gframe/network.h
+2
-0
gframe/single_duel.cpp
gframe/single_duel.cpp
+4
-4
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+4
-4
No files found.
gframe/network.h
View file @
3ff00b50
...
...
@@ -12,6 +12,8 @@
namespace
ygo
{
constexpr
int
SIZE_NETWORK_BUFFER
=
0x2000
;
constexpr
int
MAX_DATA_SIZE
=
SIZE_NETWORK_BUFFER
-
3
;
constexpr
int
MAINC_MAX
=
250
;
// the limit of card_state
constexpr
int
SIDEC_MAX
=
MAINC_MAX
;
struct
HostInfo
{
unsigned
int
lflist
{};
...
...
gframe/single_duel.cpp
View file @
3ff00b50
...
...
@@ -277,16 +277,16 @@ void SingleDuel::PlayerKick(DuelPlayer* dp, unsigned char pos) {
void
SingleDuel
::
UpdateDeck
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
{
if
(
dp
->
type
>
1
||
ready
[
dp
->
type
])
return
;
if
(
len
<
=
8
||
len
%
sizeof
(
int32_t
)
!=
0
)
if
(
len
<
8
)
return
;
bool
valid
=
true
;
auto
deckbuf
=
pdata
;
int
mainc
=
BufferIO
::
ReadInt32
(
deckbuf
);
int
sidec
=
BufferIO
::
ReadInt32
(
deckbuf
);
const
int
deck_size
=
len
-
2
*
sizeof
(
int32_t
);
if
(
mainc
<
DECK_MIN_SIZE
||
mainc
>
DECK_MAX_SIZE
+
EXTRA_MAX_SIZE
)
if
(
mainc
<
0
||
mainc
>
MAINC_MAX
)
valid
=
false
;
else
if
(
sidec
<
0
||
sidec
>
SIDE
_MAX_SIZE
)
else
if
(
sidec
<
0
||
sidec
>
SIDE
C_MAX
)
valid
=
false
;
else
if
(
deck_size
!=
(
mainc
+
sidec
)
*
(
int
)
sizeof
(
int32_t
))
valid
=
false
;
...
...
@@ -297,7 +297,7 @@ void SingleDuel::UpdateDeck(DuelPlayer* dp, unsigned char* pdata, int len) {
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_ERROR_MSG
,
scem
);
return
;
}
int
deck_list
[
DECK_MAX_SIZE
+
EXTRA_MAX_SIZE
+
SIDE_MAX_SIZE
];
int
deck_list
[
SIZE_NETWORK_BUFFER
/
sizeof
(
int32_t
)
];
std
::
memcpy
(
deck_list
,
deckbuf
,
deck_size
);
if
(
duel_count
==
0
)
{
deck_error
[
dp
->
type
]
=
deckManager
.
LoadDeck
(
pdeck
[
dp
->
type
],
deck_list
,
mainc
,
sidec
);
...
...
gframe/tag_duel.cpp
View file @
3ff00b50
...
...
@@ -260,16 +260,16 @@ void TagDuel::PlayerKick(DuelPlayer* dp, unsigned char pos) {
void
TagDuel
::
UpdateDeck
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
{
if
(
dp
->
type
>
3
||
ready
[
dp
->
type
])
return
;
if
(
len
<
=
8
||
len
%
sizeof
(
int32_t
)
!=
0
)
if
(
len
<
8
)
return
;
bool
valid
=
true
;
auto
deckbuf
=
pdata
;
int
mainc
=
BufferIO
::
ReadInt32
(
deckbuf
);
int
sidec
=
BufferIO
::
ReadInt32
(
deckbuf
);
const
int
deck_size
=
len
-
2
*
sizeof
(
int32_t
);
if
(
mainc
<
DECK_MIN_SIZE
||
mainc
>
DECK_MAX_SIZE
+
EXTRA_MAX_SIZE
)
if
(
mainc
<
0
||
mainc
>
MAINC_MAX
)
valid
=
false
;
else
if
(
sidec
<
0
||
sidec
>
SIDE
_MAX_SIZE
)
else
if
(
sidec
<
0
||
sidec
>
SIDE
C_MAX
)
valid
=
false
;
else
if
(
deck_size
!=
(
mainc
+
sidec
)
*
(
int
)
sizeof
(
int32_t
))
valid
=
false
;
...
...
@@ -280,7 +280,7 @@ void TagDuel::UpdateDeck(DuelPlayer* dp, unsigned char* pdata, int len) {
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_ERROR_MSG
,
scem
);
return
;
}
int
deck_list
[
DECK_MAX_SIZE
+
EXTRA_MAX_SIZE
+
SIDE_MAX_SIZE
];
int
deck_list
[
SIZE_NETWORK_BUFFER
/
sizeof
(
int32_t
)
];
std
::
memcpy
(
deck_list
,
deckbuf
,
deck_size
);
deck_error
[
dp
->
type
]
=
deckManager
.
LoadDeck
(
pdeck
[
dp
->
type
],
deck_list
,
mainc
,
sidec
);
}
...
...
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