mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +02:00
Hopefully fixed buttons without making leak.
This commit is contained in:
@@ -25,7 +25,8 @@ AdventureMapButton<T>::AdventureMapButton
|
||||
name=Name;
|
||||
helpBox=HelpBox;
|
||||
int est = LOCPLINT->playerID;
|
||||
CDefHandler * temp = CGI->spriteh->giveDef(defName); //todo: moze cieknac
|
||||
CDefHandler * temp = CGI->spriteh->giveDef(defName);
|
||||
temp->notFreeImgs = true;
|
||||
for (int i=0;i<temp->ourImages.size();i++)
|
||||
{
|
||||
imgs.resize(1);
|
||||
@@ -39,6 +40,7 @@ AdventureMapButton<T>::AdventureMapButton
|
||||
for (int i=0; i<add->size();i++)
|
||||
{
|
||||
temp = CGI->spriteh->giveDef((*add)[i]);
|
||||
temp->notFreeImgs = true;
|
||||
for (int j=0;j<temp->ourImages.size();j++)
|
||||
{
|
||||
imgs[i+1].push_back(temp->ourImages[j].bitmap);
|
||||
|
@@ -316,6 +316,12 @@ CButtonBase::CButtonBase()
|
||||
ourObj=NULL;
|
||||
state=0;
|
||||
}
|
||||
CButtonBase::~CButtonBase()
|
||||
{
|
||||
for(int i =0; i<imgs.size();i++)
|
||||
for(int j=0;j<imgs[i].size();j++)
|
||||
SDL_FreeSurface(imgs[i][j]);
|
||||
}
|
||||
void CButtonBase::show(SDL_Surface * to)
|
||||
{
|
||||
if(!to)
|
||||
|
@@ -55,7 +55,7 @@ public:
|
||||
virtual void activate()=0;
|
||||
virtual void deactivate()=0;
|
||||
CButtonBase();
|
||||
virtual ~CButtonBase(){};
|
||||
virtual ~CButtonBase();
|
||||
};
|
||||
class ClickableL : public virtual CIntObject //for left-clicks
|
||||
{
|
||||
|
Reference in New Issue
Block a user