Subversion Repositories spk

Rev

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

Rev 175 Rev 182
Line 504... Line 504...
504
			m_pLaserList->MemoryClear();
504
			m_pLaserList->MemoryClear();
505
			m_pMissileList->MemoryClear();
505
			m_pMissileList->MemoryClear();
506
			m_pTextList->MemoryClear();
506
			m_pTextList->MemoryClear();
507
 
507
 
508
			System::String ^tempDir = System::IO::Path::GetTempPath();
508
			System::String ^tempDir = System::IO::Path::GetTempPath();
509
			CyString sTempDir = CyStringFromSystemString(tempDir);
509
			Utils::String sTempDir = _S(tempDir);
510
 
510
 
511
			CPackages p;
511
			CPackages p;
512
			bool tcText = false;
512
			bool tcText = false;
513
			for ( SStringList *strNode = m_pDirList->Head(); strNode; strNode = strNode->next )
513
			for ( SStringList *strNode = m_pDirList->Head(); strNode; strNode = strNode->next )
514
			{
514
			{
Line 517... Line 517...
517
				CyStringList *missileList = new CyStringList;
517
				CyStringList *missileList = new CyStringList;
518
				m_pMissileList->push_back(missileList);
518
				m_pMissileList->push_back(missileList);
519
				CyStringList *textList = new CyStringList;
519
				CyStringList *textList = new CyStringList;
520
				m_pTextList->push_back(textList);
520
				m_pTextList->push_back(textList);
521
 
521
 
522
				if ( p.ExtractGameFile("types/TLaser.pck", sTempDir + "/TLaser.txt", strNode->str) )
522
				if ( p.extractGameFile("types/TLaser.pck", sTempDir + "/TLaser.txt", strNode->str.ToString()) )
523
				{
523
				{
524
					CFileIO Open(sTempDir + "/TLaser.txt");
524
					CFileIO Open(sTempDir + "/TLaser.txt");
525
					std::vector<Utils::String> *lines = Open.readLines();
525
					std::vector<Utils::String> *lines = Open.readLines();
526
					if ( lines )
526
					if ( lines )
527
					{
527
					{
Line 547... Line 547...
547
					}
547
					}
548
 
548
 
549
					Open.remove();
549
					Open.remove();
550
				}
550
				}
551
 
551
 
552
				if ( p.ExtractGameFile("types/TMissiles.pck", sTempDir + "/TMissiles.txt", strNode->str) )
552
				if ( p.extractGameFile("types/TMissiles.pck", sTempDir + "/TMissiles.txt", strNode->str.ToString()) )
553
				{
553
				{
554
					CFileIO Open(sTempDir + "/TMissiles.txt");
554
					CFileIO Open(sTempDir + "/TMissiles.txt");
555
					std::vector<Utils::String> *lines = Open.readLines();
555
					std::vector<Utils::String> *lines = Open.readLines();
556
					if ( lines )
556
					if ( lines )
557
					{
557
					{
Line 581... Line 581...
581
 
581
 
582
				if ( !m_bReadText )
582
				if ( !m_bReadText )
583
					continue;
583
					continue;
584
 
584
 
585
				// load the text file
585
				// load the text file
586
				CyString textFormat;
586
				Utils::String textFormat;
587
				if ( tcText )
587
				if ( tcText )
588
					textFormat = "0001-L044";
588
					textFormat = "0001-L044";
589
				else
589
				else
590
					textFormat = "440001";
590
					textFormat = "440001";
591
 
591
 
592
				if ( p.ExtractGameFile(CyString("t/";) + textFormat + ".pck", sTempDir + "/" + textFormat + ".xml", strNode->str) )
592
				if ( p.extractGameFile("t/" + textFormat + ".pck", sTempDir + "/"; + textFormat + ".xml", strNode->str.ToString()) )
593
				{
593
				{
594
					CFileIO Open(sTempDir + textFormat + ".xml");
594
					CFileIO Open(sTempDir + textFormat + ".xml");
595
					if ( Open.startRead() )
595
					if ( Open.startRead() )
596
					{
596
					{
597
						int donePage = (tcText) ? 3 : 2;
597
						int donePage = (tcText) ? 3 : 2;
598
						int inPage = 0;
598
						int inPage = 0;
599
						while ( !Open.atEnd() )
599
						while ( !Open.atEnd() )
600
						{
600
						{
601
							CyString line = Open.readEndOfLine();
601
							Utils::String line = Open.readEndOfLine();
602
							if ( line.Empty() )
602
							if ( line.empty() )
603
								continue;
603
								continue;
604
							line = line.RemoveFirstSpace();
604
							line = line.removeFirstSpace();
605
							line = line.Remove('\t');
605
							line = line.remove('\t');
606
							if ( !inPage )
606
							if ( !inPage )
607
							{
607
							{
608
								if ( line.Left(5).Compare("<page") )
608
								if ( line.left(5).Compare("<page") )
609
								{
609
								{
610
									int pos = line.FindPos(" id=\"");
610
									int pos = line.findPos(" id=\"");
611
									if ( pos != -1 )
611
									if ( pos != -1 )
612
									{
612
									{
613
										int endpos = line.FindPos("\"", pos + 5);
613
										int endpos = line.findPos("\"", pos + 5);
614
										if ( endpos != -1 )
614
										if ( endpos != -1 )
615
										{
615
										{
616
											CyString check = line.Mid(pos + 6, endpos - pos - 5);
616
											Utils::String check = line.mid(pos + 6, endpos - pos - 5);
617
											int iPage = check.ToInt();
617
											int iPage = check.toInt();
618
											if ( iPage == 17 || iPage == 300017 || iPage == 350017 )
618
											if ( iPage == 17 || iPage == 300017 || iPage == 350017 )
619
												inPage = iPage;
619
												inPage = iPage;
620
										}
620
										}
621
									}
621
									}
622
								}
622
								}
623
							}
623
							}
624
							else
624
							else
625
							{
625
							{
626
								if ( line.Left(6).Compare("</page") )
626
								if ( line.left(6).Compare("</page") )
627
								{
627
								{
628
									inPage = 0;
628
									inPage = 0;
629
									--donePage;
629
									--donePage;
630
 
630
 
631
									if ( donePage <= 0 )
631
									if ( donePage <= 0 )
632
										break;
632
										break;
633
								}
633
								}
634
								else
634
								else
635
								{
635
								{
636
									int pos = line.FindPos("t id=\"");
636
									int pos = line.findPos("t id=\"");
637
									if ( pos != -1 )
637
									if ( pos != -1 )
638
									{
638
									{
639
										int endpos = line.FindPos("\"", pos + 6);
639
										int endpos = line.findPos("\"", pos + 6);
640
										if ( endpos != -1 )
640
										if ( endpos != -1 )
641
										{
641
										{
642
											CyString check = line.Mid(pos + 7, endpos - pos - 6);
642
											Utils::String check = line.mid(pos + 7, endpos - pos - 6);
643
											
643
											
644
											CyString data;
644
											Utils::String data;
645
											int pos = line.FindPos(">", endpos);
645
											int pos = line.findPos(">", endpos);
646
											if ( pos != -1 )
646
											if ( pos != -1 )
647
											{
647
											{
648
												endpos = line.FindPos("</", pos);
648
												endpos = line.findPos("</", pos);
649
												if ( endpos != -1 )
649
												if ( endpos != -1 )
650
													data = line.Mid(pos + 2, endpos - pos - 1);
650
													data = line.mid(pos + 2, endpos - pos - 1);
651
											}
651
											}
652
											SStringList *str = textList->FindData(check);
652
											SStringList *str = textList->FindData(check);
653
											if ( str )
653
											if ( str )
654
												str->str = data;
654
												str->str = data;
655
											else
655
											else
656
												textList->PushBack(data, check);
656
												textList->PushBack(CyString(data), CyString(check));
657
										}
657
										}
658
									}
658
									}
659
								}
659
								}
660
							}
660
							}
661
						}
661
						}