mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Quest Log: cleanup minimap code
Usage of shared_ptr suggested by @alexwins
This commit is contained in:
parent
5a5c126f0e
commit
8beed60815
client/windows
@ -72,26 +72,21 @@ CMinimap (position),
|
||||
void CQuestMinimap::addQuestMarks (const QuestInfo * q)
|
||||
{
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||
for (auto icon : icons)
|
||||
delete icon;
|
||||
icons.clear();
|
||||
|
||||
int3 tile;
|
||||
if (q->obj)
|
||||
{
|
||||
tile = q->obj->pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
tile = q->tile;
|
||||
}
|
||||
|
||||
int x,y;
|
||||
minimap->tileToPixels (tile, x, y);
|
||||
|
||||
if (level != tile.z)
|
||||
setLevel(tile.z);
|
||||
|
||||
CQuestIcon * pic = new CQuestIcon ("VwSymbol.def", 3, x, y);
|
||||
auto pic = make_shared<CQuestIcon>("VwSymbol.def", 3, x, y);
|
||||
|
||||
pic->moveBy (Point ( -pic->pos.w/2, -pic->pos.h/2));
|
||||
pic->callback = std::bind (&CQuestMinimap::iconClicked, this);
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
|
||||
class CQuestMinimap : public CMinimap
|
||||
{
|
||||
std::vector <CQuestIcon *> icons;
|
||||
std::vector <shared_ptr<CQuestIcon>> icons;
|
||||
|
||||
void clickLeft(tribool down, bool previousState){}; //minimap ignores clicking on its surface
|
||||
void iconClicked();
|
||||
|
Loading…
x
Reference in New Issue
Block a user