Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (28 sloc) 1.105 kb
module LevelState where
import Display
import Geometry
import Level
import State
import Item
import ItemState
import Grammar
viewTile :: Bool -> Tile -> Assocs -> (Char, Attr -> Attr)
viewTile b (Tile t []) a = viewTerrain 0 b t
viewTile b (Tile t (i:_)) a = viewItem (itype i) a
-- | Produces a textual description of the terrain and items at an already
-- explored location. Mute for unknown locations.
-- The "detailed" variant is for use in the look mode.
lookAt :: Bool -> State -> LMap -> Loc -> String -> String
lookAt detailed s lmap loc msg
| detailed =
lookTerrain (tterrain (lmap `rememberAt` loc)) ++ " " ++ msg ++ isd
| otherwise = msg ++ isd
where
is = titems (lmap `rememberAt` loc)
isd = case is of
[] -> ""
[i] -> "You see " ++ objectItem s (icount i) (itype i) ++ "."
[i,j] -> "You see " ++ objectItem s (icount i) (itype i) ++ " and "
++ objectItem s (icount j) (itype j) ++ "."
_ -> "There are several objects here" ++
if detailed then ":" else "."
Jump to Line
Something went wrong with that request. Please try again.