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
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: