Prechádzať zdrojové kódy

fix memory error in tree template structure generation

Kolja Strohm 7 mesiacov pred
rodič
commit
1a9c44e82c

+ 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);
 }