- added SDL Pump events during game load to avoid hanging appearance when users click madly in startup

This commit is contained in:
Mark Vejvoda 2010-06-13 00:59:56 +00:00
parent 100e39e6e0
commit 6c28167e5e
2 changed files with 16 additions and 0 deletions

View File

@ -164,6 +164,8 @@ void Game::load(){
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
if(loadingImageUsed == false){
// try to use a faction related loading screen
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Searching for faction loading screen\n",__FILE__,__FUNCTION__);
@ -242,6 +244,7 @@ void Game::load(){
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
@ -257,6 +260,7 @@ void Game::load(){
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
@ -265,6 +269,7 @@ void Game::load(){
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
@ -276,6 +281,7 @@ void Game::load(){
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//good_fpu_control_registers(NULL,__FILE__,__FUNCTION__,__LINE__);
@ -304,16 +310,19 @@ void Game::init()
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
world.init(this, gameSettings.getDefaultUnits());
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
gui.init(this);
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
chatManager.init(&console, world.getThisTeamIndex());
console.clearStoredLines();
@ -323,6 +332,7 @@ void Game::init()
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
scriptManager.init(&world, &gameCamera);
@ -345,6 +355,7 @@ void Game::init()
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
//wheather particle systems
if(world.getTileset()->getWeather() == wRainy){
@ -372,6 +383,7 @@ void Game::init()
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
//sounds
SoundRenderer &soundRenderer= SoundRenderer::getInstance();

View File

@ -68,6 +68,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
//load tech tree xml info
try{
@ -90,6 +91,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
//armor types
const XmlNode *armorTypesNode= techTreeNode->getChild("armor-types");
@ -117,6 +119,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
//load factions
str= dir+"/factions/*.";
@ -136,6 +139,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
// give CPU time to update other things to avoid apperance of hanging
sleep(0);
SDL_PumpEvents();
}
}