Copyright | (c) Alexander Vieth 2015 |
---|---|
License | BSD3 |
Maintainer | aovieth@gmail.com |
Stability | experimental |
Portability | non-portable (GHC only) |
Safe Haskell | Safe |
Language | Haskell2010 |
- type Occupation = Map Zone (Aligned Unit)
- emptyOccupation :: Occupation
- occupy :: ProvinceTarget -> Maybe (Aligned Unit) -> Occupation -> Occupation
- occupier :: ProvinceTarget -> Occupation -> Maybe (Aligned Unit)
- provinceOccupier :: Province -> Occupation -> Maybe (Aligned Unit)
- occupies :: Aligned Unit -> ProvinceTarget -> Occupation -> Bool
- unitOccupies :: Unit -> ProvinceTarget -> Occupation -> Bool
- occupied :: ProvinceTarget -> Occupation -> Bool
- zoneOccupied :: Zone -> Occupation -> Bool
- allSubjects :: Maybe GreatPower -> Occupation -> [Subject]
Documentation
type Occupation = Map Zone (Aligned Unit) Source #
Each Zone is occupied by at most one Aligned Unit, but the functions on Occupation work with ProvinceTarget; the use of Zone as a key here is just to guarantee that we don't have, for instance, units on both of Spain's coasts simultaneously.
occupy :: ProvinceTarget -> Maybe (Aligned Unit) -> Occupation -> Occupation Source #
occupier :: ProvinceTarget -> Occupation -> Maybe (Aligned Unit) Source #
Must be careful with this one! We can't just lookup the Zone corresponding to the ProvinceTarget; we must also check that the key matching that Zone, if there is one in the map, is also ProvinceTarget-equal.
provinceOccupier :: Province -> Occupation -> Maybe (Aligned Unit) Source #
occupies :: Aligned Unit -> ProvinceTarget -> Occupation -> Bool Source #
unitOccupies :: Unit -> ProvinceTarget -> Occupation -> Bool Source #
occupied :: ProvinceTarget -> Occupation -> Bool Source #
zoneOccupied :: Zone -> Occupation -> Bool Source #
allSubjects :: Maybe GreatPower -> Occupation -> [Subject] Source #