precondition checks for run()

This commit is contained in:
James Turk 2005-10-28 22:12:44 +00:00
parent 39280103f6
commit 3ba1927472

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: Application.cpp,v 1.29 2005/08/18 07:05:35 cozman Exp $ // $Id: Application.cpp,v 1.30 2005/10/28 22:12:44 cozman Exp $
#include "Application.hpp" #include "Application.hpp"
@ -62,6 +62,18 @@ Application::~Application()
void Application::run() void Application::run()
{ {
if(quit_)
{
throw PreconditionException("Call to Application::run prior to creation"
" of display.");
}
if(stateStack_.empty())
{
throw PreconditionException("Call to Application::run with no state"
" active.");
}
while(!quit_) while(!quit_)
{ {
update(); update();
@ -471,7 +483,7 @@ void Application::initAudioCore(const std::string& deviceName)
// create AudioCore, avoid double initializaiton // create AudioCore, avoid double initializaiton
if(audioCore_.get() == 0) if(audioCore_.get() == 0)
{ {
audioCore_.reset(new audio::AudioCore(deviceName)); audioCore_.reset(new audio::OALAudioCore(deviceName));
} }
else else
{ {