Subversion Repositories spk

Rev

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

Rev 197 Rev 211
Line 11... Line 11...
11
{
11
{
12
	this->ClearLists();
12
	this->ClearLists();
13
}
13
}
14
 
14
 
15
 
15
 
16
Utils::String CShipData::createData() const
16
Utils::WString CShipData::createData() const
17
{
17
{
18
	Utils::String data = this->sModel;
18
	Utils::WString data = this->sModel;
19
	data.addToken(";", Utils::String::Number(this->iPictureID));
19
	data.addToken(L";", Utils::WString::Number(this->iPictureID));
20
	data.addToken(";", Utils::String::FromFloat(this->fRotX, -1));
20
	data.addToken(L";", Utils::WString::FromFloat(this->fRotX, -1));
21
	data.addToken(";", Utils::String::FromFloat(this->fRotY, -1));
21
	data.addToken(L";", Utils::WString::FromFloat(this->fRotY, -1));
22
	data.addToken(";", Utils::String::FromFloat(this->fRotZ, -1));
22
	data.addToken(L";", Utils::WString::FromFloat(this->fRotZ, -1));
23
	data.addToken(";", CShipData::ConvertShipSubType(this->iSubType));
23
	data.addToken(L";", CShipData::ConvertShipSubType(this->iSubType));
24
	data.addToken(";", Utils::String::Number(this->iDesc));
24
	data.addToken(L";", Utils::WString::Number(this->iDesc));
25
	data.addToken(";", Utils::String::Number(this->iSpeed));
25
	data.addToken(L";", Utils::WString::Number(this->iSpeed));
26
	data.addToken(";", Utils::String::Number(this->iAccel));
26
	data.addToken(L";", Utils::WString::Number(this->iAccel));
27
	data.addToken(";", Utils::String::Number(this->iEngineSound));
27
	data.addToken(L";", Utils::WString::Number(this->iEngineSound));
28
	data.addToken(";", Utils::String::Number(this->iReactionDelay));
28
	data.addToken(L";", Utils::WString::Number(this->iReactionDelay));
29
	data.addToken(";", Utils::String::Number(this->iEngineEffect));
29
	data.addToken(L";", Utils::WString::Number(this->iEngineEffect));
30
	data.addToken(";", Utils::String::Number(this->iEngineGlow));
30
	data.addToken(L";", Utils::WString::Number(this->iEngineGlow));
31
	data.addToken(";", Utils::String::Number(this->iPower));
31
	data.addToken(L";", Utils::WString::Number(this->iPower));
32
	data.addToken(";", Utils::String::Number(this->iSoundMin));
32
	data.addToken(L";", Utils::WString::Number(this->iSoundMin));
33
	data.addToken(";", Utils::String::Number(this->iSoundMax));
33
	data.addToken(L";", Utils::WString::Number(this->iSoundMax));
34
	data.addToken(";", this->sModelScene);
34
	data.addToken(L";", this->sModelScene);
35
	data.addToken(";", this->sCockpitScene);
35
	data.addToken(L";", this->sCockpitScene);
36
	data.addToken(";", Utils::String::Number(this->iLaserMask));
36
	data.addToken(L";", Utils::WString::Number(this->iLaserMask));
37
	data.addToken(";", Utils::String::Number(this->iGunCount));
37
	data.addToken(L";", Utils::WString::Number(this->iGunCount));
38
	data.addToken(";", Utils::String::Number(this->iLaserEnergy));
38
	data.addToken(L";", Utils::WString::Number(this->iLaserEnergy));
39
	data.addToken(";", Utils::String::FromFloat(this->fLaserRecharge, -1));
39
	data.addToken(L";", Utils::WString::FromFloat(this->fLaserRecharge, -1));
40
	data.addToken(";", Utils::String::Number(this->iShieldType));
40
	data.addToken(L";", Utils::WString::Number(this->iShieldType));
41
	data.addToken(";", Utils::String::Number(this->iMaxShields));
41
	data.addToken(L";", Utils::WString::Number(this->iMaxShields));
42
	data.addToken(";", Utils::String::Number(this->iMissileMask));
42
	data.addToken(L";", Utils::WString::Number(this->iMissileMask));
43
	data.addToken(";", Utils::String::Number(this->iMissileCount));
43
	data.addToken(L";", Utils::WString::Number(this->iMissileCount));
44
	data.addToken(";", Utils::String::Number(this->iSpeedExtension));
44
	data.addToken(L";", Utils::WString::Number(this->iSpeedExtension));
45
	data.addToken(";", Utils::String::Number(this->iSteeringExtension));
45
	data.addToken(L";", Utils::WString::Number(this->iSteeringExtension));
46
	data.addToken(";", Utils::String::Number(this->iCargoMin));
46
	data.addToken(L";", Utils::WString::Number(this->iCargoMin));
47
	data.addToken(";", Utils::String::Number(this->iCargoMax));
47
	data.addToken(L";", Utils::WString::Number(this->iCargoMax));
48
	data.addToken(";", Utils::String::Number(this->iWareListID));
48
	data.addToken(L";", Utils::WString::Number(this->iWareListID));
49
 
49
 
50
	// 6 turrets next
50
	// 6 turrets next
51
	for ( int i = 0; i < 6; i++ )
51
	for ( int i = 0; i < 6; i++ )
52
	{
52
	{
53
		if ( this->cockpits[i].sCockpit.empty() )
53
		if ( this->cockpits[i].sCockpit.empty() )
54
			data.addToken(";", Utils::String::Number(this->cockpits[i].iCockpit));
54
			data.addToken(L";", Utils::WString::Number(this->cockpits[i].iCockpit));
55
		else
55
		else
56
		{
56
		{
57
			if ( this->cockpits[i].iCockpit > -1 )
57
			if ( this->cockpits[i].iCockpit > -1 )
58
				data.addToken(";", this->cockpits[i].sCockpit + "(" + (long)this->cockpits[i].iCockpit + ")");
58
				data.addToken(L";", this->cockpits[i].sCockpit + L"(" + (long)this->cockpits[i].iCockpit + L")");
59
			else
59
			else
60
				data.addToken(";", this->cockpits[i].sCockpit);
60
				data.addToken(L";", this->cockpits[i].sCockpit);
61
		}
61
		}
62
		data.addToken(";", Utils::String::Number(this->cockpits[i].iPos));
62
		data.addToken(L";", Utils::WString::Number(this->cockpits[i].iPos));
63
	}
63
	}
64
 
64
 
65
	data.addToken(";", Utils::String::Number(this->iDocking));
65
	data.addToken(L";", Utils::WString::Number(this->iDocking));
66
	data.addToken(";", Utils::String::Number(this->iCargoClass));
66
	data.addToken(L";", Utils::WString::Number(this->iCargoClass));
67
	data.addToken(";", Utils::String::Number(this->iRace));
67
	data.addToken(L";", Utils::WString::Number(this->iRace));
68
	data.addToken(";", Utils::String::Number(this->iHull));
68
	data.addToken(L";", Utils::WString::Number(this->iHull));
69
	data.addToken(";", Utils::String::Number(this->iExplosionDef));
69
	data.addToken(L";", Utils::WString::Number(this->iExplosionDef));
70
	data.addToken(";", Utils::String::Number(this->iExplosionBody));
70
	data.addToken(L";", Utils::WString::Number(this->iExplosionBody));
71
	data.addToken(";", Utils::String::Number(this->iParticle));
71
	data.addToken(L";", Utils::WString::Number(this->iParticle));
72
	data.addToken(";", Utils::String::Number(this->iVariation));
72
	data.addToken(L";", Utils::WString::Number(this->iVariation));
73
	data.addToken(";", Utils::String::Number(this->iRotationAccel));
73
	data.addToken(L";", Utils::WString::Number(this->iRotationAccel));
74
	data.addToken(";", Utils::String::Number(this->iClass));
74
	data.addToken(L";", Utils::WString::Number(this->iClass));
75
	data.addToken(";", Utils::String::Number(this->iTurretCount));
75
	data.addToken(L";", Utils::WString::Number(this->iTurretCount));
76
 
76
 
77
	// now do the turrets
77
	// now do the turrets
78
	for ( int i = 0; i < this->iTurretCount; i++ )
78
	for ( int i = 0; i < this->iTurretCount; i++ )
79
	{
79
	{
80
		STurretEntry *t = this->lTurrets[i];
80
		STurretEntry *t = this->lTurrets[i];
81
		data.addToken(";", Utils::String::Number(t->iIndex));
81
		data.addToken(L";", Utils::WString::Number(t->iIndex));
82
		data.addToken(";", Utils::String::Number(t->iTurret));
82
		data.addToken(L";", Utils::WString::Number(t->iTurret));
83
		data.addToken(";", t->sModel);
83
		data.addToken(L";", t->sModel);
84
		data.addToken(";", Utils::String::Number(t->iSceneNode));
84
		data.addToken(L";", Utils::WString::Number(t->iSceneNode));
85
	}
85
	}
86
 
86
 
87
	// the gun entries next
87
	// the gun entries next
88
	data.addToken(";", Utils::String::Number(this->iGunsCount));
88
	data.addToken(L";", Utils::WString::Number(this->iGunsCount));
89
	for ( int i = 0; i < this->iGunsCount; i++ )
89
	for ( int i = 0; i < this->iGunsCount; i++ )
90
	{
90
	{
91
		SGunGroup *g = this->lGuns[i];
91
		SGunGroup *g = this->lGuns[i];
92
		data.addToken(";", Utils::String::Number(g->iGunIndex));
92
		data.addToken(L";", Utils::WString::Number(g->iGunIndex));
93
		data.addToken(";", Utils::String::Number(g->iLaserCount));
93
		data.addToken(L";", Utils::WString::Number(g->iLaserCount));
94
		data.addToken(";", Utils::String::Number(g->iIndex));
94
		data.addToken(L";", Utils::WString::Number(g->iIndex));
95
		data.addToken(";", Utils::String::Number(g->iWeaponCount));
95
		data.addToken(L";", Utils::WString::Number(g->iWeaponCount));
96
		for ( int j = 0; j < g->iWeaponCount; j++ )
96
		for ( int j = 0; j < g->iWeaponCount; j++ )
97
		{
97
		{
98
			SWeaponGroup *w = g->lWeapons[j];
98
			SWeaponGroup *w = g->lWeapons[j];
99
			data.addToken(";", Utils::String::Number(w->iGunIndex));
99
			data.addToken(L";", Utils::WString::Number(w->iGunIndex));
100
			data.addToken(";", Utils::String::Number(w->iLaser));
100
			data.addToken(L";", Utils::WString::Number(w->iLaser));
101
			data.addToken(";", w->sModel1);
101
			data.addToken(L";", w->sModel1);
102
			data.addToken(";", Utils::String::Number(w->iNode1));
102
			data.addToken(L";", Utils::WString::Number(w->iNode1));
103
			data.addToken(";", w->sModel2);
103
			data.addToken(L";", w->sModel2);
104
			data.addToken(";", Utils::String::Number(w->iNode2));
104
			data.addToken(L";", Utils::WString::Number(w->iNode2));
105
		}
105
		}
106
	}
106
	}
107
 
107
 
108
	// now the rest of the data
108
	// now the rest of the data
109
	data.addToken(";", Utils::String::Number(this->iVolumn));
109
	data.addToken(L";", Utils::WString::Number(this->iVolumn));
110
	data.addToken(";", Utils::String::Number(this->iRelVal));
110
	data.addToken(L";", Utils::WString::Number(this->iRelVal));
111
	data.addToken(";", Utils::String::Number(this->iPriceMod1));
111
	data.addToken(L";", Utils::WString::Number(this->iPriceMod1));
112
	data.addToken(";", Utils::String::Number(this->iPriceMod2));
112
	data.addToken(L";", Utils::WString::Number(this->iPriceMod2));
113
	data.addToken(";", Utils::String::Number(this->iSize));
113
	data.addToken(L";", Utils::WString::Number(this->iSize));
114
	data.addToken(";", Utils::String::Number(this->iRelValPlayer));
114
	data.addToken(L";", Utils::WString::Number(this->iRelValPlayer));
115
	data.addToken(";", Utils::String::Number(this->iMinNoto));
115
	data.addToken(L";", Utils::WString::Number(this->iMinNoto));
116
	data.addToken(";", Utils::String::Number(this->iVideoID));
116
	data.addToken(L";", Utils::WString::Number(this->iVideoID));
117
	data.addToken(";", Utils::String::Number(this->iSkin));
117
	data.addToken(L";", Utils::WString::Number(this->iSkin));
118
	data.addToken(";", this->sID.toString());
118
	data.addToken(L";", this->sID);
119
	data += ";"; // add the end ;
119
	data += L";"; // add the end ;
120
 
120
 
121
	return data;
121
	return data;
122
}
122
}
123
 
123
 
124
void CShipData::CreateDefault()
124
void CShipData::CreateDefault()
125
{
125
{
126
	this->sModel = "0";
126
	this->sModel = L"0";
127
	this->iPictureID = 0;
127
	this->iPictureID = 0;
128
	this->fRotX = 0.00f;
128
	this->fRotX = 0.00f;
129
	this->fRotY = 0.00f;
129
	this->fRotY = 0.00f;
130
	this->fRotZ = 0.00f;
130
	this->fRotZ = 0.00f;
131
	this->iSubType = 0;
131
	this->iSubType = 0;
Line 137... Line 137...
137
	this->iEngineEffect = 5;
137
	this->iEngineEffect = 5;
138
	this->iEngineGlow = 37;
138
	this->iEngineGlow = 37;
139
	this->iPower = 0;
139
	this->iPower = 0;
140
	this->iSoundMin = 112;
140
	this->iSoundMin = 112;
141
	this->iSoundMax = 202;
141
	this->iSoundMax = 202;
142
	this->sModelScene = "";
142
	this->sModelScene = L"";
143
	this->sCockpitScene = "";
143
	this->sCockpitScene = L"";
144
	this->iLaserMask = 0;
144
	this->iLaserMask = 0;
145
	this->iGunCount = 0;
145
	this->iGunCount = 0;
146
	this->iLaserEnergy = 0;
146
	this->iLaserEnergy = 0;
147
	this->fLaserRecharge = 0.00f;
147
	this->fLaserRecharge = 0.00f;
148
	this->iShieldType = 0;
148
	this->iShieldType = 0;
Line 187... Line 187...
187
	for ( SGunGroup *g = this->lGuns.First(); g; g = this->lGuns.Next() )
187
	for ( SGunGroup *g = this->lGuns.First(); g; g = this->lGuns.Next() )
188
		g->lWeapons.MemoryClear();
188
		g->lWeapons.MemoryClear();
189
	this->lGuns.MemoryClear();
189
	this->lGuns.MemoryClear();
190
}
190
}
191
 
191
 
192
bool CShipData::readShipData(const Utils::String &a_data)
192
bool CShipData::readShipData(const Utils::WString &a_data)
193
{
193
{
194
	int max;
194
	std::vector<Utils::WString> entries;
195
	Utils::String *entries = a_data.tokenise(";", &max);
195
	a_data.tokenise(L";", entries);
-
 
196
 
196
	if ( max &gt;= 60 && entries )
197
	if (entries.size() &gt;= 60)
197
	{
198
	{
198
		this->sModel = entries[0];
199
		this->sModel = entries[0];
199
		this->iPictureID = entries[1].toInt();
200
		this->iPictureID = entries[1].toInt();
200
		this->fRotX = entries[2].toFloat();
201
		this->fRotX = entries[2].toFloat();
201
		this->fRotY = entries[3].toFloat();
202
		this->fRotY = entries[3].toFloat();
Line 237... Line 238...
237
				this->cockpits[i].iCockpit = entries[(i * 2) + 31].toInt();
238
				this->cockpits[i].iCockpit = entries[(i * 2) + 31].toInt();
238
			else
239
			else
239
			{
240
			{
240
				this->cockpits[i].sCockpit = entries[(i * 2) + 31];
241
				this->cockpits[i].sCockpit = entries[(i * 2) + 31];
241
				this->cockpits[i].iCockpit = -1; // custom cockpit
242
				this->cockpits[i].iCockpit = -1; // custom cockpit
242
				if ( this->cockpits[i].sCockpit.contains("(") ) {
243
				if ( this->cockpits[i].sCockpit.contains(L"(") ) {
243
					this->cockpits[i].iCockpit = this->cockpits[i].sCockpit.tokens("(", 2).token(")", 1).toInt();
244
					this->cockpits[i].iCockpit = this->cockpits[i].sCockpit.tokens(L"(", 2).token(L")", 1).toInt();
244
					this->cockpits[i].sCockpit = this->cockpits[i].sCockpit.token("(", 1);
245
					this->cockpits[i].sCockpit = this->cockpits[i].sCockpit.token(L"(", 1);
245
				}
246
				}
246
			}
247
			}
247
		}
248
		}
248
 
249
 
249
		this->iDocking = entries[43].toInt();
250
		this->iDocking = entries[43].toInt();
Line 279... Line 280...
279
			this->iTurretCount = 1;
280
			this->iTurretCount = 1;
280
			STurretEntry *t = this->lTurrets.push_back(new STurretEntry);
281
			STurretEntry *t = this->lTurrets.push_back(new STurretEntry);
281
			t->iIndex = 0;
282
			t->iIndex = 0;
282
			t->iTurret = 1;
283
			t->iTurret = 1;
283
			t->iSceneNode = 0;
284
			t->iSceneNode = 0;
284
			t->sModel = "0";
285
			t->sModel = L"0";
285
		}
286
		}
286
 
287
 
287
		// next pos should be gun count
288
		// next pos should be gun count
288
		this->iGunsCount = entries[pos].toInt();
289
		this->iGunsCount = entries[pos].toInt();
289
		++pos;
290
		++pos;
Line 330... Line 331...
330
		this->iSize = entries[pos + 4].toInt();
331
		this->iSize = entries[pos + 4].toInt();
331
		this->iRelValPlayer = entries[pos + 5].toInt();
332
		this->iRelValPlayer = entries[pos + 5].toInt();
332
		this->iMinNoto = entries[pos + 6].toInt();
333
		this->iMinNoto = entries[pos + 6].toInt();
333
		this->iVideoID = entries[pos + 7].toInt();
334
		this->iVideoID = entries[pos + 7].toInt();
334
		this->iSkin = entries[pos + 8].toInt();
335
		this->iSkin = entries[pos + 8].toInt();
335
		this->sID = entries[pos + 9].toWString();
336
		this->sID = entries[pos + 9];
336
 
337
 
337
		this->UpdateGunEntries();
338
		this->UpdateGunEntries();
338
 
-
 
339
		CLEANSPLIT(entries, max);
-
 
340
 
339
 
341
		this->_capValues();
340
		this->_capValues();
342
 
341
 
343
		return true;
342
		return true;
344
	}
343
	}
345
 
-
 
346
	CLEANSPLIT(entries, max);
-
 
347
 
344
 
348
	return false;
345
	return false;
349
}
346
}
350
 
347
 
351
void CShipData::_capValues()
348
void CShipData::_capValues()
Line 405... Line 402...
405
	}
402
	}
406
 
403
 
407
	return 0;
404
	return 0;
408
}
405
}
409
 
406
 
410
int CShipData::ConvertShipClass(const Utils::String &shipclass)
407
int CShipData::ConvertShipClass(const Utils::WString &shipclass)
411
{
408
{
412
	for ( int i = 0; i < OBJ_SHIP_MAX; i++ )
409
	for ( int i = 0; i < OBJ_SHIP_MAX; i++ )
413
	{
410
	{
414
		int c = CShipData::GetShipClassFromNum(i);
411
		int c = CShipData::GetShipClassFromNum(i);
415
		if ( CShipData::ConvertShipClass(c).Compare(shipclass) )
412
		if ( CShipData::ConvertShipClass(c).Compare(shipclass) )
Line 417... Line 414...
417
	}
414
	}
418
 
415
 
419
	return OBJ_SHIP_TL;
416
	return OBJ_SHIP_TL;
420
}
417
}
421
 
418
 
422
Utils::String CShipData::ConvertShipClass(int shipclass)
419
Utils::WString CShipData::ConvertShipClass(int shipclass)
423
{
420
{
424
	switch ( shipclass )
421
	switch ( shipclass )
425
	{
422
	{
426
		case OBJ_SHIP_TL:
423
		case OBJ_SHIP_TL:
427
			return "OBJ_SHIP_TL";
424
			return L"OBJ_SHIP_TL";
428
		case OBJ_SHIP_TS:
425
		case OBJ_SHIP_TS:
429
			return "OBJ_SHIP_TS";
426
			return L"OBJ_SHIP_TS";
430
		case OBJ_SHIP_TP:
427
		case OBJ_SHIP_TP:
431
			return "OBJ_SHIP_TP";
428
			return L"OBJ_SHIP_TP";
432
		case OBJ_SHIP_TM:
429
		case OBJ_SHIP_TM:
433
			return "OBJ_SHIP_TS";
430
			return L"OBJ_SHIP_TS";
434
		case OBJ_SHIP_TL_PIRATE:
431
		case OBJ_SHIP_TL_PIRATE:
435
			return "OBJ_SHIP_TL_PIRATE";
432
			return L"OBJ_SHIP_TL_PIRATE";
436
		case OBJ_SHIP_TS_PIRATE:
433
		case OBJ_SHIP_TS_PIRATE:
437
			return "OBJ_SHIP_TS_PIRATE";
434
			return L"OBJ_SHIP_TS_PIRATE";
438
		case OBJ_SHIP_GONER:
435
		case OBJ_SHIP_GONER:
439
			return "OBJ_SHIP_GONER";
436
			return L"OBJ_SHIP_GONER";
440
		case OBJ_SHIP_M0:
437
		case OBJ_SHIP_M0:
441
			return "OBJ_SHIP_M0";
438
			return L"OBJ_SHIP_M0";
442
		case OBJ_SHIP_M1:
439
		case OBJ_SHIP_M1:
443
			return "OBJ_SHIP_M1";
440
			return L"OBJ_SHIP_M1";
444
		case OBJ_SHIP_M2:
441
		case OBJ_SHIP_M2:
445
			return "OBJ_SHIP_M2";
442
			return L"OBJ_SHIP_M2";
446
		case OBJ_SHIP_M3:
443
		case OBJ_SHIP_M3:
447
			return "OBJ_SHIP_M3";
444
			return L"OBJ_SHIP_M3";
448
		case OBJ_SHIP_M4:
445
		case OBJ_SHIP_M4:
449
			return "OBJ_SHIP_M4";
446
			return L"OBJ_SHIP_M4";
450
		case OBJ_SHIP_M5:
447
		case OBJ_SHIP_M5:
451
			return "OBJ_SHIP_M5";
448
			return L"OBJ_SHIP_M5";
452
		case OBJ_SHIP_M6:
449
		case OBJ_SHIP_M6:
453
			return "OBJ_SHIP_M6";
450
			return L"OBJ_SHIP_M6";
454
		case OBJ_SHIP_M7:
451
		case OBJ_SHIP_M7:
455
			return "OBJ_SHIP_M7";
452
			return L"OBJ_SHIP_M7";
456
		case OBJ_SHIP_M8:
453
		case OBJ_SHIP_M8:
457
			return "OBJ_SHIP_M8";
454
			return L"OBJ_SHIP_M8";
458
	}
455
	}
459
 
456
 
460
	return "OBJ_SHIP_TL";
457
	return L"OBJ_SHIP_TL";
461
}
458
}
462
 
459
 
463
Utils::String CShipData::ConvertShipSubType(int subtype)
460
Utils::WString CShipData::ConvertShipSubType(int subtype)
464
{
461
{
465
	switch ( subtype )
462
	switch ( subtype )
466
	{
463
	{
467
		case SG_SH_TL:
464
		case SG_SH_TL:
468
			return "SG_SH_TL";
465
			return L"SG_SH_TL";
469
		case SG_SH_TS:
466
		case SG_SH_TS:
470
			return "SG_SH_TS";
467
			return L"SG_SH_TS";
471
		case SG_SH_M0:
468
		case SG_SH_M0:
472
			return "SG_SH_M0";
469
			return L"SG_SH_M0";
473
		case SG_SH_M1:
470
		case SG_SH_M1:
474
			return "SG_SH_M1";
471
			return L"SG_SH_M1";
475
		case SG_SH_M2:
472
		case SG_SH_M2:
476
			return "SG_SH_M2";
473
			return L"SG_SH_M2";
477
		case SG_SH_M3:
474
		case SG_SH_M3:
478
			return "SG_SH_M3";
475
			return L"SG_SH_M3";
479
		case SG_SH_M4:
476
		case SG_SH_M4:
480
			return "SG_SH_M4";
477
			return L"SG_SH_M4";
481
		case SG_SH_M5:
478
		case SG_SH_M5:
482
			return "SG_SH_M5";
479
			return L"SG_SH_M5";
483
		case SG_SH_TL_P:
480
		case SG_SH_TL_P:
484
			return "SG_SH_TL_P";
481
			return L"SG_SH_TL_P";
485
		case SG_SH_TS_P:
482
		case SG_SH_TS_P:
486
			return "SG_SH_TS_P";
483
			return L"SG_SH_TS_P";
487
		case SG_SH_GO:
484
		case SG_SH_GO:
488
			return "SG_SH_GO";
485
			return L"SG_SH_GO";
489
		case SG_SH_M6:
486
		case SG_SH_M6:
490
			return "SG_SH_M6";
487
			return L"SG_SH_M6";
491
		case SG_SH_TP:
488
		case SG_SH_TP:
492
			return "SG_SH_TP";
489
			return L"SG_SH_TP";
493
		case SG_SH_M7:
490
		case SG_SH_M7:
494
			return "SG_SH_M7";
491
			return L"SG_SH_M7";
495
		case SG_SH_TM:
492
		case SG_SH_TM:
496
			return "SG_SH_TM";
493
			return L"SG_SH_TM";
497
		case SG_SH_M8:
494
		case SG_SH_M8:
498
			return "SG_SH_M8";
495
			return L"SG_SH_M8";
499
	}
496
	}
500
 
497
 
501
	return "SG_SH_TL";
498
	return L"SG_SH_TL";
502
}
499
}
503
 
500
 
504
int CShipData::ConvertShipSubType(const Utils::String &subtype)
501
int CShipData::ConvertShipSubType(const Utils::WString &subtype)
505
{
502
{
506
	int num = 0;
503
	int num = 0;
507
	for ( int i = 0; i < SG_SH_MAX; i++ )
504
	for ( int i = 0; i < SG_SH_MAX; i++ )
508
	{
505
	{
509
		if ( subtype.Compare(CShipData::ConvertShipSubType(i)) )
506
		if ( subtype.Compare(CShipData::ConvertShipSubType(i)) )
Line 540... Line 537...
540
		}
537
		}
541
 
538
 
542
		// zero out the remaining
539
		// zero out the remaining
543
		this->cockpits[5].iCockpit = 0;
540
		this->cockpits[5].iCockpit = 0;
544
		this->cockpits[5].iPos = 0;
541
		this->cockpits[5].iPos = 0;
545
		this->cockpits[5].sCockpit = "";
542
		this->cockpits[5].sCockpit = L"";
546
 
543
 
547
		// now remove the gun entries connected to the turret
544
		// now remove the gun entries connected to the turret
548
		SGunGroup *g = this->lGuns.Get(t);
545
		SGunGroup *g = this->lGuns.Get(t);
549
		if ( g )
546
		if ( g )
550
		{
547
		{
Line 571... Line 568...
571
		g->iLaserCount = 0;
568
		g->iLaserCount = 0;
572
		for ( CListNode<SWeaponGroup> *wNode = g->lWeapons.Front(); wNode; wNode = wNode->next() )
569
		for ( CListNode<SWeaponGroup> *wNode = g->lWeapons.Front(); wNode; wNode = wNode->next() )
573
		{
570
		{
574
			SWeaponGroup *w = wNode->Data();
571
			SWeaponGroup *w = wNode->Data();
575
 
572
 
576
			if ( (w->iNode1 > 0 || (w->iNode1 == 0 && w->sModel1 != "0")) && !w->sModel1.empty() )
573
			if ( (w->iNode1 > 0 || (w->iNode1 == 0 && w->sModel1 != L"0")) && !w->sModel1.empty() )
577
			{
574
			{
578
				w->iLaser = 1;
575
				w->iLaser = 1;
579
				if ( (w->iNode2 > 0 || (w->iNode2 == 0 && w->sModel2 != "0")) && !w->sModel2.empty() )
576
				if ( (w->iNode2 > 0 || (w->iNode2 == 0 && w->sModel2 != L"0")) && !w->sModel2.empty() )
580
					w->iLaser = 2;
577
					w->iLaser = 2;
581
			}
578
			}
582
			else
579
			else
583
			{
580
			{
584
				w->iLaser = 0;
581
				w->iLaser = 0;
585
				w->iNode2 = -1;
582
				w->iNode2 = -1;
586
				w->sModel2 = "";
583
				w->sModel2 = L"";
587
			}
584
			}
588
 
585
 
589
			w->iGunIndex = gunindex;
586
			w->iGunIndex = gunindex;
590
			gunindex += w->iLaser;
587
			gunindex += w->iLaser;
591
			g->iLaserCount += w->iLaser;
588
			g->iLaserCount += w->iLaser;
Line 608... Line 605...
608
{
605
{
609
	for ( int i = 0; i < 6; i++ )
606
	for ( int i = 0; i < 6; i++ )
610
	{
607
	{
611
		this->cockpits[i].iCockpit = 0;
608
		this->cockpits[i].iCockpit = 0;
612
		this->cockpits[i].iPos = 0;
609
		this->cockpits[i].iPos = 0;
613
		this->cockpits[i].sCockpit = "";
610
		this->cockpits[i].sCockpit = L"";
614
	}
611
	}
615
 
612
 
616
	while ( this->lTurrets.size() > 1 )
613
	while ( this->lTurrets.size() > 1 )
617
		this->lTurrets.erase(1, true);
614
		this->lTurrets.erase(1, true);
618
	while ( this->lGuns.size() > 1 )
615
	while ( this->lGuns.size() > 1 )
Line 640... Line 637...
640
	g->iLaserCount = 0;
637
	g->iLaserCount = 0;
641
	SWeaponGroup *w = new SWeaponGroup;
638
	SWeaponGroup *w = new SWeaponGroup;
642
	w->iLaser = 0;
639
	w->iLaser = 0;
643
	w->iNode1 = 0;
640
	w->iNode1 = 0;
644
	w->iNode2 = -1;
641
	w->iNode2 = -1;
645
	w->sModel1 = "0";
642
	w->sModel1 = L"0";
646
	g->lWeapons.push_back(w);
643
	g->lWeapons.push_back(w);
647
	
644
	
648
	this->lTurrets.push_back(t);
645
	this->lTurrets.push_back(t);
649
	this->lGuns.push_back(g);
646
	this->lGuns.push_back(g);
650
 
647
 
Line 652... Line 649...
652
	++this->iGunsCount;
649
	++this->iGunsCount;
653
 
650
 
654
	this->UpdateGunEntries();
651
	this->UpdateGunEntries();
655
}
652
}
656
 
653
 
657
Utils::String CShipData::ConvertMissileGroup(int type)
654
Utils::WString CShipData::ConvertMissileGroup(int type)
658
{
655
{
659
	switch ( type )
656
	switch ( type )
660
	{
657
	{
661
		case SG_MISSILE_LIGHT:
658
		case SG_MISSILE_LIGHT:
662
			return "SG_MISSILE_LIGHT";
659
			return L"SG_MISSILE_LIGHT";
663
		case SG_MISSILE_MEDIUM:
660
		case SG_MISSILE_MEDIUM:
664
			return "SG_MISSILE_MEDIUM";
661
			return L"SG_MISSILE_MEDIUM";
665
		case SG_MISSILE_HEAVY:
662
		case SG_MISSILE_HEAVY:
666
			return "SG_MISSILE_HEAVY";
663
			return L"SG_MISSILE_HEAVY";
667
		case SG_MISSILE_TR_LIGHT:
664
		case SG_MISSILE_TR_LIGHT:
668
			return "SG_MISSILE_TR_LIGHT";
665
			return L"SG_MISSILE_TR_LIGHT";
669
		case SG_MISSILE_TR_MEDIUM:
666
		case SG_MISSILE_TR_MEDIUM:
670
			return "SG_MISSILE_TR_MEDIUM";
667
			return L"SG_MISSILE_TR_MEDIUM";
671
		case SG_MISSILE_TR_HEAVY:
668
		case SG_MISSILE_TR_HEAVY:
672
			return "SG_MISSILE_TR_HEAVY";
669
			return L"SG_MISSILE_TR_HEAVY";
673
		case SG_MISSILE_KHAAK:
670
		case SG_MISSILE_KHAAK:
674
			return "SG_MISSILE_KHAAK";
671
			return L"SG_MISSILE_KHAAK";
675
		case SG_MISSILE_BOMBER:
672
		case SG_MISSILE_BOMBER:
676
			return "SG_MISSILE_BOMBOER";
673
			return L"SG_MISSILE_BOMBOER";
677
		case SG_MISSILE_TORP_CAPTIAL:
674
		case SG_MISSILE_TORP_CAPTIAL:
678
			return "SG_MISSILE_TORP_CAPTIAL";
675
			return L"SG_MISSILE_TORP_CAPTIAL";
679
		case SG_MISSILE_AF_CAPTIAL:
676
		case SG_MISSILE_AF_CAPTIAL:
680
			return "SG_MISSILE_AF_CAPTIAL";
677
			return L"SG_MISSILE_AF_CAPTIAL";
681
		case SG_MISSILE_TR_BOMBER:
678
		case SG_MISSILE_TR_BOMBER:
682
			return "SG_MISSILE_TR_BOMBER";
679
			return L"SG_MISSILE_TR_BOMBER";
683
		case SG_MISSILE_TR_TORP_CAPTIAL:
680
		case SG_MISSILE_TR_TORP_CAPTIAL:
684
			return "SG_MISSILE_TR_TORP_CAPTIAL";
681
			return L"SG_MISSILE_TR_TORP_CAPTIAL";
685
		case SG_MISSILE_TR_AF_CAPTIAL:
682
		case SG_MISSILE_TR_AF_CAPTIAL:
686
			return "SG_MISSILE_TR_AF_CAPTIAL";
683
			return L"SG_MISSILE_TR_AF_CAPTIAL";
687
		case SG_MISSILE_BOARDINGPOD:
684
		case SG_MISSILE_BOARDINGPOD:
688
			return "SG_MISSILE_BOARDINGPOD";
685
			return L"SG_MISSILE_BOARDINGPOD";
689
		case SG_MISSILE_DMBF:
686
		case SG_MISSILE_DMBF:
690
			return "SG_MISSILE_DMBF";
687
			return L"SG_MISSILE_DMBF";
691
	}
688
	}
692
 
689
 
693
	return "";
690
	return L"";
694
}
691
}
695
 
692
 
696
int CShipData::ConvertMissileGroupToID(int type)
693
int CShipData::ConvertMissileGroupToID(int type)
697
{
694
{
698
	int arr[] = {SG_MISSILE_LIGHT, SG_MISSILE_MEDIUM, SG_MISSILE_HEAVY, SG_MISSILE_TR_LIGHT, SG_MISSILE_TR_MEDIUM, SG_MISSILE_TR_HEAVY, SG_MISSILE_KHAAK, SG_MISSILE_BOMBER, SG_MISSILE_TORP_CAPTIAL, 
695
	int arr[] = {SG_MISSILE_LIGHT, SG_MISSILE_MEDIUM, SG_MISSILE_HEAVY, SG_MISSILE_TR_LIGHT, SG_MISSILE_TR_MEDIUM, SG_MISSILE_TR_HEAVY, SG_MISSILE_KHAAK, SG_MISSILE_BOMBER, SG_MISSILE_TORP_CAPTIAL, 
Line 704... Line 701...
704
	}
701
	}
705
 
702
 
706
	return 0; 
703
	return 0; 
707
}
704
}
708
 
705
 
709
int CShipData::ConvertMissileGroupToID(const Utils::String &type)
706
int CShipData::ConvertMissileGroupToID(const Utils::WString &type)
710
{
707
{
711
	return CShipData::ConvertMissileGroupToID(CShipData::ConvertMissileGroup(type));
708
	return CShipData::ConvertMissileGroupToID(CShipData::ConvertMissileGroup(type));
712
}
709
}
713
 
710
 
714
int CShipData::ConvertMissileGroup(const Utils::String &type)
711
int CShipData::ConvertMissileGroup(const Utils::WString &type)
715
{
712
{
716
	if ( type.Compare("SG_MISSILE_LIGHT") )
713
	if ( type.Compare(L"SG_MISSILE_LIGHT") )
717
		return SG_MISSILE_LIGHT;
714
		return SG_MISSILE_LIGHT;
718
	if ( type.Compare("SG_MISSILE_MEDIUM") )
715
	if ( type.Compare(L"SG_MISSILE_MEDIUM") )
719
		return SG_MISSILE_MEDIUM;
716
		return SG_MISSILE_MEDIUM;
720
	if ( type.Compare("SG_MISSILE_HEAVY") )
717
	if ( type.Compare(L"SG_MISSILE_HEAVY") )
721
		return SG_MISSILE_HEAVY;
718
		return SG_MISSILE_HEAVY;
722
	if ( type.Compare("SG_MISSILE_TR_LIGHT") )
719
	if ( type.Compare(L"SG_MISSILE_TR_LIGHT") )
723
		return SG_MISSILE_TR_LIGHT;
720
		return SG_MISSILE_TR_LIGHT;
724
	if ( type.Compare("SG_MISSILE_TR_MEDIUM") )
721
	if ( type.Compare(L"SG_MISSILE_TR_MEDIUM") )
725
		return SG_MISSILE_TR_MEDIUM;
722
		return SG_MISSILE_TR_MEDIUM;
726
	if ( type.Compare("SG_MISSILE_TR_HEAVY") )
723
	if ( type.Compare(L"SG_MISSILE_TR_HEAVY") )
727
		return SG_MISSILE_TR_HEAVY;
724
		return SG_MISSILE_TR_HEAVY;
728
	if ( type.Compare("SG_MISSILE_KHAAK") )
725
	if ( type.Compare(L"SG_MISSILE_KHAAK") )
729
		return SG_MISSILE_KHAAK;
726
		return SG_MISSILE_KHAAK;
730
	if ( type.Compare("SG_MISSILE_BOMBER") )
727
	if ( type.Compare(L"SG_MISSILE_BOMBER") )
731
		return SG_MISSILE_BOMBER;
728
		return SG_MISSILE_BOMBER;
732
	if ( type.Compare("SG_MISSILE_TORP_CAPTIAL") )
729
	if ( type.Compare(L"SG_MISSILE_TORP_CAPTIAL") )
733
		return SG_MISSILE_TORP_CAPTIAL;
730
		return SG_MISSILE_TORP_CAPTIAL;
734
	if ( type.Compare("SG_MISSILE_AF_CAPTIAL") )
731
	if ( type.Compare(L"SG_MISSILE_AF_CAPTIAL") )
735
		return SG_MISSILE_AF_CAPTIAL;
732
		return SG_MISSILE_AF_CAPTIAL;
736
	if ( type.Compare("SG_MISSILE_TR_BOMBER") )
733
	if ( type.Compare(L"SG_MISSILE_TR_BOMBER") )
737
		return SG_MISSILE_TR_BOMBER;
734
		return SG_MISSILE_TR_BOMBER;
738
	if ( type.Compare("SG_MISSILE_TR_TORP_CAPTIAL") )
735
	if ( type.Compare(L"SG_MISSILE_TR_TORP_CAPTIAL") )
739
		return SG_MISSILE_TR_TORP_CAPTIAL;
736
		return SG_MISSILE_TR_TORP_CAPTIAL;
740
	if ( type.Compare("SG_MISSILE_TR_AF_CAPTIAL") )
737
	if ( type.Compare(L"SG_MISSILE_TR_AF_CAPTIAL") )
741
		return SG_MISSILE_TR_AF_CAPTIAL;
738
		return SG_MISSILE_TR_AF_CAPTIAL;
742
	if ( type.Compare("SG_MISSILE_BOARDINGPOD") )
739
	if ( type.Compare(L"SG_MISSILE_BOARDINGPOD") )
743
		return SG_MISSILE_BOARDINGPOD;
740
		return SG_MISSILE_BOARDINGPOD;
744
	if ( type.Compare("SG_MISSILE_DMBF") )
741
	if ( type.Compare(L"SG_MISSILE_DMBF") )
745
		return SG_MISSILE_DMBF;
742
		return SG_MISSILE_DMBF;
746
 
743
 
747
	return 0;
744
	return 0;
748
}
745
}