//
  // SelectTypesCallback
  //
  // Select all units of each type in a list
  //
  void UnitSelection::SelectTypesCallback(const char *key, const CH *, void *context)
  {
    // Get the list to add the types to
    UnitObjTypeList *list = reinterpret_cast<UnitObjTypeList *>(context);

    // Is this a unit type
    if (UnitObjType *type = GameObjCtrl::FindType<UnitObjType>(key))
    {
      list->Append(type);
    }
  }
Example #2
0
//
// Prereq::GetAll
//
// Get all of the prereqs
//
void Prereq::GetAll(UnitObjTypeList &list) const
{
    // Add each of our prereqs to the list ensuring
    // that they're not alread in the list
    for (UnitObjTypeList::Iterator t(&prereqs); *t; t++)
    {
        if (!list.Exists(**t))
        {
            // Add this type to the list
            list.Append(**t);

            // Get this item to add its prereqs as well
            (**t)->GetPrereqs().GetAll(list);
        }
    }
}