Merge pull request #1006 from Intyre/engine

Reduce GetTiles slice allocation
This commit is contained in:
Tim Sarbin 2020-12-23 22:32:50 -05:00 committed by GitHub
commit f3a869c2be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) ||