private void AddHeaders()
        {
            int rowIndex = m_gameList.AddRow();

            for (int currentHeader = 0; currentHeader < HeaderCount; currentHeader++)
            {
                AddHeader(rowIndex, currentHeader);
            }
        }
        private bool GetStats()
        {
            if (m_stats == null)
            {
                m_stats = new List <MyStatsRow>();
            }
            m_stats.Clear();

            if (m_statsTableFactions == null)
            {
                m_statsTableFactions = new Dictionary <MyMwcObjectBuilder_FactionEnum, MyFactionStats>();
            }
            m_statsTableFactions.Clear();


            m_statsListbox.RemoveAllRows();

            //add player first
            m_playerFaction = MySession.Static.Player.Faction;
            m_playerId      = MyEntityIdentifier.CurrentPlayerId;
            AddPlayer(MyClientServer.LoggedPlayer.GetDisplayName(), 0, MyClientServer.LoggedPlayer.Statistics.Deaths, MyClientServer.LoggedPlayer.Statistics.PlayersKilled, m_playerId, m_playerFaction);

            //add other players
            foreach (MyPlayerRemote player in MyMultiplayerPeers.Static.Players)
            {
                AddPlayer(player);
            }

            //Debug add random stuff
            //foreach (MinerWars.AppCode.Game.Entities.MyEntity entity in MinerWars.AppCode.Game.Entities.MyEntities.GetEntities())
            //{
            //    //var bot = entity as MinerWars.AppCode.Game.Entities.MySmallShipBot;
            //    //if (bot != null)
            //    //{
            //        //AddPlayer(new StringBuilder("Bot"), null, 0, 0, 0, bot.Faction);
            //    //}
            //    AddPlayer(new StringBuilder(entity.GetType().Name), null, 0, 0, 0, entity.Faction);
            //}

            //add faction titles
            if (m_statsTableFactions.Count > 1) // No reason to display just one faction (ie Rainers or Freelancers)
            {
                foreach (KeyValuePair <MyMwcObjectBuilder_FactionEnum, MyFactionStats> faction in m_statsTableFactions)
                {
                    AddPlayer(MyFactionConstants.GetFactionProperties(faction.Value.Faction).Name, null, faction.Value.Deaths, faction.Value.Kills, (byte)faction.Value.Faction, faction.Value.Faction, true);
                }
            }


            // order
            m_stats.Sort(StatsRowComparer);
            AddHeaders();
            foreach (MyStatsRow row in m_stats)
            {
                if (row.IsFaction)
                {
                    m_statsListbox.AddRow();
                }
                AddStatRowToListbox(row);
            }

            return(true);
        }