OpenClonk
DisconnectData Class Reference

Public Member Functions

 DisconnectData (C4LeagueFBIDList &rFBIDList, const C4ClientPlayerInfos &rPlayerInfos)
 
void CompileFunc (StdCompiler *pComp)
 

Detailed Description

Definition at line 251 of file C4League.cpp.

Constructor & Destructor Documentation

◆ DisconnectData()

DisconnectData::DisconnectData ( C4LeagueFBIDList rFBIDList,
const C4ClientPlayerInfos rPlayerInfos 
)
inline

Definition at line 258 of file C4League.cpp.

259  : rFBIDList(rFBIDList), rPlayerInfos(rPlayerInfos) {}

Member Function Documentation

◆ CompileFunc()

void DisconnectData::CompileFunc ( StdCompiler pComp)
inline

Definition at line 261 of file C4League.cpp.

262  {
263  if (pComp->isDeserializer())
264  {
265  // compiling not yet needed
266  assert(!"DisconnectData::CompileFunc not defined for compiler!");
267  }
268  else
269  {
270  // decompiling: Compile all joined and not removed player infos.
271  // Compile them even if they're not in the FBID-List, but omit
272  // the FBID (used for host message)
273  int32_t i=0; C4PlayerInfo *pInfo;
274  while ((pInfo = rPlayerInfos.GetPlayerInfo(i++)))
275  if (pInfo->IsJoined() && !pInfo->IsRemoved())
276  {
277  pComp->Name("Player");
278  try
279  {
280  pComp->Value(mkNamingAdapt(mkDecompileAdapt(pInfo->GetID()), "ID"));
281  StdCopyStrBuf sFBID;
282  if (rFBIDList.FindFBIDByAccount(pInfo->getLeagueAccount(), &sFBID)) pComp->Value(mkNamingAdapt(mkParAdapt(sFBID, StdCompiler::RCT_IdtfAllowEmpty), "FBID"));
283  }
284  catch (StdCompiler::Exception *)
285  {
286  pComp->NameEnd();
287  throw;
288  }
289  pComp->NameEnd();
290  }
291  }
292  }
StdDecompileAdapt< T > mkDecompileAdapt(const T &rValue)
Definition: StdAdaptors.h:153
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:490
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
C4PlayerInfo * GetPlayerInfo(int32_t iIndex) const
bool FindFBIDByAccount(const char *szAccount, StdStrBuf *pFBIDOut)
Definition: C4League.cpp:207
bool IsRemoved() const
Definition: C4PlayerInfo.h:164
const char * getLeagueAccount() const
Definition: C4PlayerInfo.h:184
int32_t GetID() const
Definition: C4PlayerInfo.h:194
bool IsJoined() const
Definition: C4PlayerInfo.h:166
void Value(const T &rStruct)
Definition: StdCompiler.h:161
virtual void NameEnd(bool fBreak=false)
Definition: StdCompiler.h:78
virtual bool isDeserializer()
Definition: StdCompiler.h:53
@ RCT_IdtfAllowEmpty
Definition: StdCompiler.h:140
virtual bool Name(const char *szName)
Definition: StdCompiler.h:77

References C4LeagueFBIDList::FindFBIDByAccount(), C4PlayerInfo::GetID(), C4PlayerInfo::getLeagueAccount(), C4ClientPlayerInfos::GetPlayerInfo(), StdCompiler::isDeserializer(), C4PlayerInfo::IsJoined(), C4PlayerInfo::IsRemoved(), mkDecompileAdapt(), mkNamingAdapt(), mkParAdapt(), StdCompiler::Name(), StdCompiler::NameEnd(), StdCompiler::RCT_IdtfAllowEmpty, and StdCompiler::Value().

Here is the call graph for this function:

The documentation for this class was generated from the following file: