Subversion Repositories spk

Rev

Rev 197 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#include "../StdAfx.h"
2
#include "CustomiseInfo.h"
3
 
4
namespace Creator {
5
 
6
	void CustomiseInfo::UpdateDisplay()
7
	{
8
		m_bUpdateing = true;
9
		this->ComboClass->SelectedIndex = CShipData::ConvertShipClassToNum(m_pShipData->iClass);
10
		this->ComboRace->SelectedIndex = m_pShipData->iRace - 1;
11
		this->ComboVariation->SelectedIndex = m_pShipData->iVariation;
12
		this->NumDock->Value = m_pShipData->iDocking;
13
		this->NumCargoMin->Value = m_pShipData->iCargoMin;
14
		this->NumCargoMax->Value = m_pShipData->iCargoMax;
15
		this->ComboCargo->SelectedIndex = m_pShipData->iCargoClass;
16
		this->NumPriceNPC->Value = m_pShipData->iRelVal;
17
		this->NumPricePlayer->Value = m_pShipData->iRelValPlayer;
18
		this->NumNoto->Value = m_pShipData->iMinNoto;
19
		this->ComboSubType->SelectedIndex = m_pShipData->iSubType;
20
		m_bUpdateing = false;
21
	}
22
 
23
	void CustomiseInfo::UpdateInfo()
24
	{
25
		m_bUpdateing = true;
26
		// fill race entries
94 cycrow 27
 
28
		CGameDirectories *game = ((CustomiseShip ^)m_pParent)->gameDirectories();
29
 
1 cycrow 30
		this->ComboRace->Items->Clear();
31
		for ( int i = 1; i <= 19; i++ )
32
		{
33
			if ( i == 10 ) // special case for player
34
				this->ComboRace->Items->Add("Player");
35
			else
197 cycrow 36
				this->ComboRace->Items->Add(_US(game->findText(0, TEXTPAGE_RACE, i, Utils::WString::Number(i))));
1 cycrow 37
		}
38
 
39
		// fill variation entries
40
		this->ComboVariation->Items->Clear();
41
		this->ComboVariation->Items->Add("Standard");
42
		for ( int i = 1; i <= 20; i++ )
197 cycrow 43
			this->ComboVariation->Items->Add(_US(game->findText(0, TEXTPAGE_OBJECTS, 10000 + i, Utils::WString::Number(i))));
1 cycrow 44
 
45
		// fill ship class entries
46
		this->ComboClass->Items->Clear();
47
		for ( int i = 0; i < OBJ_SHIP_MAX; i++ )
211 cycrow 48
			this->ComboClass->Items->Add(_US(game->findText(0, TEXTPAGE_CLASS, CShipData::GetShipClassFromNum(i), CShipData::ConvertShipClass(CShipData::GetShipClassFromNum(i)))));
1 cycrow 49
 
50
		// the cargo class
51
		this->ComboCargo->Items->Clear();
52
		for ( int i = 0; i < 6; i++ )
53
		{
197 cycrow 54
			Utils::WString text = game->findText(0, TEXTPAGE_CARGOCLASS, i + 10);
94 cycrow 55
			if ( text.empty() ) 
197 cycrow 56
				text = game->findText(0, TEXTPAGE_CARGOCLASS, i, _WS(this->GetCargoClass(i)));
94 cycrow 57
			else 
197 cycrow 58
				text = text + L" (" + game->findText(0, TEXTPAGE_CARGOCLASS, i, _WS(this->GetCargoClass(i))) + L")";
94 cycrow 59
			this->ComboCargo->Items->Add(_US(text));
1 cycrow 60
		}
61
 
62
		// the sub type
63
		this->ComboSubType->Items->Clear();
64
		for ( int i = 0; i < SG_SH_MAX; i++ )
191 cycrow 65
			this->ComboSubType->Items->Add(_US(CShipData::ConvertShipSubType(i)));
1 cycrow 66
 
67
		this->UpdateNotority();
68
		m_bUpdateing = false;
69
	}
70
 
71
	void CustomiseInfo::UpdateNotority()
72
	{
73
		this->ComboNoto->Items->Clear();
94 cycrow 74
 
75
		CGameDirectories *game = ((CustomiseShip ^)m_pParent)->gameDirectories();
197 cycrow 76
		Utils::WString text = game->findText(0, this->GetNotoPage(m_pShipData->iRace), 110);
94 cycrow 77
 
78
		if ( this->GetNotoPage(m_pShipData->iRace) == 0 || text.empty() )
1 cycrow 79
			this->ComboNoto->Enabled = false;
80
		else
81
		{
82
			this->ComboNoto->Enabled = true;
83
			this->ComboNoto->Items->Add("-");
84
			for ( int i = 0; i < 16; i++ )
94 cycrow 85
				this->ComboNoto->Items->Add(_US(game->findText(0, this->GetNotoPage(m_pShipData->iRace), 110 - i)));
1 cycrow 86
		}
87
	}
88
 
89
	String ^CustomiseInfo::GetCargoClass(int i)
90
	{
91
		switch ( i )
92
		{
93
			case 1:
94
				return "S";
95
			case 2:
96
				return "M";
97
			case 3:
98
				return "L";
99
			case 4:
100
				return "XL";
101
			case 5:
102
				return "ST";
103
		}
104
 
105
		return "-";
106
	}
107
 
108
	int CustomiseInfo::GetNotoPage(int race)
109
	{
110
		switch ( race )
111
		{
112
			case 1: // argon
113
				return 23;
114
			case 2: // boron
115
				return 24;
116
			case 3: // split
117
				return 25;
118
			case 4: // paranid
119
				return 26;
120
			case 5: // teladi
121
				return 27;
122
			case 9: // goner
123
				return 28;
124
			case 18: // terran
125
				return 829;
126
			case 17: // atf
127
				return 830;
128
			default:
129
				return 0;
130
		}
131
	}
132
 
133
	int CustomiseInfo::GetNotoAmount(int preset)
134
	{
135
		switch ( preset )
136
		{
137
			case 1:
138
				return 333333;
139
			case 2:
140
				return 100000;
141
			case 3:
142
				return 33333;
143
			case 4:
144
				return 10000;
145
			case 5:
146
				return 3333;
147
			case 6:
148
				return 1000;
149
			case 7:
150
				return 333;
151
			case 8:
152
				return 100;
153
			case 9:
154
				return 33;
155
			case 10:
156
				return 10;
157
			case 11:
158
				return 0;
159
			case 12:
160
				return -11;
161
			case 13:
162
				return -101;
163
			case 14:
164
				return -1001;
165
			case 15:
166
				return -10001;
167
			case 16:
168
				return -100001;
169
			default:
170
				return 0;
171
		}
172
	}
173
 
174
};