Add external Trie library before using Tries for terminal commands
This commit is contained in:
@@ -54,6 +54,7 @@ dependencies:
|
|||||||
- tasty
|
- tasty
|
||||||
- tasty-hunit
|
- tasty-hunit
|
||||||
- tasty-quickcheck
|
- tasty-quickcheck
|
||||||
|
- list-tries
|
||||||
|
|
||||||
library:
|
library:
|
||||||
source-dirs: src
|
source-dirs: src
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ module Dodge.Data.Terminal (
|
|||||||
module Dodge.Data.Terminal.Status,
|
module Dodge.Data.Terminal.Status,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import qualified Data.ListTrie.Patricia.Map.Enum as PT
|
||||||
import Sound.Data
|
import Sound.Data
|
||||||
import Color
|
import Color
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
@@ -30,7 +31,7 @@ data Terminal = Terminal
|
|||||||
, _tmExternalColor :: Color
|
, _tmExternalColor :: Color
|
||||||
, _tmDisplayedLines :: [(String, Color)]
|
, _tmDisplayedLines :: [(String, Color)]
|
||||||
, _tmFutureLines :: [TerminalLine]
|
, _tmFutureLines :: [TerminalLine]
|
||||||
, _tmScrollCommands :: [TerminalCommand]
|
, _tmCommands :: [TerminalCommand]
|
||||||
, _tmDeathEffect :: TmWdWd
|
, _tmDeathEffect :: TmWdWd
|
||||||
, _tmStatus :: TerminalStatus
|
, _tmStatus :: TerminalStatus
|
||||||
, _tmCommandHistory :: [String]
|
, _tmCommandHistory :: [String]
|
||||||
@@ -76,10 +77,10 @@ data TerminalCommand = TerminalCommand
|
|||||||
, _tcEffect :: TerminalCommandEffect -- Terminal -> World -> EffectArguments
|
, _tcEffect :: TerminalCommandEffect -- Terminal -> World -> EffectArguments
|
||||||
}
|
}
|
||||||
|
|
||||||
--data TCom = TCom
|
data TCom = TCom
|
||||||
-- { _tcomHelp :: String
|
{ _tcomHelp :: String
|
||||||
-- , _tcomArgs :: Trie Char [TerminalLine]
|
, _tcomArgs :: PT.TrieMap Char [TerminalLine]
|
||||||
-- }
|
}
|
||||||
|
|
||||||
data TmWdWd
|
data TmWdWd
|
||||||
= TmWdId
|
= TmWdId
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ defaultTerminal =
|
|||||||
, _tmDisplayedLines = []
|
, _tmDisplayedLines = []
|
||||||
, _tmFutureLines = []
|
, _tmFutureLines = []
|
||||||
-- , _tmInput = defaultTerminalInput
|
-- , _tmInput = defaultTerminalInput
|
||||||
, _tmScrollCommands = []
|
, _tmCommands = []
|
||||||
-- , _tmWriteCommands = []
|
-- , _tmWriteCommands = []
|
||||||
, _tmDeathEffect = TmWdId
|
, _tmDeathEffect = TmWdId
|
||||||
, _tmStatus = TerminalOff
|
, _tmStatus = TerminalOff
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ analyser proxreq pslight psmc = extTrigLitPos pslight $ \tp ->
|
|||||||
(themachine & mcMounts . at OTTrigger .~ _plMID tp)
|
(themachine & mcMounts . at OTTrigger .~ _plMID tp)
|
||||||
tparams -- (linksensortotrigger tp)
|
tparams -- (linksensortotrigger tp)
|
||||||
where
|
where
|
||||||
tparams = basicTerminal & tmScrollCommands .:~ sensorCommand
|
tparams = basicTerminal & tmCommands .:~ sensorCommand
|
||||||
-- linksensortotrigger tp _ mc
|
-- linksensortotrigger tp _ mc
|
||||||
-- = triggers . ix (fromJust $ _plMID tp) .~ const (_sensToggle $ _mcSensor mc)
|
-- = triggers . ix (fromJust $ _plMID tp) .~ const (_sensToggle $ _mcSensor mc)
|
||||||
themachine =
|
themachine =
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ sensInsideDoor senseType outplid rm =
|
|||||||
.++~ [ psPt atFstLnkOut . PutForeground $ floorWire (V2 20 0) (V2 20 (-100))
|
.++~ [ psPt atFstLnkOut . PutForeground $ floorWire (V2 20 0) (V2 20 (-100))
|
||||||
, psPt atFstLnkOut . PutForeground $ floorWire (V2 0 (-100)) (V2 20 (-100))
|
, psPt atFstLnkOut . PutForeground $ floorWire (V2 0 (-100)) (V2 20 (-100))
|
||||||
, psPt atFstLnkOut . PutForeground $ verticalWire (V2 20 0) 0 80
|
, psPt atFstLnkOut . PutForeground $ verticalWire (V2 20 0) 0 80
|
||||||
, putMessageTerminal terminalColor (basicTerminal & tmScrollCommands .:~ damageCodeCommand)
|
, putMessageTerminal terminalColor (basicTerminal & tmCommands .:~ damageCodeCommand)
|
||||||
& plSpot .~ rprBoolShift isUnusedLnk (shiftInBy 10)
|
& plSpot .~ rprBoolShift isUnusedLnk (shiftInBy 10)
|
||||||
]
|
]
|
||||||
& rmOutPmnt .~ [OutPlacement (sensAboveDoor senseType 10 (atFstLnkOutShiftInward 100)) outplid]
|
& rmOutPmnt .~ [OutPlacement (sensAboveDoor senseType 10 (atFstLnkOutShiftInward 100)) outplid]
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ addWarningTerminal str outplid =
|
|||||||
)
|
)
|
||||||
termMessages trpl =
|
termMessages trpl =
|
||||||
lineOutputTerminal (makeColorTermLine red "WARNING" : makeTermPara str)
|
lineOutputTerminal (makeColorTermLine red "WARNING" : makeTermPara str)
|
||||||
& tmScrollCommands .:~ toggleCommand
|
& tmCommands .:~ toggleCommand
|
||||||
& tmToggles
|
& tmToggles
|
||||||
.~ M.fromList
|
.~ M.fromList
|
||||||
[("DOOR", TerminalToggle (fromJust $ _plMID trpl) (BlConst True))]
|
[("DOOR", TerminalToggle (fromJust $ _plMID trpl) (BlConst True))]
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ basicTerminal =
|
|||||||
{ _tmDisplayedLines = []
|
{ _tmDisplayedLines = []
|
||||||
, _tmFutureLines = []
|
, _tmFutureLines = []
|
||||||
-- , _tmTitle = "TERMINAL"
|
-- , _tmTitle = "TERMINAL"
|
||||||
, _tmScrollCommands = [helpCommand,commandsCommand,quitCommand]
|
, _tmCommands = [helpCommand,commandsCommand,quitCommand]
|
||||||
-- , _tmWriteCommands = [helpCommand, commandsCommand]
|
-- , _tmWriteCommands = [helpCommand, commandsCommand]
|
||||||
, _tmBootLines = connectionBlurb
|
, _tmBootLines = connectionBlurb
|
||||||
, _tmDeathEffect = TmWdWdDoDeathTriggers
|
, _tmDeathEffect = TmWdWdDoDeathTriggers
|
||||||
@@ -110,7 +110,7 @@ termTextColor :: Color
|
|||||||
termTextColor = greyN 0.9
|
termTextColor = greyN 0.9
|
||||||
|
|
||||||
getCommands :: Terminal -> [TerminalCommand]
|
getCommands :: Terminal -> [TerminalCommand]
|
||||||
getCommands tm = _tmScrollCommands tm -- ++ _tmWriteCommands tm
|
getCommands tm = _tmCommands tm -- ++ _tmWriteCommands tm
|
||||||
|
|
||||||
makeTermLine :: String -> TerminalLine
|
makeTermLine :: String -> TerminalLine
|
||||||
makeTermLine = makeColorTermLine termTextColor
|
makeTermLine = makeColorTermLine termTextColor
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ lineOutputTerminal tls =
|
|||||||
{ _tmDisplayedLines = []
|
{ _tmDisplayedLines = []
|
||||||
, _tmFutureLines = []
|
, _tmFutureLines = []
|
||||||
-- , _tmTitle = "TERMINAL"
|
-- , _tmTitle = "TERMINAL"
|
||||||
, _tmScrollCommands = [helpCommand,commandsCommand,quitCommand]
|
, _tmCommands = [helpCommand,commandsCommand,quitCommand]
|
||||||
-- , _tmWriteCommands = [helpCommand, commandsCommand]
|
-- , _tmWriteCommands = [helpCommand, commandsCommand]
|
||||||
, _tmBootLines = connectionBlurbLines tls
|
, _tmBootLines = connectionBlurbLines tls
|
||||||
, _tmDeathEffect = TmWdWdDoDeathTriggers
|
, _tmDeathEffect = TmWdWdDoDeathTriggers
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ packages:
|
|||||||
extra-deps:
|
extra-deps:
|
||||||
#- SDL-0.6.7.0@sha256:9d6ba75c0cab575ec38468c8277803983e985f9622437aeca6a53e6a7337a7d5,2045
|
#- SDL-0.6.7.0@sha256:9d6ba75c0cab575ec38468c8277803983e985f9622437aeca6a53e6a7337a7d5,2045
|
||||||
- sdl2-mixer-1.2.0.0@sha256:6a6b5a46c035c9e77eaf9c244e45de9e4a9b9a110890cfeeb9fa72faa2419cef,4497
|
- sdl2-mixer-1.2.0.0@sha256:6a6b5a46c035c9e77eaf9c244e45de9e4a9b9a110890cfeeb9fa72faa2419cef,4497
|
||||||
|
- list-tries-0.6.7.1@sha256:a53b4a466d2ecdb932da4c1d34ec8dda99d9eba2977eb991f6b052ad710e249d,4272
|
||||||
#- repa-3.4.1.5@sha256:4d94845e66d668345130f75f5de8f7c69139b91495c8c4b5a825014e8985e2fd,3562
|
#- repa-3.4.1.5@sha256:4d94845e66d668345130f75f5de8f7c69139b91495c8c4b5a825014e8985e2fd,3562
|
||||||
#- strict-containers-0.1@sha256:d751696a8a74e368cf778cf98410b43fcd192d68febd4c691faaac1d6c3ab63f,10591
|
#- strict-containers-0.1@sha256:d751696a8a74e368cf778cf98410b43fcd192d68febd4c691faaac1d6c3ab63f,10591
|
||||||
#- strict-containers-lens-0.1@sha256:97c0e68e2e23578074d41fa45690a9ff7b1d47057ea6635d863af99f0daa2f9d,1103
|
#- strict-containers-lens-0.1@sha256:97c0e68e2e23578074d41fa45690a9ff7b1d47057ea6635d863af99f0daa2f9d,1103
|
||||||
|
|||||||
Reference in New Issue
Block a user