• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Location Leaks

Status
Not open for further replies.
Level 14
Joined
Dec 29, 2009
Messages
931
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