namespace Decal.Filters;

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

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