Subversion Repositories spk

Rev

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

Rev 49 Rev 50
Line 60... Line 60...
60
	}
60
	}
61
 
61
 
62
	newtext->sName = name;
62
	newtext->sName = name;
63
	newtext->sDesc = desc;
63
	newtext->sDesc = desc;
64
 
64
 
65
	m_bChanged = true; 
65
	_changed();
66
}
66
}
67
 
67
 
68
void CXspFile::RemoveText(int id)
68
void CXspFile::RemoveText(int id)
69
{
69
{
70
	for ( SText *t = m_lText.First(); t; t = m_lText.Next() )
70
	for ( SText *t = m_lText.First(); t; t = m_lText.Next() )
71
	{
71
	{
72
		if ( t->iId == id )
72
		if ( t->iId == id )
73
		{
73
		{
74
			m_bChanged = true; 
74
			_changed();
75
			m_lText.RemoveCurrent();
75
			m_lText.RemoveCurrent();
76
			return;
76
			return;
77
		}
77
		}
78
	}
78
	}
79
}
79
}
Line 87... Line 87...
87
	if ( d->sData.right(1) != ";" )
87
	if ( d->sData.right(1) != ";" )
88
		d->sData += ";";
88
		d->sData += ";";
89
 
89
 
90
	m_lDummy.push_back ( d );
90
	m_lDummy.push_back ( d );
91
 
91
 
92
	m_bChanged = true; 
92
	_changed();
93
}
93
}
94
 
94
 
95
void CXspFile::AddComponent ( const Utils::String &section, const Utils::String &section2, const Utils::String &data )
95
void CXspFile::AddComponent ( const Utils::String &section, const Utils::String &section2, const Utils::String &data )
96
{
96
{
97
	SComponent *c = new SComponent;
97
	SComponent *c = new SComponent;
Line 102... Line 102...
102
	if ( c->sData.right(1) != ";" )
102
	if ( c->sData.right(1) != ";" )
103
		c->sData += ";";
103
		c->sData += ";";
104
 
104
 
105
	m_lComponent.push_back ( c );
105
	m_lComponent.push_back ( c );
106
 
106
 
107
	m_bChanged = true; 
107
	_changed();
108
}
108
}
109
 
109
 
110
void CXspFile::AddWeaponMask ( int game, int mask )
110
void CXspFile::AddWeaponMask ( int game, int mask )
111
{
111
{
112
	// first check if we have one for the game
112
	// first check if we have one for the game
Line 127... Line 127...
127
		m_lWeaponMasks.push_back(m);
127
		m_lWeaponMasks.push_back(m);
128
		m->iGame = game;
128
		m->iGame = game;
129
	}
129
	}
130
 
130
 
131
	m->iMask = mask;
131
	m->iMask = mask;
132
	m_bChanged = true; 
132
	_changed();
133
}
133
}
134
void CXspFile::AddMissileMask ( int game, int mask )
134
void CXspFile::AddMissileMask ( int game, int mask )
135
{
135
{
136
	// first check if we have one for the game
136
	// first check if we have one for the game
137
	SWeaponMask *m = NULL;
137
	SWeaponMask *m = NULL;
Line 151... Line 151...
151
		m_lMissileMasks.push_back(m);
151
		m_lMissileMasks.push_back(m);
152
		m->iGame = game;
152
		m->iGame = game;
153
	}
153
	}
154
 
154
 
155
	m->iMask = mask;
155
	m->iMask = mask;
156
	m_bChanged = true; 
156
	_changed();
157
}
157
}
158
 
158
 
159
bool CXspFile::IsValid ()
159
bool CXspFile::IsValid ()
160
{
160
{
161
	if ( m_sName.Empty() )
161
	if ( this->name().empty() )
162
		return false;
162
		return false;
163
	if ( m_sAuthor.Empty() )
163
	if ( this->author().empty() )
164
		return false;
164
		return false;
165
 
165
 
166
	return true;
166
	return true;
167
}
167
}
168
 
168
 
Line 1111... Line 1111...
1111
		if ( mask == -1 )
1111
		if ( mask == -1 )
1112
			wm->iMask = cockpit.token(";", 9);
1112
			wm->iMask = cockpit.token(";", 9);
1113
		else
1113
		else
1114
			wm->iMask = mask;
1114
			wm->iMask = mask;
1115
	}
1115
	}
1116
	m_bChanged = true; 
1116
	_changed();
1117
}
1117
}
1118
 
1118
 
1119
void CXspFile::AddBody(const Utils::String &section, const Utils::String &data)
1119
void CXspFile::AddBody(const Utils::String &section, const Utils::String &data)
1120
{
1120
{
1121
	this->AddBodies(section + ";" + data);
1121
	this->AddBodies(section + ";" + data);
1122
	m_bChanged = true; 
1122
	_changed();
1123
}
1123
}
1124
void CXspFile::AddBodies(const Utils::String &sData)
1124
void CXspFile::AddBodies(const Utils::String &sData)
1125
{
1125
{
1126
	Utils::String data = sData;
1126
	Utils::String data = sData;
1127
	if ( !data.isNumber() )
1127
	if ( !data.isNumber() )
Line 1132... Line 1132...
1132
			data = data.left(-4);
1132
			data = data.left(-4);
1133
		if ( data.right(1) != ";" )
1133
		if ( data.right(1) != ";" )
1134
			data += ";";
1134
			data += ";";
1135
	}
1135
	}
1136
	m_lBodies.PushBack(CyString(data), true);
1136
	m_lBodies.PushBack(CyString(data), true);
1137
	m_bChanged = true; 
1137
	_changed();
1138
}
1138
}
1139
 
1139
 
1140
int CXspFile::GetAnimationType(const Utils::String &type)
1140
int CXspFile::GetAnimationType(const Utils::String &type)
1141
{
1141
{
1142
	if ( type.Compare("TAT_TAGSINGLESTEP") )
1142
	if ( type.Compare("TAT_TAGSINGLESTEP") )
Line 1285... Line 1285...
1285
 
1285
 
1286
void CXspFile::AddAnimation(CyStringList *list)
1286
void CXspFile::AddAnimation(CyStringList *list)
1287
{
1287
{
1288
	for ( SStringList *strNode = list->Head(); strNode; strNode = strNode->next )
1288
	for ( SStringList *strNode = list->Head(); strNode; strNode = strNode->next )
1289
		this->AddAnimation(strNode->str.ToString());
1289
		this->AddAnimation(strNode->str.ToString());
1290
	m_bChanged = true; 
1290
	_changed();
1291
}
1291
}
1292
 
1292
 
1293
SText *CXspFile::FindShipText(int lang)
1293
SText *CXspFile::FindShipText(int lang)
1294
{
1294
{
1295
	if ( m_lText.empty() )
1295
	if ( m_lText.empty() )
Line 1781... Line 1781...
1781
		bool ret = this->AddTextFromFile(fid, textId);
1781
		bool ret = this->AddTextFromFile(fid, textId);
1782
		fclose(fid);
1782
		fclose(fid);
1783
 
1783
 
1784
		if ( remove )
1784
		if ( remove )
1785
			CFileIO(file).Remove();
1785
			CFileIO(file).Remove();
1786
		m_bChanged = true; 
1786
		_changed();
1787
		return ret;
1787
		return ret;
1788
	}
1788
	}
1789
 
1789
 
1790
	return false;
1790
	return false;
1791
}
1791
}
Line 2012... Line 2012...
2012
	if ( !shipName.empty() )
2012
	if ( !shipName.empty() )
2013
		added = true;
2013
		added = true;
2014
 
2014
 
2015
	if ( added )
2015
	if ( added )
2016
	{
2016
	{
2017
		if ( lang == 44 || m_sName.Empty())
2017
		if ( lang == 44 || this->name().empty())
2018
		{
2018
		{
2019
			m_sName = shipName;
2019
			this->setName(shipName);
2020
			this->setDescription(shipDesc.findReplace("&amp", "&"));
2020
			this->setDescription(shipDesc.findReplace("&amp", "&"));
2021
		}
2021
		}
2022
		this->AddText(lang, shipName, shipDesc);
2022
		this->AddText(lang, shipName, shipDesc);
2023
		return true;	
2023
		return true;	
2024
	}
2024
	}
Line 2178... Line 2178...
2178
 
2178
 
2179
		for ( int i = 0; i < 6; i++ )
2179
		for ( int i = 0; i < 6; i++ )
2180
		{
2180
		{
2181
			Utils::String tId = m_sData.token(";", 32 + (i * 2));
2181
			Utils::String tId = m_sData.token(";", 32 + (i * 2));
2182
			if ( tId.isNumber() && ((int)tId) == c->iIndex )
2182
			if ( tId.isNumber() && ((int)tId) == c->iIndex )
2183
				m_sData = m_sData.replaceToken(";", 32 + (i * 2), (id + "(" + Utils::String::number(c->iIndex) + ")").c_str());
2183
				m_sData = m_sData.replaceToken(";", 32 + (i * 2), (id + "(" + Utils::String::Number(c->iIndex) + ")").c_str());
2184
		}
2184
		}
2185
	}
2185
	}
2186
}
2186
}
2187
 
2187
 
2188
Utils::String CXspFile::FormatShipData(CyStringList *cockpits, int *text, int game)
2188
Utils::String CXspFile::FormatShipData(CyStringList *cockpits, int *text, int game)