Subversion Repositories spk

Rev

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

Rev 43 Rev 52
Line 44... Line 44...
44
	m_sDir = dir;
44
	m_sDir = dir;
45
 
45
 
46
	this->_clear();
46
	this->_clear();
47
 
47
 
48
	int number = 1;
48
	int number = 1;
49
	while ( CFileIO(CyString(dir) + "/" + CyString::Number(number).PadNumber(2) + ".cat").Exists() )
49
	while ( CFileIO(CyString(dir) + "/" + CyString::Number(number).PadNumber(2) + ".cat").ExistsOld() )
50
	{
50
	{
51
		if ( maxPatch && maxPatch > number ) break;
51
		if ( maxPatch && maxPatch > number ) break;
52
		CyString file = CyString(dir) + "/" + CyString::Number(number).PadNumber(2);
52
		CyString file = CyString(dir) + "/" + CyString::Number(number).PadNumber(2);
53
		if ( !CFileIO(file + ".dat").Exists() )
53
		if ( !CFileIO(file + ".dat").ExistsOld() )
54
			break;
54
			break;
55
 
55
 
56
		CCatFile cat;
56
		CCatFile cat;
57
		if ( cat.Open(file + ".cat", m_sAddon, CATREAD_JUSTCONTENTS, false) == CATERR_NONE )
57
		if ( cat.Open(file + ".cat", m_sAddon, CATREAD_JUSTCONTENTS, false) == CATERR_NONE )
58
		{
58
		{
Line 249... Line 249...
249
 
249
 
250
CyStringList *CVirtualFileSystem::GetTShipsEntries()
250
CyStringList *CVirtualFileSystem::GetTShipsEntries()
251
{
251
{
252
	if ( this->ExtractGameFile("types/tships.pck", "tships.txt") ) {
252
	if ( this->ExtractGameFile("types/tships.pck", "tships.txt") ) {
253
		CFileIO TShips("tships.txt");
253
		CFileIO TShips("tships.txt");
254
		if ( TShips.Exists() )
254
		if ( TShips.exists() )
255
		{
255
		{
256
			CyStringList *lines = TShips.ReadLinesStr();
256
			CyStringList *lines = TShips.ReadLinesStr();
257
			if ( lines )
257
			if ( lines )
258
			{
258
			{
259
				// remove any commands, blank lines, and start
259
				// remove any commands, blank lines, and start
Line 289... Line 289...
289
					while ( str->data.Empty() )
289
					while ( str->data.Empty() )
290
						str->data = str->str.GetToken(";", num--, (num + 2));
290
						str->data = str->str.GetToken(";", num--, (num + 2));
291
				}
291
				}
292
			}
292
			}
293
			// remove the tmp file
293
			// remove the tmp file
294
			TShips.Remove();
294
			TShips.remove();
295
 
295
 
296
			if ( lines )
296
			if ( lines )
297
				lines->RemoveMarked();
297
				lines->RemoveMarked();
298
			return lines;
298
			return lines;
299
		}
299
		}
Line 314... Line 314...
314
		CFileIO File("tmp");
314
		CFileIO File("tmp");
315
 
315
 
316
		C_File *f = pPackage->AddFile(CFileIO(sTo).GetFilename(), CFileIO(sTo).GetDir(), iFileType);
316
		C_File *f = pPackage->AddFile(CFileIO(sTo).GetFilename(), CFileIO(sTo).GetDir(), iFileType);
317
		if ( f ) {
317
		if ( f ) {
318
			if ( f->ReadFromFile("tmp") ) {
318
			if ( f->ReadFromFile("tmp") ) {
319
				File.Remove();
319
				File.remove();
320
				return f;
320
				return f;
321
			}
321
			}
322
		}
322
		}
323
 
323
 
324
		File.Remove();
324
		File.remove();
325
	}
325
	}
326
 
326
 
327
	return NULL;
327
	return NULL;
328
}
328
}
329
 
329
 
Line 354... Line 354...
354
				continue;
354
				continue;
355
		}
355
		}
356
 
356
 
357
		if ( this->ExtractGameFile(str, "tmp") ) {
357
		if ( this->ExtractGameFile(str, "tmp") ) {
358
			pPackage->AddTextFromFile("tmp", textId);
358
			pPackage->AddTextFromFile("tmp", textId);
359
			CFileIO("tmp").Remove();
359
			CFileIO::Remove("tmp");
360
		}
360
		}
361
	}
361
	}
362
}
362
}
363
 
363
 
364
void CVirtualFileSystem::updateTexts(int iFromPage, int iToPage)
364
void CVirtualFileSystem::updateTexts(int iFromPage, int iToPage)
Line 458... Line 458...
458
 
458
 
459
			delete lines;
459
			delete lines;
460
			ret = true;
460
			ret = true;
461
		}
461
		}
462
 
462
 
463
		File.Remove();
463
		File.remove();
464
	}
464
	}
465
 
465
 
466
	return ret;
466
	return ret;
467
}
467
}
468
 
468