You're right that KillUnit() will not instantly remove the unit from game.
However the unit will be removed after the death animation has played properly.
So if it's the wanted effect to play animations after death, then it's probably the most elegant solution.
JASS:
// The cleanest approach appears to be RemoveUnit(unit). Using a stack with timed dummy
// recycling helps us to properly display the attached special effects.
^I fail to see logics for caring to play the animation of attached effects.
What I see is only a delayed "RemoveUnit" which is checked each second at the stack.
And from my understanding the death effect won't play properly then, because the unit will be instantly removed.
Maybe it's intended to destroy the special effect on
function Missile_RecycleDummy
so it has 3 seconds to play before the dummy is removed.
But if these are the options I personaly would maybe still go with KillUnit() and add an extra condition at the filter. Maybe just preference.
_______________
And, oh, I see. That rectangle solution is pretty clever to ensure picking really all units.
But on other side this seems to be uncared at
function Missile_IsWidgetInRange
.
There you "only" pick units in range of current position, which does potentialy leak some units then, if speed is very fast.
Basicly then it would need to share the exactly same rectangle from PREV to CURRENT, as the max and min of the circle will cover all points.
But not 100% the same. At the very start and the very end of the rectangle the shape must be half circled.
So from PREV(x/y) and CURRENT (x/y) it should be checked normaly for range, but all in between should be the same rect as in
function Missile_SetRectRectangle
.
It would look similar to a cylinder, but with a half-sphered cap at front and at the back.
Like:
JASS:
local real x1 = udg_Missile_PrevX[index]
local real y1 = udg_Missile_PrevY[index]
local real x2 = udg_Missile_PosX[index]
local real y2 = udg_Missile_PosY[index]
local real d = udg_Missile_Collision[index] + Missile_GetMaxCollision()
// What is min, what is max ...
if x1 < x2 then
if y1 < y2 then
call SetRect(udg_MissileRect, x1 , y1 , x2 , y2 )
else
call SetRect(udg_MissileRect, x1 , y2 , x2 , y1 )
endif
else
if y1 < y2 then
call SetRect(udg_MissileRect, x2 , y1 , x1 , y2 )
else
call SetRect(udg_MissileRect, x2 , y2 , x1 , y1 )
endif
endif
// ^ Rect is done without range "d".
// So now of current(x/y) and prev (x/y) there needs to be a circular check
// for all widgets in range of "d".