Browse Source

fix missing tree blocks

Kolja Strohm 3 years ago
parent
commit
ff1a707a4b
2 changed files with 4 additions and 4 deletions
  1. 2 2
      FactoryCraft/GeneratedStructure.cpp
  2. 2 2
      FactoryCraft/TreeTemplate.cpp

+ 2 - 2
FactoryCraft/GeneratedStructure.cpp

@@ -39,7 +39,7 @@ void GeneratedStructure::setBlockAt( Framework::Either<Block*, int> block, Frame
 
 bool GeneratedStructure::isBlockAffected( Framework::Vec3<int> location ) const
 {
-    Framework::Vec3<int> localPos = location - originPos;
+    Framework::Vec3<int> localPos = location - minAffectedPos;
     if( localPos.x >= 0 && localPos.y >= 0 && localPos.z >= 0 && localPos.x < size.x && localPos.y < size.y && localPos.z < size.z )
     {
         int index = ((localPos.x * size.y) + localPos.y) * size.z + localPos.z;
@@ -50,7 +50,7 @@ bool GeneratedStructure::isBlockAffected( Framework::Vec3<int> location ) const
 
 Framework::Either<Block*, int> GeneratedStructure::generateBlockAt( Framework::Vec3<int> location ) const
 {
-    Framework::Vec3<int> localPos = location - originPos;
+    Framework::Vec3<int> localPos = location - minAffectedPos;
     if( localPos.x >= 0 && localPos.y >= 0 && localPos.z >= 0 && localPos.x < size.x && localPos.y < size.y && localPos.z < size.z )
     {
         int index = ((localPos.x * size.y) + localPos.y) * size.z + localPos.z;

+ 2 - 2
FactoryCraft/TreeTemplate.cpp

@@ -2,7 +2,7 @@
 
 
 TreeTemplate::TreeTemplate( float propability, const BlockType* zWoodType, const BlockType* zLeaveType, int minHeight, int maxHeight )
-    : GenerationTemplate( propability, 0, 1, Framework::Vec3<int>( -3, -3, 0 ), Framework::Vec3<int>( 5, 5, maxHeight ) ),
+    : GenerationTemplate( propability, 0, 1, Framework::Vec3<int>( -2, -2, 0 ), Framework::Vec3<int>( 5, 5, maxHeight ) ),
     zWoodType( zWoodType ),
     zLeaveType( zLeaveType ),
     minHeight( minHeight ),
@@ -13,7 +13,7 @@ GeneratedStructure* TreeTemplate::generateAt( Framework::Vec3<int> location, Noi
 {
     double noise = zNoise->getNoise( (double)location.x + 40, (double)location.y + 70, (double)location.z - 20 );
     int height = (int)(minHeight + (noise * (maxHeight - minHeight)));
-    GeneratedStructure* generated = new GeneratedStructure( dynamic_cast<GenerationTemplate*>(getThis()), location, Framework::Vec3<int>( 5, 5, height ), Framework::Vec3<int>( -3, -3, 0 ) + location );
+    GeneratedStructure* generated = new GeneratedStructure( dynamic_cast<GenerationTemplate*>(getThis()), location, Framework::Vec3<int>( 5, 5, height ), Framework::Vec3<int>( -2, -2, 0 ) + location );
     for( int x = 1; x < 4; x++ )
     {
         for( int y = 1; y < 4; y++ )