This commit is contained in:
2024-11-18 11:02:12 +00:00
parent 3c5e5b92b1
commit 69fe28afe7
3 changed files with 12 additions and 84 deletions
+1 -10
View File
@@ -1,10 +1 @@
/home/justin/Haskell/loop/src/Dodge/Update/Input/InGame.hs:159:1-21: warning: [-Wunused-top-binds] All good (594 modules, at 11:01:56)
Defined but not used: updateCombineInvClick
|
159 | updateCombineInvClick sss w = case w ^. input . mouseContext of
| ^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Update/Input/InGame.hs:159:23-25: warning: [-Wunused-matches]
Defined but not used: sss
|
159 | updateCombineInvClick sss w = case w ^. input . mouseContext of
| ^^^
+6 -18
View File
@@ -1,5 +1,4 @@
module Dodge.Terminal ( module Dodge.Terminal (
doTerminalEffectLB,
doTerminalCommandEffect, doTerminalCommandEffect,
makeTermLine, makeTermLine,
commandFutureLines, commandFutureLines,
@@ -18,9 +17,8 @@ module Dodge.Terminal (
terminalReturnEffect, terminalReturnEffect,
) where ) where
import Dodge.Terminal.Type
import Control.Monad
import Color import Color
import Control.Monad
import Data.Char import Data.Char
import Data.Foldable import Data.Foldable
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
@@ -28,6 +26,7 @@ import Data.Maybe
import Dodge.Data.World import Dodge.Data.World
import Dodge.Default import Dodge.Default
import Dodge.SoundLogic import Dodge.SoundLogic
import Dodge.Terminal.Type
import Justify import Justify
import LensHelp import LensHelp
import ListHelp (safeHead, safeUncons) import ListHelp (safeHead, safeUncons)
@@ -225,7 +224,8 @@ disconnectTerminal tm =
exitTerminalSubInv :: World -> World exitTerminalSubInv :: World -> World
exitTerminalSubInv w = case w ^? hud . hudElement . subInventory . termID of exitTerminalSubInv w = case w ^? hud . hudElement . subInventory . termID of
Just _ -> w & hud . hudElement . subInventory Just _ ->
w & hud . hudElement . subInventory
.~ NoSubInventory MouseInvNothing .~ NoSubInventory MouseInvNothing
_ -> w _ -> w
@@ -261,8 +261,8 @@ commandFutureLines s tm w = fromMaybe [errline "^ Invalid command"] $ do
NoArguments tls -> Just tls NoArguments tls -> Just tls
OneArgument argtype m -> OneArgument argtype m ->
let setpartial let setpartial
| null (_tmPartialCommand tm) | null (_tmPartialCommand tm) =
= TerminalLineTerminalEffect 0 (TmTmSetPartialCommand (Just command)) : TerminalLineTerminalEffect 0 (TmTmSetPartialCommand (Just command)) :
makeTermPara ("Expects " ++ argtype ++ " as an argument") makeTermPara ("Expects " ++ argtype ++ " as an argument")
| otherwise = | otherwise =
TerminalLineTerminalEffect 0 (TmTmSetPartialCommand Nothing) : TerminalLineTerminalEffect 0 (TmTmSetPartialCommand Nothing) :
@@ -292,15 +292,3 @@ runTerminalString s tm w =
. (tmFutureLines ++.~ commandFutureLines s tm w) . (tmFutureLines ++.~ commandFutureLines s tm w)
. (tmCommandHistory %~ take 10 . (s :)) . (tmCommandHistory %~ take 10 . (s :))
) )
doTerminalEffectLB :: Terminal -> World -> World
doTerminalEffectLB tm w = case w ^. input . mouseContext of
OverTerminalReturn -> fromMaybe w $ do
guard (_tmStatus tm == TerminalReady)
s <- w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
return $ if null (words s) && null (_tmPartialCommand tm)
then w
else terminalReturnEffect tm w
OverTerminalEscape -> w
& hud . hudElement . subInventory .~ NoSubInventory MouseInvNothing
_ -> w
-51
View File
@@ -60,9 +60,7 @@ updateUseInputInGame u = updateFunctionKeys $ case u ^. uvWorld . hud . hudEleme
& uvWorld %~ setInvPosFromSS & uvWorld %~ setInvPosFromSS
_ -> M.foldlWithKey' updateKeyInGame u pkeys _ -> M.foldlWithKey' updateKeyInGame u pkeys
where where
-- w = u ^. uvWorld
pkeys = u ^. uvWorld . input . pressedKeys pkeys = u ^. uvWorld . input . pressedKeys
-- lbinitialpress = u ^? uvWorld . input . mouseButtons . ix ButtonLeft == Just 0
dodisplayregexinput x di = fromMaybe di $ do dodisplayregexinput x di = fromMaybe di $ do
sss <- di ^? diSections sss <- di ^? diSections
msel <- di ^? diSelection msel <- di ^? diSelection
@@ -152,55 +150,6 @@ updateFunctionKey uv sc InitialPress = case sc of
_ -> uv _ -> uv
updateFunctionKey uv _ _ = uv updateFunctionKey uv _ _ = uv
updateCombineInvClick ::
IM.IntMap (SelectionSection CombinableItem) ->
World ->
World
updateCombineInvClick sss w = case w ^. input . mouseContext of
OverCombSelect x ->
w & hud . hudElement . subInventory . ciSelection ?~ x
& worldEventFlags . at CombineInventoryChange ?~ ()
OverCombFilter ->
w & hud . hudElement . subInventory . ciFilter .~ Nothing
& worldEventFlags . at CombineInventoryChange ?~ ()
OverCombCombine (i, j) ->
(worldEventFlags . at InventoryChange ?~ ()) . maybeExitCombine $
tryCombine (i, j) w
& worldEventFlags . at CombineInventoryChange ?~ ()
OverCombEscape ->
w
& worldEventFlags . at InventoryChange ?~ ()
& hud . hudElement . subInventory .~ NoSubInventory MouseInvNothing
OverInvFilt (i, j) -> fromMaybe w $ do
guard $ i == 0
str <-
fmap (take 5) $
w
^? hud . hudElement . diSections . ix i . ssItems . ix j . siPictures . ix 0
return . (worldEventFlags . at CombineInventoryChange ?~ ()) $
case w ^? hud . hudElement . subInventory . ciFilter . _Just of
Just (_ : xs)
| str == xs ->
w
& hud . hudElement . subInventory . ciFilter .~ Nothing
_ -> w & hud . hudElement . subInventory . ciFilter ?~ ("<" ++ str)
x ->
error $
"while combining this mouse context should not be possible: "
++ show x
-- x@(Just (i,_))
-- | x /= msel -> w & hud . hudElement . subInventory . ciSelection .~ x
-- & worldEventFlags . at CombineInventoryChange ?~ ()
-- | i == -1 -> w & hud . hudElement . subInventory . ciFilter .~ Nothing
-- & worldEventFlags . at CombineInventoryChange ?~ ()
-- _ | (w ^? hud . hudElement . subInventory . ciSelection . _Just . _1) == Just (-1)
-- -> w & hud . hudElement . subInventory . ciFilter .~ Nothing
-- & worldEventFlags . at CombineInventoryChange ?~ ()
-- _ -> (worldEventFlags . at InventoryChange ?~ ()) . maybeExitCombine $
-- tryCombine sss msel w
-- & worldEventFlags . at CombineInventoryChange ?~ ()
updatePressedButtonsCarte :: World -> World updatePressedButtonsCarte :: World -> World
updatePressedButtonsCarte w = updatePressedButtonsCarte' (_mouseButtons (_input w)) w updatePressedButtonsCarte w = updatePressedButtonsCarte' (_mouseButtons (_input w)) w