mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-01-18 23:36:36 -05:00
Reduce GetTiles slice allocation
This commit is contained in:
parent
a8ebddb917
commit
9ce9c2f848
@ -256,7 +256,7 @@ func (m *MapEngine) RemoveEntity(entity d2interface.MapEntity) {
|
|||||||
// GetTiles returns a slice of all tiles matching the given style,
|
// GetTiles returns a slice of all tiles matching the given style,
|
||||||
// sequence and tileType.
|
// sequence and tileType.
|
||||||
func (m *MapEngine) GetTiles(style, sequence int, tileType d2enum.TileType) []d2dt1.Tile {
|
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 {
|
for idx := range m.dt1TileData {
|
||||||
if m.dt1TileData[idx].Style != int32(style) || m.dt1TileData[idx].Sequence != int32(sequence) ||
|
if m.dt1TileData[idx].Style != int32(style) || m.dt1TileData[idx].Sequence != int32(sequence) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user