예제 #1
0
Chaff* SimpleStoresMgr::getNextChaffImp()
{
   Chaff* chaff = nullptr;

   base::PairStream* list = getWeapons();
   if (list != nullptr) {

      // find the first free (inactive) chaff bundle
      base::List::Item* item = list->getFirstItem();
      while (item != nullptr && chaff == nullptr) {
         base::Pair* pair = static_cast<base::Pair*>(item->getValue());
         Chaff* p = dynamic_cast<Chaff*>(pair->object());
         if (p != nullptr) {
            if (p->isInactive() || p->isReleaseHold()) {
               chaff = static_cast<Chaff*>(p->getPointer());
            }
         }
         item = item->getNext();
      }

      list->unref();
   }

   return chaff;
}
예제 #2
0
Chaff* SimpleStoresMgr::getNextChaffImp()
{
   Chaff* chaff = 0;

   Basic::PairStream* list = getWeapons();
   if (list != 0) {

      Basic::List::Item* item = list->getFirstItem();
      while (item != 0 && chaff == 0) {
         Basic::Pair* pair = (Basic::Pair*) item->getValue();
         Chaff* p = dynamic_cast<Chaff*>( pair->object() );
         if (p != 0) {
            if (p->isInactive() || p->isReleaseHold()) {
               chaff = (Chaff*) p->getPointer();
            }
         }
         item = item->getNext();
      }

      list->unref();
   }

   return chaff;
}