1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Crashes on starting next campaign mission should be fixed.

This commit is contained in:
Michał W. Urbańczyk 2012-09-25 18:00:55 +00:00
parent f3f4a7633d
commit ecd8947d8e
6 changed files with 39 additions and 6 deletions

View File

@ -1380,7 +1380,8 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
if (guardingCreature)
{
CCS->curh->changeGraphic(0, 5 + turns*6);
} else
}
else
{
if(pnode->land)
{

View File

@ -334,6 +334,8 @@ void CClient::newGame( CConnection *con, StartInfo *si )
c >> si;
tlog0 <<"\tSending/Getting info to/from the server: "<<tmh.getDiff()<<std::endl;
c.enableStackSendingByID();
c.disableSmartPointerSerialization();
gs = const_cast<CGameInfo*>(CGI)->state;
gs->scenarioOps = si;

View File

@ -55,10 +55,8 @@ CTypeList typeList;
void CConnection::init()
{
CISer<CConnection>::smartPointerSerialization = false;
COSer<CConnection>::smartPointerSerialization = false;
CISer<CConnection>::sendStackInstanceByIds = true;
COSer<CConnection>::sendStackInstanceByIds = true;
enableSmartPointerSerializatoin();
disableStackSendingByID();
registerTypes(static_cast<CISer<CConnection>&>(*this));
registerTypes(static_cast<COSer<CConnection>&>(*this));
#ifdef LIL_ENDIAN
@ -250,6 +248,30 @@ void CConnection::sendPackToServer(const CPack &pack, ui8 player, ui32 requestID
*this << player << requestID << &pack; //packs has to be sent as polymorphic pointers!
}
void CConnection::disableStackSendingByID()
{
CISer<CConnection>::sendStackInstanceByIds = false;
COSer<CConnection>::sendStackInstanceByIds = false;
}
void CConnection::enableStackSendingByID()
{
CISer<CConnection>::sendStackInstanceByIds = true;
COSer<CConnection>::sendStackInstanceByIds = true;
}
void CConnection::disableSmartPointerSerialization()
{
CISer<CConnection>::smartPointerSerialization = false;
COSer<CConnection>::smartPointerSerialization = false;
}
void CConnection::enableSmartPointerSerializatoin()
{
CISer<CConnection>::smartPointerSerialization = true;
COSer<CConnection>::smartPointerSerialization = true;
}
CSaveFile::CSaveFile( const std::string &fname )
{
registerTypes(*this);

View File

@ -1087,6 +1087,11 @@ public:
CPack *retreivePack(); //gets from server next pack (allocates it with new)
void sendPackToServer(const CPack &pack, ui8 player, ui32 requestID);
void disableStackSendingByID();
void enableStackSendingByID();
void disableSmartPointerSerialization();
void enableSmartPointerSerializatoin();
};
DLL_LINKAGE std::ostream &operator<<(std::ostream &str, const CConnection &cpc);

View File

@ -1480,6 +1480,10 @@ void CGameHandler::run(bool resume)
}
}
tlog0 << std::endl;
cc->addStdVecItems(gs);
cc->enableStackSendingByID();
cc->disableSmartPointerSerialization();
}
for(std::set<CConnection*>::iterator i = conns.begin(); i!=conns.end();i++)

View File

@ -328,7 +328,6 @@ CGameHandler * CVCMIServer::initGhFromHostingConnection(CConnection &c)
}
gh->init(&si);
c.addStdVecItems(gh->gs);
gh->conns.insert(&c);
return gh;