swarm-0.6.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.Game.Scenario.Topography.Structure.Recognition.Registry

Description

Registry of found structures. This datatype contains two maps that must be kept in sync. Uses smart constructors to maintain this invariant.

Synopsis

Documentation

data FoundRegistry b a Source #

The authoritative source of which built structures currently exist.

The two type parameters, b and a, correspond to StructureCells and Entity, respectively.

Instantiation

populateStaticFoundStructures :: [FoundStructure b a] -> FoundRegistry b a Source #

Bulk insertion of found structures.

Each of these shall have been re-checked in case a subsequent placement occludes them.

Read-only accessors

foundByName :: FoundRegistry b a -> Map OriginalName (NEMap (Cosmic Location) (StructureWithGrid b a)) Source #

We use a NEMap here so that we can use the safe-indexing function indexWrapNonEmpty in the implementation of the structure command.

foundByLocation :: FoundRegistry b a -> Map (Cosmic Location) (FoundStructure b a) Source #

This is a worldwide "mask" that prevents members of placed structures from participating in new structures and facilitates deletion of structures when their elements are removed from the world.

Each recognized structure instance will have MxN entries in this map.

Mutation