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