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
0a8a4726
Commit
0a8a4726
authored
Jun 17, 2019
by
DailyShana
Committed by
nanahira
Jun 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
verify deck data (#2216)
parent
284bc470
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
6 deletions
+22
-6
gframe/netserver.cpp
gframe/netserver.cpp
+1
-1
gframe/network.h
gframe/network.h
+1
-1
gframe/single_duel.cpp
gframe/single_duel.cpp
+9
-1
gframe/single_duel.h
gframe/single_duel.h
+1
-1
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+9
-1
gframe/tag_duel.h
gframe/tag_duel.h
+1
-1
No files found.
gframe/netserver.cpp
View file @
0a8a4726
...
...
@@ -197,7 +197,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, char* data, unsigned int len) {
case
CTOS_UPDATE_DECK
:
{
if
(
!
dp
->
game
)
return
;
duel_mode
->
UpdateDeck
(
dp
,
pdata
);
duel_mode
->
UpdateDeck
(
dp
,
pdata
,
len
-
1
);
break
;
}
case
CTOS_HAND_RESULT
:
{
...
...
gframe/network.h
View file @
0a8a4726
...
...
@@ -123,7 +123,7 @@ public:
virtual
void
ToObserver
(
DuelPlayer
*
dp
)
{}
virtual
void
PlayerReady
(
DuelPlayer
*
dp
,
bool
is_ready
)
{}
virtual
void
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
)
{}
virtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
)
{}
virtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
,
unsigned
int
len
)
{}
virtual
void
StartDuel
(
DuelPlayer
*
dp
)
{}
virtual
void
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
)
{}
virtual
void
TPResult
(
DuelPlayer
*
dp
,
unsigned
char
tp
)
{}
...
...
gframe/single_duel.cpp
View file @
0a8a4726
...
...
@@ -280,12 +280,20 @@ void SingleDuel::PlayerKick(DuelPlayer* dp, unsigned char pos) {
return
;
LeaveGame
(
players
[
pos
]);
}
void
SingleDuel
::
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
)
{
void
SingleDuel
::
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
,
unsigned
int
len
)
{
if
(
dp
->
type
>
1
||
ready
[
dp
->
type
])
return
;
char
*
deckbuf
=
(
char
*
)
pdata
;
int
mainc
=
BufferIO
::
ReadInt32
(
deckbuf
);
int
sidec
=
BufferIO
::
ReadInt32
(
deckbuf
);
// verify data
if
((
unsigned
)
mainc
+
(
unsigned
)
sidec
>
(
len
-
8
)
/
4
)
{
STOC_ErrorMsg
scem
;
scem
.
msg
=
ERRMSG_DECKERROR
;
scem
.
code
=
DECKERROR_MAINCOUNT
<<
28
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_ERROR_MSG
,
scem
);
return
;
}
if
(
duel_count
==
0
)
{
deck_error
[
dp
->
type
]
=
deckManager
.
LoadDeck
(
pdeck
[
dp
->
type
],
(
int
*
)
deckbuf
,
mainc
,
sidec
);
}
else
{
...
...
gframe/single_duel.h
View file @
0a8a4726
...
...
@@ -18,7 +18,7 @@ public:
virtual
void
ToObserver
(
DuelPlayer
*
dp
);
virtual
void
PlayerReady
(
DuelPlayer
*
dp
,
bool
ready
);
virtual
void
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
);
virtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
);
virtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
,
unsigned
int
len
);
virtual
void
StartDuel
(
DuelPlayer
*
dp
);
virtual
void
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
);
virtual
void
TPResult
(
DuelPlayer
*
dp
,
unsigned
char
tp
);
...
...
gframe/tag_duel.cpp
View file @
0a8a4726
...
...
@@ -256,12 +256,20 @@ void TagDuel::PlayerKick(DuelPlayer* dp, unsigned char pos) {
return
;
LeaveGame
(
players
[
pos
]);
}
void
TagDuel
::
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
)
{
void
TagDuel
::
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
,
unsigned
int
len
)
{
if
(
dp
->
type
>
3
||
ready
[
dp
->
type
])
return
;
char
*
deckbuf
=
(
char
*
)
pdata
;
int
mainc
=
BufferIO
::
ReadInt32
(
deckbuf
);
int
sidec
=
BufferIO
::
ReadInt32
(
deckbuf
);
// verify data
if
((
unsigned
)
mainc
+
(
unsigned
)
sidec
>
(
len
-
8
)
/
4
)
{
STOC_ErrorMsg
scem
;
scem
.
msg
=
ERRMSG_DECKERROR
;
scem
.
code
=
DECKERROR_MAINCOUNT
<<
28
;
NetServer
::
SendPacketToPlayer
(
dp
,
STOC_ERROR_MSG
,
scem
);
return
;
}
deck_error
[
dp
->
type
]
=
deckManager
.
LoadDeck
(
pdeck
[
dp
->
type
],
(
int
*
)
deckbuf
,
mainc
,
sidec
);
}
void
TagDuel
::
StartDuel
(
DuelPlayer
*
dp
)
{
...
...
gframe/tag_duel.h
View file @
0a8a4726
...
...
@@ -18,7 +18,7 @@ public:
virtual
void
ToObserver
(
DuelPlayer
*
dp
);
virtual
void
PlayerReady
(
DuelPlayer
*
dp
,
bool
ready
);
virtual
void
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
);
virtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
);
virtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
void
*
pdata
,
unsigned
int
len
);
virtual
void
StartDuel
(
DuelPlayer
*
dp
);
virtual
void
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
);
virtual
void
TPResult
(
DuelPlayer
*
dp
,
unsigned
char
tp
);
...
...
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