1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
Michał W. Urbańczyk 2013-02-14 15:19:35 +00:00
parent 12e627ec49
commit d23a5dcfdf
4 changed files with 15 additions and 2 deletions

View File

@ -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))
{

View File

@ -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 )

View File

@ -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);

View File

@ -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);
}