From: <tz...@us...> - 2006-11-22 03:10:41
|
Revision: 1952 http://svn.sourceforge.net/freeorion/revision/?rev=1952&view=rev Author: tzlaine Date: 2006-11-21 19:10:41 -0800 (Tue, 21 Nov 2006) Log Message: ----------- Converted JOIN_GAME messages from XML to plain text. Modified Paths: -------------- trunk/FreeOrion/network/Message.cpp trunk/FreeOrion/network/Message.h trunk/FreeOrion/server/ServerApp.cpp Modified: trunk/FreeOrion/network/Message.cpp =================================================================== --- trunk/FreeOrion/network/Message.cpp 2006-11-22 02:57:40 UTC (rev 1951) +++ trunk/FreeOrion/network/Message.cpp 2006-11-22 03:10:41 UTC (rev 1952) @@ -122,7 +122,7 @@ << msg.Sender(); if (msg.Sender() == -1) - os << "(server) --> "; + os << "(server/unknown) --> "; else if (msg.Sender() == 0) os << "(host) --> "; else @@ -131,7 +131,7 @@ os << msg.Receiver(); if (msg.Receiver() == -1) - os << "(server)."; + os << "(server/unknown)."; else if (msg.Receiver() == 0) os << "(host)."; else @@ -269,9 +269,8 @@ //////////////////////////////////////////////// // Message-Creation Free Functions //////////////////////////////////////////////// -Message HostGameMessage(int player_id, const XMLDoc& game_parameters) +Message HostGameMessage(int player_id, const XMLDoc& doc) { - XMLDoc doc(game_parameters); return Message(Message::HOST_GAME, player_id, -1, Message::CORE, doc); } @@ -284,22 +283,14 @@ Message JoinGameMessage(const std::string& player_name) { - XMLDoc doc; - doc.root_node.AppendChild(XMLElement("player_name", player_name)); - return Message(Message::JOIN_GAME, -1, -1, Message::CORE, doc); + return Message(Message::JOIN_GAME, -1, -1, Message::CORE, player_name); } -Message JoinGameSetup(const XMLDoc& player_setup) +Message JoinGameSetup(const XMLDoc& doc) { - XMLDoc doc(player_setup); return Message(Message::JOIN_GAME, -1, -1, Message::CORE, doc); } -Message VersionConflictMessage(int player_id, const XMLDoc& conflict_details) -{ - return Message(Message::SERVER_STATUS, -1, player_id, Message::CORE, conflict_details); -} - Message GameStartMessage(int player_id, const std::string& data) { return Message(Message::GAME_START, -1, player_id, Message::CORE, data); Modified: trunk/FreeOrion/network/Message.h =================================================================== --- trunk/FreeOrion/network/Message.h 2006-11-22 02:57:40 UTC (rev 1951) +++ trunk/FreeOrion/network/Message.h 2006-11-22 03:10:41 UTC (rev 1952) @@ -142,7 +142,7 @@ /** creates a HOST_GAME message*/ -Message HostGameMessage(int player_id, const XMLDoc& game_parameters); +Message HostGameMessage(int player_id, const XMLDoc& doc); /** creates a minimal HOST_GAME message used to enter and finalize the multiplayer "lobby" setup*/ Message HostGameMessage(int player_id, const std::string& host_player_name); @@ -151,7 +151,7 @@ Message JoinGameMessage(const std::string& player_name); /** creates a JOIN_GAME message. Sends an xml document of the player's details.*/ -Message JoinGameSetup(const XMLDoc& player_setup); +Message JoinGameSetup(const XMLDoc& doc); /** creates a GAME_START message. Contains the initial game state visible to player \a player_id.*/ Message GameStartMessage(int player_id, const std::string& data); Modified: trunk/FreeOrion/server/ServerApp.cpp =================================================================== --- trunk/FreeOrion/server/ServerApp.cpp 2006-11-22 02:57:40 UTC (rev 1951) +++ trunk/FreeOrion/server/ServerApp.cpp 2006-11-22 03:10:41 UTC (rev 1952) @@ -641,10 +641,7 @@ } case Message::JOIN_GAME: { - std::stringstream stream(msg.GetText()); - XMLDoc doc; - doc.ReadDoc(stream); - std::string player_name = doc.root_node.Child("player_name").Text(); + std::string player_name = msg.GetText(); PlayerInfo player_info(connection.socket, connection.address, player_name, false); int player_id = std::max(NetworkCore::HOST_PLAYER_ID + 1, static_cast<int>(m_network_core.Players().size())); |