JASS:
struct point
real x
real y
endstruct
Both this struct, and the location needs creating and destroying, so I don't really see a reason to use point instead of location.
Anyone has a different point of view?
struct point
real x
real y
endstruct
Can't I do that with location too? Only the syntax will be differentYou could add vector and matrix related functionality such as transforms.
Array reads (I would compare them with each other in 5 secs
x // p.x in vJass
) can't possible be slower than native function calls (GetLocationX(p)
... so no point in doing a comparison =).location
for representing points they would be restricted to having only x and y coordinates, because there's no arbitrary SetLocationZ(p, z)
(only MoveLocation(p, x, y)
).The compiled JASS script is not the only factor. Besides like I said, it will only add a few lines and array variables in wc3map.j (whatever the script name file is) .If you're too hurt by that, you can always use a custom Alloc (like the one in Spells section by Nestharus) to lessen the generated script by default allocator of JassHelper.guys guys guys
why are you talking like "struct" is a jass native or something?
can you simply compile the function using 1st and 2nd type and provide FINAL jass code? I would compare them with each other in 5 secs
I read somewhere, that a native function is faster than a BJ function call (even if it does nothing).
I would imagine that custom functions will be as slow as BJ functions, thus adding methods to this struct would not appeal to the "speed demons", who care a lot about code's speed efficiency.
function mySetUnitVertexColor takes unit u, integer r, integer g, integer b, integer a returns nothing
call SetUnitVertexColor(u,r,g,b,a)
endfunction
call SetUnitVertexColor(udg_Hero[1],100,60,200,200)//x500
call mySetUnitVertexColor(udg_Hero[1],100,60,200,200)//x500
function mySetUnitVertexColor takes nothing returns nothing
call SetUnitVertexColor(udg_Hero[1],100,60,200,200)
endfunction
call SetUnitVertexColor(udg_Hero[1],100,60,200,200)//x500
call mySetUnitVertexColor()//x500
I read somewhere, that a native function is faster than a BJ function call (even if it does nothing).
I would imagine that custom functions will be as slow as BJ functions, thus adding methods to this struct would not appeal to the "speed demons", who care a lot about code's speed efficiency.