[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.ncb
Win32/Unuk/Unuk.suo
Bin/*.dll
*.o
*.exe
*log

View File

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

View File

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