OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4GameParameters.cpp
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
5  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
6  *
7  * Distributed under the terms of the ISC license; see accompanying file
8  * "COPYING" for details.
9  *
10  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11  * See accompanying file "TRADEMARK" for details.
12  *
13  * To redistribute this file separately, substitute the full license texts
14  * for the above references.
15  */
16 #include "C4Include.h"
18 
19 #include "lib/C4Log.h"
20 #include "c4group/C4Components.h"
21 #include "object/C4Def.h"
22 #include "object/C4DefList.h"
23 #include "game/C4Game.h"
24 #include "game/C4Application.h"
25 #include "network/C4Network2.h"
26 
27 // *** C4GameRes
28 
29 
31  : eType(NRT_Null), pResCore(nullptr), pNetRes(nullptr)
32 {
33 
34 }
35 
37  : eType(Res.getType()), File(Res.getFile()), pResCore(Res.getResCore()), pNetRes(Res.getNetRes())
38 {
39  if (pResCore && !pNetRes)
40  pResCore = new C4Network2ResCore(*pResCore);
41 }
42 
43 
45 {
46  Clear();
47 }
48 
50 {
51  Clear();
52  eType = Res.getType();
53  File = Res.getFile();
54  pResCore = Res.getResCore();
55  pNetRes = Res.getNetRes();
56  if (pResCore && !pNetRes)
57  pResCore = new C4Network2ResCore(*pResCore);
58  return *this;
59 }
60 
62 {
63  eType = NRT_Null;
64  File.Clear();
65  if (pResCore && !pNetRes)
66  delete pResCore;
67  pResCore = nullptr;
68  pNetRes = nullptr;
69 }
70 
71 void C4GameRes::SetFile(C4Network2ResType enType, const char *sznFile)
72 {
73  assert(!pNetRes && !pResCore);
74  eType = enType;
75  File = sznFile;
76 }
77 
79 {
80  assert(!pNetRes);
81  pResCore = pnResCore;
82  eType = pResCore->getType();
83 }
84 
86 {
87  Clear();
88  pNetRes = pnNetRes;
89  eType = pNetRes->getType();
90  File = pNetRes->getFile();
91  pResCore = &pNetRes->getCore();
92 }
93 
95 {
96  bool deserializing = pComp->isDeserializer();
97  // Clear previous data for compiling
98  if (deserializing) Clear();
99  // Core is needed to decompile something meaningful
100  if (!deserializing) assert(pResCore);
101  // De-/Compile core
102  pComp->Value(mkPtrAdaptNoNull(const_cast<C4Network2ResCore * &>(pResCore)));
103  // Compile: Set type accordingly
104  if (deserializing)
105  eType = pResCore->getType();
106 }
107 
109 {
110  assert(isPresent());
111  // Already present?
112  if (pNetRes) return true;
113  // determine whether it's loadable
114  bool fAllowUnloadable = false;
115  if (eType == NRT_Definitions) fAllowUnloadable = true;
116  // Add to network resource list
117  C4Network2Res::Ref pNetRes = pNetResList->AddByFile(File.getData(), false, eType, -1, nullptr, fAllowUnloadable);
118  if (!pNetRes) return false;
119  // Set resource
120  SetNetRes(pNetRes);
121  return true;
122 }
123 
125 {
126  assert(pResCore);
127  // Already present?
128  if (pNetRes) return true;
129  // Add to network resource list
130  C4Network2Res::Ref pNetRes = pNetResList->AddByCore(*pResCore);
131  if (!pNetRes) return false;
132  // Set resource
133  SetNetRes(pNetRes);
134  return true;
135 }
136 
138 {
139  // Already initialized?
140  if (getNetRes())
141  return true;
142  // Present? [Host]
143  if (isPresent())
144  {
145  // Publish on network
146  if (!Publish(pNetResList))
147  {
148  LogFatal(FormatString(LoadResStr("IDS_NET_NOFILEPUBLISH"), getFile()).getData());
149  return false;
150  }
151  }
152  // Got a core? [Client]
153  else if (pResCore)
154  {
155  // Search/Load it
156  if (!Load(pNetResList))
157  {
158  // Give some hints to why this might happen.
159  const char *szFilename = pResCore->getFileName();
160  if (!pResCore->isLoadable())
161  if (pResCore->getType() == NRT_System)
162  LogFatal(FormatString(LoadResStr("IDS_NET_NOSAMESYSTEM"), szFilename).getData());
163  else
164  LogFatal(FormatString(LoadResStr("IDS_NET_NOSAMEANDTOOLARGE"), szFilename).getData());
165  // Should not happen
166  else
167  LogFatal(FormatString(LoadResStr("IDS_NET_NOVALIDCORE"), szFilename).getData());
168  return false;
169  }
170  }
171  // Okay
172  return true;
173 }
174 
176 {
177  if (!pNetRes) return;
178  pNetRes->CalculateSHA();
179 }
180 
181 // *** C4GameResList
182 
184 {
185  Clear();
186  // Copy the list
187  iResCount = iResCapacity = List.iResCount;
188  pResList = new C4GameRes *[iResCapacity];
189  for (int i = 0; i < iResCount; i++)
190  pResList[i] = new C4GameRes(*List.pResList[i]);
191  return *this;
192 }
193 
195 {
196  for (int i = 0; i < iResCount; i++)
197  if (!pLast)
198  {
199  if (eType == NRT_Null || pResList[i]->getType() == eType)
200  return pResList[i];
201  }
202  else if (pLast == pResList[i])
203  pLast = nullptr;
204  return nullptr;
205 }
206 
208 {
209  // clear them
210  for (int32_t i = 0; i < iResCount; i++)
211  delete pResList[i];
212  delete [] pResList;
213  pResList = nullptr;
214  iResCount = iResCapacity = 0;
215 }
216 
218 {
219  // Scan path for folder names
220  int32_t iBackslash;
221  char szFoldername[_MAX_PATH+1];
222  C4Group hGroup;
223 #ifdef _WIN32
224  // Allow both backward and forward slashes when searching because the path
225  // may be given with forward slashes. We would skip loading some definitions
226  // if we didn't handle this properly and the user would have no clue what was
227  // going on. See also http://forum.openclonk.org/topic_show.pl?tid=905.
228  char control[3] = { DirectorySeparator, AltDirectorySeparator, '\0' };
229  const int32_t len = (int32_t)strlen(szPath);
230  for (int32_t iPrev=0; (iBackslash = strcspn(szPath+iPrev, control) + iPrev) < len; iPrev = iBackslash + 1)
231 #else
232  for (int32_t cnt=0; (iBackslash=SCharPos(DirectorySeparator,szPath,cnt)) > -1; cnt++)
233 #endif
234  {
235  // Get folder name
236  SCopy(szPath,szFoldername,iBackslash);
237  // Open folder
238  if (SEqualNoCase(GetExtension(szFoldername),"ocf"))
239  if (hGroup.Open(szFoldername))
240  {
241  // Check for contained defs
242  // do not, however, add them to the group set:
243  // parent folders are added by OpenScenario already!
244  int32_t iContents;
245  if ((iContents = Game.GroupSet.CheckGroupContents(hGroup, C4GSCnt_Definitions)))
246  {
247  // Add folder to list
248  CreateByFile(NRT_Definitions, szFoldername);
249  }
250  // Close folder
251  hGroup.Close();
252  }
253  }
254 }
255 
256 bool C4GameResList::Load(C4Group &hGroup, C4Scenario *pScenario, const char * szDefinitionFilenames)
257 {
258  // clear any prev
259  Clear();
260  // no defs to be added? that's OK (LocalOnly)
261  if (szDefinitionFilenames && *szDefinitionFilenames)
262  {
263  // add them
264  char szSegment[_MAX_PATH+1];
265  for (int32_t cseg=0; SCopySegment(szDefinitionFilenames,cseg,szSegment,';',_MAX_PATH); ++cseg)
266  if (*szSegment)
267  CreateByFile(NRT_Definitions, szSegment);
268  }
269 
270  LoadFoldersWithLocalDefs(pScenario->Head.Origin ? pScenario->Head.Origin.getData() : hGroup.GetFullName().getData());
271 
272  // add System.ocg
274  // add all instances of Material.ocg, except those inside the scenario file
275  C4Group *pMatParentGrp = nullptr;
276  while ((pMatParentGrp = Game.GroupSet.FindGroup(C4GSCnt_Material, pMatParentGrp)))
277  if (pMatParentGrp != &Game.ScenarioFile)
278  {
279  StdStrBuf MaterialPath = pMatParentGrp->GetFullName() + DirSep C4CFN_Material;
280  CreateByFile(NRT_Material, (pMatParentGrp->GetFullName() + DirSep C4CFN_Material).getData());
281  }
282  // add global Material.ocg
284  // done; success
285  return true;
286 }
287 
289 {
290  // Create & set
291  C4GameRes *pRes = new C4GameRes();
292  pRes->SetFile(eType, szFile);
293  // Add to list
294  Add(pRes);
295  return pRes;
296 }
297 
299 {
300  // Create & set
301  C4GameRes *pRes = new C4GameRes();
302  pRes->SetNetRes(pNetRes);
303  // Add to list
304  Add(pRes);
305  return pRes;
306 }
307 
309 {
310  // Check all resources without attached network resource object
311  for (int i = 0; i < iResCount; i++)
312  if (!pResList[i]->InitNetwork(pNetResList))
313  return false;
314  // Success
315  return true;
316 }
317 
319 {
320  for (int32_t i = 0; i < iResCount; i++)
321  pResList[i]->CalcHash();
322 }
323 
325 {
326  // wait for all resources
327  for (int32_t i = 0; i < iResCount; i++)
328  {
329  const C4Network2ResCore &Core = *pResList[i]->getResCore();
330  StdStrBuf ResNameBuf = FormatString("%s: %s", LoadResStr("IDS_DLG_DEFINITION"), GetFilename(Core.getFileName()));
331  if (!::Network.RetrieveRes(Core, C4NetResRetrieveTimeout, ResNameBuf.getData()))
332  return false;
333  }
334  return true;
335 }
336 
338 {
339  // Enlarge
340  if (iResCount >= iResCapacity)
341  {
342  iResCapacity += 10;
343  C4GameRes **pnResList = new C4GameRes *[iResCapacity];
344  for (int i = 0; i < iResCount; i++)
345  pnResList[i] = pResList[i];
346  pResList = pnResList;
347  }
348  // Add
349  pResList[iResCount++] = pRes;
350 }
351 
353 {
354  bool deserializing = pComp->isDeserializer();
355  // Clear previous data
356  if (deserializing) Clear();
357  // Compile resource count
358  pComp->Value(mkNamingCountAdapt(iResCount, "Resource"));
359  // Create list
360  if (deserializing)
361  {
362  pResList = new C4GameRes *[iResCapacity = iResCount];
363  ZeroMem(pResList, sizeof(*pResList) * iResCount);
364  }
365  // Compile list
366  pComp->Value(
368  mkArrayAdaptMap(pResList, iResCount, mkPtrAdaptNoNull<C4GameRes>),
369  "Resource"));
370  mkPtrAdaptNoNull<C4GameRes>(*pResList);
371 }
372 
373 
374 
375 // *** C4GameParameters
376 
378 {
379 
380 }
381 
383 {
384 
385 }
386 
388 {
389  League.Clear();
391  Rules.Clear();
392  Goals.Clear();
393  Scenario.Clear();
394  GameRes.Clear();
395  Clients.Clear();
396  PlayerInfos.Clear();
398  Teams.Clear();
400 }
401 
402 bool C4GameParameters::Load(C4Group &hGroup, C4Scenario *pScenario, const char *szGameText, C4LangStringTable *pLang, const char *DefinitionFilenames, C4ScenarioParameters *pStartupScenarioParameters)
403 {
404  // Clear previous data
405  Clear();
406 
407  // Scenario
409 
410  // Additional game resources
411  if (!GameRes.Load(hGroup, pScenario, DefinitionFilenames))
412  return false;
413 
414  // Player infos (replays only)
415  if (pScenario->Head.Replay)
416  if (hGroup.FindEntry(C4CFN_PlayerInfos))
418 
419  // Savegame restore infos: Used for savegames to rejoin joined players
420  if (hGroup.FindEntry(C4CFN_SavePlayerInfos))
421  {
422  // load to savegame info list
424  // transfer counter to allow for additional player joins in savegame resumes
426  // in network mode, savegame players may be reassigned in the lobby
427  // in any mode, the final player restoration will be done in InitPlayers()
428  // dropping any players that could not be restored
429  }
430 
431  // Load teams
432  if (!Teams.Load(hGroup, pScenario, pLang))
433  { LogFatal(LoadResStr("IDS_PRC_ERRORLOADINGTEAMS")); return false; }
434 
435  // Compile data
436  StdStrBuf Buf;
437  if (hGroup.LoadEntryString(C4CFN_Parameters, &Buf))
438  {
439  if (!CompileFromBuf_LogWarn<StdCompilerINIRead>(
440  mkNamingAdapt(mkParAdapt(*this, pScenario), "Parameters"),
441  Buf,
443  return false;
444  }
445  else
446  {
447 
448  // Set default values
449  StdCompilerNull DefaultCompiler;
450  DefaultCompiler.Compile(mkParAdapt(*this, pScenario));
451 
452  // Set control rate default
453  if (ControlRate < 0)
455 
456  // network game?
458 
459  // Auto frame skip by options
461 
462  // custom parameters from startup
463  if (pStartupScenarioParameters) ScenarioParameters = *pStartupScenarioParameters;
464  }
465 
466 
467  // enforce league settings
468  if (isLeague()) EnforceLeagueRules(pScenario);
469 
470  // Done
471  return true;
472 }
473 
475 {
476  Scenario.CalcHash();
479  AllowDebug = false;
480  if (pScenario) MaxPlayers = pScenario->Head.MaxPlayerLeague;
481  // forced league values in custom scenario parameters
482  size_t idx=0; const C4ScenarioParameterDef *pdef; int32_t val;
483  while ((pdef = ::Game.ScenarioParameterDefs.GetParameterDefByIndex(idx++)))
484  if ((val = pdef->GetLeagueValue()))
485  ScenarioParameters.SetValue(pdef->GetID(), val, false);
486 }
487 
488 bool C4GameParameters::Save(C4Group &hGroup, C4Scenario *pScenario)
489 {
490 
491  // Write Parameters.txt
492  StdStrBuf ParData = DecompileToBuf<StdCompilerINIWrite>(
493  mkNamingAdapt(mkParAdapt(*this, pScenario), "Parameters"));
494  if (!hGroup.Add(C4CFN_Parameters, ParData, false, true))
495  return false;
496 
497  // Done
498  return true;
499 }
500 
502 {
503 
504  // Scenario & material resource
505  if (!Scenario.InitNetwork(pResList))
506  return false;
507 
508  // Other game resources
509  if (!GameRes.InitNetwork(pResList))
510  return false;
511 
512  // Done
513  return true;
514 }
515 
517 {
518  pComp->Value(mkNamingAdapt(MaxPlayers, "MaxPlayers", !pScenario ? 0 : pScenario->Head.MaxPlayer));
519  pComp->Value(mkNamingAdapt(AllowDebug, "AllowDebug", true));
520  pComp->Value(mkNamingAdapt(IsNetworkGame, "IsNetworkGame", false));
521  pComp->Value(mkNamingAdapt(IsEditor, "IsEditor", !!::Application.isEditor));
522  pComp->Value(mkNamingAdapt(ControlRate, "ControlRate", -1));
523  pComp->Value(mkNamingAdapt(AutoFrameSkip, "AutoFrameSkip", false));
524  pComp->Value(mkNamingAdapt(Rules, "Rules", !pScenario ? C4IDList() : pScenario->Game.Rules));
525  pComp->Value(mkNamingAdapt(Goals, "Goals", !pScenario ? C4IDList() : pScenario->Game.Goals));
526  pComp->Value(mkNamingAdapt(League, "League", StdStrBuf()));
527 
528  // These values are either stored separately (see Load/Save) or
529  // don't make sense for savegames.
530  if (!pScenario)
531  {
532  pComp->Value(mkNamingAdapt(LeagueAddress, "LeagueAddress", ""));
533 
534  pComp->Value(mkNamingAdapt(Scenario, "Scenario" ));
535  pComp->Value(GameRes);
536 
537  pComp->Value(mkNamingAdapt(PlayerInfos, "PlayerInfos" ));
538  pComp->Value(mkNamingAdapt(RestorePlayerInfos,"RestorePlayerInfos"));
539  pComp->Value(mkNamingAdapt(Teams, "Teams" ));
540  }
541 
542  pComp->Value(Clients);
543 
544  pComp->Value(mkNamingAdapt(ScenarioParameters, "ScenarioParameters"));
545 
546 }
547 
549 {
550  // getting game goals from the ID list
551  // unfortunately, names cannot be deduced before object definitions are loaded
552  StdStrBuf sResult;
553  C4ID idGoal;
554  for (int32_t i=0; i<Goals.GetNumberOfIDs(); ++i)
555  if ((idGoal = Goals.GetID(i))) if (idGoal != C4ID::None)
556  {
557  if (Game.IsRunning)
558  {
559  C4Def *pDef = C4Id2Def(idGoal);
560  if (pDef)
561  {
562  if (sResult.getLength()) sResult.Append(", ");
563  sResult.Append(pDef->GetName());
564  }
565  }
566  else
567  {
568  if (sResult.getLength()) sResult.Append(", ");
569  sResult.Append(idGoal.ToString());
570  }
571  }
572  // Max length safety
573  if (sResult.getLength() > C4MaxTitle) sResult.SetLength(C4MaxTitle);
574  // Compose desc string
575  if (sResult.getLength())
576  return FormatString("%s: %s", LoadResStr("IDS_MENU_CPGOALS"), sResult.getData());
577  else
578  return StdCopyStrBuf(LoadResStr("IDS_CTL_NOGOAL"), true);
579 }
C4Network2ResType
Definition: C4Network2Res.h:40
char * GetFilename(char *szPath)
Definition: StdFile.cpp:55
const char * getData() const
Definition: StdBuf.h:450
bool FindEntry(const char *szWildCard, StdStrBuf *sFileName=nullptr, size_t *iSize=nullptr)
Definition: C4Group.cpp:1774
bool InitNetwork(C4Network2ResList *pNetResList)
StdCopyStrBuf Origin
Definition: C4Scenario.h:80
bool IsRunning
Definition: C4Game.h:141
void CompileFunc(StdCompiler *pComp, C4Scenario *pScenario=nullptr)
const C4ScenarioParameterDef * GetParameterDefByIndex(size_t idx) const
void Clear()
Definition: stub-handle.cpp:64
C4Config Config
Definition: C4Config.cpp:837
C4Network2Res::Ref AddByCore(const C4Network2ResCore &Core, bool fLoad=true)
void CompileFunc(StdCompiler *pComp)
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:122
const size_t C4MaxTitle
Definition: C4Constants.h:25
virtual const char * GetName() const
Definition: C4PropList.cpp:267
StdNamingCountAdapt< int_t > mkNamingCountAdapt(int_t &iCount, const char *szName)
Definition: StdAdaptors.h:974
void SetIDCounter(int32_t idNewCounter)
Definition: C4PlayerInfo.h:397
bool Load(C4Group &hGroup, C4Scenario *pScenario, const char *szDefinitionFilenames)
C4Game Game
Definition: C4Globals.cpp:52
C4GameRes * iterRes(C4GameRes *pLast, C4Network2ResType eType=NRT_Null)
C4IDList Goals
Definition: C4Scenario.h:122
C4GroupSet GroupSet
Definition: C4Game.h:89
void Clear()
Definition: StdBuf.h:474
#define C4CFN_Material
Definition: C4Components.h:25
C4GameRes & operator=(const C4GameRes &Res)
bool SCopySegment(const char *szString, int iSegment, char *sTarget, char cSeparator, int iMaxL, bool fSkipWhitespace)
Definition: Standard.cpp:243
void EnforceLeagueRules(class C4Scenario *pScenario)
bool isLoadable() const
Definition: C4Network2Res.h:88
bool Load(C4Group &hGroup, C4Scenario *pDefault, const char *szGameText, C4LangStringTable *pLang, const char *DefinitionFilenames, C4ScenarioParameters *pStartupScenarioParameters)
bool Replay
Definition: C4Scenario.h:72
C4IDList Rules
Definition: C4Scenario.h:123
#define C4GSCnt_Material
Definition: C4GroupSet.h:36
C4Network2ResType getType() const
StdCopyStrBuf League
bool SEqualNoCase(const char *szStr1, const char *szStr2, int iLen)
Definition: Standard.cpp:177
bool InitNetwork(C4Network2ResList *pResList)
#define C4GSCnt_Definitions
Definition: C4GroupSet.h:38
int32_t ControlRate
Definition: C4Config.h:140
#define _MAX_PATH
C4ClientList Clients
class C4ScenarioParameterDefs & ScenarioParameterDefs
Definition: C4Game.h:77
const char * getFileName() const
Definition: C4Network2Res.h:94
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
const C4Network2ResCore * getResCore() const
void Compile(T &&rStruct)
Definition: StdCompiler.h:183
#define AltDirectorySeparator
bool Load(C4Group &hGroup, class C4Scenario *pInitDefault, class C4LangStringTable *pLang)
Definition: C4Teams.cpp:605
C4ConfigGraphics Graphics
Definition: C4Config.h:254
bool Publish(C4Network2ResList *pResList)
const char * getFile() const
void SetResCore(C4Network2ResCore *pResCore)
C4Network2 Network
Definition: C4Globals.cpp:53
const C4Network2ResCore & getCore() const
C4GameRes * CreateByFile(C4Network2ResType eType, const char *szFile)
bool InitNetwork(C4Network2ResList *pResList)
C4ScenarioParameters ScenarioParameters
StdStrBuf GetGameGoalString() const
C4Network2Res::Ref RetrieveRes(const C4Network2ResCore &Core, int32_t iTimeout, const char *szResName, bool fWaitForCore=false)
StdStrBuf GetFullName() const
Definition: C4Group.cpp:2078
#define C4CFN_SavePlayerInfos
Definition: C4Components.h:125
bool Open(const char *szGroupName, bool fCreate=false)
Definition: C4Group.cpp:514
static const C4ID None
Definition: C4Id.h:42
int32_t MaxPlayer
Definition: C4Scenario.h:70
C4GameResList GameRes
C4Group ScenarioFile
Definition: C4Game.h:88
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527
StdPtrAdapt< T > mkPtrAdaptNoNull(T *&rpObj)
Definition: StdAdaptors.h:604
C4ConfigNetwork Network
Definition: C4Config.h:256
Definition: C4Def.h:100
#define C4CFN_Parameters
Definition: C4Components.h:128
bool Close()
Definition: C4Group.cpp:755
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:230
C4Network2Res::Ref AddByFile(const char *strFilePath, bool fTemp, C4Network2ResType eType, int32_t iResID=-1, const char *szResName=nullptr, bool fAllowUnloadable=false)
void Clear()
Definition: C4Client.cpp:187
char * GetExtension(char *szFilename)
Definition: StdFile.cpp:131
bool NetworkActive
Definition: C4Game.h:124
void Value(const T &rStruct)
Definition: StdCompiler.h:171
const char * GetID() const
Definition: C4Id.h:28
bool Save(C4Group &hGroup, C4Scenario *pDefault)
int32_t GetLeagueValue() const
C4PlayerInfoList RestorePlayerInfos
C4GameResList & operator=(const C4GameResList &List)
virtual bool isDeserializer()
Definition: StdCompiler.h:63
#define C4CFN_PlayerInfos
Definition: C4Components.h:124
bool Load(C4Group &hGroup, const char *szFromFile, class C4LangStringTable *pLang=nullptr)
const int C4NetResRetrieveTimeout
Definition: C4Network2.h:37
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:80
C4Network2ResType getType() const
Definition: C4Network2Res.h:84
bool LoadEntryString(const char *szEntryName, StdStrBuf *Buf)
Definition: C4Group.cpp:1932
void Clear()
Definition: C4Teams.cpp:256
const char * ToString() const
Definition: C4Id.h:62
C4PlayerInfoList PlayerInfos
void CompileFunc(StdCompiler *pComp)
const char * getFile() const
void SetNetRes(C4Network2Res::Ref pRes)
C4SGame Game
Definition: C4Scenario.h:232
bool isLeague() const
C4Network2Res::Ref getNetRes() const
C4Network2ResType getType() const
bool Add(const char *szFile, const char *szAddAs)
Definition: C4Group.cpp:1316
C4Group * FindGroup(int32_t Contents, C4Group *pAfter=nullptr, bool fSamePrio=false)
Definition: C4GroupSet.cpp:157
int32_t GetIDCounter()
Definition: C4PlayerInfo.h:398
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:456
size_t getLength() const
Definition: StdBuf.h:453
static int32_t CheckGroupContents(C4Group &rGroup, int32_t Contents)
Definition: C4GroupSet.cpp:108
void SetLength(size_t iLength)
Definition: StdBuf.h:517
int SCharPos(char cTarget, const char *szInStr, int iIndex)
Definition: Standard.cpp:203
std::enable_if< std::is_pod< T >::value >::type ZeroMem(T *lpMem, size_t dwSize)
Definition: Standard.h:63
C4SHead Head
Definition: C4Scenario.h:230
void LoadFoldersWithLocalDefs(const char *szPath)
bool Load(C4Network2ResList *pResList)
#define C4CFN_System
Definition: C4Components.h:29
#define DirSep
void Add(C4GameRes *pRes)
bool isPresent() const
StdCopyStrBuf LeagueAddress
C4ID GetID(size_t index, int32_t *ipCount=nullptr) const
Definition: C4IDList.cpp:99
C4GameRes * CreateByNetRes(C4Network2Res::Ref pNetRes)
StdArrayAdapt< T, M > mkArrayAdaptMap(T *pArray, int iSize, M &&map)
Definition: StdAdaptors.h:311
int32_t AutoFrameSkip
Definition: C4Config.h:117
#define DirectorySeparator
int32_t GetNumberOfIDs() const
Definition: C4IDList.cpp:197
void EnforceLeagueRules()
Definition: C4Teams.cpp:844
int32_t MaxPlayerLeague
Definition: C4Scenario.h:70
void SetFile(C4Network2ResType eType, const char *szFile)
C4Application Application
Definition: C4Globals.cpp:44
void SetValue(const char *id, int32_t value, bool only_if_larger)
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277