Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2034


Ignore:
Timestamp:
Oct 28, 2008, 10:34:45 PM (16 years ago)
Author:
landauf
Message:

Synchronisable translates creator ↔ creatorID

Location:
code/branches/objecthierarchy/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/core/CoreIncludes.h

    r1940 r2034  
    112112*/
    113113#define Class(ClassName) \
    114     ClassIdentifier<ClassName>::getIdentifier()
     114    orxonox::ClassIdentifier<ClassName>::getIdentifier()
    115115
    116116/**
  • code/branches/objecthierarchy/src/network/GamestateManager.cc

    r2006 r2034  
    8080    // now push only the most recent gamestates we received (ignore obsolete ones)
    8181    for(it = gamestateQueue.begin(); it!=gamestateQueue.end(); it++){
    82       assert(processGamestate(it->second));
     82      bool b = processGamestate(it->second);
     83//      assert(b);
    8384      delete it->second;
    8485    }
  • code/branches/objecthierarchy/src/network/Synchronisable.cc

    r2033 r2034  
    6363  * Initializes all Variables and sets the right objectID
    6464  */
    65   Synchronisable::Synchronisable(){
     65  Synchronisable::Synchronisable(orxonox::BaseObject* creator){
    6666    RegisterRootObject(Synchronisable);
    6767    static uint32_t idCounter=0;
     
    7171    classID = (unsigned int)-1;
    7272    syncList = new std::list<synchronisableVariable *>;
     73
     74    this->creatorID = OBJECTID_UNKNOWN;
     75
     76    searchcreatorID:
     77    if (creator)
     78    {
     79        if (creator->isA(Class(Synchronisable)))
     80        {
     81            Synchronisable* synchronisable_creator = dynamic_cast<Synchronisable*>(creator);
     82            this->creatorID = synchronisable_creator->getObjectID();
     83        }
     84        else if (creator != creator->getCreator())
     85        {
     86            creator = creator->getCreator();
     87            goto searchcreatorID;
     88        }
     89    }
    7390  }
    7491
     
    134151    orxonox::Identifier* id = ClassByID(header->classID);
    135152    assert(id);
    136     orxonox::BaseObject *bo = id->fabricate(0); //TODO: get BaseObject* from header->creatorID here
     153    orxonox::BaseObject* creator = 0;
     154    if (header->creatorID != OBJECTID_UNKNOWN)
     155    {
     156        Synchronisable* synchronisable_creator = Synchronisable::getSynchronisable(header->creatorID);
     157        if (!synchronisable_creator)
     158            return 0;
     159        else
     160            creator = dynamic_cast<orxonox::BaseObject*>(synchronisable_creator);
     161    }
     162    orxonox::BaseObject *bo = id->fabricate(creator);
     163    assert(bo);
    137164    Synchronisable *no = dynamic_cast<Synchronisable *>(bo);
    138165    assert(no);
  • code/branches/objecthierarchy/src/network/Synchronisable.h

    r2028 r2034  
    115115    inline unsigned int getClassID(){return classID;}
    116116  protected:
    117     Synchronisable();
     117    Synchronisable(orxonox::BaseObject* creator);
    118118    void registerVar(void *var, int size, variableType t, int mode=1, NetworkCallbackBase *cb=0);
    119119    void setObjectMode(int mode);
  • code/branches/objecthierarchy/src/network/packet/Gamestate.cc

    r2031 r2034  
    158158    {
    159159      s = Synchronisable::fabricate(mem, mode);
    160       assert(s);
     160      return false;
    161161//       if(!s)
    162162//         return false;
  • code/branches/objecthierarchy/src/orxonox/gamestates/GSLevel.cc

    r2030 r2034  
    197197    void GSLevel::unloadLevel()
    198198    {
    199         Loader::unload(startFile_);
     199        //////////////////////////////////////////////////////////////////////////////////////////
     200        // TODO // TODO // TODO // TODO // TODO // TODO // TODO // TODO // TODO // TODO // TODO //
     201        //////////////////////////////////////////////////////////////////////////////////////////
     202        // Loader::unload(startFile_); // TODO: REACTIVATE THIS IF LOADER::UNLOAD WORKS PROPERLY /
     203        //////////////////////////////////////////////////////////////////////////////////////////
     204
    200205        delete this->startFile_;
    201206    }
  • code/branches/objecthierarchy/src/orxonox/objects/Scene.cc

    r2033 r2034  
    4343    CreateFactory(Scene);
    4444
    45     Scene::Scene(BaseObject* creator) : BaseObject(creator)
     45    Scene::Scene(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
    4646    {
    4747        RegisterObject(Scene);
     
    8181        }
    8282        // test test test
    83        
     83
    8484        this->registerVariables();
    8585    }
  • code/branches/objecthierarchy/src/orxonox/objects/Test.cc

    r2019 r2034  
    3636        CreateFactory ( Test );
    3737
    38         Test::Test(BaseObject* creator) : BaseObject(creator)
     38        Test::Test(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
    3939        {
    4040                RegisterObject ( Test );
  • code/branches/objecthierarchy/src/orxonox/objects/infos/Info.cc

    r2019 r2034  
    3434namespace orxonox
    3535{
    36     Info::Info(BaseObject* creator) : BaseObject(creator)
     36    Info::Info(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
    3737    {
    3838        RegisterObject(Info);
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/SpawnPoint.h

    r2024 r2034  
    6060            void spawn(ControllableEntity* entity);
    6161
    62         public:
     62        private:
    6363            void setSpawnClassName(const std::string& name);
    6464            inline const std::string& getSpawnClassName() const
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/WorldEntity.cc

    r2023 r2034  
    4848    const Vector3 WorldEntity::UP    = Vector3::UNIT_Y;
    4949
    50     WorldEntity::WorldEntity(BaseObject* creator) : BaseObject(creator)
     50    WorldEntity::WorldEntity(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
    5151    {
    5252        RegisterObject(WorldEntity);
  • code/branches/objecthierarchy/src/util/Debug.h

    r1791 r2034  
    7777}
    7878
     79namespace orxonox
     80{
     81    using std::endl;
     82}
    7983
    8084// DEFINE ERROR MODES
Note: See TracChangeset for help on using the changeset viewer.