SimpleGridMap

open class SimpleGridMap(val width: Int, val height: Int, val depth: Int) : VyrekaMap(source)

A simple implementation of a VyrekaMap that is used in a grid-based map.

Since

1.0.0

Parameters

width

the width of the map

height

the height of the map

depth

the depth of the map

See also

Constructors

Link copied to clipboard
constructor(width: Int, height: Int, depth: Int)

Properties

Link copied to clipboard
Link copied to clipboard
open override val depth: Int
Link copied to clipboard
open override val height: Int
Link copied to clipboard
open override val width: Int

Functions

Link copied to clipboard
open fun getCellAt(location: Location): Cell

Tries to retrieve a cell at the given location. If there is no cell at the location, for example since the location is out of bounds, an exception is thrown. This method should only be used if it is guaranteed that there is a cell at the location.

Link copied to clipboard
open override fun getCellAtOrNull(location: Location): Cell?

Tries to retrieve a cell at the given location. If there is no cell at the location, for example since the location is out of bounds, null is returned. However, as long as the location is within the bounds of the map, this method should never return null.

Link copied to clipboard
open override fun getCellsFlattened(): List<Cell>

Creates a list of all cells in the map. The order of the cells is not specified and may vary between different implementations.

Link copied to clipboard
open override fun removeCellAt(location: Location): Cell?

Removes the cell at the given location. If there is no cell at the location, null is returned. Otherwise, the removed cell is returned.

Link copied to clipboard
open override fun setCell(cell: Cell)

Sets the cell at the given location to the given cell. If there is already a cell at the location, it will be overwritten by the new cell.