Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 15, 2014, 3:53:11 PM (11 years ago)
Author:
noep
Message:

Expanded functionality of PartDestructionEvents, fixed cursor not showing when flying a ModularSpaceShip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc

    r10055 r10058  
    4040
    4141#include "items/ShipPart.h"
     42#include "items/Engine.h"
    4243#include "worldentities/StaticEntity.h"
    4344#include "collisionshapes/WorldEntityCollisionShape.h"
     
    230231    /**
    231232    @brief
     233        Looks for an attached ShipPart with a certain name.
     234    @param name
     235        The name of the ShipPart to be returned.
     236    @return
     237        Pointer to the ShipPart with the given name, or NULL if not found.
     238    */
     239    ShipPart* ModularSpaceShip::getShipPartByName(std::string name)
     240    {
     241        for(std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it)
     242        {
     243            if(orxonox_cast<ShipPart*>(*it)->getName() == name)
     244            {
     245                return orxonox_cast<ShipPart*>(*it);
     246            }
     247        }
     248        orxout(internal_warning) << "Couldn't find ShipPart with name \"" << name << "\"." << endl;
     249        return NULL;
     250    }
     251
     252    /**
     253    @brief
    232254        Check whether the SpaceShip has a particular Engine.
    233255    @param engine
     
    285307    /**
    286308    @brief
     309        Looks for an attached Engine with a certain name.
     310    @param name
     311        The name of the engine to be returned.
     312    @return
     313        Pointer to the engine with the given name, or NULL if not found.
     314    */
     315    Engine* ModularSpaceShip::getEngineByName(std::string name)
     316    {
     317        for(std::vector<Engine*>::iterator it = this->engineList_.begin(); it != this->engineList_.end(); ++it)
     318        {
     319            if(orxonox_cast<Engine*>(*it)->getName() == name)
     320            {
     321                return orxonox_cast<Engine*>(*it);
     322            }
     323        }
     324        orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl;
     325        return NULL;
     326    }
     327
     328    /**
     329    @brief
    287330        Detaches a child WorldEntity from this instance.
    288331    */
     
    297340
    298341        // collision shapes
    299         orxout() << "MSS: detach()" << endl;
    300342
    301343        //this->printBtChildShapes((btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape()), 2, 0);
     
    314356
    315357        object->notifyDetached();
    316         orxout() << "MSS: detach() completed." << endl;
    317358    }
    318359}
Note: See TracChangeset for help on using the changeset viewer.