Changeset 1559 for code/trunk
- Timestamp:
- Jun 7, 2008, 2:34:54 AM (17 years ago)
- Location:
- code/trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/BaseObject.cc
r1558 r1559 45 45 @brief Constructor: Registers the object in the BaseObject-list. 46 46 */ 47 BaseObject::BaseObject() : 48 bInitialized_(false), 49 bActive_(true), 50 bVisible_(true), 51 level_(0), 52 namespace_(0) 47 BaseObject::BaseObject() : bInitialized_(false) 53 48 { 54 49 RegisterRootObject(BaseObject); 55 50 56 51 this->bInitialized_ = true; 52 53 this->bActive_ = true; 54 this->bVisible_ = true; 55 56 this->level_ = 0; 57 this->namespace_ = 0; 57 58 } 58 59 -
code/trunk/src/orxonox/objects/BillboardProjectile.cc
r1558 r1559 52 52 BillboardProjectile::~BillboardProjectile() 53 53 { 54 if (this-> owner_)54 if (this->isInitialized() && this->owner_) 55 55 this->detachObject(this->billboard_.getBillboardSet()); 56 56 } -
code/trunk/src/orxonox/objects/Model.cc
r1558 r1559 45 45 CreateFactory(Model); 46 46 47 Model::Model() : meshSrc_("")47 Model::Model() 48 48 { 49 49 RegisterObject(Model); … … 53 53 Model::~Model() 54 54 { 55 if ( (this->meshSrc_ != "") && (this->meshSrc_.size() > 0))55 if (this->isInitialized() && (this->meshSrc_ != "") && (this->meshSrc_.size() > 0)) 56 56 this->detachObject(this->mesh_.getEntity()); 57 57 } -
code/trunk/src/orxonox/objects/ParticleProjectile.cc
r1558 r1559 37 37 CreateFactory(ParticleProjectile); 38 38 39 ParticleProjectile::ParticleProjectile(SpaceShip* owner) : BillboardProjectile(owner) , particles_(0)39 ParticleProjectile::ParticleProjectile(SpaceShip* owner) : BillboardProjectile(owner) 40 40 { 41 41 RegisterObject(ParticleProjectile); … … 47 47 this->particles_->getAllEmitters()->setDirection(-this->owner_->getInitialDir()); 48 48 this->particles_->setKeepParticlesInLocalSpace(true); 49 } 50 else 51 { 52 this->particles_ = 0; 49 53 } 50 54 } -
code/trunk/src/orxonox/objects/ParticleSpawner.cc
r1553 r1559 38 38 CreateFactory(ParticleSpawner); 39 39 40 ParticleSpawner::ParticleSpawner() : particle_(0)40 ParticleSpawner::ParticleSpawner() 41 41 { 42 42 RegisterObject(ParticleSpawner); 43 43 } 44 44 45 ParticleSpawner::ParticleSpawner(const std::string& templateName, float lifetime, float delay, const Vector3& direction) : particle_(0)45 ParticleSpawner::ParticleSpawner(const std::string& templateName, float lifetime, float delay, const Vector3& direction) 46 46 { 47 47 RegisterObject(ParticleSpawner); … … 61 61 ParticleSpawner::~ParticleSpawner() 62 62 { 63 if (this-> particle_)63 if (this->isInitialized()) 64 64 { 65 65 this->particle_->detachFromSceneNode(); -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1558 r1559 79 79 } 80 80 81 SpaceShip::SpaceShip() : 82 //testvector_(0,0,0), 83 //bInvertYAxis_(false), 84 setMouseEventCallback_(false), 85 bLMousePressed_(false), 86 bRMousePressed_(false), 87 camNode_(0), 88 cam_(0), 89 camName_("CamNode"), 90 tt1_(0), 91 tt2_(0), 92 redNode_(0), 93 greenNode_(0), 94 blinkTime_(0.0f), 95 chNearNode_(0), 96 chFarNode_(0), 97 timeToReload_(0.0f), 98 //reloadTime_(0.0f), 99 maxSideAndBackSpeed_(0.0f), 100 maxSpeed_(0.0f), 101 maxRotation_(0.0f), 102 translationAcceleration_(0.0f), 103 rotationAcceleration_(0.0f), 104 translationDamping_(0.0f), 105 rotationDamping_(0.0f), 106 maxRotationRadian_(0), 107 rotationAccelerationRadian_(0), 108 rotationDampingRadian_(0), 109 zeroRadian_(0), 110 mouseXRotation_(0), 111 mouseYRotation_(0), 112 mouseX_(0.0f), 113 mouseY_(0.0f), 114 myShip_(false), 115 teamNr_(0), 116 health_(100) 81 SpaceShip::SpaceShip() 117 82 { 118 83 RegisterObject(SpaceShip); 119 this->registerAllVariables();120 121 SpaceShip::instance_s = this;122 123 this->setConfigValues();124 125 initialDir_ = Vector3(1.0, 0.0, 0.0);126 currentDir_ = initialDir_;127 initialOrth_ = Vector3(0.0, 0.0, 1.0);128 currentOrth_ = initialOrth_;129 130 this->camName_ = this->getName() + "CamNode";131 84 132 85 this->setRotationAxis(1, 0, 0); 133 86 this->setStatic(false); 134 87 88 this->zeroRadian_ = 0; 89 this->maxSideAndBackSpeed_ = 0; 90 this->maxSpeed_ = 0; 91 this->maxRotation_ = 0; 92 this->translationAcceleration_ = 0; 93 this->rotationAcceleration_ = 0; 94 this->translationDamping_ = 0; 95 this->rotationDamping_ = 0; 96 this->maxRotationRadian_ = 0; 97 this->rotationAccelerationRadian_ = 0; 98 this->rotationDampingRadian_ = 0; 99 100 this->cam_ = 0; 101 this->tt1_ = 0; 102 this->tt2_ = 0; 103 104 this->redNode_ = 0; 105 this->greenNode_ = 0; 106 this->blinkTime_ = 0; 107 108 this->timeToReload_ = 0; 109 110 this->setMouseEventCallback_ = false; 111 this->bLMousePressed_ = false; 112 this->bRMousePressed_ = false; 113 this->mouseXRotation_ = 0; 114 this->mouseYRotation_ = 0; 115 this->mouseX_ = 0; 116 this->mouseY_ = 0; 117 this->myShip_ = false; 118 119 this->registerAllVariables(); 120 121 SpaceShip::instance_s = this; 122 123 this->setConfigValues(); 124 125 this->initialDir_ = Vector3(1.0, 0.0, 0.0); 126 this->currentDir_ = initialDir_; 127 this->initialOrth_ = Vector3(0.0, 0.0, 1.0); 128 this->currentOrth_ = initialOrth_; 129 130 this->camName_ = this->getName() + "CamNode"; 131 132 this->teamNr_ = 0; 133 this->health_ = 100; 134 135 135 COUT(3) << "Info: SpaceShip was loaded" << std::endl; 136 136 } … … 138 138 SpaceShip::~SpaceShip() 139 139 { 140 if (this->tt1_) 141 delete this->tt1_; 142 if (this->tt2_) 143 delete this->tt2_; 144 if(setMouseEventCallback_) 145 InputManager::removeMouseHandler("SpaceShip"); 146 if (this->cam_) 147 delete this->cam_; 148 if (!Identifier::isCreatingHierarchy() && !myShip_ && &HUD::getSingleton()!=NULL) 149 //remove the radar object 150 HUD::getSingleton().removeRadarObject(this->getNode()); 140 if (this->isInitialized()) 141 { 142 if (this->tt1_) 143 delete this->tt1_; 144 if (this->tt2_) 145 delete this->tt2_; 146 147 if (setMouseEventCallback_) 148 InputManager::removeMouseHandler("SpaceShip"); 149 150 if (this->cam_) 151 delete this->cam_; 152 153 if (!myShip_ && &HUD::getSingleton()!=NULL) 154 HUD::getSingleton().removeRadarObject(this->getNode()); 155 } 151 156 } 152 157 … … 307 312 Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0)); 308 313 Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(1,0,0)); 309 camNode_->setOrientation(q2*q1);314 this->camNode_->setOrientation(q2*q1); 310 315 if(network::Client::getSingleton()!=0 && network::Client::getSingleton()->getShipID()==objectID){ 311 316 this->setBacksync(true); -
code/trunk/src/orxonox/objects/WorldEntity.cc
r1558 r1559 45 45 unsigned int WorldEntity::worldEntityCounter_s = 0; 46 46 47 WorldEntity::WorldEntity() : 48 velocity_ (0, 0, 0), 49 acceleration_(0, 0, 0), 50 rotationAxis_(0, 1, 0), 51 rotationRate_(0), 52 momentum_ (0), 53 node_ (0), 54 bStatic_ (true) 47 WorldEntity::WorldEntity() 55 48 { 56 49 RegisterObject(WorldEntity); … … 58 51 if (GraphicsEngine::getSingleton().getSceneManager()) 59 52 { 60 std::ostringstream name;61 name << (WorldEntity::worldEntityCounter_s++);62 this->setName("WorldEntity" + name.str());63 this->node_ = GraphicsEngine::getSingleton().getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName());53 std::ostringstream name; 54 name << (WorldEntity::worldEntityCounter_s++); 55 this->setName("WorldEntity" + name.str()); 56 this->node_ = GraphicsEngine::getSingleton().getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName()); 64 57 65 registerAllVariables();58 registerAllVariables(); 66 59 } 60 else 61 { 62 this->node_ = 0; 63 } 64 65 this->bStatic_ = true; 66 this->velocity_ = Vector3(0, 0, 0); 67 this->acceleration_ = Vector3(0, 0, 0); 68 this->rotationAxis_ = Vector3(0, 1, 0); 69 this->rotationRate_ = 0; 70 this->momentum_ = 0; 67 71 } 68 72 … … 70 74 WorldEntity::~WorldEntity() 71 75 { 72 // just to make sure we clean out all scene nodes 73 if(this->getNode()) 76 if (this->isInitialized()) 74 77 { 75 78 this->getNode()->removeAndDestroyAllChildren();
Note: See TracChangeset
for help on using the changeset viewer.