Subversion Repositories spk

Rev

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

Rev 60 Rev 101
Line 245... Line 245...
245
		printf("Error: Unable to read mod file, %s\n", catfile.c_str());
245
		printf("Error: Unable to read mod file, %s\n", catfile.c_str());
246
		delete pVfs;
246
		delete pVfs;
247
		return;
247
		return;
248
	}
248
	}
249
 
249
 
250
	CyStringList *ships = pVfs->GetTShipsEntries();
250
	Utils::CStringList *ships = pVfs->getTShipsEntries();
251
	if ( !ships )
251
	if ( !ships )
252
	{
252
	{
253
		printf("Error: Failed to read %s::types\\TShips.pck\n", catfile.c_str());
253
		printf("Error: Failed to read %s::types\\TShips.pck\n", catfile.c_str());
254
		delete pVfs;
254
		delete pVfs;
255
		return;
255
		return;
256
	}
256
	}
257
 
257
 
258
	// now get the ship line to extract
258
	// now get the ship line to extract
259
	SStringList *tshipsLine = NULL;
259
	Utils::String tShipsLine;
260
	if ( shipid.Empty() )
260
	if ( shipid.Empty() )
261
	{
261
	{
262
		// no ship id, lets get one
262
		// no ship id, lets get one
263
		CyString ids[2];
263
		Utils::String ids[2];
264
		int i = 0;
264
		int i = 0;
265
		int id = 0;
265
		int id = 0;
266
		for ( SStringList *node = ships->Head(); node; node = node->next )
266
		for ( CListNode<Utils::SStringList> *node = ships->Front(); node; node = node->next() )
267
		{
267
		{
268
			ids[i++] = node->data;
268
			ids[i++] = node->Data()->data;
269
			if ( i >= 2 )
269
			if ( i >= 2 )
270
			{
270
			{
271
				printf("[%3d][%30s]\t[%3d][%30s]\n", id - 1, ids[0].c_str(), id, ids[1].c_str());
271
				printf("[%3d][%30s]\t[%3d][%30s]\n", id - 1, ids[0].c_str(), id, ids[1].c_str());
272
				for ( i = 0; i < 2; i++ )
272
				for ( i = 0; i < 2; i++ )
273
					ids[i] = "";
273
					ids[i] = "";
Line 279... Line 279...
279
			printf("[%3d][%30s]\n", id, ids[0].c_str());
279
			printf("[%3d][%30s]\n", id, ids[0].c_str());
280
		printf("Enter ID to use > ");
280
		printf("Enter ID to use > ");
281
		shipid = GetInput();
281
		shipid = GetInput();
282
 
282
 
283
		if ( shipid.IsNumber() )
283
		if ( shipid.IsNumber() )
284
			tshipsLine = ships->GetAt(shipid.ToInt());
284
			tShipsLine = ships->Get(shipid.ToInt())->str;
285
		else
285
		else
286
			tshipsLine = ships->FindData(shipid.upper());
286
			tShipsLine = ships->findData(shipid.ToString(), true);
287
	}
287
	}
288
	else
288
	else
289
		ships->FindData(shipid.upper());
289
		ships->findData(shipid.ToString(), true);
290
 
290
 
291
	if ( !tshipsLine )
291
	if ( tShipsLine.empty() )
292
	{
292
	{
293
		printf("Error, %s is not a valid ship id to use\n", shipid.c_str());
293
		printf("Error, %s is not a valid ship id to use\n", shipid.c_str());
294
		delete pVfs;
294
		delete pVfs;
295
		return;
295
		return;
296
	}
296
	}
297
 
297
 
298
	// now we have the tships to use, lets start to extract the ship
298
	// now we have the tships to use, lets start to extract the ship
299
	printf("Extracting ship from %s, Ship=%s\n", catfile.c_str(), tshipsLine-&gt;data.c_str());
299
	printf("Extracting ship from %s, Ship=%s\n", catfile.c_str(), tShipsLine.token(&quot;;";, -2).c_str());
300
 
300
 
301
	CXspFile ship;
301
	CXspFile ship;
302
	if ( ship.extractShip(pVfs, tshipsLine->data.ToString(), 0) )
302
	if ( ship.extractShip(pVfs, tShipsLine.token(";", -2), 0) )
303
	{
303
	{
304
		printf ( "Ship has been successfully extracted\n" );
304
		printf ( "Ship has been successfully extracted\n" );
305
 
305
 
306
		printf("\t- Models:\t %d\n", ship.CountFiles(FILETYPE_SHIPMODEL));
306
		printf("\t- Models:\t %d\n", ship.CountFiles(FILETYPE_SHIPMODEL));
307
		printf("\t- Textures:\t %d\n", ship.CountFiles(FILETYPE_SHIPOTHER));
307
		printf("\t- Textures:\t %d\n", ship.CountFiles(FILETYPE_SHIPOTHER));