Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
REIKAI
ygopro
Commits
12f0c719
Commit
12f0c719
authored
Nov 29, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'roomlist'
parents
db728403
5ba0c92b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
0 deletions
+76
-0
gframe/bufferio.h
gframe/bufferio.h
+10
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+59
-0
gframe/duelclient.h
gframe/duelclient.h
+2
-0
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+4
-0
gframe/network.h
gframe/network.h
+1
-0
No files found.
gframe/bufferio.h
View file @
12f0c719
...
...
@@ -12,11 +12,21 @@ public:
p
+=
4
;
return
ret
;
}
inline
static
unsigned
int
ReadUInt32
(
char
*&
p
)
{
unsigned
int
ret
=
*
(
unsigned
int
*
)
p
;
p
+=
4
;
return
ret
;
}
inline
static
short
ReadInt16
(
char
*&
p
)
{
short
ret
=
*
(
short
*
)
p
;
p
+=
2
;
return
ret
;
}
inline
static
unsigned
short
ReadUInt16
(
char
*&
p
)
{
unsigned
short
ret
=
*
(
unsigned
short
*
)
p
;
p
+=
2
;
return
ret
;
}
inline
static
char
ReadInt8
(
char
*&
p
)
{
char
ret
=
*
(
char
*
)
p
;
p
++
;
...
...
gframe/duelclient.cpp
View file @
12f0c719
...
...
@@ -31,12 +31,14 @@ mtrandom DuelClient::rnd;
bool
DuelClient
::
is_refreshing
=
false
;
int
DuelClient
::
match_kill
=
0
;
std
::
vector
<
HostPacket
>
DuelClient
::
hosts
;
std
::
vector
<
std
::
wstring
>
DuelClient
::
hosts_srvpro
;
std
::
set
<
unsigned
int
>
DuelClient
::
remotes
;
event
*
DuelClient
::
resp_event
=
0
;
unsigned
int
DuelClient
::
temp_ip
=
0
;
unsigned
short
DuelClient
::
temp_port
=
0
;
unsigned
short
DuelClient
::
temp_ver
=
0
;
bool
DuelClient
::
try_needed
=
false
;
bool
DuelClient
::
is_srvpro
=
false
;
bool
DuelClient
::
StartClient
(
unsigned
int
ip
,
unsigned
short
port
,
bool
create_game
)
{
if
(
connect_state
)
...
...
@@ -357,6 +359,62 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
break
;
}
case
STOC_SRVPRO_ROOMLIST
:
{
is_srvpro
=
true
;
mainGame
->
gMutex
.
Lock
();
mainGame
->
lstHostList
->
clear
();
hosts_srvpro
.
clear
();
unsigned
short
count
=
BufferIO
::
ReadUInt16
(
pdata
);
char
temp1
[
64
];
char
temp2
[
128
];
for
(
unsigned
short
i
=
0
;
i
<
count
;
++
i
)
{
wchar_t
roomname
[
32
];
wchar_t
player1
[
64
];
wchar_t
player2
[
64
];
wchar_t
hoststr
[
1024
];
memcpy
(
temp1
,
pdata
,
64
);
pdata
+=
64
;
BufferIO
::
DecodeUTF8
(
temp1
,
roomname
);
unsigned
char
room_status
=
BufferIO
::
ReadUInt8
(
pdata
);
char
room_duel_count
=
BufferIO
::
ReadInt8
(
pdata
);
char
room_turn_count
=
BufferIO
::
ReadInt8
(
pdata
);
memcpy
(
temp2
,
pdata
,
128
);
pdata
+=
128
;
BufferIO
::
DecodeUTF8
(
temp2
,
player1
);
char
player1_score
=
BufferIO
::
ReadInt8
(
pdata
);
int
player1_lp
=
BufferIO
::
ReadInt32
(
pdata
);
memcpy
(
temp2
,
pdata
,
128
);
pdata
+=
128
;
BufferIO
::
DecodeUTF8
(
temp2
,
player2
);
char
player2_score
=
BufferIO
::
ReadInt8
(
pdata
);
int
player2_lp
=
BufferIO
::
ReadInt32
(
pdata
);
hosts_srvpro
.
push_back
(
std
::
wstring
(
roomname
));
switch
(
room_status
)
{
case
0
:
{
myswprintf
(
hoststr
,
L"[SRVPro][Waiting][%ls] %ls VS %ls"
,
roomname
,
player1
,
player2
);
break
;
}
case
1
:
{
myswprintf
(
hoststr
,
L"[SRVPro][G%d,T%d][%ls] (%d,LP%d) %ls VS %ls (%d,LP%d)"
,
room_duel_count
,
room_turn_count
,
roomname
,
player1_score
,
player1_lp
,
player1
,
player2
,
player2_score
,
player2_lp
);
break
;
}
case
2
:
{
myswprintf
(
hoststr
,
L"[SRVPro][G%d,Siding][%ls] (%d) %ls VS %ls (%d)"
,
room_duel_count
,
roomname
,
player1_score
,
player1
,
player2
,
player2_score
);
break
;
}
}
mainGame
->
lstHostList
->
addItem
(
hoststr
);
}
mainGame
->
gMutex
.
Unlock
();
break
;
}
case
STOC_SELECT_HAND
:
{
mainGame
->
wHand
->
setVisible
(
true
);
break
;
...
...
@@ -3922,6 +3980,7 @@ void DuelClient::BeginRefreshHost() {
if
(
is_refreshing
)
return
;
is_refreshing
=
true
;
DuelClient
::
is_srvpro
=
false
;
mainGame
->
btnLanRefresh
->
setEnabled
(
false
);
mainGame
->
lstHostList
->
clear
();
remotes
.
clear
();
...
...
gframe/duelclient.h
View file @
12f0c719
...
...
@@ -79,6 +79,8 @@ protected:
static
std
::
set
<
unsigned
int
>
remotes
;
public:
static
std
::
vector
<
HostPacket
>
hosts
;
static
std
::
vector
<
std
::
wstring
>
hosts_srvpro
;
static
bool
is_srvpro
;
static
void
BeginRefreshHost
();
static
int
RefreshThread
(
void
*
arg
);
static
void
BroadcastReply
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
...
...
gframe/menu_handler.cpp
View file @
12f0c719
...
...
@@ -456,6 +456,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int
sel
=
mainGame
->
lstHostList
->
getSelected
();
if
(
sel
==
-
1
)
break
;
if
(
DuelClient
::
is_srvpro
)
{
mainGame
->
ebJoinPass
->
setText
(
DuelClient
::
hosts_srvpro
[
sel
].
c_str
());
break
;
}
int
addr
=
DuelClient
::
hosts
[
sel
].
ipaddr
;
int
port
=
DuelClient
::
hosts
[
sel
].
port
;
wchar_t
buf
[
20
];
...
...
gframe/network.h
View file @
12f0c719
...
...
@@ -196,6 +196,7 @@ public:
#define STOC_HS_PLAYER_ENTER 0x20
#define STOC_HS_PLAYER_CHANGE 0x21
#define STOC_HS_WATCH_CHANGE 0x22
#define STOC_SRVPRO_ROOMLIST 0x31
#define PLAYERCHANGE_OBSERVE 0x8
#define PLAYERCHANGE_READY 0x9
...
...
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