Subversion Repositories spk

Rev

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

Rev 127 Rev 197
Line 15... Line 15...
15
	this->shipToolStripMenuItem1->Image = this->imageList1->Images[1];
15
	this->shipToolStripMenuItem1->Image = this->imageList1->Images[1];
16
	this->multiPackageToolStripMenuItem->Image = this->imageList1->Images[this->imageList1->Images->IndexOfKey("multi")];
16
	this->multiPackageToolStripMenuItem->Image = this->imageList1->Images[this->imageList1->Images->IndexOfKey("multi")];
17
	this->Closed += gcnew System::EventHandler(this, &Form1::CloseEvent);
17
	this->Closed += gcnew System::EventHandler(this, &Form1::CloseEvent);
18
 
18
 
19
	this->Text = "Package Creator " + GetVersionString();
19
	this->Text = "Package Creator " + GetVersionString();
20
	m_pLoadedList = new CyStringList;
20
	m_pLoadedList = new Utils::WStringList;
21
	_pGameDir = new CGameDirectories(_S(mydoc));
21
	_pGameDir = new CGameDirectories(_S(mydoc));
22
	_pGameDir->setLanguage(44);
22
	_pGameDir->setLanguage(44);
23
 
23
 
24
	// default settings
24
	// default settings
25
	m_settings = new SSettings;
25
	m_settings = new SSettings;
Line 119... Line 119...
119
}
119
}
120
 
120
 
121
 
121
 
122
String ^Form1::getShipSelection(CVirtualFileSystem *pVfs, System::String ^*shipName)
122
String ^Form1::getShipSelection(CVirtualFileSystem *pVfs, System::String ^*shipName)
123
{
123
{
124
	Utils::CStringList *ships = pVfs->getTShipsEntries();
124
	Utils::WStringList *ships = pVfs->getTShipsEntries();
125
	if ( ships ) {
125
	if ( ships ) {
126
		this->LoadText(pVfs);
126
		this->LoadText(pVfs);
127
 
127
 
128
		LoadShip ^ls = gcnew LoadShip();
128
		LoadShip ^ls = gcnew LoadShip();
129
		for(Utils::SStringList *str = ships->first(); str; str = ships->next()) {
129
		for(Utils::WStringNode *str = ships->first(); str; str = ships->next()) {
130
			int tId = str->str.token(";", 7).toLong();
130
			int tId = str->str.token(L";", 7).toLong();
131
			String ^name = _US(pVfs->findText(0, 17, tId));
131
			String ^name = _US(pVfs->findText(0, 17, tId));
132
			String ^race = (str->str.token(";", 46).toLong() == 0) ? "" : _US(pVfs->findText(0, 1266, str->str.token(";", 46).toLong()));
132
			String ^race = (str->str.token(L";", 46).toLong() == 0) ? "" : _US(pVfs->findText(0, 1266, str->str.token(L";", 46).toLong()));
133
			String ^text = race + " " + name;
133
			String ^text = race + " " + name;
134
			int variation = str->str.token(";", 51).toLong();
134
			int variation = str->str.token(L";", 51).toLong();
135
			if ( variation && variation != 20 )
135
			if ( variation && variation != 20 )
136
				text = text + " " + _US(pVfs->findText(0, 17, 10000 + variation));
136
				text = text + " " + _US(pVfs->findText(0, 17, 10000 + variation));
137
			ls->AddShip(_US(str->data), text);
137
			ls->AddShip(_US(str->data), text);
138
		}
138
		}
139
 
139
 
140
		if ( ls->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )	{
140
		if ( ls->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )	{
141
			Utils::String line = pVfs->getTShipsEntry(_S(ls->GetData()));
141
			Utils::WString line = pVfs->getTShipsEntry(_S(ls->GetData()));
142
	
142
	
143
			if ( !line.empty() ) {
143
			if ( !line.empty() ) {
144
				if ( shipName ) {
144
				if ( shipName ) {
145
					(*shipName) = ls->GetShipName();
145
					(*shipName) = ls->GetShipName();
146
				}
146
				}
Line 227... Line 227...
227
	SelectFilesystem ^Filesystem = gcnew SelectFilesystem(_pGameDir);
227
	SelectFilesystem ^Filesystem = gcnew SelectFilesystem(_pGameDir);
228
	if ( Filesystem->ShowDialog(this) != System::Windows::Forms::DialogResult::OK ) {
228
	if ( Filesystem->ShowDialog(this) != System::Windows::Forms::DialogResult::OK ) {
229
		return;
229
		return;
230
	}
230
	}
231
 
231
 
232
	Utils::String dir = Filesystem->gameDir();
232
	Utils::WString dir = Filesystem->gameDir();
233
	CyString mod;
233
	Utils::WString mod;
234
	if ( Filesystem->gameMod() ) {
234
	if ( Filesystem->gameMod() ) {
235
		mod = CyString(dir) + "/mods/" + CyStringFromSystemString(Filesystem->gameMod()) + ".cat";
235
		mod = dir + L"/mods/" + _WS(Filesystem->gameMod()) + L".cat";
236
	}
236
	}
237
 
237
 
238
	CVirtualFileSystem *vfs = _pGameDir->selectedVFS();
238
	CVirtualFileSystem *vfs = _pGameDir->selectedVFS();
239
 
239
 
240
	if ( !vfs ) {
240
	if ( !vfs ) {
241
		MessageBox::Show(this, "Error: Couldn't open Virtual File System", "Error Importing Ship", MessageBoxButtons::OK, MessageBoxIcon::Error);
241
		MessageBox::Show(this, "Error: Couldn't open Virtual File System", "Error Importing Ship", MessageBoxButtons::OK, MessageBoxIcon::Error);
242
		return;
242
		return;
243
	}
243
	}
244
 
244
 
245
	// load a mod on top of the VFS
245
	// load a mod on top of the VFS
246
	if ( !mod.Empty() ) {
246
	if ( !mod.empty() ) {
247
		if ( !vfs->loadMod(mod.ToString()) ) {
247
		if ( !vfs->loadMod(mod) ) {
248
			MessageBox::Show(this, "There was a problem trying to open the mod file\n" + Filesystem->gameMod(), "Error Importing Ship", MessageBoxButtons::OK, MessageBoxIcon::Error);
248
			MessageBox::Show(this, "There was a problem trying to open the mod file\n" + Filesystem->gameMod(), "Error Importing Ship", MessageBoxButtons::OK, MessageBoxIcon::Error);
249
			return;
249
			return;
250
		}
250
		}
251
		vfs->updateModTexts(17);
251
		vfs->updateModTexts(17);
252
	}
252
	}