Commit ad1f15a5 authored by mercury233's avatar mercury233

fix

parent f864cd51
...@@ -48,7 +48,7 @@ class Room ...@@ -48,7 +48,7 @@ class Room
@find_or_create_random: (type, player_name)-> @find_or_create_random: (type, player_name)->
result = _.find @all, (room)-> result = _.find @all, (room)->
room.random_type != '' and (type == '' or room.random_type == type) and room.get_playing_player().length == 1 and room.get_playing_player()[0].name != Room.players_oppentlist[player_name] room.random_type != '' and !room.started and (type == '' or room.random_type == type) and room.get_playing_player().length == 1 and room.get_playing_player()[0].name != Room.players_oppentlist[player_name]
if result if result
result.welcome = '对手已经在等你了,开始决斗吧!' result.welcome = '对手已经在等你了,开始决斗吧!'
#log.info 'found room', player_name #log.info 'found room', player_name
...@@ -86,6 +86,7 @@ class Room ...@@ -86,6 +86,7 @@ class Room
@alive = true @alive = true
@players = [] @players = []
@status = 'starting' @status = 'starting'
@started = false
@established = false @established = false
@watcher_buffers = [] @watcher_buffers = []
@watchers = [] @watchers = []
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
Room.find_or_create_random = function(type, player_name) { Room.find_or_create_random = function(type, player_name) {
var name, result; var name, result;
result = _.find(this.all, function(room) { result = _.find(this.all, function(room) {
return room.random_type !== '' && (type === '' || room.random_type === type) && room.get_playing_player().length === 1 && room.get_playing_player()[0].name !== Room.players_oppentlist[player_name]; return room.random_type !== '' && !room.started && (type === '' || room.random_type === type) && room.get_playing_player().length === 1 && room.get_playing_player()[0].name !== Room.players_oppentlist[player_name];
}); });
if (result) { if (result) {
result.welcome = '对手已经在等你了,开始决斗吧!'; result.welcome = '对手已经在等你了,开始决斗吧!';
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,7 @@
this.alive = true; this.alive = true;
this.players = []; this.players = [];
this.status = 'starting'; this.status = 'starting';
this.started = false;
this.established = false; this.established = false;
this.watcher_buffers = []; this.watcher_buffers = [];
this.watchers = []; this.watchers = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment