Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function generateGrid takes rect baseRect returns nothing
- local real y
- local real x
- local real x_step
- local real y_step
- local integer x_step_count
- local integer y_step_count
- local integer width
- local rect array grid_store
- local integer i
- local integer j
- local real minx
- local real miny
- local integer step
- local boolean switch
- set switch = FALSE
- set step = 132
- set minx = GetRectMinX(baseRect)
- set miny = GetRectMinY(baseRect)
- set y = GetRectHeightBJ(baseRect)
- set x = GetRectWidthBJ(baseRect)
- set x_step = x / step
- set y_step = y / step
- set x_step_count = R2I(x_step)
- set y_step_count = R2I(y_step)
- set width = x_step_count
- set i = 0
- set j = 0
- call DisplayTextToForce( GetPlayersAll(), R2S(x) + " " + R2S(y) )
- call DisplayTextToForce( GetPlayersAll(), I2S(x_step_count) + " " + I2S(y_step_count) )
- call DisplayTextToForce( GetPlayersAll(), R2S(x_step) + " " + R2S(y_step) )
- loop
- exitwhen i >= x_step_count
- loop
- //call DisplayTextToForce( GetPlayersAll(), I2S(i) + " " + I2S(j) )
- exitwhen j >= y_step_count
- set grid_store[i + width * j] = Rect(minx + i*step, miny + j*step, minx + (i+1)*step, miny + (j+1)*step)
- call CreateTextTagLocBJ( I2S(i + width * j), GetRectCenter(grid_store[i + width * j]), 0, 10, 100, 100, 100, 0 )
- if switch then
- call SetTerrainTypeBJ( GetRectCenter(grid_store[i + width * j]), 'Lgrd', -1, 1, 1 )
- set switch = FALSE
- else
- call SetTerrainTypeBJ( GetRectCenter(grid_store[i + width * j]), 'Lrok', -1, 1, 1 )
- set switch = TRUE
- endif
- set j = j + 1
- endloop
- set j = 0
- set i = i + 1
- if switch then
- set switch=FALSE
- else
- set switch=TRUE
- endif
- endloop
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement