Changeset 8186
- Timestamp:
- Apr 4, 2011, 3:21:48 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/dockingsystem/src/modules/docking/Dock.cc
r8185 r8186 33 33 34 34 #include "Dock.h" 35 #include "worldentities/pawns/Pawn.h" 36 #include "interfaces/PlayerTrigger.h" 35 37 36 38 … … 74 76 //TODO: Handle MultiDistanceTrigger 75 77 76 //TODO: This way too oversimplified 77 if(bTriggered) { 78 DockingEffect::invokeEffect(docking::DOCKING, NULL, effects_); 79 DockingEffect::invokeEffect(docking::ATTACH, NULL, effects_); 80 } else { 81 DockingEffect::invokeEffect(docking::RELEASE, NULL, effects_); 78 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 79 Pawn* pawn = NULL; 80 81 // If the trigger is a PlayerTrigger. 82 if(pTrigger != NULL) 83 { 84 if(!pTrigger->isForPlayer()) // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one. 85 return false; 86 else 87 pawn = pTrigger->getTriggeringPlayer(); 88 } 89 else 90 return false; 91 92 if(pawn == NULL) 93 { 94 COUT(4) << "Docking: Can't retrieve Pawn from Trigger. (" << trigger->getIdentifier()->getName() << ")" << std::endl; 95 return false; 82 96 } 83 97 98 // Extract the PlayerInfo from the Pawn. 99 PlayerInfo* player = pawn->getPlayer(); 100 101 if(player == NULL) 102 { 103 COUT(3) << "The PlayerInfo* is NULL." << std::endl; 104 return false; 105 } 106 107 //TODO: This is way too oversimplified 108 if(bTriggered) { 109 DockingEffect::invokeEffect(docking::DOCKING, player, effects_); 110 DockingEffect::invokeEffect(docking::ATTACH, player, effects_); 111 } else { 112 DockingEffect::invokeEffect(docking::RELEASE, player, effects_); 113 } 84 114 85 115 return true;
Note: See TracChangeset
for help on using the changeset viewer.