void update_list()
        {
            CreatureList.BeginUpdate();

            CreatureList.Groups.Clear();
            CreatureList.Items.Clear();

            List <Creature> creatures = Session.Creatures;

            BinarySearchTree <string> bst = new BinarySearchTree <string>();

            foreach (Creature c in creatures)
            {
                bst.Add(c.Category);
            }

            List <string> cats = bst.SortedList;

            cats.Add("Miscellaneous Creatures");
            foreach (string cat in cats)
            {
                CreatureList.Groups.Add(cat, cat);
            }

            List <ListViewItem> items = new List <ListViewItem>();

            foreach (Creature c in creatures)
            {
                if (!match(c, NameBox.Text))
                {
                    continue;
                }

                if (fCreatures.Contains(c))
                {
                    continue;
                }

                ListViewItem lvi = new ListViewItem(c.Name);
                lvi.SubItems.Add(c.Info);
                lvi.Tag = c;

                if ((c.Category != null) && (c.Category != ""))
                {
                    lvi.Group = CreatureList.Groups[c.Category];
                }
                else
                {
                    lvi.Group = CreatureList.Groups["Miscellaneous Creatures"];
                }

                items.Add(lvi);
            }

            CreatureList.Items.AddRange(items.ToArray());
            CreatureList.EndUpdate();
        }
        void update_creature_list()
        {
            CreatureList.BeginUpdate();

            List <ICreature> creatures     = new List <ICreature>();
            List <Creature>  all_creatures = Session.Creatures;

            foreach (ICreature c in all_creatures)
            {
                creatures.Add(c);
            }
            if (Session.Project != null)
            {
                foreach (ICreature c in Session.Project.CustomCreatures)
                {
                    creatures.Add(c);
                }
                foreach (ICreature c in Session.Project.NPCs)
                {
                    creatures.Add(c);
                }
            }

            BinarySearchTree <string> categories = new BinarySearchTree <string>();

            foreach (ICreature c in creatures)
            {
                if (c.Category != "")
                {
                    categories.Add(c.Category);
                }
            }

            List <string> cats = categories.SortedList;

            cats.Insert(0, "Custom Creatures");
            cats.Insert(1, "NPCs");
            cats.Add("Miscellaneous Creatures");

            CreatureList.Groups.Clear();
            foreach (string cat in cats)
            {
                CreatureList.Groups.Add(cat, cat);
            }
            CreatureList.ShowGroups = true;

            List <ListViewItem> item_list = new List <ListViewItem>();

            foreach (ICreature c in creatures)
            {
                if (c == null)
                {
                    continue;
                }

                Difficulty diff;
                if (!FilterPanel.AllowItem(c, out diff))
                {
                    continue;
                }

                ListViewItem lvi = new ListViewItem(c.Name);
                lvi.SubItems.Add(c.Info);
                lvi.Tag = c;

                if (c.Category != "")
                {
                    lvi.Group = CreatureList.Groups[c.Category];
                }
                else
                {
                    lvi.Group = CreatureList.Groups["Miscellaneous Creatures"];
                }

                item_list.Add(lvi);
            }

            CreatureList.Items.Clear();
            CreatureList.Items.AddRange(item_list.ToArray());

            if (CreatureList.Items.Count == 0)
            {
                CreatureList.ShowGroups = false;

                ListViewItem lvi = CreatureList.Items.Add("(no creatures)");
                lvi.ForeColor = SystemColors.GrayText;
            }

            CreatureList.EndUpdate();
        }
        void update_creature_list()
        {
            CreatureList.BeginUpdate();
            CreatureList.ShowGroups = true;

            List <ListViewItem> item_list = new List <ListViewItem>();

            if (DeckView.IsCellSelected)
            {
                List <ICreature> creatures = new List <ICreature>();
                foreach (Creature c in Session.Creatures)
                {
                    creatures.Add(c);
                }
                foreach (CustomCreature cc in Session.Project.CustomCreatures)
                {
                    creatures.Add(cc);
                }

                foreach (ICreature c in creatures)
                {
                    EncounterCard card = new EncounterCard();
                    card.CreatureID = c.ID;

                    if (!DeckView.InSelectedCell(card))
                    {
                        continue;
                    }

                    ListViewItem lvi = new ListViewItem(c.Name);
                    lvi.Tag = c;

                    string cat_name = (c.Category != "") ? c.Category : "Miscellaneous Creatures";
                    lvi.Group = CreatureList.Groups[cat_name];

                    item_list.Add(lvi);
                }

                if (item_list.Count == 0)
                {
                    CreatureList.ShowGroups = false;

                    ListViewItem lvi = new ListViewItem("(no creatures)");
                    lvi.ForeColor = SystemColors.GrayText;

                    item_list.Add(lvi);
                }
            }
            else
            {
                CreatureList.ShowGroups = false;

                ListViewItem lvi = new ListViewItem("(no cell selected)");
                lvi.ForeColor = SystemColors.GrayText;

                item_list.Add(lvi);
            }

            CreatureList.Items.Clear();
            CreatureList.Items.AddRange(item_list.ToArray());
            CreatureList.EndUpdate();
        }