Changeset 8667
- Timestamp:
- May 29, 2011, 6:44:45 PM (13 years ago)
- Location:
- code/branches/presentation/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/modules/docking/Dock.cc
r8645 r8667 84 84 { 85 85 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 86 P awn* pawn= NULL;86 PlayerInfo* player = NULL; 87 87 88 88 // Check whether it is a player trigger and extract pawn from it … … 93 93 return false; 94 94 } 95 p awn= pTrigger->getTriggeringPlayer();95 player = pTrigger->getTriggeringPlayer(); 96 96 } 97 97 else … … 100 100 return false; 101 101 } 102 if(pawn == NULL)103 {104 COUT(4) << "Docking::execute Can't retrieve Pawn from Trigger. (" << trigger->getIdentifier()->getName() << ")" << std::endl;105 return false;106 }107 108 // Extract the PlayerInfo from the Pawn.109 PlayerInfo* player = pawn->getPlayer();110 102 if(player == NULL) 111 103 { 112 COUT( 2) << "Docking::execute The PlayerInfo* is NULL." << std::endl;104 COUT(4) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << std::endl; 113 105 return false; 114 106 } -
code/branches/presentation/src/modules/notifications/NotificationDispatcher.cc
r8666 r8667 140 140 141 141 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 142 P awn* pawn= NULL;142 PlayerInfo* player = NULL; 143 143 144 144 // If the trigger is a PlayerTrigger. … … 148 148 return false; 149 149 else 150 p awn= pTrigger->getTriggeringPlayer();150 player = pTrigger->getTriggeringPlayer(); 151 151 } 152 152 else 153 153 return false; 154 154 155 if(p awn== NULL)155 if(player == NULL) 156 156 { 157 157 COUT(4) << "The NotificationDispatcher was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl; … … 159 159 } 160 160 161 // Extract the PlayerInfo from the Pawn. 162 PlayerInfo* player = pawn->getPlayer(); 163 164 if(player == NULL) 165 { 166 CCOUT(3) << "The PlayerInfo* is NULL." << std::endl; 167 return false; 168 } 169 170 // HACK fix. Resolve this issue another way... 171 if(GameMode::isStandalone()) 172 this->dispatch(0); 173 else 174 this->dispatch(player->getClientID()); 161 this->dispatch(player->getClientID()); 175 162 176 163 return true; -
code/branches/presentation/src/modules/objects/Script.cc
r7493 r8667 140 140 141 141 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 142 P awn* pawn= NULL;142 PlayerInfo* player = NULL; 143 143 144 144 // If the trigger is a PlayerTrigger. … … 148 148 return false; 149 149 else 150 p awn= pTrigger->getTriggeringPlayer();150 player = pTrigger->getTriggeringPlayer(); 151 151 } 152 152 else 153 153 return false; 154 154 155 if(p awn== NULL) //TODO: Will this ever happen? If not, change in NotificationDispatcher as well.155 if(player == NULL) //TODO: Will this ever happen? If not, change in NotificationDispatcher as well. 156 156 { 157 157 COUT(4) << "The Script was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl; 158 return false;159 }160 161 // Extract the PlayerInfo from the Pawn.162 PlayerInfo* player = pawn->getPlayer();163 164 if(player == NULL)165 {166 COUT(3) << "The PlayerInfo* is NULL." << std::endl;167 158 return false; 168 159 } -
code/branches/presentation/src/modules/objects/triggers/DistanceTrigger.cc
r8637 r8667 205 205 entity = entity->getParent(); 206 206 207 Pawn* player = orxonox_cast<Pawn*>(entity); 208 this->setTriggeringPlayer(player); 207 Pawn* pawn = orxonox_cast<Pawn*>(entity); 208 if(pawn != NULL) 209 this->setTriggeringPawn(pawn); 210 else 211 CCOUT(2) << "Pawn was NULL." << endl; 209 212 } 210 213 -
code/branches/presentation/src/modules/objects/triggers/MultiTriggerContainer.cc
r7601 r8667 73 73 { 74 74 this->setForPlayer(true); 75 this->setTriggeringP layer(pawn);75 this->setTriggeringPawn(pawn); 76 76 } 77 77 } -
code/branches/presentation/src/modules/questsystem/QuestEffectBeacon.cc
r8351 r8667 113 113 114 114 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 115 P awn* pawn= NULL;115 PlayerInfo* player = NULL; 116 116 117 117 // If the trigger is a PlayerTrigger. … … 121 121 return false; 122 122 else 123 p awn= pTrigger->getTriggeringPlayer();123 player = pTrigger->getTriggeringPlayer(); 124 124 } 125 125 else 126 126 return false; 127 127 128 if(p awn== NULL)128 if(player == NULL) 129 129 { 130 130 COUT(4) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl; 131 return false;132 }133 134 // Extract the PlayerInfo from the Pawn.135 PlayerInfo* player = pawn->getPlayer();136 137 if(player == NULL)138 {139 COUT(3) << "The PlayerInfo* is NULL." << std::endl;140 131 return false; 141 132 } -
code/branches/presentation/src/orxonox/interfaces/InterfaceCompilation.cc
r8637 r8667 59 59 RegisterRootObject(PlayerTrigger); 60 60 61 this->player_ = NULL;62 61 this->isForPlayer_ = false; 63 62 } -
code/branches/presentation/src/orxonox/interfaces/PlayerTrigger.h
r7601 r8667 40 40 #include "core/OrxonoxClass.h" 41 41 42 #include "infos/PlayerInfo.h" 43 #include "worldentities/pawns/Pawn.h" 44 42 45 namespace orxonox 43 46 { 44 47 /** 45 48 @brief 46 PlayerTrigger is an interface if implemented by a specific trigger can be used to recover the Player (or more preciselythe @ref orxonox::Pawn "Pawn") that triggered it.49 PlayerTrigger is an interface if implemented by a specific trigger can be used to recover the Player (or the @ref orxonox::Pawn "Pawn") that triggered it. 47 50 48 51 @author … … 58 61 59 62 /** 60 @brief Returns the playerthat triggered the PlayerTrigger.63 @brief Returns the Pawn that triggered the PlayerTrigger. 61 64 @return Returns a pointer to the Pawn that triggered the PlayerTrigger. 62 65 */ 63 inline Pawn* getTriggeringPlayer(void) const 66 inline Pawn* getTriggeringPawn(void) const 67 { return this->pawn_.get(); } 68 69 /** 70 @brief Returns the player that triggered the PlayerTrigger. 71 @return Returns a pointer to the PlayerInfo that triggered the PlayerTrigger. 72 */ 73 inline PlayerInfo* getTriggeringPlayer(void) const 64 74 { return this->player_; } 65 75 66 76 /** 67 @brief Checks whether the PlayerTrigger normally returns a Pawn .68 @return Returns true if the PlayerTrigger normally returns a Pawn .77 @brief Checks whether the PlayerTrigger normally returns a Pawn/PlayerInfo. 78 @return Returns true if the PlayerTrigger normally returns a Pawn/PlayerInfo. 69 79 */ 70 80 inline bool isForPlayer(void) const … … 76 86 @param player A pointer to the Pawn that triggered the PlayerTrigger. 77 87 */ 78 inline void setTriggeringP layer(Pawn* player)79 { this->player_ = player; }88 inline void setTriggeringPawn(Pawn* pawn) 89 { assert(pawn); this->player_ = WeakPtr<PlayerInfo>(pawn->getPlayer()); this->pawn_ = WeakPtr<Pawn>(pawn); } 80 90 81 91 /** … … 87 97 88 98 private: 89 Pawn* player_; //!< The player that triggered the PlayerTrigger. 99 WeakPtr<PlayerInfo> player_; //!< The player that triggered the PlayerTrigger. 100 WeakPtr<Pawn> pawn_; //!< The Pawn that triggered the PlayerTrigger. 90 101 bool isForPlayer_; //!< Is true when the PlayerTrigger should be set to normally be triggered by Pawns. 91 102
Note: See TracChangeset
for help on using the changeset viewer.