Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 4, 2008, 6:39:03 PM (16 years ago)
Author:
scheusso
Message:

corrected some problems with objectID's on client and asserts

File:
1 edited

Legend:

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

    r2132 r2133  
    6969    objectFrequency_=1;
    7070    objectMode_=0x1; // by default do not send data to server
    71     objectID=idCounter++;
     71    if(Host::running() && Host::isServer())
     72      objectID=idCounter++; //this is only needed when running a server
     73    else
     74      objectID=OBJECTID_UNKNOWN;
    7275    classID = (unsigned int)-1;
    7376    syncList = new std::list<synchronisableVariable *>;
     77   
     78#ifndef NDEBUG
     79    ObjectList<Synchronisable>::iterator it;
     80    for(it = ObjectList<Synchronisable>::begin(); it!=ObjectList<Synchronisable>::end(); ++it){
     81      if( it->getObjectID()==this->objectID )
     82        assert(*it==this || (it->objectID==OBJECTID_UNKNOWN && it->objectMode_==0x0));
     83    }
     84#endif
    7485
    7586    this->creatorID = OBJECTID_UNKNOWN;
     
    170181        creator = dynamic_cast<BaseObject*>(synchronisable_creator);
    171182    }
     183    assert(getSynchronisable(header->objectID)==0);   //make sure no object with this id exists
    172184    BaseObject *bo = id->fabricate(creator);
    173185    assert(bo);
Note: See TracChangeset for help on using the changeset viewer.