Пример #1
0
        internal static MPPositionInfo Parse(BinaryReader reader, MapParseContext context)
        {
            return(ParseAsset(reader, context, version =>
            {
                var result = new MPPositionInfo
                {
                    IsHuman = reader.ReadBooleanChecked(),
                    IsComputer = reader.ReadBooleanChecked()
                };

                if (version > 0)
                {
                    // I'm guessing about what 5 bytes are missing in version 0, compared to version 1.
                    result.LoadAIScript = reader.ReadBooleanChecked();
                }

                result.Team = reader.ReadUInt32();

                if (version > 0)
                {
                    result.SideRestrictions = new string[reader.ReadUInt32()];
                    for (var i = 0; i < result.SideRestrictions.Length; i++)
                    {
                        result.SideRestrictions[i] = reader.ReadUInt16PrefixedAsciiString();
                    }
                }

                return result;
            }));
        }
Пример #2
0
        internal static MPPositionList Parse(BinaryReader reader, MapParseContext context)
        {
            return(ParseAsset(reader, context, version =>
            {
                var positions = new List <MPPositionInfo>();

                ParseAssets(reader, context, assetName =>
                {
                    if (assetName != MPPositionInfo.AssetName)
                    {
                        throw new InvalidDataException();
                    }

                    positions.Add(MPPositionInfo.Parse(reader, context));
                });

                return new MPPositionList
                {
                    Positions = positions.ToArray()
                };
            }));
        }