Browse Source

fix some memory errors

Kolja Strohm 1 year ago
parent
commit
34ac1d5acf

+ 2 - 2
FactoryCraft/GrowingPlant.cpp

@@ -200,12 +200,12 @@ Framework::Text GrowingPlantBlockType::getBlockTypeNameAfterGrowth() const
     return blockTypeNameAfterGrowth;
 }
 
-void GrowingPlantBlockType::setReadableName(const char* readableName)
+void GrowingPlantBlockType::setReadableName(Framework::Text readableName)
 {
     this->readableName = readableName;
 }
 
-const char* GrowingPlantBlockType::getReadableName() const
+Framework::Text GrowingPlantBlockType::getReadableName() const
 {
     return readableName;
 }

+ 3 - 3
FactoryCraft/GrowingPlant.h

@@ -56,7 +56,7 @@ private:
     Framework::RCArray<GrowthState> states;
     int blockTypeIdAfterGrowth;
     Framework::Text blockTypeNameAfterGrowth;
-    const char* readableName;
+    Framework::Text readableName;
     int ticksNeeded;
 
 public:
@@ -81,8 +81,8 @@ public:
     const Framework::RCArray<GrowthState>& getStates() const;
     void setBlockTypeNameAfterGrowth(Framework::Text blockTypeIdAfterGrowth);
     Framework::Text getBlockTypeNameAfterGrowth() const;
-    void setReadableName(const char* readableName);
-    const char* getReadableName() const;
+    void setReadableName(Framework::Text readableName);
+    Framework::Text getReadableName() const;
     void setTicksNeeded(int ticksNeeded);
     int getTicksNeeded() const;
     void setTransparent(bool transparent);

+ 1 - 2
FactoryCraft/QuestReward.cpp

@@ -8,8 +8,7 @@
 #include "Quest.h"
 
 QuestReward::QuestReward()
-    : ReferenceCounter(),
-      rewardId(rewardId)
+    : ReferenceCounter()
 {}
 
 bool QuestReward::validateSettings(

+ 1 - 3
FactoryCraft/Recipie.cpp

@@ -227,9 +227,7 @@ JSONObjectValidationBuilder* RecipieOutputFactory::addToValidator(
 }
 
 Recipie::Recipie()
-    : ReferenceCounter(),
-      groupName(groupName),
-      outputs(outputs)
+    : ReferenceCounter()
 {}
 
 void Recipie::addOutput(RecipieOutput* outputs)