From d23a5dcfdf17e507bc5e3233fadb854649bf3dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Thu, 14 Feb 2013 15:19:35 +0000 Subject: [PATCH] Fixed #1208. --- client/CPreGame.cpp | 2 ++ lib/Connection.cpp | 12 ++++++++++-- lib/Connection.h | 1 + server/CVCMIServer.cpp | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index 06b35a17f..4daa60425 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -714,6 +714,7 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMulti serv = CServerHandler::justConnectToServer(); } + serv->enterPregameConnectionMode(); *serv << playerNames.begin()->second; if(multiPlayer == CMenuScreen::MULTI_NETWORK_GUEST) @@ -933,6 +934,7 @@ void CSelectionScreen::handleConnection() { CPackForSelectionScreen *pack = NULL; *serv >> pack; + tlog5 << "Received a pack of type " << typeid(*pack).name() << std::endl; assert(pack); if(QuitMenuWithoutStarting *endingPack = dynamic_cast(pack)) { diff --git a/lib/Connection.cpp b/lib/Connection.cpp index 7f2be3808..43a496292 100644 --- a/lib/Connection.cpp +++ b/lib/Connection.cpp @@ -279,8 +279,16 @@ void CConnection::prepareForSendingHeroes() savedPointers.clear(); CISer::smartVectorMembersSerialization = false; COSer::smartVectorMembersSerialization = false; - CISer::smartPointerSerialization = true; - COSer::smartPointerSerialization = true; + enableSmartPointerSerializatoin(); +} + +void CConnection::enterPregameConnectionMode() +{ + loadedPointers.clear(); + savedPointers.clear(); + CISer::smartVectorMembersSerialization = false; + COSer::smartVectorMembersSerialization = false; + disableSmartPointerSerialization(); } CSaveFile::CSaveFile( const std::string &fname ) diff --git a/lib/Connection.h b/lib/Connection.h index 390490953..798bbaada 100644 --- a/lib/Connection.h +++ b/lib/Connection.h @@ -1289,6 +1289,7 @@ public: void enableSmartPointerSerializatoin(); void prepareForSendingHeroes(); //disables sending vectorised, enables smart pointer serialization, clears saved/loaded ptr cache + void enterPregameConnectionMode(); }; DLL_LINKAGE std::ostream &operator<<(std::ostream &str, const CConnection &cpc); diff --git a/server/CVCMIServer.cpp b/server/CVCMIServer.cpp index 69673f1a2..eabfee9f7 100644 --- a/server/CVCMIServer.cpp +++ b/server/CVCMIServer.cpp @@ -66,6 +66,7 @@ CPregameServer::CPregameServer(CConnection *Host, TAcceptor *Acceptor /*= NULL*/ void CPregameServer::handleConnection(CConnection *cpc) { + setThreadName("CPregameServer::handleConnection"); try { while(!cpc->receivedStop) @@ -299,6 +300,7 @@ void CPregameServer::initConnection(CConnection *c) void CPregameServer::startListeningThread(CConnection * pc) { listeningThreads++; + pc->enterPregameConnectionMode(); pc->handler = new boost::thread(&CPregameServer::handleConnection, this, pc); }