Exemplo n.º 1
0
C4Network2Res::Ref C4Network2ResList::AddByFile(const char *strFilePath, bool fTemp, C4Network2ResType eType, int32_t iResID, const char *szResName, bool fAllowUnloadable)
{
	// already in list?
	C4Network2Res::Ref pRes = getRefRes(strFilePath);
	if (pRes) return pRes;
	// get resource ID
	if (iResID < 0) iResID = nextResID();
	if (iResID < 0) { Log("AddByFile: no more resource IDs available!"); return NULL; }
	// create new
	pRes = new C4Network2Res(this);
	// initialize
	if (!pRes->SetByFile(strFilePath, fTemp, eType, iResID, szResName)) { return NULL; }
	// create standalone for non-system files
	// system files shouldn't create a standalone; they should never be marked loadable!
	if (eType != NRT_System)
		if (!pRes->GetStandalone(NULL, 0, true, fAllowUnloadable))
			if (!fAllowUnloadable)
			{
				delete pRes;
				return NULL;
			}
	// add to list
	Add(pRes);
	return pRes;
}
Exemplo n.º 2
0
C4Network2Res::Ref C4Network2ResList::AddByGroup(C4Group *pGrp, bool fTemp, C4Network2ResType eType, int32_t iResID, const char *szResName, bool fAllowUnloadable)
{
	// get resource ID
	if (iResID < 0) iResID = nextResID();
	if (iResID < 0) { Log("AddByGroup: no more resource IDs available!"); return NULL; }
	// create new
	C4Network2Res::Ref pRes = new C4Network2Res(this);
	// initialize
	if (!pRes->SetByGroup(pGrp, fTemp, eType, iResID, szResName))
	{
		delete pRes;
		return NULL;
	}
	// create standalone
	if (!pRes->GetStandalone(NULL, 0, true, fAllowUnloadable))
		if (!fAllowUnloadable)
		{
			delete pRes;
			return NULL;
		}
	// add to list
	Add(pRes);
	return pRes;
}