Subversion Repositories spk

Rev

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

Rev 181 Rev 182
Line 83... Line 83...
83
		m_sFilename = filename;
83
		m_sFilename = filename;
84
 
84
 
85
		if ( !base )
85
		if ( !base )
86
		{
86
		{
87
			int error;
87
			int error;
88
			m_pPackage = m_pP->OpenPackage(CyStringFromSystemString(filename), &error);
88
			m_pPackage = m_pP->openPackage(_S(filename), &error);
89
			if ( !m_pPackage )
89
			if ( !m_pPackage )
90
				return false;
90
				return false;
91
		}
91
		}
92
		else
92
		else
93
			m_pPackage = base;
93
			m_pPackage = base;
Line 950... Line 950...
950
 
950
 
951
	void PackageForm::UpdateGamesList()
951
	void PackageForm::UpdateGamesList()
952
	{
952
	{
953
		this->ListGames->Items->Clear();
953
		this->ListGames->Items->Clear();
954
		for ( SGameCompat *game = m_pPackage->GetGameCompatabilityList()->First(); game; game = m_pPackage->GetGameCompatabilityList()->Next() ) {
954
		for ( SGameCompat *game = m_pPackage->GetGameCompatabilityList()->First(); game; game = m_pPackage->GetGameCompatabilityList()->Next() ) {
955
			ListViewItem ^item = gcnew ListViewItem(SystemStringFromCyString(m_pP->GetGameNameFromType(game->iGame)));
955
			ListViewItem ^item = gcnew ListViewItem(_US(m_pP->getGameNameFromType(game->iGame)));
956
			item->ImageIndex = (game->iGame < 0) ? -1 : (game->iGame - 1);
956
			item->ImageIndex = (game->iGame < 0) ? -1 : (game->iGame - 1);
957
			if ( !game->sVersion.empty() ) {
957
			if ( !game->sVersion.empty() ) {
958
				item->SubItems->Add("Exact: " + SystemStringFromCyString(game->sVersion));
958
				item->SubItems->Add("Exact: " + _US(game->sVersion));
959
			}
959
			}
960
			else {
960
			else {
961
				item->SubItems->Add(SystemStringFromCyString(m_pP->GetGameVersionFromType(game->iGame, game->iVersion, game->sVersion)));
961
				item->SubItems->Add(_US(m_pP->getGameVersionFromType(game->iGame, game->iVersion, game->sVersion)));
962
			}
962
			}
963
			item->Tag = game->iGame;
963
			item->Tag = game->iGame;
964
			this->ListGames->Items->Add(item);
964
			this->ListGames->Items->Add(item);
965
		}
965
		}
966
 
966
 
Line 1430... Line 1430...
1430
			// if its a cat file, lets load the text
1430
			// if its a cat file, lets load the text
1431
			Hashtable ^catText = gcnew Hashtable();
1431
			Hashtable ^catText = gcnew Hashtable();
1432
 
1432
 
1433
			if ( String::Compare(IO::FileInfo(ofd->FileName).Extension, ".cat") == 0 )
1433
			if ( String::Compare(IO::FileInfo(ofd->FileName).Extension, ".cat") == 0 )
1434
			{
1434
			{
1435
				CyStringList readText;
1435
				Utils::CStringList readText;
1436
				if ( m_pP->ReadTextPage(CyStringFromSystemString(ofd->FileName), &readText, false, 17) )
1436
				if ( m_pP->readTextPage(_S(ofd->FileName), readText, false, 17) )
1437
				{
1437
				{
1438
					for ( SStringList *str = readText.Head(); str; str = str->;next )
1438
					for(auto itr = readText.begin(); itr != readText.end(); itr++)
1439
					{
1439
					{
1440
						String ^key = SystemStringFromCyString(str->str);
1440
						String ^key = _US((*itr)->str);
1441
						if ( catText->ContainsKey(key) )
1441
						if ( catText->ContainsKey(key) )
1442
							catText[key] = SystemStringFromCyString(str->data);
1442
							catText[key] = _US((*itr)->data);
1443
						else
1443
						else
1444
							catText->Add(key, SystemStringFromCyString(str->data));
1444
							catText->Add(key, _US((*itr)->data));
1445
					}
1445
					}
1446
				}
1446
				}
1447
			}
1447
			}
1448
 
1448
 
1449
			CyStringList list;
1449
			Utils::CStringList list;
1450
			if ( m_pP->LoadShipData(CyStringFromSystemString(ofd->;FileName), &list) )
1450
			if (m_pP->loadShipData(_S(ofd->;FileName), list))
1451
			{
1451
			{
1452
				LoadShip ^ls = gcnew LoadShip();
1452
				LoadShip ^ls = gcnew LoadShip();
1453
				for ( SStringList *str = list.Head(); str; str = str->;next )
1453
				for(auto itr = list.begin(); itr != list.end(); itr++)
1454
				{
1454
				{
1455
					int tId = str-&gt;data.GetToken(";", 7, 7).ToInt();
1455
					int tId = (*itr)-&gt;data.token(";", 7).toInt();
1456
					String ^name;
1456
					String ^name;
1457
					if ( catText->ContainsKey(Convert::ToString(tId)) )
1457
					if ( catText->ContainsKey(Convert::ToString(tId)) )
1458
						name = Convert::ToString(catText[Convert::ToString(tId)]);
1458
						name = Convert::ToString(catText[Convert::ToString(tId)]);
1459
					else
1459
					else
1460
						name = ((Form1 ^)this->MdiParent)->FindText(-1, 17, tId);
1460
						name = ((Form1 ^)this->MdiParent)->FindText(-1, 17, tId);
1461
					String ^text = ((Form1 ^)this->MdiParent)->FindText(-1, 1266, str-&gt;data.GetToken(";", 46, 46).ToInt()) + " " + name;
1461
					String ^text = ((Form1 ^)this->MdiParent)->FindText(-1, 1266, (*itr)-&gt;data.token(";", 46).toInt()) + " " + name;
1462
					int variation = str-&gt;data.GetToken(";", 51, 51).ToInt();
1462
					int variation = (*itr)-&gt;data.token(";", 51).toInt();
1463
					if ( variation )
1463
					if ( variation )
1464
						text = text + " " + ((Form1 ^)this->MdiParent)->FindText(-1, 17, 10000 + variation);
1464
						text = text + " " + ((Form1 ^)this->MdiParent)->FindText(-1, 17, 10000 + variation);
1465
					ls->AddShip(SystemStringFromCyString(str->str), text);
1465
					ls->AddShip(_US((*itr)->str), text);
1466
				}
1466
				}
1467
 
1467
 
1468
				if ( ls->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
1468
				if ( ls->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
1469
				{
1469
				{
1470
					SStringList *str = list.FindString(CyStringFromSystemString(ls->GetData()));
1470
					Utils::String data = list.findString(_S(ls->GetData()));
1471
					if ( str )
1471
					if (data.empty())
1472
					{
1472
					{
1473
						((CXspFile *)m_pPackage)->SetShipData(str->data.ToString());
1473
						((CXspFile *)m_pPackage)->SetShipData(data);
1474
						if ( ((CXspFile *)m_pPackage)->GetShipID().empty() )
1474
						if ( ((CXspFile *)m_pPackage)->GetShipID().empty() )
1475
						{
1475
						{
1476
							CyString id = str->data.GetToken(";", -2);
1476
							Utils::String id = data.tokens(";", -2);
1477
							while ( id.Right(1) == ";" )
1477
							while ( id.right(1) == ";" )
1478
								id.Truncate((int)id.Length() - 1);
1478
								id.truncate((int)id.length() - 1);
1479
							((CXspFile *)m_pPackage)->SetShipID(id.ToString());
1479
							((CXspFile *)m_pPackage)->SetShipID(id);
1480
							this->TextShipID->Text = SystemStringFromCyString(id);
1480
							this->TextShipID->Text = _US(id);
1481
						}
1481
						}
1482
 
1482
 
1483
						((CXspFile *)m_pPackage)->SetShipData(str->data.ToString());
1483
						((CXspFile *)m_pPackage)->SetShipData(data);
1484
						this->TextShipData->Text = SystemStringFromCyString(str->data);
1484
						this->TextShipData->Text = _US(data);
1485
						this->NumTextID->Value = str->data.GetToken(";", 7, 7).ToInt();
1485
						this->NumTextID->Value = data.token(";", 7).toInt();
1486
						this->UpdateChanged();
1486
						this->UpdateChanged();
1487
					}
1487
					}
1488
				}
1488
				}
1489
			}
1489
			}
1490
			else
1490
			else