Changeset 6986 in orxonox.OLD for trunk/src/world_entities/player.cc
- Timestamp:
- Feb 2, 2006, 5:58:33 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/player.cc
r6985 r6986 49 49 Player::~Player () 50 50 { 51 51 this->setPlayable(NULL); 52 52 } 53 53 … … 55 55 bool Player::setPlayable(Playable* playable) 56 56 { 57 if(playable != NULL && playable->subscribePlayer(this)) 57 if (this->playable == playable) 58 return false; 59 60 // get out of the current Playable 61 if (this->playable != NULL) 58 62 { 63 printf("Player gets ejected from Playable\n"); 64 this->hud.setEnergyWidget(NULL); 65 this->hud.setWeaponManager(NULL); 66 67 Playable* ejectedPlayable = this->playable; 68 69 this->playable = NULL; 70 ejectedPlayable->setPlayer(NULL); 71 } 72 73 if (playable != NULL) 74 { 75 printf("Enter new Playable\n"); 59 76 this->playable = playable; 60 77 this->hud.setEnergyWidget(this->playable->getHealthWidget()); 61 78 this->hud.setWeaponManager(this->playable->getWeaponManager()); 79 80 this->playable->setPlayer(this); 62 81 return true; 63 82 } 64 else 65 return false; 83 84 printf("no change\n"); 85 return true; 66 86 } 67 87 68 bool Player:: disconnectPlayable()88 bool Player::eject() 69 89 { 70 if(this->playable == NULL) return true; 90 this->setPlayable(NULL); 91 } 71 92 72 if(this->playable->unsubscribePlayer(this))73 {74 this->playable = NULL;75 this->hud.setEnergyWidget(NULL);76 this->hud.setWeaponManager(NULL);77 return true;78 }79 else80 return false;81 }82 93 83 94 void Player::weaponConfigChanged() … … 99 110 { 100 111 101 this->disconnectPlayable();102 112 this->setPlayable(dynamic_cast<Playable*>(*node)); 103 113
Note: See TracChangeset
for help on using the changeset viewer.