Fix dependency loop
This commit is contained in:
parent
b7278d6afc
commit
f529fc5237
25 changed files with 251 additions and 199 deletions
|
@ -11,24 +11,24 @@ import RPGEngine.Data
|
|||
Item(itemId, itemX, itemY, itemName, itemDescription, itemValue,
|
||||
itemActions, useTimes),
|
||||
Level(layout, items, entities),
|
||||
Game (..), State (..), StateBase (..) )
|
||||
Game (..), State (..) )
|
||||
import RPGEngine.Parse.TextToStructure
|
||||
( Value(Infinite, Action, Layout, String, Direction, Integer),
|
||||
Key(Tag, ConditionList),
|
||||
Structure(..) )
|
||||
import RPGEngine.Data.Default (defaultPlayer, defaultLevel, defaultItem, defaultEntity)
|
||||
import RPGEngine.Render.Playing (renderPlaying)
|
||||
import RPGEngine.Input.Playing (handleInputPlaying)
|
||||
|
||||
------------------------------ Exported ------------------------------
|
||||
|
||||
structureToGame :: Structure -> Game
|
||||
structureToGame (Block [(Entry(Tag "player") playerBlock), (Entry(Tag "levels") levelsBlock)]) = game
|
||||
where game = Game{ state = newState, levels = newLevels, player = newPlayer }
|
||||
newState = Playing{ base = playingBase, level = currentLevel }
|
||||
playingBase = StateBase{ renderer = renderPlaying, inputHandler = handleInputPlaying }
|
||||
newLevels = structureToLevels levelsBlock
|
||||
currentLevel = head newLevels
|
||||
-- structureToGame [Entry(Tag "player") playerBlock, Entry(Tag "levels") levelsBlock] = game
|
||||
structureToGame (Entry (Tag "player") playerBlock) = game
|
||||
where game = Game{ state = newState }
|
||||
newState = Playing{ levels = newLevels, level = currentLevel, player = newPlayer, restart = newState }
|
||||
-- newLevels = structureToLevels levelsBlock
|
||||
-- currentLevel = head newLevels
|
||||
newLevels = [defaultLevel]
|
||||
currentLevel = defaultLevel
|
||||
newPlayer = structureToPlayer playerBlock
|
||||
|
||||
------------------------------- Player -------------------------------
|
||||
|
|
|
@ -27,9 +27,9 @@ import Text.Parsec.String ( Parser )
|
|||
-- See documentation for more details, only a short description is
|
||||
-- provided here.
|
||||
data Structure = Block [Structure]
|
||||
| Entry Key Structure -- Key + Value
|
||||
| Regular Value -- Regular value, Integer or String or Infinite
|
||||
deriving (Eq, Show)
|
||||
| Entry Key Structure -- Key + Value
|
||||
| Regular Value -- Regular value, Integer or String or Infinite
|
||||
deriving (Eq, Show)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
|
Reference in a new issue