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).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core4/src/network/synchronisable/Synchronisable.cc

    r3214 r3223  
    7373    if (creator)
    7474    {
    75         Synchronisable* synchronisable_creator = dynamic_cast<Synchronisable*>(creator);
     75        Synchronisable* synchronisable_creator = orxonox_cast<Synchronisable>(creator);
    7676        if (synchronisable_creator && synchronisable_creator->objectMode_)
    7777        {
     
    161161      }
    162162      else
    163         creator = dynamic_cast<BaseObject*>(synchronisable_creator);
     163        creator = orxonox_cast<BaseObject>(synchronisable_creator);
    164164    }
    165165    assert(getSynchronisable(header.getObjectID())==0);   //make sure no object with this id exists
    166166    BaseObject *bo = id->fabricate(creator);
    167167    assert(bo);
    168     Synchronisable *no = dynamic_cast<Synchronisable *>(bo);
     168    Synchronisable *no = orxonox_cast<Synchronisable>(bo);
    169169    assert(no);
    170170    no->objectID=header.getObjectID();
Note: See TracChangeset for help on using the changeset viewer.