aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-01-23 17:29:15 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-01-23 17:29:15 +0200
commitc914cbb0a081b30b28271618bbaa8e987a108ae7 (patch)
treee77ed702c3efe15dce220a4410ac10db5f1bf25b /src/server.cpp
parentc0a1bcf4735661e69ba0938b322fe37daf510edf (diff)
downloadminetest-c914cbb0a081b30b28271618bbaa8e987a108ae7.tar.gz
minetest-c914cbb0a081b30b28271618bbaa8e987a108ae7.tar.bz2
minetest-c914cbb0a081b30b28271618bbaa8e987a108ae7.zip
OMG! Main Menu!
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp
index e06e69d87..a979086ea 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -53,6 +53,10 @@ void * ServerThread::Thread()
catch(con::NoIncomingDataException &e)
{
}
+ catch(con::PeerNotFoundException &e)
+ {
+ dout_server<<"Server: PeerNotFoundException"<<std::endl;
+ }
}
END_DEBUG_EXCEPTION_HANDLER
@@ -3436,4 +3440,44 @@ void Server::handlePeerChanges()
}
}
+void dedicated_server_loop(Server &server)
+{
+ DSTACK(__FUNCTION_NAME);
+
+ std::cout<<std::endl;
+ std::cout<<"========================"<<std::endl;
+ std::cout<<"Running dedicated server"<<std::endl;
+ std::cout<<"========================"<<std::endl;
+ std::cout<<std::endl;
+
+ for(;;)
+ {
+ // This is kind of a hack but can be done like this
+ // because server.step() is very light
+ sleep_ms(30);
+ server.step(0.030);
+
+ static int counter = 0;
+ counter--;
+ if(counter <= 0)
+ {
+ counter = 10;
+
+ core::list<PlayerInfo> list = server.getPlayerInfo();
+ core::list<PlayerInfo>::Iterator i;
+ static u32 sum_old = 0;
+ u32 sum = PIChecksum(list);
+ if(sum != sum_old)
+ {
+ std::cout<<DTIME<<"Player info:"<<std::endl;
+ for(i=list.begin(); i!=list.end(); i++)
+ {
+ i->PrintLine(&std::cout);
+ }
+ }
+ sum_old = sum;
+ }
+ }
+}
+