Add support for up to 6 players.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user