• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Problem with leaks

Status
Not open for further replies.
Level 4
Joined
Nov 22, 2006
Messages
28
Ok, here´s my problem: i created a maul and need to save some extra vars for each creep. So i give every unit a unique costum value (resetet after each round). So i can save whatever i want - variable["costum value of picked unit"].

I also created a anti-stuck and block system. If a unit stands to long at one point it will teleport. Every 4 seconds it picks every creep and saves the postion. Then i can compare the latest saved position with the current positon. If the distance is to short it will be "marked" for teleport or gets new orders.

So far it´s quite simple. But i have problems with saving the position. First i save the current position of the picked creep as temp_point. Then it checks the distance and then it sets unit_position[costum value] = temp_point. Then i remove the temp_point with the WEU function to prevent leaks - but it also removes the currently saved unit_position[costum value] o_O. I don´t know why. I guess it´s some kind of bug.

Next thing i tried was to save the x and y coordinates as integer. That worked but leaks. Any ideas?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Two things -

  • x and y coordinates do not leak, if you saw that then you're doing something else wrong and/or fooling yourself
  • It's not a bug, when you set a variable of type handle or a child thereof (for example, location!), they share the same memory address; the location is just re-referenced, not copied. Thus, you should remove it when you want to set the next unit_position.
 
Status
Not open for further replies.
Top