Subversion Repositories spk

Rev

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

Rev 39 Rev 94
Line 63... Line 63...
63
 
63
 
64
	void CustomiseTurret::UpdateCockpits()
64
	void CustomiseTurret::UpdateCockpits()
65
	{
65
	{
66
		this->ComboCockpitStd->Items->Clear();
66
		this->ComboCockpitStd->Items->Clear();
67
		
67
		
68
		CyStringList *list = ((CustomiseShip ^)m_pParent)->GetCockpits();
68
		CGameDirectories *gameDir = ((CustomiseShip ^)m_pParent)->gameDirectories();
69
		if ( list || !list->Empty() )
-
 
70
		{
-
 
71
			for ( SStringList *str = list->Head(); str; str = str->next )
69
		for(Utils::String cockpit = gameDir->firstCockpit(); !cockpit.empty(); cockpit = gameDir->nextCockpit()) {
72
				this->ComboCockpitStd->Items->Add(SystemStringFromCyString(str->data));
70
			this->ComboCockpitStd->Items->Add(_US(cockpit));
73
		}
71
		}
74
 
72
 
75
		this->ComboCockpitCustom->Items->Clear();
73
		this->ComboCockpitCustom->Items->Clear();
76
		for ( SCockpit *c = m_pShipFile->GetCockpits()->First(); c; c = m_pShipFile->GetCockpits()->Next() )
74
		for ( SCockpit *c = m_pShipFile->GetCockpits()->First(); c; c = m_pShipFile->GetCockpits()->Next() )
77
			this->ComboCockpitCustom->Items->Add(_US(c->sCockpit.token(";", 19)));
75
			this->ComboCockpitCustom->Items->Add(_US(c->sCockpit.token(";", 19)));
Line 80... Line 78...
80
	void CustomiseTurret::UpdateTurrets()
78
	void CustomiseTurret::UpdateTurrets()
81
	{
79
	{
82
		this->ListTurret->Items->Clear();
80
		this->ListTurret->Items->Clear();
83
		int i = 0;
81
		int i = 0;
84
		for ( STurretEntry *t = m_pShipData->lTurrets.First(); t; t = m_pShipData->lTurrets.Next() )
82
		for ( STurretEntry *t = m_pShipData->lTurrets.First(); t; t = m_pShipData->lTurrets.Next() )
85
		{
83
		{
86
			if ( t == m_pShipData->lTurrets.Front()->Data() ) continue; // skip the first entry (its the cockpit not a turret
84
			if ( t == m_pShipData->lTurrets.Front()->Data() ) continue; // skip the first entry (its the cockpit not a turret
87
			ListViewItem ^item = this->ListTurret->Items->Add(gcnew ListViewItem(Convert::ToString(t->iIndex - 1)));
85
			ListViewItem ^item = this->ListTurret->Items->Add(gcnew ListViewItem(Convert::ToString(t->iIndex - 1)));
88
			if ( m_pShipData->cockpits[t->iTurret - 1].sCockpit.Empty() )
86
			if ( m_pShipData->cockpits[t->iTurret - 1].sCockpit.Empty() )
89
				item->SubItems->Add(Convert::ToString(m_pShipData->cockpits[t->iTurret - 1].iCockpit));
87
				item->SubItems->Add(Convert::ToString(m_pShipData->cockpits[t->iTurret - 1].iCockpit));
90
			else
88
			else
Line 117... Line 115...
117
			else
115
			else
118
			{
116
			{
119
				this->RadioCockpitCustom->Checked = true;
117
				this->RadioCockpitCustom->Checked = true;
120
				this->ComboCockpitCustom->Text = item->SubItems[1]->Text;
118
				this->ComboCockpitCustom->Text = item->SubItems[1]->Text;
121
				this->UpdateCockpitDisplay2();
119
				this->UpdateCockpitDisplay2();
122
			}
120
			}
123
		}
121
		}
124
		else
122
		else
125
		{
123
		{
126
			this->ComboCockpitStd->SelectedIndex = -1;
124
			this->ComboCockpitStd->SelectedIndex = -1;
127
		}
125
		}
128
	}
126
	}
Line 134... Line 132...
134
		{
132
		{
135
			this->TextCockpitScene->Text = SystemStringFromCyString(m_pCurrentCockpit->sCockpit.token(";", 8));
133
			this->TextCockpitScene->Text = SystemStringFromCyString(m_pCurrentCockpit->sCockpit.token(";", 8));
136
			this->UpdateCockpitWeaponsList();
134
			this->UpdateCockpitWeaponsList();
137
		}
135
		}
138
	}
136
	}
139
 
-
 
140
	void CustomiseTurret::UpdateCockpitWeaponsList()
137
	void CustomiseTurret::UpdateCockpitWeaponsList()
141
	{
138
	{
142
		this->ListWeaponCockpit->Items->Clear();
139
		this->ListWeaponCockpit->Items->Clear();
143
 
140
 
144
		if ( !m_pCurrentCockpit )
141
		if ( !m_pCurrentCockpit )
Line 148... Line 145...
148
		m_bUpdateing = true;
145
		m_bUpdateing = true;
149
 
146
 
150
		bool added = false;
147
		bool added = false;
151
 
148
 
152
		CyStringList List;
149
		CyStringList List;
153
		CyStringList *list = NULL;
-
 
154
		int mask = -1;
150
		int mask = -1;
155
		if ( this->ComboGameCockpit->SelectedIndex > 0 )
151
		if ( this->ComboGameCockpit->SelectedIndex > 0 )
156
		{
152
		{
157
			this->CheckWeaponDefaultCockpit->Visible = true;
153
			this->CheckWeaponDefaultCockpit->Visible = true;
158
			list = ((CustomiseShip ^)m_pParent)->GetLasers(this->ComboGameCockpit->SelectedIndex);
-
 
159
			for ( SWeaponMask *m = m_pCurrentCockpit->lWeaponMask.First(); m; m = m_pCurrentCockpit->lWeaponMask.Next() )
154
			for ( SWeaponMask *m = m_pCurrentCockpit->lWeaponMask.First(); m; m = m_pCurrentCockpit->lWeaponMask.Next() )
160
			{
155
			{
161
				if ( m->iGame == this->ComboGameCockpit->SelectedIndex )
156
				if ( m->iGame == this->ComboGameCockpit->SelectedIndex )
162
				{
157
				{
163
					mask = m->iMask;
158
					mask = m->iMask;
Line 171... Line 166...
171
			mask = m_pCurrentCockpit->sCockpit.token(";", 9);
166
			mask = m_pCurrentCockpit->sCockpit.token(";", 9);
172
			this->CheckWeaponDefaultCockpit->Visible = false;
167
			this->CheckWeaponDefaultCockpit->Visible = false;
173
			this->CheckWeaponDefaultCockpit->Checked = false;
168
			this->CheckWeaponDefaultCockpit->Checked = false;
174
		}
169
		}
175
		if ( mask == -1 ) mask = 0;
170
		if ( mask == -1 ) mask = 0;
-
 
171
		
176
		if ( list )
172
		if ( this->ComboGameCockpit->SelectedIndex > 0 )
177
		{
173
		{
-
 
174
			CGameDirectories *gameDir = ((CustomiseShip ^)m_pParent)->gameDirectories();
-
 
175
			gameDir->setSelectedGameDirectory(this->ComboGameCockpit->SelectedIndex, true);
178
			for ( SStringList *strNode = list->Head(); strNode; strNode = strNode->next )
176
			for ( std::pair<Utils::String, Utils::String> laser = gameDir->firstLaser(); !laser.first.empty(); laser = gameDir->nextLaser() ) {
179
			{
-
 
180
				CyString id = strNode->str.GetToken(";", 6, 6);
177
				Utils::String group = laser.first.token(";", 6);
181
				SStringList *found = List.FindString(id);
178
				SStringList *found = List.FindString(group);
182
				CyString str = (strNode->data.Empty()) ? strNode->str.GetToken(";", 23, 23) : strNode->data;
-
 
183
				if ( found )
179
				if ( found ) {
184
				{
-
 
185
					found->data += ", ";
180
					found->data += ", ";
186
					found->data += str;
181
					found->data += laser.second;
187
				}
182
				}
188
				else
183
				else
189
					List.PushBack(id, str);
184
					List.PushBack(CyString(group), CyString(laser.second));
190
			}
185
			}
-
 
186
			gameDir->reselectTemporaryDirectory();
191
		}
187
		}
192
 
188
 
193
		for ( int i = 0; i < 32; i++ )
189
		for ( int i = 0; i < 32; i++ )
194
		{
190
		{
195
			if ( List.Count() > i )
191
			if ( List.Count() > i )