Skip to content

Commit 17a4adb

Browse files
committed
Remove lobby creator
1 parent b479122 commit 17a4adb

File tree

3 files changed

+1
-19
lines changed

3 files changed

+1
-19
lines changed

internal/game/data.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ type Lobby struct {
4040
// Owner references the Player that currently owns the lobby.
4141
// Meaning this player has rights to restart or change certain settings.
4242
Owner *Player
43-
// creator is the player that opened a lobby. Initially creator and owner
44-
// are set to the same player. While the owner can change throughout the
45-
// game, the creator can't.
46-
creator *Player
4743
// ScoreCalculation decides how scores for both guessers and drawers are
4844
// determined.
4945
ScoreCalculation ScoreCalculation

internal/game/lobby.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -526,16 +526,6 @@ func calculateVotesNeededToKick(playerToKick *Player, lobby *Lobby) int {
526526
return 2
527527
}
528528

529-
if playerToKick == lobby.creator {
530-
// We don't want to allow people to kick the creator, as this could
531-
// potentially annoy certain creators. For example a streamer playing
532-
// a game with viewers could get trolled this way. Just one
533-
// hypothetical scenario, I am sure there are more ;)
534-
535-
// All players excluding the owner themselves.
536-
return connectedPlayerCount - 1
537-
}
538-
539529
// If the amount of players equals an even number, such as 6, we will always
540530
// need half of that. If the amount is uneven, we'll get a floored result.
541531
// therefore we always add one to the amount.
@@ -982,7 +972,6 @@ func CreateLobby(
982972

983973
player := lobby.JoinPlayer(playerName)
984974
lobby.Owner = player
985-
lobby.creator = player
986975

987976
return player, lobby, nil
988977
}

internal/game/lobby_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import (
1717
func createLobbyWithDemoPlayers(playercount int) *Lobby {
1818
owner := &Player{}
1919
lobby := &Lobby{
20-
Owner: owner,
21-
creator: owner,
20+
Owner: owner,
2221
}
2322
for range playercount {
2423
lobby.players = append(lobby.players, &Player{
@@ -279,7 +278,6 @@ func Test_wordSelectionEvent(t *testing.T) {
279278
drawer := lobby.JoinPlayer("Drawer")
280279
drawer.Connected = true
281280
lobby.Owner = drawer
282-
lobby.creator = drawer
283281

284282
if err := lobby.HandleEvent(EventTypeStart, nil, drawer); err != nil {
285283
t.Errorf("Couldn't start lobby: %s", err)
@@ -346,7 +344,6 @@ func Test_kickDrawer(t *testing.T) {
346344
marcel := lobby.JoinPlayer("marcel")
347345
marcel.Connected = true
348346
lobby.Owner = marcel
349-
lobby.creator = marcel
350347

351348
kevin := lobby.JoinPlayer("kevin")
352349
kevin.Connected = true

0 commit comments

Comments
 (0)