Subversion Repositories spk

Rev

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

Rev 162 Rev 164
Line 86... Line 86...
86
 
86
 
87
	m_gameExe.GetDirectoryData(_pCurrentDir);
87
	m_gameExe.GetDirectoryData(_pCurrentDir);
88
	_pCurrentDir->langid = this->GetGameLanguage(_pCurrentDir->dir);
88
	_pCurrentDir->langid = this->GetGameLanguage(_pCurrentDir->dir);
89
	if (_pCurrentDir->langid > 0)
89
	if (_pCurrentDir->langid > 0)
90
		_pCurrentDir->langname = this->ConvertLanguage(_pCurrentDir->langid);
90
		_pCurrentDir->langname = this->ConvertLanguage(_pCurrentDir->langid);
-
 
91
 
-
 
92
	updateFoundPackages("");
91
}
93
}
92
 
94
 
-
 
95
 
93
void CPackages::SetVanilla(bool b)
96
void CPackages::SetVanilla(bool b)
94
{
97
{
95
	if ( m_bVanilla != b && b ) {
98
	if ( m_bVanilla != b && b ) {
96
		for ( CListNode<CBaseFile> *pNode = m_lPackages.Front(); pNode; pNode = pNode->next() ) {
99
		for ( CListNode<CBaseFile> *pNode = m_lPackages.Front(); pNode; pNode = pNode->next() ) {
97
			pNode->Data()->SetModifiedEnabled(pNode->Data()->IsEnabled());
100
			pNode->Data()->SetModifiedEnabled(pNode->Data()->IsEnabled());
Line 179... Line 182...
179
	}
182
	}
180
	m_iShipBuffer = 0;
183
	m_iShipBuffer = 0;
181
 
184
 
182
	m_lGameShips.MemoryClear();
185
	m_lGameShips.MemoryClear();
183
	m_lAvailablePackages.MemoryClear();
186
	m_lAvailablePackages.MemoryClear();
-
 
187
	m_lFoundPackages.MemoryClear();
184
	m_lInstallList.MemoryClear();
188
	m_lInstallList.MemoryClear();
185
	m_lEnableList.MemoryClear();
189
	m_lEnableList.MemoryClear();
186
	m_lDisableList.MemoryClear();
190
	m_lDisableList.MemoryClear();
187
 
191
 
188
	m_lCreatedFiles.clear();
192
	m_lCreatedFiles.clear();
Line 6531... Line 6535...
6531
		SGameShip *s = node->Data();
6535
		SGameShip *s = node->Data();
6532
		if ( s->iType != WARETYPE_ADDED || !s->pPackage )
6536
		if ( s->iType != WARETYPE_ADDED || !s->pPackage )
6533
			continue;
6537
			continue;
6534
 
6538
 
6535
		// no dummies to add?
6539
		// no dummies to add?
6536
		if ( !s->pPackage->AnyCutData() )
6540
		if ( !s->pPackage->anyCutData() )
6537
			continue;
6541
			continue;
6538
		found = true;
6542
		found = true;
6539
		break;
6543
		break;
6540
	}
6544
	}
6541
 
6545
 
Line 6585... Line 6589...
6585
		SGameShip *s = node->Data();
6589
		SGameShip *s = node->Data();
6586
		if ( s->iType != WARETYPE_ADDED || !s->pPackage )
6590
		if ( s->iType != WARETYPE_ADDED || !s->pPackage )
6587
			continue;
6591
			continue;
6588
 
6592
 
6589
		// no dummies to add?
6593
		// no dummies to add?
6590
		if ( !s->pPackage->AnyCutData() )
6594
		if ( !s->pPackage->anyCutData() )
6591
			continue;
6595
			continue;
6592
 
6596
 
6593
		// add each dummy to list
6597
		// add each dummy to list
6594
		for ( SStringList *strNode = s->pPackage->GetCutData()->Head(); strNode; strNode = strNode->next )
6598
		auto& list = s->pPackage->getCutData();
-
 
6599
		for(auto itr = list.begin(); itr != list.end(); itr++)
6595
		{
6600
		{
6596
			CyString str = strNode->str;
6601
			Utils::String str = (*itr)->str;
6597
			str.RemoveChar(' ');
6602
			str.removeChar(' ');
6598
			if ( str.Right(1) != ";" )
6603
			if ( str.right(1) != ";" )
6599
				str += ";";
6604
				str += ";";
6600
			cutList.PushBack(str, true);
6605
			cutList.PushBack(CyString(str), true);
6601
		}
6606
		}
6602
	}
6607
	}
6603
 
6608
 
6604
	cutList.PushFront(CyString::Number(cutList.Count()) + ";");
6609
	cutList.PushFront(CyString::Number(cutList.Count()) + ";");
6605
	cutList.PushFront("/cut id;filename (leave blank to use id)");
6610
	cutList.PushFront("/cut id;filename (leave blank to use id)");
Line 8079... Line 8084...
8079
CyString CPackages::GetLanguageName() const
8084
CyString CPackages::GetLanguageName() const
8080
{
8085
{
8081
	return CPackages::ConvertLanguage(m_iLanguage);
8086
	return CPackages::ConvertLanguage(m_iLanguage);
8082
}
8087
}
8083
 
8088
 
-
 
8089
size_t CPackages::updateFoundPackages(const Utils::String& dir)
-
 
8090
{
-
 
8091
	m_lFoundPackages.MemoryClear();
-
 
8092
	if (!m_sCurrentDir.empty())
-
 
8093
		return findAllPackages(m_lFoundPackages, dir);
-
 
8094
 
-
 
8095
	return 0;
-
 
8096
}
-
 
8097
 
-
 
8098
size_t CPackages::addFoundPackages(const Utils::String& dir)
-
 
8099
{
-
 
8100
	return findPackageDirectories(m_lFoundPackages, dir);
-
 
8101
}
-
 
8102
 
8084
int CPackages::findAllPackages(CLinkList<CBaseFile> &packages, const Utils::String &dir)
8103
int CPackages::findAllPackages(CLinkList<CBaseFile> &packages, const Utils::String &dir)
8085
{
8104
{
8086
	int count = 0;
8105
	int count = 0;
8087
	if (!dir.empty())
8106
	if (!dir.empty())
8088
	{
8107
	{
Line 9089... Line 9108...
9089
			return node->Data();
9108
			return node->Data();
9090
	}
9109
	}
9091
	return NULL;
9110
	return NULL;
9092
}
9111
}
9093
 
9112
 
-
 
9113
CBaseFile* CPackages::findFoundPackage(const Utils::String& name, const Utils::String& author) const
-
 
9114
{
-
 
9115
	for (CListNode<CBaseFile>* node = m_lFoundPackages.Front(); node; node = node->next())
-
 
9116
	{
-
 
9117
		if (node->Data()->name().Compare(name) && node->Data()->author().Compare(author))
-
 
9118
			return node->Data();
-
 
9119
	}
-
 
9120
	return NULL;
-
 
9121
}
-
 
9122
 
-
 
9123
 
9094
bool CPackages::addAvailablePackage(SAvailablePackage *package)	
9124
bool CPackages::addAvailablePackage(SAvailablePackage *package)	
9095
{ 
9125
{ 
9096
	if ( !package->lGames.empty() ) {
9126
	if ( !package->lGames.empty() ) {
9097
		bool found = false;
9127
		bool found = false;
9098
		for ( CListNode<SGameCompat> *node = package->lGames.Front(); node; node = node->next() ) {
9128
		for ( CListNode<SGameCompat> *node = package->lGames.Front(); node; node = node->next() ) {
Line 9104... Line 9134...
9104
 
9134
 
9105
		if ( !found )
9135
		if ( !found )
9106
			return false;
9136
			return false;
9107
	}
9137
	}
9108
 
9138
 
-
 
9139
	// check if a matching package is already found
-
 
9140
	const CBaseFile* bf = findFoundPackage(package->sName, package->sAuthor);
-
 
9141
	if (bf)
-
 
9142
	{
-
 
9143
		if (bf->version().compareVersion(package->sVersion) <= 0)
-
 
9144
			return true;		
-
 
9145
	}
-
 
9146
 
9109
	const SAvailablePackage *p = findAvailablePackage(package->sFilename);
9147
	const SAvailablePackage *p = findAvailablePackage(package->sFilename);
9110
	if(p)
9148
	if(p)
9111
	{
9149
	{
9112
		if (p->sVersion.compareVersion(package->sVersion) <= 0)
9150
		if (p->sVersion.compareVersion(package->sVersion) <= 0)
9113
			return true;
9151
			return true;