Subversion Repositories spk

Rev

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

Rev 213 Rev 214
Line 963... Line 963...
963
	if ( package->GetType() == TYPE_SPK )
963
	if ( package->GetType() == TYPE_SPK )
964
	{
964
	{
965
		CSpkFile *spk = (CSpkFile *)package;
965
		CSpkFile *spk = (CSpkFile *)package;
966
		if ( spk->GetScriptType() == CSpkFile::SCRIPTTYPE_CUSTOM )
966
		if ( spk->GetScriptType() == CSpkFile::SCRIPTTYPE_CUSTOM )
967
		{
967
		{
968
			Utils::String type = spk->GetScriptTypeString(44);
968
			Utils::WString type = spk->scriptTypeString(44);
969
			if ( type.Compare("Ship Upgrade") )
969
			if ( type.Compare(L"Ship Upgrade") )
970
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_SHIPUPGRADE);
970
				spk->setScriptType(CSpkFile::SCRIPTTYPE_SHIPUPGRADE);
971
			else if ( type.Compare("Trade Script") )
971
			else if ( type.Compare(L"Trade Script") )
972
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_TRADE);
972
				spk->setScriptType(CSpkFile::SCRIPTTYPE_TRADE);
973
			else if ( type.Compare("Fleet Management") )
973
			else if ( type.Compare(L"Fleet Management") )
974
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_FLEET);
974
				spk->setScriptType(CSpkFile::SCRIPTTYPE_FLEET);
975
			else if ( type.Compare("Navigation Script") )
975
			else if ( type.Compare(L"Navigation Script") )
976
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_NAVIGATION);
976
				spk->setScriptType(CSpkFile::SCRIPTTYPE_NAVIGATION);
977
			else if ( type.Compare("Piracy") )
977
			else if ( type.Compare(L"Piracy") )
978
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_PIRACY);
978
				spk->setScriptType(CSpkFile::SCRIPTTYPE_PIRACY);
979
			else if ( type.Compare("Other") )
979
			else if ( type.Compare(L"Other") )
980
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_OTHER);
980
				spk->setScriptType(CSpkFile::SCRIPTTYPE_OTHER);
981
			else if ( type.Compare("Ship Command") )
981
			else if ( type.Compare(L"Ship Command") )
982
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_SHIPCOMMAND);
982
				spk->setScriptType(CSpkFile::SCRIPTTYPE_SHIPCOMMAND);
983
			else if ( type.Compare("Station Command") )
983
			else if ( type.Compare(L"Station Command") )
984
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_STATIONCOMMAND);
984
				spk->setScriptType(CSpkFile::SCRIPTTYPE_STATIONCOMMAND);
985
			else if ( type.Compare("al plugin") )
985
			else if ( type.Compare(L"al plugin") )
986
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_ALPLUGIN);
986
				spk->setScriptType(CSpkFile::SCRIPTTYPE_ALPLUGIN);
987
			else if ( type.Compare("combat script") )
987
			else if ( type.Compare(L"combat script") )
988
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_COMBAT);
988
				spk->setScriptType(CSpkFile::SCRIPTTYPE_COMBAT);
989
			else if ( type.Compare("bbs and missions") )
989
			else if ( type.Compare(L"bbs and missions") )
990
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_MISSION);
990
				spk->setScriptType(CSpkFile::SCRIPTTYPE_MISSION);
991
			else if ( type.Compare("extension mod") )
991
			else if ( type.Compare(L"extension mod") )
992
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_EXTENSION);
992
				spk->setScriptType(CSpkFile::SCRIPTTYPE_EXTENSION);
993
			else if ( type.Compare("rebalance mod") )
993
			else if ( type.Compare(L"rebalance mod") )
994
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_REBALANCE);
994
				spk->setScriptType(CSpkFile::SCRIPTTYPE_REBALANCE);
995
			else if ( type.Compare("general mod") )
995
			else if ( type.Compare(L"general mod") )
996
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_GENERALMOD);
996
				spk->setScriptType(CSpkFile::SCRIPTTYPE_GENERALMOD);
997
			else if ( type.Compare("total conversion") )
997
			else if ( type.Compare(L"total conversion") )
998
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_TOTAL);
998
				spk->setScriptType(CSpkFile::SCRIPTTYPE_TOTAL);
999
			else if ( type.Compare("cheat script") )
999
			else if ( type.Compare(L"cheat script") )
1000
				spk->SetScriptType(CSpkFile::SCRIPTTYPE_CHEAT);
1000
				spk->setScriptType(CSpkFile::SCRIPTTYPE_CHEAT);
1001
			else if ( type == "Library Script" )
1001
			else if ( type == L"Library Script" )
1002
			{
1002
			{
1003
				spk->SetScriptType("");
1003
				spk->setScriptType(L"");
1004
				spk->SetLibrary();
1004
				spk->SetLibrary();
1005
			}
1005
			}
1006
 
1006
 
1007
			if ( spk->GetScriptType() != CSpkFile::SCRIPTTYPE_CUSTOM )
1007
			if ( spk->GetScriptType() != CSpkFile::SCRIPTTYPE_CUSTOM )
1008
				spk->SetScriptType("");
1008
				spk->setScriptType(L"");
1009
		}
1009
		}
1010
	}
1010
	}
1011
	else if ( package->GetType() == TYPE_XSP )
1011
	else if ( package->GetType() == TYPE_XSP )
1012
	{
1012
	{
1013
		CXspFile *xsp = (CXspFile *)package;
1013
		CXspFile *xsp = (CXspFile *)package;
Line 1053... Line 1053...
1053
 
1053
 
1054
	// check for another mod
1054
	// check for another mod
1055
	if ( !package->IsAnotherMod() )
1055
	if ( !package->IsAnotherMod() )
1056
		return;
1056
		return;
1057
 
1057
 
1058
	package->SetParent((CSpkFile *)findSpkPackage(package->GetOtherName(), package->GetOtherAuthor()));
1058
	package->SetParent((CSpkFile *)findSpkPackage(package->otherName(), package->otherAuthor()));
1059
}
1059
}
1060
 
1060
 
1061
/**
1061
/**
1062
 * Updates the package list once data has been read
1062
 * Updates the package list once data has been read
1063
 *
1063
 *
Line 1777... Line 1777...
1777
	// now we need to link any child/parent packages
1777
	// now we need to link any child/parent packages
1778
	if ( package->GetType() == TYPE_SPK )
1778
	if ( package->GetType() == TYPE_SPK )
1779
	{
1779
	{
1780
		CSpkFile *spk = (CSpkFile *)package;
1780
		CSpkFile *spk = (CSpkFile *)package;
1781
		if ( spk->IsAnotherMod() ) {
1781
		if ( spk->IsAnotherMod() ) {
1782
			spk->SetParent((CSpkFile *)findSpkPackage(spk->GetOtherName(), spk->GetOtherAuthor()));
1782
			spk->SetParent((CSpkFile *)findSpkPackage(spk->otherName(), spk->otherAuthor()));
1783
			CLog::logf(CLog::Log_Install, 2, "Linking to parent package: %s by %s (Version: %s)", spk->name().c_str(), spk->author().c_str(), spk->version().c_str());
1783
			CLog::logf(CLog::Log_Install, 2, "Linking to parent package: %s by %s (Version: %s)", spk->name().c_str(), spk->author().c_str(), spk->version().c_str());
1784
		}
1784
		}
1785
	}
1785
	}
1786
 
1786
 
1787
	// store enabled mod
1787
	// store enabled mod
Line 3642... Line 3642...
3642
	if ( package->GetType() == TYPE_SPK )
3642
	if ( package->GetType() == TYPE_SPK )
3643
	{
3643
	{
3644
		CSpkFile *spk = (CSpkFile *)package;
3644
		CSpkFile *spk = (CSpkFile *)package;
3645
		if ( spk->IsAnotherMod() )
3645
		if ( spk->IsAnotherMod() )
3646
		{
3646
		{
3647
			if ( !findSpkPackage(spk->GetOtherName(), spk->GetOtherAuthor()) )
3647
			if ( !findSpkPackage(spk->otherName(), spk->otherAuthor()) )
3648
			{
3648
			{
3649
				// check the install list
3649
				// check the install list
3650
				if ( m_lInstallList.empty() )
3650
				if ( m_lInstallList.empty() )
3651
					return false;
3651
					return false;
3652
 
3652
 
3653
				bool found = false;
3653
				bool found = false;
3654
				for ( CListNode<CBaseFile> *node = m_lInstallList.Front(); node; node = node->next() )
3654
				for ( CListNode<CBaseFile> *node = m_lInstallList.Front(); node; node = node->next() )
3655
				{
3655
				{
3656
					if ( spk->GetOtherName().Compare(node->Data()->name().toString()) && spk->GetOtherAuthor().Compare(node->Data()->author().toString()) )
3656
					if ( spk->otherName().Compare(node->Data()->name()) && spk->otherAuthor().Compare(node->Data()->author()) )
3657
					{
3657
					{
3658
						found = true;
3658
						found = true;
3659
						break;
3659
						break;
3660
					}
3660
					}
3661
				}
3661
				}
Line 3674... Line 3674...
3674
	// check the for another mod
3674
	// check the for another mod
3675
	if ( p->GetType() == TYPE_SPK )
3675
	if ( p->GetType() == TYPE_SPK )
3676
	{
3676
	{
3677
		if ( ((CSpkFile *)p)->IsAnotherMod() )
3677
		if ( ((CSpkFile *)p)->IsAnotherMod() )
3678
		{
3678
		{
3679
			CBaseFile *parent = this->findSpkPackage(((CSpkFile *)p)->GetOtherName(), ((CSpkFile *)p)->GetOtherAuthor());
3679
			CBaseFile *parent = this->findSpkPackage(((CSpkFile *)p)->otherName(), ((CSpkFile *)p)->otherAuthor());
3680
			if ( parent )
3680
			if ( parent )
3681
			{
3681
			{
3682
				if ( !parent->IsEnabled() )
3682
				if ( !parent->IsEnabled() )
3683
					return false;
3683
					return false;
3684
			}
3684
			}
Line 3868... Line 3868...
3868
	{
3868
	{
3869
		CSpkFile* spk = (CSpkFile*)p;
3869
		CSpkFile* spk = (CSpkFile*)p;
3870
		if (spk->IsAnotherMod())
3870
		if (spk->IsAnotherMod())
3871
		{
3871
		{
3872
			bool found = true;
3872
			bool found = true;
3873
			if (!this->findSpkPackage(spk->GetOtherName(), spk->GetOtherAuthor()))
3873
			if (!this->findSpkPackage(spk->otherName(), spk->otherAuthor()))
3874
			{
3874
			{
3875
				if (includePrepared)
3875
				if (includePrepared)
3876
				{
3876
				{
3877
					found = false;
3877
					found = false;
3878
					for (CListNode<CBaseFile>* pNode = m_lInstallList.Front(); pNode; pNode = pNode->next())
3878
					for (CListNode<CBaseFile>* pNode = m_lInstallList.Front(); pNode; pNode = pNode->next())
Line 3889... Line 3889...
3889
					found = false;
3889
					found = false;
3890
			}
3890
			}
3891
 
3891
 
3892
			if (!found)
3892
			if (!found)
3893
			{
3893
			{
3894
				const SAvailablePackage* available = findAvailablePackage(spk->GetOtherName(), spk->GetOtherAuthor());
3894
				const SAvailablePackage* available = findAvailablePackage(spk->otherName(), spk->otherAuthor());
3895
				if (available)
3895
				if (available)
3896
					list.push_back(available);
3896
					list.push_back(available);
3897
				++count;
3897
				++count;
3898
			}
3898
			}
3899
		}
3899
		}
Line 3924... Line 3924...
3924
	{
3924
	{
3925
		CSpkFile *spk = (CSpkFile *)p;
3925
		CSpkFile *spk = (CSpkFile *)p;
3926
		if ( spk->IsAnotherMod() )
3926
		if ( spk->IsAnotherMod() )
3927
		{
3927
		{
3928
			bool found = true;
3928
			bool found = true;
3929
			if ( !this->findSpkPackage(spk->GetOtherName(), spk->GetOtherAuthor()) )
3929
			if ( !this->findSpkPackage(spk->otherName(), spk->otherAuthor()) )
3930
			{
3930
			{
3931
				if ( includePrepared )
3931
				if ( includePrepared )
3932
				{
3932
				{
3933
					found = false;
3933
					found = false;
3934
					for ( CListNode<CBaseFile> *pNode = m_lInstallList.Front(); pNode; pNode = pNode->next() )
3934
					for ( CListNode<CBaseFile> *pNode = m_lInstallList.Front(); pNode; pNode = pNode->next() )
Line 3946... Line 3946...
3946
			}
3946
			}
3947
 
3947
 
3948
			if ( !found )
3948
			if ( !found )
3949
			{
3949
			{
3950
				if ( list )
3950
				if ( list )
3951
					list->pushBack(spk->GetOtherName(), spk->GetOtherAuthor());
3951
					list->pushBack(spk->otherName(), spk->otherAuthor());
3952
				++count;
3952
				++count;
3953
			}
3953
			}
3954
		}
3954
		}
3955
	}
3955
	}
3956
 
3956
 
Line 5899... Line 5899...
5899
		writeData.push_back(L"		<t id=\"" + Utils::WString::Number((long)start) + L"\">" + this->convertTextString(p->name()) + L"</t>");
5899
		writeData.push_back(L"		<t id=\"" + Utils::WString::Number((long)start) + L"\">" + this->convertTextString(p->name()) + L"</t>");
5900
		writeData.push_back(L"		<t id=\"" + Utils::WString::Number((long)(start + 1)) + L"\">" + this->convertTextString(p->author()) + L"</t>");
5900
		writeData.push_back(L"		<t id=\"" + Utils::WString::Number((long)(start + 1)) + L"\">" + this->convertTextString(p->author()) + L"</t>");
5901
		writeData.push_back(L"		<t id=\"" + Utils::WString::Number((long)(start + 2)) + L"\">" + this->convertTextString(p->version()) + L"</t>");
5901
		writeData.push_back(L"		<t id=\"" + Utils::WString::Number((long)(start + 2)) + L"\">" + this->convertTextString(p->version()) + L"</t>");
5902
		writeData.push_back(L"		<t id=\"" + Utils::WString::Number((long)(start + 3)) + L"\">" + this->convertTextString(p->name(lang)) + L"</t>");
5902
		writeData.push_back(L"		<t id=\"" + Utils::WString::Number((long)(start + 3)) + L"\">" + this->convertTextString(p->name(lang)) + L"</t>");
5903
 
5903
 
5904
		CLinkList<SSettingType> *settings = spk->GetSettingsList();
5904
		CLinkList<SSettingType> *settings = spk->settingsList();
5905
		if ( settings && settings->size() )
5905
		if ( settings && settings->size() )
5906
		{
5906
		{
5907
			writeData.push_back(Utils::WString(L"		<t id=\"") + (long)(start + 4) + L"\">" + (long)settings->size() + L"</t>");
5907
			writeData.push_back(Utils::WString(L"		<t id=\"") + (long)(start + 4) + L"\">" + (long)settings->size() + L"</t>");
5908
			writeData.push_back(Utils::WString(L"		<t id=\"") + (long)(start + 5) + L"\">" + (long)settingStart + L"</t>");
5908
			writeData.push_back(Utils::WString(L"		<t id=\"") + (long)(start + 5) + L"\">" + (long)settingStart + L"</t>");
5909
 
5909
 
5910
			for ( CListNode<SSettingType> *sNode = settings->Front(); sNode; sNode = sNode->next() )
5910
			for ( CListNode<SSettingType> *sNode = settings->Front(); sNode; sNode = sNode->next() )
5911
			{
5911
			{
5912
				SSettingType *st = sNode->Data();
5912
				SSettingType *st = sNode->Data();
5913
				writeData.push_back(Utils::WString(L"		<t id=\"") + (long)(settingStart++) + L"\">" + st->sKey.toWString() + L"</t>");
5913
				writeData.push_back(Utils::WString(L"		<t id=\"") + (long)(settingStart++) + L"\">" + st->sKey + L"</t>");
5914
				writeData.push_back(Utils::WString(L"		<t id=\"") + (long)(settingStart++) + L"\">" + spk->GetSetting(st).toWString() + L"</t>");
5914
				writeData.push_back(Utils::WString(L"		<t id=\"") + (long)(settingStart++) + L"\">" + spk->getSetting(st) + L"</t>");
5915
			}
5915
			}
5916
		}
5916
		}
5917
		else
5917
		else
5918
			writeData.push_back(Utils::WString(L"		<t id=\"") + (long)(start + 4) + L"\">0</t>");
5918
			writeData.push_back(Utils::WString(L"		<t id=\"") + (long)(start + 4) + L"\">0</t>");
5919
 
5919
 
Line 8651... Line 8651...
8651
	if (from->type() == BaseFileType::TYPE_SPK)
8651
	if (from->type() == BaseFileType::TYPE_SPK)
8652
	{
8652
	{
8653
		CSpkFile* fromSpk = dynamic_cast<CSpkFile*>(from);
8653
		CSpkFile* fromSpk = dynamic_cast<CSpkFile*>(from);
8654
		if (fromSpk->isAnotherMod())
8654
		if (fromSpk->isAnotherMod())
8655
		{
8655
		{
8656
			if (fromSpk->otherName().toWString().Compare(to->name()) &amp;& fromSpk->otherAuthor().toWString().Compare(to->author()))
8656
			if (fromSpk->otherName().Compare(to->name()) &amp;& fromSpk->otherAuthor().Compare(to->author()))
8657
				return false;
8657
				return false;
8658
		}
8658
		}
8659
	}
8659
	}
8660
	if (to->type() == BaseFileType::TYPE_SPK)
8660
	if (to->type() == BaseFileType::TYPE_SPK)
8661
	{
8661
	{
8662
		CSpkFile* toSpk = dynamic_cast<CSpkFile*>(to);
8662
		CSpkFile* toSpk = dynamic_cast<CSpkFile*>(to);
8663
		if (toSpk->isAnotherMod())
8663
		if (toSpk->isAnotherMod())
8664
		{
8664
		{
8665
			if (toSpk->otherName().toWString().Compare(from->name()) &amp;& toSpk->otherAuthor().toWString().Compare(from->author()))
8665
			if (toSpk->otherName().Compare(from->name()) &amp;& toSpk->otherAuthor().Compare(from->author()))
8666
				return false;
8666
				return false;
8667
		}
8667
		}
8668
	}
8668
	}
8669
 
8669
 
8670
	int count = 0;
8670
	int count = 0;