diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-03 01:55:21 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-03 01:55:21 +0200 |
commit | 581b746992878819e813e867ad183a160709de53 (patch) | |
tree | 93028bbb834588785ecd44b561958d999c78c187 /src/Main.hs | |
parent | e82a3a8c147b34b75a203f66f974f5b3ec21d98c (diff) | |
download | 2017-01-16_17:13:37-581b746992878819e813e867ad183a160709de53.tar 2017-01-16_17:13:37-581b746992878819e813e867ad183a160709de53.tar.gz 2017-01-16_17:13:37-581b746992878819e813e867ad183a160709de53.tar.bz2 2017-01-16_17:13:37-581b746992878819e813e867ad183a160709de53.tar.xz 2017-01-16_17:13:37-581b746992878819e813e867ad183a160709de53.zip |
cleanup
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 15 |
1 files changed, 8 insertions, 7 deletions
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 | |||
77 | factionColumn i = [evalState ?? st $ toName x | x <- rowGroup, factionIndex x == i ] | 77 | factionColumn i = [evalState ?? st $ toName x | x <- rowGroup, factionIndex x == i ] |
78 | return . colsAllG top $ [show (seqVal' ^. seqVal)] : map factionColumn [0..(length factions - 1)] | 78 | return . colsAllG top $ [show (seqVal' ^. seqVal)] : map factionColumn [0..(length factions - 1)] |
79 | 79 | ||
80 | listFaction :: Completable Faction -> Sh GameState () | 80 | -- Query state |
81 | listFaction = withArg $ \qFaction -> use gEntities >>= mapM_ (shellPutStrLn <=< toName) . Map.keys . Map.filter ((==) qFaction . view eFaction) | 81 | listFactions, listEntities :: Sh GameState () |
82 | |||
83 | listFactions :: Sh GameState () | ||
84 | listFactions = use inhabitedFactions >>= mapM_ (shellPutStrLn . view faction') | 82 | listFactions = use inhabitedFactions >>= mapM_ (shellPutStrLn . view faction') |
85 | |||
86 | listEntities :: Sh GameState () | ||
87 | listEntities = use (gEntities . to Map.keys) >>= mapM_ (shellPutStrLn <=< toName) | 83 | listEntities = use (gEntities . to Map.keys) >>= mapM_ (shellPutStrLn <=< toName) |
88 | 84 | ||
89 | alignEntity :: Completable Faction -> Sh GameState () | 85 | -- Manage faction |
86 | listFaction, alignEntity :: Completable Faction -> Sh GameState () | ||
87 | listFaction = withArg $ \qFaction -> use gEntities >>= mapM_ (shellPutStrLn <=< toName) . Map.keys . Map.filter ((==) qFaction . view eFaction) | ||
90 | alignEntity = withArg $ \nFaction -> withFocus $ \ident -> gEntities %= Map.adjust (set eFaction nFaction) ident | 88 | alignEntity = withArg $ \nFaction -> withFocus $ \ident -> gEntities %= Map.adjust (set eFaction nFaction) ident |
91 | 89 | ||
90 | -- Automatic focus | ||
92 | focusTip, blur :: Sh GameState () | 91 | focusTip, blur :: Sh GameState () |
93 | focusTip = gFocus <~ use tip | 92 | focusTip = gFocus <~ use tip |
94 | blur = gFocus .= Nothing | 93 | blur = gFocus .= Nothing |
95 | 94 | ||
95 | -- Manual focus | ||
96 | setFocus :: Completable EntityIdentifier -> Sh GameState () | 96 | setFocus :: Completable EntityIdentifier -> Sh GameState () |
97 | setFocus = withArg $ \ident -> gFocus .= Just ident | 97 | setFocus = withArg $ \ident -> gFocus .= Just ident |
98 | 98 | ||
99 | -- Drop information | ||
99 | remove :: Sh GameState () | 100 | remove :: Sh GameState () |
100 | remove = withFocus $ \ident -> do | 101 | remove = withFocus $ \ident -> do |
101 | name <- toName ident | 102 | name <- toName ident |