Ejemplo n.º 1
0
Bomb* SimpleStoresMgr::getNextBombImp()
{
   Bomb* bomb = nullptr;

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

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

      list->unref();
   }

   return bomb;
}
Ejemplo n.º 2
0
Bomb* SimpleStoresMgr::getNextBombImp()
{
   Bomb* bomb = 0;

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

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

      list->unref();
   }

   return bomb;
}