Skip to content

Commit

Permalink
fixed issue with joining as spectator
Browse files Browse the repository at this point in the history
fixed an issue where if you had closed panel attack while spectating, the server didn't remove you as a spectator, and so you couldn't ever join that room again, even if you closed and reopened panel attack.
  • Loading branch information
jon12156 committed May 26, 2018
1 parent 32a2547 commit f6eb769
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 f6eb769

Please sign in to comment.