mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #637 from necropotame/pr-i636-memoryleak
Fixed memory leak after gametype change
This commit is contained in:
commit
acb1ada28c
|
@ -91,7 +91,7 @@ int CMapImages::GetEntities()
|
||||||
{
|
{
|
||||||
CServerInfo Info;
|
CServerInfo Info;
|
||||||
Client()->GetServerInfo(&Info);
|
Client()->GetServerInfo(&Info);
|
||||||
|
|
||||||
if(m_EntitiesTextures == -1 || str_comp(m_aEntitiesGameType, Info.m_aGameType))
|
if(m_EntitiesTextures == -1 || str_comp(m_aEntitiesGameType, Info.m_aGameType))
|
||||||
{
|
{
|
||||||
// DDNet default to prevent delay in seeing entities
|
// DDNet default to prevent delay in seeing entities
|
||||||
|
@ -109,6 +109,9 @@ int CMapImages::GetEntities()
|
||||||
|
|
||||||
char path[64];
|
char path[64];
|
||||||
str_format(path, sizeof(path), "editor/entities_clear/%s.png", file);
|
str_format(path, sizeof(path), "editor/entities_clear/%s.png", file);
|
||||||
|
|
||||||
|
if(m_EntitiesTextures >= 0)
|
||||||
|
Graphics()->UnloadTexture(m_EntitiesTextures);
|
||||||
m_EntitiesTextures = Graphics()->LoadTexture(path, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
m_EntitiesTextures = Graphics()->LoadTexture(path, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
||||||
|
|
||||||
str_copy(m_aEntitiesGameType, Info.m_aGameType, sizeof(m_aEntitiesGameType));
|
str_copy(m_aEntitiesGameType, Info.m_aGameType, sizeof(m_aEntitiesGameType));
|
||||||
|
|
Loading…
Reference in a new issue