using FSO.Files.Utils; using System.IO; namespace FSO.Files.Formats.IFF.Chunks { /// /// This class defines a single family in the neighbourhood, and various properties such as their /// budget and house assignment. These can be modified using GenericTS1Calls, but are mainly /// defined within CAS. /// public class FAMI : IffChunk { public uint Version = 0x9; public int HouseNumber; //this is not a typical family number - it is unique between user created families, but -1 for townies. //i believe it is an alternate family UID that basically runs on an auto increment to obtain its value. //(in comparison with the ChunkID as family that is used ingame, which appears to fill spaces as they are left) public int FamilyNumber; public int Budget; public int ValueInArch; public int FamilyFriends; public int Unknown; //19, 17 or 1? could be flags, (1, 16, 2) ... 0 for townies. 24 for CAS created (new 16+8?) //1: in house //2: unknown, but is set sometimes //4: unknown //8: user created? //16: in cas public uint[] FamilyGUIDs = new uint[] { }; public uint[] RuntimeSubset = new uint[] { }; //the members of this family currently active. don't save! public void SelectWholeFamily() { RuntimeSubset = FamilyGUIDs; } public void SelectOneMember(uint guid) { RuntimeSubset = new uint[] { guid }; } /// /// Reads a FAMI chunk from a stream. /// /// An Iff instance. /// A Stream object holding a OBJf chunk. public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { io.ReadUInt32(); //pad Version = io.ReadUInt32(); //0x9 for latest game string magic = io.ReadCString(4); //IMAF HouseNumber = io.ReadInt32(); FamilyNumber = io.ReadInt32(); Budget = io.ReadInt32(); ValueInArch = io.ReadInt32(); FamilyFriends = io.ReadInt32(); Unknown = io.ReadInt32(); FamilyGUIDs = new uint[io.ReadInt32()]; for (int i=0; i