View Single Post
Old 11-27-2013, 09:26 PM   #9
Fledermaus
default string
 
Fledermaus's Avatar
 
Join Date: May 2006
Posts: 705

Submissions (1)

Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)

Send a message via MSN to Fledermaus
Default

Quote:
Originally Posted by Yrth
I was saying
atomics: don't leak
objects: leak unless properly nulled
arrays of atomics: ?
I don't think they leak but Ani probably knows better than me.

Quote:
Originally Posted by Yrth
does wc3 run multiple threads at once?
No, only 1 thread.

Quote:
Originally Posted by Yrth
What, you can't make code arrays? was that on purpose?
I think it was something to do with patch 1.24 fixing the return bug I2Code or Code2I bug that allowed access outside the VM or something.

Quote:
Originally Posted by Yrth
I never really picked up interfaces, which i know i really should, so this is going to be pretty sketchy but
I'd use function interfaces:
Collapse JASS:
function interface MazeCallback takes nothing returns nothing

struct MazeElement
    MazeCallback Start
    MazeCallback Pause
    MazeCallback Unpause
    
    static method create takes MazeCallback s, MazeCallback p, MazeCallback u returns MazeElement
         local MazeElement this = MazeElement.allocate()
         
         set .Start = s
         set .Pause = p
         set .Unpause = u
         
         call .Start.execute()
         
         return this
    endmethod
endstruct

...

function SomeMazeCallbackFunction takes nothing returns nothing
    //Do your stuff in here
endfunction

...

MazeElement e = MazeElement.create(SomeMazeCallbackFunction, SomeMazeCallbackFunction, SomeMazeCallbackFunction)
You can use function interfaces with arguments as well. Check out the readme for more information.
You could also use interfaces but then you'd need a different struct for each Maze. You can check them out in the readme too if you want.
Fledermaus is offline   Reply With Quote