From 581b746992878819e813e867ad183a160709de53 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 3 Jun 2016 01:55:21 +0200 Subject: cleanup --- src/Main.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 258e230..e480f4b 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -77,25 +77,26 @@ stateOutline st factionColumn i = [evalState ?? st $ toName x | x <- rowGroup, factionIndex x == i ] return . colsAllG top $ [show (seqVal' ^. seqVal)] : map factionColumn [0..(length factions - 1)] -listFaction :: Completable Faction -> Sh GameState () -listFaction = withArg $ \qFaction -> use gEntities >>= mapM_ (shellPutStrLn <=< toName) . Map.keys . Map.filter ((==) qFaction . view eFaction) - -listFactions :: Sh GameState () +-- Query state +listFactions, listEntities :: Sh GameState () listFactions = use inhabitedFactions >>= mapM_ (shellPutStrLn . view faction') - -listEntities :: Sh GameState () listEntities = use (gEntities . to Map.keys) >>= mapM_ (shellPutStrLn <=< toName) -alignEntity :: Completable Faction -> Sh GameState () +-- Manage faction +listFaction, alignEntity :: Completable Faction -> Sh GameState () +listFaction = withArg $ \qFaction -> use gEntities >>= mapM_ (shellPutStrLn <=< toName) . Map.keys . Map.filter ((==) qFaction . view eFaction) alignEntity = withArg $ \nFaction -> withFocus $ \ident -> gEntities %= Map.adjust (set eFaction nFaction) ident +-- Automatic focus focusTip, blur :: Sh GameState () focusTip = gFocus <~ use tip blur = gFocus .= Nothing +-- Manual focus setFocus :: Completable EntityIdentifier -> Sh GameState () setFocus = withArg $ \ident -> gFocus .= Just ident +-- Drop information remove :: Sh GameState () remove = withFocus $ \ident -> do name <- toName ident -- cgit v1.2.3