• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] World editor crashes

Status
Not open for further replies.
Level 2
Joined
Apr 15, 2006
Messages
19
I recently decided to have a look at JASS, and I made a function that should change the texture of the ground taking a rect, and the type to change into.
I placed it in the general section (the part that gets loaded after global variables).
My problem is that when I try to save the map, worldeditor throws an unhandled access violation exception, so if any experts here can spot an error in my code, it would be greately pariciated :)
JASS:
function ChangeGroundRecrusively takes integer x0, integer x1, integer y0, integer y1, integer t returns nothing
    local integer height = y1 - y0
    local integer width = x1 - x0
    local integer smallest = height
    if width < height then
        set smallest = width
    endif
    call SetTerrainType(x0 + smallest/2, y0 + smallest/2, t, -1, smallest, 1)
    
    
    if height > width then
        set height = height
        call ChangeGroundRecrusively(x0, x1, y0 + smallest, y1, t)
    
    elseif height < width then
        call ChangeGroundRecrusively(x0 + smallest, x1, y0, y1, t)
    endif    

endfunction


function ChangeGround takes rect r, integer t returns nothing
    call ChangeGroundRecrusively(GetRectMinX(r), GetRectMaxX(r), GetRectMinY(r), GetRectMaxY(r), t) 
endfunction
 
Last edited:
Level 2
Joined
Apr 15, 2006
Messages
19
no, its not an endless loop as I always call it with a smaller square, and if the width equals the height, no more calls are made.
The only way to go in an endless loop is if the height or width is 0, but if the initial input doesn't have a width or height of 0, the subsequent calls won't have it either, since I add a number less than the width (if height is smallest) to x0, resulting in a new width of atleast 1 (since i'm using integers)

At any case, it shouldn't call the function when saving the map..
 
Level 2
Joined
Apr 15, 2006
Messages
19
I wrote another function to do it, and it works. I have had crashes with other functions though. Maby this is because the worldeditor syntax checker sucks? That it tries to compile invalid code.
 
Level 2
Joined
Apr 15, 2006
Messages
19
jass new gen pack, where do I find that? cant see it in the tools section.
Im currently using JassCraft for writing jass functions, but would like something with some error responses other then "syntax error!". Also it would be nice if the editor could open the w3x file and import all global variables and functions.
 
Status
Not open for further replies.
Top