Subversion Repositories spk

Rev

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

Rev 207 Rev 210
Line 688... Line 688...
688
bool CXspFile::writeHeader(CFileIO &file, int valueheader, int valueComprLen) const
688
bool CXspFile::writeHeader(CFileIO &file, int valueheader, int valueComprLen) const
689
{
689
{
690
	return file.write("XSPCycrow;%.2f;%d;%d\n", FILEVERSION, valueheader, valueComprLen);
690
	return file.write("XSPCycrow;%.2f;%d;%d\n", FILEVERSION, valueheader, valueComprLen);
691
}
691
}
692
 
692
 
693
bool CXspFile::_checkHeader(const Utils::String header) const
693
bool CXspFile::_checkHeader(const Utils::WString &header) const
694
{
694
{
695
	if ( header.Compare("XSPCycrow") )
695
	if ( header.Compare(L"XSPCycrow") )
696
		return true;
696
		return true;
697
	return false;
697
	return false;
698
}
698
}
699
 
699
 
700
void CXspFile::SetLaserMask(int game, int mask)
700
void CXspFile::SetLaserMask(int game, int mask)
Line 778... Line 778...
778
	if ( !m_sData.empty() )
778
	if ( !m_sData.empty() )
779
		return m_sData.token(";", TSHIPPOS_CLASS);
779
		return m_sData.token(";", TSHIPPOS_CLASS);
780
	return "OBJ_SHIP_M5";
780
	return "OBJ_SHIP_M5";
781
}
781
}
782
 
782
 
783
bool CXspFile::GeneratePackagerScript(bool wildcard, Utils::CStringList *list, int game, const Utils::CStringList &gameAddons, bool datafile)
783
bool CXspFile::GeneratePackagerScript(bool wildcard, Utils::WStringList *list, int game, const Utils::WStringList &gameAddons, bool datafile)
784
{
784
{
785
	if ( !CBaseFile::GeneratePackagerScript(wildcard, list, game, gameAddons, datafile) )
785
	if ( !CBaseFile::GeneratePackagerScript(wildcard, list, game, gameAddons, datafile) )
786
		return false;
786
		return false;
787
 
787
 
788
	list->pushBack("# File Type, Script or Ship");
788
	list->pushBack(L"# File Type, Script or Ship");
789
	list->pushBack("FileType: Ship");
789
	list->pushBack(L"FileType: Ship");
790
	list->pushBack("");
790
	list->pushBack(L"");
791
 
791
 
792
	if ( m_iShipyard )
792
	if ( m_iShipyard )
793
	{
793
	{
794
		list->pushBack("# Shipyards, Set which shipyards to add ships for sale to");
794
		list->pushBack(L"# Shipyards, Set which shipyards to add ships for sale to");
795
		for ( int i = SHIPYARD_ARGON; i <= SHIPYARD_MAX; i *= 2 )
795
		for ( int i = SHIPYARD_ARGON; i <= SHIPYARD_MAX; i *= 2 )
796
		{
796
		{
797
			if ( this->IsShipyard(i) )
797
			if ( this->IsShipyard(i) )
798
				list->pushBack("Shipyard: " + GetShipyardName(i));
798
				list->pushBack(L"Shipyard: " + GetShipyardName(i).toWString());
799
		}
799
		}
800
		list->pushBack("");
800
		list->pushBack(L"");
801
	}
801
	}
802
 
802
 
803
	if ( m_iOrgDesc > 0 )
803
	if ( m_iOrgDesc > 0 )
804
	{
804
	{
805
		list->pushBack("# Use Original Description, overrides text entrys to use one of the built in text");
805
		list->pushBack(L"# Use Original Description, overrides text entrys to use one of the built in text");
806
		list->pushBack(Utils::String("OriginalDescription: ") + (long)m_iOrgDesc);
806
		list->pushBack(Utils::WString(L"OriginalDescription: ") + (long)m_iOrgDesc);
807
		list->pushBack("");
807
		list->pushBack(L"");
808
	}
808
	}
809
 
809
 
810
	if ( !m_sID.empty() )
810
	if ( !m_sID.empty() )
811
	{
811
	{
812
		list->pushBack("# Ship ID, the ship id to identify the ship as");
812
		list->pushBack(L"# Ship ID, the ship id to identify the ship as");
813
		list->pushBack("ShipID: " + m_sID);
813
		list->pushBack(L"ShipID: " + m_sID.toWString());
814
	}
814
	}
815
 
815
 
816
	if ( m_bExistingShip )
816
	if ( m_bExistingShip )
817
	{
817
	{
818
		list->pushBack("# Existing Ship, replaces an existing ship in the game with ship package instead of creating a new entry");
818
		list->pushBack(L"# Existing Ship, replaces an existing ship in the game with ship package instead of creating a new entry");
819
		list->pushBack("ExistingShip");
819
		list->pushBack(L"ExistingShip");
820
		list->pushBack("");
820
		list->pushBack(L"");
821
	}
821
	}
822
 
822
 
823
	if ( !m_sData.empty() )
823
	if ( !m_sData.empty() )
824
	{
824
	{
825
		list->pushBack("# Ship Data, the TShip data entry to add to the game (parts of this are adjusted and auto generated by the installer)");
825
		list->pushBack(L"# Ship Data, the TShip data entry to add to the game (parts of this are adjusted and auto generated by the installer)");
826
		list->pushBack("ShipData: " + m_sData);
826
		list->pushBack(L"ShipData: " + m_sData.toWString());
827
		list->pushBack("");
827
		list->pushBack(L"");
828
	}
828
	}
829
 
829
 
830
	if ( m_lText.size() ) {
830
	if ( m_lText.size() ) {
831
		list->pushBack("# Ship Texts, the name/description of the ship in each language: <LANGID> <NAME>|<DESCRIPTION>");
831
		list->pushBack(L"# Ship Texts, the name/description of the ship in each language: <LANGID> <NAME>|<DESCRIPTION>");
832
		for(CListNode<SText> *node = m_lText.Front(); node; node = node->next()) {
832
		for(CListNode<SText> *node = m_lText.Front(); node; node = node->next()) {
833
			list->pushBack(Utils::String("ShipText: ") + (long)node->Data()->iId + " " + node->Data()->sName + "|" + node->;Data()->sDesc);
833
			list->pushBack(Utils::WString(L"ShipText: ") + (long)node->Data()->iId + L" " + node->Data()->sName.toWString() + L"|" + node->;Data()->sDesc.toWString());
834
		}
834
		}
835
 
835
 
836
		list->pushBack("");
836
		list->pushBack(L"");
837
	}
837
	}
838
 
838
 
839
	if ( this->m_lWeaponMasks.size() ) {
839
	if ( this->m_lWeaponMasks.size() ) {
840
		list->pushBack("# Weapon Masks, the weapons for each game: <GAME> <MASK>");
840
		list->pushBack(L"# Weapon Masks, the weapons for each game: <GAME> <MASK>");
841
		for(CListNode<SWeaponMask> *node = m_lWeaponMasks.Front(); node; node = node->next()) {
841
		for(CListNode<SWeaponMask> *node = m_lWeaponMasks.Front(); node; node = node->next()) {
842
			list->pushBack(Utils::String("WeaponMask: ") + (long)node->Data()->iGame + " " + (long)node->Data()->iMask);
842
			list->pushBack(Utils::WString(L"WeaponMask: ") + (long)node->Data()->iGame + L" " + (long)node->Data()->iMask);
843
		}
843
		}
844
 
844
 
845
		list->pushBack("");
845
		list->pushBack(L"");
846
	}
846
	}
847
 
847
 
848
	if ( this->m_lMissileMasks.size() ) {
848
	if ( this->m_lMissileMasks.size() ) {
849
		list->pushBack("# Missile Masks, the missiles for each game: <GAME> <MASK>");
849
		list->pushBack(L"# Missile Masks, the missiles for each game: <GAME> <MASK>");
850
		for(CListNode<SWeaponMask> *node = m_lMissileMasks.Front(); node; node = node->next()) {
850
		for(CListNode<SWeaponMask> *node = m_lMissileMasks.Front(); node; node = node->next()) {
851
			list->pushBack(Utils::String("WeaponMask: ") + (long)node->Data()->iGame + " " + (long)node->Data()->iMask);
851
			list->pushBack(Utils::WString(L"WeaponMask: ") + (long)node->Data()->iGame + L" " + (long)node->Data()->iMask);
852
		}
852
		}
853
 
853
 
854
		list->pushBack("");
854
		list->pushBack("");
855
	}
855
	}
856
 
856
 
857
	if ( this->m_lComponent.size() ) {
857
	if ( this->m_lComponent.size() ) {
858
		list->pushBack("# Ship Components, each component used in the ships scene: <SECTION> <MODELENTRY> <VALUES>");
858
		list->pushBack(L"# Ship Components, each component used in the ships scene: <SECTION> <MODELENTRY> <VALUES>");
859
		for(CListNode<SComponent> *node = m_lComponent.Front(); node; node = node->next()) {
859
		for(CListNode<SComponent> *node = m_lComponent.Front(); node; node = node->next()) {
860
			list->pushBack(Utils::String("Component: ") + node->Data()->sSection + " " + node->Data()->sSection2 + " " + node->Data()->sData);
860
			list->pushBack(Utils::WString(L"Component: ") + node->Data()->sSection.toWString() + L" " + node->Data()->sSection2.toWString() + L" " + node->Data()->sData.toWString());
861
		}
861
		}
862
		list->pushBack("");
862
		list->pushBack(L"");
863
	}
863
	}
864
 
864
 
865
	if ( this->m_lDummy.size() ) {
865
	if ( this->m_lDummy.size() ) {
866
		list->pushBack("# Ship Dummies, each dummy entry used in the ships scene: <SECTION> <VALUE>");
866
		list->pushBack(L"# Ship Dummies, each dummy entry used in the ships scene: <SECTION> <VALUE>");
867
		for(CListNode<SDummy> *node = m_lDummy.Front(); node; node = node->next()) {
867
		for(CListNode<SDummy> *node = m_lDummy.Front(); node; node = node->next()) {
868
			list->pushBack("Dummy: " + node->Data()->sSection + " " + node->;Data()->sData);
868
			list->pushBack(L"Dummy: " + node->Data()->sSection.toWString() + L" " + node->;Data()->sData.toWString());
869
		}
869
		}
870
		list->pushBack("");
870
		list->pushBack(L"");
871
	}
871
	}
872
 
872
 
873
	if ( this->m_lCockpit.size() ) {
873
	if ( this->m_lCockpit.size() ) {
874
		list->pushBack("# Cockpit entries, each cockpit value with thier weapons mask");
874
		list->pushBack(L"# Cockpit entries, each cockpit value with thier weapons mask");
875
		for(CListNode<SCockpit> *node = m_lCockpit.Front(); node; node = node->next()) {
875
		for(CListNode<SCockpit> *node = m_lCockpit.Front(); node; node = node->next()) {
876
			list->pushBack("Cockpit: " + node->Data()->sCockpit.token(";", 19) + " " + node->;Data()->sCockpit);
876
			list->pushBack(L"Cockpit: " + node->Data()->sCockpit.toWString().token(L";", 19) + L" " + node->;Data()->sCockpit.toWString());
877
			for(SWeaponMask *mask = node->Data()->lWeaponMask.First(); mask; mask = node->Data()->lWeaponMask.Next()) {
877
			for(SWeaponMask *mask = node->Data()->lWeaponMask.First(); mask; mask = node->Data()->lWeaponMask.Next()) {
878
				list->pushBack("CockpitWeapon: " + node->Data()->sCockpit.token(";", 19) + " " + (long)mask->iGame + " " + (long)mask->iMask);
878
				list->pushBack(L"CockpitWeapon: " + node->Data()->sCockpit.toWString().token(L";", 19) + L" " + (long)mask->iGame + L" " + (long)mask->iMask);
879
			}
879
			}
880
		}
880
		}
881
 
881
 
882
		list->pushBack("");
882
		list->pushBack(L"");
883
	}
883
	}
884
 
884
 
885
	if (!this->_lCutData.empty())
885
	if (!this->_lCutData.empty())
886
	{
886
	{
887
		list->pushBack("# Ship Cut Data");
887
		list->pushBack(L"# Ship Cut Data");
888
		for(auto itr = _lCutData.begin(); itr != _lCutData.end(); itr++)
888
		for(auto itr = _lCutData.begin(); itr != _lCutData.end(); itr++)
889
			list->pushBack("CutData: " + (*itr)->str);
889
			list->pushBack(L"CutData: " + (*itr)->str.toWString());
890
		list->pushBack("");
890
		list->pushBack(L"");
891
	}
891
	}
892
 
892
 
893
	if (!this->_lBodies.empty())
893
	if (!this->_lBodies.empty())
894
	{
894
	{
895
		list->pushBack("# Ship Bodies");
895
		list->pushBack(L"# Ship Bodies");
896
		for(auto itr = _lBodies.begin(); itr != _lBodies.end(); itr++)
896
		for(auto itr = _lBodies.begin(); itr != _lBodies.end(); itr++)
897
			list->pushBack("Bodies: " + (*itr)->str);
897
			list->pushBack(L"Bodies: " + (*itr)->str.toWString());
898
		list->pushBack("");
898
		list->pushBack(L"");
899
	}
899
	}
900
 
900
 
901
	if (!this->_lAnimations.empty())
901
	if (!this->_lAnimations.empty())
902
	{
902
	{
903
		list->pushBack("# Ship Animations");
903
		list->pushBack(L"# Ship Animations");
904
		for (auto itr = _lAnimations.begin(); itr != _lAnimations.end(); itr++)
904
		for (auto itr = _lAnimations.begin(); itr != _lAnimations.end(); itr++)
905
			list->pushBack("Animation: " + (*itr)->str);	
905
			list->pushBack(L"Animation: " + (*itr)->str.toWString());	
906
		list->pushBack("");
906
		list->pushBack(L"");
907
	}
907
	}
908
 
908
 
909
	if ( !datafile )
909
	if ( !datafile )
910
	{
910
	{
911
		if ( !CBaseFile::GeneratePackagerScriptFile(wildcard, list, game, gameAddons) )
911
		if ( !CBaseFile::GeneratePackagerScriptFile(wildcard, list, game, gameAddons) )