Esempio n. 1
0
Flare* SimpleStoresMgr::getNextFlareImp()
{
   Flare* flare = nullptr;

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

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

      list->unref();
   }

   return flare;
}
Esempio n. 2
0
Flare* SimpleStoresMgr::getNextFlareImp()
{
   Flare* flare = 0;

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

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

      list->unref();
   }

   return flare;
}