Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 14, 2011, 8:04:44 PM (13 years ago)
Author:
dafrick
Message:

The calling of tthe docking dialog is now synchronized (but not the docking).

Location:
code/branches/presentation/src/modules/docking
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/modules/docking/Dock.cc

    r8700 r8705  
    3737#include "core/LuaState.h"
    3838#include "core/GUIManager.h"
     39#include "core/command/ConsoleCommand.h"
     40#include "network/NetworkFunction.h"
     41
    3942#include "infos/HumanPlayer.h"
     43#include "interfaces/PlayerTrigger.h"
    4044#include "worldentities/pawns/Pawn.h"
    41 #include "interfaces/PlayerTrigger.h"
    42 #include "core/command/ConsoleCommand.h"
    4345
    4446#include "ToluaBindDocking.h"
     
    5355    SetConsoleCommand("Dock", "dock",    &Dock::cmdDock).addShortcut().setAsInputCommand();
    5456    SetConsoleCommand("Dock", "undock",  &Dock::cmdUndock).addShortcut().setAsInputCommand();
     57
     58    registerStaticNetworkFunction(Dock::showDockingDialog);
    5559
    5660    Dock::Dock(BaseObject* creator) : StaticEntity(creator)
     
    110114
    111115            // Show docking dialog
    112             GUIManager::showGUI("DockingDialog");
     116            this->showDockingDialogHelper(player);
    113117        }
    114118        else
     
    119123
    120124        return true;
     125    }
     126
     127    void Dock::showDockingDialogHelper(PlayerInfo* player)
     128    {
     129        assert(player);
     130       
     131        if(!player->isHumanPlayer())
     132            return;
     133       
     134        if(GameMode::isMaster())
     135        {
     136            if(GameMode::showsGraphics())
     137                GUIManager::showGUI("DockingDialog");
     138        }
     139        else
     140            callStaticNetworkFunction(Dock::showDockingDialog, player->getClientID());
     141
     142    }
     143
     144    /*static*/ void Dock::showDockingDialog()
     145    {
     146        if(GameMode::showsGraphics())
     147            GUIManager::showGUI("DockingDialog");
    121148    }
    122149
  • code/branches/presentation/src/modules/docking/Dock.h

    r8700 r8705  
    3636#define _Dock_H__
    3737
     38#include "DockingPrereqs.h"
     39
    3840#include <set>
    3941
    4042#include "core/CoreIncludes.h"
     43#include "core/EventIncludes.h"
    4144#include "core/XMLPort.h"
    42 #include "core/EventIncludes.h"
     45
     46#include "controllers/HumanController.h"
     47
     48#include "DockingAnimation.h"
     49#include "DockingEffect.h"
    4350
    4451#include "worldentities/StaticEntity.h"
    45 #include "controllers/HumanController.h"
    46 
    47 #include "DockingEffect.h"
    48 #include "DockingAnimation.h"
    49 #include "DockingPrereqs.h"
    5052
    5153namespace orxonox // tolua_export
     
    9294            static void cmdUndock();
    9395
     96            // Network functions
     97            void showDockingDialogHelper(PlayerInfo* player);
     98            static void showDockingDialog();
     99
    94100        private:
    95101            std::set<PlayerInfo*> candidates_; //!< A set of all players which are allowed to dock using the console command.
Note: See TracChangeset for help on using the changeset viewer.