22bea1217419b508ab2b509991cbbf3b2aee4940

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

game: activate the location when the player starts on its marker

NewState left active empty, so a start cell sitting on a location marker
rendered as 'in' the place but rejected talk until you moved off and back.
Initialize active from the start cell.

Diff

 1diff --git a/internal/game/state.go b/internal/game/state.go
 2index a7e050f8dc1cff2756b51d1cb7c1f0934905b5f0..506ce70b70f6f2e36466398f666c8ec59c40b4ea 100644
 3--- a/internal/game/state.go
 4+++ b/internal/game/state.go
 5@@ -71,12 +71,16 @@ type State struct {
 6 }
 7 
 8 // NewState builds a state from a parsed map with the player at the start cell.
 9+// If the start cell is a location marker, that location starts active so the
10+// player can talk where they begin.
11 func NewState(m MapData) *State {
12-	return &State{
13+	s := &State{
14 		m:       m,
15 		pos:     Position{Row: m.Start.Row, Col: m.Start.Col},
16 		history: make(map[string][]Turn),
17 	}
18+	s.active = s.LocationAt(s.pos)
19+	return s
20 }
21 
22 // Map returns the underlying map data for rendering.