Hey all!
I’m spawning HISM and storing their location in a TMap as follows:
Key: IntPoint (location) ← this make it easier to ‘find’ by IntPoint
Value: HISM index
When I remove a HISM by index, the map is useless because all the index are off.
Example:
Key - Value
0,0 = 0
0,1 = 1
0,2 = 2
0,3 = 3
0,4 = 4
If I remove HISM index 2, I assume 4 becomes 3 and 3 become 2, making anything after IntPoint index 2 incorrect (0,2 - 0,3 - 0,4). The only way I can think to fix this is to iterate through my TMap and shift 2-4 down in a For Loop. This doesn’t seem like the most efficient way to handle the situation, especially if I’m dealing with thousands of HISMs. Is there a better way to keep track of these?
I’m storing them via IntPoints so I don’t have to do a line trace. I just look up where the player is trying to interact and remove the HISM that’s there.
Any help would be greatly appreciated!
Thanks.