fix inventory overview

pull/118/head
Jon Eugster 3 years ago
parent 70d30d1212
commit 25f2f08309

@ -189,12 +189,12 @@ partial def handleServerEvent (ev : ServerEvent) : GameServerM Bool := do
let some game ← getGame? s.game let some game ← getGame? s.game
| return false | return false
-- All Levels have the same tiles, so we just load them from level 1 of an arbitrary world -- All Levels have the same tiles, so we just load them from level 1 of an arbitrary world
-- and reset `new`, `disabled` and `unlocked` -- and reset `new`, `disabled` and `unlocked`.
match game.worlds.nodes.toList with -- Note: as we allow worlds without any levels (for developing), we might need
| [] => return false -- to try until we find the first world with levels.
| ⟨worldId, _⟩ :: _ => for ⟨worldId, _⟩ in game.worlds.nodes.toList do
let some lvl ← getLevel? {game := s.game, world := worldId, level := 1} let some lvl ← getLevel? {game := s.game, world := worldId, level := 1}
| do return false | do continue
let inventory : InventoryOverview := { let inventory : InventoryOverview := {
tactics := lvl.tactics.tiles.map tactics := lvl.tactics.tiles.map
({ · with locked := true, disabled := false, new := false }), ({ · with locked := true, disabled := false, new := false }),
@ -207,6 +207,7 @@ partial def handleServerEvent (ev : ServerEvent) : GameServerM Bool := do
let c ← read let c ← read
c.hOut.writeLspResponse ⟨id, ToJson.toJson inventory⟩ c.hOut.writeLspResponse ⟨id, ToJson.toJson inventory⟩
return true return true
return false
| _ => return false | _ => return false
| _ => return false | _ => return false

Loading…
Cancel
Save