Browse Source

Fix potentially uninitialized members

Ivan Savenko 1 year ago
parent
commit
e32b6bd807
3 changed files with 6 additions and 6 deletions
  1. 4 4
      AI/Nullkiller/Analyzers/ObjectClusterizer.h
  2. 1 1
      lib/bonuses/Bonus.h
  3. 1 1
      lib/bonuses/Limiters.h

+ 4 - 4
AI/Nullkiller/Analyzers/ObjectClusterizer.h

@@ -17,10 +17,10 @@ namespace NKAI
 
 struct ClusterObjectInfo
 {
-	float priority;
-	float movementCost;
-	uint64_t danger;
-	uint8_t turn;
+	float priority = 0;
+	float movementCost = 0;
+	uint64_t danger = 0;
+	uint8_t turn = 0;
 };
 
 struct ObjectInstanceIDHash

+ 1 - 1
lib/bonuses/Bonus.h

@@ -64,7 +64,7 @@ struct DLL_LINKAGE Bonus : public std::enable_shared_from_this<Bonus>
 	BonusSubtypeID subtype;
 
 	BonusSource source = BonusSource::OTHER; //source type" uses BonusSource values - what gave that bonus
-	BonusSource targetSourceType;//Bonuses of what origin this amplifies, uses BonusSource values. Needed for PERCENT_TO_TARGET_TYPE.
+	BonusSource targetSourceType = BonusSource::OTHER;//Bonuses of what origin this amplifies, uses BonusSource values. Needed for PERCENT_TO_TARGET_TYPE.
 	si32 val = 0;
 	BonusSourceID sid; //source id: id of object/artifact/spell
 	BonusValueType valType = BonusValueType::ADDITIVE_VALUE;

+ 1 - 1
lib/bonuses/Limiters.h

@@ -117,7 +117,7 @@ class DLL_LINKAGE HasAnotherBonusLimiter : public ILimiter //applies only to nod
 public:
 	BonusType type;
 	BonusSubtypeID subtype;
-	BonusSource source;
+	BonusSource source = BonusSource::OTHER;
 	BonusSourceID sid;
 	bool isSubtypeRelevant; //check for subtype only if this is true
 	bool isSourceRelevant; //check for bonus source only if this is true