Improve rooms, make consumable use type
This commit is contained in:
+23
-16
@@ -103,8 +103,11 @@ zipCount :: [a] -> [(Int,a)]
|
||||
zipCount = Prelude.zip [0..]
|
||||
|
||||
printColumns :: [Int] -> [String] -> IO ()
|
||||
printColumns (i:is) (s:strs) = putStr (rightPad i ' ' s) >> printColumns is strs
|
||||
printColumns _ strs = putStrLn $ concat strs
|
||||
printColumns is ss = printPartialColumns is ss >> putStrLn ""
|
||||
|
||||
printPartialColumns :: [Int] -> [String] -> IO ()
|
||||
printPartialColumns (i:is) (s:strs) = putStr (rightPad i ' ' s) >> printPartialColumns is strs
|
||||
printPartialColumns _ strs = putStr $ concat strs
|
||||
|
||||
theColumns :: [String] -> IO ()
|
||||
theColumns = printColumns [20,5,20,20]
|
||||
@@ -112,21 +115,25 @@ theColumns = printColumns [20,5,20,20]
|
||||
printColumnTitles :: IO ()
|
||||
printColumnTitles = theColumns ["Parent","Cnum","Child","Link pair"]
|
||||
|
||||
printInfo :: RoomInt -> Int -> RoomInt -> IO ()
|
||||
printInfo (parentrm,parenti) childn (childrm,childi) = do
|
||||
putStr $ rpns 20 (_rmName parentrm ++ "-" ++ show parenti )
|
||||
++ rpns 5 (show childn ++ " ")
|
||||
++ rpns 20 (_rmName childrm ++ "-" ++ show childi )
|
||||
printInfo :: (Show a) => RoomInt -> a -> RoomInt -> IO ()
|
||||
printInfo (parentrm,parenti) childn (childrm,childi) = printPartialColumns
|
||||
[20,5,20]
|
||||
[_rmName parentrm ++ "-" ++ show parenti
|
||||
,show childn ++ " "
|
||||
,_rmName childrm ++ "-" ++ show childi
|
||||
]
|
||||
|
||||
printInfoCheckNum :: (Show a, Eq a, Num a) => RoomInt -> a -> RoomInt -> IO ()
|
||||
printInfoCheckNum (parentrm,parenti) childn (childrm,childi) = printPartialColumns
|
||||
[20,5,20]
|
||||
[rname
|
||||
,show childn
|
||||
,_rmName childrm ++ "-" ++ show childi
|
||||
]
|
||||
where
|
||||
rpns x s = rightPadNoSquash x ' ' s
|
||||
printInfoCheckNum :: RoomInt -> Int -> RoomInt -> IO ()
|
||||
printInfoCheckNum p 0 c = printInfo p 0 c
|
||||
printInfoCheckNum _ childn (childrm,childi) = do
|
||||
putStr $ rpns 20 ""
|
||||
++ rpns 5 (show childn ++ " ")
|
||||
++ rpns 20 (_rmName childrm ++ "-" ++ show childi )
|
||||
where
|
||||
rpns x s = rightPadNoSquash x ' ' s
|
||||
rname = case childn of
|
||||
0 -> _rmName parentrm ++ "-" ++ show parenti
|
||||
_ -> ""
|
||||
|
||||
doLnkEff :: (Point2,Float) -> Room -> Room
|
||||
doLnkEff x rm = case _rmLinkEff rm of
|
||||
|
||||
Reference in New Issue
Block a user