1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00
Helper functions for enabling/disabling smart vector memeber serialziation. [doesn't really save writing but adds consistency]
This commit is contained in:
Michał W. Urbańczyk 2013-07-02 16:48:01 +00:00
parent a1f545792b
commit 1e8c58ecdf
3 changed files with 16 additions and 6 deletions

View File

@ -263,8 +263,7 @@ void CConnection::prepareForSendingHeroes()
{
loadedPointers.clear();
savedPointers.clear();
CISer<CConnection>::smartVectorMembersSerialization = false;
COSer<CConnection>::smartVectorMembersSerialization = false;
disableSmartVectorMemberSerialization();
enableSmartPointerSerializatoin();
}
@ -272,11 +271,20 @@ void CConnection::enterPregameConnectionMode()
{
loadedPointers.clear();
savedPointers.clear();
CISer<CConnection>::smartVectorMembersSerialization = false;
COSer<CConnection>::smartVectorMembersSerialization = false;
disableSmartVectorMemberSerialization();
disableSmartPointerSerialization();
}
void CConnection::disableSmartVectorMemberSerialization()
{
smartVectorMembersSerialization = false;
}
void CConnection::enableSmartVectorMemberSerializatoin()
{
smartVectorMembersSerialization = true;
}
CSaveFile::CSaveFile( const std::string &fname )
{
registerTypes(*this);

View File

@ -1354,6 +1354,8 @@ public:
void enableStackSendingByID();
void disableSmartPointerSerialization();
void enableSmartPointerSerializatoin();
void disableSmartVectorMemberSerialization();
void enableSmartVectorMemberSerializatoin();
void prepareForSendingHeroes(); //disables sending vectorised, enables smart pointer serialization, clears saved/loaded ptr cache
void enterPregameConnectionMode();

View File

@ -205,10 +205,10 @@ void CPregameServer::connectionAccepted(const boost::system::error_code& ec)
initConnection(pc);
upcomingConnection = nullptr;
*pc << (ui8)pc->connectionID << curmap;
startListeningThread(pc);
*pc << (ui8)pc->connectionID << curmap;
announceTxt(pc->name + " joins the game");
auto pj = new PlayerJoined();
pj->playerName = pc->name;