It's more practical no cache nothing, and to PickAllDestructables just when needed. In general it can make things simple, which is good.
But if it has much less performance, and might be not good if it's a huge map, and/or there are very much destructables placed.
So if it has worse performance, and happens periodically, or just very often in a time frame, then it could become bad for map.
I would cache destructables/trees per se though, not just their locations. One can directly check if destructable is dead, for example.
===
More work, but great performance boost, if needed, would be to use arrays.
Trees = Destroctable[array]
TreesCounter = Integer
Map Start
Code:
PickAllDestructbleOnMap
-- if (Destructable Is A Tree == True)
-- -- TreeCounter = TreeCounter + 1
-- -- Trees[TreeCounter] = Destructable
Then later, you can always loop through Trees:
Code:
For Integer I from 1 To TreeCounter
-- Location = (Position of Trees[I])
When new trees are created you need to adjust the array:
Code:
Destructable - CreateTree( ... )
TreeCounter = TreeCounter + 1
Trees[TreeCounter] = LastCreatedDestructable()
When trees are dead, you need to adjust the array. Though, it can be done in looo, so just at at next usage. So we adjust the usage loop:
Code:
For Integer I from 1 To TreeCounter
-- If ( Tree[I] Is Dead != True
-- -- Location = (Position of Trees[I])
-- Else
-- -- Set Tree[I] = Tree[TreeCounter]
-- -- Set I = I - 1
^what happens is we moved the last tree in array to current position. And then we decrease loop counter, to try again at same position.
There are systems to get to know if a destructable is a tree, in case you haven't included one, yet.