moved static car menu pointer variable into garage menu class
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6960 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 91887c5284033f831d234a608c99990e3312d405 Former-commit-id: c435103cff51d6a126238c248041a8a835f04970
This commit is contained in:
parent
aa3f5dd68c
commit
b616ef8c14
2 changed files with 20 additions and 14 deletions
|
@ -35,8 +35,6 @@
|
|||
#include "garagemenu.h"
|
||||
#include "carsetupmenu.h"
|
||||
|
||||
static CarSetupMenu *carSetupMenu = nullptr;
|
||||
|
||||
void RmGarageMenu::onActivateCB(void *pGarageMenu)
|
||||
{
|
||||
GfLogTrace("Entering Garage menu\n");
|
||||
|
@ -44,10 +42,10 @@ void RmGarageMenu::onActivateCB(void *pGarageMenu)
|
|||
// Get the RmGarageMenu instance.
|
||||
RmGarageMenu* pMenu = static_cast<RmGarageMenu*>(pGarageMenu);
|
||||
|
||||
if (carSetupMenu)
|
||||
if (pMenu->_pCarSetupMenu)
|
||||
{
|
||||
delete carSetupMenu;
|
||||
carSetupMenu = nullptr;
|
||||
delete pMenu->_pCarSetupMenu;
|
||||
pMenu->_pCarSetupMenu = nullptr;
|
||||
}
|
||||
|
||||
// Get infos about the current car for the current driver
|
||||
|
@ -139,9 +137,9 @@ void RmGarageMenu::onCarSetupCB(void *pGarageMenu)
|
|||
pDriver->setCar(pMenu->getSelectedCarModel());
|
||||
|
||||
// Switch to setup screen.
|
||||
carSetupMenu = new CarSetupMenu;
|
||||
carSetupMenu->initialize(pMenu->getMenuHandle(), pMenu->getRace(), pMenu->getDriver());
|
||||
carSetupMenu->runMenu();
|
||||
pMenu->_pCarSetupMenu = new CarSetupMenu;
|
||||
pMenu->_pCarSetupMenu->initialize(pMenu->getMenuHandle(), pMenu->getRace(), pMenu->getDriver());
|
||||
pMenu->_pCarSetupMenu->runMenu();
|
||||
}
|
||||
|
||||
void RmGarageMenu::onAcceptCB(void *pGarageMenu)
|
||||
|
@ -160,24 +158,28 @@ void RmGarageMenu::onAcceptCB(void *pGarageMenu)
|
|||
// Back to previous screen.
|
||||
GfuiScreenActivate(pMenu->getPreviousMenuHandle());
|
||||
|
||||
delete carSetupMenu;
|
||||
carSetupMenu = nullptr;
|
||||
delete pMenu->_pCarSetupMenu;
|
||||
pMenu->_pCarSetupMenu = nullptr;
|
||||
}
|
||||
|
||||
void RmGarageMenu::onCancelCB(void *pGarageMenu)
|
||||
{
|
||||
// Get the RmGarageMenu instance from call-back user data.
|
||||
const RmGarageMenu* pMenu = static_cast<RmGarageMenu*>(pGarageMenu);
|
||||
RmGarageMenu* pMenu = static_cast<RmGarageMenu*>(pGarageMenu);
|
||||
|
||||
// Back to previous screen.
|
||||
GfuiScreenActivate(pMenu->getPreviousMenuHandle());
|
||||
|
||||
delete carSetupMenu;
|
||||
carSetupMenu = nullptr;
|
||||
delete pMenu->_pCarSetupMenu;
|
||||
pMenu->_pCarSetupMenu = nullptr;
|
||||
}
|
||||
|
||||
RmGarageMenu::RmGarageMenu()
|
||||
: GfuiMenuScreen("garagemenu.xml"), _pRace(0), _pDriver(0), _nCurSkinIndex(0)
|
||||
: GfuiMenuScreen("garagemenu.xml")
|
||||
, _pRace(nullptr)
|
||||
, _pDriver(nullptr)
|
||||
, _nCurSkinIndex(0)
|
||||
, _pCarSetupMenu(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ class GfRace;
|
|||
class GfDriverSkin;
|
||||
class GfDriver;
|
||||
class GfCar;
|
||||
class CarSetupMenu;
|
||||
|
||||
|
||||
class RmGarageMenu : public GfuiMenuScreen
|
||||
|
@ -81,6 +82,9 @@ private:
|
|||
std::vector<GfDriverSkin> _vecPossSkins;
|
||||
size_t _nCurSkinIndex;
|
||||
|
||||
// The car setup menu.
|
||||
CarSetupMenu *_pCarSetupMenu;
|
||||
|
||||
};
|
||||
|
||||
#endif //_GARAGEMENU_H_
|
||||
|
|
Loading…
Reference in a new issue