Subversion Repositories spk

Rev

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

Rev 217 Rev 218
Line 1559... Line 1559...
1559
						cockpit->SetEdit(m_pSelectedItem->Text, _US(_WS(m_pSelectedItem->SubItems[2]->Text).token(L";", 8)), _WS(m_pSelectedItem->SubItems[2]->Text).token(L";", 9).toInt());
1559
						cockpit->SetEdit(m_pSelectedItem->Text, _US(_WS(m_pSelectedItem->SubItems[2]->Text).token(L";", 8)), _WS(m_pSelectedItem->SubItems[2]->Text).token(L";", 9).toInt());
1560
					if ( cockpit->ShowDialog(this) == Windows::Forms::DialogResult::OK )
1560
					if ( cockpit->ShowDialog(this) == Windows::Forms::DialogResult::OK )
1561
					{
1561
					{
1562
						if ( !edit )
1562
						if ( !edit )
1563
						{
1563
						{
1564
							xsp->NewCockpit(_S(cockpit->GetID()), _S(cockpit->GetScene()), cockpit->GetMask());
1564
							xsp->newCockpit(_WS(cockpit->GetID()), _WS(cockpit->GetScene()), cockpit->GetMask());
1565
							this->UpdateShipPartList();
1565
							this->UpdateShipPartList();
1566
						}
1566
						}
1567
						else
1567
						else
1568
						{
1568
						{
1569
							xsp->EditCockpit(_S(cockpit->GetID()), _S(cockpit->GetScene()), cockpit->GetMask());
1569
							xsp->editCockpit(_WS(cockpit->GetID()), _WS(cockpit->GetScene()), cockpit->GetMask());
1570
							m_pSelectedItem->SubItems[2]->Text = _US(xsp->GetCockpitData(_S(cockpit->GetID())));
1570
							m_pSelectedItem->SubItems[2]->Text = _US(xsp->getCockpitData(_WS(cockpit->GetID())));
1571
						}
1571
						}
1572
					}
1572
					}
1573
				}
1573
				}
1574
				break;
1574
				break;
1575
 
1575
 
Line 1721... Line 1721...
1721
	{
1721
	{
1722
		CFileIO F(_S(file));
1722
		CFileIO F(_S(file));
1723
		if ( !F.exists() )
1723
		if ( !F.exists() )
1724
			return;
1724
			return;
1725
 
1725
 
1726
		std::vector<Utils::String> lines;
1726
		std::vector<Utils::WString> lines;
1727
		if(!F.readLines(lines))
1727
		if(!F.readLines(lines))
1728
			return;
1728
			return;
1729
 
1729
 
1730
		LoadShip ^load = gcnew LoadShip();
1730
		LoadShip ^load = gcnew LoadShip();
1731
 
1731
 
1732
		int entryPos = 1;
1732
		int entryPos = 1;
1733
		int dataPos = 1;
1733
		int dataPos = 1;
1734
		int dataPos2 = 0;
1734
		int dataPos2 = 0;
1735
		bool sections = false;
1735
		bool sections = false;
1736
		Utils::String section;
1736
		Utils::WString section;
1737
		switch ( type )
1737
		switch ( type )
1738
		{
1738
		{
1739
			case 2:
1739
			case 2:
1740
				entryPos = 2;
1740
				entryPos = 2;
1741
				dataPos = 19;
1741
				dataPos = 19;
Line 1764... Line 1764...
1764
				break;
1764
				break;
1765
		}
1765
		}
1766
 
1766
 
1767
		int entries2 = 0;
1767
		int entries2 = 0;
1768
		int entries = -1;
1768
		int entries = -1;
1769
		Utils::CStringList list;
1769
		Utils::WStringList list;
1770
		Utils::String data;
1770
		Utils::WString data;
1771
		int e = 0;
1771
		int e = 0;
1772
		for(auto itr = lines.begin(); itr != lines.end(); itr++)
1772
		for(auto itr = lines.begin(); itr != lines.end(); itr++)
1773
		{
1773
		{
1774
			Utils::String str = itr->remove(9).remove('\r');
1774
			Utils::WString str = itr->remove(9).remove('\r');
1775
			str = str.removeFirstSpace();
1775
			str = str.removeFirstSpace();
1776
			if (str.empty())
1776
			if (str.empty())
1777
				continue;
1777
				continue;
1778
			if (str[0] == '/')
1778
			if (str[0] == '/')
1779
				continue;
1779
				continue;
1780
 
1780
 
1781
			if ( entries == -1 || (entries <= 0 && sections) )
1781
			if ( entries == -1 || (entries <= 0 && sections) )
1782
			{
1782
			{
1783
				entries = str.token(";", entryPos).toInt();
1783
				entries = str.token(L";", entryPos).toInt();
1784
				if ( sections )
1784
				if ( sections )
1785
				{
1785
				{
1786
					section = str.token(";", 1);
1786
					section = str.token(L";", 1);
1787
					load->AddGroup(_US(section));
1787
					load->AddGroup(_US(section));
1788
				}
1788
				}
1789
			}
1789
			}
1790
			else
1790
			else
1791
			{
1791
			{
1792
				if ( type == 4 )
1792
				if ( type == 4 )
1793
				{
1793
				{
1794
					int max;
-
 
1795
					Utils::String *strs = str.tokenise(";", &amp;max);
1794
					std::vector<Utils::WString&gt; strs;
1796
					if ( max &;&amp; strs )
1795
					if(str.tokenise(L";&quot;, strs))
1797
					{
1796
					{
1798
						for ( int i = 0; i < max; i++ )
1797
						for (size_t i = 0; i < strs.size(); i++ )
1799
						{
1798
						{
1800
							strs[i].removeFirstSpace();
1799
							strs[i].removeFirstSpace();
1801
							if ( strs[i].empty() ) continue;
1800
							if ( strs[i].empty() ) continue;
1802
							Utils::String id = strs[i].token(";", dataPos);
1801
							Utils::WString id = strs[i].token(L";", dataPos);
1803
							load->AddShip(_US(id), "");
1802
							load->AddShip(_US(id), "");
1804
							list.pushBack(id, Utils::String::Number(e) + " " + section + ";" + strs[i]);
1803
							list.pushBack(id, Utils::WString::Number(e) + L" " + section + L";" + strs[i]);
1805
							++e;
1804
							++e;
1806
							--entries;
1805
							--entries;
1807
						}
1806
						}
1808
					}
1807
					}
1809
 
-
 
1810
					CLEANSPLIT(strs, max)
-
 
1811
				}
1808
				}
1812
				else if ( type == 0 )
1809
				else if ( type == 0 )
1813
				{
1810
				{
1814
					if ( entries2 )
1811
					if ( entries2 )
1815
					{
1812
					{
1816
						load->AddShip(_US(data), _US(str));
1813
						load->AddShip(_US(data), _US(str));
1817
						list.pushBack(data, section + ";" + data + ";" + str);
1814
						list.pushBack(data, section + L";" + data + L";" + str);
1818
						--entries2;
1815
						--entries2;
1819
					}
1816
					}
1820
					else
1817
					else
1821
					{
1818
					{
1822
						data = str.token(";", 1);
1819
						data = str.token(L";", 1);
1823
						entries2 = str.token(";", 2).toInt();
1820
						entries2 = str.token(L";", 2).toInt();
1824
						++e;
1821
						++e;
1825
						--entries;
1822
						--entries;
1826
					}
1823
					}
1827
				}
1824
				}
1828
				else
1825
				else
1829
				{
1826
				{
1830
					Utils::String id;
1827
					Utils::WString id;
1831
					if ( dataPos == -1 )
1828
					if ( dataPos == -1 )
1832
						id = str; 
1829
						id = str; 
1833
					else
1830
					else
1834
						id = str.token(";", dataPos); 
1831
						id = str.token(L";", dataPos); 
1835
 
1832
 
1836
					if ( dataPos2 )
1833
					if ( dataPos2 )
1837
						load->AddShip(_US(id), _US(str.token(";", dataPos2)));
1834
						load->AddShip(_US(id), _US(str.token(L";", dataPos2)));
1838
					else
1835
					else
1839
						load->AddShip(_US(id), "");
1836
						load->AddShip(_US(id), "");
1840
					if ( sections )
1837
					if ( sections )
1841
						list.pushBack(id, Utils::String::Number(e) + " " + section + ";" + str);
1838
						list.pushBack(id, Utils::WString::Number(e) + L" " + section + L";" + str);
1842
					else
1839
					else
1843
						list.pushBack(id, Utils::String::Number(e) + " " + str);
1840
						list.pushBack(id, Utils::WString::Number(e) + L" " + str);
1844
					++e;
1841
					++e;
1845
					--entries;
1842
					--entries;
1846
				}
1843
				}
1847
			}
1844
			}
1848
		}
1845
		}