Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 23, 2009, 7:28:48 PM (16 years ago)
Author:
rgrieder
Message:

Add a new core-feature: orxonox_cast<T>()
The functions casts objects like dynamic_cast, but uses the identifier instead for MSVC (much faster) and is just a redirection to dynamic_cast for GCC.
Also replaced almost all dynamic_casts (of course only those related to the class hierarchy).

Location:
code/branches/core4/src/orxonox/overlays
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core4/src/orxonox/overlays/hud/AnnounceMessage.cc

    r3110 r3223  
    5656        SUPER(AnnounceMessage, changedOwner);
    5757
    58         this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());
     58        this->owner_ = orxonox_cast<PlayerInfo>(this->getOwner());
    5959    }
    6060}
  • code/branches/core4/src/orxonox/overlays/hud/DeathMessage.cc

    r3110 r3223  
    5656        SUPER(DeathMessage, changedOwner);
    5757
    58         this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());
     58        this->owner_ = orxonox_cast<PlayerInfo>(this->getOwner());
    5959    }
    6060}
  • code/branches/core4/src/orxonox/overlays/hud/GametypeStatus.cc

    r3196 r3223  
    8686        SUPER(GametypeStatus, changedOwner);
    8787
    88         this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());
     88        this->owner_ = orxonox_cast<PlayerInfo>(this->getOwner());
    8989    }
    9090}
  • code/branches/core4/src/orxonox/overlays/hud/HUDHealthBar.cc

    r3196 r3223  
    9494        SUPER(HUDHealthBar, changedOwner);
    9595
    96         this->owner_ = dynamic_cast<Pawn*>(this->getOwner());
     96        this->owner_ = orxonox_cast<Pawn>(this->getOwner());
    9797    }
    9898
  • code/branches/core4/src/orxonox/overlays/hud/HUDRadar.cc

    r3196 r3223  
    164164        SUPER(HUDRadar, changedOwner);
    165165
    166         this->owner_ = dynamic_cast<Pawn*>(this->getOwner());
     166        this->owner_ = orxonox_cast<Pawn>(this->getOwner());
    167167    }
    168168}
  • code/branches/core4/src/orxonox/overlays/hud/HUDSpeedBar.cc

    r3196 r3223  
    6565        SUPER(HUDSpeedBar, changedOwner);
    6666
    67         this->owner_ = dynamic_cast<SpaceShip*>(this->getOwner());
     67        this->owner_ = orxonox_cast<SpaceShip>(this->getOwner());
    6868    }
    6969}
  • code/branches/core4/src/orxonox/overlays/hud/HUDTimer.cc

    r3196 r3223  
    6868        SUPER(HUDTimer, changedOwner);
    6969
    70         this->owner_ = dynamic_cast<ControllableEntity*>(this->getOwner());
     70        this->owner_ = orxonox_cast<ControllableEntity>(this->getOwner());
    7171    }
    7272}
  • code/branches/core4/src/orxonox/overlays/hud/KillMessage.cc

    r3110 r3223  
    5656        SUPER(KillMessage, changedOwner);
    5757
    58         this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());
     58        this->owner_ = orxonox_cast<PlayerInfo>(this->getOwner());
    5959    }
    6060}
  • code/branches/core4/src/orxonox/overlays/hud/PongScore.cc

    r3196 r3223  
    133133
    134134        if (this->getOwner() && this->getOwner()->getGametype())
    135             this->owner_ = dynamic_cast<Pong*>(this->getOwner()->getGametype());
     135            this->owner_ = orxonox_cast<Pong>(this->getOwner()->getGametype());
    136136        else
    137137            this->owner_ = 0;
  • code/branches/core4/src/orxonox/overlays/hud/TeamBaseMatchScore.cc

    r3196 r3223  
    118118
    119119        if (this->getOwner() && this->getOwner()->getGametype())
    120             this->owner_ = dynamic_cast<TeamBaseMatch*>(this->getOwner()->getGametype());
     120            this->owner_ = orxonox_cast<TeamBaseMatch>(this->getOwner()->getGametype());
    121121        else
    122122            this->owner_ = 0;
  • code/branches/core4/src/orxonox/overlays/hud/UnderAttackHealthBar.cc

    r3196 r3223  
    7373        SUPER(UnderAttackHealthBar, changedOwner);
    7474
    75         PlayerInfo* player = dynamic_cast<PlayerInfo*>(this->getOwner());
     75        PlayerInfo* player = orxonox_cast<PlayerInfo>(this->getOwner());
    7676        if (player)
    7777        {
    7878            this->owner_ = player;
    7979
    80             UnderAttack* ua = dynamic_cast<UnderAttack*>(player->getGametype());
     80            UnderAttack* ua = orxonox_cast<UnderAttack>(player->getGametype());
    8181            if (ua)
    8282            {
  • code/branches/core4/src/orxonox/overlays/map/Map.cc

    r3196 r3223  
    359359        //COUT(0) << "shipptr" << this->getOwner()->getReverseCamera() << std::endl;
    360360
    361         ControllableEntity* entity = dynamic_cast<ControllableEntity*>(this->getOwner());
     361        ControllableEntity* entity = orxonox_cast<ControllableEntity>(this->getOwner());
    362362        if(entity && entity->getReverseCamera())
    363363        {
Note: See TracChangeset for help on using the changeset viewer.