I was looking the menu to figure out a fade issue I saw on the wiz, its on the pc side but you have to be quick.
What i found was that theres a memory leak:
In loadmainmenu:
| CODE |
do { gamedo_AnimatedTiles(); MainMenu->processlogic();
if(g_pInput->getPressedCommand(IC_STATUS) || g_pInput->getPressedCommand(IC_JUMP) || g_pInput->getPressedKey(KENTER)) break; if (g_pInput->getPressedKey(KQUIT)) { QuitState = NO_QUIT; [B]return MAINMNU_QUIT;[/B] } MainMenu->render(); } while(!g_pInput->getExitEvent());
|
The code can return before MainMenu is deleted. Which causes the alpha not to be reset, showing the fade issue I saw.
My suggestion is to change all of the CDialogs to local instances, not pointers. It would be better to not use pointers if the scope of the object is only the function.
Also by doing this once the function returns the object is always going to destruct.
I think we do this to all of the menu functions.
Agreed! Nevertheless, check if it is possible use auto classes there instead of pointers.