Skip to content

Commit

Permalink
Merge pull request #12 from inada-s/fix-room-state
Browse files Browse the repository at this point in the history
fix to update room state when user exit a room.
  • Loading branch information
inada-s authored Oct 26, 2019
2 parents 34a7dd5 + 7d52524 commit 8d5e4fc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/lobby/model/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ func (r *Room) Exit(userId string) {
break
}
}

if len(r.Users) == int(r.MaxPlayer) {
r.Status = RoomStateFull
} else {
r.Status = RoomStateRecruit
}

if len(r.Users) == 0 {
r.Remove()
}
Expand Down

0 comments on commit 8d5e4fc

Please sign in to comment.