* Fix a memory leak + some weirdness.

This commit is contained in:
iProgramInCpp 2023-08-02 14:35:26 +03:00
parent b710486ebb
commit 8047ce7e03
2 changed files with 10 additions and 1 deletions

View file

@ -32,6 +32,14 @@ ExternalFileLevelStorage::ExternalFileLevelStorage(const std::string& a, const s
readPlayerData(datPlayer, m_pLevelData);
}
ExternalFileLevelStorage::~ExternalFileLevelStorage()
{
if (m_pRegionFile)
delete m_pRegionFile;
if (m_pLevelData)
delete m_pLevelData;
}
LevelData* ExternalFileLevelStorage::prepareLevel(Level* level)
{
m_pLevel = level;
@ -113,7 +121,7 @@ void ExternalFileLevelStorage::tick()
if (iter == m_unsavedLevelChunks.end())
{
UnsavedLevelChunk ulc = { index, RakNet::GetTimeMS(), pChunk };
UnsavedLevelChunk ulc = { index, int(RakNet::GetTimeMS()), pChunk };
m_unsavedLevelChunks.push_back(ulc);
}

View file

@ -26,6 +26,7 @@ class ExternalFileLevelStorage : public LevelStorage, ChunkStorage
{
public:
ExternalFileLevelStorage(const std::string& a, const std::string& path);
~ExternalFileLevelStorage();
// LevelStorage
LevelData* prepareLevel(Level* level) override;