Subversion Repositories spk

Rev

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

Rev 35 Rev 39
Line 1230... Line 1230...
1230
		case SPKFILE_INVALID:
1230
		case SPKFILE_INVALID:
1231
			// convert xsp
1231
			// convert xsp
1232
			if ( CFileIO(file).CheckFileExtension("xsp") )
1232
			if ( CFileIO(file).CheckFileExtension("xsp") )
1233
			{
1233
			{
1234
				installFile = new CXspFile();
1234
				installFile = new CXspFile();
1235
				if ( !((CXspFile *)installFile)->ConvertOld(file) )
1235
				if ( !((CXspFile *)installFile)->ConvertOld(file.ToString()) )
1236
				{
1236
				{
1237
					delete installFile;
1237
					delete installFile;
1238
					return NULL;
1238
					return NULL;
1239
				}
1239
				}
1240
				break;
1240
				break;
Line 5937... Line 5937...
5937
			{
5937
			{
5938
				SDummy *dummy = dNode->Data();
5938
				SDummy *dummy = dNode->Data();
5939
				SDummyEntry *found = NULL;
5939
				SDummyEntry *found = NULL;
5940
				for ( CListNode<SDummyEntry> *eNode = dummyList.Front(); eNode; eNode = eNode->next() )
5940
				for ( CListNode<SDummyEntry> *eNode = dummyList.Front(); eNode; eNode = eNode->next() )
5941
				{
5941
				{
5942
					if ( eNode->Data()->sSection.Compare(dummy->sSection) )
5942
					if ( eNode->Data()->sSection.Compare(CyString(dummy->sSection)) )
5943
					{
5943
					{
5944
						found = eNode->Data();
5944
						found = eNode->Data();
5945
						break;
5945
						break;
5946
					}
5946
					}
5947
				}
5947
				}
Line 5955... Line 5955...
5955
				else
5955
				else
5956
				{
5956
				{
5957
					bool f = false;
5957
					bool f = false;
5958
					for ( SStringList *strNode = found->lEntries.Head(); strNode; strNode = strNode->next )
5958
					for ( SStringList *strNode = found->lEntries.Head(); strNode; strNode = strNode->next )
5959
					{
5959
					{
5960
						if ( strNode->str.GetToken(";", 1, 1).Compare(dummy->sData.GetToken(";", 1, 1)) )
5960
						if ( strNode->str.GetToken(";", 1, 1).Compare(CyString(dummy->sData.token(";", 1))) )
5961
						{
5961
						{
5962
							f = true;
5962
							f = true;
5963
							break;
5963
							break;
5964
						}
5964
						}
5965
					}
5965
					}
5966
 
5966
 
5967
					if ( f )
5967
					if ( f )
5968
						continue;
5968
						continue;
5969
				}
5969
				}
5970
 
5970
 
5971
				found->lEntries.PushBack(dummy->sData);
5971
				found->lEntries.PushBack(CyString(dummy->sData));
5972
			}
5972
			}
5973
		}
5973
		}
5974
 
5974
 
5975
		// finally, write the file
5975
		// finally, write the file
5976
		std::vector<CyString> lines;
5976
		std::vector<CyString> lines;
Line 6572... Line 6572...
6572
				SComponent *dummy = dNode->Data();
6572
				SComponent *dummy = dNode->Data();
6573
				SComponantEntry *found = NULL;
6573
				SComponantEntry *found = NULL;
6574
				SComponantEntry2 *found2 = NULL;
6574
				SComponantEntry2 *found2 = NULL;
6575
				for ( CListNode<SComponantEntry> *eNode = dummyList.Front(); eNode; eNode = eNode->next() )
6575
				for ( CListNode<SComponantEntry> *eNode = dummyList.Front(); eNode; eNode = eNode->next() )
6576
				{
6576
				{
6577
					if ( eNode->Data()->sSection.Compare(dummy->sSection) )
6577
					if ( eNode->Data()->sSection.Compare(CyString(dummy->sSection)) )
6578
					{
6578
					{
6579
						found = eNode->Data();
6579
						found = eNode->Data();
6580
						break;
6580
						break;
6581
					}
6581
					}
6582
				}
6582
				}
Line 6592... Line 6592...
6592
				// else check for the 2nd section
6592
				// else check for the 2nd section
6593
				else
6593
				else
6594
				{
6594
				{
6595
					for ( CListNode<SComponantEntry2> *cNode = found->lEntries.Front(); cNode; cNode = cNode->next() )
6595
					for ( CListNode<SComponantEntry2> *cNode = found->lEntries.Front(); cNode; cNode = cNode->next() )
6596
					{
6596
					{
6597
						if ( cNode->Data()->sSection.Compare(dummy->sSection2) )
6597
						if ( cNode->Data()->sSection.Compare(CyString(dummy->sSection2)) )
6598
						{
6598
						{
6599
							found2 = cNode->Data();
6599
							found2 = cNode->Data();
6600
							break;
6600
							break;
6601
						}
6601
						}
6602
					}
6602
					}
Line 6610... Line 6610...
6610
					else
6610
					else
6611
					{
6611
					{
6612
						bool f = false;
6612
						bool f = false;
6613
						for ( SStringList *strNode = found2->lEntries.Head(); strNode; strNode = strNode->next )
6613
						for ( SStringList *strNode = found2->lEntries.Head(); strNode; strNode = strNode->next )
6614
						{
6614
						{
6615
							if ( dummy->sData.Remove(' ').Compare(strNode->str) )
6615
							if ( dummy->sData.remove(' ').Compare(strNode->str.ToString()) )
6616
							{
6616
							{
6617
								f = true;
6617
								f = true;
6618
								break;
6618
								break;
6619
							}
6619
							}
6620
						}
6620
						}
Line 6622... Line 6622...
6622
						if ( f )
6622
						if ( f )
6623
							continue;
6623
							continue;
6624
					}
6624
					}
6625
				}
6625
				}
6626
 
6626
 
6627
				found2->lEntries.PushBack(dummy->sData.Remove(' '));
6627
				found2->lEntries.PushBack(CyString(dummy->sData.remove(' ')));
6628
			}
6628
			}
6629
		}
6629
		}
6630
 
6630
 
6631
		// finally, write the file
6631
		// finally, write the file
6632
		std::vector<CyString> lines;
6632
		std::vector<CyString> lines;
Line 6824... Line 6824...
6824
									s->iText = shiptext;
6824
									s->iText = shiptext;
6825
									if ( !s->pPackage->GetOriginalDescription() )
6825
									if ( !s->pPackage->GetOriginalDescription() )
6826
										shiptext += 2;
6826
										shiptext += 2;
6827
									s->iPos = tshipsList.Count();
6827
									s->iPos = tshipsList.Count();
6828
									added = true;
6828
									added = true;
6829
									tshipsList.PushBack(s->pPackage->FormatShipData(&Cockpits, &s->iText, m_iGame));
6829
									tshipsList.PushBack(CyString(s->pPackage->FormatShipData(&Cockpits, &s->iText, m_iGame)));
6830
									shipOverrides.remove(node);
6830
									shipOverrides.remove(node);
6831
									break;
6831
									break;
6832
								}
6832
								}
6833
							}
6833
							}
6834
						}
6834
						}
Line 6874... Line 6874...
6874
				{
6874
				{
6875
					s->iText = shiptext;
6875
					s->iText = shiptext;
6876
					if ( !s->pPackage->GetOriginalDescription() )
6876
					if ( !s->pPackage->GetOriginalDescription() )
6877
						shiptext += 2;
6877
						shiptext += 2;
6878
 
6878
 
6879
					tshipsList.PushBack(s->pPackage->FormatShipData(&Cockpits, &s->iText, m_iGame));
6879
					tshipsList.PushBack(CyString(s->pPackage->FormatShipData(&Cockpits, &s->iText, m_iGame)));
6880
				}
6880
				}
6881
				else if ( s->iType == WARETYPE_DELETED )
6881
				else if ( s->iType == WARETYPE_DELETED )
6882
					tshipsList.PushBack(bufferStart + "SHIP_DELETED;");
6882
					tshipsList.PushBack(bufferStart + "SHIP_DELETED;");
6883
				else if ( s->iType == WARETYPE_DISABLED )
6883
				else if ( s->iType == WARETYPE_DISABLED )
6884
					tshipsList.PushBack(bufferStart + "SHIP_DISABLED;");
6884
					tshipsList.PushBack(bufferStart + "SHIP_DISABLED;");
Line 7103... Line 7103...
7103
				continue;
7103
				continue;
7104
 
7104
 
7105
			if ( !s->pPackage->AnyCockpits() )
7105
			if ( !s->pPackage->AnyCockpits() )
7106
				continue;
7106
				continue;
7107
 
7107
 
7108
			bool found = false;
-
 
7109
			for ( CListNode<SCockpit> *cn = s->pPackage->GetCockpits()->Front(); cn; cn = cn->next() )
7108
			for ( CListNode<SCockpit> *cn = s->pPackage->GetCockpits()->Front(); cn; cn = cn->next() )
7110
			{
7109
			{
7111
				bool foundEntry = false;
7110
				bool foundEntry = false;
7112
				CyString cockpitStr = cn->Data()->sCockpit;
7111
				CyString cockpitStr = cn->Data()->sCockpit;
7113
				// search for matching game entry
7112
				// search for matching game entry
Line 7119... Line 7118...
7119
							cockpitStr = cockpitStr.RepToken(";", 9, CyString::Number(wm->Data()->iMask));
7118
							cockpitStr = cockpitStr.RepToken(";", 9, CyString::Number(wm->Data()->iMask));
7120
						foundEntry = true;
7119
						foundEntry = true;
7121
						break;
7120
						break;
7122
					}
7121
					}
7123
				}
7122
				}
-
 
7123
 
-
 
7124
				bool found = false;
7124
				for ( SStringList *str = cockpitList->Head(); str; str = str->next )
7125
				for ( SStringList *str = cockpitList->Head(); str; str = str->next )
7125
				{
7126
				{
7126
					if ( str->str.GetToken(";", 19, 19).Compare(cn->Data()->sCockpit.GetToken(";", 19, 19)) )
7127
					if ( str->str.GetToken(";", 19, 19).Compare(CyString(cn->Data()->sCockpit.token(";", 19))) )
7127
					{
7128
					{
7128
						// only replace existing entry if we have sepeperate weapon masks set
7129
						// only replace existing entry if we have sepeperate weapon masks set
7129
						if ( foundEntry )
7130
						if ( foundEntry )
7130
							str->str = cockpitStr;
7131
							str->str = cockpitStr;
7131
						found = true;
7132
						found = true;