summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-05-21 01:11:58 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-05-21 01:11:58 +0300
commit76e241392d2ad232b751c74df7cba9e5acfa7855 (patch)
treee58f72b379c1a4e1b86a4e85c6c0007109635b32 /src/game.cpp
parent73a18b9271bebddfe6716529bb13cad30869bc16 (diff)
parent52d857cf1527948e1db5eead457e51b6741de8a2 (diff)
downloadminetest-76e241392d2ad232b751c74df7cba9e5acfa7855.tar.gz
minetest-76e241392d2ad232b751c74df7cba9e5acfa7855.tar.bz2
minetest-76e241392d2ad232b751c74df7cba9e5acfa7855.zip
Merge: New map directory structure and player passwords
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp22
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;
}