diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-04-24 00:11:23 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-04-24 00:11:23 +0300 |
commit | 0034744568ccf97c20638a7e4eb7afc11c4579d6 (patch) | |
tree | 19f934ebf933ca97482905b1dce3cf9b00633921 /src/game.cpp | |
parent | 60a565c1d2cfca9dac01c3ef77395cf81cd98391 (diff) | |
download | dragonfireclient-0034744568ccf97c20638a7e4eb7afc11c4579d6.tar.xz |
Made the main menu a bit more unique looking
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp index 9a0fd312b..c806034f2 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -652,15 +652,33 @@ void the_game( gui_loadingtext->remove(); return; } + + /* + Attempt to connect to the server + */ dstream<<DTIME<<"Connecting to server at "; connect_address.print(&dstream); dstream<<std::endl; client.connect(connect_address); + + bool could_connect = false; try{ - while(client.connectedAndInitialized() == false) + float time_counter = 0.0; + for(;;) { + if(client.connectedAndInitialized()) + { + could_connect = true; + break; + } + // Wait for 10 seconds + if(time_counter >= 10.0) + { + break; + } + // Update screen driver->beginScene(true, true, video::SColor(255,0,0,0)); guienv->drawAll(); @@ -675,12 +693,15 @@ void the_game( // Delay a bit sleep_ms(100); + time_counter += 0.1; } } catch(con::PeerNotFoundException &e) + {} + + if(could_connect == false) { std::cout<<DTIME<<"Timed out."<<std::endl; - //return 0; error_message = L"Connection timed out."; gui_loadingtext->remove(); return; |