View Single Post
Old 11-24-2006, 10:25 PM   #5
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

0.9.0 fixes bugs, adds structs, library_once and textmacro_once.

I didn't have time to document the aditions, the readme would be updated tomorrow with some luck.

this is a sample of structs:

Collapse JASS:
struct vec
    integer x = 0
    integer y=0
    integer z=0
endstruct



function vec_add takes vec A, vec B returns vec
 local vec C= vec.create()
     set C.x = A.x + B.x
     set C.y = A.y + B.y
     set C.z = A.z + B.z
 return C
endfunction

function vec_string takes vec A returns string
    return "("+I2S(A.x)+","+I2S(A.y)+","+I2S(A.z)+")"
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
 local vec a=vec.create()
 local vec b=vec.create()
 local vec c

    set a.x=2
    set a.y=2
    set a.z=5

    set b.x=-7
    set b.y=8
    set b.z=9


    set c=vec_add(a,b)

    call BJDebugMsg(vec_string(a)+" + "+vec_string(b) +" = "+vec_string(c))


//either works:
    call vec.destroy(c)
    call a.destroy()
    call b.destroy()

endfunction

coming soon: methods, inheritance and polymorphism.

(static attributes are currently possible, also private members, although they have no use since there are no methods)

Notice structname.create() would return 0 if the 8190 instance limit is reached, if debug mode is enabled it would show a message in game in that case.

So just be careful not to create more than 8190 instances and if there is that possibility check if the returned struct is not 0.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote