Changeset 8844 in orxonox.OLD for trunk/src/world_entities/weapons/weapon_manager.cc
- Timestamp:
- Jun 28, 2006, 12:17:53 PM (18 years ago)
- File:
-
- 1 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))
Note: See TracChangeset
for help on using the changeset viewer.