From f1c213b7077c67898f19a38c7092569d3d5003c8 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sat, 7 Nov 2009 23:27:08 +0000 Subject: [PATCH] Fixing compiler errors. Might still be broken, though. --- src/net/common/clientstate.cpp | 28 ++++++++++++++++------------ src/net/common/serverlobbythread.cpp | 16 +++++++++++++--- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index 81f8a088..82ad477c 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -1053,7 +1053,22 @@ ClientStateWaitAuthChallenge::Exit(boost::shared_ptr /*client*/) void ClientStateWaitAuthChallenge::InternalHandlePacket(boost::shared_ptr client, boost::shared_ptr tmpPacket) { - if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_authMessage) + if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_announceMessage) + { + // Server has send announcement - check data. + AnnounceMessage_t *netAnnounce = &tmpPacket->GetMsg()->choice.announceMessage; + // Check current game version. + if (netAnnounce->latestGameVersion.major != POKERTH_VERSION_MAJOR + || netAnnounce->latestGameVersion.minor != POKERTH_VERSION_MINOR) + { + client->GetCallback().SignalNetClientNotification(NTF_NET_NEW_RELEASE_AVAILABLE); + } + else if (POKERTH_BETA_REVISION && netAnnounce->latestBetaRevision != POKERTH_BETA_REVISION) + { + client->GetCallback().SignalNetClientNotification(NTF_NET_OUTDATED_BETA); + } + } + else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_authMessage) { // Check subtype. AuthMessage_t *netAuth = &tmpPacket->GetMsg()->choice.authMessage; @@ -1167,17 +1182,6 @@ ClientStateWaitSession::InternalHandlePacket(boost::shared_ptr cli { // Everything is fine - we are in the lobby. InitAckMessage_t *netInitAck = &tmpPacket->GetMsg()->choice.initAckMessage; - // Check current game version. - if (netInitAck->latestGameVersion.major != POKERTH_VERSION_MAJOR - || netInitAck->latestGameVersion.minor != POKERTH_VERSION_MINOR) - { - client->GetCallback().SignalNetClientNotification(NTF_NET_NEW_RELEASE_AVAILABLE); - } - else if (POKERTH_BETA_REVISION && netInitAck->latestBetaRevision != POKERTH_BETA_REVISION) - { - client->GetCallback().SignalNetClientNotification(NTF_NET_OUTDATED_BETA); - } - client->SetGuiPlayerId(netInitAck->yourPlayerId); client->SetSessionEstablished(true); diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index e308fbe5..7bbb593e 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -216,6 +216,19 @@ ServerLobbyThread::AddConnection(boost::shared_ptr sock) { sessionData->SetClientAddr(ipAddress); hasClientIp = true; + + boost::shared_ptr packet(new NetPacket(NetPacket::Alloc)); + packet->GetMsg()->present = PokerTHMessage_PR_announceMessage; + AnnounceMessage_t *netAnnounce = &packet->GetMsg()->choice.announceMessage; + netAnnounce->protocolVersion.major = NET_VERSION_MAJOR; + netAnnounce->protocolVersion.minor = NET_VERSION_MINOR; + netAnnounce->latestGameVersion.major = POKERTH_VERSION_MAJOR; + netAnnounce->latestGameVersion.minor = POKERTH_VERSION_MINOR; + netAnnounce->latestBetaRevision = POKERTH_BETA_REVISION; + // TODO + netAnnounce->serverType = serverType_serverTypeLAN; + GetSender().Send(sessionData, packet); + sock->async_read_some( boost::asio::buffer(sessionData->GetReceiveBuffer().recvBuf, RECV_BUF_SIZE), boost::bind( @@ -1327,9 +1340,6 @@ ServerLobbyThread::EstablishSession(SessionWrapper session) boost::shared_ptr ack(new NetPacket(NetPacket::Alloc)); ack->GetMsg()->present = PokerTHMessage_PR_initAckMessage; InitAckMessage_t *netInitAck = &ack->GetMsg()->choice.initAckMessage; - netInitAck->latestGameVersion.major = POKERTH_VERSION_MAJOR; - netInitAck->latestGameVersion.minor = POKERTH_VERSION_MINOR; - netInitAck->latestBetaRevision = POKERTH_BETA_REVISION; // initAckData.sessionId = session.sessionData->GetId(); // TODO: currently unused. netInitAck->yourPlayerId = session.playerData->GetUniqueId(); GetSender().Send(session.sessionData, ack);