Michał W. Urbańczyk %!s(int64=12) %!d(string=hai) anos
pai
achega
d23a5dcfdf
Modificáronse 4 ficheiros con 15 adicións e 2 borrados
  1. 2 0
      client/CPreGame.cpp
  2. 10 2
      lib/Connection.cpp
  3. 1 0
      lib/Connection.h
  4. 2 0
      server/CVCMIServer.cpp

+ 2 - 0
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<QuitMenuWithoutStarting *>(pack))
 			{

+ 10 - 2
lib/Connection.cpp

@@ -279,8 +279,16 @@ void CConnection::prepareForSendingHeroes()
 	savedPointers.clear();
 	CISer<CConnection>::smartVectorMembersSerialization = false;
 	COSer<CConnection>::smartVectorMembersSerialization = false;
-	CISer<CConnection>::smartPointerSerialization = true;
-	COSer<CConnection>::smartPointerSerialization = true;
+	enableSmartPointerSerializatoin();
+}
+
+void CConnection::enterPregameConnectionMode()
+{
+	loadedPointers.clear();
+	savedPointers.clear();
+	CISer<CConnection>::smartVectorMembersSerialization = false;
+	COSer<CConnection>::smartVectorMembersSerialization = false;
+	disableSmartPointerSerialization();
 }
 
 CSaveFile::CSaveFile( const std::string &fname )

+ 1 - 0
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);

+ 2 - 0
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);
 }