Changeset - r17989:632dd67c277f
[Not reviewed]
master
0 1 0
rubidium - 13 years ago 2011-08-21 19:36:30
rubidium@openttd.org
(svn r22808) -Change [FS#4740]: make it less likely that a one tile wide lake is created
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/landscape.cpp
Show inline comments
 
@@ -1122,25 +1122,25 @@ static bool FlowRiver(bool *marks, TileI
 
			TileIndex t2 = end + TileOffsByDiagDir(d);
 
			if (IsValidTile(t2) && !marks[t2] && FlowsDown(end, t2)) {
 
				marks[t2] = true;
 
				count++;
 
				queue.push_back(t2);
 
			}
 
		}
 
	} while (!queue.empty());
 

	
 
	if (found) {
 
		/* Flow further down hill. */
 
		found = FlowRiver(marks, spring, end);
 
	} else if (count > 10) {
 
	} else if (count > 32) {
 
		/* Maybe we can make a lake. Find the Nth of the considered tiles. */
 
		TileIndex lakeCenter = 0;
 
		for (int i = RandomRange(count - 1); i != 0; lakeCenter++) {
 
			if (marks[lakeCenter]) i--;
 
		}
 

	
 
		if (IsValidTile(lakeCenter) &&
 
				/* A river, or lake, can only be built on flat slopes. */
 
				GetTileSlope(lakeCenter, NULL) == SLOPE_FLAT &&
 
				/* We want the lake to be built at the height of the river. */
 
				TileHeight(begin) == TileHeight(lakeCenter) &&
 
				/* We don't want the lake at the entry of the valley. */
0 comments (0 inline, 0 general)