Commit f81a0c4d authored by Gerhard Stein's avatar Gerhard Stein

More SmartPointers

parent 5802cf72
......@@ -7,8 +7,6 @@
#include "CConfirmMenu.h"
#define SAFE_DELETE(x) if(x) { delete x; x = NULL; }
/*CConfirmMenu::CConfirmMenu(const std::string &question, bool &to_be_confirmed, Uint8 dlg_theme) :
CBaseMenu(dlg_theme),
m_question(question),
......@@ -39,9 +37,4 @@ void CConfirmMenu::processSpecific()
m_to_be_confirmed = (m_selection == 1) ? true : false;
m_mustclose = true;
}*/
/*}
CConfirmMenu::~CConfirmMenu()
{
//SAFE_DELETE(mp_Dialog);
}*/
/*}*/
......@@ -17,7 +17,6 @@ class CConfirmMenu : public CBaseMenu
public:
CConfirmMenu(const std::string &question, bool &to_be_confirmed, Uint8 dlg_theme);
void processSpecific();
virtual ~CConfirmMenu();
private:
std::string m_question;
......
......@@ -19,8 +19,6 @@
#include "core/CGameControl.h"
#define SAFE_DELETE(x) if(x) { delete x; x = NULL; }
CSettingsMenu::CSettingsMenu() :
CBaseMenu( CRect<float>(0.25f, 0.24f, 0.5f, 0.32f) )
{
......
......@@ -159,7 +159,7 @@ bool CPlayGameVorticon::loadGameState()
g_pGfxEngine->setupEffect(pColorMergeFX);
mp_ObjectAI = new CSpriteObjectAI(mMap.get(), m_Object, m_Player,
mpObjectAI = new CSpriteObjectAI(mMap.get(), m_Object, m_Player,
m_NumPlayers, m_Episode, m_Level,
mMap->m_Dark);
setupPlayers();
......
......@@ -83,7 +83,7 @@ void CPlayGameVorticon::processLevelTrigger(int trigger)
mMap->m_Dark = false;
g_pMusicPlayer->stop();
g_pGfxEngine->Palette.setdark(mMap->m_Dark);
mpFinale = new CTantalusRay(mMessageBoxes, mMap, m_Object, *mp_ObjectAI);
mpFinale = new CTantalusRay(mMessageBoxes, mMap, m_Object, *(mpObjectAI.get()) );
m_Player[0].dontdraw = true;
m_gameover = true;
}
......
......@@ -24,8 +24,7 @@
////
CPlayGameVorticon::CPlayGameVorticon( CExeFile &ExeFile, char level,
char numplayers, CSaveGameController &SavedGame) :
CPlayGame(ExeFile, level, numplayers),
mp_ObjectAI(NULL)
CPlayGame(ExeFile, level, numplayers)
{
mMap = new CMap();
m_level_command = (level==WORLD_MAP_LEVEL_VORTICON) ? GOTO_WORLD_MAP : START_LEVEL;
......@@ -130,7 +129,7 @@ bool CPlayGameVorticon::init()
g_pInput->flushAll();
// Initialize the AI
mp_ObjectAI = new CSpriteObjectAI(mMap.get(), m_Object, m_Player,
mpObjectAI = new CSpriteObjectAI(mMap.get(), m_Object, m_Player,
m_NumPlayers, m_Episode, m_Level,
mMap->m_Dark);
......@@ -188,7 +187,7 @@ void CPlayGameVorticon::process()
if(mMessageBoxes.empty() && !StatusScreenOpen())
{
// Perform AIs
mp_ObjectAI->process();
mpObjectAI->process();
if( !g_pBehaviorEngine->paused() )
......@@ -620,7 +619,6 @@ void CPlayGameVorticon::drawAllElements()
////
void CPlayGameVorticon::cleanup()
{
SAFE_DELETE(mp_ObjectAI);
std::vector<CSpriteObject*>::iterator obj = m_Object.begin();
for( ; obj != m_Object.end() ; obj++ )
delete (*obj);
......@@ -630,5 +628,4 @@ void CPlayGameVorticon::cleanup()
CPlayGameVorticon::~CPlayGameVorticon()
{
m_Player.clear();
SAFE_DELETE(mp_ObjectAI);
}
......@@ -106,7 +106,7 @@ private:
SmartPointer<CMap> mMap;
std::vector<CPlayer> m_Player;
CSpriteObjectAI *mp_ObjectAI;
SmartPointer<CSpriteObjectAI> mpObjectAI;
SmartPointer<CFinale> mpFinale;
SmartPointer<CEGABitmap> mpGameoverBmp;
std::list< SmartPointer<CMessageBoxVort> > mMessageBoxes;
......
......@@ -13,8 +13,6 @@
#include "sdl/extensions.h"
#include "graphics/CGfxEngine.h"
#define SAFE_DELETE(x) { if(x) SDL_FreeSurface(x); x = NULL; }
CSprite::CSprite() :
m_alpha(255)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment