summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-06-03 01:02:26 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-06-03 01:02:26 +0200
commit49847034c56b105763a9d6d369f68a7d433ca521 (patch)
tree793e19db1a71a5f3766aaf0419a406a5f531ada5 /src
parentab903fff1d08e36092d25205e061fe42e5c62d4b (diff)
download2017-01-16_17:13:37-49847034c56b105763a9d6d369f68a7d433ca521.tar
2017-01-16_17:13:37-49847034c56b105763a9d6d369f68a7d433ca521.tar.gz
2017-01-16_17:13:37-49847034c56b105763a9d6d369f68a7d433ca521.tar.bz2
2017-01-16_17:13:37-49847034c56b105763a9d6d369f68a7d433ca521.tar.xz
2017-01-16_17:13:37-49847034c56b105763a9d6d369f68a7d433ca521.zip
Getter for tip of queue
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs2
-rw-r--r--src/Sequence/Types.hs5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 903da05..ea663e8 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -38,7 +38,7 @@ main = do
38 let 38 let
39 description = initialShellDescription 39 description = initialShellDescription
40 { historyFile = Just historyFile 40 { historyFile = Just historyFile
41 , prompt = \st -> return $ maybe "" (++ " ") ((evalState ?? st) . toName . snd <$> (listToMaybe $ view priorityQueue st)) ++ "→ " 41 , prompt = \st -> return $ maybe "" (++ " ") ((evalState ?? st) . toName <$> view tip st) ++ "→ "
42 , beforePrompt = gets stateOutline >>= (\str -> if null str then return () else shellPutStrLn str) 42 , beforePrompt = gets stateOutline >>= (\str -> if null str then return () else shellPutStrLn str)
43 , commandStyle = OnlyCommands 43 , commandStyle = OnlyCommands
44 , shellCommands = [ exitCommand "exit" 44 , shellCommands = [ exitCommand "exit"
diff --git a/src/Sequence/Types.hs b/src/Sequence/Types.hs
index afe1060..fd8d7ab 100644
--- a/src/Sequence/Types.hs
+++ b/src/Sequence/Types.hs
@@ -7,7 +7,7 @@ module Sequence.Types
7 , Entity(..), eFaction, eSeqVal 7 , Entity(..), eFaction, eSeqVal
8 , EntityName(..), entityName 8 , EntityName(..), entityName
9 , EntityIdentifier(..), entityId 9 , EntityIdentifier(..), entityId
10 , inhabitedFactions, priorityQueue 10 , inhabitedFactions, priorityQueue, tip
11 ) where 11 ) where
12 12
13import Control.Lens 13import Control.Lens
@@ -99,3 +99,6 @@ priorityQueue = to priorityQueue'
99 priorityQueue' (Map.toAscList . view gEntities -> entities) = sortBy (comparing $ Down . snd) . concat . map filter . map (over _1 $ view eSeqVal) . map swap $ entities 99 priorityQueue' (Map.toAscList . view gEntities -> entities) = sortBy (comparing $ Down . snd) . concat . map filter . map (over _1 $ view eSeqVal) . map swap $ entities
100 filter (Nothing, _) = mempty 100 filter (Nothing, _) = mempty
101 filter (Just val, id) = pure (val, id) 101 filter (Just val, id) = pure (val, id)
102
103tip :: Getter GameState (Maybe EntityIdentifier)
104tip = priorityQueue . to (fmap snd . listToMaybe)