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
dbeeeac5
Commit
dbeeeac5
authored
Dec 19, 2011
by
argon.sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
3931d638
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
29 deletions
+56
-29
gframe/event_handler.cpp
gframe/event_handler.cpp
+3
-3
gframe/game.cpp
gframe/game.cpp
+16
-7
gframe/game.h
gframe/game.h
+2
-0
gframe/network.cpp
gframe/network.cpp
+29
-13
gframe/network.h
gframe/network.h
+4
-4
script/c16255442.lua
script/c16255442.lua
+1
-1
script/c9059700.lua
script/c9059700.lua
+1
-1
No files found.
gframe/event_handler.cpp
View file @
dbeeeac5
...
@@ -42,7 +42,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -42,7 +42,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
ebStartLP
->
setText
(
L"5"
);
mainGame
->
ebStartLP
->
setText
(
L"5"
);
if
(
_wtoi
(
mainGame
->
ebDrawCount
->
getText
())
==
0
)
if
(
_wtoi
(
mainGame
->
ebDrawCount
->
getText
())
==
0
)
mainGame
->
ebStartLP
->
setText
(
L"1"
);
mainGame
->
ebStartLP
->
setText
(
L"1"
);
if
(
mainGame
->
netManager
.
CreateHost
())
{
if
(
mainGame
->
netManager
.
CreateHost
(
mainGame
->
cbIPList
->
getSelected
()
))
{
mainGame
->
btnLanStartServer
->
setEnabled
(
false
);
mainGame
->
btnLanStartServer
->
setEnabled
(
false
);
mainGame
->
btnLanCancelServer
->
setEnabled
(
true
);
mainGame
->
btnLanCancelServer
->
setEnabled
(
true
);
mainGame
->
btnLanConnect
->
setEnabled
(
false
);
mainGame
->
btnLanConnect
->
setEnabled
(
false
);
...
@@ -59,7 +59,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -59,7 +59,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_LAN_REFRESH
:
{
case
BUTTON_LAN_REFRESH
:
{
if
(
mainGame
->
netManager
.
RefreshHost
())
{
if
(
mainGame
->
netManager
.
RefreshHost
(
mainGame
->
cbIPList
->
getSelected
()
))
{
mainGame
->
btnLanStartServer
->
setEnabled
(
false
);
mainGame
->
btnLanStartServer
->
setEnabled
(
false
);
mainGame
->
btnLanConnect
->
setEnabled
(
false
);
mainGame
->
btnLanConnect
->
setEnabled
(
false
);
mainGame
->
btnRefreshList
->
setEnabled
(
false
);
mainGame
->
btnRefreshList
->
setEnabled
(
false
);
...
@@ -813,7 +813,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -813,7 +813,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if
(
mainGame
->
wModes
->
getActiveTab
()
==
1
)
{
if
(
mainGame
->
wModes
->
getActiveTab
()
==
1
)
{
if
(
mainGame
->
is_refreshing
||
mainGame
->
netManager
.
is_creating_host
)
if
(
mainGame
->
is_refreshing
||
mainGame
->
netManager
.
is_creating_host
)
break
;
break
;
if
(
mainGame
->
netManager
.
RefreshHost
())
{
if
(
mainGame
->
netManager
.
RefreshHost
(
mainGame
->
cbIPList
->
getSelected
()
))
{
mainGame
->
btnLanStartServer
->
setEnabled
(
false
);
mainGame
->
btnLanStartServer
->
setEnabled
(
false
);
mainGame
->
btnLanConnect
->
setEnabled
(
false
);
mainGame
->
btnLanConnect
->
setEnabled
(
false
);
mainGame
->
btnRefreshList
->
setEnabled
(
false
);
mainGame
->
btnRefreshList
->
setEnabled
(
false
);
...
...
gframe/game.cpp
View file @
dbeeeac5
...
@@ -38,7 +38,7 @@ bool Game::Initialize() {
...
@@ -38,7 +38,7 @@ bool Game::Initialize() {
dField
.
device
=
device
;
dField
.
device
=
device
;
deckBuilder
.
device
=
device
;
deckBuilder
.
device
=
device
;
memset
(
&
dInfo
,
0
,
sizeof
(
DuelInfo
));
memset
(
&
dInfo
,
0
,
sizeof
(
DuelInfo
));
netManager
.
local_addr
=
NetManager
::
GetLocalAddress
();
netManager
.
GetLocalAddress
();
netManager
.
send_buffer_ptr
=
&
netManager
.
send_buf
[
2
];
netManager
.
send_buffer_ptr
=
&
netManager
.
send_buf
[
2
];
deckManager
.
LoadLFList
();
deckManager
.
LoadLFList
();
driver
=
device
->
getVideoDriver
();
driver
=
device
->
getVideoDriver
();
...
@@ -52,8 +52,7 @@ bool Game::Initialize() {
...
@@ -52,8 +52,7 @@ bool Game::Initialize() {
smgr
=
device
->
getSceneManager
();
smgr
=
device
->
getSceneManager
();
device
->
setWindowCaption
(
L"[---]"
);
device
->
setWindowCaption
(
L"[---]"
);
device
->
setResizable
(
false
);
device
->
setResizable
(
false
);
myswprintf
(
dataManager
.
strBuffer
,
L"模式选择(当前IP:%d.%d.%d.%d 版本:0x%X)"
,
netManager
.
local_addr
&
0xff
,
(
netManager
.
local_addr
>>
8
)
&
0xff
,
myswprintf
(
dataManager
.
strBuffer
,
L"YGOPro Version:0x%X)"
,
PROTO_VERSION
);
(
netManager
.
local_addr
>>
16
)
&
0xff
,
(
netManager
.
local_addr
>>
24
)
&
0xff
,
PROTO_VERSION
);
wModeSelection
=
env
->
addWindow
(
rect
<
s32
>
(
270
,
100
,
750
,
490
),
false
,
dataManager
.
strBuffer
);
wModeSelection
=
env
->
addWindow
(
rect
<
s32
>
(
270
,
100
,
750
,
490
),
false
,
dataManager
.
strBuffer
);
wModeSelection
->
getCloseButton
()
->
setVisible
(
false
);
wModeSelection
->
getCloseButton
()
->
setVisible
(
false
);
wModes
=
env
->
addTabControl
(
rect
<
s32
>
(
5
,
60
,
475
,
350
),
wModeSelection
,
false
,
true
,
TAB_MODES
);
wModes
=
env
->
addTabControl
(
rect
<
s32
>
(
5
,
60
,
475
,
350
),
wModeSelection
,
false
,
true
,
TAB_MODES
);
...
@@ -119,13 +118,23 @@ bool Game::Initialize() {
...
@@ -119,13 +118,23 @@ bool Game::Initialize() {
lstReplayList
->
setItemHeight
(
18
);
lstReplayList
->
setItemHeight
(
18
);
btnLoadReplay
=
env
->
addButton
(
rect
<
s32
>
(
180
,
200
,
280
,
225
),
tabReplay
,
BUTTON_LOAD_REPLAY
,
L"载入录像"
);
btnLoadReplay
=
env
->
addButton
(
rect
<
s32
>
(
180
,
200
,
280
,
225
),
tabReplay
,
BUTTON_LOAD_REPLAY
,
L"载入录像"
);
env
->
addStaticText
(
L"昵称:"
,
rect
<
s32
>
(
10
,
30
,
90
,
50
),
false
,
false
,
wModeSelection
);
env
->
addStaticText
(
L"昵称:"
,
rect
<
s32
>
(
10
,
30
,
90
,
50
),
false
,
false
,
wModeSelection
);
ebUsername
=
env
->
addEditBox
(
L""
,
rect
<
s32
>
(
80
,
25
,
2
6
0
,
50
),
true
,
wModeSelection
);
ebUsername
=
env
->
addEditBox
(
L""
,
rect
<
s32
>
(
80
,
25
,
2
4
0
,
50
),
true
,
wModeSelection
);
ebUsername
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
ebUsername
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
env
->
addStaticText
(
L"卡组:"
,
rect
<
s32
>
(
2
7
0
,
30
,
350
,
50
),
false
,
false
,
wModeSelection
);
env
->
addStaticText
(
L"卡组:"
,
rect
<
s32
>
(
2
5
0
,
30
,
350
,
50
),
false
,
false
,
wModeSelection
);
cbDeckSel
=
env
->
addComboBox
(
rect
<
s32
>
(
3
20
,
25
,
47
0
,
50
),
wModeSelection
,
-
1
);
cbDeckSel
=
env
->
addComboBox
(
rect
<
s32
>
(
3
10
,
25
,
41
0
,
50
),
wModeSelection
,
-
1
);
RefreshDeck
(
cbDeckSel
);
RefreshDeck
(
cbDeckSel
);
btnDeckEdit
=
env
->
addButton
(
rect
<
s32
>
(
4
10
,
55
,
470
,
8
0
),
wModeSelection
,
BUTTON_DECK_EDIT
,
L"编辑"
);
btnDeckEdit
=
env
->
addButton
(
rect
<
s32
>
(
4
20
,
25
,
470
,
5
0
),
wModeSelection
,
BUTTON_DECK_EDIT
,
L"编辑"
);
stModeStatus
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
20
,
360
,
350
,
380
),
false
,
false
,
wModeSelection
);
stModeStatus
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
20
,
360
,
350
,
380
),
false
,
false
,
wModeSelection
);
env
->
addStaticText
(
L"IP选择:"
,
rect
<
s32
>
(
250
,
55
,
350
,
80
),
false
,
false
,
wModeSelection
);
cbIPList
=
env
->
addComboBox
(
rect
<
s32
>
(
310
,
55
,
470
,
75
),
wModeSelection
,
COMBOBOX_IPADDR
);
int
ipi
=
0
;
while
(
netManager
.
local_addr
[
ipi
])
{
myswprintf
(
dataManager
.
strBuffer
,
L"%d.%d.%d.%d"
,
netManager
.
local_addr
[
ipi
]
&
0xff
,
(
netManager
.
local_addr
[
ipi
]
>>
8
)
&
0xff
,
(
netManager
.
local_addr
[
ipi
]
>>
16
)
&
0xff
,
(
netManager
.
local_addr
[
ipi
]
>>
24
)
&
0xff
);
cbIPList
->
addItem
(
dataManager
.
strBuffer
);
ipi
++
;
}
cbIPList
->
setSelected
(
0
);
btnModeExit
=
env
->
addButton
(
rect
<
s32
>
(
380
,
355
,
470
,
380
),
wModeSelection
,
BUTTON_MODE_EXIT
,
L"退出"
);
btnModeExit
=
env
->
addButton
(
rect
<
s32
>
(
380
,
355
,
470
,
380
),
wModeSelection
,
BUTTON_MODE_EXIT
,
L"退出"
);
//img
//img
wCardImg
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
1
,
1
,
199
,
273
),
true
,
false
,
0
,
-
1
,
true
);
wCardImg
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
1
,
1
,
199
,
273
),
true
,
false
,
0
,
-
1
,
true
);
...
...
gframe/game.h
View file @
dbeeeac5
...
@@ -223,6 +223,7 @@ public:
...
@@ -223,6 +223,7 @@ public:
irr
::
gui
::
IGUIComboBox
*
cbDeckSel
;
irr
::
gui
::
IGUIComboBox
*
cbDeckSel
;
irr
::
gui
::
IGUIButton
*
btnDeckEdit
;
irr
::
gui
::
IGUIButton
*
btnDeckEdit
;
irr
::
gui
::
IGUIStaticText
*
stModeStatus
;
irr
::
gui
::
IGUIStaticText
*
stModeStatus
;
irr
::
gui
::
IGUIComboBox
*
cbIPList
;
irr
::
gui
::
IGUIButton
*
btnModeExit
;
irr
::
gui
::
IGUIButton
*
btnModeExit
;
//message
//message
irr
::
gui
::
IGUIWindow
*
wMessage
;
irr
::
gui
::
IGUIWindow
*
wMessage
;
...
@@ -348,6 +349,7 @@ extern Game* mainGame;
...
@@ -348,6 +349,7 @@ extern Game* mainGame;
#define BUTTON_SAVE_LOG 100
#define BUTTON_SAVE_LOG 100
#define BUTTON_CLEAR_LOG 101
#define BUTTON_CLEAR_LOG 101
#define LISTBOX_LOG 102
#define LISTBOX_LOG 102
#define COMBOBOX_IPADDR 109
#define BUTTON_LAN_START_SERVER 110
#define BUTTON_LAN_START_SERVER 110
#define BUTTON_LAN_CANCEL_SERVER 111
#define BUTTON_LAN_CANCEL_SERVER 111
#define BUTTON_LAN_CONNECT 112
#define BUTTON_LAN_CONNECT 112
...
...
gframe/network.cpp
View file @
dbeeeac5
...
@@ -3,14 +3,13 @@
...
@@ -3,14 +3,13 @@
namespace
ygo
{
namespace
ygo
{
const
unsigned
short
PROTO_VERSION
=
0x101
6
;
const
unsigned
short
PROTO_VERSION
=
0x101
7
;
bool
NetManager
::
CreateHost
()
{
bool
NetManager
::
CreateHost
(
int
ipindex
)
{
wchar_t
*
pstr
;
wchar_t
*
pstr
;
int
wp
;
int
wp
;
hInfo
.
identifier
=
NETWORK_SERVER_ID
;
hInfo
.
identifier
=
NETWORK_SERVER_ID
;
hInfo
.
version
=
PROTO_VERSION
;
hInfo
.
version
=
PROTO_VERSION
;
hInfo
.
address
=
mainGame
->
netManager
.
local_addr
;
for
(
wp
=
0
,
pstr
=
(
wchar_t
*
)
mainGame
->
ebServerName
->
getText
();
wp
<
19
&&
pstr
[
wp
];
++
wp
)
for
(
wp
=
0
,
pstr
=
(
wchar_t
*
)
mainGame
->
ebServerName
->
getText
();
wp
<
19
&&
pstr
[
wp
];
++
wp
)
hInfo
.
name
[
wp
]
=
pstr
[
wp
];
hInfo
.
name
[
wp
]
=
pstr
[
wp
];
hInfo
.
port
=
serv_port
;
hInfo
.
port
=
serv_port
;
...
@@ -35,7 +34,10 @@ bool NetManager::CreateHost() {
...
@@ -35,7 +34,10 @@ bool NetManager::CreateHost() {
BOOL
opt
=
TRUE
;
BOOL
opt
=
TRUE
;
setsockopt
(
sBHost
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
));
setsockopt
(
sBHost
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
));
SOCKADDR_IN
local
;
SOCKADDR_IN
local
;
local
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
if
(
ipindex
==
-
1
)
local
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
else
local
.
sin_addr
.
s_addr
=
local_addr
[
ipindex
];
local
.
sin_family
=
AF_INET
;
local
.
sin_family
=
AF_INET
;
local
.
sin_port
=
htons
(
7913
);
local
.
sin_port
=
htons
(
7913
);
if
(
::
bind
(
sBHost
,
(
sockaddr
*
)
&
local
,
sizeof
(
sockaddr
))
==
SOCKET_ERROR
)
{
if
(
::
bind
(
sBHost
,
(
sockaddr
*
)
&
local
,
sizeof
(
sockaddr
))
==
SOCKET_ERROR
)
{
...
@@ -65,14 +67,17 @@ bool NetManager::CancelHost() {
...
@@ -65,14 +67,17 @@ bool NetManager::CancelHost() {
closesocket
(
sListen
);
closesocket
(
sListen
);
is_creating_host
=
false
;
is_creating_host
=
false
;
}
}
bool
NetManager
::
RefreshHost
()
{
bool
NetManager
::
RefreshHost
(
int
ipindex
)
{
sBClient
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
sBClient
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
if
(
sBClient
==
INVALID_SOCKET
)
if
(
sBClient
==
INVALID_SOCKET
)
return
false
;
return
false
;
BOOL
opt
=
TRUE
;
BOOL
opt
=
TRUE
;
setsockopt
(
sBClient
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
));
setsockopt
(
sBClient
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
));
SOCKADDR_IN
local
;
SOCKADDR_IN
local
;
local
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
if
(
ipindex
==
-
1
)
local
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
else
local
.
sin_addr
.
s_addr
=
local_addr
[
ipindex
];
local
.
sin_family
=
AF_INET
;
local
.
sin_family
=
AF_INET
;
local
.
sin_port
=
htons
(
7912
);
local
.
sin_port
=
htons
(
7912
);
hReq
.
identifier
=
NETWORK_CLIENT_ID
;
hReq
.
identifier
=
NETWORK_CLIENT_ID
;
...
@@ -154,18 +159,26 @@ int NetManager::GetLocalAddress() {
...
@@ -154,18 +159,26 @@ int NetManager::GetLocalAddress() {
hostent
*
host
=
gethostbyname
(
hname
);
hostent
*
host
=
gethostbyname
(
hname
);
if
(
!
host
)
if
(
!
host
)
return
0
;
return
0
;
return
*
(
int
*
)
host
->
h_addr_list
[
0
];
int
i
=
0
;
for
(
i
=
0
;
i
<
8
;
++
i
)
{
local_addr
[
i
]
=
0
;
if
(
host
->
h_addr_list
[
i
]
==
0
)
break
;
local_addr
[
i
]
=
*
(
unsigned
int
*
)
host
->
h_addr_list
[
i
];
}
return
i
;
}
}
int
NetManager
::
BroadcastServer
(
void
*
np
)
{
int
NetManager
::
BroadcastServer
(
void
*
np
)
{
NetManager
*
net
=
(
NetManager
*
)
np
;
NetManager
*
net
=
(
NetManager
*
)
np
;
SOCKADDR_IN
sockTo
;
SOCKADDR_IN
sockTo
;
sockTo
.
sin_addr
.
s_addr
=
htonl
(
INADDR_BROADCAST
);
sockTo
.
sin_family
=
AF_INET
;
sockTo
.
sin_family
=
AF_INET
;
sockTo
.
sin_port
=
htons
(
7912
);
sockTo
.
sin_port
=
htons
(
7912
);
int
recvLen
=
recvfrom
(
net
->
sBHost
,
(
char
*
)
&
net
->
hReq
,
sizeof
(
HostRequest
),
0
,
0
,
0
);
int
recvLen
=
recvfrom
(
net
->
sBHost
,
(
char
*
)
&
net
->
hReq
,
sizeof
(
HostRequest
),
0
,
0
,
0
);
while
(
recvLen
!=
0
&&
recvLen
!=
SOCKET_ERROR
)
{
while
(
recvLen
!=
0
&&
recvLen
!=
SOCKET_ERROR
)
{
if
(
recvLen
==
sizeof
(
HostRequest
)
&&
net
->
hReq
.
identifier
==
NETWORK_CLIENT_ID
)
if
(
recvLen
==
sizeof
(
HostRequest
)
&&
net
->
hReq
.
identifier
==
NETWORK_CLIENT_ID
)
{
sockTo
.
sin_addr
.
s_addr
=
htonl
(
INADDR_BROADCAST
);
sendto
(
net
->
sBHost
,
(
const
char
*
)
&
net
->
hInfo
,
sizeof
(
HostInfo
),
0
,
(
sockaddr
*
)
&
sockTo
,
sizeof
(
sockaddr
));
sendto
(
net
->
sBHost
,
(
const
char
*
)
&
net
->
hInfo
,
sizeof
(
HostInfo
),
0
,
(
sockaddr
*
)
&
sockTo
,
sizeof
(
sockaddr
));
}
recvLen
=
recvfrom
(
net
->
sBHost
,
(
char
*
)
&
net
->
hReq
,
sizeof
(
HostRequest
),
0
,
0
,
0
);
recvLen
=
recvfrom
(
net
->
sBHost
,
(
char
*
)
&
net
->
hReq
,
sizeof
(
HostRequest
),
0
,
0
,
0
);
}
}
net
->
is_creating_host
=
false
;
net
->
is_creating_host
=
false
;
...
@@ -191,8 +204,8 @@ int NetManager::BroadcastClient(void* np) {
...
@@ -191,8 +204,8 @@ int NetManager::BroadcastClient(void* np) {
sockTo
.
sin_port
=
htons
(
7913
);
sockTo
.
sin_port
=
htons
(
7913
);
fd_set
fds
;
fd_set
fds
;
timeval
tv
;
timeval
tv
;
tv
.
tv_sec
=
0
;
tv
.
tv_sec
=
1
;
tv
.
tv_usec
=
50000
0
;
tv
.
tv_usec
=
0
;
FD_ZERO
(
&
fds
);
FD_ZERO
(
&
fds
);
FD_SET
(
net
->
sBClient
,
&
fds
);
FD_SET
(
net
->
sBClient
,
&
fds
);
sendto
(
net
->
sBClient
,
(
const
char
*
)
&
net
->
hReq
,
sizeof
(
HostRequest
),
0
,
(
sockaddr
*
)
&
sockTo
,
sizeof
(
sockaddr
));
sendto
(
net
->
sBClient
,
(
const
char
*
)
&
net
->
hReq
,
sizeof
(
HostRequest
),
0
,
(
sockaddr
*
)
&
sockTo
,
sizeof
(
sockaddr
));
...
@@ -201,10 +214,13 @@ int NetManager::BroadcastClient(void* np) {
...
@@ -201,10 +214,13 @@ int NetManager::BroadcastClient(void* np) {
int
result
=
select
(
0
,
&
fds
,
0
,
0
,
&
tv
);
int
result
=
select
(
0
,
&
fds
,
0
,
0
,
&
tv
);
std
::
set
<
int
>
addrset
;
std
::
set
<
int
>
addrset
;
net
->
hosts
.
clear
();
net
->
hosts
.
clear
();
SOCKADDR_IN
sockFrom
;
int
sz
=
sizeof
(
SOCKADDR_IN
);
while
(
result
!=
0
&&
result
!=
SOCKET_ERROR
)
{
while
(
result
!=
0
&&
result
!=
SOCKET_ERROR
)
{
int
recvLen
=
recvfrom
(
net
->
sBClient
,
(
char
*
)
&
net
->
hInfo
,
sizeof
(
HostInfo
),
0
,
0
,
0
);
int
recvLen
=
recvfrom
(
net
->
sBClient
,
(
char
*
)
&
net
->
hInfo
,
sizeof
(
HostInfo
),
0
,
(
sockaddr
*
)
&
sockFrom
,
&
sz
);
if
(
recvLen
==
sizeof
(
HostInfo
)
&&
net
->
hInfo
.
identifier
==
NETWORK_SERVER_ID
if
(
recvLen
==
sizeof
(
HostInfo
)
&&
net
->
hInfo
.
identifier
==
NETWORK_SERVER_ID
&&
net
->
hInfo
.
version
==
PROTO_VERSION
&&
addrset
.
find
(
net
->
hInfo
.
address
)
==
addrset
.
end
())
{
&&
net
->
hInfo
.
version
==
PROTO_VERSION
&&
addrset
.
find
(
sockFrom
.
sin_addr
.
s_addr
)
==
addrset
.
end
())
{
net
->
hInfo
.
address
=
sockFrom
.
sin_addr
.
s_addr
;
net
->
hosts
.
push_back
(
net
->
hInfo
);
net
->
hosts
.
push_back
(
net
->
hInfo
);
}
}
result
=
select
(
0
,
&
fds
,
0
,
0
,
&
tv
);
result
=
select
(
0
,
&
fds
,
0
,
0
,
&
tv
);
...
...
gframe/network.h
View file @
dbeeeac5
...
@@ -33,7 +33,7 @@ struct HostRequest {
...
@@ -33,7 +33,7 @@ struct HostRequest {
class
NetManager
{
class
NetManager
{
public:
public:
unsigned
int
local_addr
;
unsigned
int
local_addr
[
8
]
;
unsigned
short
serv_port
;
unsigned
short
serv_port
;
unsigned
int
remote_addr
;
unsigned
int
remote_addr
;
unsigned
short
remote_port
;
unsigned
short
remote_port
;
...
@@ -49,9 +49,9 @@ public:
...
@@ -49,9 +49,9 @@ public:
char
send_buf
[
4096
];
char
send_buf
[
4096
];
char
recv_buf
[
4096
];
char
recv_buf
[
4096
];
bool
CreateHost
();
bool
CreateHost
(
int
ipindex
);
bool
CancelHost
();
bool
CancelHost
();
bool
RefreshHost
();
bool
RefreshHost
(
int
ipindex
);
bool
JoinHost
();
bool
JoinHost
();
bool
SendtoRemote
(
char
*
buf
,
int
len
);
bool
SendtoRemote
(
char
*
buf
,
int
len
);
bool
WaitClientResponse
();
bool
WaitClientResponse
();
...
@@ -89,7 +89,7 @@ public:
...
@@ -89,7 +89,7 @@ public:
p
++
;
p
++
;
}
}
static
int
GetLocalAddress
();
int
GetLocalAddress
();
static
int
BroadcastServer
(
void
*
);
static
int
BroadcastServer
(
void
*
);
static
int
BroadcastClient
(
void
*
);
static
int
BroadcastClient
(
void
*
);
static
int
ListenThread
(
void
*
);
static
int
ListenThread
(
void
*
);
...
...
script/c16255442.lua
View file @
dbeeeac5
...
@@ -25,7 +25,7 @@ end
...
@@ -25,7 +25,7 @@ end
function
c16255442
.
operation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c16255442
.
operation
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
local
sg
=
Duel
.
GetFieldGroup
(
tp
,
LOCATION_HAND
,
0
,
nil
)
local
sg
=
Duel
.
GetFieldGroup
(
tp
,
LOCATION_HAND
,
0
,
nil
)
local
sct
=
sg
:
GetCount
()
local
sct
=
sg
:
GetCount
()
Duel
.
SendtoGrave
(
sg
,
REASON_EFFECT
)
Duel
.
SendtoGrave
(
sg
,
REASON_EFFECT
+
REASON_DISCARD
)
local
tg
=
Duel
.
GetMatchingGroup
(
c16255442
.
filter
,
tp
,
LOCATION_GRAVE
,
0
,
nil
)
local
tg
=
Duel
.
GetMatchingGroup
(
c16255442
.
filter
,
tp
,
LOCATION_GRAVE
,
0
,
nil
)
if
tg
:
GetCount
()
>=
sct
then
if
tg
:
GetCount
()
>=
sct
then
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_ATOHAND
)
Duel
.
Hint
(
HINT_SELECTMSG
,
tp
,
HINTMSG_ATOHAND
)
...
...
script/c9059700.lua
View file @
dbeeeac5
...
@@ -11,7 +11,7 @@ function c9059700.initial_effect(c)
...
@@ -11,7 +11,7 @@ function c9059700.initial_effect(c)
c
:
RegisterEffect
(
e1
)
c
:
RegisterEffect
(
e1
)
end
end
function
c9059700
.
cfilter
(
c
)
function
c9059700
.
cfilter
(
c
)
return
c
:
Is
Faceup
()
and
c
:
IsAttack
(
)
and
c
:
IsSetCard
(
0xb
)
return
c
:
Is
Position
(
POS_FACEUP_ATTACK
)
and
c
:
IsSetCard
(
0xb
)
end
end
function
c9059700
.
condition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
function
c9059700
.
condition
(
e
,
tp
,
eg
,
ep
,
ev
,
re
,
r
,
rp
)
if
ep
==
tp
or
not
Duel
.
IsExistingMatchingCard
(
c9059700
.
cfilter
,
tp
,
LOCATION_MZONE
,
0
,
1
,
nil
)
if
ep
==
tp
or
not
Duel
.
IsExistingMatchingCard
(
c9059700
.
cfilter
,
tp
,
LOCATION_MZONE
,
0
,
1
,
nil
)
...
...
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