namespace Decal.Filters;

public sealed class SpeciesTable : IdNameTable<Species>
{
	internal SpeciesTable(byte[] Data)
	{
		LoadFrom(Data);
	}

	internal override bool LoadFrom(byte[] Data)
	{
		int Index = 0;
		if (Get.DWord(Data, ref Index) != 570425358)
		{
			return false;
		}
		Index += 5;
		int num = Get.Byte(Data, ref Index);
		InitializeTable(num);
		for (int i = 0; i < num; i++)
		{
			Species species = new Species(Get.DWord(Data, ref Index));
			species.Name = Get.PString(Data, ref Index);
			Add(species);
		}
		return true;
	}
}
