]> git.localhorst.tv Git - blank.git/commitdiff
server: notify clients of player joins/parts
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 21 Oct 2015 07:42:41 +0000 (09:42 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 21 Oct 2015 07:42:41 +0000 (09:42 +0200)
src/server/net.cpp

index 6ceb186644d3a9f7d5d24526d3cfb2376492db8c..e739922b60268062f4c6a708d0de334d03e401cf 100644 (file)
@@ -431,12 +431,17 @@ void ClientConnection::AttachPlayer(Player &player) {
                GetPlayerModel().Instantiate(PlayerEntity().GetModel());
        }
 
-       cout << "player \"" << player.Name() << "\" joined" << endl;
+       string msg = "player \"" + player.Name() + "\" joined";
+       cout << msg << endl;
+       server.DistributeMessage(0, 0, msg);
 }
 
 void ClientConnection::DetachPlayer() {
        if (!HasPlayer()) return;
-       cout << "player \"" << input->GetPlayer().Name() << "\" left" << endl;
+       string msg = "player \"" + input->GetPlayer().Name() + "\" left";
+       cout << msg << endl;
+       server.DistributeMessage(0, 0, msg);
+
        server.GetWorldSave().Write(input->GetPlayer());
        PlayerEntity().Kill();
        PlayerEntity().UnRef();