Skip to content

Commit

Permalink
Offload subrecords of GameState to other modules (#1667)
Browse files Browse the repository at this point in the history
This is a continuation of #1652.

Most of the sub-records are bundled into `Swarm.Game.State.Substate`, but we create a `Swarm.Game.State.Robot` module just for robots.

We introduce a `zoomRobots` function so that applicable functions can operate directly on `Robots` state instead of `GameState`.

## Size comparison

### Before

| File | Lines |
| --- | --- |
| `State.hs` | 1569 |

### After

| File | Lines |
| --- | --- |
| `State.hs` | 812 |
| `Substate.hs` | 497 |
| `Robot.hs` | 395 |
| `Config.hs` | 21 |
## For follow-up PR:
- [ ]  Remove exports of `_viewCenter` and `_focusedRobotID` from `Swarm.Game.State.Robot`
  • Loading branch information
kostmo authored Nov 30, 2023
1 parent b244a42 commit 3094abd
Show file tree
Hide file tree
Showing 29 changed files with 1,121 additions and 911 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import Swarm.Game.Scenario.Topography.Structure.Recognition.Log
import Swarm.Game.Scenario.Topography.Structure.Recognition.Registry
import Swarm.Game.Scenario.Topography.Structure.Recognition.Type
import Swarm.Game.State
import Swarm.Game.State.Substate
import Swarm.Game.Universe
import Swarm.Game.World.Modify
import Text.AhoCorasick
Expand Down
Loading

0 comments on commit 3094abd

Please sign in to comment.