[Fix] Memory managment now working, and utilized.
This commit is contained in:
		
							parent
							
								
									7ca0ad0d7d
								
							
						
					
					
						commit
						d55d16ac61
					
				| @ -45,21 +45,22 @@ public: | ||||
| 
 | ||||
| 	void OnAttack(void); | ||||
| 
 | ||||
| //	inline void* operator new(size_t size) {
 | ||||
| //		return gMemManager.Allocate(size);
 | ||||
| //	}
 | ||||
| //
 | ||||
| //	inline void operator delete(void* object) {
 | ||||
| //		gMemManager.Free(object);
 | ||||
| //	}
 | ||||
| //
 | ||||
| //	inline void* operator new [](size_t size) {
 | ||||
| //		return gMemManager.Allocate(size);
 | ||||
| //	}
 | ||||
| //
 | ||||
| //	inline void operator delete [](void* object) {
 | ||||
| //		gMemManager.Free(object);
 | ||||
| //	}
 | ||||
| 	// Overload new and delete operators to utilize MemManager.
 | ||||
| 	inline void* operator new(size_t size) { | ||||
| 		return gMemManager.Allocate(size); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void operator delete(void* object) { | ||||
| 		gMemManager.Free(object); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void* operator new [](size_t size) { | ||||
| 		return gMemManager.Allocate(size); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void operator delete [](void* object) { | ||||
| 		gMemManager.Free(object); | ||||
| 	} | ||||
| 
 | ||||
| 	enum { | ||||
| 		FACING_UP, | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| #pragma once | ||||
| #include <list> | ||||
| #include "MemClass.h" | ||||
| 
 | ||||
| class Character; | ||||
| class NPC; | ||||
| @ -29,6 +30,23 @@ public: | ||||
| 	void OnPlayerAttack(Player* player); | ||||
| 	void OnPlayerMove(Player* player); | ||||
| 
 | ||||
| 	// Overload new and delete operators to utilize MemManager.
 | ||||
| 	inline void* operator new(size_t size) { | ||||
| 		return gMemManager.Allocate(size); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void operator delete(void* object) { | ||||
| 		gMemManager.Free(object); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void* operator new [](size_t size) { | ||||
| 		return gMemManager.Allocate(size); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void operator delete [](void* object) { | ||||
| 		gMemManager.Free(object); | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	LevelGen* _level; | ||||
| 	std::list<NPC*> _npcs; | ||||
|  | ||||
| @ -14,6 +14,7 @@ | ||||
| #include "../LevelGen/MapTile.h" | ||||
| #include "../System/Debug.h" | ||||
| #include "../Engine/WorldManager.h" | ||||
| #include "../Engine/MemClass.h" | ||||
| using namespace std; | ||||
| 
 | ||||
| class Character; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Rtch90
						Rtch90