Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 30, 2009, 12:42:28 PM (15 years ago)
Author:
scheusso
Message:

Fixed problem with scene and creators
creatorID is now always the objectID of the scene except for the case

  • if the object is the scene (then the creatorID is OBJECTID_UNKNOWN)
  • if the object is "above" the scene (e.g. level), then the cID is also OBJECTID_UNKNOWN
Location:
code/branches/core5/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/core/BaseObject.cc

    r5821 r5839  
    4646#include "XMLNameListener.h"
    4747#include "XMLPort.h"
     48#include "network/NetworkPrereqs.h"
    4849
    4950namespace orxonox
     
    7475            this->setFile(this->creator_->getFile());
    7576            this->setNamespace(this->creator_->getNamespace());
    76             this->setScene(this->creator_->getScene());
     77            this->setScene(this->creator_->getScene(), this->creator_->getSceneID());
    7778            this->setGametype(this->creator_->getGametype());
    7879        }
     
    8283            this->namespace_ = 0;
    8384            this->scene_ = 0;
     85            this->sceneID_ = OBJECTID_UNKNOWN;
    8486            this->gametype_ = 0;
    8587        }
  • code/branches/core5/src/libraries/core/BaseObject.h

    r5829 r5839  
    135135            inline BaseObject* getCreator() const { return this->creator_; }
    136136
    137             inline void setScene(const SmartPtr<Scene>& scene) { this->scene_ = scene; }
     137            inline void setScene(const SmartPtr<Scene>& scene, uint32_t sceneID) { this->scene_ = scene; this->sceneID_=sceneID; }
    138138            inline const SmartPtr<Scene>& getScene() const { return this->scene_; }
     139            inline virtual uint32_t getSceneID() const { return this->sceneID_; }
    139140
    140141            inline void setGametype(const SmartPtr<Gametype>& gametype)
     
    202203            std::list<BaseObject*> events_;
    203204            std::map<std::string, EventContainer*> eventContainers_;
     205            uint32_t               sceneID_;
    204206    };
    205207
  • code/branches/core5/src/libraries/network/synchronisable/Synchronisable.cc

    r5797 r5839  
    7272
    7373    // get creator id
    74     this->creatorID = OBJECTID_UNKNOWN;
    75 
    76     searchcreatorID:
     74    if( creator )
     75      this->creatorID = creator->getSceneID();
     76    else
     77      this->creatorID = OBJECTID_UNKNOWN;
     78
     79    /*searchcreatorID:
    7780    if (creator)
    7881    {
     
    8083        if (synchronisable_creator && synchronisable_creator->objectMode_)
    8184        {
    82             this->creatorID = synchronisable_creator->getObjectID();
     85            this->creatorID = synchronisable_creator->getScene()->getObjectID();
    8386        }
    8487        else if (creator != creator->getCreator())
     
    8790            goto searchcreatorID;
    8891        }
    89     }
     92    }*/
    9093  }
    9194
     
    173176    assert(no);
    174177    no->objectID=header.getObjectID();
    175     no->creatorID=header.getCreatorID(); //TODO: remove this
     178    //no->creatorID=header.getCreatorID(); //TODO: remove this
    176179    no->classID=header.getClassID();
     180    assert(no->creatorID == header.getCreatorID());
     181    //assert(no->classID == header.getClassID());
    177182    COUT(4) << "fabricate objectID: " << no->objectID << " classID: " << no->classID << std::endl;
    178183          // update data and create object/entity...
  • code/branches/core5/src/orxonox/Scene.cc

    r5813 r5839  
    5555        RegisterObject(Scene);
    5656
    57         this->setScene(SmartPtr<Scene>(this, false));
     57        this->setScene(SmartPtr<Scene>(this, false), OBJECTID_UNKNOWN);
    5858        this->bShadows_ = true;
    5959
     
    283283    {
    284284        this->objects_.push_back(object);
    285         object->setScene(this);
     285        object->setScene(this, this->getObjectID());
    286286    }
    287287
  • code/branches/core5/src/orxonox/Scene.h

    r5813 r5839  
    7373            inline Radar* getRadar()
    7474                { return this->radar_; }
     75           
     76            inline virtual uint32_t getSceneID() const { return this->getObjectID(); }
    7577
    7678            virtual void tick(float dt);
Note: See TracChangeset for help on using the changeset viewer.