Subversion Repositories spk

Rev

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

Rev 96 Rev 101
Line 1161... Line 1161...
1161
bool CCatFile::MarkRemoveFile ( SInCatFile *f )
1161
bool CCatFile::MarkRemoveFile ( SInCatFile *f )
1162
{
1162
{
1163
	f->bDelete = true;
1163
	f->bDelete = true;
1164
	return true;
1164
	return true;
1165
}
1165
}
1166
 
-
 
1167
CyStringList *CCatFile::GetTShipsEntries()
-
 
1168
{
-
 
1169
	if ( this->ExtractFile("types/tships.pck", "tships.txt") )
-
 
1170
	{
-
 
1171
		CFileIO TShips("tships.txt");
-
 
1172
		if ( TShips.exists() )
-
 
1173
		{
-
 
1174
			CyStringList *lines = TShips.ReadLinesStr();
-
 
1175
			if ( lines )
-
 
1176
			{
-
 
1177
				// remove any commands, blank lines, and start
-
 
1178
				// and put the id as the data
-
 
1179
				int entries = -1;
-
 
1180
				for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
1181
				{
-
 
1182
					str->str.RemoveFirstSpace();
-
 
1183
					str->str.RemoveChar(9);
-
 
1184
					str->str.RemoveChar('\r');
-
 
1185
					str->str.RemoveChar('\n');
-
 
1186
					if ( str->str.Empty() )
-
 
1187
					{
-
 
1188
						str->remove = true;
-
 
1189
						continue;
-
 
1190
					}
-
 
1191
 
-
 
1192
					if ( str->str[0] == '/' )
-
 
1193
					{
-
 
1194
						str->remove = true;
-
 
1195
						continue;
-
 
1196
					}
-
 
1197
 
-
 
1198
					if ( entries == -1 )
-
 
1199
					{
-
 
1200
						entries = str->str.GetToken(";", 2, 2).ToInt();
-
 
1201
						str->remove = true;
-
 
1202
						continue;
-
 
1203
					}
-
 
1204
 
-
 
1205
					// hopefully we now have a valid tships line
-
 
1206
					int num = -1;
-
 
1207
					while ( str->data.Empty() )
-
 
1208
						str->data = str->str.GetToken(";", num--, (num + 2));
-
 
1209
				}
-
 
1210
			}
-
 
1211
			// remove the tmp file
-
 
1212
			TShips.remove();
-
 
1213
 
-
 
1214
			if ( lines )
-
 
1215
				lines->RemoveMarked();
-
 
1216
			return lines;
-
 
1217
		}
-
 
1218
	}
-
 
1219
 
-
 
1220
	return NULL;
-
 
1221
}
-
 
1222
 
-
 
1223
CyString CCatFile::GetTShipsEntry(CyString id)
-
 
1224
{
-
 
1225
	CyStringList *ships = this->GetTShipsEntries();
-
 
1226
	if ( ships )
-
 
1227
	{
-
 
1228
		SStringList *node = ships->FindData(id.upper());
-
 
1229
		if ( node )
-
 
1230
			return node->str;
-
 
1231
	}
-
 
1232
	return NullString;
-
 
1233
}
-
 
1234
 
-