Fix trees causing IndexOutOfRange errors on maps with very low heights such as 16

This commit is contained in:
UnknownShadow200 2017-05-02 07:48:10 +10:00
parent 2a88a33379
commit ab2032d1d8
2 changed files with 2 additions and 0 deletions

View File

@ -347,6 +347,7 @@ namespace ClassicalSharp.Generator {
continue;
int treeY = heightmap[treeZ * Width + treeX] + 1;
if (treeY >= Height) continue;
int treeHeight = 5 + rnd.Next(3);
int index = (treeY * Length + treeZ) * Width + treeX;

View File

@ -218,6 +218,7 @@ void NotchyGen_PlantTrees() {
continue;
Int32 treeY = Heightmap[treeZ * Width + treeX] + 1;
if (treeY >= Height) continue;
Int32 treeHeight = 5 + Random_Next(&rnd, 3);
Int32 index = (treeY * Length + treeZ) * Width + treeX;