Hello, what this function is suppose to do is wait for the user to either click button one, button two, or ex out the program. Instead, i get this error:
1 2
Unhandled exception at 0x00973faa in TicTacToe v2.0.exe: 0xC0000005:
Access violation reading location 0xfeeefeee.
I don't see anything wrong with that code. What exact line does the crash happen on?
On a side note, it seems very strange that you would pass an SDL_Event event to this function. I would get rid of that and just make SDL_Event local to the function instead of a parameter.
The program '[3492] TicTacToe v2.0.exe: Native' has exited with code -1073741819 (0xc0000005).
But cant tell what the exact line is. If i try doing that thing with the red circle on the side ( sorry i cant remember what its called... break point maybe?) the arrow just keeps going to the top of the while loop and then to the bottom... then to the top and to the bottom. Oh and i fixed what you said about passing an event to the function but im still getting the same problem.
I would suspect the problem is with ChangeState since that seems to be doing pointer work, and you have a bug that's typically caused by screwing up pointer work.
If you could upload the whole source somewhere so I could see all of it, that would be even better.
void ChangeState( GameState *currentState, int nextState )
{
//If the state needs to be changed
if( nextState != STATE_NULL )
{
//Delete the current state
if( nextState != STATE_EXIT )
{
delete currentState;
}
//Change the state
switch( nextState )
{
case STATE_TITLE:
currentState = new Title();
break;
case STATE_2PLAYER:
currentState = new MultiPlayer();
break;
}
}
}