Wire the audio player in Run, not in NewGame
ci/woodpecker/push/woodpecker Pipeline was successful

AudioPlayer keeps the *AssetManager it is handed, so attaching it during
construction quietly pinned it to the manager NewGame happened to make. A
domain that assigns its own registry onto the Game — legal, the fields are
plain *Manager values — got a working image path and a silent audio one.

Run attaches instead, once the Game is final.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-30 10:36:13 +02:00
co-authored by Claude Opus 5
parent 08f15a7e3d
commit 39af65f3c9
3 changed files with 32 additions and 6 deletions
+4 -1
View File
@@ -114,6 +114,10 @@ type runtimeDialog struct {
// NewGame initializes a game with empty entity managers, the SCUMM-style
// verb set, all preset themes, and "classic-scumm" selected. Widgets are
// NOT auto-registered — call RegisterDefaultUI(g) explicitly.
//
// A domain is free to replace any of the entity managers with one of its
// own before Run — the registries are ordinary *Manager values, and Run
// wires the engine to whichever ones the Game holds by then.
func NewGame(title string, w, h int) *Game {
g := &Game{
Title: title,
@@ -138,7 +142,6 @@ func NewGame(title string, w, h int) *Game {
transition: &transition{},
selectedVerb: "look",
}
g.Audio.attach(g.AssetManager)
for _, v := range defaultVerbs() {
g.VerbManager.Register(v)
}