Index

FloodFillTerrain

FloodFillTerrain(<-posX <-posZ <-minHeight <-maxHeight <-maxSize) ->listOfCells

Description

Returns a list of 2d vectors representing map coordinates that satisfy the following conditions:

Warning: This currently has a bug (current for 1.4), and will accept heights 1 tile below min_height, so a min height of 3 will add tiles with a height of 2 as well, but not tiles with a height of 1.

Examples

FloodFillTerrain(GetUnitCell(self) 1 20 999999) ->listOfCells

How FloodFill Works

FloodFill starts at the center and looks at the four adjacent cells - above, left, right, below. If the cell matches the criteria, it is added to a list.

Now FloodFill iterates over each of the cells in the list, but not checking cells that has been checked in a previous iteration. So, assuming the cell “above” matched criteria and is in the list, will cause it's left (also diagonal left from start cell), above, right (again, also diagonal right from start cell), but not below, since that has already been checked.

This process iterates for as many iterations as “maxsize” and the total number of cells returned and their locations are dependent on the topology of the terrain.

Index