Add: documention to large functions that have too little documentation according to CodeQL
This commit is contained in:
@@ -863,12 +863,15 @@ static void GenerateTerrain(int type, uint flag)
|
||||
{
|
||||
uint32 r = Random();
|
||||
|
||||
const Sprite *templ = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845, ST_MAPGEN);
|
||||
/* Choose one of the templates from the graphics file. */
|
||||
const Sprite *templ = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + SPR_MAPGEN_BEGIN, ST_MAPGEN);
|
||||
if (templ == nullptr) usererror("Map generator sprites could not be loaded");
|
||||
|
||||
/* Chose a random location to apply the template to. */
|
||||
uint x = r & Map::MaxX();
|
||||
uint y = (r >> Map::LogX()) & Map::MaxY();
|
||||
|
||||
/* Make sure the template is not too close to the upper edges; bottom edges are checked later. */
|
||||
uint edge_distance = 1 + (_settings_game.construction.freeform_edges ? 1 : 0);
|
||||
if (x <= edge_distance || y <= edge_distance) return;
|
||||
|
||||
@@ -881,6 +884,9 @@ static void GenerateTerrain(int type, uint flag)
|
||||
const byte *p = templ->data;
|
||||
|
||||
if ((flag & 4) != 0) {
|
||||
/* This is only executed in secondary/tertiary loops to generate the terrain for arctic and tropic.
|
||||
* It prevents the templates to be applied to certain parts of the map based on the flags, thus
|
||||
* creating regions with different elevations/topography. */
|
||||
uint xw = x * Map::SizeY();
|
||||
uint yw = y * Map::SizeX();
|
||||
uint bias = (Map::SizeX() + Map::SizeY()) * 16;
|
||||
@@ -905,11 +911,15 @@ static void GenerateTerrain(int type, uint flag)
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure the template does not overflow at the bottom edges of the map; upper edges were checked before. */
|
||||
if (x + w >= Map::MaxX()) return;
|
||||
if (y + h >= Map::MaxY()) return;
|
||||
|
||||
TileIndex tile = TileXY(x, y);
|
||||
|
||||
/* Get the template and overlay in a particular direction over the map's height from the given
|
||||
* origin point (tile), and update the map's height everywhere where the height from the template
|
||||
* is higher than the height of the map. In other words, this only raises the tile heights. */
|
||||
switch (direction) {
|
||||
default: NOT_REACHED();
|
||||
case DIAGDIR_NE:
|
||||
|
Reference in New Issue
Block a user