mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix client build
* use regular overloaded methods for client serialization. (serialize template not needed if connection.h already included and save/load code is different)
This commit is contained in:
parent
74161198c4
commit
2b88a914ff
@ -493,11 +493,10 @@ void CClient::newGame( CConnection *con, StartInfo *si )
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Handler>
|
void CClient::serialize(COSer & h, const int version)
|
||||||
void CClient::serialize( Handler &h, const int version )
|
|
||||||
{
|
{
|
||||||
h & hotSeat;
|
assert(h.saving);
|
||||||
if(h.saving)
|
h & hotSeat;
|
||||||
{
|
{
|
||||||
ui8 players = playerint.size();
|
ui8 players = playerint.size();
|
||||||
h & players;
|
h & players;
|
||||||
@ -507,11 +506,15 @@ void CClient::serialize( Handler &h, const int version )
|
|||||||
LOG_TRACE_PARAMS(logGlobal, "Saving player %s interface", i->first);
|
LOG_TRACE_PARAMS(logGlobal, "Saving player %s interface", i->first);
|
||||||
assert(i->first == i->second->playerID);
|
assert(i->first == i->second->playerID);
|
||||||
h & i->first & i->second->dllName & i->second->human;
|
h & i->first & i->second->dllName & i->second->human;
|
||||||
i->second->saveGame(dynamic_cast<COSer & >(h), version);
|
i->second->saveGame(h, version);
|
||||||
//evil cast that i still like better than sfinae-magic. If I had a "static if"...
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
void CClient::serialize(CISer & h, const int version)
|
||||||
|
{
|
||||||
|
assert(!h.saving);
|
||||||
|
h & hotSeat;
|
||||||
{
|
{
|
||||||
ui8 players = 0; //fix for uninitialized warning
|
ui8 players = 0; //fix for uninitialized warning
|
||||||
h & players;
|
h & players;
|
||||||
@ -551,7 +554,7 @@ void CClient::serialize( Handler &h, const int version )
|
|||||||
nInt->playerID = pid;
|
nInt->playerID = pid;
|
||||||
|
|
||||||
installNewPlayerInterface(nInt, pid);
|
installNewPlayerInterface(nInt, pid);
|
||||||
nInt->loadGame(dynamic_cast<CISer & >(h), version); //another evil cast, check above
|
nInt->loadGame(h, version); //another evil cast, check above
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!vstd::contains(battleints, PlayerColor::NEUTRAL))
|
if(!vstd::contains(battleints, PlayerColor::NEUTRAL))
|
||||||
@ -559,11 +562,10 @@ void CClient::serialize( Handler &h, const int version )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Handler>
|
void CClient::serialize(COSer & h, const int version, const std::set<PlayerColor> & playerIDs)
|
||||||
void CClient::serialize( Handler &h, const int version, const std::set<PlayerColor>& playerIDs)
|
|
||||||
{
|
{
|
||||||
|
assert(h.saving);
|
||||||
h & hotSeat;
|
h & hotSeat;
|
||||||
if(h.saving)
|
|
||||||
{
|
{
|
||||||
ui8 players = playerint.size();
|
ui8 players = playerint.size();
|
||||||
h & players;
|
h & players;
|
||||||
@ -573,11 +575,15 @@ void CClient::serialize( Handler &h, const int version, const std::set<PlayerCol
|
|||||||
LOG_TRACE_PARAMS(logGlobal, "Saving player %s interface", i->first);
|
LOG_TRACE_PARAMS(logGlobal, "Saving player %s interface", i->first);
|
||||||
assert(i->first == i->second->playerID);
|
assert(i->first == i->second->playerID);
|
||||||
h & i->first & i->second->dllName & i->second->human;
|
h & i->first & i->second->dllName & i->second->human;
|
||||||
i->second->saveGame(dynamic_cast<COSer & >(h), version);
|
i->second->saveGame(h, version);
|
||||||
//evil cast that i still like better than sfinae-magic. If I had a "static if"...
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
void CClient::serialize(CISer & h, const int version, const std::set<PlayerColor> & playerIDs)
|
||||||
|
{
|
||||||
|
assert(!h.saving);
|
||||||
|
h & hotSeat;
|
||||||
{
|
{
|
||||||
ui8 players = 0; //fix for uninitialized warning
|
ui8 players = 0; //fix for uninitialized warning
|
||||||
h & players;
|
h & players;
|
||||||
@ -620,7 +626,7 @@ void CClient::serialize( Handler &h, const int version, const std::set<PlayerCol
|
|||||||
if(playerIDs.count(pid))
|
if(playerIDs.count(pid))
|
||||||
installNewPlayerInterface(nInt, pid);
|
installNewPlayerInterface(nInt, pid);
|
||||||
|
|
||||||
nInt->loadGame(dynamic_cast<CISer & >(h), version); //another evil cast, check above
|
nInt->loadGame(h, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(playerIDs.count(PlayerColor::NEUTRAL))
|
if(playerIDs.count(PlayerColor::NEUTRAL))
|
||||||
@ -901,8 +907,6 @@ std::string CClient::aiNameForPlayer(const PlayerSettings &ps, bool battleAI)
|
|||||||
return goodAI;
|
return goodAI;
|
||||||
}
|
}
|
||||||
|
|
||||||
template void CClient::serialize(CISer & h, const int version);
|
|
||||||
template void CClient::serialize(COSer & h, const int version);
|
|
||||||
|
|
||||||
void CServerHandler::startServer()
|
void CServerHandler::startServer()
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,8 @@ struct SharedMem;
|
|||||||
class CClient;
|
class CClient;
|
||||||
class CScriptingModule;
|
class CScriptingModule;
|
||||||
struct CPathsInfo;
|
struct CPathsInfo;
|
||||||
|
class CISer;
|
||||||
|
class COSer;
|
||||||
namespace boost { class thread; }
|
namespace boost { class thread; }
|
||||||
|
|
||||||
/// structure to handle running server and connecting to it
|
/// structure to handle running server and connecting to it
|
||||||
@ -236,7 +238,10 @@ public:
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version);
|
void serialize(COSer &h, const int version);
|
||||||
template <typename Handler> void serialize(Handler &h, const int version, const std::set<PlayerColor>& playerIDs);
|
void serialize(CISer &h, const int version);
|
||||||
|
|
||||||
|
void serialize(COSer &h, const int version, const std::set<PlayerColor>& playerIDs);
|
||||||
|
void serialize(CISer &h, const int version, const std::set<PlayerColor>& playerIDs);
|
||||||
void battleFinished();
|
void battleFinished();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user