浏览代码

Only delete CQuest in CMap destructor and not with IQuestObject

Quest information must remain accessible even if map object removed. Fix issue 2472
Arseniy Shestakov 9 年之前
父节点
当前提交
1e60ba6516
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 3 1
      lib/mapObjects/CQuest.cpp
  2. 3 0
      lib/mapping/CMap.cpp

+ 3 - 1
lib/mapObjects/CQuest.cpp

@@ -498,7 +498,9 @@ IQuestObject::IQuestObject():
 
 IQuestObject::~IQuestObject()
 {
-	delete quest;
+	///Information about quest should remain accessible even if IQuestObject removed from map
+	///All CQuest objects are freed in CMap destructor
+	//delete quest;
 }
 
 bool IQuestObject::checkQuest(const CGHeroInstance* h) const

+ 3 - 0
lib/mapping/CMap.cpp

@@ -245,6 +245,9 @@ CMap::~CMap()
 
 	for(auto obj : objects)
 		obj.dellNull();
+
+	for(auto quest : quests)
+		quest.dellNull();
 }
 
 void CMap::removeBlockVisTiles(CGObjectInstance * obj, bool total)