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
42a427a4
Commit
42a427a4
authored
Jul 06, 2025
by
salix5
Committed by
GitHub
Jul 06, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use function template BufferIO::Read (#2835)
parent
3e2be8dd
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
886 additions
and
863 deletions
+886
-863
gframe/bufferio.h
gframe/bufferio.h
+31
-10
gframe/client_card.cpp
gframe/client_card.cpp
+34
-34
gframe/client_field.cpp
gframe/client_field.cpp
+2
-2
gframe/deck_con.cpp
gframe/deck_con.cpp
+5
-5
gframe/duelclient.cpp
gframe/duelclient.cpp
+423
-422
gframe/duelclient.h
gframe/duelclient.h
+6
-6
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+5
-5
gframe/netserver.cpp
gframe/netserver.cpp
+5
-4
gframe/netserver.h
gframe/netserver.h
+6
-6
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+63
-63
gframe/single_duel.cpp
gframe/single_duel.cpp
+118
-118
gframe/single_mode.cpp
gframe/single_mode.cpp
+67
-67
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+121
-121
No files found.
gframe/bufferio.h
View file @
42a427a4
...
...
@@ -2,31 +2,52 @@
#define BUFFERIO_H
#include <cstdint>
#include <cstring>
#include <cwchar>
#include "../ocgcore/buffer.h"
class
BufferIO
{
public:
static
int
ReadInt32
(
unsigned
char
*&
p
)
{
return
buffer_read
<
int32_t
>
(
p
);
template
<
typename
T
>
static
T
Read
(
unsigned
char
*&
p
)
{
T
ret
{};
std
::
memcpy
(
&
ret
,
p
,
sizeof
(
T
));
p
+=
sizeof
(
T
);
return
ret
;
}
template
<
typename
T
>
static
void
Write
(
unsigned
char
*&
p
,
T
value
)
{
std
::
memcpy
(
p
,
&
value
,
sizeof
(
T
));
p
+=
sizeof
(
T
);
}
// for compatibility
[[
deprecated
]]
static
int32_t
ReadInt32
(
unsigned
char
*&
p
)
{
return
Read
<
int32_t
>
(
p
);
}
[[
deprecated
]]
static
short
ReadInt16
(
unsigned
char
*&
p
)
{
return
buffer_r
ead
<
int16_t
>
(
p
);
return
R
ead
<
int16_t
>
(
p
);
}
[[
deprecated
]]
static
char
ReadInt8
(
unsigned
char
*&
p
)
{
return
buffer_r
ead
<
char
>
(
p
);
return
R
ead
<
char
>
(
p
);
}
[[
deprecated
]]
static
unsigned
char
ReadUInt8
(
unsigned
char
*&
p
)
{
return
buffer_r
ead
<
unsigned
char
>
(
p
);
return
R
ead
<
unsigned
char
>
(
p
);
}
static
void
WriteInt32
(
unsigned
char
*&
p
,
int
val
)
{
buffer_write
<
int32_t
>
(
p
,
val
);
[[
deprecated
]]
static
void
WriteInt32
(
unsigned
char
*&
p
,
int32_t
val
)
{
Write
<
int32_t
>
(
p
,
val
);
}
[[
deprecated
]]
static
void
WriteInt16
(
unsigned
char
*&
p
,
short
val
)
{
buffer_w
rite
<
int16_t
>
(
p
,
val
);
W
rite
<
int16_t
>
(
p
,
val
);
}
[[
deprecated
]]
static
void
WriteInt8
(
unsigned
char
*&
p
,
char
val
)
{
buffer_w
rite
<
char
>
(
p
,
val
);
W
rite
<
char
>
(
p
,
val
);
}
/**
* @brief Copy a C-style string to another C-style string.
...
...
gframe/client_card.cpp
View file @
42a427a4
...
...
@@ -39,13 +39,13 @@ void ClientCard::SetCode(unsigned int x) {
code
=
x
;
}
void
ClientCard
::
UpdateInfo
(
unsigned
char
*
buf
)
{
int
flag
=
BufferIO
::
Read
Int32
(
buf
);
int
flag
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
flag
==
0
)
{
ClearData
();
return
;
}
if
(
flag
&
QUERY_CODE
)
{
int
pdata
=
BufferIO
::
Read
Int32
(
buf
);
int
pdata
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
!
pdata
)
ClearData
();
if
((
location
==
LOCATION_HAND
)
&&
((
unsigned
int
)
pdata
!=
code
))
{
...
...
@@ -55,7 +55,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
code
=
pdata
;
}
if
(
flag
&
QUERY_POSITION
)
{
int
pdata
=
(
BufferIO
::
Read
Int32
(
buf
)
>>
24
)
&
0xff
;
int
pdata
=
(
BufferIO
::
Read
<
int32_t
>
(
buf
)
>>
24
)
&
0xff
;
if
((
location
&
(
LOCATION_EXTRA
|
LOCATION_REMOVED
))
&&
pdata
!=
position
)
{
position
=
pdata
;
mainGame
->
dField
.
MoveCard
(
this
,
1
);
...
...
@@ -63,29 +63,29 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
position
=
pdata
;
}
if
(
flag
&
QUERY_ALIAS
)
alias
=
BufferIO
::
Read
Int32
(
buf
);
alias
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
flag
&
QUERY_TYPE
)
type
=
BufferIO
::
Read
Int32
(
buf
);
type
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
flag
&
QUERY_LEVEL
)
{
int
pdata
=
BufferIO
::
Read
Int32
(
buf
);
int
pdata
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
level
!=
(
unsigned
int
)
pdata
)
{
level
=
pdata
;
myswprintf
(
lvstring
,
L"L%d"
,
level
);
}
}
if
(
flag
&
QUERY_RANK
)
{
int
pdata
=
BufferIO
::
Read
Int32
(
buf
);
int
pdata
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
pdata
&&
rank
!=
(
unsigned
int
)
pdata
)
{
rank
=
pdata
;
myswprintf
(
lvstring
,
L"R%d"
,
rank
);
}
}
if
(
flag
&
QUERY_ATTRIBUTE
)
attribute
=
BufferIO
::
Read
Int32
(
buf
);
attribute
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
flag
&
QUERY_RACE
)
race
=
BufferIO
::
Read
Int32
(
buf
);
race
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
flag
&
QUERY_ATTACK
)
{
attack
=
BufferIO
::
Read
Int32
(
buf
);
attack
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
attack
<
0
)
{
atkstring
[
0
]
=
'?'
;
atkstring
[
1
]
=
0
;
...
...
@@ -93,7 +93,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
myswprintf
(
atkstring
,
L"%d"
,
attack
);
}
if
(
flag
&
QUERY_DEFENSE
)
{
defense
=
BufferIO
::
Read
Int32
(
buf
);
defense
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
type
&
TYPE_LINK
)
{
defstring
[
0
]
=
'-'
;
defstring
[
1
]
=
0
;
...
...
@@ -104,18 +104,18 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
myswprintf
(
defstring
,
L"%d"
,
defense
);
}
if
(
flag
&
QUERY_BASE_ATTACK
)
base_attack
=
BufferIO
::
Read
Int32
(
buf
);
base_attack
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
flag
&
QUERY_BASE_DEFENSE
)
base_defense
=
BufferIO
::
Read
Int32
(
buf
);
base_defense
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
flag
&
QUERY_REASON
)
reason
=
BufferIO
::
Read
Int32
(
buf
);
reason
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
flag
&
QUERY_REASON_CARD
)
buf
+=
4
;
if
(
flag
&
QUERY_EQUIP_CARD
)
{
int
c
=
BufferIO
::
Read
UInt8
(
buf
);
unsigned
int
l
=
BufferIO
::
Read
UInt8
(
buf
);
int
s
=
BufferIO
::
Read
UInt8
(
buf
);
BufferIO
::
Read
UInt8
(
buf
);
int
c
=
BufferIO
::
Read
<
uint8_t
>
(
buf
);
unsigned
int
l
=
BufferIO
::
Read
<
uint8_t
>
(
buf
);
int
s
=
BufferIO
::
Read
<
uint8_t
>
(
buf
);
BufferIO
::
Read
<
uint8_t
>
(
buf
);
ClientCard
*
ecard
=
mainGame
->
dField
.
GetCard
(
mainGame
->
LocalPlayer
(
c
),
l
,
s
);
if
(
ecard
)
{
equipTarget
=
ecard
;
...
...
@@ -123,12 +123,12 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
}
}
if
(
flag
&
QUERY_TARGET_CARD
)
{
int
count
=
BufferIO
::
Read
Int32
(
buf
);
int
count
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
c
=
BufferIO
::
Read
UInt8
(
buf
);
unsigned
int
l
=
BufferIO
::
Read
UInt8
(
buf
);
int
s
=
BufferIO
::
Read
UInt8
(
buf
);
BufferIO
::
Read
UInt8
(
buf
);
int
c
=
BufferIO
::
Read
<
uint8_t
>
(
buf
);
unsigned
int
l
=
BufferIO
::
Read
<
uint8_t
>
(
buf
);
int
s
=
BufferIO
::
Read
<
uint8_t
>
(
buf
);
BufferIO
::
Read
<
uint8_t
>
(
buf
);
ClientCard
*
tcard
=
mainGame
->
dField
.
GetCard
(
mainGame
->
LocalPlayer
(
c
),
l
,
s
);
if
(
tcard
)
{
cardTarget
.
insert
(
tcard
);
...
...
@@ -137,38 +137,38 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
}
}
if
(
flag
&
QUERY_OVERLAY_CARD
)
{
int
count
=
BufferIO
::
Read
Int32
(
buf
);
int
count
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
overlayed
[
i
]
->
SetCode
(
BufferIO
::
Read
Int32
(
buf
));
overlayed
[
i
]
->
SetCode
(
BufferIO
::
Read
<
int32_t
>
(
buf
));
}
}
if
(
flag
&
QUERY_COUNTERS
)
{
int
count
=
BufferIO
::
Read
Int32
(
buf
);
int
count
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
ctype
=
BufferIO
::
Read
Int16
(
buf
);
int
ccount
=
BufferIO
::
Read
Int16
(
buf
);
int
ctype
=
BufferIO
::
Read
<
uint16_t
>
(
buf
);
int
ccount
=
BufferIO
::
Read
<
uint16_t
>
(
buf
);
counters
[
ctype
]
=
ccount
;
}
}
if
(
flag
&
QUERY_OWNER
)
owner
=
BufferIO
::
Read
Int32
(
buf
);
owner
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
flag
&
QUERY_STATUS
)
status
=
BufferIO
::
Read
Int32
(
buf
);
status
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
flag
&
QUERY_LSCALE
)
{
lscale
=
BufferIO
::
Read
Int32
(
buf
);
lscale
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
myswprintf
(
lscstring
,
L"%d"
,
lscale
);
}
if
(
flag
&
QUERY_RSCALE
)
{
rscale
=
BufferIO
::
Read
Int32
(
buf
);
rscale
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
myswprintf
(
rscstring
,
L"%d"
,
rscale
);
}
if
(
flag
&
QUERY_LINK
)
{
int
pdata
=
BufferIO
::
Read
Int32
(
buf
);
int
pdata
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
link
!=
(
unsigned
int
)
pdata
)
{
link
=
pdata
;
}
myswprintf
(
linkstring
,
L"L
\x2012
%d"
,
link
);
pdata
=
BufferIO
::
Read
Int32
(
buf
);
pdata
=
BufferIO
::
Read
<
int32_t
>
(
buf
);
if
(
link_marker
!=
(
unsigned
int
)
pdata
)
{
link_marker
=
pdata
;
}
...
...
gframe/client_field.cpp
View file @
42a427a4
...
...
@@ -317,7 +317,7 @@ ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) {
}
void
ClientField
::
UpdateCard
(
int
controler
,
int
location
,
int
sequence
,
unsigned
char
*
data
)
{
ClientCard
*
pcard
=
GetCard
(
controler
,
location
,
sequence
);
int
len
=
BufferIO
::
Read
Int32
(
data
);
int
len
=
BufferIO
::
Read
<
int32_t
>
(
data
);
if
(
pcard
&&
len
>
LEN_HEADER
)
pcard
->
UpdateInfo
(
data
);
}
...
...
@@ -350,7 +350,7 @@ void ClientField::UpdateFieldCard(int controler, int location, unsigned char* da
return
;
int
len
;
for
(
auto
cit
=
lst
->
begin
();
cit
!=
lst
->
end
();
++
cit
)
{
len
=
BufferIO
::
Read
Int32
(
data
);
len
=
BufferIO
::
Read
<
int32_t
>
(
data
);
if
(
len
>
LEN_HEADER
)
(
*
cit
)
->
UpdateInfo
(
data
);
data
+=
len
-
4
;
...
...
gframe/deck_con.cpp
View file @
42a427a4
...
...
@@ -698,14 +698,14 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame
->
ClearCardInfo
();
unsigned
char
deckbuf
[
1024
];
auto
pdeck
=
deckbuf
;
BufferIO
::
Write
Int32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
Write
Int32
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
BufferIO
::
Write
<
int32_t
>
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
Write
<
int32_t
>
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
main
.
size
();
++
i
)
BufferIO
::
Write
Int32
(
pdeck
,
deckManager
.
current_deck
.
main
[
i
]
->
first
);
BufferIO
::
Write
<
int32_t
>
(
pdeck
,
deckManager
.
current_deck
.
main
[
i
]
->
first
);
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
extra
.
size
();
++
i
)
BufferIO
::
Write
Int32
(
pdeck
,
deckManager
.
current_deck
.
extra
[
i
]
->
first
);
BufferIO
::
Write
<
int32_t
>
(
pdeck
,
deckManager
.
current_deck
.
extra
[
i
]
->
first
);
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
side
.
size
();
++
i
)
BufferIO
::
Write
Int32
(
pdeck
,
deckManager
.
current_deck
.
side
[
i
]
->
first
);
BufferIO
::
Write
<
int32_t
>
(
pdeck
,
deckManager
.
current_deck
.
side
[
i
]
->
first
);
DuelClient
::
SendBufferToServer
(
CTOS_UPDATE_DECK
,
deckbuf
,
pdeck
-
deckbuf
);
break
;
}
...
...
gframe/duelclient.cpp
View file @
42a427a4
...
...
@@ -249,7 +249,7 @@ int DuelClient::ClientThread() {
}
void
DuelClient
::
HandleSTOCPacketLan
(
unsigned
char
*
data
,
int
len
)
{
unsigned
char
*
pdata
=
data
;
unsigned
char
pktType
=
BufferIO
::
Read
UInt8
(
pdata
);
unsigned
char
pktType
=
BufferIO
::
Read
<
uint8_t
>
(
pdata
);
switch
(
pktType
)
{
case
STOC_GAME_MSG
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
unsigned
char
))
...
...
@@ -438,13 +438,13 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
if
(
len
<
1
+
(
int
)
sizeof
(
int16_t
)
*
6
)
return
;
mainGame
->
gMutex
.
lock
();
int
deckc
=
BufferIO
::
Read
Int16
(
pdata
);
int
extrac
=
BufferIO
::
Read
Int16
(
pdata
);
int
sidec
=
BufferIO
::
Read
Int16
(
pdata
);
int
deckc
=
BufferIO
::
Read
<
uint16_t
>
(
pdata
);
int
extrac
=
BufferIO
::
Read
<
uint16_t
>
(
pdata
);
int
sidec
=
BufferIO
::
Read
<
uint16_t
>
(
pdata
);
mainGame
->
dField
.
Initial
(
0
,
deckc
,
extrac
,
sidec
);
deckc
=
BufferIO
::
Read
Int16
(
pdata
);
extrac
=
BufferIO
::
Read
Int16
(
pdata
);
sidec
=
BufferIO
::
Read
Int16
(
pdata
);
deckc
=
BufferIO
::
Read
<
uint16_t
>
(
pdata
);
extrac
=
BufferIO
::
Read
<
uint16_t
>
(
pdata
);
sidec
=
BufferIO
::
Read
<
uint16_t
>
(
pdata
);
mainGame
->
dField
.
Initial
(
1
,
deckc
,
extrac
,
sidec
);
mainGame
->
gMutex
.
unlock
();
break
;
...
...
@@ -791,9 +791,10 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
const
int
chat_msg_size
=
len
-
1
-
sizeof
(
uint16_t
);
if
(
chat_msg_size
%
sizeof
(
uint16_t
))
return
;
uint16_t
chat_player_type
=
buffer_r
ead
<
uint16_t
>
(
pdata
);
uint16_t
chat_player_type
=
BufferIO
::
R
ead
<
uint16_t
>
(
pdata
);
uint16_t
chat_msg
[
LEN_CHAT_MSG
];
buffer_read_block
(
pdata
,
chat_msg
,
chat_msg_size
);
std
::
memcpy
(
chat_msg
,
pdata
,
chat_msg_size
);
pdata
+=
chat_msg_size
;
const
int
chat_msg_len
=
chat_msg_size
/
sizeof
(
uint16_t
);
if
(
chat_msg
[
chat_msg_len
-
1
]
!=
0
)
return
;
...
...
@@ -952,7 +953,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
bool
DuelClient
::
ClientAnalyze
(
unsigned
char
*
msg
,
int
len
)
{
unsigned
char
*
pbuf
=
msg
;
wchar_t
textBuffer
[
256
];
mainGame
->
dInfo
.
curMsg
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dInfo
.
curMsg
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
mainGame
->
dInfo
.
curMsg
!=
MSG_RETRY
)
{
std
::
memcpy
(
last_successful_msg
,
msg
,
len
);
last_successful_msg_length
=
len
;
...
...
@@ -986,7 +987,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
case
MSG_RETRY
:
{
if
(
last_successful_msg_length
)
{
auto
p
=
last_successful_msg
;
auto
last_msg
=
BufferIO
::
Read
UInt8
(
p
);
auto
last_msg
=
BufferIO
::
Read
<
uint8_t
>
(
p
);
int
err_desc
=
1421
;
switch
(
last_msg
)
{
case
MSG_ANNOUNCE_CARD
:
...
...
@@ -1071,9 +1072,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_HINT
:
{
int
type
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
data
=
BufferIO
::
Read
Int32
(
pbuf
);
int
type
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
data
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
switch
(
type
)
{
...
...
@@ -1206,8 +1207,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
case
MSG_WIN
:
{
mainGame
->
dInfo
.
isFinished
=
true
;
int
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
type
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
type
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
showcarddif
=
110
;
mainGame
->
showcardp
=
0
;
mainGame
->
dInfo
.
vic_string
=
L""
;
...
...
@@ -1258,7 +1259,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame
->
gMutex
.
lock
();
mainGame
->
dField
.
Clear
();
mainGame
->
dInfo
.
isInDuel
=
true
;
int
playertype
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
playertype
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dInfo
.
isFirst
=
(
playertype
&
0xf
)
?
false
:
true
;
if
(
playertype
&
0xf0
)
mainGame
->
dInfo
.
player_type
=
7
;
...
...
@@ -1268,16 +1269,16 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
else
mainGame
->
dInfo
.
tag_player
[
0
]
=
true
;
}
mainGame
->
dInfo
.
duel_rule
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dInfo
.
lp
[
mainGame
->
LocalPlayer
(
0
)]
=
BufferIO
::
Read
Int32
(
pbuf
);
mainGame
->
dInfo
.
lp
[
mainGame
->
LocalPlayer
(
1
)]
=
BufferIO
::
Read
Int32
(
pbuf
);
mainGame
->
dInfo
.
duel_rule
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dInfo
.
lp
[
mainGame
->
LocalPlayer
(
0
)]
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
mainGame
->
dInfo
.
lp
[
mainGame
->
LocalPlayer
(
1
)]
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
0
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
0
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
1
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
1
]);
int
deckc
=
BufferIO
::
Read
Int16
(
pbuf
);
int
extrac
=
BufferIO
::
Read
Int16
(
pbuf
);
int
deckc
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
int
extrac
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
mainGame
->
dField
.
Initial
(
mainGame
->
LocalPlayer
(
0
),
deckc
,
extrac
);
deckc
=
BufferIO
::
Read
Int16
(
pbuf
);
extrac
=
BufferIO
::
Read
Int16
(
pbuf
);
deckc
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
extrac
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
mainGame
->
dField
.
Initial
(
mainGame
->
LocalPlayer
(
1
),
deckc
,
extrac
);
mainGame
->
dInfo
.
turn
=
0
;
mainGame
->
dInfo
.
is_shuffling
=
false
;
...
...
@@ -1295,37 +1296,37 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_UPDATE_DATA
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
location
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
location
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
gMutex
.
lock
();
mainGame
->
dField
.
UpdateFieldCard
(
player
,
location
,
pbuf
);
mainGame
->
gMutex
.
unlock
();
return
true
;
}
case
MSG_UPDATE_CARD
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
seq
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
seq
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
gMutex
.
lock
();
mainGame
->
dField
.
UpdateCard
(
player
,
loc
,
seq
,
pbuf
);
mainGame
->
gMutex
.
unlock
();
break
;
}
case
MSG_SELECT_BATTLECMD
:
{
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
desc
,
count
,
con
,
seq
/*, diratt*/
;
unsigned
int
code
,
loc
;
ClientCard
*
pcard
;
mainGame
->
dField
.
activatable_cards
.
clear
();
mainGame
->
dField
.
activatable_descs
.
clear
();
mainGame
->
dField
.
conti_cards
.
clear
();
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
BufferIO
::
Read
Int32
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
seq
=
BufferIO
::
Read
UInt8
(
pbuf
);
desc
=
BufferIO
::
Read
Int32
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
seq
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
desc
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
con
,
loc
,
seq
);
int
flag
=
0
;
if
(
code
&
0x80000000
)
{
...
...
@@ -1349,24 +1350,24 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
}
mainGame
->
dField
.
attackable_cards
.
clear
();
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
/*code = */
BufferIO
::
Read
Int32
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
seq
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*diratt = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*code = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
seq
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*diratt = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
con
,
loc
,
seq
);
mainGame
->
dField
.
attackable_cards
.
push_back
(
pcard
);
pcard
->
cmdFlag
|=
COMMAND_ATTACK
;
}
mainGame
->
gMutex
.
lock
();
if
(
BufferIO
::
Read
UInt8
(
pbuf
))
{
if
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
))
{
mainGame
->
btnM2
->
setVisible
(
true
);
mainGame
->
btnM2
->
setEnabled
(
true
);
mainGame
->
btnM2
->
setPressed
(
false
);
}
if
(
BufferIO
::
Read
UInt8
(
pbuf
))
{
if
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
))
{
mainGame
->
btnEP
->
setVisible
(
true
);
mainGame
->
btnEP
->
setEnabled
(
true
);
mainGame
->
btnEP
->
setPressed
(
false
);
...
...
@@ -1375,28 +1376,28 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_SELECT_IDLECMD
:
{
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
desc
,
count
,
con
,
seq
;
unsigned
int
code
,
loc
;
ClientCard
*
pcard
;
mainGame
->
dField
.
summonable_cards
.
clear
();
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
BufferIO
::
Read
Int32
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
seq
=
BufferIO
::
Read
UInt8
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
seq
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
con
,
loc
,
seq
);
mainGame
->
dField
.
summonable_cards
.
push_back
(
pcard
);
pcard
->
cmdFlag
|=
COMMAND_SUMMON
;
}
mainGame
->
dField
.
spsummonable_cards
.
clear
();
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
BufferIO
::
Read
Int32
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
seq
=
BufferIO
::
Read
UInt8
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
seq
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
con
,
loc
,
seq
);
mainGame
->
dField
.
spsummonable_cards
.
push_back
(
pcard
);
pcard
->
cmdFlag
|=
COMMAND_SPSUMMON
;
...
...
@@ -1416,34 +1417,34 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
}
mainGame
->
dField
.
reposable_cards
.
clear
();
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
BufferIO
::
Read
Int32
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
seq
=
BufferIO
::
Read
UInt8
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
seq
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
con
,
loc
,
seq
);
mainGame
->
dField
.
reposable_cards
.
push_back
(
pcard
);
pcard
->
cmdFlag
|=
COMMAND_REPOS
;
}
mainGame
->
dField
.
msetable_cards
.
clear
();
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
BufferIO
::
Read
Int32
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
seq
=
BufferIO
::
Read
UInt8
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
seq
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
con
,
loc
,
seq
);
mainGame
->
dField
.
msetable_cards
.
push_back
(
pcard
);
pcard
->
cmdFlag
|=
COMMAND_MSET
;
}
mainGame
->
dField
.
ssetable_cards
.
clear
();
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
BufferIO
::
Read
Int32
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
seq
=
BufferIO
::
Read
UInt8
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
seq
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
con
,
loc
,
seq
);
mainGame
->
dField
.
ssetable_cards
.
push_back
(
pcard
);
pcard
->
cmdFlag
|=
COMMAND_SSET
;
...
...
@@ -1451,13 +1452,13 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame
->
dField
.
activatable_cards
.
clear
();
mainGame
->
dField
.
activatable_descs
.
clear
();
mainGame
->
dField
.
conti_cards
.
clear
();
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
BufferIO
::
Read
Int32
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
seq
=
BufferIO
::
Read
UInt8
(
pbuf
);
desc
=
BufferIO
::
Read
Int32
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
con
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
seq
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
desc
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
con
,
loc
,
seq
);
int
flag
=
0
;
if
(
code
&
0x80000000
)
{
...
...
@@ -1480,17 +1481,17 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame
->
dField
.
extra_act
[
con
]
=
true
;
}
}
if
(
BufferIO
::
Read
UInt8
(
pbuf
))
{
if
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
))
{
mainGame
->
btnBP
->
setVisible
(
true
);
mainGame
->
btnBP
->
setEnabled
(
true
);
mainGame
->
btnBP
->
setPressed
(
false
);
}
if
(
BufferIO
::
Read
UInt8
(
pbuf
))
{
if
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
))
{
mainGame
->
btnEP
->
setVisible
(
true
);
mainGame
->
btnEP
->
setEnabled
(
true
);
mainGame
->
btnEP
->
setPressed
(
false
);
}
if
(
BufferIO
::
Read
UInt8
(
pbuf
))
{
if
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
))
{
mainGame
->
btnShuffle
->
setVisible
(
true
);
}
else
{
mainGame
->
btnShuffle
->
setVisible
(
false
);
...
...
@@ -1498,20 +1499,20 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_SELECT_EFFECTYN
:
{
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
l
!=
LOCATION_DECK
)
{
pcard
->
is_highlighting
=
true
;
mainGame
->
dField
.
highlighting_card
=
pcard
;
}
int
desc
=
BufferIO
::
Read
Int32
(
pbuf
);
int
desc
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
if
(
desc
==
0
)
{
wchar_t
ynbuf
[
256
];
myswprintf
(
ynbuf
,
dataManager
.
GetSysString
(
200
),
dataManager
.
FormatLocation
(
l
,
s
),
dataManager
.
GetName
(
code
));
...
...
@@ -1532,8 +1533,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_SELECT_YESNO
:
{
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
desc
=
BufferIO
::
Read
Int32
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
desc
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
mainGame
->
dField
.
highlighting_card
=
0
;
mainGame
->
gMutex
.
lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
guiFont
,
dataManager
.
GetDesc
(
desc
));
...
...
@@ -1542,21 +1543,21 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_SELECT_OPTION
:
{
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
select_options
.
clear
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
mainGame
->
dField
.
select_options
.
push_back
(
BufferIO
::
Read
Int32
(
pbuf
));
mainGame
->
dField
.
select_options
.
push_back
(
BufferIO
::
Read
<
int32_t
>
(
pbuf
));
mainGame
->
dField
.
ShowSelectOption
(
select_hint
);
select_hint
=
0
;
return
false
;
}
case
MSG_SELECT_CARD
:
{
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dField
.
select_cancelable
=
BufferIO
::
Read
UInt8
(
pbuf
)
!=
0
;
mainGame
->
dField
.
select_min
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dField
.
select_max
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
select_cancelable
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
)
!=
0
;
mainGame
->
dField
.
select_min
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
select_max
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
selectable_cards
.
clear
();
mainGame
->
dField
.
selected_cards
.
clear
();
int
c
,
s
,
ss
;
...
...
@@ -1569,11 +1570,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame
->
dField
.
select_ready
=
select_ready
;
ClientCard
*
pcard
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
BufferIO
::
Read
Int32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
ss
=
BufferIO
::
Read
UInt8
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ss
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
l
&
LOCATION_OVERLAY
)
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
&
0x7f
,
s
)
->
overlayed
[
ss
];
else
...
...
@@ -1616,13 +1617,13 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_SELECT_UNSELECT_CARD
:
{
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
bool
finishable
=
BufferIO
::
Read
UInt8
(
pbuf
)
!=
0
;
bool
cancelable
=
BufferIO
::
Read
UInt8
(
pbuf
)
!=
0
;
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
bool
finishable
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
)
!=
0
;
bool
cancelable
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
)
!=
0
;
mainGame
->
dField
.
select_cancelable
=
finishable
||
cancelable
;
mainGame
->
dField
.
select_min
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dField
.
select_max
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
count1
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dField
.
select_min
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
select_max
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count1
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
selectable_cards
.
clear
();
mainGame
->
dField
.
selected_cards
.
clear
();
int
c
,
s
,
ss
;
...
...
@@ -1634,11 +1635,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame
->
dField
.
select_ready
=
false
;
ClientCard
*
pcard
;
for
(
int
i
=
0
;
i
<
count1
;
++
i
)
{
code
=
(
unsigned
int
)
BufferIO
::
Read
Int32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
ss
=
BufferIO
::
Read
UInt8
(
pbuf
);
code
=
(
unsigned
int
)
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ss
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
l
&
LOCATION_OVERLAY
)
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
&
0x7f
,
s
)
->
overlayed
[
ss
];
else
...
...
@@ -1656,13 +1657,13 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
panelmode
=
true
;
}
}
int
count2
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
count2
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
count1
;
i
<
count1
+
count2
;
++
i
)
{
code
=
(
unsigned
int
)
BufferIO
::
Read
Int32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
ss
=
BufferIO
::
Read
UInt8
(
pbuf
);
code
=
(
unsigned
int
)
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ss
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
l
&
LOCATION_OVERLAY
)
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
&
0x7f
,
s
)
->
overlayed
[
ss
];
else
...
...
@@ -1711,11 +1712,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_SELECT_CHAIN
:
{
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
specount
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int hint0 = */
BufferIO
::
Read
Int32
(
pbuf
);
/*int hint1 = */
BufferIO
::
Read
Int32
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
specount
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int hint0 = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
/*int hint1 = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
c
,
s
,
ss
,
desc
;
unsigned
int
code
,
l
;
ClientCard
*
pcard
;
...
...
@@ -1727,15 +1728,15 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame
->
dField
.
activatable_descs
.
clear
();
mainGame
->
dField
.
conti_cards
.
clear
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
flag
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
forced
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
flag
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
forced
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
flag
|=
forced
<<
8
;
code
=
BufferIO
::
Read
Int32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
ss
=
BufferIO
::
Read
UInt8
(
pbuf
);
desc
=
BufferIO
::
Read
Int32
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ss
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
desc
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
,
ss
);
mainGame
->
dField
.
activatable_cards
.
push_back
(
pcard
);
mainGame
->
dField
.
activatable_descs
.
push_back
(
std
::
make_pair
(
desc
,
flag
));
...
...
@@ -1818,12 +1819,12 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
case
MSG_SELECT_PLACE
:
case
MSG_SELECT_DISFIELD
:
{
int
selecting_player
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
selecting_player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
select_min
=
count
>
0
?
count
:
1
;
mainGame
->
dField
.
select_ready
=
false
;
mainGame
->
dField
.
select_cancelable
=
count
==
0
;
mainGame
->
dField
.
selectable_field
=
~
BufferIO
::
Read
Int32
(
pbuf
);
mainGame
->
dField
.
selectable_field
=
~
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
if
(
selecting_player
==
mainGame
->
LocalPlayer
(
1
))
mainGame
->
dField
.
selectable_field
=
(
mainGame
->
dField
.
selectable_field
>>
16
)
|
(
mainGame
->
dField
.
selectable_field
<<
16
);
mainGame
->
dField
.
selected_field
=
0
;
...
...
@@ -1904,9 +1905,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_SELECT_POSITION
:
{
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
Read
Int32
(
pbuf
);
unsigned
int
positions
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
unsigned
int
positions
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
positions
==
0x1
||
positions
==
0x2
||
positions
==
0x4
||
positions
==
0x8
)
{
SetResponseI
(
positions
);
return
true
;
...
...
@@ -1947,11 +1948,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_SELECT_TRIBUTE
:
{
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dField
.
select_cancelable
=
BufferIO
::
Read
UInt8
(
pbuf
)
!=
0
;
mainGame
->
dField
.
select_min
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dField
.
select_max
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
select_cancelable
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
)
!=
0
;
mainGame
->
dField
.
select_min
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
select_max
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
selectable_cards
.
clear
();
mainGame
->
dField
.
selected_cards
.
clear
();
mainGame
->
dField
.
selectsum_all
.
clear
();
...
...
@@ -1962,11 +1963,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
ClientCard
*
pcard
;
mainGame
->
dField
.
select_ready
=
false
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
(
unsigned
int
)
BufferIO
::
Read
Int32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
t
=
BufferIO
::
Read
UInt8
(
pbuf
);
code
=
(
unsigned
int
)
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
t
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
&&
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
...
...
@@ -1992,20 +1993,20 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_SELECT_COUNTER
:
{
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dField
.
select_counter_type
=
BufferIO
::
Read
Int16
(
pbuf
);
mainGame
->
dField
.
select_counter_count
=
BufferIO
::
Read
Int16
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
select_counter_type
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
mainGame
->
dField
.
select_counter_count
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
selectable_cards
.
clear
();
int
c
,
s
,
t
/*, code*/
;
unsigned
int
l
;
ClientCard
*
pcard
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
/*code = */
BufferIO
::
Read
Int32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
t
=
BufferIO
::
Read
Int16
(
pbuf
);
/*code = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
t
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
mainGame
->
dField
.
selectable_cards
.
push_back
(
pcard
);
pcard
->
opParam
=
(
t
<<
16
)
|
t
;
...
...
@@ -2019,38 +2020,38 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_SELECT_SUM
:
{
mainGame
->
dField
.
select_mode
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dField
.
select_sumval
=
BufferIO
::
Read
Int32
(
pbuf
);
mainGame
->
dField
.
select_min
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dField
.
select_max
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dField
.
must_select_count
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dField
.
select_mode
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int selecting_player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
select_sumval
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
mainGame
->
dField
.
select_min
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
select_max
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
must_select_count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
selectsum_all
.
clear
();
mainGame
->
dField
.
selected_cards
.
clear
();
mainGame
->
dField
.
selectsum_cards
.
clear
();
mainGame
->
dField
.
select_panalmode
=
false
;
for
(
int
i
=
0
;
i
<
mainGame
->
dField
.
must_select_count
;
++
i
)
{
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
Read
Int32
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
!=
0
&&
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
pcard
->
opParam
=
BufferIO
::
Read
Int32
(
pbuf
);
pcard
->
opParam
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
pcard
->
select_seq
=
0
;
mainGame
->
dField
.
selected_cards
.
push_back
(
pcard
);
}
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
Read
Int32
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
!=
0
&&
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
pcard
->
opParam
=
BufferIO
::
Read
Int32
(
pbuf
);
pcard
->
opParam
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
pcard
->
select_seq
=
i
;
mainGame
->
dField
.
selectsum_all
.
push_back
(
pcard
);
if
((
l
&
0xe
)
==
0
)
...
...
@@ -2062,8 +2063,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
mainGame
->
dField
.
ShowSelectSum
(
mainGame
->
dField
.
select_panalmode
);
}
case
MSG_SORT_CARD
:
{
/*int player = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
selectable_cards
.
clear
();
mainGame
->
dField
.
selected_cards
.
clear
();
mainGame
->
dField
.
sort_list
.
clear
();
...
...
@@ -2071,10 +2072,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
unsigned
int
code
,
l
;
ClientCard
*
pcard
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
(
unsigned
int
)
BufferIO
::
Read
Int32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
code
=
(
unsigned
int
)
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
!=
0
&&
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
...
...
@@ -2088,13 +2089,13 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_CONFIRM_DECKTOP
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
unsigned
int
code
;
ClientCard
*
pcard
;
mainGame
->
dField
.
selectable_cards
.
clear
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
BufferIO
::
Read
Int32
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
pbuf
+=
3
;
pcard
=
*
(
mainGame
->
dField
.
deck
[
player
].
rbegin
()
+
i
);
if
(
code
!=
0
)
...
...
@@ -2126,13 +2127,13 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_CONFIRM_EXTRATOP
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
unsigned
int
code
;
ClientCard
*
pcard
;
mainGame
->
dField
.
selectable_cards
.
clear
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
BufferIO
::
Read
Int32
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
pbuf
+=
3
;
pcard
=
*
(
mainGame
->
dField
.
extra
[
player
].
rbegin
()
+
i
+
mainGame
->
dField
.
extra_p_count
[
player
]);
if
(
code
!=
0
)
...
...
@@ -2163,9 +2164,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_CONFIRM_CARDS
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
skip_panel
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
skip_panel
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
c
,
s
;
unsigned
int
code
,
l
;
std
::
vector
<
ClientCard
*>
field_confirm
;
...
...
@@ -2179,10 +2180,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
208
),
count
);
mainGame
->
AddLog
(
textBuffer
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
code
=
BufferIO
::
Read
Int32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
!=
0
)
pcard
->
SetCode
(
code
);
...
...
@@ -2265,7 +2266,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_SHUFFLE_DECK
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
if
(
mainGame
->
dField
.
deck
[
player
].
size
()
<
2
)
return
true
;
bool
rev
=
mainGame
->
dField
.
deck_reversed
;
...
...
@@ -2304,8 +2305,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_SHUFFLE_HAND
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
count
>
1
)
soundManager
.
PlaySoundEffect
(
SOUND_SHUFFLE
);
...
...
@@ -2334,7 +2335,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame
->
WaitFrameSignal
(
11
);
}
for
(
auto
cit
=
mainGame
->
dField
.
hand
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
hand
[
player
].
end
();
++
cit
)
{
(
*
cit
)
->
SetCode
(
BufferIO
::
Read
Int32
(
pbuf
));
(
*
cit
)
->
SetCode
(
BufferIO
::
Read
<
int32_t
>
(
pbuf
));
(
*
cit
)
->
desc_hints
.
clear
();
}
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
...
...
@@ -2347,8 +2348,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_SHUFFLE_EXTRA
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
((
mainGame
->
dField
.
extra
[
player
].
size
()
-
mainGame
->
dField
.
extra_p_count
[
player
])
<
2
)
return
true
;
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
...
...
@@ -2372,15 +2373,15 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
for
(
auto
cit
=
mainGame
->
dField
.
extra
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
extra
[
player
].
end
();
++
cit
)
if
(
!
((
*
cit
)
->
position
&
POS_FACEUP
))
(
*
cit
)
->
SetCode
(
BufferIO
::
Read
Int32
(
pbuf
));
(
*
cit
)
->
SetCode
(
BufferIO
::
Read
<
int32_t
>
(
pbuf
));
return
true
;
}
case
MSG_REFRESH_DECK
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
return
true
;
}
case
MSG_SWAP_GRAVE_DECK
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
dField
.
grave
[
player
].
swap
(
mainGame
->
dField
.
deck
[
player
]);
for
(
auto
cit
=
mainGame
->
dField
.
grave
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
grave
[
player
].
end
();
++
cit
)
...
...
@@ -2434,9 +2435,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_DECK_TOP
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
seq
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
seq
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
player
,
LOCATION_DECK
,
mainGame
->
dField
.
deck
[
player
].
size
()
-
1
-
seq
);
pcard
->
SetCode
(
code
&
0x7fffffff
);
bool
rev
=
(
code
&
0x80000000
)
!=
0
;
...
...
@@ -2448,8 +2449,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
case
MSG_SHUFFLE_SET_CARD
:
{
std
::
vector
<
ClientCard
*>*
lst
=
0
;
unsigned
int
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
loc
==
LOCATION_MZONE
)
lst
=
mainGame
->
dField
.
mzone
;
else
...
...
@@ -2459,10 +2460,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
int
c
,
s
,
ps
;
unsigned
int
l
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mc
[
i
]
=
lst
[
c
][
s
];
mc
[
i
]
->
SetCode
(
0
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
...
...
@@ -2475,10 +2476,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
mainGame
->
WaitFrameSignal
(
20
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ps
=
mc
[
i
]
->
sequence
;
if
(
l
>
0
)
{
swp
=
lst
[
c
][
s
];
...
...
@@ -2500,7 +2501,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_NEW_TURN
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
mainGame
->
dInfo
.
turn
++
;
if
(
!
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
player_type
<
7
)
{
mainGame
->
dField
.
tag_surrender
=
false
;
...
...
@@ -2540,7 +2541,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_NEW_PHASE
:
{
unsigned
short
phase
=
BufferIO
::
Read
Int16
(
pbuf
);
unsigned
short
phase
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
mainGame
->
btnPhaseStatus
->
setVisible
(
false
);
mainGame
->
btnBP
->
setVisible
(
false
);
mainGame
->
btnM2
->
setVisible
(
false
);
...
...
@@ -2585,16 +2586,16 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_MOVE
:
{
unsigned
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
int
pc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
pl
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
ps
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
pp
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
cl
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
cs
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
cp
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
reason
=
BufferIO
::
Read
Int32
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
pc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
pl
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
ps
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
unsigned
int
pp
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
cl
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
cs
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
unsigned
int
cp
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
reason
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
cl
&
LOCATION_REMOVED
&&
pl
!=
cl
)
soundManager
.
PlaySoundEffect
(
SOUND_BANISHED
);
...
...
@@ -2801,12 +2802,12 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_POS_CHANGE
:
{
unsigned
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
cl
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
cs
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
pp
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
cp
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
cl
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
cs
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
unsigned
int
pp
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
unsigned
int
cp
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
cc
,
cl
,
cs
);
if
((
pp
&
POS_FACEUP
)
&&
(
cp
&
POS_FACEDOWN
))
{
pcard
->
counters
.
clear
();
...
...
@@ -2823,27 +2824,27 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_SET
:
{
/*int code = */
BufferIO
::
Read
Int32
(
pbuf
);
/*int cc = mainGame->LocalPlayer*/
(
BufferIO
::
Read
UInt8
(
pbuf
));
/*int cl = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int cs = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int cp = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int code = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
/*int cc = mainGame->LocalPlayer*/
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
/*int cl = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int cs = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int cp = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
soundManager
.
PlaySoundEffect
(
SOUND_SET
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1601
));
return
true
;
}
case
MSG_SWAP
:
{
/*int code1 = */
BufferIO
::
Read
Int32
(
pbuf
);
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l1
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s1
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int p1 = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int code2 = */
BufferIO
::
Read
Int32
(
pbuf
);
int
c2
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l2
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s2
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int p2 = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int code1 = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l1
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s1
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int p1 = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int code2 = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
c2
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l2
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s2
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int p2 = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1602
));
ClientCard
*
pc1
=
mainGame
->
dField
.
GetCard
(
c1
,
l1
,
s1
);
ClientCard
*
pc2
=
mainGame
->
dField
.
GetCard
(
c2
,
l2
,
s2
);
...
...
@@ -2870,18 +2871,18 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_FIELD_DISABLED
:
{
unsigned
int
disabled
=
BufferIO
::
Read
Int32
(
pbuf
);
unsigned
int
disabled
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isFirst
)
disabled
=
(
disabled
>>
16
)
|
(
disabled
<<
16
);
mainGame
->
dField
.
disabled_field
=
disabled
;
return
true
;
}
case
MSG_SUMMONING
:
{
unsigned
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
/*int cc = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
/*int cl = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int cs = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int cp = */
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
/*int cc = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
/*int cl = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int cs = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int cp = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
soundManager
.
PlaySoundEffect
(
SOUND_SUMMON
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1603
),
dataManager
.
GetName
(
code
));
...
...
@@ -2900,11 +2901,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_SPSUMMONING
:
{
unsigned
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
/*int cc = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
/*int cl = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int cs = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int cp = */
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
/*int cc = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
/*int cl = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int cs = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int cp = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
CardData
cd
;
if
(
dataManager
.
GetData
(
code
,
&
cd
)
&&
(
cd
.
type
&
TYPE_TOKEN
))
...
...
@@ -2926,11 +2927,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_FLIPSUMMONING
:
{
unsigned
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
cl
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
cs
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
cp
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
cl
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
cs
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
unsigned
int
cp
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
cc
,
cl
,
cs
);
pcard
->
SetCode
(
code
);
pcard
->
position
=
cp
;
...
...
@@ -2954,16 +2955,16 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_CHAINING
:
{
unsigned
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
int
pcc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
pcl
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
pcs
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
subs
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
cl
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
cs
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
desc
=
BufferIO
::
Read
Int32
(
pbuf
);
/*int ct = */
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
pcc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
pcl
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
pcs
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
subs
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
cl
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
cs
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
desc
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
/*int ct = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
soundManager
.
PlaySoundEffect
(
SOUND_ACTIVATE
);
...
...
@@ -3014,7 +3015,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_CHAINED
:
{
int
ct
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
ct
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1609
),
dataManager
.
GetName
(
mainGame
->
dField
.
current_chain
.
code
));
...
...
@@ -3027,7 +3028,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_CHAIN_SOLVING
:
{
int
ct
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
ct
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
if
(
mainGame
->
dField
.
chains
.
size
()
>
1
||
mainGame
->
gameConf
.
draw_single_chain
)
{
...
...
@@ -3044,7 +3045,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_CHAIN_SOLVED
:
{
/*int ct = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*int ct = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
return
true
;
}
case
MSG_CHAIN_END
:
{
...
...
@@ -3058,7 +3059,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
case
MSG_CHAIN_NEGATED
:
case
MSG_CHAIN_DISABLED
:
{
int
ct
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
ct
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
soundManager
.
PlaySoundEffect
(
SOUND_NEGATE
);
mainGame
->
showcardcode
=
mainGame
->
dField
.
chains
[
ct
-
1
].
code
;
...
...
@@ -3073,8 +3074,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_RANDOM_SELECTED
:
{
/*int player = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int player = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
pbuf
+=
count
*
4
;
return
true
;
...
...
@@ -3082,10 +3083,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
soundManager
.
PlaySoundEffect
(
SOUND_DICE
);
ClientCard
*
pcards
[
10
];
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
ss
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
ss
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
l
&
LOCATION_OVERLAY
)
pcards
[
i
]
=
mainGame
->
dField
.
GetCard
(
c
,
l
&
0x7f
,
s
)
->
overlayed
[
ss
];
else
...
...
@@ -3099,16 +3100,16 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
case
MSG_BECOME_TARGET
:
{
//soundManager.PlaySoundEffect(SOUND_TARGET);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
pbuf
+=
count
*
4
;
return
true
;
}
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int ss = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int ss = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
pcard
->
is_highlighting
=
true
;
mainGame
->
dField
.
current_chain
.
target
.
insert
(
pcard
);
...
...
@@ -3137,11 +3138,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_DRAW
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ClientCard
*
pcard
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
unsigned
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
player
,
LOCATION_DECK
,
mainGame
->
dField
.
deck
[
player
].
size
()
-
1
-
i
);
if
(
!
mainGame
->
dField
.
deck_reversed
||
code
)
pcard
->
SetCode
(
code
&
0x7fffffff
);
...
...
@@ -3171,8 +3172,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_DAMAGE
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
val
=
BufferIO
::
Read
Int32
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
val
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
final
=
mainGame
->
dInfo
.
lp
[
player
]
-
val
;
if
(
final
<
0
)
final
=
0
;
...
...
@@ -3202,8 +3203,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_RECOVER
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
val
=
BufferIO
::
Read
Int32
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
val
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
final
=
mainGame
->
dInfo
.
lp
[
player
]
+
val
;
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
...
...
@@ -3231,14 +3232,14 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_EQUIP
:
{
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l1
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s1
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
c2
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l2
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s2
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l1
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s1
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
c2
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l2
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s2
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ClientCard
*
pc1
=
mainGame
->
dField
.
GetCard
(
c1
,
l1
,
s1
);
ClientCard
*
pc2
=
mainGame
->
dField
.
GetCard
(
c2
,
l2
,
s2
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
...
...
@@ -3265,8 +3266,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_LPUPDATE
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
val
=
BufferIO
::
Read
Int32
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
val
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
dInfo
.
lp
[
player
]
=
val
;
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
...
...
@@ -3283,10 +3284,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_UNEQUIP
:
{
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l1
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s1
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l1
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s1
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ClientCard
*
pc
=
mainGame
->
dField
.
GetCard
(
c1
,
l1
,
s1
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
pc
->
equipTarget
->
equipped
.
erase
(
pc
);
...
...
@@ -3304,14 +3305,14 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_CARD_TARGET
:
{
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l1
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s1
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
c2
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l2
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s2
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l1
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s1
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
c2
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l2
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s2
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ClientCard
*
pc1
=
mainGame
->
dField
.
GetCard
(
c1
,
l1
,
s1
);
ClientCard
*
pc2
=
mainGame
->
dField
.
GetCard
(
c2
,
l2
,
s2
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
...
...
@@ -3330,14 +3331,14 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
break
;
}
case
MSG_CANCEL_TARGET
:
{
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l1
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s1
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
c2
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l2
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s2
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l1
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s1
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
c2
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l2
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s2
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
ClientCard
*
pc1
=
mainGame
->
dField
.
GetCard
(
c1
,
l1
,
s1
);
ClientCard
*
pc2
=
mainGame
->
dField
.
GetCard
(
c2
,
l2
,
s2
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
...
...
@@ -3356,8 +3357,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
break
;
}
case
MSG_PAY_LPCOST
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
cost
=
BufferIO
::
Read
Int32
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
cost
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
final
=
mainGame
->
dInfo
.
lp
[
player
]
-
cost
;
if
(
final
<
0
)
final
=
0
;
...
...
@@ -3383,11 +3384,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_ADD_COUNTER
:
{
int
type
=
BufferIO
::
Read
Int16
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
Int16
(
pbuf
);
int
type
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
ClientCard
*
pc
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
pc
->
counters
.
count
(
type
))
pc
->
counters
[
type
]
+=
count
;
...
...
@@ -3406,11 +3407,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_REMOVE_COUNTER
:
{
int
type
=
BufferIO
::
Read
Int16
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
Int16
(
pbuf
);
int
type
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint16_t
>
(
pbuf
);
ClientCard
*
pc
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
pc
->
counters
[
type
]
-=
count
;
if
(
pc
->
counters
[
type
]
<=
0
)
...
...
@@ -3429,15 +3430,15 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_ATTACK
:
{
int
ca
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
la
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
sa
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
ca
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
la
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
sa
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
attacker
=
mainGame
->
dField
.
GetCard
(
ca
,
la
,
sa
);
int
cd
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
ld
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
sd
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
cd
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
ld
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
sd
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
float
sy
;
...
...
@@ -3480,20 +3481,20 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_BATTLE
:
{
int
ca
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
la
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
sa
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
aatk
=
BufferIO
::
Read
Int32
(
pbuf
);
int
adef
=
BufferIO
::
Read
Int32
(
pbuf
);
/*int da = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
cd
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
ld
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
sd
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
datk
=
BufferIO
::
Read
Int32
(
pbuf
);
int
ddef
=
BufferIO
::
Read
Int32
(
pbuf
);
/*int dd = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
ca
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
la
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
sa
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
aatk
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
adef
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
/*int da = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
cd
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
ld
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
sd
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
datk
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
ddef
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
/*int dd = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
mainGame
->
gMutex
.
lock
();
...
...
@@ -3531,19 +3532,19 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_MISSED_EFFECT
:
{
BufferIO
::
Read
Int32
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1622
),
dataManager
.
GetName
(
code
));
mainGame
->
AddLog
(
textBuffer
,
code
);
return
true
;
}
case
MSG_TOSS_COIN
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
wchar_t
*
pwbuf
=
textBuffer
;
BufferIO
::
CopyWStrRef
(
dataManager
.
GetSysString
(
1623
),
pwbuf
,
256
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
res
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
res
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
*
pwbuf
++
=
L'['
;
BufferIO
::
CopyWStrRef
(
dataManager
.
GetSysString
(
res
?
60
:
61
),
pwbuf
,
256
);
*
pwbuf
++
=
L']'
;
...
...
@@ -3561,12 +3562,12 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_TOSS_DICE
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
wchar_t
*
pwbuf
=
textBuffer
;
BufferIO
::
CopyWStrRef
(
dataManager
.
GetSysString
(
1624
),
pwbuf
,
256
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
res
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
res
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
*
pwbuf
++
=
L'['
;
*
pwbuf
++
=
L'0'
+
res
;
*
pwbuf
++
=
L']'
;
...
...
@@ -3584,7 +3585,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_ROCK_PAPER_SCISSORS
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
mainGame
->
gMutex
.
lock
();
...
...
@@ -3593,7 +3594,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_HAND_RES
:
{
int
res
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
res
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
mainGame
->
stHintMsg
->
setVisible
(
false
);
...
...
@@ -3610,9 +3611,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_ANNOUNCE_RACE
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
mainGame
->
dField
.
announce_count
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
available
=
BufferIO
::
Read
Int32
(
pbuf
);
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
mainGame
->
dField
.
announce_count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
available
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
for
(
int
i
=
0
,
filter
=
0x1
;
i
<
RACES_COUNT
;
++
i
,
filter
<<=
1
)
{
mainGame
->
chkRace
[
i
]
->
setChecked
(
false
);
if
(
filter
&
available
)
...
...
@@ -3630,9 +3631,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_ANNOUNCE_ATTRIB
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
mainGame
->
dField
.
announce_count
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
available
=
BufferIO
::
Read
Int32
(
pbuf
);
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
mainGame
->
dField
.
announce_count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
available
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
for
(
int
i
=
0
,
filter
=
0x1
;
i
<
7
;
++
i
,
filter
<<=
1
)
{
mainGame
->
chkAttribute
[
i
]
->
setChecked
(
false
);
if
(
filter
&
available
)
...
...
@@ -3650,11 +3651,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_ANNOUNCE_CARD
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
declare_opcodes
.
clear
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
mainGame
->
dField
.
declare_opcodes
.
push_back
(
buffer_r
ead
<
uint32_t
>
(
pbuf
));
mainGame
->
dField
.
declare_opcodes
.
push_back
(
BufferIO
::
R
ead
<
uint32_t
>
(
pbuf
));
if
(
select_hint
)
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_hint
));
else
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
564
));
...
...
@@ -3668,8 +3669,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_ANNOUNCE_NUMBER
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
gMutex
.
lock
();
mainGame
->
cbANNumber
->
clear
();
bool
quickmode
=
count
<=
12
;
...
...
@@ -3681,7 +3682,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
}
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
value
=
BufferIO
::
Read
Int32
(
pbuf
);
int
value
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
myswprintf
(
textBuffer
,
L" % d"
,
value
);
mainGame
->
cbANNumber
->
addItem
(
textBuffer
,
value
);
if
(
quickmode
)
{
...
...
@@ -3720,12 +3721,12 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
false
;
}
case
MSG_CARD_HINT
:
{
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
s
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
UInt8
(
pbuf
);
int
chtype
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
value
=
BufferIO
::
Read
Int32
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
l
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
s
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
chtype
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
value
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
!
pcard
)
return
true
;
...
...
@@ -3757,9 +3758,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_PLAYER_HINT
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
int
chtype
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
value
=
BufferIO
::
Read
Int32
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
int
chtype
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
value
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
auto
&
player_desc_hints
=
mainGame
->
dField
.
player_desc_hints
[
player
];
if
(
value
==
CARD_QUESTION
&&
player
==
0
)
{
if
(
chtype
==
PHINT_DESC_ADD
)
{
...
...
@@ -3778,16 +3779,16 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
return
true
;
}
case
MSG_MATCH_KILL
:
{
match_kill
=
BufferIO
::
Read
Int32
(
pbuf
);
match_kill
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
return
true
;
}
case
MSG_TAG_SWAP
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
size_t
mcount
=
(
size_t
)
BufferIO
::
Read
UInt8
(
pbuf
);
size_t
ecount
=
(
size_t
)
BufferIO
::
Read
UInt8
(
pbuf
);
size_t
pcount
=
(
size_t
)
BufferIO
::
Read
UInt8
(
pbuf
);
size_t
hcount
=
(
size_t
)
BufferIO
::
Read
UInt8
(
pbuf
);
int
topcode
=
BufferIO
::
Read
Int32
(
pbuf
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
size_t
mcount
=
(
size_t
)
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
size_t
ecount
=
(
size_t
)
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
size_t
pcount
=
(
size_t
)
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
size_t
hcount
=
(
size_t
)
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
topcode
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
for
(
auto
cit
=
mainGame
->
dField
.
deck
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
deck
[
player
].
end
();
++
cit
)
{
if
(
player
==
0
)
(
*
cit
)
->
dPos
.
Y
=
0.4
f
;
...
...
@@ -3876,7 +3877,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
(
*
mainGame
->
dField
.
deck
[
player
].
rbegin
())
->
code
=
topcode
;
for
(
auto
cit
=
mainGame
->
dField
.
hand
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
hand
[
player
].
end
();
++
cit
)
{
ClientCard
*
pcard
=
*
cit
;
pcard
->
code
=
BufferIO
::
Read
Int32
(
pbuf
);
pcard
->
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
mainGame
->
dField
.
GetCardLocation
(
pcard
,
&
pcard
->
curPos
,
&
pcard
->
curRot
);
if
(
player
==
0
)
pcard
->
curPos
.
Y
+=
2.0
f
;
else
pcard
->
curPos
.
Y
-=
3.0
f
;
...
...
@@ -3884,7 +3885,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
for
(
auto
cit
=
mainGame
->
dField
.
extra
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
extra
[
player
].
end
();
++
cit
)
{
ClientCard
*
pcard
=
*
cit
;
pcard
->
code
=
BufferIO
::
Read
Int32
(
pbuf
)
&
0x7fffffff
;
pcard
->
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
)
&
0x7fffffff
;
mainGame
->
dField
.
GetCardLocation
(
pcard
,
&
pcard
->
curPos
,
&
pcard
->
curRot
);
if
(
player
==
0
)
pcard
->
curPos
.
Y
+=
2.0
f
;
else
pcard
->
curPos
.
Y
-=
3.0
f
;
...
...
@@ -3899,19 +3900,19 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame
->
gMutex
.
lock
();
}
mainGame
->
dField
.
Clear
();
mainGame
->
dInfo
.
duel_rule
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dInfo
.
duel_rule
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
val
=
0
;
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
int
p
=
mainGame
->
LocalPlayer
(
i
);
mainGame
->
dInfo
.
lp
[
p
]
=
BufferIO
::
Read
Int32
(
pbuf
);
mainGame
->
dInfo
.
lp
[
p
]
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
p
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
p
]);
for
(
int
seq
=
0
;
seq
<
7
;
++
seq
)
{
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
val
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_MZONE
,
seq
);
ccard
->
position
=
BufferIO
::
Read
UInt8
(
pbuf
);
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
ccard
->
position
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
val
)
{
for
(
int
xyz
=
0
;
xyz
<
val
;
++
xyz
)
{
ClientCard
*
xcard
=
new
ClientCard
;
...
...
@@ -3927,53 +3928,53 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
}
for
(
int
seq
=
0
;
seq
<
8
;
++
seq
)
{
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
val
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_SZONE
,
seq
);
ccard
->
position
=
BufferIO
::
Read
UInt8
(
pbuf
);
ccard
->
position
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
}
}
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_DECK
,
seq
);
}
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_HAND
,
seq
);
}
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_GRAVE
,
seq
);
}
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_REMOVED
,
seq
);
}
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_EXTRA
,
seq
);
}
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
mainGame
->
dField
.
extra_p_count
[
p
]
=
val
;
}
mainGame
->
dField
.
RefreshAllCards
();
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
//chains
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
//chains
for
(
int
i
=
0
;
i
<
val
;
++
i
)
{
unsigned
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
int
pcc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
pcl
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
pcs
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
subs
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
UInt8
(
pbuf
));
unsigned
int
cl
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
cs
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
desc
=
BufferIO
::
Read
Int32
(
pbuf
);
unsigned
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
int
pcc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
pcl
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
pcs
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
subs
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
Read
<
uint8_t
>
(
pbuf
));
unsigned
int
cl
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
cs
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
desc
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
pcc
,
pcl
,
pcs
,
subs
);
mainGame
->
dField
.
current_chain
.
chain_card
=
pcard
;
mainGame
->
dField
.
current_chain
.
code
=
code
;
...
...
gframe/duelclient.h
View file @
42a427a4
...
...
@@ -49,16 +49,16 @@ public:
static
void
SendResponse
();
static
void
SendPacketToServer
(
unsigned
char
proto
)
{
auto
p
=
duel_client_write
;
buffer_w
rite
<
uint16_t
>
(
p
,
1
);
buffer_w
rite
<
uint8_t
>
(
p
,
proto
);
BufferIO
::
W
rite
<
uint16_t
>
(
p
,
1
);
BufferIO
::
W
rite
<
uint8_t
>
(
p
,
proto
);
bufferevent_write
(
client_bev
,
duel_client_write
,
3
);
}
template
<
typename
ST
>
static
void
SendPacketToServer
(
unsigned
char
proto
,
const
ST
&
st
)
{
auto
p
=
duel_client_write
;
static_assert
(
sizeof
(
ST
)
<=
MAX_DATA_SIZE
,
"Packet size is too large."
);
buffer_w
rite
<
uint16_t
>
(
p
,
(
uint16_t
)(
1
+
sizeof
(
ST
)));
buffer_w
rite
<
uint8_t
>
(
p
,
proto
);
BufferIO
::
W
rite
<
uint16_t
>
(
p
,
(
uint16_t
)(
1
+
sizeof
(
ST
)));
BufferIO
::
W
rite
<
uint8_t
>
(
p
,
proto
);
std
::
memcpy
(
p
,
&
st
,
sizeof
(
ST
));
bufferevent_write
(
client_bev
,
duel_client_write
,
sizeof
(
ST
)
+
3
);
}
...
...
@@ -66,8 +66,8 @@ public:
auto
p
=
duel_client_write
;
if
(
len
>
MAX_DATA_SIZE
)
len
=
MAX_DATA_SIZE
;
buffer_w
rite
<
uint16_t
>
(
p
,
(
uint16_t
)(
1
+
len
));
buffer_w
rite
<
uint8_t
>
(
p
,
proto
);
BufferIO
::
W
rite
<
uint16_t
>
(
p
,
(
uint16_t
)(
1
+
len
));
BufferIO
::
W
rite
<
uint8_t
>
(
p
,
proto
);
std
::
memcpy
(
p
,
buffer
,
len
);
bufferevent_write
(
client_bev
,
duel_client_write
,
len
+
3
);
}
...
...
gframe/menu_handler.cpp
View file @
42a427a4
...
...
@@ -17,14 +17,14 @@ void UpdateDeck() {
BufferIO
::
CopyWideString
(
mainGame
->
cbDeckSelect
->
getText
(),
mainGame
->
gameConf
.
lastdeck
);
unsigned
char
deckbuf
[
1024
]{};
auto
pdeck
=
deckbuf
;
BufferIO
::
Write
Int32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
Write
Int32
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
BufferIO
::
Write
<
int32_t
>
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
Write
<
int32_t
>
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
main
.
size
();
++
i
)
BufferIO
::
Write
Int32
(
pdeck
,
deckManager
.
current_deck
.
main
[
i
]
->
first
);
BufferIO
::
Write
<
int32_t
>
(
pdeck
,
deckManager
.
current_deck
.
main
[
i
]
->
first
);
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
extra
.
size
();
++
i
)
BufferIO
::
Write
Int32
(
pdeck
,
deckManager
.
current_deck
.
extra
[
i
]
->
first
);
BufferIO
::
Write
<
int32_t
>
(
pdeck
,
deckManager
.
current_deck
.
extra
[
i
]
->
first
);
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
side
.
size
();
++
i
)
BufferIO
::
Write
Int32
(
pdeck
,
deckManager
.
current_deck
.
side
[
i
]
->
first
);
BufferIO
::
Write
<
int32_t
>
(
pdeck
,
deckManager
.
current_deck
.
side
[
i
]
->
first
);
DuelClient
::
SendBufferToServer
(
CTOS_UPDATE_DECK
,
deckbuf
,
pdeck
-
deckbuf
);
}
bool
MenuHandler
::
OnEvent
(
const
irr
::
SEvent
&
event
)
{
...
...
gframe/netserver.cpp
View file @
42a427a4
...
...
@@ -185,7 +185,7 @@ void NetServer::DisconnectPlayer(DuelPlayer* dp) {
}
void
NetServer
::
HandleCTOSPacket
(
DuelPlayer
*
dp
,
unsigned
char
*
data
,
int
len
)
{
auto
pdata
=
data
;
unsigned
char
pktType
=
BufferIO
::
Read
UInt8
(
pdata
);
unsigned
char
pktType
=
BufferIO
::
Read
<
uint8_t
>
(
pdata
);
if
((
pktType
!=
CTOS_SURRENDER
)
&&
(
pktType
!=
CTOS_CHAT
)
&&
(
dp
->
state
==
0xff
||
(
dp
->
state
&&
dp
->
state
!=
pktType
)))
return
;
switch
(
pktType
)
{
...
...
@@ -261,7 +261,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
// for other server & reverse proxy use only
/*
wchar_t hostname[LEN_HOSTNAME];
uint32_t real_ip = ntohl(BufferIO::Read
Int32
(pdata));
uint32_t real_ip = ntohl(BufferIO::Read
<int32_t>
(pdata));
BufferIO::CopyCharArray((uint16_t*)pdata, hostname);
*/
break
;
...
...
@@ -380,8 +380,9 @@ size_t NetServer::CreateChatPacket(unsigned char* src, int src_size, unsigned ch
return
0
;
// STOC_Chat packet
auto
pdst
=
dst
;
buffer_write
<
uint16_t
>
(
pdst
,
dst_player_type
);
buffer_write_block
(
pdst
,
src_msg
,
src_size
);
BufferIO
::
Write
<
uint16_t
>
(
pdst
,
dst_player_type
);
std
::
memcpy
(
pdst
,
src_msg
,
src_size
);
pdst
+=
src_size
;
return
sizeof
(
dst_player_type
)
+
src_size
;
}
...
...
gframe/netserver.h
View file @
42a427a4
...
...
@@ -34,8 +34,8 @@ public:
static
size_t
CreateChatPacket
(
unsigned
char
*
src
,
int
src_size
,
unsigned
char
*
dst
,
uint16_t
dst_player_type
);
static
void
SendPacketToPlayer
(
DuelPlayer
*
dp
,
unsigned
char
proto
)
{
auto
p
=
net_server_write
;
buffer_w
rite
<
uint16_t
>
(
p
,
1
);
buffer_w
rite
<
uint8_t
>
(
p
,
proto
);
BufferIO
::
W
rite
<
uint16_t
>
(
p
,
1
);
BufferIO
::
W
rite
<
uint8_t
>
(
p
,
proto
);
last_sent
=
3
;
if
(
dp
)
bufferevent_write
(
dp
->
bev
,
net_server_write
,
3
);
...
...
@@ -44,8 +44,8 @@ public:
static
void
SendPacketToPlayer
(
DuelPlayer
*
dp
,
unsigned
char
proto
,
const
ST
&
st
)
{
auto
p
=
net_server_write
;
static_assert
(
sizeof
(
ST
)
<=
MAX_DATA_SIZE
,
"Packet size is too large."
);
buffer_w
rite
<
uint16_t
>
(
p
,
(
uint16_t
)(
1
+
sizeof
(
ST
)));
buffer_w
rite
<
uint8_t
>
(
p
,
proto
);
BufferIO
::
W
rite
<
uint16_t
>
(
p
,
(
uint16_t
)(
1
+
sizeof
(
ST
)));
BufferIO
::
W
rite
<
uint8_t
>
(
p
,
proto
);
std
::
memcpy
(
p
,
&
st
,
sizeof
(
ST
));
last_sent
=
sizeof
(
ST
)
+
3
;
if
(
dp
)
...
...
@@ -55,8 +55,8 @@ public:
auto
p
=
net_server_write
;
if
(
len
>
MAX_DATA_SIZE
)
len
=
MAX_DATA_SIZE
;
buffer_w
rite
<
uint16_t
>
(
p
,
(
uint16_t
)(
1
+
len
));
buffer_w
rite
<
uint8_t
>
(
p
,
proto
);
BufferIO
::
W
rite
<
uint16_t
>
(
p
,
(
uint16_t
)(
1
+
len
));
BufferIO
::
W
rite
<
uint8_t
>
(
p
,
proto
);
std
::
memcpy
(
p
,
buffer
,
len
);
last_sent
=
len
+
3
;
if
(
dp
)
...
...
gframe/replay_mode.cpp
View file @
42a427a4
...
...
@@ -300,7 +300,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
}
auto
offset
=
pbuf
;
bool
pauseable
=
true
;
mainGame
->
dInfo
.
curMsg
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dInfo
.
curMsg
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
switch
(
mainGame
->
dInfo
.
curMsg
)
{
case
MSG_RETRY
:
{
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
{
...
...
@@ -332,142 +332,142 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
return
false
;
}
case
MSG_SELECT_BATTLECMD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
+
2
;
ReplayRefresh
();
return
ReadReplayResponse
();
}
case
MSG_SELECT_IDLECMD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
+
3
;
ReplayRefresh
();
return
ReadReplayResponse
();
}
case
MSG_SELECT_EFFECTYN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
12
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_YESNO
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_OPTION
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_CARD
:
case
MSG_SELECT_TRIBUTE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
3
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
9
+
count
*
14
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_PLACE
:
case
MSG_SELECT_DISFIELD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_POSITION
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_COUNTER
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
9
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_SUM
:
{
pbuf
++
;
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
6
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
return
ReadReplayResponse
();
}
case
MSG_SORT_CARD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
return
ReadReplayResponse
();
}
case
MSG_CONFIRM_DECKTOP
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_CONFIRM_EXTRATOP
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_CONFIRM_CARDS
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
1
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_SHUFFLE_DECK
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
ReplayRefreshDeck
(
player
);
break
;
}
case
MSG_SHUFFLE_HAND
:
{
/*int oplayer = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int oplayer = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_SHUFFLE_EXTRA
:
{
/*int oplayer = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int oplayer = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
...
...
@@ -478,7 +478,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_SWAP_GRAVE_DECK
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
ReplayRefreshGrave
(
player
);
break
;
...
...
@@ -496,7 +496,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
}
case
MSG_SHUFFLE_SET_CARD
:
{
pbuf
++
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
...
...
@@ -510,7 +510,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
mainGame
->
gMutex
.
unlock
();
}
}
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
...
...
@@ -634,22 +634,22 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
}
case
MSG_CARD_SELECTED
:
case
MSG_RANDOM_SELECTED
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
pauseable
=
false
;
break
;
}
case
MSG_BECOME_TARGET
:
{
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_DRAW
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
...
...
@@ -742,21 +742,21 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_TOSS_COIN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_TOSS_DICE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_ROCK_PAPER_SCISSORS
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
return
ReadReplayResponse
();
}
case
MSG_HAND_RES
:
{
...
...
@@ -765,19 +765,19 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_ANNOUNCE_RACE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
return
ReadReplayResponse
();
}
case
MSG_ANNOUNCE_ATTRIB
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
return
ReadReplayResponse
();
}
case
MSG_ANNOUNCE_CARD
:
case
MSG_ANNOUNCE_NUMBER
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
*
count
;
return
ReadReplayResponse
();
}
...
...
@@ -808,12 +808,12 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
for
(
int
p
=
0
;
p
<
2
;
++
p
)
{
pbuf
+=
4
;
for
(
int
seq
=
0
;
seq
<
7
;
++
seq
)
{
int
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
val
)
pbuf
+=
2
;
}
for
(
int
seq
=
0
;
seq
<
8
;
++
seq
)
{
int
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
val
)
pbuf
++
;
}
...
...
@@ -826,12 +826,12 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_AI_NAME
:
{
int
len
=
buffer_r
ead
<
uint16_t
>
(
pbuf
);
int
len
=
BufferIO
::
R
ead
<
uint16_t
>
(
pbuf
);
pbuf
+=
len
+
1
;
break
;
}
case
MSG_SHOW_HINT
:
{
int
len
=
buffer_r
ead
<
uint16_t
>
(
pbuf
);
int
len
=
BufferIO
::
R
ead
<
uint16_t
>
(
pbuf
);
pbuf
+=
len
+
1
;
break
;
}
...
...
gframe/single_duel.cpp
View file @
42a427a4
...
...
@@ -331,12 +331,12 @@ void SingleDuel::StartDuel(DuelPlayer* dp) {
}
unsigned
char
deckbuff
[
12
];
auto
pbuf
=
deckbuff
;
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
0
].
main
.
size
());
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
0
].
extra
.
size
());
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
0
].
side
.
size
());
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
1
].
main
.
size
());
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
1
].
extra
.
size
());
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
1
].
side
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
0
].
main
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
0
].
extra
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
0
].
side
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
1
].
main
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
1
].
extra
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
1
].
side
.
size
());
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_DECK_COUNT
,
deckbuff
,
12
);
char
tempbuff
[
6
];
std
::
memcpy
(
tempbuff
,
deckbuff
,
6
);
...
...
@@ -457,15 +457,15 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
last_replay
.
Flush
();
unsigned
char
startbuf
[
32
]{};
auto
pbuf
=
startbuf
;
BufferIO
::
Write
Int8
(
pbuf
,
MSG_START
);
BufferIO
::
Write
Int8
(
pbuf
,
0
);
BufferIO
::
Write
Int8
(
pbuf
,
host_info
.
duel_rule
);
BufferIO
::
Write
Int32
(
pbuf
,
host_info
.
start_lp
);
BufferIO
::
Write
Int32
(
pbuf
,
host_info
.
start_lp
);
BufferIO
::
Write
Int16
(
pbuf
,
query_field_count
(
pduel
,
0
,
LOCATION_DECK
));
BufferIO
::
Write
Int16
(
pbuf
,
query_field_count
(
pduel
,
0
,
LOCATION_EXTRA
));
BufferIO
::
Write
Int16
(
pbuf
,
query_field_count
(
pduel
,
1
,
LOCATION_DECK
));
BufferIO
::
Write
Int16
(
pbuf
,
query_field_count
(
pduel
,
1
,
LOCATION_EXTRA
));
BufferIO
::
Write
<
uint8_t
>
(
pbuf
,
MSG_START
);
BufferIO
::
Write
<
uint8_t
>
(
pbuf
,
0
);
BufferIO
::
Write
<
uint8_t
>
(
pbuf
,
host_info
.
duel_rule
);
BufferIO
::
Write
<
int32_t
>
(
pbuf
,
host_info
.
start_lp
);
BufferIO
::
Write
<
int32_t
>
(
pbuf
,
host_info
.
start_lp
);
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
query_field_count
(
pduel
,
0
,
LOCATION_DECK
));
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
query_field_count
(
pduel
,
0
,
LOCATION_EXTRA
));
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
query_field_count
(
pduel
,
1
,
LOCATION_DECK
));
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
query_field_count
(
pduel
,
1
,
LOCATION_EXTRA
));
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
startbuf
,
19
);
startbuf
[
1
]
=
1
;
NetServer
::
SendBufferToPlayer
(
players
[
1
],
STOC_GAME_MSG
,
startbuf
,
19
);
...
...
@@ -578,7 +578,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
int
player
,
count
,
type
;
while
(
pbuf
-
msgbuffer
<
(
int
)
len
)
{
offset
=
pbuf
;
unsigned
char
engType
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
char
engType
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
switch
(
engType
)
{
case
MSG_RETRY
:
{
WaitforResponse
(
last_response
);
...
...
@@ -586,9 +586,9 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return
1
;
}
case
MSG_HINT
:
{
type
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
Int32
(
pbuf
);
type
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
switch
(
type
)
{
case
1
:
case
2
:
...
...
@@ -619,8 +619,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_WIN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
type
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
type
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
...
...
@@ -639,10 +639,10 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return
2
;
}
case
MSG_SELECT_BATTLECMD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
+
2
;
RefreshMzone
(
0
);
RefreshMzone
(
1
);
...
...
@@ -655,18 +655,18 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return
1
;
}
case
MSG_SELECT_IDLECMD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
+
3
;
RefreshMzone
(
0
);
RefreshMzone
(
1
);
...
...
@@ -679,22 +679,22 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return
1
;
}
case
MSG_SELECT_EFFECTYN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
12
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_YESNO
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_OPTION
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -702,54 +702,54 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
}
case
MSG_SELECT_CARD
:
case
MSG_SELECT_TRIBUTE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
3
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
c
/*, l, s, ss, code*/
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
Read
Int32
(
pbuf
);
c
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*l = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*s = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*ss = */
BufferIO
::
Read
UInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
Int32
(
pbufw
,
0
);
/*code = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*l = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*s = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*ss = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
}
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
c
/*, l, s, ss, code*/
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
Read
Int32
(
pbuf
);
c
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*l = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*s = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*ss = */
BufferIO
::
Read
UInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
Int32
(
pbufw
,
0
);
/*code = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*l = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*s = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*ss = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
}
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
Read
Int32
(
pbuf
);
c
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*l = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*s = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*ss = */
BufferIO
::
Read
UInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
Int32
(
pbufw
,
0
);
/*code = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*l = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*s = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*ss = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
}
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
9
+
count
*
14
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -757,23 +757,23 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
}
case
MSG_SELECT_PLACE
:
case
MSG_SELECT_DISFIELD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_POSITION
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_COUNTER
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
9
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -781,27 +781,27 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
}
case
MSG_SELECT_SUM
:
{
pbuf
++
;
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
6
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SORT_CARD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_CONFIRM_DECKTOP
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -810,8 +810,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_CONFIRM_EXTRATOP
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -820,9 +820,9 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_CONFIRM_CARDS
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
1
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
pbuf
[
5
]
!=
LOCATION_DECK
)
{
pbuf
+=
count
*
7
;
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -836,7 +836,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SHUFFLE_DECK
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
...
...
@@ -844,11 +844,11 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SHUFFLE_HAND
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
(
pbuf
-
offset
)
+
count
*
4
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
BufferIO
::
Write
Int32
(
pbuf
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbuf
,
0
);
NetServer
::
SendBufferToPlayer
(
players
[
1
-
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
...
...
@@ -856,11 +856,11 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SHUFFLE_EXTRA
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
(
pbuf
-
offset
)
+
count
*
4
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
BufferIO
::
Write
Int32
(
pbuf
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbuf
,
0
);
NetServer
::
SendBufferToPlayer
(
players
[
1
-
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
...
...
@@ -876,7 +876,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SWAP_GRAVE_DECK
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
...
...
@@ -900,8 +900,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SHUFFLE_SET_CARD
:
{
unsigned
int
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -960,7 +960,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
pbuf
+=
16
;
NetServer
::
SendBufferToPlayer
(
players
[
cc
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
if
(
!
(
cl
&
(
LOCATION_GRAVE
+
LOCATION_OVERLAY
))
&&
((
cl
&
(
LOCATION_DECK
+
LOCATION_HAND
))
||
(
cp
&
POS_FACEDOWN
)))
BufferIO
::
Write
Int32
(
pbufw
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
NetServer
::
SendBufferToPlayer
(
players
[
1
-
cc
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
...
...
@@ -984,7 +984,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SET
:
{
BufferIO
::
Write
Int32
(
pbuf
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbuf
,
0
);
pbuf
+=
4
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1148,14 +1148,14 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_CARD_SELECTED
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
break
;
}
case
MSG_RANDOM_SELECTED
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1164,7 +1164,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_BECOME_TARGET
:
{
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1173,14 +1173,14 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_DRAW
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbufw
=
pbuf
;
pbuf
+=
count
*
4
;
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
if
(
!
(
pbufw
[
3
]
&
0x80
))
BufferIO
::
Write
Int32
(
pbufw
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
else
pbufw
+=
4
;
}
...
...
@@ -1317,8 +1317,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_TOSS_COIN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1327,8 +1327,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_TOSS_DICE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1337,7 +1337,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_ROCK_PAPER_SCISSORS
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
...
...
@@ -1351,14 +1351,14 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_ANNOUNCE_RACE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_ANNOUNCE_ATTRIB
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -1366,8 +1366,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
}
case
MSG_ANNOUNCE_CARD
:
case
MSG_ANNOUNCE_NUMBER
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
*
count
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -1390,7 +1390,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_MATCH_KILL
:
{
int
code
=
BufferIO
::
Read
Int32
(
pbuf
);
int
code
=
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
if
(
match_mode
)
{
match_kill
=
code
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -1462,9 +1462,9 @@ void SingleDuel::TimeConfirm(DuelPlayer* dp) {
}
inline
int
SingleDuel
::
WriteUpdateData
(
int
&
player
,
int
location
,
int
&
flag
,
unsigned
char
*&
qbuf
,
int
&
use_cache
)
{
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
BufferIO
::
Write
Int8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
Write
Int8
(
qbuf
,
player
);
BufferIO
::
Write
Int8
(
qbuf
,
location
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
player
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
location
);
int
len
=
query_field_card
(
pduel
,
player
,
location
,
flag
,
qbuf
,
use_cache
);
return
len
;
}
...
...
@@ -1476,7 +1476,7 @@ void SingleDuel::RefreshMzone(int player, int flag, int use_cache) {
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
qlen
=
0
;
while
(
qlen
<
len
)
{
const
int
clen
=
BufferIO
::
Read
Int32
(
qbuf
);
const
int
clen
=
BufferIO
::
Read
<
int32_t
>
(
qbuf
);
qlen
+=
clen
;
if
(
clen
<=
LEN_HEADER
)
continue
;
...
...
@@ -1497,7 +1497,7 @@ void SingleDuel::RefreshSzone(int player, int flag, int use_cache) {
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
qlen
=
0
;
while
(
qlen
<
len
)
{
const
int
clen
=
BufferIO
::
Read
Int32
(
qbuf
);
const
int
clen
=
BufferIO
::
Read
<
int32_t
>
(
qbuf
);
qlen
+=
clen
;
if
(
clen
<=
LEN_HEADER
)
continue
;
...
...
@@ -1518,7 +1518,7 @@ void SingleDuel::RefreshHand(int player, int flag, int use_cache) {
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
qlen
=
0
;
while
(
qlen
<
len
)
{
const
int
slen
=
BufferIO
::
Read
Int32
(
qbuf
);
const
int
slen
=
BufferIO
::
Read
<
int32_t
>
(
qbuf
);
qlen
+=
slen
;
if
(
slen
<=
LEN_HEADER
)
continue
;
...
...
@@ -1552,19 +1552,19 @@ void SingleDuel::RefreshSingle(int player, int location, int sequence, int flag)
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
unsigned
char
query_buffer
[
0x1000
];
auto
qbuf
=
query_buffer
;
BufferIO
::
Write
Int8
(
qbuf
,
MSG_UPDATE_CARD
);
BufferIO
::
Write
Int8
(
qbuf
,
player
);
BufferIO
::
Write
Int8
(
qbuf
,
location
);
BufferIO
::
Write
Int8
(
qbuf
,
sequence
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
MSG_UPDATE_CARD
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
player
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
location
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
sequence
);
int
len
=
query_card
(
pduel
,
player
,
location
,
sequence
,
flag
,
qbuf
,
0
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
if
(
len
<=
LEN_HEADER
)
return
;
const
int
clen
=
BufferIO
::
Read
Int32
(
qbuf
);
const
int
clen
=
BufferIO
::
Read
<
int32_t
>
(
qbuf
);
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
position
&
POS_FACEDOWN
)
{
BufferIO
::
Write
Int32
(
qbuf
,
QUERY_CODE
);
BufferIO
::
Write
Int32
(
qbuf
,
0
);
BufferIO
::
Write
<
int32_t
>
(
qbuf
,
QUERY_CODE
);
BufferIO
::
Write
<
int32_t
>
(
qbuf
,
0
);
std
::
memset
(
qbuf
,
0
,
clen
-
12
);
}
NetServer
::
SendBufferToPlayer
(
players
[
1
-
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
...
...
gframe/single_mode.cpp
View file @
42a427a4
...
...
@@ -188,7 +188,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
if
(
is_closing
||
!
is_continuing
)
return
false
;
offset
=
pbuf
;
mainGame
->
dInfo
.
curMsg
=
BufferIO
::
Read
UInt8
(
pbuf
);
mainGame
->
dInfo
.
curMsg
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
switch
(
mainGame
->
dInfo
.
curMsg
)
{
case
MSG_RETRY
:
{
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
...
...
@@ -198,9 +198,9 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_HINT
:
{
/*int type = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int data = */
BufferIO
::
Read
Int32
(
pbuf
);
/*int type = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int data = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
if
(
player
==
0
)
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
...
...
@@ -211,10 +211,10 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
return
false
;
}
case
MSG_SELECT_BATTLECMD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
+
2
;
SinglePlayRefresh
();
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
...
...
@@ -224,18 +224,18 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_SELECT_IDLECMD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
+
3
;
SinglePlayRefresh
();
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
...
...
@@ -245,7 +245,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_SELECT_EFFECTYN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
12
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
...
...
@@ -255,7 +255,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_SELECT_YESNO
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -264,8 +264,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_SELECT_OPTION
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -275,9 +275,9 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
}
case
MSG_SELECT_CARD
:
case
MSG_SELECT_TRIBUTE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
3
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -286,11 +286,11 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -299,8 +299,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
9
+
count
*
14
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -310,7 +310,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
}
case
MSG_SELECT_PLACE
:
case
MSG_SELECT_DISFIELD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -319,7 +319,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_SELECT_POSITION
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -328,9 +328,9 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_SELECT_COUNTER
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
9
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -340,11 +340,11 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
}
case
MSG_SELECT_SUM
:
{
pbuf
++
;
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
6
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -353,8 +353,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_SORT_CARD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -363,43 +363,43 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_CONFIRM_DECKTOP
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_CONFIRM_EXTRATOP
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_CONFIRM_CARDS
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
1
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_SHUFFLE_DECK
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
SinglePlayRefreshDeck
(
player
);
break
;
}
case
MSG_SHUFFLE_HAND
:
{
/*int oplayer = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int oplayer = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_SHUFFLE_EXTRA
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
...
...
@@ -410,7 +410,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_SWAP_GRAVE_DECK
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
SinglePlayRefreshGrave
(
player
);
break
;
...
...
@@ -428,13 +428,13 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
}
case
MSG_SHUFFLE_SET_CARD
:
{
pbuf
++
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_NEW_TURN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
...
...
@@ -550,21 +550,21 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
}
case
MSG_CARD_SELECTED
:
case
MSG_RANDOM_SELECTED
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_BECOME_TARGET
:
{
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_DRAW
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
...
...
@@ -649,21 +649,21 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_TOSS_COIN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_TOSS_DICE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
break
;
}
case
MSG_ROCK_PAPER_SCISSORS
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
mainGame
->
singleSignal
.
Wait
();
...
...
@@ -676,7 +676,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_ANNOUNCE_RACE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -685,7 +685,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
MSG_ANNOUNCE_ATTRIB
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -695,8 +695,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
}
case
MSG_ANNOUNCE_CARD
:
case
MSG_ANNOUNCE_NUMBER
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
*
count
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
...
...
@@ -731,18 +731,18 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
for
(
int
p
=
0
;
p
<
2
;
++
p
)
{
pbuf
+=
4
;
for
(
int
seq
=
0
;
seq
<
7
;
++
seq
)
{
int
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
val
)
pbuf
+=
2
;
}
for
(
int
seq
=
0
;
seq
<
8
;
++
seq
)
{
int
val
=
BufferIO
::
Read
UInt8
(
pbuf
);
int
val
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
val
)
pbuf
++
;
}
pbuf
+=
6
;
}
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
15
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
SinglePlayReload
();
...
...
@@ -754,7 +754,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
case
MSG_AI_NAME
:
{
char
namebuf
[
SIZE_AI_NAME
]{};
wchar_t
wname
[
20
]{};
int
name_len
=
buffer_r
ead
<
uint16_t
>
(
pbuf
);
int
name_len
=
BufferIO
::
R
ead
<
uint16_t
>
(
pbuf
);
if
(
name_len
+
1
<=
(
int
)
sizeof
namebuf
)
{
std
::
memcpy
(
namebuf
,
pbuf
,
name_len
);
namebuf
[
name_len
]
=
0
;
...
...
@@ -767,7 +767,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
case
MSG_SHOW_HINT
:
{
char
msgbuf
[
SIZE_HINT_MSG
]{};
wchar_t
msg
[
SIZE_HINT_MSG
]{};
int
msg_len
=
buffer_r
ead
<
uint16_t
>
(
pbuf
);
int
msg_len
=
BufferIO
::
R
ead
<
uint16_t
>
(
pbuf
);
if
(
msg_len
+
1
<=
(
int
)
sizeof
msgbuf
)
{
std
::
memcpy
(
msgbuf
,
pbuf
,
msg_len
);
msgbuf
[
msg_len
]
=
0
;
...
...
gframe/tag_duel.cpp
View file @
42a427a4
...
...
@@ -296,12 +296,12 @@ void TagDuel::StartDuel(DuelPlayer* dp) {
}
unsigned
char
deckbuff
[
12
];
auto
pbuf
=
deckbuff
;
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
0
].
main
.
size
());
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
0
].
extra
.
size
());
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
0
].
side
.
size
());
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
2
].
main
.
size
());
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
2
].
extra
.
size
());
BufferIO
::
Write
Int16
(
pbuf
,
(
shor
t
)
pdeck
[
2
].
side
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
0
].
main
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
0
].
extra
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
0
].
side
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
2
].
main
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
2
].
extra
.
size
());
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
(
uint16_
t
)
pdeck
[
2
].
side
.
size
());
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_DECK_COUNT
,
deckbuff
,
12
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
char
tempbuff
[
6
];
...
...
@@ -446,15 +446,15 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
last_replay
.
Flush
();
unsigned
char
startbuf
[
32
]{};
auto
pbuf
=
startbuf
;
BufferIO
::
Write
Int8
(
pbuf
,
MSG_START
);
BufferIO
::
Write
Int8
(
pbuf
,
0
);
BufferIO
::
Write
Int8
(
pbuf
,
host_info
.
duel_rule
);
BufferIO
::
Write
Int32
(
pbuf
,
host_info
.
start_lp
);
BufferIO
::
Write
Int32
(
pbuf
,
host_info
.
start_lp
);
BufferIO
::
Write
Int16
(
pbuf
,
query_field_count
(
pduel
,
0
,
0x1
));
BufferIO
::
Write
Int16
(
pbuf
,
query_field_count
(
pduel
,
0
,
0x40
));
BufferIO
::
Write
Int16
(
pbuf
,
query_field_count
(
pduel
,
1
,
0x1
));
BufferIO
::
Write
Int16
(
pbuf
,
query_field_count
(
pduel
,
1
,
0x40
));
BufferIO
::
Write
<
uint8_t
>
(
pbuf
,
MSG_START
);
BufferIO
::
Write
<
uint8_t
>
(
pbuf
,
0
);
BufferIO
::
Write
<
uint8_t
>
(
pbuf
,
host_info
.
duel_rule
);
BufferIO
::
Write
<
int32_t
>
(
pbuf
,
host_info
.
start_lp
);
BufferIO
::
Write
<
int32_t
>
(
pbuf
,
host_info
.
start_lp
);
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
query_field_count
(
pduel
,
0
,
LOCATION_DECK
));
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
query_field_count
(
pduel
,
0
,
LOCATION_EXTRA
));
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
query_field_count
(
pduel
,
1
,
LOCATION_DECK
));
BufferIO
::
Write
<
uint16_t
>
(
pbuf
,
query_field_count
(
pduel
,
1
,
LOCATION_EXTRA
));
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
startbuf
,
19
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
startbuf
[
1
]
=
1
;
...
...
@@ -540,7 +540,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
int
player
,
count
,
type
;
while
(
pbuf
-
msgbuffer
<
(
int
)
len
)
{
offset
=
pbuf
;
unsigned
char
engType
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
char
engType
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
switch
(
engType
)
{
case
MSG_RETRY
:
{
WaitforResponse
(
last_response
);
...
...
@@ -548,9 +548,9 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return
1
;
}
case
MSG_HINT
:
{
type
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
BufferIO
::
Read
Int32
(
pbuf
);
type
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
switch
(
type
)
{
case
1
:
case
2
:
...
...
@@ -583,8 +583,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_WIN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
type
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
type
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
NetServer
::
ReSendToPlayer
(
players
[
2
]);
...
...
@@ -595,10 +595,10 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return
2
;
}
case
MSG_SELECT_BATTLECMD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
+
2
;
RefreshMzone
(
0
);
RefreshMzone
(
1
);
...
...
@@ -611,18 +611,18 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return
1
;
}
case
MSG_SELECT_IDLECMD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
+
3
;
RefreshMzone
(
0
);
RefreshMzone
(
1
);
...
...
@@ -635,22 +635,22 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return
1
;
}
case
MSG_SELECT_EFFECTYN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
12
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_YESNO
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_OPTION
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -658,54 +658,54 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
}
case
MSG_SELECT_CARD
:
case
MSG_SELECT_TRIBUTE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
3
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
c
/*, l, s, ss, code*/
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
Read
Int32
(
pbuf
);
c
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*l = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*s = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*ss = */
BufferIO
::
Read
UInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
Int32
(
pbufw
,
0
);
/*code = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*l = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*s = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*ss = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
}
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
c
/*, l, s, ss, code*/
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
Read
Int32
(
pbuf
);
c
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*l = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*s = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*ss = */
BufferIO
::
Read
UInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
Int32
(
pbufw
,
0
);
/*code = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*l = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*s = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*ss = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
}
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
Read
Int32
(
pbuf
);
c
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*l = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*s = */
BufferIO
::
Read
UInt8
(
pbuf
);
/*ss = */
BufferIO
::
Read
UInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
Int32
(
pbufw
,
0
);
/*code = */
BufferIO
::
Read
<
int32_t
>
(
pbuf
);
c
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*l = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*s = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*ss = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
}
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
9
+
count
*
14
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -713,23 +713,23 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
}
case
MSG_SELECT_PLACE
:
case
MSG_SELECT_DISFIELD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_POSITION
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_COUNTER
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
9
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -737,27 +737,27 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
}
case
MSG_SELECT_SUM
:
{
pbuf
++
;
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
6
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
11
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SORT_CARD
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_CONFIRM_DECKTOP
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -768,8 +768,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_CONFIRM_EXTRATOP
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
7
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -780,9 +780,9 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_CONFIRM_CARDS
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
1
;
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
if
(
pbuf
[
5
]
!=
LOCATION_DECK
)
{
pbuf
+=
count
*
7
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -798,7 +798,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SHUFFLE_DECK
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
NetServer
::
ReSendToPlayer
(
players
[
2
]);
...
...
@@ -808,11 +808,11 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SHUFFLE_HAND
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
(
pbuf
-
offset
)
+
count
*
4
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
BufferIO
::
Write
Int32
(
pbuf
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbuf
,
0
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
if
(
players
[
i
]
!=
cur_player
[
player
])
NetServer
::
SendBufferToPlayer
(
players
[
i
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -822,11 +822,11 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SHUFFLE_EXTRA
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
(
pbuf
-
offset
)
+
count
*
4
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
BufferIO
::
Write
Int32
(
pbuf
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbuf
,
0
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
if
(
players
[
i
]
!=
cur_player
[
player
])
NetServer
::
SendBufferToPlayer
(
players
[
i
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -846,7 +846,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SWAP_GRAVE_DECK
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
NetServer
::
ReSendToPlayer
(
players
[
2
]);
...
...
@@ -876,8 +876,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SHUFFLE_SET_CARD
:
{
unsigned
int
loc
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
unsigned
int
loc
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
8
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -952,7 +952,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
pbuf
+=
16
;
NetServer
::
SendBufferToPlayer
(
cur_player
[
cc
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
if
(
!
(
cl
&
(
LOCATION_GRAVE
+
LOCATION_OVERLAY
))
&&
((
cl
&
(
LOCATION_DECK
+
LOCATION_HAND
))
||
(
cp
&
POS_FACEDOWN
)))
BufferIO
::
Write
Int32
(
pbufw
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
if
(
players
[
i
]
!=
cur_player
[
cc
])
NetServer
::
SendBufferToPlayer
(
players
[
i
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -980,7 +980,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_SET
:
{
BufferIO
::
Write
Int32
(
pbuf
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbuf
,
0
);
pbuf
+=
4
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1176,14 +1176,14 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_CARD_SELECTED
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
break
;
}
case
MSG_RANDOM_SELECTED
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1194,7 +1194,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_BECOME_TARGET
:
{
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
*
4
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1205,14 +1205,14 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_DRAW
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbufw
=
pbuf
;
pbuf
+=
count
*
4
;
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
if
(
!
(
pbufw
[
3
]
&
0x80
))
BufferIO
::
Write
Int32
(
pbufw
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
else
pbufw
+=
4
;
}
...
...
@@ -1381,8 +1381,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_TOSS_COIN
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1393,8 +1393,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_TOSS_DICE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
count
;
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1405,7 +1405,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_ROCK_PAPER_SCISSORS
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
...
...
@@ -1421,14 +1421,14 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_ANNOUNCE_RACE
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_ANNOUNCE_ATTRIB
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
5
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -1436,8 +1436,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
}
case
MSG_ANNOUNCE_CARD
:
case
MSG_ANNOUNCE_NUMBER
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
count
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
count
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbuf
+=
4
*
count
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
...
@@ -1464,23 +1464,23 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break
;
}
case
MSG_TAG_SWAP
:
{
player
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int mcount = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
ecount
=
BufferIO
::
Read
UInt8
(
pbuf
);
/*int pcount = */
BufferIO
::
Read
UInt8
(
pbuf
);
int
hcount
=
BufferIO
::
Read
UInt8
(
pbuf
);
player
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int mcount = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
ecount
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
/*int pcount = */
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
int
hcount
=
BufferIO
::
Read
<
uint8_t
>
(
pbuf
);
pbufw
=
pbuf
+
4
;
pbuf
+=
hcount
*
4
+
ecount
*
4
+
4
;
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
for
(
int
i
=
0
;
i
<
hcount
;
++
i
)
{
if
(
!
(
pbufw
[
3
]
&
0x80
))
BufferIO
::
Write
Int32
(
pbufw
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
else
pbufw
+=
4
;
}
for
(
int
i
=
0
;
i
<
ecount
;
++
i
)
{
if
(
!
(
pbufw
[
3
]
&
0x80
))
BufferIO
::
Write
Int32
(
pbufw
,
0
);
BufferIO
::
Write
<
int32_t
>
(
pbufw
,
0
);
else
pbufw
+=
4
;
}
...
...
@@ -1571,9 +1571,9 @@ void TagDuel::TimeConfirm(DuelPlayer* dp) {
}
inline
int
TagDuel
::
WriteUpdateData
(
int
&
player
,
int
location
,
int
&
flag
,
unsigned
char
*&
qbuf
,
int
&
use_cache
)
{
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
BufferIO
::
Write
Int8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
Write
Int8
(
qbuf
,
player
);
BufferIO
::
Write
Int8
(
qbuf
,
location
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
player
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
location
);
int
len
=
query_field_card
(
pduel
,
player
,
location
,
flag
,
qbuf
,
use_cache
);
return
len
;
}
...
...
@@ -1587,7 +1587,7 @@ void TagDuel::RefreshMzone(int player, int flag, int use_cache) {
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
int
qlen
=
0
;
while
(
qlen
<
len
)
{
int
clen
=
BufferIO
::
Read
Int32
(
qbuf
);
int
clen
=
BufferIO
::
Read
<
int32_t
>
(
qbuf
);
qlen
+=
clen
;
if
(
clen
<=
LEN_HEADER
)
continue
;
...
...
@@ -1612,7 +1612,7 @@ void TagDuel::RefreshSzone(int player, int flag, int use_cache) {
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
int
qlen
=
0
;
while
(
qlen
<
len
)
{
int
clen
=
BufferIO
::
Read
Int32
(
qbuf
);
int
clen
=
BufferIO
::
Read
<
int32_t
>
(
qbuf
);
qlen
+=
clen
;
if
(
clen
<=
LEN_HEADER
)
continue
;
...
...
@@ -1635,7 +1635,7 @@ void TagDuel::RefreshHand(int player, int flag, int use_cache) {
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
qlen
=
0
;
while
(
qlen
<
len
)
{
int
slen
=
BufferIO
::
Read
Int32
(
qbuf
);
int
slen
=
BufferIO
::
Read
<
int32_t
>
(
qbuf
);
qlen
+=
slen
;
if
(
slen
<=
LEN_HEADER
)
continue
;
...
...
@@ -1673,10 +1673,10 @@ void TagDuel::RefreshSingle(int player, int location, int sequence, int flag) {
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
unsigned
char
query_buffer
[
0x1000
];
auto
qbuf
=
query_buffer
;
BufferIO
::
Write
Int8
(
qbuf
,
MSG_UPDATE_CARD
);
BufferIO
::
Write
Int8
(
qbuf
,
player
);
BufferIO
::
Write
Int8
(
qbuf
,
location
);
BufferIO
::
Write
Int8
(
qbuf
,
sequence
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
MSG_UPDATE_CARD
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
player
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
location
);
BufferIO
::
Write
<
uint8_t
>
(
qbuf
,
sequence
);
int
len
=
query_card
(
pduel
,
player
,
location
,
sequence
,
flag
,
qbuf
,
0
);
auto
position
=
GetPosition
(
qbuf
,
12
);
if
(
location
&
LOCATION_ONFIELD
)
{
...
...
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