Subversion Repositories spk

Rev

Rev 124 | Rev 160 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 124 Rev 125
Line 26... Line 26...
26
	if ( !CFileIO::Exists(sModFile) ) { m_iError = MDERR_FILENOTFOUND; return false; }
26
	if ( !CFileIO::Exists(sModFile) ) { m_iError = MDERR_FILENOTFOUND; return false; }
27
 
27
 
28
	delete m_pCatFile;
28
	delete m_pCatFile;
29
	m_pCatFile = new CCatFile;
29
	m_pCatFile = new CCatFile;
30
 
30
 
31
	if ( m_pCatFile->Open(sModFile, m_sAddon, CATREAD_CATDECRYPT, false) != CATERR_NONE ) { 
31
	if ( m_pCatFile->open(sModFile, m_sAddon, CATREAD_CATDECRYPT, false) != CATERR_NONE ) { 
32
		delete m_pCatFile;
32
		delete m_pCatFile;
33
		m_pCatFile = NULL;
33
		m_pCatFile = NULL;
34
		m_iError = MDERR_CANTOPENMOD; 
34
		m_iError = MDERR_CANTOPENMOD; 
35
		return false; 
35
		return false; 
36
	}
36
	}
Line 173... Line 173...
173
	Utils::String addonDir = "";
173
	Utils::String addonDir = "";
174
	int addonSize = addonDir.length() + 1;
174
	int addonSize = addonDir.length() + 1;
175
 
175
 
176
	// try and open the mod file
176
	// try and open the mod file
177
	CCatFile cat;
177
	CCatFile cat;
178
	if ( cat.Open(modfile, addonDir, CATREAD_DAT, false) != CATERR_NONE ) { m_iError = MDERR_CANTOPENMOD; return false; }
178
	if ( cat.open(modfile, addonDir, CATREAD_DAT, false) != CATERR_NONE ) { m_iError = MDERR_CANTOPENMOD; return false; }
179
 
179
 
180
	// we'll need to read in all the types/text files
180
	// we'll need to read in all the types/text files
181
	for ( int i = 0; i < cat.GetNumFiles(); i++ )
181
	for (unsigned int i = 0; i < cat.GetNumFiles(); i++)
182
	{
182
	{
183
		SInCatFile *f = cat.GetFile(i);
183
		SInCatFile *f = cat.GetFile(i);
184
		Utils::String checkFile = f->sFile.findReplace("\\", "/");
184
		Utils::String checkFile = f->sFile.findReplace("\\", "/");
185
		if ( (checkFile.left(6).Compare("types/") || checkFile.left(2).Compare("t/") || checkFile.left(6 + addonSize).Compare(addonDir + "/types/") || checkFile.left(2 + addonSize).Compare(addonDir + "/t/")) && _validFile(checkFile) )
185
		if ( (checkFile.left(6).Compare("types/") || checkFile.left(2).Compare("t/") || checkFile.left(6 + addonSize).Compare(addonDir + "/types/") || checkFile.left(2 + addonSize).Compare(addonDir + "/t/")) && _validFile(checkFile) )
186
		{
186
		{
Line 437... Line 437...
437
 
437
 
438
	this->ApplyMod(mod);
438
	this->ApplyMod(mod);
439
 
439
 
440
	bool ret = false;
440
	bool ret = false;
441
 
441
 
442
	CyString addonDir = "";
442
	Utils::String addonDir = "";
443
 
443
 
444
	CCatFile cat;
444
	CCatFile cat;
445
	if ( !CCatFile::Opened(cat.Open(mod, addonDir, CATREAD_CATDECRYPT, true)) )
445
	if ( !CCatFile::Opened(cat.open(mod, addonDir, CATREAD_CATDECRYPT, true)) )
446
		return false;
446
		return false;
447
 
447
 
448
	for ( CListNode<SDiffFile> *node = m_lFiles.Front(); node; node = node->next() )
448
	for ( CListNode<SDiffFile> *node = m_lFiles.Front(); node; node = node->next() )
449
	{
449
	{
450
		// extract the file from the game
450
		// extract the file from the game