Example #1
0
 public void AddNeighbor(Neighbour nb)
 {
     Entries.Add(nb);
     Entries = Entries.OrderBy(x => x.NeighbourID).ToList();
     NeighbourByID.Add(nb.NeighbourID, nb);
     DefaultNeighbourByGUID[nb.GUID] = nb.NeighbourID;
 }
Example #2
0
        /// <summary>
        /// Reads a NBRS chunk from a stream.
        /// </summary>
        /// <param name="iff">An Iff instance.</param>
        /// <param name="stream">A Stream object holding a OBJf chunk.</param>
        public override void Read(IffFile iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                io.ReadUInt32();                  //pad
                Version = io.ReadUInt32();        //0x49 for latest game
                string magic = io.ReadCString(4); //SRBN
                var    count = io.ReadUInt32();

                for (int i = 0; i < count; i++)
                {
                    if (!io.HasMore)
                    {
                        return;
                    }
                    var neigh = new Neighbour(io);
                    Entries.Add(neigh);
                    if (neigh.Unknown1 > 0)
                    {
                        NeighbourByID.Add(neigh.NeighbourID, neigh);
                        DefaultNeighbourByGUID[neigh.GUID] = neigh.NeighbourID;
                    }
                }
            }
            Entries = Entries.OrderBy(x => x.NeighbourID).ToList();
        }
Example #3
0
        public void AddNeighbor(Neighbour nb)
        {
            Entries.Add(nb);
            Entries = Entries.OrderBy(x => x.NeighbourID).ToList();
            foreach (var entry in Entries)
            {
                entry.RuntimeIndex = Entries.IndexOf(entry);
            }

            NeighbourByID.Add(nb.NeighbourID, nb);
            DefaultNeighbourByGUID[nb.GUID] = nb.NeighbourID;
        }