Reduce GetTiles slice allocation

This commit is contained in:
Intyre 2020-12-23 21:58:39 +01:00
parent a8ebddb917
commit 9ce9c2f848
1 changed files with 1 additions and 1 deletions

View File

@ -256,7 +256,7 @@ func (m *MapEngine) RemoveEntity(entity d2interface.MapEntity) {
// GetTiles returns a slice of all tiles matching the given style,
// sequence and tileType.
func (m *MapEngine) GetTiles(style, sequence int, tileType d2enum.TileType) []d2dt1.Tile {
tiles := make([]d2dt1.Tile, 0, len(m.dt1TileData))
tiles := make([]d2dt1.Tile, 0)
for idx := range m.dt1TileData {
if m.dt1TileData[idx].Style != int32(style) || m.dt1TileData[idx].Sequence != int32(sequence) ||