OpenClonk
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_LEN];
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  {
238  if (Reloc.Open(hGroup, szFoldername))
239  {
240  // Check for contained defs
241  // do not, however, add them to the group set:
242  // parent folders are added by OpenScenario already!
243  int32_t iContents;
244  if ((iContents = Game.GroupSet.CheckGroupContents(hGroup, C4GSCnt_Definitions)))
245  {
246  // Add folder to list
247  CreateByFile(NRT_Definitions, szFoldername);
248  }
249  // Close folder
250  hGroup.Close();
251  }
252  else
253  {
254  LogF("Internal WARNING: Could not inspect folder %s for definitions.", szFoldername);
255  }
256  }
257  }
258 }
259 
260 bool C4GameResList::Load(C4Group &hGroup, C4Scenario *pScenario, const char * szDefinitionFilenames)
261 {
262  // clear any prev
263  Clear();
264  // no defs to be added? that's OK (LocalOnly)
265  if (szDefinitionFilenames && *szDefinitionFilenames)
266  {
267  // add them
268  char szSegment[_MAX_PATH_LEN];
269  for (int32_t cseg=0; SCopySegment(szDefinitionFilenames,cseg,szSegment,';',_MAX_PATH); ++cseg)
270  if (*szSegment)
271  CreateByFile(NRT_Definitions, szSegment);
272  }
273 
274  LoadFoldersWithLocalDefs(pScenario->Head.Origin ? pScenario->Head.Origin.getData() : hGroup.GetFullName().getData());
275 
276  // add System.ocg
278  // add all instances of Material.ocg, except those inside the scenario file
279  C4Group *pMatParentGrp = nullptr;
280  while ((pMatParentGrp = Game.GroupSet.FindGroup(C4GSCnt_Material, pMatParentGrp)))
281  if (pMatParentGrp != &Game.ScenarioFile)
282  {
283  StdStrBuf MaterialPath = pMatParentGrp->GetFullName() + DirSep C4CFN_Material;
284  CreateByFile(NRT_Material, (pMatParentGrp->GetFullName() + DirSep C4CFN_Material).getData());
285  }
286  // add global Material.ocg
288  // done; success
289  return true;
290 }
291 
293 {
294  // Create & set
295  C4GameRes *pRes = new C4GameRes();
296  pRes->SetFile(eType, szFile);
297  // Add to list
298  Add(pRes);
299  return pRes;
300 }
301 
303 {
304  // Create & set
305  C4GameRes *pRes = new C4GameRes();
306  pRes->SetNetRes(pNetRes);
307  // Add to list
308  Add(pRes);
309  return pRes;
310 }
311 
313 {
314  // Check all resources without attached network resource object
315  for (int i = 0; i < iResCount; i++)
316  if (!pResList[i]->InitNetwork(pNetResList))
317  return false;
318  // Success
319  return true;
320 }
321 
323 {
324  for (int32_t i = 0; i < iResCount; i++)
325  pResList[i]->CalcHash();
326 }
327 
329 {
330  // wait for all resources
331  for (int32_t i = 0; i < iResCount; i++)
332  {
333  const C4Network2ResCore &Core = *pResList[i]->getResCore();
334  StdStrBuf ResNameBuf = FormatString("%s: %s", LoadResStr("IDS_DLG_DEFINITION"), GetFilename(Core.getFileName()));
335  if (!::Network.RetrieveRes(Core, C4NetResRetrieveTimeout, ResNameBuf.getData()))
336  return false;
337  }
338  return true;
339 }
340 
342 {
343  // Enlarge
344  if (iResCount >= iResCapacity)
345  {
346  iResCapacity += 10;
347  C4GameRes **pnResList = new C4GameRes *[iResCapacity];
348  for (int i = 0; i < iResCount; i++)
349  pnResList[i] = pResList[i];
350  pResList = pnResList;
351  }
352  // Add
353  pResList[iResCount++] = pRes;
354 }
355 
357 {
358  bool deserializing = pComp->isDeserializer();
359  // Clear previous data
360  if (deserializing) Clear();
361  // Compile resource count
362  pComp->Value(mkNamingCountAdapt(iResCount, "Resource"));
363  // Create list
364  if (deserializing)
365  {
366  pResList = new C4GameRes *[iResCapacity = iResCount];
367  ZeroMem(pResList, sizeof(*pResList) * iResCount);
368  }
369  // Compile list
370  pComp->Value(
372  mkArrayAdaptMap(pResList, iResCount, mkPtrAdaptNoNull<C4GameRes>),
373  "Resource"));
374  mkPtrAdaptNoNull<C4GameRes>(*pResList);
375 }
376 
377 
378 
379 // *** C4GameParameters
380 
382 
384 
386 {
387  League.Clear();
389  Rules.Clear();
390  Goals.Clear();
391  Scenario.Clear();
392  GameRes.Clear();
393  Clients.Clear();
394  PlayerInfos.Clear();
396  Teams.Clear();
398 }
399 
400 bool C4GameParameters::Load(C4Group &hGroup, C4Scenario *pScenario, const char *szGameText, C4LangStringTable *pLang, const char *DefinitionFilenames, C4ScenarioParameters *pStartupScenarioParameters)
401 {
402  // Clear previous data
403  Clear();
404 
405  // Scenario
407 
408  // Additional game resources
409  if (!GameRes.Load(hGroup, pScenario, DefinitionFilenames))
410  return false;
411 
412  // Player infos (replays only)
413  if (pScenario->Head.Replay)
414  if (hGroup.FindEntry(C4CFN_PlayerInfos))
416 
417  // Savegame restore infos: Used for savegames to rejoin joined players
418  if (hGroup.FindEntry(C4CFN_SavePlayerInfos))
419  {
420  // load to savegame info list
422  // transfer counter to allow for additional player joins in savegame resumes
424  // in network mode, savegame players may be reassigned in the lobby
425  // in any mode, the final player restoration will be done in InitPlayers()
426  // dropping any players that could not be restored
427  }
428 
429  // Load teams
430  if (!Teams.Load(hGroup, pScenario, pLang))
431  { LogFatal(LoadResStr("IDS_PRC_ERRORLOADINGTEAMS")); return false; }
432 
433  // Compile data
434  StdStrBuf Buf;
435  if (hGroup.LoadEntryString(C4CFN_Parameters, &Buf))
436  {
437  if (!CompileFromBuf_LogWarn<StdCompilerINIRead>(
438  mkNamingAdapt(mkParAdapt(*this, pScenario), "Parameters"),
439  Buf,
441  return false;
442  }
443  else
444  {
445 
446  // Set default values
447  StdCompilerNull DefaultCompiler;
448  DefaultCompiler.Compile(mkParAdapt(*this, pScenario));
449 
450  // Set control rate default
451  if (ControlRate < 0)
453 
454  // network game?
456 
457  // Auto frame skip by options
459 
460  // custom parameters from startup
461  if (pStartupScenarioParameters) ScenarioParameters = *pStartupScenarioParameters;
462  }
463 
464 
465  // enforce league settings
466  if (isLeague()) EnforceLeagueRules(pScenario);
467 
468  // Done
469  return true;
470 }
471 
473 {
474  Scenario.CalcHash();
477  AllowDebug = false;
478  if (pScenario) MaxPlayers = pScenario->Head.MaxPlayerLeague;
479  // forced league values in custom scenario parameters
480  size_t idx=0; const C4ScenarioParameterDef *pdef; int32_t val;
481  while ((pdef = ::Game.ScenarioParameterDefs.GetParameterDefByIndex(idx++)))
482  if ((val = pdef->GetLeagueValue()))
483  ScenarioParameters.SetValue(pdef->GetID(), val, false);
484 }
485 
486 bool C4GameParameters::Save(C4Group &hGroup, C4Scenario *pScenario)
487 {
488 
489  // Write Parameters.txt
490  StdStrBuf ParData = DecompileToBuf<StdCompilerINIWrite>(
491  mkNamingAdapt(mkParAdapt(*this, pScenario), "Parameters"));
492  if (!hGroup.Add(C4CFN_Parameters, ParData, false, true))
493  return false;
494 
495  // Done
496  return true;
497 }
498 
500 {
501 
502  // Scenario & material resource
503  if (!Scenario.InitNetwork(pResList))
504  return false;
505 
506  // Other game resources
507  if (!GameRes.InitNetwork(pResList))
508  return false;
509 
510  // Done
511  return true;
512 }
513 
515 {
516  pComp->Value(mkNamingAdapt(MaxPlayers, "MaxPlayers", !pScenario ? 0 : pScenario->Head.MaxPlayer));
517  pComp->Value(mkNamingAdapt(AllowDebug, "AllowDebug", true));
518  pComp->Value(mkNamingAdapt(IsNetworkGame, "IsNetworkGame", false));
519  pComp->Value(mkNamingAdapt(IsEditor, "IsEditor", !!::Application.isEditor));
520  pComp->Value(mkNamingAdapt(ControlRate, "ControlRate", -1));
521  pComp->Value(mkNamingAdapt(AutoFrameSkip, "AutoFrameSkip", false));
522  pComp->Value(mkNamingAdapt(Rules, "Rules", !pScenario ? C4IDList() : pScenario->Game.Rules));
523  pComp->Value(mkNamingAdapt(Goals, "Goals", !pScenario ? C4IDList() : pScenario->Game.Goals));
524  pComp->Value(mkNamingAdapt(League, "League", StdStrBuf()));
525 
526  // These values are either stored separately (see Load/Save) or
527  // don't make sense for savegames.
528  if (!pScenario)
529  {
530  pComp->Value(mkNamingAdapt(LeagueAddress, "LeagueAddress", ""));
531 
532  pComp->Value(mkNamingAdapt(Scenario, "Scenario" ));
533  pComp->Value(GameRes);
534 
535  pComp->Value(mkNamingAdapt(PlayerInfos, "PlayerInfos" ));
536  pComp->Value(mkNamingAdapt(RestorePlayerInfos,"RestorePlayerInfos"));
537  pComp->Value(mkNamingAdapt(Teams, "Teams" ));
538  }
539 
540  pComp->Value(Clients);
541 
542  pComp->Value(mkNamingAdapt(ScenarioParameters, "ScenarioParameters"));
543 
544 }
545 
547 {
548  // getting game goals from the ID list
549  // unfortunately, names cannot be deduced before object definitions are loaded
550  StdStrBuf sResult;
551  C4ID idGoal;
552  for (int32_t i=0; i<Goals.GetNumberOfIDs(); ++i)
553  if ((idGoal = Goals.GetID(i))) if (idGoal != C4ID::None)
554  {
555  if (Game.IsRunning)
556  {
557  C4Def *pDef = C4Id2Def(idGoal);
558  if (pDef)
559  {
560  if (sResult.getLength()) sResult.Append(", ");
561  sResult.Append(pDef->GetName());
562  }
563  }
564  else
565  {
566  if (sResult.getLength()) sResult.Append(", ");
567  sResult.Append(idGoal.ToString());
568  }
569  }
570  // Max length safety
571  if (sResult.getLength() > C4MaxTitle) sResult.SetLength(C4MaxTitle);
572  // Compose desc string
573  if (sResult.getLength())
574  return FormatString("%s: %s", LoadResStr("IDS_MENU_CPGOALS"), sResult.getData());
575  else
576  return StdCopyStrBuf(LoadResStr("IDS_CTL_NOGOAL"), true);
577 }
#define C4CFN_System
Definition: C4Components.h:29
#define C4CFN_Material
Definition: C4Components.h:25
#define C4CFN_PlayerInfos
Definition: C4Components.h:124
#define C4CFN_Parameters
Definition: C4Components.h:128
#define C4CFN_SavePlayerInfos
Definition: C4Components.h:125
C4Config Config
Definition: C4Config.cpp:930
const size_t C4MaxTitle
Definition: C4Constants.h:25
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84
C4Game Game
Definition: C4Globals.cpp:52
C4Application Application
Definition: C4Globals.cpp:44
C4Network2 Network
Definition: C4Globals.cpp:53
#define C4GSCnt_Material
Definition: C4GroupSet.h:36
#define C4GSCnt_Definitions
Definition: C4GroupSet.h:38
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:262
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:239
const int C4NetResRetrieveTimeout
Definition: C4Network2.h:37
C4Network2ResType
Definition: C4Network2Res.h:41
@ NRT_Definitions
Definition: C4Network2Res.h:46
@ NRT_Material
Definition: C4Network2Res.h:48
@ NRT_Scenario
Definition: C4Network2Res.h:43
@ NRT_Null
Definition: C4Network2Res.h:42
@ NRT_System
Definition: C4Network2Res.h:47
C4Reloc Reloc
Definition: C4Reloc.cpp:21
#define DirectorySeparator
#define AltDirectorySeparator
#define _MAX_PATH
#define _MAX_PATH_LEN
#define DirSep
int SCharPos(char cTarget, const char *szInStr, int iIndex)
Definition: Standard.cpp:239
bool SCopySegment(const char *szString, int iSegment, char *sTarget, char cSeparator, int iMaxL, bool fSkipWhitespace)
Definition: Standard.cpp:279
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:152
bool SEqualNoCase(const char *szStr1, const char *szStr2, int iLen)
Definition: Standard.cpp:213
std::enable_if< std::is_pod< T >::value >::type ZeroMem(T *lpMem, size_t dwSize)
Definition: Standard.h:60
StdPtrAdapt< T > mkPtrAdaptNoNull(T *&rpObj)
Definition: StdAdaptors.h:638
StdArrayAdapt< T, M > mkArrayAdaptMap(T *pArray, int iSize, M &&map)
Definition: StdAdaptors.h:340
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:490
StdNamingCountAdapt< int_t > mkNamingCountAdapt(int_t &iCount, const char *szName)
Definition: StdAdaptors.h:1008
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270
char * GetExtension(char *szFilename)
Definition: StdFile.cpp:118
char * GetFilename(char *szPath)
Definition: StdFile.cpp:42
void Clear()
Definition: C4Client.cpp:170
int32_t AutoFrameSkip
Definition: C4Config.h:116
C4ConfigNetwork Network
Definition: C4Config.h:259
C4ConfigGraphics Graphics
Definition: C4Config.h:257
int32_t ControlRate
Definition: C4Config.h:139
Definition: C4Def.h:99
bool IsRunning
Definition: C4Game.h:140
class C4ScenarioParameterDefs & ScenarioParameterDefs
Definition: C4Game.h:75
bool NetworkActive
Definition: C4Game.h:123
C4GroupSet GroupSet
Definition: C4Game.h:87
C4Group ScenarioFile
Definition: C4Game.h:86
bool isLeague() const
C4GameResList GameRes
C4ClientList Clients
C4ScenarioParameters ScenarioParameters
StdStrBuf GetGameGoalString() const
bool Load(C4Group &hGroup, C4Scenario *pDefault, const char *szGameText, C4LangStringTable *pLang, const char *DefinitionFilenames, C4ScenarioParameters *pStartupScenarioParameters)
bool InitNetwork(C4Network2ResList *pResList)
void EnforceLeagueRules(class C4Scenario *pScenario)
StdCopyStrBuf League
C4PlayerInfoList RestorePlayerInfos
void CompileFunc(StdCompiler *pComp, C4Scenario *pScenario=nullptr)
StdCopyStrBuf LeagueAddress
bool Save(C4Group &hGroup, C4Scenario *pDefault)
C4PlayerInfoList PlayerInfos
void SetNetRes(C4Network2Res::Ref pRes)
C4Network2Res::Ref getNetRes() const
bool isPresent() const
void SetFile(C4Network2ResType eType, const char *szFile)
void CompileFunc(StdCompiler *pComp)
void SetResCore(C4Network2ResCore *pResCore)
C4Network2ResType getType() const
const char * getFile() const
C4GameRes & operator=(const C4GameRes &Res)
const C4Network2ResCore * getResCore() const
bool Load(C4Network2ResList *pResList)
bool Publish(C4Network2ResList *pResList)
bool InitNetwork(C4Network2ResList *pResList)
C4GameResList & operator=(const C4GameResList &List)
C4GameRes * CreateByFile(C4Network2ResType eType, const char *szFile)
void LoadFoldersWithLocalDefs(const char *szPath)
void Add(C4GameRes *pRes)
C4GameRes * iterRes(C4GameRes *pLast, C4Network2ResType eType=NRT_Null)
C4GameRes * CreateByNetRes(C4Network2Res::Ref pNetRes)
void CompileFunc(StdCompiler *pComp)
bool InitNetwork(C4Network2ResList *pNetResList)
bool Load(C4Group &hGroup, C4Scenario *pScenario, const char *szDefinitionFilenames)
StdStrBuf GetFullName() const
Definition: C4Group.cpp:2638
bool Add(const char *filename, const char *entry_name)
Definition: C4Group.cpp:1621
bool LoadEntryString(const char *entry_name, StdStrBuf *buffer)
Definition: C4Group.cpp:2430
bool Close()
Definition: C4Group.cpp:971
bool FindEntry(const char *wildcard, StdStrBuf *filename=nullptr, size_t *size=nullptr)
Definition: C4Group.cpp:2211
static int32_t CheckGroupContents(C4Group &rGroup, int32_t Contents)
Definition: C4GroupSet.cpp:106
C4Group * FindGroup(int32_t Contents, C4Group *pAfter=nullptr, bool fSamePrio=false)
Definition: C4GroupSet.cpp:155
Definition: C4Id.h:26
const char * ToString() const
Definition: C4Id.h:56
static const C4ID None
Definition: C4Id.h:39
C4ID GetID(size_t index, int32_t *ipCount=nullptr) const
Definition: C4IDList.cpp:103
void Clear()
Definition: stub-handle.cpp:64
int32_t GetNumberOfIDs() const
Definition: C4IDList.cpp:231
C4Network2Res::Ref RetrieveRes(const C4Network2ResCore &Core, int32_t iTimeout, const char *szResName, bool fWaitForCore=false)
const char * getFileName() const
Definition: C4Network2Res.h:94
bool isLoadable() const
Definition: C4Network2Res.h:88
C4Network2ResType getType() const
Definition: C4Network2Res.h:84
const char * getFile() const
const C4Network2ResCore & getCore() const
C4Network2ResType getType() const
C4Network2Res::Ref AddByFile(const char *strFilePath, bool fTemp, C4Network2ResType eType, int32_t iResID=-1, const char *szResName=nullptr, bool fAllowUnloadable=false)
C4Network2Res::Ref AddByCore(const C4Network2ResCore &Core, bool fLoad=true)
void SetIDCounter(int32_t idNewCounter)
Definition: C4PlayerInfo.h:394
bool Load(C4Group &hGroup, const char *szFromFile, class C4LangStringTable *pLang=nullptr)
int32_t GetIDCounter()
Definition: C4PlayerInfo.h:395
const char * GetName() const override
Definition: C4PropList.cpp:243
bool Open(C4Group &group, const char *filename) const
Definition: C4Reloc.cpp:156
C4IDList Goals
Definition: C4Scenario.h:122
C4IDList Rules
Definition: C4Scenario.h:123
int32_t MaxPlayerLeague
Definition: C4Scenario.h:70
bool Replay
Definition: C4Scenario.h:72
int32_t MaxPlayer
Definition: C4Scenario.h:70
StdCopyStrBuf Origin
Definition: C4Scenario.h:80
C4SGame Game
Definition: C4Scenario.h:234
C4SHead Head
Definition: C4Scenario.h:232
const char * GetID() const
int32_t GetLeagueValue() const
const C4ScenarioParameterDef * GetParameterDefByIndex(size_t idx) const
void SetValue(const char *id, int32_t value, bool only_if_larger)
void Clear()
Definition: C4Teams.cpp:255
void EnforceLeagueRules()
Definition: C4Teams.cpp:856
bool Load(C4Group &hGroup, class C4Scenario *pInitDefault, class C4LangStringTable *pLang)
Definition: C4Teams.cpp:604
void Value(const T &rStruct)
Definition: StdCompiler.h:161
virtual bool isDeserializer()
Definition: StdCompiler.h:53
void Compile(T &&rStruct)
Definition: StdCompiler.h:173
void SetLength(size_t iLength)
Definition: StdBuf.h:509
const char * getData() const
Definition: StdBuf.h:442
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:519
void Clear()
Definition: StdBuf.h:466
size_t getLength() const
Definition: StdBuf.h:445