Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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-2pick
Commits
afe6dbca
Commit
afe6dbca
authored
Jan 12, 2012
by
argon.sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proto
parent
42ea0f69
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
18 deletions
+27
-18
gframe/duelclient.cpp
gframe/duelclient.cpp
+23
-15
gframe/duelclient.h
gframe/duelclient.h
+2
-2
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+1
-0
system.conf
system.conf
+1
-1
No files found.
gframe/duelclient.cpp
View file @
afe6dbca
...
...
@@ -13,7 +13,7 @@ char DuelClient::duel_client_read[0x2000];
char
DuelClient
::
duel_client_write
[
0x2000
];
bool
DuelClient
::
is_closing
=
false
;
bool
DuelClient
::
StartClient
(
unsigned
int
ip
,
unsigned
short
port
)
{
bool
DuelClient
::
StartClient
(
unsigned
int
ip
,
unsigned
short
port
,
bool
create_game
)
{
if
(
connect_state
)
return
false
;
sockaddr_in
sin
;
...
...
@@ -25,7 +25,7 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port) {
sin
.
sin_addr
.
s_addr
=
htonl
(
ip
);
sin
.
sin_port
=
htons
(
port
);
client_bev
=
bufferevent_socket_new
(
client_base
,
-
1
,
BEV_OPT_CLOSE_ON_FREE
);
bufferevent_setcb
(
client_bev
,
ClientRead
,
NULL
,
ClientEvent
,
NULL
);
bufferevent_setcb
(
client_bev
,
ClientRead
,
NULL
,
ClientEvent
,
(
void
*
)
create_game
);
if
(
bufferevent_socket_connect
(
client_bev
,
(
sockaddr
*
)
&
sin
,
sizeof
(
sin
))
<
0
)
{
bufferevent_free
(
client_bev
);
return
false
;
...
...
@@ -63,25 +63,33 @@ void DuelClient::ClientRead(bufferevent* bev, void* ctx) {
len
-=
packet_len
+
2
;
}
}
void
DuelClient
::
ClientEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ptr
)
{
void
DuelClient
::
ClientEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ctx
)
{
if
(
events
&
BEV_EVENT_CONNECTED
)
{
bool
create_game
=
(
bool
)
ctx
;
mainGame
->
HideElement
(
mainGame
->
wCreateHost
);
mainGame
->
WaitFrameSignal
(
10
);
CTOS_PlayerInfo
cspi
;
BufferIO
::
CopyWStr
(
mainGame
->
ebNickName
->
getText
(),
cspi
.
name
,
20
);
SendPacketToServer
(
CTOS_PLAYER_INFO
,
cspi
);
CTOS_CreateGame
cscg
;
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
cscg
.
name
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebServerPass
->
getText
(),
cscg
.
pass
,
20
);
cscg
.
info
.
rule
=
mainGame
->
cbRule
->
getSelected
();
cscg
.
info
.
mode
=
mainGame
->
cbMatchMode
->
getSelected
();
cscg
.
info
.
start_hand
=
_wtoi
(
mainGame
->
ebStartHand
->
getText
());
cscg
.
info
.
start_lp
=
_wtoi
(
mainGame
->
ebStartLP
->
getText
());
cscg
.
info
.
draw_count
=
_wtoi
(
mainGame
->
ebDrawCount
->
getText
());
cscg
.
info
.
lflist
=
mainGame
->
cbLFlist
->
getItemData
(
mainGame
->
cbLFlist
->
getSelected
());
cscg
.
info
.
no_check_deck
=
mainGame
->
chkNoCheckDeck
->
isChecked
();
cscg
.
info
.
no_shuffle_deck
=
mainGame
->
chkNoShuffleDeck
->
isChecked
();
SendPacketToServer
(
CTOS_CREATE_GAME
,
cscg
);
if
(
create_game
)
{
CTOS_CreateGame
cscg
;
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
cscg
.
name
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebServerPass
->
getText
(),
cscg
.
pass
,
20
);
cscg
.
info
.
rule
=
mainGame
->
cbRule
->
getSelected
();
cscg
.
info
.
mode
=
mainGame
->
cbMatchMode
->
getSelected
();
cscg
.
info
.
start_hand
=
_wtoi
(
mainGame
->
ebStartHand
->
getText
());
cscg
.
info
.
start_lp
=
_wtoi
(
mainGame
->
ebStartLP
->
getText
());
cscg
.
info
.
draw_count
=
_wtoi
(
mainGame
->
ebDrawCount
->
getText
());
cscg
.
info
.
lflist
=
mainGame
->
cbLFlist
->
getItemData
(
mainGame
->
cbLFlist
->
getSelected
());
cscg
.
info
.
no_check_deck
=
mainGame
->
chkNoCheckDeck
->
isChecked
();
cscg
.
info
.
no_shuffle_deck
=
mainGame
->
chkNoShuffleDeck
->
isChecked
();
SendPacketToServer
(
CTOS_CREATE_GAME
,
cscg
);
}
else
{
CTOS_JoinGame
csjg
;
csjg
.
gameid
=
0
;
BufferIO
::
CopyWStr
(
mainGame
->
ebJoinPass
->
getText
(),
csjg
.
pass
,
20
);
SendPacketToServer
(
CTOS_JOIN_GAME
,
csjg
);
}
bufferevent_enable
(
bev
,
EV_READ
);
connect_state
=
2
;
}
else
if
(
events
&
BEV_EVENT_ERROR
)
{
...
...
gframe/duelclient.h
View file @
afe6dbca
...
...
@@ -25,10 +25,10 @@ private:
static
char
duel_client_write
[
0x2000
];
static
bool
is_closing
;
public:
static
bool
StartClient
(
unsigned
int
ip
,
unsigned
short
port
);
static
bool
StartClient
(
unsigned
int
ip
,
unsigned
short
port
,
bool
create_game
=
true
);
static
void
StopClient
(
bool
is_exiting
=
false
);
static
void
ClientRead
(
bufferevent
*
bev
,
void
*
ctx
);
static
void
ClientEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ptr
);
static
void
ClientEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ctx
);
static
int
ClientThread
(
void
*
param
);
static
void
HandleSTOCPacketLan
(
char
*
data
,
unsigned
int
len
);
static
void
SetResponseI
(
int
respI
);
...
...
gframe/menu_handler.cpp
View file @
afe6dbca
...
...
@@ -190,6 +190,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case
CHECKBOX_HS_READY
:
{
if
(
!
caller
->
isEnabled
())
break
;
mainGame
->
env
->
setFocus
(
mainGame
->
wHostSingle
);
DuelClient
::
SendPacketToServer
(
CTOS_HS_READY
);
break
;
}
...
...
system.conf
View file @
afe6dbca
#config file
#nickname & gamename should be less than 20 characters
antialias
=
2
nickname
=
Player
1
锈蚀水雾
nickname
=
Player
gamename
=
Game
lastdeck
=
infernity
textfont
=
c
:/
windows
/
fonts
/
simsun
.
ttc
...
...
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