Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 4, 2011, 3:48:17 PM (14 years ago)
Author:
sven
Message:

More verbose error handling in Dock

Location:
code/branches/dockingsystem
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/dockingsystem/data/levels/docking.oxw

    r8185 r8188  
    4242        </events>
    4343        <attached>
    44             <DistanceTrigger position="0,0,0" distance="20" target="ControllableEntity" name="dockMe" />
     44            <DistanceTrigger position="0,0,0" distance="20" target="Pawn" name="dockMe" />
    4545            <Billboard material="Examples/Flare" colour="1.0, 0, 0" />
    4646        </attached>
  • code/branches/dockingsystem/src/modules/docking/Dock.cc

    r8186 r8188  
    7979        Pawn* pawn = NULL;
    8080
    81         // If the trigger is a PlayerTrigger.
     81        // Check whether it is a player trigger and extract pawn from it
    8282        if(pTrigger != NULL)
    8383        {
    84             if(!pTrigger->isForPlayer())  // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
     84            if(!pTrigger->isForPlayer()) {  // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
     85                COUT(0) << "Docking:execute PlayerTrigger is not triggered for player.." << std::endl;
    8586                return false;
    86             else
    87                 pawn = pTrigger->getTriggeringPlayer();
     87            }
     88            pawn = pTrigger->getTriggeringPlayer();
     89        } else {
     90            COUT(0) << "Docking::execute Not a player trigger, can't extract pawn from it.." << std::endl;
     91            return false;
    8892        }
    89         else
    90             return false;
    91 
    9293        if(pawn == NULL)
    9394        {
    94             COUT(4) << "Docking: Can't retrieve Pawn from Trigger. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
     95            COUT(0) << "Docking: Can't retrieve Pawn from Trigger. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
    9596            return false;
    9697        }
     
    9899        // Extract the PlayerInfo from the Pawn.
    99100        PlayerInfo* player = pawn->getPlayer();
    100 
    101101        if(player == NULL)
    102102        {
    103             COUT(3) << "The PlayerInfo* is NULL." << std::endl;
     103            COUT(0) << "The PlayerInfo* is NULL." << std::endl;
    104104            return false;
    105105        }
    106106
    107         //TODO: This is way too oversimplified
     107        // Try to get HumanPlayer
     108        HumanPlayer* human;
     109        if(!player->isHuman()) {
     110            COUT(0) << "Docking::execute Not triggered by a human." << std::endl;
     111            return false;
     112        }
     113        human = orxonox_cast<HumanPlayer*>(player);
     114        assert(human);
     115
     116
     117
     118        //TODO: This is waaay too oversimplified
    108119        if(bTriggered) {
    109120            DockingEffect::invokeEffect(docking::DOCKING, player, effects_);
Note: See TracChangeset for help on using the changeset viewer.