DEV 1676: Add maps helper functions (#111)

* add utility methods to Editor and BoardStateEditor

* add Meta.Validate

* allow setting Meta.MinPlayers to zero

* remove uints in map sizes

* use Meta.Validate in HazardPitsMap
This commit is contained in:
Rob O'Dwyer 2022-09-13 13:11:43 -07:00 committed by GitHub
parent c5810d8604
commit c4247945ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 701 additions and 83 deletions

View file

@ -10,7 +10,7 @@ func init() {
globalRegistry.RegisterMap("hz_castle_wall_xl", CastleWallExtraLargeHazardsMap{})
}
func setupCastleWallBoard(maxPlayers uint, startingPositions []rules.Point, hazards []rules.Point, initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error {
func setupCastleWallBoard(maxPlayers int, startingPositions []rules.Point, hazards []rules.Point, initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error {
rand := settings.GetRand(initialBoardState.Turn)
if len(initialBoardState.Snakes) > int(maxPlayers) {