Subversion Repositories spk

Rev

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

Rev 58 Rev 68
Line 50... Line 50...
50
		int GetHighestGame()
50
		int GetHighestGame()
51
		{
51
		{
52
			int highest = 1;
52
			int highest = 1;
53
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
53
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
54
			{
54
			{
55
				int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
-
 
56
				if ( checkgame > highest )
55
				if ( gd->iGame > highest )
57
					highest = checkgame;
56
					highest = gd->iGame;
58
			}
57
			}
59
			return highest;
58
			return highest;
60
		}
59
		}
61
 
60
 
62
		void ModMerge()
61
		void ModMerge()
63
		{
62
		{
64
			ModMerge::Form1 ^merge = gcnew ModMerge::Form1();
63
			ModMerge::Form1 ^merge = gcnew ModMerge::Form1();
65
			merge->StartPosition = Windows::Forms::FormStartPosition::CenterParent;
64
			merge->StartPosition = Windows::Forms::FormStartPosition::CenterParent;
66
			merge->TopMost = true;
65
			merge->TopMost = true;
67
			if ( !m_pGameDir->empty() )
66
			if ( !m_pGameDir->empty() )
68
				merge->SetGameDir(-1, SystemStringFromCyString(m_pGameDir->Front()->Data()->sDir));
67
				merge->SetGameDir(-1, _US(m_pGameDir->Front()->Data()->dir));
69
			merge->ShowDialog(this);
68
			merge->ShowDialog(this);
70
		}
69
		}
71
 
70
 
72
		void ModDiffDialog()
71
		void ModDiffDialog()
73
		{
72
		{
Line 120... Line 119...
120
 
119
 
121
			if ( list->Empty() )
120
			if ( list->Empty() )
122
			{
121
			{
123
				for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
122
				for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
124
				{
123
				{
125
					int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
-
 
126
					if ( checkgame != game )
124
					if ( gd->iGame != game )
127
						continue;
125
						continue;
128
					int e = m_pPackages->ExtractGameFile("types\\TLaser.pck", m_pPackages->GetTempDirectory() + "/TLaser.txt", gd->sDir);
126
					int e = m_pPackages->ExtractGameFile("types\\TLaser.pck", m_pPackages->GetTempDirectory() + "/TLaser.txt", gd->dir);
129
					if ( e )
127
					if ( e )
130
					{
128
					{
131
						CFileIO File((e == -1) ? "TLaser.txt" : m_pPackages->GetTempDirectory() + "/TLaser.txt");
129
						CFileIO File((e == -1) ? "TLaser.txt" : m_pPackages->GetTempDirectory() + "/TLaser.txt");
132
						CyStringList *lines = File.ReadLinesStr();
130
						CyStringList *lines = File.ReadLinesStr();
133
						if ( lines )
131
						if ( lines )
Line 180... Line 178...
180
			CyStringList *list = new CyStringList;
178
			CyStringList *list = new CyStringList;
181
			m_pMissiles->push_back(list);
179
			m_pMissiles->push_back(list);
182
 
180
 
183
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
181
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
184
			{
182
			{
185
				int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
-
 
186
				if ( checkgame != game )
183
				if ( gd->iGame != game )
187
					continue;
184
					continue;
188
				int e = m_pPackages->ExtractGameFile("types\\TMissiles.pck", m_pPackages->GetTempDirectory() + "/TMissiles.txt", gd->sDir);
185
				int e = m_pPackages->ExtractGameFile("types\\TMissiles.pck", m_pPackages->GetTempDirectory() + "/TMissiles.txt", gd->dir);
189
				if ( e )
186
				if ( e )
190
				{
187
				{
191
					CFileIO File((e == -1) ? "TMissiles.txt" : m_pPackages->GetTempDirectory() + "/TMissiles.txt");
188
					CFileIO File((e == -1) ? "TMissiles.txt" : m_pPackages->GetTempDirectory() + "/TMissiles.txt");
192
					CyStringList *lines = File.ReadLinesStr();
189
					CyStringList *lines = File.ReadLinesStr();
193
					if ( lines )
190
					if ( lines )
Line 229... Line 226...
229
				bool found = false;
226
				bool found = false;
230
				for ( int game = 2; game >= 0; game-- )
227
				for ( int game = 2; game >= 0; game-- )
231
				{
228
				{
232
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
229
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
233
					{
230
					{
234
						int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
-
 
235
						if ( checkgame != game )
231
						if ( gd->iGame != game )
236
							continue;
232
							continue;
237
						if ( m_pPackages->ExtractGameFile("types\\TShields.pck", m_pPackages->GetTempDirectory() + "/TShields.txt", gd->sDir) )
233
						if ( m_pPackages->ExtractGameFile("types\\TShields.pck", m_pPackages->GetTempDirectory() + "/TShields.txt", gd->dir) )
238
						{
234
						{
239
							if ( !m_pShields )
235
							if ( !m_pShields )
240
								m_pShields = new CyStringList;
236
								m_pShields = new CyStringList;
241
 
237
 
242
							CFileIO File(m_pPackages->GetTempDirectory() + "/TShields.txt");
238
							CFileIO File(m_pPackages->GetTempDirectory() + "/TShields.txt");
Line 296... Line 292...
296
			CyStringList *list = new CyStringList;
292
			CyStringList *list = new CyStringList;
297
			m_pCockpits->push_back(list);
293
			m_pCockpits->push_back(list);
298
 
294
 
299
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
295
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
300
			{
296
			{
301
				int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
-
 
302
				if ( checkgame != game )
297
				if ( gd->iGame != game )
303
					continue;
298
					continue;
304
				if ( m_pPackages->ExtractGameFile("types\\TCockpits.pck", m_pPackages->GetTempDirectory() + "/TCockpits.txt", gd->sDir) )
299
				if ( m_pPackages->ExtractGameFile("types\\TCockpits.pck", m_pPackages->GetTempDirectory() + "/TCockpits.txt", gd->dir) )
305
				{
300
				{
306
					CFileIO File(m_pPackages->GetTempDirectory() + "/TCockpits.txt");
301
					CFileIO File(m_pPackages->GetTempDirectory() + "/TCockpits.txt");
307
					CyStringList *lines = File.ReadLinesStr();
302
					CyStringList *lines = File.ReadLinesStr();
308
					if ( lines )
303
					if ( lines )
309
					{
304
					{
Line 346... Line 341...
346
				bool found = false;
341
				bool found = false;
347
				for ( int game = 2; game >= 0; game-- )
342
				for ( int game = 2; game >= 0; game-- )
348
				{
343
				{
349
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
344
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
350
					{
345
					{
351
						int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
-
 
352
						if ( checkgame != game )
346
						if ( gd->iGame != game )
353
							continue;
347
							continue;
354
						if ( m_pPackages->ExtractGameFile("types\\Components.pck", m_pPackages->GetTempDirectory() + "/components.txt", gd->sDir) )
348
						if ( m_pPackages->ExtractGameFile("types\\Components.pck", m_pPackages->GetTempDirectory() + "/components.txt", gd->dir) )
355
						{
349
						{
356
							if ( !m_pComponents )
350
							if ( !m_pComponents )
357
								m_pComponents = new CyStringList;
351
								m_pComponents = new CyStringList;
358
							CFileIO File(m_pPackages->GetTempDirectory() + "/components.txt");
352
							CFileIO File(m_pPackages->GetTempDirectory() + "/components.txt");
359
							CyStringList *lines = File.ReadLinesStr();
353
							CyStringList *lines = File.ReadLinesStr();
Line 419... Line 413...
419
				bool found = false;
413
				bool found = false;
420
				for ( int game = 2; game >= 0; game-- )
414
				for ( int game = 2; game >= 0; game-- )
421
				{
415
				{
422
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
416
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
423
					{
417
					{
424
						int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
-
 
425
						if ( checkgame != game )
418
						if ( gd->iGame != game )
426
							continue;
419
							continue;
427
						if ( m_pPackages->ExtractGameFile("types\\Dummies.pck", m_pPackages->GetTempDirectory() + "/Dummies.txt", gd->sDir) )
420
						if ( m_pPackages->ExtractGameFile("types\\Dummies.pck", m_pPackages->GetTempDirectory() + "/Dummies.txt", gd->dir) )
428
						{
421
						{
429
							if ( !m_pDummies )
422
							if ( !m_pDummies )
430
								m_pDummies = new CyStringList;
423
								m_pDummies = new CyStringList;
431
							CFileIO File(m_pPackages->GetTempDirectory() + "/Dummies.txt");
424
							CFileIO File(m_pPackages->GetTempDirectory() + "/Dummies.txt");
432
							CyStringList *lines = File.ReadLinesStr();
425
							CyStringList *lines = File.ReadLinesStr();
Line 487... Line 480...
487
				bool found = false;
480
				bool found = false;
488
				for ( int game = 2; game >= 0; game-- )
481
				for ( int game = 2; game >= 0; game-- )
489
				{
482
				{
490
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
483
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
491
					{
484
					{
492
						int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
-
 
493
						if ( checkgame != game )
485
						if ( gd->iGame != game )
494
							continue;
486
							continue;
495
						if ( m_pPackages->ExtractGameFile("types\\Bodies.pck", m_pPackages->GetTempDirectory() + "/Bodies.txt", gd->sDir) )
487
						if ( m_pPackages->ExtractGameFile("types\\Bodies.pck", m_pPackages->GetTempDirectory() + "/Bodies.txt", gd->dir) )
496
						{
488
						{
497
							if ( !m_pBodies )
489
							if ( !m_pBodies )
498
								m_pBodies = new CyStringList;
490
								m_pBodies = new CyStringList;
499
							CFileIO File(m_pPackages->GetTempDirectory() + "/Bodies.txt");
491
							CFileIO File(m_pPackages->GetTempDirectory() + "/Bodies.txt");
500
							CyStringList *lines = File.ReadLinesStr();
492
							CyStringList *lines = File.ReadLinesStr();
Line 591... Line 583...
591
		}
583
		}
592
 
584
 
593
		SGameDir *findGameDir(int iGame)
585
		SGameDir *findGameDir(int iGame)
594
		{
586
		{
595
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() ) {
587
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() ) {
596
				int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
-
 
597
				if ( checkgame == iGame ) return gd;
588
				if ( gd->iGame == iGame ) return gd;
598
			}
589
			}
599
 
590
 
600
			return NULL;
591
			return NULL;
601
		}
592
		}
602
 
593
 
Line 1671... Line 1662...
1671
				lines.PushBack("CreatorMax:");
1662
				lines.PushBack("CreatorMax:");
1672
 
1663
 
1673
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
1664
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
1674
				lines.PushBack(CyString("Loaded:") + str->data + " " + str->str);
1665
				lines.PushBack(CyString("Loaded:") + str->data + " " + str->str);
1675
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
1666
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
1676
				lines.PushBack(CyString("GameDir:") + gd->sDir + ";" + gd->sGame + ((gd->bLoad) ? ";1" : ";0"));
1667
				lines.PushBack(CyString("GameDir:") + gd->dir + ";" + CyString::Number(gd->iGame) + " " + gd->name + ((gd->bLoad) ? ";1" : ";0"));
1677
			if ( m_settings->bGenerateUpdate )
1668
			if ( m_settings->bGenerateUpdate )
1678
				lines.PushBack("GenerateUpdate:");
1669
				lines.PushBack("GenerateUpdate:");
1679
 
1670
 
1680
			Config.WriteFile(&lines);
1671
			Config.WriteFile(&lines);
1681
		}
1672
		}
Line 1708... Line 1699...
1708
						else if ( start.Compare("GenerateUpdate") )
1699
						else if ( start.Compare("GenerateUpdate") )
1709
							m_settings->bGenerateUpdate = true;
1700
							m_settings->bGenerateUpdate = true;
1710
						else if ( start.Compare("GameDir") )
1701
						else if ( start.Compare("GameDir") )
1711
						{
1702
						{
1712
							SGameDir *gd = new SGameDir;
1703
							SGameDir *gd = new SGameDir;
1713
							gd->sDir = rest.GetToken(";", 1, 1);
1704
							gd->dir = rest.GetToken(";", 1, 1).ToString();
1714
							gd->sGame = rest.GetToken(";", 2, 2);
1705
							gd->name = rest.GetToken(";", 2, 2).ToString();
1715
							gd->iGame = gd->sGame.GetToken(" ", 1, 1).ToInt();
1706
							gd->iGame = gd->name.token(" ", 1).toLong();
-
 
1707
							gd->name = gd->name.tokens(" ", 2);
1716
 
1708
 
1717
							SGameExe *exe = m_pPackages->GetGameExe()->GetGame(gd->iGame);
1709
							SGameExe *exe = m_pPackages->GetGameExe()->GetGame(gd->iGame);
1718
 
1710
 
1719
							gd->bLoad = rest.GetToken(";", 3, 3).ToBool();
1711
							gd->bLoad = rest.GetToken(";", 3, 3).ToBool();
1720
							gd->pVfs = new CVirtualFileSystem();
1712
							gd->pVfs = new CVirtualFileSystem();
1721
							gd->pVfs->setLanguage(44);
1713
							gd->pVfs->setLanguage(44);
1722
							gd->pVfs->LoadFilesystem(gd->sDir.ToString());
1714
							gd->pVfs->LoadFilesystem(gd->dir);
1723
							if ( exe ) {
1715
							if ( exe ) {
1724
								gd->pVfs->SetAddon(exe->sAddon);
1716
								gd->pVfs->SetAddon(exe->sAddon);
1725
							}
1717
							}
1726
							m_pGameDir->push_back(gd);
1718
							m_pGameDir->push_back(gd);
1727
						}
1719
						}