1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

* battle settings will be remembered between battles

* call-ins for serializing client and playerinterfaces (not used really yet)
This commit is contained in:
Michał W. Urbańczyk
2009-03-28 18:46:20 +00:00
parent 42773e67f2
commit fca28fab10
12 changed files with 166 additions and 47 deletions

View File

@@ -342,3 +342,42 @@ void CClient::waitForServer()
shared->sr->cond.wait(slock);
}
}
template <typename Handler>
void CClient::serialize( Handler &h, const int version )
{
if(h.saving)
{
ui8 players = playerint.size();
h & players;
for(std::map<ui8,CGameInterface *>::iterator i = playerint.begin(); i != playerint.end(); i++)
{
h & i->first & i->second->dllName;
i->second->serialize(h,version);
}
}
else
{
ui8 players;
h & players;
for(int i=0; i < players; i++)
{
std::string dllname;
ui8 pid;
h & pid & dllname;
if(dllname.length())
{
CCallback *callback = new CCallback(gs,pid,this);
callbacks.insert(callback);
playerint[pid] = CAIHandler::getNewAI(callback,dllname);
playerint[pid]->init(callback);
}
}
}
}
template void CClient::serialize( CISer<CLoadFile> &h, const int version );
template void CClient::serialize( COSer<CSaveFile> &h, const int version );