diff options
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp index d90262060..69e673fa4 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -634,6 +634,7 @@ void the_game( gui::IGUIFont* font, std::string map_dir, std::string playername, + std::string password, std::string address, u16 port, std::wstring &error_message @@ -672,7 +673,6 @@ void the_game( guienv->drawAll(); driver->endScene(); - std::cout<<DTIME<<"Creating server and client"<<std::endl; /* Create server. @@ -680,6 +680,7 @@ void the_game( */ SharedPtr<Server> server; if(address == ""){ + std::cout<<DTIME<<"Creating server"<<std::endl; server = new Server(map_dir); server->start(port); } @@ -688,7 +689,8 @@ void the_game( Create client */ - Client client(device, playername.c_str(), draw_control); + std::cout<<DTIME<<"Creating client"<<std::endl; + Client client(device, playername.c_str(), password, draw_control); Address connect_address(0,0,0,0, port); try{ @@ -727,6 +729,10 @@ void the_game( could_connect = true; break; } + if(client.accessDenied()) + { + break; + } // Wait for 10 seconds if(time_counter >= 10.0) { @@ -755,8 +761,16 @@ void the_game( if(could_connect == false) { - std::cout<<DTIME<<"Timed out."<<std::endl; - error_message = L"Connection timed out."; + if(client.accessDenied()) + { + error_message = L"Access denied. Check your password and try again."; + std::cout<<DTIME<<"Access denied."<<std::endl; + } + else + { + error_message = L"Connection timed out."; + std::cout<<DTIME<<"Timed out."<<std::endl; + } gui_loadingtext->remove(); return; } |