Nestharus
o-o
- Reaction score
- 84
Save Unit Position
JASS:
library SaveUnitLoc /*
*************************************************************************************
*
* Saves unit's location
*
*************************************************************************************
*
* */uses/*
*
* */ NumberStack /* hiveworkshop.com/forums/1993458-post521.html
* */ UnitStatePercent /* hiveworkshop.com/forums/jass-functions-413/snippet-unit-state-percent-189943/
* */ optional Buffer /* hiveworkshop.com/forums/2002936-post568.html
*
************************************************************************************
*
* function SaveUnitLoc takes NumberStack stack, unit whichUnit returns nothing
*
* -> No Buffer <-
*
* function LoadUnitLoc takes NumberStack stack, unit whichUnit returns nothing
*
* -> Buffer <-
*
* function LoadUnitLocToBuffer takes NumberStack stack returns nothing
* function LoadUnitLocFromBuffer takes unit whichUnit returns nothing
*
************************************************************************************/
function SaveUnitLoc takes NumberStack stack, unit whichUnit returns nothing
call stack.push(GetPercentUnitX(whichUnit),100)
call stack.push(GetPercentUnitY(whichUnit),100)
endfunction
static if LIBRARY_Buffer then
function LoadUnitLocToBuffer takes NumberStack stack returns nothing
call Buffer.write(stack.pop(100))
call Buffer.write(stack.pop(100))
endfunction
function LoadUnitLocFromBuffer takes unit whichUnit returns nothing
call SetUnitY(whichUnit, PercentToY(Buffer.read()))
call SetUnitX(whichUnit, PercentToX(Buffer.read()))
endfunction
else
function LoadUnitLoc takes NumberStack stack, unit whichUnit returns nothing
call SetUnitY(whichUnit, PercentToY(stack.pop(100)))
call SetUnitX(whichUnit, PercentToX(stack.pop(100)))
endfunction
endif
endlibrary
JASS:
library SaveUnitFacing /*
*************************************************************************************
*
* Saves unit's facing
*
*************************************************************************************
*
* */uses/*
*
* */ NumberStack /* hiveworkshop.com/forums/1993458-post521.html
* */ UnitStatePercent /* hiveworkshop.com/forums/jass-functions-413/snippet-unit-state-percent-189943/
* */ optional Buffer /* hiveworkshop.com/forums/2002936-post568.html
*
************************************************************************************
*
* function SaveUnitFacing takes NumberStack stack, unit whichUnit returns nothing
*
* -> No Buffer <-
*
* function LoadUnitFacing takes NumberStack stack, unit whichUnit returns nothing
*
* -> Buffer <-
*
* function LoadUnitFacingToBuffer takes NumberStack stack returns nothing
* function LoadUnitFacingFromBuffer takes unit whichUnit returns nothing
*
************************************************************************************/
function SaveUnitFacing takes NumberStack stack, unit whichUnit returns nothing
call stack.push(GetPercentUnitFacing(whichUnit),99)
endfunction
static if LIBRARY_Buffer then
function LoadUnitFacingToBuffer takes NumberStack stack returns nothing
call Buffer.write(stack.pop(99))
endfunction
function LoadUnitFacingFromBuffer takes unit whichUnit returns nothing
call SetUnitFacing(whichUnit, PercentToFacing(Buffer.read()))
endfunction
else
function LoadUnitFacing takes NumberStack stack, unit whichUnit returns nothing
call SetUnitFacing(whichUnit, PercentToFacing(stack.pop(99)))
endfunction
endif
endlibrary