[FIX] Fixed exception when quitting.

This commit is contained in:
Tamir Atias 2011-12-29 00:15:51 +02:00
parent 0e11ecba87
commit 73210e0451
3 changed files with 17 additions and 3 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@ Win32/Unuk/Unuk/Release
Win32/Unuk/Unuk/*.user Win32/Unuk/Unuk/*.user
Win32/Unuk/Unuk.ncb Win32/Unuk/Unuk.ncb
Win32/Unuk/Unuk.suo Win32/Unuk/Unuk.suo
Bin/*.dll
*.o *.o
*.exe *.exe
*log *log

View File

@ -54,15 +54,26 @@ gameNavVal_t Game::Run(const string savegameIDArg) {
_gameRunning = true; _gameRunning = true;
while(_gameRunning) { while(_gameRunning) {
bool stillRunning = true;
updateTimer.Start(); updateTimer.Start();
while((int)SDL_GetTicks() > nextGameTick) { while((int)SDL_GetTicks() > nextGameTick) {
HandleInput(); HandleInput();
UpdateGame(); if (!_gameRunning) {
stillRunning = false;
break;
}
UpdateGame();
nextGameTick += SKIP_TICKS; nextGameTick += SKIP_TICKS;
} }
updateTimer.Pause(); updateTimer.Pause();
if (!stillRunning) {
break;
}
renderTimer.Start(); renderTimer.Start();
Render(); Render();
renderTimer.Pause(); renderTimer.Pause();

View File

@ -11,8 +11,10 @@ Text::Text(void) {
} }
Text::~Text(void) { Text::~Text(void) {
assert(_text != NULL); if (_text) {
SDL_FreeSurface(_text); SDL_FreeSurface(_text);
_text = NULL;
}
} }
void Text::LoadFonts(void) { void Text::LoadFonts(void) {