Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 4, 2012, 10:50:28 PM (12 years ago)
Author:
landauf
Message:

use orxonox_cast instead of dynamic_cast wherever possible

Location:
code/branches/presentation2012merge/src/modules/pickup
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2012merge/src/modules/pickup/Pickup.cc

    r8864 r9279  
    210210        SUPER(Pickup, clone, item);
    211211
    212         Pickup* pickup = dynamic_cast<Pickup*>(item);
     212        Pickup* pickup = orxonox_cast<Pickup*>(item);
    213213        pickup->setActivationTypeDirect(this->getActivationTypeDirect());
    214214        pickup->setDurationTypeDirect(this->getDurationTypeDirect());
  • code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc

    r8305 r9279  
    7979        }
    8080        this->pickups_.clear();
    81        
     81
    8282        if(this->pickupCollectionIdentifier_ != NULL)
    8383            delete this->pickupCollectionIdentifier_;
     
    195195            return;
    196196
    197         // If at least all the enabled pickups of this PickupCollection are no longer picked up. 
     197        // If at least all the enabled pickups of this PickupCollection are no longer picked up.
    198198        if(this->pickedUpCounter_ <= this->disabledCounter_ && this->isPickedUp())
    199199            this->Pickupable::destroy();
     
    218218        SUPER(PickupCollection, clone, item);
    219219
    220         PickupCollection* pickup = dynamic_cast<PickupCollection*>(item);
     220        PickupCollection* pickup = orxonox_cast<PickupCollection*>(item);
    221221        // Clone all Pickupables this PickupCollection consist of.
    222222        for(std::vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
     
    297297        This is used internally by the CollectiblePickup class.
    298298    @param changed
    299         The value the used status has changed to. 
     299        The value the used status has changed to.
    300300    */
    301301    void PickupCollection::pickupChangedUsed(bool changed)
  • code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.cc

    r8891 r9279  
    199199
    200200                Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
    201                 PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(*it);
     201                PickupCarrier* carrier = orxonox_cast<PickupCarrier*>(*it);
    202202                // If a PickupCarrier, that fits the target-range of the Pickupable spawned by this PickupSpawner, is in trigger-distance and the carrier is not blocked.
    203203                if(distance.length() < this->triggerDistance_ && carrier != NULL && this->blocked_.find(carrier) == this->blocked_.end())
     
    303303            orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") triggered and active." << endl;
    304304
    305             PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn);
     305            PickupCarrier* carrier = orxonox_cast<PickupCarrier*>(pawn);
    306306            assert(carrier);
    307307
  • code/branches/presentation2012merge/src/modules/pickup/items/DamageBoostPickup.cc

    r9272 r9279  
    180180    {
    181181        PickupCarrier* carrier = this->getCarrier();
    182         SpaceShip* ship = dynamic_cast<SpaceShip*>(carrier);
     182        SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier);
    183183
    184184        if(ship == NULL)
     
    203203        SUPER(DamageBoostPickup, clone, item);
    204204
    205         DamageBoostPickup* pickup = dynamic_cast<DamageBoostPickup*>(item);
     205        DamageBoostPickup* pickup = orxonox_cast<DamageBoostPickup*>(item);
    206206        pickup->setDuration(this->getDuration());
    207207        pickup->setDamageMultiplier(this->getDamageMultiplier());
  • code/branches/presentation2012merge/src/modules/pickup/items/DronePickup.cc

    r8858 r9279  
    144144
    145145                Controller* controller = drone->getController();
    146                 DroneController* droneController = dynamic_cast<DroneController*>(controller);
     146                DroneController* droneController = orxonox_cast<DroneController*>(controller);
    147147                if(droneController != NULL)
    148148                {
     
    175175    {
    176176        PickupCarrier* carrier = this->getCarrier();
    177         Pawn* pawn = dynamic_cast<Pawn*>(carrier);
     177        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    178178
    179179        if(pawn == NULL)
     
    198198        SUPER(DronePickup, clone, item);
    199199
    200         DronePickup* pickup = dynamic_cast<DronePickup*>(item);
     200        DronePickup* pickup = orxonox_cast<DronePickup*>(item);
    201201        pickup->setDroneTemplate(this->getDroneTemplate());
    202202
  • code/branches/presentation2012merge/src/modules/pickup/items/HealthPickup.cc

    r8864 r9279  
    230230            {
    231231                PickupCarrier* carrier = this->getCarrier();
    232                 Pawn* pawn = dynamic_cast<Pawn*>(carrier);
     232                Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    233233
    234234                if(pawn == NULL)
     
    264264    {
    265265        PickupCarrier* carrier = this->getCarrier();
    266         Pawn* pawn = dynamic_cast<Pawn*>(carrier);
     266        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    267267
    268268        if(pawn == NULL)
     
    285285        SUPER(HealthPickup, clone, item);
    286286
    287         HealthPickup* pickup = dynamic_cast<HealthPickup*>(item);
     287        HealthPickup* pickup = orxonox_cast<HealthPickup*>(item);
    288288        pickup->setHealth(this->getHealth());
    289289        pickup->setHealthRate(this->getHealthRate());
  • code/branches/presentation2012merge/src/modules/pickup/items/InvisiblePickup.cc

    r8858 r9279  
    159159        SUPER(InvisiblePickup, clone, item);
    160160
    161         InvisiblePickup* pickup = dynamic_cast<InvisiblePickup*>(item);
     161        InvisiblePickup* pickup = orxonox_cast<InvisiblePickup*>(item);
    162162        pickup->setDuration(this->getDuration());
    163163        pickup->initializeIdentifier();
     
    202202    {
    203203        PickupCarrier* carrier = this->getCarrier();
    204         Pawn* pawn = dynamic_cast<Pawn*>(carrier);
     204        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    205205
    206206        if(pawn == NULL)
  • code/branches/presentation2012merge/src/modules/pickup/items/MetaPickup.cc

    r8858 r9279  
    172172        SUPER(MetaPickup, clone, item);
    173173
    174         MetaPickup* pickup = dynamic_cast<MetaPickup*>(item);
     174        MetaPickup* pickup = orxonox_cast<MetaPickup*>(item);
    175175        pickup->setMetaTypeDirect(this->getMetaTypeDirect());
    176176
  • code/branches/presentation2012merge/src/modules/pickup/items/ShieldPickup.cc

    r8858 r9279  
    177177    {
    178178        PickupCarrier* carrier = this->getCarrier();
    179         Pawn* pawn = dynamic_cast<Pawn*>(carrier);
     179        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    180180
    181181        if(pawn == NULL)
     
    199199        SUPER(ShieldPickup, clone, item);
    200200
    201         ShieldPickup* pickup = dynamic_cast<ShieldPickup*>(item);
     201        ShieldPickup* pickup = orxonox_cast<ShieldPickup*>(item);
    202202        pickup->setDuration(this->getDuration());
    203203        pickup->setShieldAbsorption(this->getShieldAbsorption());
  • code/branches/presentation2012merge/src/modules/pickup/items/ShrinkPickup.cc

    r8713 r9279  
    148148    {
    149149        SUPER(ShrinkPickup, changedPickedUp);
    150        
     150
    151151        if(!this->isPickedUp() && this->isActive_)
    152152        {
     
    271271
    272272                bool destroy = false;
    273                
     273
    274274                // Stop shrinking if the desired size is reached.
    275275                if(this->timeRemainig_ <= 0.0f)
     
    314314    {
    315315        PickupCarrier* carrier = this->getCarrier();
    316         Pawn* pawn = dynamic_cast<Pawn*>(carrier);
     316        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    317317
    318318        return pawn;
     
    331331
    332332        SUPER(ShrinkPickup, clone, item);
    333         ShrinkPickup* pickup = dynamic_cast<ShrinkPickup*>(item);
     333        ShrinkPickup* pickup = orxonox_cast<ShrinkPickup*>(item);
    334334        pickup->setShrinkFactor(this->getShrinkFactor());
    335335        pickup->setDuration(this->getDuration());
  • code/branches/presentation2012merge/src/modules/pickup/items/SpeedPickup.cc

    r8858 r9279  
    176176    {
    177177        PickupCarrier* carrier = this->getCarrier();
    178         SpaceShip* ship = dynamic_cast<SpaceShip*>(carrier);
     178        SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier);
    179179
    180180        if(ship == NULL)
     
    199199        SUPER(SpeedPickup, clone, item);
    200200
    201         SpeedPickup* pickup = dynamic_cast<SpeedPickup*>(item);
     201        SpeedPickup* pickup = orxonox_cast<SpeedPickup*>(item);
    202202        pickup->setDuration(this->getDuration());
    203203        pickup->setSpeedAdd(this->getSpeedAdd());
Note: See TracChangeset for help on using the changeset viewer.