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+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  {
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+1];
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
277  CreateByFile(NRT_System, C4CFN_System);
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
287  CreateByFile(NRT_Material, C4CFN_Material);
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();
388  LeagueAddress.Clear();
389  Rules.Clear();
390  Goals.Clear();
391  Scenario.Clear();
392  GameRes.Clear();
393  Clients.Clear();
394  PlayerInfos.Clear();
395  RestorePlayerInfos.Clear();
396  Teams.Clear();
397  ScenarioParameters.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
406  Scenario.SetFile(NRT_Scenario, hGroup.GetFullName().getData());
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))
415  PlayerInfos.Load(hGroup, 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
421  RestorePlayerInfos.Load(hGroup, C4CFN_SavePlayerInfos, pLang);
422  // transfer counter to allow for additional player joins in savegame resumes
423  PlayerInfos.SetIDCounter(RestorePlayerInfos.GetIDCounter());
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)
452  ControlRate = Config.Network.ControlRate;
453 
454  // network game?
455  IsNetworkGame = Game.NetworkActive;
456 
457  // Auto frame skip by options
458  AutoFrameSkip = !!::Config.Graphics.AutoFrameSkip;
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();
475  GameRes.CalcHashes();
476  Teams.EnforceLeagueRules();
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 }
C4Network2ResType
Definition: C4Network2Res.h:40
char * GetFilename(char *szPath)
Definition: StdFile.cpp:45
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:140
void CompileFunc(StdCompiler *pComp, C4Scenario *pScenario=nullptr)
C4Config Config
Definition: C4Config.cpp:833
C4Network2Res::Ref AddByCore(const C4Network2ResCore &Core, bool fLoad=true)
void CompileFunc(StdCompiler *pComp)
int32_t GetLeagueValue() const
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:152
const size_t C4MaxTitle
Definition: C4Constants.h:25
const char * ToString() const
Definition: C4Id.h:59
StdNamingCountAdapt< int_t > mkNamingCountAdapt(int_t &iCount, const char *szName)
Definition: StdAdaptors.h:994
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
C4Network2ResType getType() const
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 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
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
C4Network2ResType getType() const
Definition: C4Network2Res.h:84
const C4ScenarioParameterDef * GetParameterDefByIndex(size_t idx) const
int32_t ControlRate
Definition: C4Config.h:139
#define _MAX_PATH
class C4ScenarioParameterDefs & ScenarioParameterDefs
Definition: C4Game.h:75
const char * getFile() const
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
void Compile(T &&rStruct)
Definition: StdCompiler.h:173
#define AltDirectorySeparator
C4ConfigGraphics Graphics
Definition: C4Config.h:253
bool Publish(C4Network2ResList *pResList)
const char * GetID() const
StdStrBuf GetFullName() const
Definition: C4Group.cpp:2078
const C4Network2ResCore & getCore() const
void SetResCore(C4Network2ResCore *pResCore)
C4Network2 Network
Definition: C4Globals.cpp:53
C4GameRes * CreateByFile(C4Network2ResType eType, const char *szFile)
bool InitNetwork(C4Network2ResList *pResList)
C4Network2Res::Ref RetrieveRes(const C4Network2ResCore &Core, int32_t iTimeout, const char *szResName, bool fWaitForCore=false)
#define C4CFN_SavePlayerInfos
Definition: C4Components.h:125
static const C4ID None
Definition: C4Id.h:39
int32_t MaxPlayer
Definition: C4Scenario.h:70
C4Group ScenarioFile
Definition: C4Game.h:86
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:519
bool isPresent() const
StdPtrAdapt< T > mkPtrAdaptNoNull(T *&rpObj)
Definition: StdAdaptors.h:624
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)
char * GetExtension(char *szFilename)
Definition: StdFile.cpp:121
bool NetworkActive
Definition: C4Game.h:123
void Value(const T &rStruct)
Definition: StdCompiler.h:161
Definition: C4Id.h:25
bool Save(C4Group &hGroup, C4Scenario *pDefault)
const char * getData() const
Definition: StdBuf.h:442
C4Reloc Reloc
Definition: C4Reloc.cpp:21
C4GameResList & operator=(const C4GameResList &List)
virtual bool isDeserializer()
Definition: StdCompiler.h:53
#define C4CFN_PlayerInfos
Definition: C4Components.h:124
C4Network2Res::Ref getNetRes() const
const int C4NetResRetrieveTimeout
Definition: C4Network2.h:37
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84
bool isLoadable() const
Definition: C4Network2Res.h:88
bool LoadEntryString(const char *szEntryName, StdStrBuf *Buf)
Definition: C4Group.cpp:1932
C4Network2ResType getType() const
void CompileFunc(StdCompiler *pComp)
void SetNetRes(C4Network2Res::Ref pRes)
C4SGame Game
Definition: C4Scenario.h:234
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
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:476
static int32_t CheckGroupContents(C4Group &rGroup, int32_t Contents)
Definition: C4GroupSet.cpp:106
void SetLength(size_t iLength)
Definition: StdBuf.h:509
bool Open(C4Group &hGroup, const char *filename) const
Definition: C4Reloc.cpp:82
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:232
const char * getFile() const
void LoadFoldersWithLocalDefs(const char *szPath)
bool Load(C4Network2ResList *pResList)
#define C4CFN_System
Definition: C4Components.h:29
#define DirSep
void Add(C4GameRes *pRes)
C4GameRes * CreateByNetRes(C4Network2Res::Ref pNetRes)
StdArrayAdapt< T, M > mkArrayAdaptMap(T *pArray, int iSize, M &&map)
Definition: StdAdaptors.h:331
const C4Network2ResCore * getResCore() const
int32_t AutoFrameSkip
Definition: C4Config.h:116
#define DirectorySeparator
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:260
StdStrBuf GetGameGoalString() const
size_t getLength() const
Definition: StdBuf.h:445
int32_t MaxPlayerLeague
Definition: C4Scenario.h:70
void SetFile(C4Network2ResType eType, const char *szFile)
C4Application Application
Definition: C4Globals.cpp:44
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270
const char * getFileName() const
Definition: C4Network2Res.h:94