Skip to content

Commit

Permalink
Merge pull request #8 from panel-attack/bugfix-in-add_spectator
Browse files Browse the repository at this point in the history
fixed issue with joining as spectator
  • Loading branch information
jon12156 authored May 26, 2018
2 parents 32a2547 + f6eb769 commit 84f551a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mainloop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ do
{"2P fakevs at burke.ro", main_net_vs_setup, {"burke.ro"}},
{"2P fakevs at Jon's server (US-East, beta for spectating and ranking)", main_net_vs_setup, {"18.188.43.50"}},
{"2P fakevs at domi1819.xyz (Europe, beta for spectating and ranking)", main_net_vs_setup, {"domi1819.xyz"}},
--{"2P fakevs at localhost (development-use only)", main_net_vs_setup, {"localhost"}},
{"2P fakevs at localhost (development-use only)", main_net_vs_setup, {"localhost"}},
{"2P fakevs local game", main_local_vs_setup},
{"Replay of 1P endless", main_replay_endless},
{"Replay of 1P puzzle", main_replay_puzzle},
Expand Down
4 changes: 3 additions & 1 deletion server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,8 @@ function Connection.close(self)
end
if self.room and (self.room.a.name == self.name or self.room.b.name == self.name) then
self.room:close()
elseif self.room then
self.room:remove_spectator(self)
end
clear_proposals(self.name)
if self.opponent then
Expand Down Expand Up @@ -784,7 +786,7 @@ function Connection.J(self, message)
if requestedRoom and requestedRoom:state() == CHARACTERSELECT then
-- TODO: allow them to join
print("join allowed")
requestedRoom:add_spectator(connections[name_to_idx[message.spectate_request.sender]])
requestedRoom:add_spectator(self)

elseif requestedRoom and requestedRoom:state() == "playing, not joinable" then
-- TODO: deny the join request, maybe queue them to join as soon as the status changes from "playing" to "room"
Expand Down

0 comments on commit 84f551a

Please sign in to comment.