aboutsummaryrefslogtreecommitdiff
path: root/internal/game
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game')
-rw-r--r--internal/game/casino.go5
-rw-r--r--internal/game/casino_test.go27
-rw-r--r--internal/game/casino_ux.go2
3 files changed, 30 insertions, 4 deletions
diff --git a/internal/game/casino.go b/internal/game/casino.go
index 230108f..8c10dfd 100644
--- a/internal/game/casino.go
+++ b/internal/game/casino.go
@@ -672,10 +672,9 @@ func (g *Game) renderCasinoSnapshot(sess *net.Session, snapshot casino.Snapshot)
}
mode := g.colorMode(sess)
unicode := sess.Player.OptionBool("unicode")
+ // Card art is governed by card_size alone; casino_display only controls
+ // how verbose the command menus are.
size := sess.Player.OptionInt("card_size")
- if sess.Player.OptionString("casino_display") == "compact" {
- size = 1
- }
switch s := snapshot.(type) {
case *casino.RouletteSnapshot:
return renderRouletteSnapshot(s, mode, unicode, size)
diff --git a/internal/game/casino_test.go b/internal/game/casino_test.go
index b3bfb9b..3a1fc41 100644
--- a/internal/game/casino_test.go
+++ b/internal/game/casino_test.go
@@ -26,6 +26,33 @@ func (c *casinoTestConn) SetWriteDeadline(time.Time) error { return nil }
func (c *casinoTestConn) Close() error { return nil }
func (c *casinoTestConn) SetEcho(bool) error { return nil }
+func TestCasinoDisplayDefaultsToDetailedAndDoesNotOverrideCardSize(t *testing.T) {
+ snapshot := &casino.BlackjackSnapshot{
+ Dealer: []casino.CardView{{Rank: "K", Suit: "hearts"}},
+ Players: []casino.BlackjackPlayerView{{Name: "alice", Score: "10", Cards: []casino.CardView{{Rank: "10", Suit: "clubs"}}}},
+ }
+ if got := player.New("alice").OptionString("casino_display"); got != "detailed" {
+ t.Fatalf("casino_display default=%q, want detailed", got)
+ }
+ for _, display := range []string{"", "detailed", "compact"} {
+ p := player.New("alice")
+ p.Options = map[string]any{"color": "none"}
+ if display != "" {
+ p.Options["casino_display"] = display
+ }
+ sess := &net.Session{Player: p}
+ g := &Game{}
+ got := g.renderCasinoSnapshot(sess, snapshot)
+ want := renderBlackjackSnapshotFor(snapshot, g.colorMode(sess), p.OptionBool("unicode"), p.OptionInt("card_size"), p.OptionString("card_style"), nil, p.Name)
+ if got != want {
+ t.Fatalf("display=%q: card_size ignored\n got %q\nwant %q", display, got, want)
+ }
+ if !strings.Contains(got, "┌") {
+ t.Fatalf("display=%q: expected card art, got %q", display, got)
+ }
+ }
+}
+
func TestExecuteBetRejectsInvalidMachineArgs(t *testing.T) {
g := &Game{Casino: casino.NewManager(1)}
cfg := casino.MachineConfig{ID: "slots", Game: casino.GameSlots}
diff --git a/internal/game/casino_ux.go b/internal/game/casino_ux.go
index d885665..e218653 100644
--- a/internal/game/casino_ux.go
+++ b/internal/game/casino_ux.go
@@ -122,7 +122,7 @@ func (g *Game) executeTableStatus(sess *net.Session, args []string, _ string) {
{Command: "insurance / decline", Desc: "Answer the insurance offer explicitly"},
{Command: "sitout", Desc: "Skip future rounds; bet to rejoin"},
{Command: "stop", Desc: "Leave now, or after your committed round"},
- {Command: "option casino_display compact", Desc: "Short cards and action hints (or detailed for card art)"},
+ {Command: "option casino_display compact", Desc: "Compact action hints (detailed for full command menus)"},
{Command: "table rules", Desc: "Review this table’s rules"},
}))
}