35 : eType(Res.getType()), File(Res.getFile()), pResCore(Res.getResCore()), pNetRes(Res.getNetRes())
37 if (pResCore && !pNetRes)
54 if (pResCore && !pNetRes)
63 if (pResCore && !pNetRes)
71 assert(!pNetRes && !pResCore);
96 if (deserializing)
Clear();
98 if (!deserializing) assert(pResCore);
110 if (pNetRes)
return true;
112 bool fAllowUnloadable =
false;
116 if (!pNetRes)
return false;
126 if (pNetRes)
return true;
129 if (!pNetRes)
return false;
154 if (!
Load(pNetResList))
175 if (!pNetRes)
return;
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]);
194 for (
int i = 0; i < iResCount; i++)
197 if (eType ==
NRT_Null || pResList[i]->getType() == eType)
200 else if (pLast == pResList[i])
208 for (int32_t i = 0; i < iResCount; i++)
212 iResCount = iResCapacity = 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)
234 SCopy(szPath,szFoldername,iBackslash);
254 LogF(
"Internal WARNING: Could not inspect folder %s for definitions.", szFoldername);
265 if (szDefinitionFilenames && *szDefinitionFilenames)
279 C4Group *pMatParentGrp =
nullptr;
315 for (
int i = 0; i < iResCount; i++)
324 for (int32_t i = 0; i < iResCount; i++)
325 pResList[i]->CalcHash();
331 for (int32_t i = 0; i < iResCount; i++)
344 if (iResCount >= iResCapacity)
348 for (
int i = 0; i < iResCount; i++)
349 pnResList[i] = pResList[i];
350 pResList = pnResList;
353 pResList[iResCount++] = pRes;
360 if (deserializing)
Clear();
366 pResList =
new C4GameRes *[iResCapacity = iResCount];
367 ZeroMem(pResList,
sizeof(*pResList) * iResCount);
374 mkPtrAdaptNoNull<C4GameRes>(*pResList);
409 if (!
GameRes.
Load(hGroup, pScenario, DefinitionFilenames))
430 if (!
Teams.
Load(hGroup, pScenario, pLang))
437 if (!CompileFromBuf_LogWarn<StdCompilerINIRead>(
490 StdStrBuf ParData = DecompileToBuf<StdCompilerINIWrite>(
#define C4CFN_PlayerInfos
#define C4CFN_SavePlayerInfos
C4Def * C4Id2Def(C4ID id)
C4Application Application
#define C4GSCnt_Definitions
const char * LoadResStr(const char *id)
bool LogF(const char *strMessage,...)
bool LogFatal(const char *szMessage)
const int C4NetResRetrieveTimeout
int SCharPos(char cTarget, const char *szInStr, int iIndex)
bool SCopySegment(const char *szString, int iSegment, char *sTarget, char cSeparator, int iMaxL, bool fSkipWhitespace)
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
bool SEqualNoCase(const char *szStr1, const char *szStr2, int iLen)
std::enable_if< std::is_pod< T >::value >::type ZeroMem(T *lpMem, size_t dwSize)
StdPtrAdapt< T > mkPtrAdaptNoNull(T *&rpObj)
StdArrayAdapt< T, M > mkArrayAdaptMap(T *pArray, int iSize, M &&map)
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
StdNamingCountAdapt< int_t > mkNamingCountAdapt(int_t &iCount, const char *szName)
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
StdStrBuf FormatString(const char *szFmt,...)
char * GetExtension(char *szFilename)
char * GetFilename(char *szPath)
C4ConfigGraphics Graphics
class C4ScenarioParameterDefs & ScenarioParameterDefs
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)
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
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
bool Add(const char *filename, const char *entry_name)
bool LoadEntryString(const char *entry_name, StdStrBuf *buffer)
bool FindEntry(const char *wildcard, StdStrBuf *filename=nullptr, size_t *size=nullptr)
static int32_t CheckGroupContents(C4Group &rGroup, int32_t Contents)
C4Group * FindGroup(int32_t Contents, C4Group *pAfter=nullptr, bool fSamePrio=false)
const char * ToString() const
C4ID GetID(size_t index, int32_t *ipCount=nullptr) const
int32_t GetNumberOfIDs() const
C4Network2Res::Ref RetrieveRes(const C4Network2ResCore &Core, int32_t iTimeout, const char *szResName, bool fWaitForCore=false)
const char * getFileName() const
C4Network2ResType getType() const
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)
bool Load(C4Group &hGroup, const char *szFromFile, class C4LangStringTable *pLang=nullptr)
const char * GetName() const override
bool Open(C4Group &group, const char *filename) const
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 EnforceLeagueRules()
bool Load(C4Group &hGroup, class C4Scenario *pInitDefault, class C4LangStringTable *pLang)
void Value(const T &rStruct)
virtual bool isDeserializer()
void Compile(T &&rStruct)
void SetLength(size_t iLength)
const char * getData() const
void Append(const char *pnData, size_t iChars)