summaryrefslogtreecommitdiff
path: root/src/Sequence
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/Sequence
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/Sequence')
-rw-r--r--src/Sequence/Types.hs5
1 files changed, 4 insertions, 1 deletions
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)