Changeset 8844 in orxonox.OLD for trunk/src/world_entities/weapons
- Timestamp:
- Jun 28, 2006, 12:17:53 PM (18 years ago)
- Location:
- trunk/src/world_entities/weapons
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/weapon_manager.cc
r8315 r8844 39 39 { 40 40 this->init(); 41 this->setParent(parent); 41 this->setParentEntity(parent); 42 43 assert (parent != NULL); 42 44 } 43 45 … … 66 68 this->setClassID(CL_WEAPON_MANAGER, "WeaponManager"); 67 69 68 this->parent = NULL; 70 this->parentNode = NULL; 71 this->parentEntity = NULL; 69 72 70 73 for (int i = 0; i < WM_MAX_CONFIGS; i++) … … 161 164 * a PNode. 162 165 */ 163 void WeaponManager::setParent(WorldEntity* parent) 164 { 165 this->parent = parent; 166 if (this->parent != NULL) 166 void WeaponManager::setParentEntity(WorldEntity* parent) 167 { 168 this->parentEntity = parent; 169 if (this->parentNode == NULL) 170 this->setParentNode(parent); 171 } 172 173 174 void WeaponManager::setParentNode(PNode* parent) 175 { 176 this->parentNode = parent; 177 assert(parent != NULL); 178 179 if (this->parentNode != NULL) 167 180 { 168 181 for (int i = 0; i < WM_MAX_SLOTS; i++) 169 this->parent->addChild(&this->currentSlotConfig[i].position); 170 } 171 } 182 this->parentNode->addChild(&this->currentSlotConfig[i].position); 183 } 184 185 } 186 172 187 173 188 /** … … 280 295 if(configID == this->currentConfigID) 281 296 this->currentSlotConfig[slotID].nextWeapon = weapon; 282 if (this->parent != NULL)283 { 284 this->parent ->addChild(weapon);285 if (this->parent ->isA(CL_PLAYABLE))286 dynamic_cast<Playable*>(this->parent )->weaponConfigChanged();297 //if (this->parent != NULL) 298 { 299 this->parentNode->addChild(weapon); 300 if (this->parentEntity->isA(CL_PLAYABLE)) 301 dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged(); 287 302 weapon->setDefaultTarget(this->crosshair); 288 303 } … … 445 460 if (tickWeapon != NULL) 446 461 { 447 if (this->parent != NULL)448 tickWeapon->toList(this->parent ->getOMListNumber());462 // if (this->parent != NULL) 463 tickWeapon->toList(this->parentEntity->getOMListNumber()); 449 464 tickWeapon->requestAction(WA_ACTIVATE); 450 465 this->currentSlotConfig[i].position.activateNode(); … … 453 468 else 454 469 this->currentSlotConfig[i].position.deactivateNode(); 455 if (this->parent != NULL && this->parent->isA(CL_PLAYABLE))456 dynamic_cast<Playable*>(this->parent )->weaponConfigChanged();470 if (this->parentEntity != NULL && this->parentEntity->isA(CL_PLAYABLE)) 471 dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged(); 457 472 } 458 473 else if (unlikely(tickWeapon != NULL && tickWeapon->getCurrentState() == WS_DEACTIVATING)) -
trunk/src/world_entities/weapons/weapon_manager.h
r6981 r8844 70 70 long getSlotCapability(int slot) const { return this->currentSlotConfig[slot].capability; }; 71 71 72 void setParent(WorldEntity* parent); 72 void setParentEntity(WorldEntity* parent); 73 WorldEntity* getParentEntity() const { return this->parentEntity; }; 74 75 void setParentNode(PNode* node); 73 76 /** @returns the Parent (carrier) of this WeaponManager */ 74 PNode* getParent () const { return this->parent; };77 PNode* getParentNode() const { return this->parentNode; }; 75 78 76 79 bool addWeapon(Weapon* weapon, int configID = -1, int slotID = -1); … … 107 110 108 111 private: 109 WorldEntity* parent; //!< The parent, this WeaponManager is connected to. 112 WorldEntity* parentEntity; //!< The parent, this WeaponManager is connected to. 113 PNode* parentNode; //!< The parented Node the WeaponManager is connected to. (by default == parentEntity). 110 114 111 115 int slotCount; //!< number of weapon slots the ship has.
Note: See TracChangeset
for help on using the changeset viewer.