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/controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core4/src/orxonox/objects/controllers/ArtificialController.cc

    r3196 r3223  
    181181        if (entity1->getXMLController())
    182182        {
    183             WaypointPatrolController* wpc = dynamic_cast<WaypointPatrolController*>(entity1->getXMLController());
     183            WaypointPatrolController* wpc = orxonox_cast<WaypointPatrolController>(entity1->getXMLController());
    184184            if (wpc)
    185185                team1 = wpc->getTeam();
     
    187187        if (entity2->getXMLController())
    188188        {
    189             WaypointPatrolController* wpc = dynamic_cast<WaypointPatrolController*>(entity2->getXMLController());
     189            WaypointPatrolController* wpc = orxonox_cast<WaypointPatrolController>(entity2->getXMLController());
    190190            if (wpc)
    191191                team2 = wpc->getTeam();
    192192        }
    193193
    194         TeamDeathmatch* tdm = dynamic_cast<TeamDeathmatch*>(gametype);
     194        TeamDeathmatch* tdm = orxonox_cast<TeamDeathmatch>(gametype);
    195195        if (tdm)
    196196        {
     
    203203
    204204        TeamBaseMatchBase* base = 0;
    205         base = dynamic_cast<TeamBaseMatchBase*>(entity1);
     205        base = orxonox_cast<TeamBaseMatchBase>(entity1);
    206206        if (base)
    207207        {
     
    219219            }
    220220        }
    221         base = dynamic_cast<TeamBaseMatchBase*>(entity2);
     221        base = orxonox_cast<TeamBaseMatchBase>(entity2);
    222222        if (base)
    223223        {
  • code/branches/core4/src/orxonox/objects/controllers/HumanController.cc

    r3196 r3223  
    161161        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    162162        {
    163             Pawn* pawn = dynamic_cast<Pawn*>(HumanController::localController_s->controllableEntity_);
     163            Pawn* pawn = orxonox_cast<Pawn>(HumanController::localController_s->controllableEntity_);
    164164            if (pawn)
    165165                pawn->kill();
     
    196196    {
    197197        if (HumanController::localController_s)
    198             return dynamic_cast<Pawn*>(HumanController::localController_s->getControllableEntity());
     198            return orxonox_cast<Pawn>(HumanController::localController_s->getControllableEntity());
    199199        else
    200200            return NULL;
Note: See TracChangeset for help on using the changeset viewer.