• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Location Leaks

Status
Not open for further replies.
Level 14
Joined
Dec 29, 2009
Messages
928
I had a question regarding location leaks and when they should be removed.
If, for example, you set a variable 'tempLoc' to the center of a region several times within something like a loop, would you need to remove the leak individually each time you set it, or after the loop?

For example, this is one of the triggers I use for my hero selection system.

  • HS Generation
    • Events
    • Conditions
    • Actions
      • For each (Integer tempInt) from 1 to 36, do (Actions)
        • Loop - Actions
          • Set tempLoc = (Center of HS_region[tempInt])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HS_heroType[tempInt] Not equal to No unit-type
            • Then - Actions
              • Unit - Create 1 HS_heroType[tempInt] for Neutral Passive at tempLoc facing 0.00 degrees
            • Else - Actions
              • Unit - Create 1 devUnit for Neutral Passive at tempLoc facing 0.00 degrees
              • Set HS_heroTaken[tempInt] = True
          • Set tempLoc = (Center of HS_region[0])
          • Set HS_hero[tempInt] = (Last created unit)
          • Unit - Make HS_hero[tempInt] face tempLoc over 0.00 seconds
          • Unit - Turn collision for HS_hero[tempInt] Off
      • Custom script: call RemoveLocation(udg_tempLoc)
Here I remove the leak after the loop is finished, but I'm not sure whether or not this is the right spot for it.
 
Status
Not open for further replies.
Top