Add support for up to 6 players.

This commit is contained in:
Greyson Parrelli
2026-07-28 07:36:09 -04:00
parent e542118175
commit a4f5f6910d
38 changed files with 2306 additions and 713 deletions
+15 -6
View File
@@ -51,14 +51,23 @@ func (s *Server) Handler() http.Handler {
return mux
}
// handleCatalog returns every card in a pack (?pack=…, default Turtle), for the
// debug panel. Unknown packs fall back to the default.
// handleCatalog returns every card in the requested packs, for the debug panel
// and the event log's card previews. Packs come as a repeated or
// comma-separated ?pack= parameter and default to Turtle; unknown ids fall back
// to the default pack's cards.
func (s *Server) handleCatalog(w http.ResponseWriter, req *http.Request) {
pack := req.URL.Query().Get("pack")
if pack == "" {
pack = game.DefaultPack
var packs []string
for _, v := range req.URL.Query()["pack"] {
for _, id := range strings.Split(v, ",") {
if id = strings.TrimSpace(id); id != "" {
packs = append(packs, id)
}
}
}
writeJSON(w, game.CatalogForPack(pack))
if len(packs) == 0 {
packs = []string{game.DefaultPack}
}
writeJSON(w, game.CatalogForPacks(packs))
}
// room is one live game plus its connections.