Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 23, 2009, 7:28:48 PM (15 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/objects/gametypes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core4/src/orxonox/objects/gametypes/Pong.cc

    r3196 r3223  
    144144        if (player && player->getController() && player->getController()->isA(Class(PongAI)))
    145145        {
    146             PongAI* ai = dynamic_cast<PongAI*>(player->getController());
     146            PongAI* ai = orxonox_cast<PongAI>(player->getController());
    147147            ai->setPongBall(this->ball_);
    148148        }
  • code/branches/core4/src/orxonox/objects/gametypes/TeamBaseMatch.cc

    r3196 r3223  
    5454    bool TeamBaseMatch::allowPawnDeath(Pawn* victim, Pawn* originator)
    5555    {
    56         TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);
     56        TeamBaseMatchBase* base = orxonox_cast<TeamBaseMatchBase>(victim);
    5757        if (base)
    5858        {
     
    8787    bool TeamBaseMatch::allowPawnDamage(Pawn* victim, Pawn* originator)
    8888    {
    89         TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);
     89        TeamBaseMatchBase* base = orxonox_cast<TeamBaseMatchBase>(victim);
    9090        if (base)
    9191        {
  • code/branches/core4/src/orxonox/objects/gametypes/TeamDeathmatch.cc

    r3196 r3223  
    126126            if ((*it)->isA(Class(TeamSpawnPoint)))
    127127            {
    128                 TeamSpawnPoint* tsp = dynamic_cast<TeamSpawnPoint*>(*it);
     128                TeamSpawnPoint* tsp = orxonox_cast<TeamSpawnPoint>(*it);
    129129                if (tsp && (int)tsp->getTeamNumber() != desiredTeamNr)
    130130                {
     
    171171                    if ((*it)->isA(Class(TeamColourable)))
    172172                    {
    173                         TeamColourable* tc = dynamic_cast<TeamColourable*>(*it);
     173                        TeamColourable* tc = orxonox_cast<TeamColourable>(*it);
    174174                        tc->setTeamColour(this->teamcolours_[it_player->second]);
    175175                    }
Note: See TracChangeset for help on using the changeset viewer.