Example #1
0
// Default function to get the current weapon (Pre-ref()'d)
Weapon* StoresMgr::getCurrentWeapon()
{
   // Get the selected station's weapon
   Weapon* wpn = getWeapon();

   if (wpn == nullptr) {
      // If not found then check to see if the selected station
      // was really a Stores class object.  If so then ask it
      // for its selected station's weapon
      ExternalStore* es = getExternalStore();
      if (es != nullptr) {
         Stores* ss = dynamic_cast<Stores*>( es );
         if (ss != nullptr) wpn = ss->getWeapon();
         es->unref();
      }
   }

   return wpn;
}