[Orxonox-commit 4031] r8705 - code/branches/presentation/src/modules/docking

dafrick at orxonox.net dafrick at orxonox.net
Tue Jun 14 20:04:44 CEST 2011


Author: dafrick
Date: 2011-06-14 20:04:44 +0200 (Tue, 14 Jun 2011)
New Revision: 8705

Modified:
   code/branches/presentation/src/modules/docking/Dock.cc
   code/branches/presentation/src/modules/docking/Dock.h
Log:
The calling of tthe docking dialog is now synchronized (but not the docking).


Modified: code/branches/presentation/src/modules/docking/Dock.cc
===================================================================
--- code/branches/presentation/src/modules/docking/Dock.cc	2011-06-13 12:35:18 UTC (rev 8704)
+++ code/branches/presentation/src/modules/docking/Dock.cc	2011-06-14 18:04:44 UTC (rev 8705)
@@ -36,10 +36,12 @@
 #include "core/CoreIncludes.h"
 #include "core/LuaState.h"
 #include "core/GUIManager.h"
+#include "core/command/ConsoleCommand.h"
+#include "network/NetworkFunction.h"
+
 #include "infos/HumanPlayer.h"
+#include "interfaces/PlayerTrigger.h"
 #include "worldentities/pawns/Pawn.h"
-#include "interfaces/PlayerTrigger.h"
-#include "core/command/ConsoleCommand.h"
 
 #include "ToluaBindDocking.h"
 
@@ -53,6 +55,8 @@
     SetConsoleCommand("Dock", "dock",    &Dock::cmdDock).addShortcut().setAsInputCommand();
     SetConsoleCommand("Dock", "undock",  &Dock::cmdUndock).addShortcut().setAsInputCommand();
 
+    registerStaticNetworkFunction(Dock::showDockingDialog);
+
     Dock::Dock(BaseObject* creator) : StaticEntity(creator)
     {
         RegisterObject(Dock);
@@ -109,7 +113,7 @@
             candidates_.insert(player);
 
             // Show docking dialog
-            GUIManager::showGUI("DockingDialog");
+            this->showDockingDialogHelper(player);
         }
         else
         {
@@ -120,6 +124,29 @@
         return true;
     }
 
+    void Dock::showDockingDialogHelper(PlayerInfo* player)
+    {
+        assert(player);
+        
+        if(!player->isHumanPlayer())
+            return;
+        
+        if(GameMode::isMaster())
+        {
+            if(GameMode::showsGraphics())
+                GUIManager::showGUI("DockingDialog");
+        }
+        else
+            callStaticNetworkFunction(Dock::showDockingDialog, player->getClientID());
+
+    }
+
+    /*static*/ void Dock::showDockingDialog()
+    {
+        if(GameMode::showsGraphics())
+            GUIManager::showGUI("DockingDialog");
+    }
+
     void Dock::cmdDock()
     {
         PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();

Modified: code/branches/presentation/src/modules/docking/Dock.h
===================================================================
--- code/branches/presentation/src/modules/docking/Dock.h	2011-06-13 12:35:18 UTC (rev 8704)
+++ code/branches/presentation/src/modules/docking/Dock.h	2011-06-14 18:04:44 UTC (rev 8705)
@@ -35,19 +35,21 @@
 #ifndef _Dock_H__
 #define _Dock_H__
 
+#include "DockingPrereqs.h"
+
 #include <set>
 
 #include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
 #include "core/XMLPort.h"
-#include "core/EventIncludes.h"
 
-#include "worldentities/StaticEntity.h"
 #include "controllers/HumanController.h"
 
+#include "DockingAnimation.h"
 #include "DockingEffect.h"
-#include "DockingAnimation.h"
-#include "DockingPrereqs.h"
 
+#include "worldentities/StaticEntity.h"
+
 namespace orxonox // tolua_export
 {  // tolua_export
 
@@ -91,6 +93,10 @@
             static void cmdDock();
             static void cmdUndock();
 
+            // Network functions
+            void showDockingDialogHelper(PlayerInfo* player);
+            static void showDockingDialog();
+
         private:
             std::set<PlayerInfo*> candidates_; //!< A set of all players which are allowed to dock using the console command.
             std::set<PlayerInfo*> docked_; //!< A set of all docked players




More information about the Orxonox-commit mailing list