internal void Load(SaveFileReader reader, PlayerManager players) { reader.ReadVersion(2); // This will be the same as the existing Owner, unless control of this team has been transferred. var ownerPlayerId = reader.ReadUInt32(); Owner = players.GetPlayerByIndex(ownerPlayerId); _attackPriorityName = reader.ReadAsciiString(); var unknown2 = reader.ReadBoolean(); _templateData.Load(reader); var teamCount = reader.ReadUInt16(); for (var i = 0; i < teamCount; i++) { var id = reader.ReadUInt32(); var team = FindTeamById(id); if (team == null) { team = TeamFactory.AddTeam(this); team.Id = id; } team.Load(reader); } }
internal void Load(SaveFileReader reader) { reader.ReadVersion(2); var playerId = reader.ReadUInt32(); if (playerId != Owner.Id) { throw new InvalidDataException(); } _attackPriorityName = reader.ReadAsciiString(); var unknown2 = reader.ReadBoolean(); _templateData.Load(reader); var teamCount = reader.ReadUInt16(); for (var i = 0; i < teamCount; i++) { var id = reader.ReadUInt32(); var team = FindTeamById(id); if (team == null) { team = TeamFactory.AddTeam(this); team.Id = id; } team.Load(reader); } }