mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2026-02-04 08:09:19 +01:00
Remove All Memory leaks
This commit is contained in:
@@ -5,7 +5,9 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "colors.h"
|
||||
#include "GroundTileTypeManager.h"
|
||||
#include "utils.h"
|
||||
#include "GridSystem/WorldTile.h"
|
||||
#include "Levels/World/WorldLevel.h"
|
||||
|
||||
|
||||
@@ -30,6 +32,7 @@ void Game::Cleanup() {
|
||||
|
||||
//TODO: ask how 2 delete the TextureManager
|
||||
ScreenManager::DestroyInstance();
|
||||
GroundTileTypeManager::DestroyInstance();
|
||||
TextureManager::DestroyInstance();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ void InitializeGroundTiles() {
|
||||
{ GroundTileTypeManager::GetInstance()->IRON, 0.1f },
|
||||
};
|
||||
}
|
||||
|
||||
WorldTile::WorldTile(const Vector2f& position, GroundTileType* groundTileType, TextureManager* pTextureManager, WorldGridManager* pGridManager) : m_Position { position },
|
||||
m_GroundTileType { groundTileType }, m_pGridManager { pGridManager } {
|
||||
// const std::string dirtPath = + "tiles/dirt/dirt" + std::to_string(utils::randRange(1, 5)) + ".png";
|
||||
|
||||
@@ -12,8 +12,21 @@ GroundTileTypeManager* GroundTileTypeManager::GetInstance() {
|
||||
return m_pInstance;
|
||||
}
|
||||
void GroundTileTypeManager::DestroyInstance() {
|
||||
delete m_pInstance->AIR;
|
||||
delete m_pInstance->DIRT;
|
||||
delete m_pInstance->STONE;
|
||||
delete m_pInstance->LAVA;
|
||||
delete m_pInstance->IRON;
|
||||
delete m_pInstance->BRONZE;
|
||||
delete m_pInstance->GOLD;
|
||||
delete m_pInstance->HARD_LEFT;
|
||||
delete m_pInstance->HARD_RIGHT;
|
||||
delete m_pInstance->HARD_MIDDLE;
|
||||
delete m_pInstance->GRASS;
|
||||
|
||||
delete m_pInstance;
|
||||
}
|
||||
GroundTileTypeManager::GroundTileTypeManager(): AIR(new GroundTileType("", GroundTileTypes::Air)), DIRT(new RandomGroundTile("tiles/dirt/dirt[0].png", GroundTileTypes::Dirt, 5)){
|
||||
GroundTileTypeManager::GroundTileTypeManager() {
|
||||
}
|
||||
// void GroundTileTypeManager::Initialize() {
|
||||
// AIR = new GroundTileType("", GroundTileTypes::Air);
|
||||
|
||||
@@ -69,7 +69,7 @@ WorldLevel::~WorldLevel() {
|
||||
delete m_mineralBuilding;
|
||||
delete m_junkBuilding;
|
||||
delete m_repairBuilding;
|
||||
//delete m_pTextTexture;
|
||||
|
||||
}
|
||||
void WorldLevel::Update(float elapsedSec) {
|
||||
m_fps = 1 / elapsedSec;
|
||||
|
||||
@@ -34,8 +34,9 @@ Player::Player(Player&& other) {
|
||||
|
||||
Player::~Player() {
|
||||
delete m_walkAnimation;
|
||||
// delete m_turnAnimation;
|
||||
// delete m_digAnimation;
|
||||
delete m_turnAnimation;
|
||||
delete m_digAnimation;
|
||||
delete m_digStartAnimation;
|
||||
}
|
||||
|
||||
Collision::CollisionRect Player::GetCollisionRect() const {
|
||||
|
||||
@@ -12,13 +12,10 @@ int SDL_main(int argv, char** args) {
|
||||
|
||||
StartHeapControl();
|
||||
|
||||
new Button();
|
||||
|
||||
auto pGame { new Game { Window { "Motherload - Verhulst, Bram - 1DAEGD16E", Viewport.x, Viewport.y, false} } };
|
||||
pGame->Run();
|
||||
delete pGame;
|
||||
|
||||
//DumpMemoryLeaks();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user