diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CBot/CBotToken.cpp | 2 | ||||
-rw-r--r-- | src/common/iman.cpp | 4 | ||||
-rw-r--r-- | src/common/singleton.h | 5 | ||||
-rw-r--r-- | src/sound/oalsound/alsound.cpp | 14 | ||||
-rw-r--r-- | src/ui/interface.cpp | 7 |
5 files changed, 9 insertions, 23 deletions
diff --git a/src/CBot/CBotToken.cpp b/src/CBot/CBotToken.cpp index 48033a3..17cdba1 100644 --- a/src/CBot/CBotToken.cpp +++ b/src/CBot/CBotToken.cpp @@ -105,7 +105,7 @@ void CBotToken::Free() const CBotToken& CBotToken::operator=(const CBotToken& src) { - if (m_next != NULL) delete(m_next); + delete m_next; m_next = NULL; m_prev = NULL; diff --git a/src/common/iman.cpp b/src/common/iman.cpp index 88fbb9b..edfa9c7 100644 --- a/src/common/iman.cpp +++ b/src/common/iman.cpp @@ -42,9 +42,7 @@ void CInstanceManager::Flush() { for (int i = 0; i < CLASS_MAX; i++) { - if (m_table[i].instances != nullptr) - delete[] m_table[i].instances; - + delete[] m_table[i].instances; m_table[i].instances = nullptr; } } diff --git a/src/common/singleton.h b/src/common/singleton.h index 841759d..bf5bc9d 100644 --- a/src/common/singleton.h +++ b/src/common/singleton.h @@ -62,10 +62,7 @@ public: static void ReplaceInstance(T* newInstance) { assert(newInstance != nullptr); - - if (m_instance != nullptr) - delete m_instance; - + delete m_instance; m_instance = newInstance; } #endif diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp index 8afbdd2..327bb6f 100644 --- a/src/sound/oalsound/alsound.cpp +++ b/src/sound/oalsound/alsound.cpp @@ -58,20 +58,14 @@ void ALSound::CleanUp() delete channel.second; } - if (m_currentMusic) - { - delete m_currentMusic; - } - + delete m_currentMusic; + for (auto item : m_oldMusic) { delete item.music; } - - if (m_previousMusic.music) - { - delete m_previousMusic.music; - } + + delete m_previousMusic.music; for (auto item : m_sounds) { diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index ab2c01b..4a0c221 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -49,11 +49,8 @@ void CInterface::Flush() { for (int i = 0; i < MAXCONTROL; i++) { - if (m_table[i] != nullptr) - { - delete m_table[i]; - m_table[i] = nullptr; - } + delete m_table[i]; + m_table[i] = nullptr; } } |