Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2015, 2:45:58 PM (8 years ago)
Author:
maxima
Message:

Merged presentation and fabiens branch. Had to modify hoverHUD and invaderHUD, because the text of the healthbar wasn't correctly displayed and the weapon settings of the hovership.

Location:
code/branches/presentationHS15
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS15

  • code/branches/presentationHS15/src/orxonox/weaponsystem/WeaponSystem.cc

    r10650 r10961  
    240240    }
    241241
     242    std::vector<WeaponPack *> * WeaponSystem::getAllWeaponPacks()
     243    {
     244        return &weaponPacks_;
     245    }   
     246
    242247    bool WeaponSystem::swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2)
    243248    {
     
    310315            return it->second;
    311316        }
    312         else if (identifier->getIdentifier()->isA(Class(Munition)))
    313         {
    314             Munition* munition = identifier->fabricate(this->getContext());
    315             this->munitions_[identifier->getIdentifier()] = munition;
    316             return munition;
    317         }
    318317        else
    319318        {
    320             return 0;
     319            return NULL;
     320        }
     321    }
     322
     323    void WeaponSystem::addMunition(Munition* munition)
     324    {
     325        if (munition == NULL)
     326        {
     327            return;
     328        }
     329
     330        SubclassIdentifier<Munition> identifier = munition->getIdentifier();
     331
     332        if (identifier)
     333        {
     334            this->munitions_[identifier] = munition;
     335            updateMunition();
     336        }
     337        else
     338        {
     339            orxout(internal_warning) << "Adding munition failed. identifier == NULL " << endl;
     340        }
     341    }
     342
     343    void WeaponSystem::updateMunition()
     344    {
     345        for (std::vector<WeaponPack*>::iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
     346        {
     347            (*it)->updateMunition();
    321348        }
    322349    }
Note: See TracChangeset for help on using the changeset viewer.