aboutsummaryrefslogtreecommitdiff
path: root/internal/game/render_map.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-07 16:46:32 -0400
committerhistoria <[not public]>2026-07-07 16:46:32 -0400
commit726997d799edc388cd448e978d5bb0755aaa551c (patch)
treeb7aa8dc2dc9d2edcad1c0a4012a28d01d348db69 /internal/game/render_map.go
parentab2597b22ccdb71116992aec78080d9858358d04 (diff)
downloadthehouseoficarus-726997d799edc388cd448e978d5bb0755aaa551c.tar.gz
feat: bitpacked and base64 encoded VisitedRooms in player YAML to keep the file human readable
Diffstat (limited to 'internal/game/render_map.go')
-rw-r--r--internal/game/render_map.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/game/render_map.go b/internal/game/render_map.go
index 0177595..3f9c4da 100644
--- a/internal/game/render_map.go
+++ b/internal/game/render_map.go
@@ -131,7 +131,7 @@ func buildTinyMap(g *Game, sess *net.Session, roomID int, mg mapGlyphs) []string
if rid == roomID {
grid[gr][gc] = mapCell{char: '@', spec: atSpec}
} else {
- unvisited := visited != nil && !visited[rid]
+ unvisited := visited != nil && !visited.Has(rid)
ch, spec := roomMapSymbol(g, sess, rid, unvisited)
if unvisited {
spec = dimSpec
@@ -307,7 +307,7 @@ func buildFullMap(g *Game, sess *net.Session, roomID, mapWidth, mapHeight int, m
if rid == roomID {
grid[gr][gc] = mapCell{char: '@', spec: atSpec}
} else {
- unvisited := visited != nil && !visited[rid]
+ unvisited := visited != nil && !visited.Has(rid)
ch, spec := roomMapSymbol(g, sess, rid, unvisited)
if unvisited {
spec = dimSpec
@@ -409,9 +409,9 @@ func buildFullMap(g *Game, sess *net.Session, roomID, mapWidth, mapHeight int, m
return renderMapCells(grid, colorMode, 0, mapHeight, 0)
}
-func roomsVisited(sess *net.Session) map[int]bool {
+func roomsVisited(sess *net.Session) *player.RoomSet {
if sess != nil && sess.Player != nil {
- return sess.Player.Stats.RoomsVisited
+ return &sess.Player.Stats.RoomsVisited
}
return nil
}
@@ -457,7 +457,7 @@ type mapRenderCtx struct {
g *Game
sess *net.Session
bg *mapGraph
- visited map[int]bool
+ visited *player.RoomSet
currentRoom int
atSpec color.ColorSpec
dimSpec color.ColorSpec
@@ -473,7 +473,7 @@ func (c *mapRenderCtx) nodeSpec(roomID int) color.ColorSpec {
if roomID == c.currentRoom {
return c.atSpec
}
- if c.visited != nil && !c.visited[roomID] {
+ if c.visited != nil && !c.visited.Has(roomID) {
return c.dimSpec
}
_, spec := roomMapSymbol(c.g, c.sess, roomID, false)
@@ -548,7 +548,7 @@ func (c *mapRenderCtx) isCourseLink(roomA, roomB int) bool {
// courseColoredCell draws a one-way course arrow using the map_course color
// (dimmed if either endpoint is unvisited).
func (c *mapRenderCtx) courseColoredCell(roomA, roomB int, glyph rune) (mapCell, bool) {
- if c.visited != nil && (!c.visited[roomA] || !c.visited[roomB]) {
+ if c.visited != nil && (!c.visited.Has(roomA) || !c.visited.Has(roomB)) {
return mapCell{char: glyph, spec: c.dimSpec}, true
}
return mapCell{char: glyph, spec: c.courseSpec}, true
@@ -557,7 +557,7 @@ func (c *mapRenderCtx) courseColoredCell(roomA, roomB int, glyph rune) (mapCell,
// coloredCell applies the shared link coloring logic for bar/arrow glyphs
// (dim if either endpoint is unvisited, otherwise the gradient average).
func (c *mapRenderCtx) coloredCell(roomA, roomB int, glyph rune) (mapCell, bool) {
- if c.visited != nil && (!c.visited[roomA] || !c.visited[roomB]) {
+ if c.visited != nil && (!c.visited.Has(roomA) || !c.visited.Has(roomB)) {
return mapCell{char: glyph, spec: c.dimSpec}, true
}
return mapCell{char: glyph, spec: color.Average(c.nodeSpec(roomA), c.nodeSpec(roomB))}, true