mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
Free memory at TerrainTypeHandler destruction
This commit is contained in:
parent
4ea57ea7fc
commit
64fd896978
@ -29,6 +29,22 @@ TerrainTypeHandler::TerrainTypeHandler()
|
||||
initTerrains(allConfigs); //maps will be populated inside
|
||||
}
|
||||
|
||||
TerrainTypeHandler::~TerrainTypeHandler()
|
||||
{
|
||||
for (const auto * terrain : objects)
|
||||
{
|
||||
delete terrain;
|
||||
}
|
||||
for (const auto * river : riverTypes)
|
||||
{
|
||||
delete river;
|
||||
}
|
||||
for (const auto * road : roadTypes)
|
||||
{
|
||||
delete road;
|
||||
}
|
||||
}
|
||||
|
||||
void TerrainTypeHandler::initTerrains(const std::vector<std::string> & allConfigs)
|
||||
{
|
||||
std::vector<std::function<void()>> resolveLater;
|
||||
|
@ -133,6 +133,7 @@ class DLL_LINKAGE TerrainTypeHandler //TODO: public IHandlerBase ?
|
||||
public:
|
||||
|
||||
TerrainTypeHandler();
|
||||
~TerrainTypeHandler();
|
||||
|
||||
const std::vector<TerrainType *> & terrains() const;
|
||||
const TerrainType * getInfoByName(const std::string & terrainName) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user