1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

CArtifactsOfHero: use shared_ptr for SCommonPart

This commit is contained in:
Arseniy Shestakov
2016-08-30 07:05:31 +03:00
parent b8f4fdc2f2
commit 0236309d25
6 changed files with 9 additions and 9 deletions

View File

@@ -908,7 +908,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
prepareBackground();
artifs[0] = new CArtifactsOfHero(Point(-334, 150));
artifs[0]->commonInfo = new CArtifactsOfHero::SCommonPart;
artifs[0]->commonInfo = std::make_shared<CArtifactsOfHero::SCommonPart>();
artifs[0]->commonInfo->participants.insert(artifs[0]);
artifs[0]->setHero(heroInst[0]);
artifs[1] = new CArtifactsOfHero(Point(96, 150));
@@ -1004,7 +1004,6 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
CExchangeWindow::~CExchangeWindow() //d-tor
{
delete artifs[0]->commonInfo;
artifs[0]->commonInfo = nullptr;
artifs[1]->commonInfo = nullptr;
}