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
}
-
 
94
 
92
 
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() ) {
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 5716... Line 5720...
5716
							}
5720
							}
5717
 
5721
 
5718
							int noto = 0;
5722
							int noto = 0;
5719
							if ( this->empOverideNoto(i - 116, &noto) ) {
5723
							if ( this->empOverideNoto(i - 116, &noto) ) {
5720
								line = line.replaceToken(";", 14, Utils::String::Number(noto));
5724
								line = line.replaceToken(";", 14, Utils::String::Number(noto));
5721
							}
5725
							}
5722
						}
5726
						}
5723
 
5727
 
5724
						wareLines.pushBack(line);
5728
						wareLines.pushBack(line);
5725
						if ( wareLines.size() >= oldSize )
5729
						if ( wareLines.size() >= oldSize )
5726
							break;
5730
							break;
Line 5916... Line 5920...
5916
	else
5920
	else
5917
		writeData.push_back("	<page id=\"" + (long)gameNumber + Utils::String::PadNumber(PMTEXTFILE, 4) + "\" title=\"Plugin Manager Text File\" descr=\"Contains text used for the plugin manager, packages, settings, wares, ship, etc\">");
5921
		writeData.push_back("	<page id=\"" + (long)gameNumber + Utils::String::PadNumber(PMTEXTFILE, 4) + "\" title=\"Plugin Manager Text File\" descr=\"Contains text used for the plugin manager, packages, settings, wares, ship, etc\">");
5918
 
5922
 
5919
	writeData.push_back("		<t id=\"99998\">[author]Plugin Manager[/author]It appears the plugin manager hasn't been closed properly.  Make sure its closed before running the game otherwise things may not work correctly</t>");
5923
	writeData.push_back("		<t id=\"99998\">[author]Plugin Manager[/author]It appears the plugin manager hasn't been closed properly.  Make sure its closed before running the game otherwise things may not work correctly</t>");
5920
	writeData.push_back("		<t id=\"99999\">2</t>");	
5924
	writeData.push_back("		<t id=\"99999\">2</t>");	
5921
	writeData.push_back("	</page>");
5925
	writeData.push_back("	</page>");
5922
 
5926
 
5923
	writeData.push_back("</language>");
5927
	writeData.push_back("</language>");
5924
	textFile.writeFileUTF(&writeData);
5928
	textFile.writeFileUTF(&writeData);
5925
 
5929
 
5926
	size_t fileSize;
5930
	size_t fileSize;
5927
	char *fileData = CFileIO(textFile.fullFilename()).ReadToData(&fileSize);
5931
	char *fileData = CFileIO(textFile.fullFilename()).ReadToData(&fileSize);
5928
 
5932
 
5929
	if ( fileData && fileSize)
5933
	if ( fileData && fileSize)
5930
	{
5934
	{
5931
		size_t newFileSize;
5935
		size_t newFileSize;
5932
		unsigned char *pckData = PCKData((unsigned char *)fileData, fileSize, &newFileSize, true);
5936
		unsigned char *pckData = PCKData((unsigned char *)fileData, fileSize, &newFileSize, true);
5933
		if ( pckData )
5937
		if ( pckData )
5934
		{
5938
		{
5935
			CFileIO pckFile(m_sCurrentDir + "/t/" + filename + ".pck");
5939
			CFileIO pckFile(m_sCurrentDir + "/t/" + filename + ".pck");
5936
			pckFile.WriteData((char *)pckData, newFileSize);
5940
			pckFile.WriteData((char *)pckData, newFileSize);
5937
			this->AddCreatedFile(pckFile.fullFilename());
5941
			this->AddCreatedFile(pckFile.fullFilename());
5938
		}
5942
		}
5939
	}
5943
	}
5940
	textFile.remove();
5944
	textFile.remove();
5941
}
5945
}
5942
 
5946
 
5943
void CPackages::CreatePluginManagerText()
5947
void CPackages::CreatePluginManagerText()
5944
{
5948
{
Line 6152... Line 6156...
6152
			writeData.push_back("  <page id=\"17\" title=\"Plugin Manager Objects\">");
6156
			writeData.push_back("  <page id=\"17\" title=\"Plugin Manager Objects\">");
6153
		else
6157
		else
6154
			writeData.push_back(Utils::String("  <page id=\"") + (long)gameNumber + "0017\" title=\"Plugin Manager Objects\">");
6158
			writeData.push_back(Utils::String("  <page id=\"") + (long)gameNumber + "0017\" title=\"Plugin Manager Objects\">");
6155
 
6159
 
6156
		writeData.push_back(Utils::String("		<t id=\"") + (long)(SHIPSTARTTEXT - 1) + "\">ZZ_BLANKSHIP</t>");
6160
		writeData.push_back(Utils::String("		<t id=\"") + (long)(SHIPSTARTTEXT - 1) + "\">ZZ_BLANKSHIP</t>");
6157
 
6161
 
6158
		// object names
6162
		// object names
6159
		for ( CListNode<SGameWare> *node = lWares.Front(); node; node = node->next() )
6163
		for ( CListNode<SGameWare> *node = lWares.Front(); node; node = node->next() )
6160
		{
6164
		{
6161
			SGameWare *w = node->Data();
6165
			SGameWare *w = node->Data();
6162
			if ( !w->pWare || w->iType != WARETYPE_ADDED )
6166
			if ( !w->pWare || w->iType != WARETYPE_ADDED )
Line 6477... Line 6481...
6477
							break;
6481
							break;
6478
						}
6482
						}
6479
					}
6483
					}
6480
 
6484
 
6481
					if ( f )
6485
					if ( f )
6482
						continue;
6486
						continue;
6483
				}
6487
				}
6484
 
6488
 
6485
				found->lEntries.PushBack(CyString(dummy->sData));
6489
				found->lEntries.PushBack(CyString(dummy->sData));
6486
			}
6490
			}
6487
		}
6491
		}
6488
 
6492
 
6489
		// finally, write the file
6493
		// finally, write the file
Line 6493... Line 6497...
6493
		{
6497
		{
6494
			lines.push_back("");
6498
			lines.push_back("");
6495
			lines.push_back("// Section: " + dummy->sSection.ToString() + " Entries: " + Utils::String::Number((long)dummy->lEntries.Count()));
6499
			lines.push_back("// Section: " + dummy->sSection.ToString() + " Entries: " + Utils::String::Number((long)dummy->lEntries.Count()));
6496
			lines.push_back(dummy->sSection.ToString() + ";" + Utils::String::Number(dummy->lEntries.Count()) + ";");
6500
			lines.push_back(dummy->sSection.ToString() + ";" + Utils::String::Number(dummy->lEntries.Count()) + ";");
6497
			for ( SStringList *str = dummy->lEntries.Head(); str; str = str->next )
6501
			for ( SStringList *str = dummy->lEntries.Head(); str; str = str->next )
6498
			{
6502
			{
6499
				Utils::String strLine = str->str.ToString();
6503
				Utils::String strLine = str->str.ToString();
6500
				strLine.removeChar(9);
6504
				strLine.removeChar(9);
6501
				strLine.removeChar('\r');
6505
				strLine.removeChar('\r');
6502
				strLine.removeEndSpace();
6506
				strLine.removeEndSpace();
6503
				strLine.removeFirstSpace();
6507
				strLine.removeFirstSpace();
Line 6506... Line 6510...
6506
					strLine += ";";
6510
					strLine += ";";
6507
				lines.push_back(strLine);
6511
				lines.push_back(strLine);
6508
			}
6512
			}
6509
		}
6513
		}
6510
		lines.push_back("");
6514
		lines.push_back("");
6511
 
6515
 
6512
		// write the file to disk
6516
		// write the file to disk
6513
		CFileIO WriteFile(m_sTempDir + "/dummies.txt");
6517
		CFileIO WriteFile(m_sTempDir + "/dummies.txt");
6514
		if ( WriteFile.writeFile(&lines) )
6518
		if ( WriteFile.writeFile(&lines) )
6515
		{
6519
		{
6516
			this->PackFile(&WriteFile, "types\\dummies.pck");
6520
			this->PackFile(&WriteFile, "types\\dummies.pck");
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 7975... Line 7980...
7975
 
7980
 
7976
				if ( askFunc )
7981
				if ( askFunc )
7977
					result = askFunc(cmd);
7982
					result = askFunc(cmd);
7978
 
7983
 
7979
				if ( rest.contains("$ASK(") )
7984
				if ( rest.contains("$ASK(") )
7980
				{
7985
				{
7981
					replace = rest.tokens("$ASK(", 2).token(")", 1);
7986
					replace = rest.tokens("$ASK(", 2).token(")", 1);
7982
					if ( result.empty() )
7987
					if ( result.empty() )
7983
						result = replace;
7988
						result = replace;
7984
					replace = "$ASK(" + replace + ")";
7989
					replace = "$ASK(" + replace + ")";
7985
				}
7990
				}
Line 8027... Line 8032...
8027
			}
8032
			}
8028
			else if ( !package->LoadPackageData(cmd, rest, sMainGame, otherGames, gameAddons, progress) )
8033
			else if ( !package->LoadPackageData(cmd, rest, sMainGame, otherGames, gameAddons, progress) )
8029
			{
8034
			{
8030
				if ( unknownCommands )
8035
				if ( unknownCommands )
8031
					unknownCommands->pushBack(cmd, rest);
8036
					unknownCommands->pushBack(cmd, rest);
8032
			}
8037
			}
8033
		}
8038
		}
8034
	}
8039
	}
8035
 
8040
 
8036
	if ( package->filename().empty() )
8041
	if ( package->filename().empty() )
8037
		package->LoadPackageData("AutoSave", "$AUTOSAVE", sMainGame, otherGames, gameAddons, progress);
8042
		package->LoadPackageData("AutoSave", "$AUTOSAVE", sMainGame, otherGames, gameAddons, progress);
8038
 
8043
 
Line 8046... Line 8051...
8046
				C_File *f = node->Data();
8051
				C_File *f = node->Data();
8047
				if (f->game() && f->game() != GAME_ALLNEW && !(f->game() & (1 << game)))
8052
				if (f->game() && f->game() != GAME_ALLNEW && !(f->game() & (1 << game)))
8048
					continue;
8053
					continue;
8049
				package->extractFile(f, itr->second, game, gameAddons);
8054
				package->extractFile(f, itr->second, game, gameAddons);
8050
			}
8055
			}
8051
		}
8056
		}
8052
	}
8057
	}
8053
 
8058
 
8054
	if (package->autoExporter())
8059
	if (package->autoExporter())
8055
	{
8060
	{
8056
		for (auto itr = package->autoExporter()->begin(); itr != package->autoExporter()->end(); itr++)
8061
		for (auto itr = package->autoExporter()->begin(); itr != package->autoExporter()->end(); itr++)
Line 8064... Line 8069...
8064
			if ( !ftppass.Empty() )
8069
			if ( !ftppass.Empty() )
8065
				ftpaddr = ftpuser + ":" + ftppass + "@" + ftpaddr;
8070
				ftpaddr = ftpuser + ":" + ftppass + "@" + ftpaddr;
8066
			else
8071
			else
8067
				ftpaddr = ftpuser + "@" + ftpaddr;
8072
				ftpaddr = ftpuser + "@" + ftpaddr;
8068
		}
8073
		}
8069
 
8074
 
8070
		if ( !ftpdir.Empty() )
8075
		if ( !ftpdir.Empty() )
8071
			ftpaddr += ftpdir;
8076
			ftpaddr += ftpdir;
8072
 
8077
 
8073
		package->SetFtpAddr(ftpaddr);
8078
		package->SetFtpAddr(ftpaddr);
8074
	}
8079
	}
8075
 
8080
 
8076
	return package;
8081
	return package;
8077
}
8082
}
8078
 
8083
 
8079
CyString CPackages::GetLanguageName() const
8084
CyString CPackages::GetLanguageName() const
8080
{
8085
{
8081
	return CPackages::ConvertLanguage(m_iLanguage);
8086
	return CPackages::ConvertLanguage(m_iLanguage);
-
 
8087
}
-
 
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);
8082
}
8101
}
8083
 
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
	{
8089
		count += findPackageDirectories(packages, dir + "/Addons");
8108
		count += findPackageDirectories(packages, dir + "/Addons");
8090
		count += findPackageDirectories(packages, dir + "/Downloads");
8109
		count += findPackageDirectories(packages, dir + "/Downloads");
8091
	}
8110
	}
Line 8114... Line 8133...
8114
		for (auto itr = files.begin(); itr != files.end(); itr++)
8133
		for (auto itr = files.begin(); itr != files.end(); itr++)
8115
		{
8134
		{
8116
			Utils::String d = Dir.file((*itr)->str);
8135
			Utils::String d = Dir.file((*itr)->str);
8117
			if (CDirIO(d).isDir())
8136
			if (CDirIO(d).isDir())
8118
				count += findPackageDirectories(packages, d);
8137
				count += findPackageDirectories(packages, d);
8119
		}
8138
		}
8120
	}
8139
	}
8121
 
8140
 
8122
	count += findPackageFiles(packages, dir);
8141
	count += findPackageFiles(packages, dir);
8123
	return count;
8142
	return count;
8124
}
8143
}
8125
int CPackages::findPackageFiles(CLinkList<CBaseFile> &packages, const Utils::String &dir)
8144
int CPackages::findPackageFiles(CLinkList<CBaseFile> &packages, const Utils::String &dir)
8126
{
8145
{
Line 8149... Line 8168...
8149
				continue;
8168
				continue;
8150
			}
8169
			}
8151
 
8170
 
8152
			// check its for the correct game
8171
			// check its for the correct game
8153
			if (!p->CheckGameCompatability(this->GetGame()))
8172
			if (!p->CheckGameCompatability(this->GetGame()))
8154
			{
8173
			{
8155
				delete p;
8174
				delete p;
8156
				continue;
8175
				continue;
8157
			}
8176
			}
8158
 
8177
 
8159
			// check if its already on the list
8178
			// check if its already on the list
8160
			bool found = false;
8179
			bool found = false;
8161
			for (CBaseFile *checkp = packages.First(); checkp; checkp = packages.Next())
8180
			for (CBaseFile *checkp = packages.First(); checkp; checkp = packages.Next())
8162
			{
8181
			{
8163
				if (p->name().Compare(checkp->name()) && p->author().Compare(checkp->author()))
8182
				if (p->name().Compare(checkp->name()) && p->author().Compare(checkp->author()))
8164
				{
8183
				{
8165
					found = true;
8184
					found = true;
8166
					break;
8185
					break;
8167
				}
8186
				}
Line 8169... Line 8188...
8169
 
8188
 
8170
			if (found)
8189
			if (found)
8171
			{
8190
			{
8172
				delete p;
8191
				delete p;
8173
				continue;
8192
				continue;
8174
			}
8193
			}
8175
			
8194
			
8176
			if (p->GetIcon())
8195
			if (p->GetIcon())
8177
			{
8196
			{
8178
				bool addedIcon = false;
8197
				bool addedIcon = false;
8179
				p->ReadIconFileToMemory();
8198
				p->ReadIconFileToMemory();
Line 8205... Line 8224...
8205
				}
8224
				}
8206
 
8225
 
8207
				if (!done)
8226
				if (!done)
8208
					f->DeleteData();
8227
					f->DeleteData();
8209
			}
8228
			}
8210
 
8229
 
8211
			packages.push_back(p);
8230
			packages.push_back(p);
8212
			++count;
8231
			++count;
8213
		}
8232
		}
8214
	}
8233
	}
8215
 
8234
 
Line 8257... Line 8276...
8257
		case 48:
8276
		case 48:
8258
			return "Polish";
8277
			return "Polish";
8259
	}
8278
	}
8260
 
8279
 
8261
	return Utils::String::Number(lang);
8280
	return Utils::String::Number(lang);
8262
}
8281
}
8263
 
8282
 
8264
bool CPackages::CheckAccessRights(CyString dir)
8283
bool CPackages::CheckAccessRights(CyString dir)
8265
{
8284
{
8266
	if ( dir.Empty() )
8285
	if ( dir.Empty() )
8267
		dir = m_sCurrentDir;
8286
		dir = m_sCurrentDir;
Line 8290... Line 8309...
8290
		return false;
8309
		return false;
8291
 
8310
 
8292
	// now read the file for the correct contents
8311
	// now read the file for the correct contents
8293
	CyStringList *lines = File.ReadLinesStr();
8312
	CyStringList *lines = File.ReadLinesStr();
8294
	if ( !lines )
8313
	if ( !lines )
8295
		return false;
8314
		return false;
8296
 
8315
 
8297
	// check that one of the lines is correct
8316
	// check that one of the lines is correct
8298
	for ( SStringList *s = lines->Head(); s; s = s->next )
8317
	for ( SStringList *s = lines->Head(); s; s = s->next )
8299
	{
8318
	{
8300
		if ( s->str == "testing access rights" )
8319
		if ( s->str == "testing access rights" )
8301
		{
8320
		{
Line 8397... Line 8416...
8397
	{
8416
	{
8398
		if ( str->str.Compare(id) )
8417
		if ( str->str.Compare(id) )
8399
		{
8418
		{
8400
			delete list;
8419
			delete list;
8401
			return str->data;
8420
			return str->data;
8402
		}
8421
		}
8403
	}
8422
	}
8404
 
8423
 
8405
	delete list;
8424
	delete list;
8406
	return NullString;
8425
	return NullString;
8407
}
8426
}
8408
 
8427
 
Line 8678... Line 8697...
8678
	{		
8697
	{		
8679
		int status = (*itr)->data.toInt();
8698
		int status = (*itr)->data.toInt();
8680
		if ( status == 1 )
8699
		if ( status == 1 )
8681
		{
8700
		{
8682
			if ( !newCat.WriteFromCat(mod1, (*itr)->str) )
8701
			if ( !newCat.WriteFromCat(mod1, (*itr)->str) )
8683
			{
8702
			{
8684
				if ( cantMerge )
8703
				if ( cantMerge )
8685
					cantMerge->PushBack(CyString((*itr)->str), "1");
8704
					cantMerge->PushBack(CyString((*itr)->str), "1");
8686
			}
8705
			}
8687
		}
8706
		}
8688
		else if ( status == 2 )
8707
		else if ( status == 2 )
8689
		{
8708
		{
Line 8732... Line 8751...
8732
}
8751
}
8733
 
8752
 
8734
/**
8753
/**
8735
 * Gets the file list from a mod that might have compatability problems
8754
 * Gets the file list from a mod that might have compatability problems
8736
 *
8755
 *
8737
 * This includes all types and text files
8756
 * This includes all types and text files
8738
 *
8757
 *
8739
 * Returns true if it finds any files
8758
 * Returns true if it finds any files
8740
 */
8759
 */
8741
bool CPackages::GetModCompatabilityList(C_File *file, CyStringList *list)
8760
bool CPackages::GetModCompatabilityList(C_File *file, CyStringList *list)
8742
{
8761
{
8743
	// not a valid file
8762
	// not a valid file
Line 8763... Line 8782...
8763
			if ( found ) {
8782
			if ( found ) {
8764
				if ( list )
8783
				if ( list )
8765
					list->PushBack(filename, CyString(f->lSize));
8784
					list->PushBack(filename, CyString(f->lSize));
8766
				else
8785
				else
8767
					return true;
8786
					return true;
8768
			}
8787
			}
8769
		}
8788
		}
8770
	}
8789
	}
8771
 
8790
 
8772
	if ( list && !list->Empty() )
8791
	if ( list && !list->Empty() )
8773
		return true;
8792
		return true;
8774
 
8793
 
8775
	return false;
8794
	return false;
8776
}
8795
}
8777
 
8796
 
8778
/**
8797
/**
Line 8820... Line 8839...
8820
			}
8839
			}
8821
		}
8840
		}
8822
	}
8841
	}
8823
 
8842
 
8824
	if ( list && !list->Empty() )
8843
	if ( list && !list->Empty() )
8825
		return true;
8844
		return true;
8826
 
8845
 
8827
	return false;
8846
	return false;
8828
}
8847
}
8829
 
8848
 
8830
bool CPackages::CheckCompatabilityBetweenMods(CBaseFile *from, CBaseFile *to, CyStringList *list)
8849
bool CPackages::CheckCompatabilityBetweenMods(CBaseFile *from, CBaseFile *to, CyStringList *list)
Line 8853... Line 8872...
8853
				++count;
8872
				++count;
8854
		}
8873
		}
8855
	}
8874
	}
8856
 
8875
 
8857
	if ( count )
8876
	if ( count )
8858
		return true;
8877
		return true;
8859
 
8878
 
8860
	return false;
8879
	return false;
8861
}
8880
}
8862
 
8881
 
8863
int CPackages::CheckCompatabilityAgainstPackages(CBaseFile *newFile, CyStringList *list, CLinkList<CBaseFile> *packages)
8882
int CPackages::CheckCompatabilityAgainstPackages(CBaseFile *newFile, CyStringList *list, CLinkList<CBaseFile> *packages)
8864
{
8883
{
8865
	if ( !newFile->IsEnabled() ) return 0;
8884
	if ( !newFile->IsEnabled() ) return 0;
8866
	if ( !newFile->AnyFileType(FILETYPE_MOD) ) return 0;
8885
	if ( !newFile->AnyFileType(FILETYPE_MOD) ) return 0;
Line 8873... Line 8892...
8873
		if ( !f->IsFakePatch() ) continue;
8892
		if ( !f->IsFakePatch() ) continue;
8874
		if ( !f->CheckFileExt("cat") ) continue;
8893
		if ( !f->CheckFileExt("cat") ) continue;
8875
 
8894
 
8876
		if ( newFile->ExtractFile(f, m_sTempDir) )
8895
		if ( newFile->ExtractFile(f, m_sTempDir) )
8877
			f->SetFullDir(m_sTempDir);
8896
			f->SetFullDir(m_sTempDir);
8878
	}
8897
	}
8879
 
8898
 
8880
	// compare mod files against all installed packages
8899
	// compare mod files against all installed packages
8881
	int count = 0;
8900
	int count = 0;
8882
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
8901
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
8883
	{
8902
	{
Line 8961... Line 8980...
8961
 
8980
 
8962
	return p;
8981
	return p;
8963
}
8982
}
8964
 
8983
 
8965
Utils::String CPackages::FormatAvailablePackageData(CBaseFile *package)
8984
Utils::String CPackages::FormatAvailablePackageData(CBaseFile *package)
8966
{
8985
{
8967
	SAvailablePackage *p = CPackages::CreateAvailablePackageData(package);
8986
	SAvailablePackage *p = CPackages::CreateAvailablePackageData(package);
8968
	Utils::String ret = CPackages::FormatAvailablePackageData(p);
8987
	Utils::String ret = CPackages::FormatAvailablePackageData(p);
8969
	delete p;
8988
	delete p;
8970
	return ret;
8989
	return ret;
8971
}
8990
}
Line 9066... Line 9085...
9066
 
9085
 
9067
	if ( !p->sDesc.empty() )
9086
	if ( !p->sDesc.empty() )
9068
		p->sDesc = p->sDesc.findReplace("::newline::", "\\n");
9087
		p->sDesc = p->sDesc.findReplace("::newline::", "\\n");
9069
 
9088
 
9070
	addAvailablePackage(p);
9089
	addAvailablePackage(p);
9071
 
9090
 
9072
	CLEANSPLIT(tok, num);
9091
	CLEANSPLIT(tok, num);
9073
}
9092
}
9074
 
9093
 
9075
const SAvailablePackage* CPackages::findAvailablePackage(const Utils::String& filename) const
9094
const SAvailablePackage* CPackages::findAvailablePackage(const Utils::String& filename) const
9076
{
9095
{
9077
	for (CListNode<SAvailablePackage>* node = m_lAvailablePackages.Front(); node; node = node->next())
9096
	for (CListNode<SAvailablePackage>* node = m_lAvailablePackages.Front(); node; node = node->next())
9078
	{
9097
	{
9079
		if (node->Data()->sFilename.Compare(filename))
9098
		if (node->Data()->sFilename.Compare(filename))
9080
			return node->Data();
9099
			return node->Data();
9081
	}
9100
	}
9082
	return NULL;
9101
	return NULL;
9083
}
9102
}
9084
const SAvailablePackage* CPackages::findAvailablePackage(const Utils::String& name, const Utils::String& author) const
9103
const SAvailablePackage* CPackages::findAvailablePackage(const Utils::String& name, const Utils::String& author) const
-
 
9104
{
-
 
9105
	for (CListNode<SAvailablePackage>* node = m_lAvailablePackages.Front(); node; node = node->next())
-
 
9106
	{
-
 
9107
		if (node->Data()->sName.Compare(name) && node->Data()->sAuthor.Compare(author))
-
 
9108
			return node->Data();
-
 
9109
	}
-
 
9110
	return NULL;
-
 
9111
}
-
 
9112
 
-
 
9113
CBaseFile* CPackages::findFoundPackage(const Utils::String& name, const Utils::String& author) const
9085
{
9114
{
9086
	for (CListNode<SAvailablePackage>* node = m_lAvailablePackages.Front(); node; node = node->next())
9115
	for (CListNode<CBaseFile>* node = m_lFoundPackages.Front(); node; node = node->next())
9087
	{
9116
	{
9088
		if (node->Data()->sName.Compare(name) &amp;&amp; node->Data()->sAuthor.Compare(author))
9117
		if (node->Data()->name().Compare(name) &&amp; node-&gt;Data()->author().Compare(author))
9089
			return node->Data();
9118
			return node->Data();
9090
	}
9119
	}
9091
	return NULL;
9120
	return NULL;
9092
}
9121
}
-
 
9122
 
9093
 
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;
Line 9102... Line 9132...
9102
			}
9132
			}
9103
		}
9133
		}
9104
 
9134
 
9105
		if ( !found )
9135
		if ( !found )
9106
			return false;
9136
			return false;
-
 
9137
	}
-
 
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;		
9107
	}
9145
	}
9108
 
9146
 
9109
	const SAvailablePackage *p = findAvailablePackage(package->sFilename);
9147
	const SAvailablePackage *p = findAvailablePackage(package->sFilename);
9110
	if(p)
9148
	if(p)
9111
	{
9149
	{