tdauth / wowr

Warcraft III: Reforged funmap World of Warcraft Reforged.
https://wowreforged.org
8 stars 0 forks source link

Reduce Memory Leaks (for example when pinging locations) #613

Open tdauth opened 2 years ago

tdauth commented 2 years ago

Tool: https://www.hiveworkshop.com/threads/jass-script-helper.293715/ Tools are buggy.

Tutorial to reduce leaks: https://www.hiveworkshop.com/threads/quick-tutorial-common-triggering-tips.190802/ Use Custom script: set bj_wantDestroyGroup = true only when we create a new group not for TmpGroup etc.

y "pick all units" in your map.

(Position of (Unit))
(Position of (Item))
(Center of (Region))
(Position of (Triggering unit) offset by 50.00 towards (Position of (Attacking unit)))
-------- --------
Set TempPoint = (Position of (Unit))
Custom script: call RemoveLocation(udg_TempPoint)

Unit Group - Pick all units in (Unit group) and do (Actions)
(Number of units in (Unit group))
-------- --------
Set TempGroup = (Unit group)
Custom script: call DestroyGroup(udg_TempGroup)

Game - Text Message to (Player Group)
-------- --------
Set TempForce = (Player Group)
Custom script: call DestroyForce(udg_TempForce)
tdauth commented 2 years ago

All ping chat commands use locations of units which might leak. They have a high priority since players might ping quite often. We need a hook for PingMinimapLocForPlayer etc. and a boolean flag which removes the location.

We can provide some custom functions:

function PingUnitForPlayer takes unit whichUnit, player whichPlayer returns nothing
function PingItemForPlayer takes item whichItem, player whichPlayer returns nothing
function PingRectForPlayer takes rect whichRect, player whichPlayer returns nothing
function PingDestructableForPlayer takes destructable whichDestructable, player whichPlayer returns nothing
tdauth commented 3 months ago

Combine them with udg_TmpUnit, udg_TmpItem and udg_TmpRect etc. to make them usable in GUI.

tdauth commented 2 months ago

New way of pinging used in Goblin quests: Set one variable to the latest location even if this leaks once. Always ping this variable.