mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Patch from O01eg fixing #1308 http://forum.vcmi.eu/viewtopic.php?t=721
Helper functions for enabling/disabling smart vector memeber serialziation. [doesn't really save writing but adds consistency]
This commit is contained in:
		| @@ -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); | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user