Browse Source

fix memory error in tree template structure generation

Kolja Strohm 1 năm trước cách đây
mục cha
commit
1a9c44e82c
2 tập tin đã thay đổi với 2 bổ sung3 xóa
  1. 1 1
      FactoryCraft/GeneratedStructure.h
  2. 1 2
      FactoryCraft/TreeTemplate.cpp

+ 1 - 1
FactoryCraft/GeneratedStructure.h

@@ -25,7 +25,7 @@ public:
         Framework::Vec3<int> originPos,
         Framework::Vec3<int> size,
         Framework::Vec3<int> minAffectedPos);
-    ~GeneratedStructure();
+    virtual ~GeneratedStructure();
     void setBlockAt(
         Framework::Either<Block*, int> block, Framework::Vec3<int> localPos);
     bool isBlockAffected(Framework::Vec3<int> location) const;

+ 1 - 2
FactoryCraft/TreeTemplate.cpp

@@ -98,7 +98,6 @@ void TreeTemplate::setMinHeight(int height)
 void TreeTemplate::setMaxHeight(int height)
 {
     maxHeight = height;
-    Framework::Vec3<int>(5, 5, maxHeight);
 }
 
 int TreeTemplate::getMinHeight() const
@@ -130,7 +129,7 @@ void TreeTemplateFactory::fromJson(
         zConfig->asObject()->zValue("leaves")->asString()->getString()));
     zResult->setMinHeight(
         (int)(zConfig->asObject()->zValue("minSize")->asNumber()->getNumber()));
-    zResult->setMinHeight(
+    zResult->setMaxHeight(
         (int)(zConfig->asObject()->zValue("maxSize")->asNumber()->getNumber()));
     GeneratorTemplateFactory::fromJson(zResult, zConfig);
 }