1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Fixed 1889 - removed memory leak that caused multiple identical quest marks

This commit is contained in:
Ivan Savenko
2014-09-18 17:46:35 +03:00
parent 3939c70a81
commit 6cd3d1b30e

View File

@@ -71,6 +71,8 @@ CMinimap (position),
void CQuestMinimap::addQuestMarks (const QuestInfo * q) void CQuestMinimap::addQuestMarks (const QuestInfo * q)
{ {
OBJ_CONSTRUCTION_CAPTURING_ALL; OBJ_CONSTRUCTION_CAPTURING_ALL;
for (auto icon : icons)
delete icon;
icons.clear(); icons.clear();
int3 tile; int3 tile;
@@ -104,7 +106,7 @@ void CQuestMinimap::iconClicked()
{ {
if (currentQuest->obj) if (currentQuest->obj)
adventureInt->centerOn (currentQuest->obj->pos); adventureInt->centerOn (currentQuest->obj->pos);
moveAdvMapSelection(); //moveAdvMapSelection();
} }
void CQuestMinimap::showAll(SDL_Surface * to) void CQuestMinimap::showAll(SDL_Surface * to)
@@ -160,7 +162,6 @@ void CQuestLog::showAll(SDL_Surface * to)
CSDL_Ext::drawBorder(to, Rect::around(labels[questIndex]->pos), int3(Colors::METALLIC_GOLD.r, Colors::METALLIC_GOLD.g, Colors::METALLIC_GOLD.b)); CSDL_Ext::drawBorder(to, Rect::around(labels[questIndex]->pos), int3(Colors::METALLIC_GOLD.r, Colors::METALLIC_GOLD.g, Colors::METALLIC_GOLD.b));
} }
description->show(to); description->show(to);
minimap->update();
minimap->show(to); minimap->show(to);
} }
@@ -178,6 +179,7 @@ void CQuestLog::recreateQuestList (int newpos)
labels[i]->deactivate(); labels[i]->deactivate();
} }
} }
minimap->update();
} }
void CQuestLog::selectQuest (int which) void CQuestLog::selectQuest (int which)
@@ -190,6 +192,7 @@ void CQuestLog::selectQuest (int which)
std::vector<Component> components; //TODO: display them std::vector<Component> components; //TODO: display them
currentQuest->quest->getVisitText (text, components , currentQuest->quest->isCustomFirst, true); currentQuest->quest->getVisitText (text, components , currentQuest->quest->isCustomFirst, true);
description->setText (text.toString()); //TODO: use special log entry text description->setText (text.toString()); //TODO: use special log entry text
minimap->update();
redraw(); redraw();
} }