浏览代码

CQuest: add proper constructor to avoid uninitialized fields

Arseniy Shestakov 9 年之前
父节点
当前提交
52e660f087
共有 2 个文件被更改,包括 8 次插入1 次删除
  1. 7 0
      lib/mapObjects/CQuest.cpp
  2. 1 1
      lib/mapObjects/CQuest.h

+ 7 - 0
lib/mapObjects/CQuest.cpp

@@ -23,6 +23,13 @@
 
 std::map <PlayerColor, std::set <ui8> > CGKeys::playerKeyMap;
 
+CQuest::CQuest()
+	: qid(-1), missionType(MISSION_NONE), progress(NOT_ACTIVE), lastDay(-1), m13489val(0),
+	textOption(0), completedOption(0), stackDirection(0), heroPortrait(-1),
+	isCustomFirst(false), isCustomNext(false), isCustomComplete(false)
+{
+}
+
 ///helpers
 static void showInfoDialog(const PlayerColor playerID, const ui32 txtID, const ui16 soundID)
 {

+ 1 - 1
lib/mapObjects/CQuest.h

@@ -50,7 +50,7 @@ public:
 	std::string firstVisitText, nextVisitText, completedText;
 	bool isCustomFirst, isCustomNext, isCustomComplete;
 
-	CQuest(){missionType = MISSION_NONE;}; //default constructor
+	CQuest();
 	virtual ~CQuest(){};
 
 	virtual bool checkQuest (const CGHeroInstance * h) const; //determines whether the quest is complete or not