diff options
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/game/http.go | 5 | ||||
| -rw-r--r-- | backend/game/models.go | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/backend/game/http.go b/backend/game/http.go index f9036c5..865c724 100644 --- a/backend/game/http.go +++ b/backend/game/http.go @@ -56,5 +56,10 @@ func (h *sockHandler) HandleSockGolfWatch(c echo.Context) error { if hub == nil { return echo.NewHTTPError(http.StatusNotFound, "Game not found") } + + if hub.game.gameType != gameType1v1 { + return echo.NewHTTPError(http.StatusBadRequest, "Only 1v1 game is supported") + } + return serveWatcherWs(hub, c.Response(), c.Request()) } diff --git a/backend/game/models.go b/backend/game/models.go index d3d0980..e96184a 100644 --- a/backend/game/models.go +++ b/backend/game/models.go @@ -6,9 +6,13 @@ import ( "github.com/nsfisis/iosdc-japan-2024-albatross/backend/api" ) +type gameType = api.GameGameType type gameState = api.GameState const ( + gameType1v1 = api.N1V1 + gameTypeMultiplayer = api.Multiplayer + gameStateClosed gameState = api.Closed gameStateWaitingEntries gameState = api.WaitingEntries gameStateWaitingStart gameState = api.WaitingStart @@ -20,7 +24,7 @@ const ( type game struct { gameID int - gameType string + gameType gameType state gameState displayName string durationSeconds int |
