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
nanahira
ygopro
Commits
67f6d60c
Commit
67f6d60c
authored
Nov 29, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test roomlist
parent
db728403
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
0 deletions
+65
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+58
-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/duelclient.cpp
View file @
67f6d60c
...
...
@@ -37,6 +37,7 @@ 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 +358,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);
unsigned short temp1[20];
unsigned short temp2[41];
for(unsigned short i = 0; i < count; ++i) {
wchar_t roomname[20];
wchar_t player1[41];
wchar_t player2[41];
wchar_t hoststr[1024];
memcpy(temp1, pdata, 40);
pdata += 40;
BufferIO::CopyWStr(roomname, temp1, 20);
unsigned char room_status = BufferIO::ReadUInt8(pdata);
char room_duel_count = BufferIO::ReadInt8(pdata);
char room_turn_count = BufferIO::ReadInt8(pdata);
memcpy(temp2, pdata, 82);
pdata += 82;
BufferIO::CopyWStr(player1, temp2, 41);
char player1_score = BufferIO::ReadInt8(pdata);
int player1_lp = BufferIO::ReadInt32(pdata);
memcpy(temp2, pdata, 82);
pdata += 82;
BufferIO::CopyWStr(player2, temp2, 41);
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 +3979,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 @
67f6d60c
...
...
@@ -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 @
67f6d60c
...
...
@@ -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 @
67f6d60c
...
...
@@ -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