Subversion Repositories spk

Rev

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

Rev 126 Rev 127
Line 591... Line 591...
591
	}
591
	}
592
 
592
 
593
	return "Other";
593
	return "Other";
594
}
594
}
595
 
595
 
596
bool CSpkFile::LoadPackageData(const Utils::String &sFirst, const Utils::String &sRest, const Utils::String &sMainGame, Utils::CStringList &otherGames)
596
bool CSpkFile::LoadPackageData(const Utils::String &sFirst, const Utils::String &sRest, const Utils::String &sMainGame, Utils::CStringList &otherGames, Utils::CStringList &gameAddons)
597
{
597
{
598
	if ( sFirst.Compare("ScriptType") )
598
	if ( sFirst.Compare("ScriptType") )
599
	{
599
	{
600
		if ( sRest.Compare("Library") || sRest.Compare("Library Script") )
600
		if ( sRest.Compare("Library") || sRest.Compare("Library Script") )
601
			this->SetLibrary();
601
			this->SetLibrary();
Line 682... Line 682...
682
		}
682
		}
683
		m_lWares.push_back ( ware );
683
		m_lWares.push_back ( ware );
684
		m_pLastWare = ware;
684
		m_pLastWare = ware;
685
	}
685
	}
686
 
686
 
687
	else if ( CBaseFile::LoadPackageData(sFirst, sRest, sMainGame, otherGames) )
687
	else if ( CBaseFile::LoadPackageData(sFirst, sRest, sMainGame, otherGames, gameAddons) )
688
		return true;
688
		return true;
689
	else
689
	else
690
		return false;
690
		return false;
691
 
691
 
692
	return true;
692
	return true;
693
}
693
}
694
 
694
 
695
bool CSpkFile::GeneratePackagerScript(bool wildcard, Utils::CStringList *list, int game, bool datafile)
695
bool CSpkFile::GeneratePackagerScript(bool wildcard, Utils::CStringList *list, int game, const Utils::CStringList &gameAddons, bool datafile)
696
{
696
{
697
	if ( !CBaseFile::GeneratePackagerScript(wildcard, list, game, datafile) )
697
	if ( !CBaseFile::GeneratePackagerScript(wildcard, list, game, gameAddons, datafile) )
698
		return false;
698
		return false;
699
 
699
 
700
	list->pushBack("# File Type, Script or Ship");
700
	list->pushBack("# File Type, Script or Ship");
701
	list->pushBack("FileType: Script");
701
	list->pushBack("FileType: Script");
702
	list->pushBack("");
702
	list->pushBack("");
Line 743... Line 743...
743
		}
743
		}
744
	}
744
	}
745
 
745
 
746
	if ( !datafile )
746
	if ( !datafile )
747
	{
747
	{
748
		if ( !CBaseFile::GeneratePackagerScriptFile(wildcard, list, game) )
748
		if ( !CBaseFile::GeneratePackagerScriptFile(wildcard, list, game, gameAddons) )
749
			return false;
749
			return false;
750
	}
750
	}
751
 
751
 
752
	return true;
752
	return true;
753
 
753
 
Line 984... Line 984...
984
	else if ( sFile.Compare("Mod") || sFile.Compare("Extra") || sFile.Compare("Screen") || sFile.Compare("Sound") )
984
	else if ( sFile.Compare("Mod") || sFile.Compare("Extra") || sFile.Compare("Screen") || sFile.Compare("Sound") )
985
		return "";
985
		return "";
986
	return "-- End of Script --";
986
	return "-- End of Script --";
987
}
987
}
988
 
988
 
989
int CSpkFile::_convert_fileType(const Utils::String &sFile)
989
FileType CSpkFile::_convert_fileType(const Utils::String &sFile)
990
{
990
{
991
	if ( sFile.Compare("Text") )
991
	if ( sFile.Compare("Text") )
992
		return FILETYPE_TEXT;
992
		return FILETYPE_TEXT;
993
	else if ( sFile.Compare("Uninstall") )
993
	else if ( sFile.Compare("Uninstall") )
994
		return FILETYPE_UNINSTALL;
994
		return FILETYPE_UNINSTALL;
Line 1137... Line 1137...
1137
unsigned char *CSpkFile::_convert_parseFile(const Utils::String &sCmd, const Utils::String &sRest, float fVersion, unsigned char *d)
1137
unsigned char *CSpkFile::_convert_parseFile(const Utils::String &sCmd, const Utils::String &sRest, float fVersion, unsigned char *d)
1138
{
1138
{
1139
	bool bShared = (sCmd.left(9) == "$$$Shared") ? true : false;
1139
	bool bShared = (sCmd.left(9) == "$$$Shared") ? true : false;
1140
	Utils::String sFile = sCmd.right(-3).left(-1);
1140
	Utils::String sFile = sCmd.right(-3).left(-1);
1141
	Utils::String sEnd = this->_convert_fileEndString(sFile);
1141
	Utils::String sEnd = this->_convert_fileEndString(sFile);
1142
	int iType = this->_convert_fileType(sFile);
1142
	FileType iType = this->_convert_fileType(sFile);
1143
 
1143
 
1144
	// convert the filename and directory
1144
	// convert the filename and directory
1145
	Utils::String dir, filename = _convert_parseFilename(sRest, fVersion, &dir);
1145
	Utils::String dir, filename = _convert_parseFilename(sRest, fVersion, &dir);
1146
 
1146
 
1147
	// get the size and time
1147
	// get the size and time
Line 1169... Line 1169...
1169
		file->ReadFromData ( (char *)readData.c_str(), (long)readData.length() );
1169
		file->ReadFromData ( (char *)readData.c_str(), (long)readData.length() );
1170
	}
1170
	}
1171
 
1171
 
1172
	// setup the file
1172
	// setup the file
1173
	file->SetName ( filename );
1173
	file->SetName ( filename );
1174
	file->SetFileType ( iType );
1174
	file->setFileType(iType);
1175
	file->SetShared ( bShared );
1175
	file->SetShared ( bShared );
1176
	file->SetCreationTime ( time );
1176
	file->SetCreationTime ( time );
1177
	if ( !dir.empty() )
1177
	if ( !dir.empty() )
1178
		file->SetDir ( dir );
1178
		file->SetDir ( dir );
1179
	
1179