Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2013, 2:22:45 PM (11 years ago)
Author:
smerkli
Message:

Merged spacestationentry branch

Location:
code/branches/presentationHS13
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS13

  • code/branches/presentationHS13/src/modules/docking/Dock.cc

    r9667 r9907  
    6969        XMLPortObject(Dock, DockingAnimation, "animations", addAnimation, getAnimation, xmlelement, mode);
    7070        XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
     71        XMLPortEventSink(Dock, BaseObject, "undocking", undocking, xmlelement, mode);
     72
    7173    }
    7274
     
    7678
    7779        XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
    78     }
     80
     81        XMLPortEventSink(Dock, BaseObject, "undocking", undocking, xmlelement, mode);
     82    }
     83
     84
     85    bool Dock::undocking(bool bTriggered, BaseObject* trigger)
     86    {
     87
     88        PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
     89        PlayerInfo* player = NULL;
     90
     91        // Check whether it is a player trigger and extract pawn from it
     92        if(pTrigger != NULL)
     93        {
     94              if(!pTrigger->isForPlayer()) {  // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
     95              orxout(verbose, context::docking) << "Docking:execute PlayerTrigger was not triggered by a player.." << endl;
     96              return false;
     97              }
     98              player = pTrigger->getTriggeringPlayer();
     99        }
     100        else
     101        {
     102              orxout(verbose, context::docking) << "Docking::execute Not a player trigger, can't extract pawn from it.." << endl;
     103              return false;
     104        }
     105        if(player == NULL)
     106        {
     107              orxout(verbose, context::docking) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << endl;
     108              return false;
     109        }
     110
     111            if(bTriggered)
     112        {
     113              // Add player to this Docks candidates
     114              candidates_.insert(player);
     115
     116              // Show docking dialog
     117              this->showUndockingDialogHelper(player);
     118        }
     119        else
     120        {
     121              // Remove player from candidates list
     122              candidates_.erase(player);
     123        }
     124
     125        return true;
     126    }
     127
     128
    79129
    80130    bool Dock::execute(bool bTriggered, BaseObject* trigger)
     
    119169        return true;
    120170    }
     171
     172
     173    void Dock::showUndockingDialogHelper(PlayerInfo* player)
     174        {
     175            assert(player);
     176
     177            if(!player->isHumanPlayer())
     178                return;
     179
     180            if(GameMode::isMaster())
     181            {
     182                if(GameMode::showsGraphics())
     183                    GUIManager::showGUI("UndockingDialog");
     184            }
     185            else
     186                callStaticNetworkFunction(Dock::showDockingDialog, player->getClientID());
     187
     188        }
    121189
    122190    void Dock::showDockingDialogHelper(PlayerInfo* player)
     
    177245        if (animations_.empty())
    178246            return dockingAnimationFinished(player);
     247
    179248        else
    180249            DockingAnimation::invokeAnimation(true, player, animations_);
  • code/branches/presentationHS13/src/modules/docking/Dock.h

    r9667 r9907  
    6262            // Trigger interface
    6363            bool execute(bool bTriggered, BaseObject* trigger);
     64            bool undocking(bool bTriggered, BaseObject* trigger);
    6465
    6566            // XML interface
     
    8586            void dock()
    8687                { this->dock(HumanController::getLocalControllerSingleton()->getPlayer()); }
     88            void undock()
     89                { this->undock(HumanController::getLocalControllerSingleton()->getPlayer()); }
    8790            static unsigned int getNumberOfActiveDocks();
    8891            static Dock* getActiveDockAtIndex(unsigned int index);
     
    9598            // Network functions
    9699            void showDockingDialogHelper(PlayerInfo* player);
     100            void showUndockingDialogHelper(PlayerInfo* player);
    97101            static void showDockingDialog();
    98102
  • code/branches/presentationHS13/src/modules/docking/MoveToDockingTarget.cc

    r9667 r9907  
    6666    {
    6767        //TODO: Investigate strange things...
    68         this->parent_->detach((WorldEntity*)player->getControllableEntity());
     68        //this->parent_->detach((WorldEntity*)player->getControllableEntity());
    6969
     70        //TODO: Check the issue with this detach call.
     71        //I have removed the line because the detach call only caused a warning and terminated. And because I didn't find a attach call either.
     72        //Didn't find the need for the line.
    7073        this->parent_->undockingAnimationFinished(player);
    7174        return true;
Note: See TracChangeset for help on using the changeset viewer.