Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
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
srvpro
Commits
bba69ea7
Commit
bba69ea7
authored
Sep 06, 2015
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
memory leak test4, synchronous ctos_follow, hide password, add http stop server
parent
5df13214
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
207 additions
and
138 deletions
+207
-138
room.coffee
room.coffee
+6
-1
room.js
room.js
+8
-1
ygopro-server.coffee
ygopro-server.coffee
+60
-55
ygopro-server.js
ygopro-server.js
+119
-81
ygopro.coffee
ygopro.coffee
+6
-0
ygopro.js
ygopro.js
+8
-0
No files found.
room.coffee
View file @
bba69ea7
...
...
@@ -122,10 +122,12 @@ class Room
return
if
@
deleted
#log.info 'room-delete', this.name, Room.all.length
@
watcher_buffers
=
[]
@
players
=
[]
@
watcher
.
end
()
if
@
watcher
@
deleted
=
true
index
=
_
.
indexOf
(
Room
.
all
,
this
)
#Room.all[index] = null unless index == -1
Room
.
all
.
splice
(
index
,
1
)
unless
index
==
-
1
@
deleted
=
true
return
connect
:
(
client
)
->
...
...
@@ -144,13 +146,16 @@ class Room
ygopro
.
stoc_send_chat_to_room
this
,
"
#{
client
.
name
}
#{
'退出了观战'
}#{
if
error
then
":
#{
error
}
"
else
''
}
"
index
=
_
.
indexOf
(
@
watchers
,
client
)
@
watchers
.
splice
(
index
,
1
)
unless
index
==
-
1
client
.
room
=
null
else
index
=
_
.
indexOf
(
@
players
,
client
)
@
players
.
splice
(
index
,
1
)
unless
index
==
-
1
if
@
players
.
length
ygopro
.
stoc_send_chat_to_room
this
,
"
#{
client
.
name
}
#{
'离开了游戏'
}#{
if
error
then
":
#{
error
}
"
else
''
}
"
client
.
room
=
null
else
@
process
.
kill
()
client
.
room
=
null
this
.
delete
()
return
...
...
room.js
View file @
bba69ea7
...
...
@@ -154,11 +154,15 @@
return
;
}
this
.
watcher_buffers
=
[];
this
.
players
=
[];
if
(
this
.
watcher
)
{
this
.
watcher
.
end
();
}
this
.
deleted
=
true
;
index
=
_
.
indexOf
(
Room
.
all
,
this
);
if
(
index
!==
-
1
)
{
Room
.
all
.
splice
(
index
,
1
);
}
this
.
deleted
=
true
;
};
Room
.
prototype
.
connect
=
function
(
client
)
{
...
...
@@ -185,6 +189,7 @@
if
(
index
!==
-
1
)
{
this
.
watchers
.
splice
(
index
,
1
);
}
client
.
room
=
null
;
}
else
{
index
=
_
.
indexOf
(
this
.
players
,
client
);
if
(
index
!==
-
1
)
{
...
...
@@ -192,8 +197,10 @@
}
if
(
this
.
players
.
length
)
{
ygopro
.
stoc_send_chat_to_room
(
this
,
client
.
name
+
"
"
+
'
离开了游戏
'
+
(
error
?
"
:
"
+
error
:
''
));
client
.
room
=
null
;
}
else
{
this
.
process
.
kill
();
client
.
room
=
null
;
this
[
"
delete
"
]();
}
}
...
...
ygopro-server.coffee
View file @
bba69ea7
This diff is collapsed.
Click to expand it.
ygopro-server.js
View file @
bba69ea7
This diff is collapsed.
Click to expand it.
ygopro.coffee
View file @
bba69ea7
...
...
@@ -110,6 +110,9 @@ for name, declaration of structs_declaration
#util
@
stoc_send_chat
=
(
client
,
msg
,
player
=
8
)
->
if
!
client
console
.
log
"err stoc_send_chat"
return
for
line
in
_
.
lines
(
msg
)
@
stoc_send
client
,
'CHAT'
,
{
player
:
player
...
...
@@ -118,6 +121,9 @@ for name, declaration of structs_declaration
return
@
stoc_send_chat_to_room
=
(
room
,
msg
,
player
=
8
)
->
if
!
room
console
.
log
"err stoc_send_chat_to_room"
return
for
client
in
room
.
players
@
stoc_send_chat
(
client
,
msg
,
player
)
if
client
for
client
in
room
.
watchers
...
...
ygopro.js
View file @
bba69ea7
...
...
@@ -171,6 +171,10 @@
if
(
player
==
null
)
{
player
=
8
;
}
if
(
!
client
)
{
console
.
log
(
"
err stoc_send_chat
"
);
return
;
}
ref
=
_
.
lines
(
msg
);
for
(
j
=
0
,
len1
=
ref
.
length
;
j
<
len1
;
j
++
)
{
line
=
ref
[
j
];
...
...
@@ -186,6 +190,10 @@
if
(
player
==
null
)
{
player
=
8
;
}
if
(
!
room
)
{
console
.
log
(
"
err stoc_send_chat_to_room
"
);
return
;
}
ref
=
room
.
players
;
for
(
j
=
0
,
len1
=
ref
.
length
;
j
<
len1
;
j
++
)
{
client
=
ref
[
j
];
...
...
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