Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 10, 2008, 12:05:03 AM (16 years ago)
Author:
landauf
Message:

merged revisions 2111-2170 from objecthierarchy branch back to trunk.

Location:
code/trunk
Files:
2 deleted
63 edited
4 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/CMakeLists.txt

    r2130 r2171  
    44  LevelManager.cc
    55  Main.cc
     6  PlayerManager.cc
    67  Settings.cc
    78 
  • code/trunk/src/orxonox/CameraManager.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/trunk/src/orxonox/CameraManager.h

    r2103 r2171  
    2828
    2929 /**
    30  @file  CameraManager.h
     30 @file
    3131 @brief Handles the instances of Camera class
    3232 @author Benjamin Knecht <beni_at_orxonox.net>
  • code/trunk/src/orxonox/LevelManager.cc

    r2087 r2171  
    2828
    2929#include "OrxonoxStableHeaders.h"
    30 
    3130#include "LevelManager.h"
    3231
    33 #include "core/CoreIncludes.h"
    34 
    35 #include "objects/infos/Level.h"
     32#include "PlayerManager.h"
     33#include "objects/Level.h"
    3634#include "objects/infos/HumanPlayer.h"
    3735
     
    4240    LevelManager::LevelManager()
    4341    {
    44         RegisterRootObject(LevelManager);
    45 
    4642        assert(singletonRef_s == 0);
    4743        singletonRef_s = this;
    48 
    49         this->getConnectedClients();
    5044    }
    5145
     
    9589        {
    9690            this->levels_s.front()->setActive(true);
    97             for (std::map<unsigned int, PlayerInfo*>::iterator it = this->clients_.begin(); it != this->clients_.end(); ++it)
     91            for (std::map<unsigned int, PlayerInfo*>::const_iterator it = PlayerManager::getInstance().getClients().begin(); it != PlayerManager::getInstance().getClients().end(); ++it)
    9892                this->levels_s.front()->playerEntered(it->second);
    9993        }
    10094    }
    101 
    102 
    103     void LevelManager::clientConnected(unsigned int clientID)
    104     {
    105         COUT(3) << "client connected" << std::endl;
    106 
    107         // create new HumanPlayer instance
    108         HumanPlayer* player = new HumanPlayer(0);
    109         player->setClientID(clientID);
    110 
    111         // add to clients-map
    112         assert(!this->clients_[clientID]);
    113         this->clients_[clientID] = player;
    114 
    115         if (this->getActiveLevel())
    116             this->getActiveLevel()->playerEntered(player);
    117     }
    118 
    119     void LevelManager::clientDisconnected(unsigned int clientID)
    120     {
    121         COUT(3) << "client disconnected" << std::endl;
    122 
    123         // remove from clients-map
    124         PlayerInfo* player = this->clients_[clientID];
    125         this->clients_.erase(clientID);
    126 
    127         if (this->getActiveLevel())
    128             this->getActiveLevel()->playerLeft(player);
    129 
    130         // delete PlayerInfo instance
    131         if (player)
    132             delete player;
    133     }
    134 
    135 
    136     PlayerInfo* LevelManager::getClient(unsigned int clientID) const
    137     {
    138         std::map<unsigned int, PlayerInfo*>::const_iterator it = this->clients_.find(clientID);
    139         if (it != this->clients_.end())
    140             return it->second;
    141         else
    142             return 0;
    143     }
    14495}
  • code/trunk/src/orxonox/LevelManager.h

    r2087 r2171  
    3636#include <cassert>
    3737
    38 #include "network/ClientConnectionListener.h"
    39 
    4038namespace orxonox
    4139{
    42     class _OrxonoxExport LevelManager : public network::ClientConnectionListener
     40    class _OrxonoxExport LevelManager
    4341    {
    4442        public:
     
    5048            Level* getActiveLevel();
    5149
    52             PlayerInfo* getClient(unsigned int clientID) const;
    53             inline const std::map<unsigned int, PlayerInfo*>& getClients() const
    54                 { return this->clients_; }
    55 
     50            static LevelManager* getInstancePtr() { return singletonRef_s; }
    5651            static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
    5752
     
    5954            LevelManager(const LevelManager&);
    6055
    61             void clientConnected(unsigned int clientID);
    62             void clientDisconnected(unsigned int clientID);
    63 
    6456            void activateNextLevel();
    6557
    6658            std::list<Level*> levels_s;
    67             std::map<unsigned int, PlayerInfo*> clients_;
    68 
    6959            static LevelManager* singletonRef_s;
    7060    };
  • code/trunk/src/orxonox/OrxonoxPrereqs.h

    r2096 r2171  
    8282    class CameraManager;
    8383    class LevelManager;
     84    class PlayerManager;
    8485
    8586    // objects
     87    class Level;
    8688    class Scene;
    8789
     
    142144
    143145    class Info;
    144     class Level;
    145146    class PlayerInfo;
    146147    class HumanPlayer;
  • code/trunk/src/orxonox/Settings.h

    r2087 r2171  
    2828
    2929/**
    30     @file Core.h
     30    @file
    3131    @brief Declaration of the Settings class.
    3232
  • code/trunk/src/orxonox/gamestates/GSClient.cc

    r2087 r2171  
    5353        Core::setIsClient(true);
    5454
    55         this->client_ = new network::Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port"));
     55        this->client_ = new Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port"));
    5656
    5757        if(!client_->establishConnection())
  • code/trunk/src/orxonox/gamestates/GSClient.h

    r2087 r2171  
    4949        void ticked(const Clock& time);
    5050
    51         network::Client* client_;
     51        Client* client_;
    5252    };
    5353}
  • code/trunk/src/orxonox/gamestates/GSDedicated.cc

    r2087 r2171  
    3232#include "core/CommandLine.h"
    3333#include "core/Core.h"
     34#include "core/Iterator.h"
    3435#include "network/Server.h"
     36#include "objects/Tickable.h"
    3537
    3638namespace orxonox
     
    5052        Core::setHasServer(true);
    5153
    52         this->server_ = new network::Server(CommandLine::getValue("port"));
     54        this->server_ = new Server(CommandLine::getValue("port"));
    5355        COUT(0) << "Loading scene in server mode" << std::endl;
    5456
  • code/trunk/src/orxonox/gamestates/GSDedicated.h

    r2087 r2171  
    4848        void ticked(const Clock& time);
    4949
    50         network::Server*      server_;
     50        Server*      server_;
    5151    };
    5252}
  • code/trunk/src/orxonox/gamestates/GSGraphics.cc

    r2103 r2171  
    5656#include "gui/GUIManager.h"
    5757#include "tools/WindowEventListener.h"
    58 #include "objects/Tickable.h"
    5958#include "Settings.h"
    6059
     
    242241        this->tickChild(time);
    243242
    244         /*** HACK *** HACK ***/
    245         // Call the Tickable objects
    246         for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
    247             it->tick(time.getDeltaTime());
    248         /*** HACK *** HACK ***/
    249 
    250243        if (this->bWindowEventListenerUpdateRequired_)
    251244        {
  • code/trunk/src/orxonox/gamestates/GSRoot.cc

    r2087 r2171  
    4141#include "core/TclThreadManager.h"
    4242#include "tools/Timer.h"
     43#include "objects/Tickable.h"
    4344#include "Settings.h"
    4445
     
    143144            it->tick(time);
    144145
     146        /*** HACK *** HACK ***/
     147        // Call the Tickable objects
     148        for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
     149            it->tick(time.getDeltaTime());
     150        /*** HACK *** HACK ***/
     151
    145152        this->tickChild(time);
    146153    }
  • code/trunk/src/orxonox/gamestates/GSServer.cc

    r2087 r2171  
    5252        Core::setHasServer(true);
    5353
    54         this->server_ = new network::Server(CommandLine::getValue("port"));
     54        this->server_ = new Server(CommandLine::getValue("port"));
    5555        COUT(0) << "Loading scene in server mode" << std::endl;
    5656
  • code/trunk/src/orxonox/gamestates/GSServer.h

    r2087 r2171  
    4848        void ticked(const Clock& time);
    4949
    50         network::Server*      server_;
     50        Server*      server_;
    5151    };
    5252}
  • code/trunk/src/orxonox/objects/CMakeLists.txt

    r2131 r2171  
    33  EventDispatcher.cc
    44  EventTarget.cc
     5  Level.cc
    56  Radar.cc
    67  RadarListener.cc
  • code/trunk/src/orxonox/objects/Scene.cc

    r2087 r2171  
    4343    CreateFactory(Scene);
    4444
    45     Scene::Scene(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
     45    Scene::Scene(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
    4646    {
    4747        RegisterObject(Scene);
     
    114114    void Scene::registerVariables()
    115115    {
    116         REGISTERSTRING(this->skybox_,     network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox));
    117         REGISTERDATA(this->ambientLight_, network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight));
     116        REGISTERSTRING(this->skybox_,     direction::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox));
     117        REGISTERDATA(this->ambientLight_, direction::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight));
    118118    }
    119119
     
    164164        return 0;
    165165    }
     166
     167    void Scene::tick(float dt)
     168    {
     169        if (!Core::showsGraphics())
     170        {
     171            // We need to update the scene nodes if we don't render
     172            this->rootSceneNode_->_update(true, false);
     173        }
     174    }
    166175}
  • code/trunk/src/orxonox/objects/Scene.h

    r2087 r2171  
    3535#include "core/BaseObject.h"
    3636#include "util/Math.h"
     37#include "objects/Tickable.h"
    3738
    3839namespace orxonox
    3940{
    40     class _OrxonoxExport Scene : public BaseObject, public network::Synchronisable
     41    class _OrxonoxExport Scene : public BaseObject, public Synchronisable, public Tickable
    4142    {
    4243        public:
     
    6465                { return this->bShadows_; }
    6566
     67            virtual void tick(float dt);
     68
    6669        private:
    6770            void addObject(BaseObject* object);
  • code/trunk/src/orxonox/objects/Test.cc

    r2087 r2171  
    3030#include "core/CoreIncludes.h"
    3131#include "core/ConfigValueIncludes.h"
     32#include "core/ConsoleCommand.h"
    3233#include "Test.h"
    3334
     
    3536{
    3637        CreateFactory ( Test );
     38 
     39  SetConsoleCommand(Test, printV1, true).accessLevel(AccessLevel::User);
     40  SetConsoleCommand(Test, printV2, true).accessLevel(AccessLevel::User);
     41  SetConsoleCommand(Test, printV3, true).accessLevel(AccessLevel::User);
     42  SetConsoleCommand(Test, printV4, true).accessLevel(AccessLevel::User);
     43 
     44  Test* Test::instance_ = 0;
    3745
    38         Test::Test(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
     46        Test::Test(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
    3947        {
     48    assert(instance_==0);
     49    instance_=this;
    4050                RegisterObject ( Test );
    41                 setConfigValues();
    42                 registerVariables();
     51    setConfigValues();
     52    registerVariables();
    4353                setObjectMode(0x3);
    4454        }
     
    4656        Test::~Test()
    4757        {
    48 
     58    instance_=0;
    4959        }
    5060
    5161        void Test::setConfigValues()
    5262        {
    53                 SetConfigValue ( v1, 1 ).callback ( this, &Test::checkV1 );
    54                 SetConfigValue ( v2, 2 ).callback ( this, &Test::checkV2 );
    55                 SetConfigValue ( v3, 3 ).callback ( this, &Test::checkV3 );
     63                SetConfigValue ( v1, 1 )/*.callback ( this, &Test::checkV1 )*/;
     64    SetConfigValue ( v2, 2 )/*.callback ( this, &Test::checkV2 )*/;
     65    SetConfigValue ( v3, 3 )/*.callback ( this, &Test::checkV3 )*/;
     66    SetConfigValue ( v4, 4 )/*.callback ( this, &Test::checkV4 )*/;
    5667        }
    5768
     
    5970        void Test::registerVariables()
    6071        {
    61                 REGISTERDATA ( v1,network::direction::toclient, new network::NetworkCallback<Test> ( this, &Test::checkV1 ) );
    62                 REGISTERDATA ( v2,network::direction::toserver, new network::NetworkCallback<Test> ( this, &Test::checkV2 ) );
    63                 REGISTERDATA ( v3,network::direction::bidirectional, new network::NetworkCallback<Test> ( this, &Test::checkV3 ) );
     72                REGISTERDATA ( v1,direction::toclient, new NetworkCallback<Test> ( this, &Test::checkV1 ) );
     73    REGISTERDATA ( v2,direction::toserver, new NetworkCallback<Test> ( this, &Test::checkV2 ) );
     74                REGISTERDATA ( v3,direction::serverMaster, new NetworkCallback<Test> ( this, &Test::checkV3 ) );
     75    REGISTERDATA ( v4,direction::clientMaster, new NetworkCallback<Test> ( this, &Test::checkV4 ) );
    6476        }
    6577
    66         void Test::checkV1(){
    67                 COUT(1) << "V1 changed: " << v1 << std::endl;
    68         }
     78  void Test::checkV1(){
     79    COUT(1) << "V1 changed: " << v1 << std::endl;
     80  }
    6981
    70         void Test::checkV2(){
    71                 COUT(1) << "V2 changed: " << v2 << std::endl;
    72         }
     82  void Test::checkV2(){
     83    COUT(1) << "V2 changed: " << v2 << std::endl;
     84  }
    7385
    74         void Test::checkV3(){
    75                 COUT(1) << "V3 changed: " << v3 << std::endl;
    76         }
     86  void Test::checkV3(){
     87    COUT(1) << "V3 changed: " << v3 << std::endl;
     88  }
     89 
     90  void Test::checkV4(){
     91    COUT(1) << "V4 changed: " << v4 << std::endl;
     92  }
    7793
    7894
  • code/trunk/src/orxonox/objects/Test.h

    r2087 r2171  
    3636namespace orxonox
    3737{
    38   class _OrxonoxExport Test: public BaseObject, public network::Synchronisable
     38  class _OrxonoxExport Test: public BaseObject, public Synchronisable
    3939  {
    4040    public:
     
    4848      void setV2(unsigned int value){ v2 = value; }
    4949      void setV3(unsigned int value){ v3 = value; }
     50      void setV4(unsigned int value){ v4 = value; }
    5051
    5152      void checkV1();
    5253      void checkV2();
    5354      void checkV3();
     55      void checkV4();
     56     
     57      void printV1(){ instance_->checkV1(); }
     58      void printV2(){ instance_->checkV2(); }
     59      void printV3(){ instance_->checkV3(); }
     60      void printV4(){ instance_->checkV4(); }
    5461
    5562    private:
     
    5764      unsigned int v2;
    5865      unsigned int v3;
     66      unsigned int v4;
     67     
     68      static Test* instance_;
    5969  };
    6070}
  • code/trunk/src/orxonox/objects/Tickable.h

    r1790 r2171  
    2828
    2929/*!
    30     @file Tickable.h
     30    @file
    3131    @brief Declaration of the Tickable interface.
    3232
  • code/trunk/src/orxonox/objects/gametypes/Gametype.cc

    r2087 r2171  
    6767        if (!this->bStarted_)
    6868            this->checkStart();
     69        else
     70            this->spawnDeadPlayersIfRequested();
    6971
    7072        this->assignDefaultPawnsIfNeeded();
    71         this->spawnDeadPlayersIfRequested();
    7273    }
    7374
     
    8889    void Gametype::playerEntered(PlayerInfo* player)
    8990    {
    90         this->players_.insert(player);
     91        this->players_[player] = PlayerState::Joined;
    9192
    9293        std::string message = player->getName() + " entered the game";
    9394        COUT(0) << message << std::endl;
    94         network::Host::Broadcast(message);
     95        Host::Broadcast(message);
    9596    }
    9697
    9798    void Gametype::playerLeft(PlayerInfo* player)
    9899    {
    99         std::set<PlayerInfo*>::iterator it = this->players_.find(player);
     100        std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.find(player);
    100101        if (it != this->players_.end())
    101102        {
     
    104105            std::string message = player->getName() + " left the game";
    105106            COUT(0) << message << std::endl;
    106             network::Host::Broadcast(message);
     107            Host::Broadcast(message);
    107108        }
    108109    }
     
    124125                std::string message = player->getOldName() + " changed name to " + player->getName();
    125126                COUT(0) << message << std::endl;
    126                 network::Host::Broadcast(message);
     127                Host::Broadcast(message);
    127128            }
    128129        }
     
    165166    }
    166167
    167     void Gametype::assignDefaultPawnsIfNeeded() const
    168     {
    169         for (std::set<PlayerInfo*>::const_iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    170         {
    171             if (!(*it)->getControllableEntity() && (!(*it)->isReadyToSpawn() || !this->bStarted_))
    172             {
    173                 SpawnPoint* spawn = this->getBestSpawnPoint(*it);
     168    void Gametype::assignDefaultPawnsIfNeeded()
     169    {
     170        for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     171        {
     172            if (!it->first->getControllableEntity() && (!it->first->isReadyToSpawn() || !this->bStarted_))
     173            {
     174                SpawnPoint* spawn = this->getBestSpawnPoint(it->first);
    174175                if (spawn)
    175176                {
     
    177178                    ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn);
    178179                    spawn->spawn(entity);
    179                     (*it)->startControl(entity);
     180                    it->first->startControl(entity);
     181                    it->second = PlayerState::Dead;
    180182                }
    181183                else
     
    210212                {
    211213                    bool allplayersready = true;
    212                     for (std::set<PlayerInfo*>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     214                    for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    213215                    {
    214                         if (!(*it)->isReadyToSpawn())
     216                        if (!it->first->isReadyToSpawn())
    215217                            allplayersready = false;
    216218                    }
     
    227229    void Gametype::spawnPlayersIfRequested()
    228230    {
    229         for (std::set<PlayerInfo*>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    230             if ((*it)->isReadyToSpawn() || this->bForceSpawn_)
    231                 this->spawnPlayer(*it);
     231        for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     232            if (it->first->isReadyToSpawn() || this->bForceSpawn_)
     233                this->spawnPlayer(it->first);
    232234    }
    233235
    234236    void Gametype::spawnDeadPlayersIfRequested()
    235237    {
    236         for (std::set<PlayerInfo*>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    237             if (!(*it)->getControllableEntity())
    238                 if ((*it)->isReadyToSpawn() || this->bForceSpawn_)
    239                     this->spawnPlayer(*it);
     238        for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     239            if (it->second == PlayerState::Dead)
     240                if (it->first->isReadyToSpawn() || this->bForceSpawn_)
     241                    this->spawnPlayer(it->first);
    240242    }
    241243
     
    246248        {
    247249            player->startControl(spawnpoint->spawn());
     250            this->players_[player] = PlayerState::Alive;
    248251        }
    249252        else
  • code/trunk/src/orxonox/objects/gametypes/Gametype.h

    r2087 r2171  
    4141namespace orxonox
    4242{
     43    namespace PlayerState
     44    {
     45        enum Enum
     46        {
     47            Uninitialized,
     48            Joined,
     49            Alive,
     50            Dead
     51        };
     52    }
     53
    4354    class _OrxonoxExport Gametype : public BaseObject, public Tickable
    4455    {
     
    7081            virtual void pawnPostSpawn(Pawn* pawn);
    7182
    72             inline const std::set<PlayerInfo*>& getPlayers() const
     83            inline const std::map<PlayerInfo*, PlayerState::Enum>& getPlayers() const
    7384                { return this->players_; }
    7485
     
    8798            void removePlayer(PlayerInfo* player);
    8899
    89             void assignDefaultPawnsIfNeeded() const;
     100            void assignDefaultPawnsIfNeeded();
    90101            void checkStart();
    91102            void spawnPlayer(PlayerInfo* player);
     
    102113            bool bStartCountdownRunning_;
    103114
    104             std::set<PlayerInfo*> players_;
     115            std::map<PlayerInfo*, PlayerState::Enum> players_;
    105116            std::set<SpawnPoint*> spawnpoints_;
    106117            SubclassIdentifier<ControllableEntity> defaultControllableEntity_;
  • code/trunk/src/orxonox/objects/infos/CMakeLists.txt

    r2131 r2171  
    11SET( SRC_FILES
    22  Info.cc
    3   Level.cc
    43  PlayerInfo.cc
    54  HumanPlayer.cc
  • code/trunk/src/orxonox/objects/infos/HumanPlayer.cc

    r2087 r2171  
    4646        RegisterObject(HumanPlayer);
    4747
    48         this->server_ready_ = Core::isMaster();
    49         this->client_ready_ = false;
     48        this->server_initialized_ = Core::isMaster();
     49        this->client_initialized_ = false;
    5050
    5151        this->bHumanPlayer_ = true;
     
    6767    void HumanPlayer::registerVariables()
    6868    {
    69         REGISTERSTRING(this->synchronize_nick_, network::direction::toserver, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));
     69        REGISTERSTRING(this->synchronize_nick_, direction::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));
    7070
    71         REGISTERDATA(this->clientID_,     network::direction::toclient, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
    72         REGISTERDATA(this->server_ready_, network::direction::toclient, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_ready));
    73         REGISTERDATA(this->client_ready_, network::direction::toserver, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_ready));
     71        REGISTERDATA(this->clientID_,     direction::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
     72        REGISTERDATA(this->server_initialized_, direction::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_initialized));
     73        REGISTERDATA(this->client_initialized_, direction::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_initialized));
    7474    }
    7575
     
    9292    void HumanPlayer::networkcallback_clientIDchanged()
    9393    {
    94         if (this->clientID_ == network::Host::getPlayerID())
     94        if (this->clientID_ == Host::getPlayerID())
    9595        {
    9696            this->bLocalPlayer_ = true;
    9797            this->synchronize_nick_ = this->nick_;
    98             this->client_ready_ = true;
     98            this->client_initialized_ = true;
    9999
    100100            if (!Core::isMaster())
    101                 this->setObjectMode(network::direction::bidirectional);
     101                this->setObjectMode(direction::bidirectional);
    102102            else
    103103                this->setName(this->nick_);
     
    107107    }
    108108
    109     void HumanPlayer::networkcallback_server_ready()
     109    void HumanPlayer::networkcallback_server_initialized()
    110110    {
    111         this->client_ready_ = true;
     111        this->client_initialized_ = true;
    112112    }
    113113
    114     void HumanPlayer::networkcallback_client_ready()
     114    void HumanPlayer::networkcallback_client_initialized()
    115115    {
    116116        if (this->getGametype())
     
    118118    }
    119119
    120     bool HumanPlayer::isReady() const
     120    bool HumanPlayer::isInitialized() const
    121121    {
    122         return (this->server_ready_ && this->client_ready_);
     122        return (this->server_initialized_ && this->client_initialized_);
    123123    }
    124124
    125125    float HumanPlayer::getPing() const
    126126    {
    127         return network::ClientInformation::findClient(this->getClientID())->getRTT();
     127        return ClientInformation::findClient(this->getClientID())->getRTT();
    128128    }
    129129
    130130    float HumanPlayer::getPacketLossRatio() const
    131131    {
    132         return network::ClientInformation::findClient(this->getClientID())->getPacketLoss();
     132        return ClientInformation::findClient(this->getClientID())->getPacketLoss();
    133133    }
    134134
  • code/trunk/src/orxonox/objects/infos/HumanPlayer.h

    r2087 r2171  
    4747            void setConfigValues();
    4848
    49             bool isReady() const;
     49            bool isInitialized() const;
    5050            float getPing() const;
    5151            float getPacketLossRatio() const;
     
    5757            void networkcallback_changednick();
    5858            void networkcallback_clientIDchanged();
    59             void networkcallback_server_ready();
    60             void networkcallback_client_ready();
     59            void networkcallback_server_initialized();
     60            void networkcallback_client_initialized();
    6161
    6262            std::string nick_;
    6363            std::string synchronize_nick_;
    64             bool server_ready_;
    65             bool client_ready_;
     64            bool server_initialized_;
     65            bool client_initialized_;
    6666    };
    6767}
  • code/trunk/src/orxonox/objects/infos/Info.cc

    r2087 r2171  
    3434namespace orxonox
    3535{
    36     Info::Info(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
     36    Info::Info(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
    3737    {
    3838        RegisterObject(Info);
  • code/trunk/src/orxonox/objects/infos/Info.h

    r2087 r2171  
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport Info : public BaseObject, public network::Synchronisable
     39    class _OrxonoxExport Info : public BaseObject, public Synchronisable
    4040    {
    4141        public:
  • code/trunk/src/orxonox/objects/infos/PlayerInfo.cc

    r2087 r2171  
    4242        RegisterObject(PlayerInfo);
    4343
    44         this->clientID_ = network::CLIENTID_UNKNOWN;
     44        this->clientID_ = CLIENTID_UNKNOWN;
    4545        this->bHumanPlayer_ = false;
    4646        this->bLocalPlayer_ = false;
     
    4848        this->controller_ = 0;
    4949        this->controllableEntity_ = 0;
    50         this->controllableEntityID_ = network::CLIENTID_UNKNOWN;
     50        this->controllableEntityID_ = CLIENTID_UNKNOWN;
    5151
    5252        this->registerVariables();
     
    5555    PlayerInfo::~PlayerInfo()
    5656    {
    57         if (this->isInitialized())
     57        if (this->BaseObject::isInitialized())
    5858        {
    5959            this->stopControl(this->controllableEntity_);
     
    6969    void PlayerInfo::registerVariables()
    7070    {
    71         REGISTERSTRING(this->name_,                 network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));
    72         REGISTERDATA  (this->controllableEntityID_, network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));
    73         REGISTERDATA  (this->bReadyToSpawn_,        network::direction::toserver);
     71        REGISTERSTRING(this->name_,                 direction::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));
     72        REGISTERDATA  (this->controllableEntityID_, direction::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));
     73        REGISTERDATA  (this->bReadyToSpawn_,        direction::toserver);
    7474    }
    7575
    7676    void PlayerInfo::changedName()
    7777    {
    78         if (this->isReady() && this->getGametype())
     78        if (this->isInitialized() && this->getGametype())
    7979            this->getGametype()->playerChangedName(this);
    8080    }
     
    8282    void PlayerInfo::changedGametype()
    8383    {
    84         if (this->isReady())
     84        if (this->isInitialized())
    8585        {
    8686            if (this->getOldGametype())
     
    126126        else
    127127        {
    128             this->controllableEntityID_ = network::OBJECTID_UNKNOWN;
     128            this->controllableEntityID_ = OBJECTID_UNKNOWN;
    129129        }
    130130
     
    138138        {
    139139            this->controllableEntity_ = 0;
    140             this->controllableEntityID_ = network::OBJECTID_UNKNOWN;
     140            this->controllableEntityID_ = OBJECTID_UNKNOWN;
    141141
    142142            if (this->controller_)
     
    150150    void PlayerInfo::networkcallback_changedcontrollableentityID()
    151151    {
    152         if (this->controllableEntityID_ != network::OBJECTID_UNKNOWN)
     152        if (this->controllableEntityID_ != OBJECTID_UNKNOWN)
    153153        {
    154154            Synchronisable* temp = Synchronisable::getSynchronisable(this->controllableEntityID_);
  • code/trunk/src/orxonox/objects/infos/PlayerInfo.h

    r2087 r2171  
    5555            inline unsigned int getClientID() const
    5656                { return this->clientID_; }
    57             inline bool isReadyToSpawn() const
    58                 { return this->bReadyToSpawn_; }
    5957
    60             virtual bool isReady() const = 0;
     58            virtual bool isInitialized() const = 0;
    6159            virtual float getPing() const = 0;
    6260            virtual float getPacketLossRatio() const = 0;
     
    6462            inline void setReadyToSpawn(bool bReady)
    6563                { this->bReadyToSpawn_ = bReady; }
     64            inline bool isReadyToSpawn() const
     65                { return this->bReadyToSpawn_; }
    6666
    6767            void startControl(ControllableEntity* entity);
  • code/trunk/src/orxonox/objects/weaponSystem/WeaponSystem.h

  • code/trunk/src/orxonox/objects/worldentities/Backlight.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/trunk/src/orxonox/objects/worldentities/Backlight.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/trunk/src/orxonox/objects/worldentities/Billboard.cc

    r2087 r2171  
    6464    void Billboard::registerVariables()
    6565    {
    66         REGISTERSTRING(this->material_, network::direction::toclient, new network::NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
    67         REGISTERDATA  (this->colour_,   network::direction::toclient, new network::NetworkCallback<Billboard>(this, &Billboard::changedColour));
     66        REGISTERSTRING(this->material_, direction::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
     67        REGISTERDATA  (this->colour_,   direction::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
    6868    }
    6969
     
    7575            {
    7676                this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
    77                 this->getNode()->attachObject(this->billboard_.getBillboardSet());
     77                if (this->billboard_.getBillboardSet())
     78                    this->getNode()->attachObject(this->billboard_.getBillboardSet());
    7879                this->billboard_.setVisible(this->isVisible());
    7980            }
     
    9091            {
    9192                this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
    92                 this->getNode()->attachObject(this->billboard_.getBillboardSet());
     93                if (this->billboard_.getBillboardSet())
     94                    this->getNode()->attachObject(this->billboard_.getBillboardSet());
    9395                this->billboard_.setVisible(this->isVisible());
    9496            }
  • code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.cc

    r2087 r2171  
    6868    void BlinkingBillboard::registerVariables()
    6969    {
    70 //        REGISTERDATA(this->amplitude_, network::direction::toclient);
    71 //        REGISTERDATA(this->frequency_, network::direction::toclient);
    72 //        REGISTERDATA(this->phase_,     network::direction::toclient);
     70//        REGISTERDATA(this->amplitude_, direction::toclient);
     71//        REGISTERDATA(this->frequency_, direction::toclient);
     72//        REGISTERDATA(this->phase_,     direction::toclient);
    7373    }
    7474
  • code/trunk/src/orxonox/objects/worldentities/Camera.cc

    r2103 r2171  
    3838#include <OgreViewport.h>
    3939
     40#include "util/Exception.h"
    4041#include "core/CoreIncludes.h"
    4142#include "core/ConfigValueIncludes.h"
     
    5152        RegisterObject(Camera);
    5253
    53         assert(this->getScene());
    54         assert(this->getScene()->getSceneManager());
     54        if (!this->getScene() || !this->getScene()->getSceneManager())
     55            ThrowException(AbortLoading, "Can't create Camera, no scene or no scene manager given.");
    5556
    5657        this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
  • code/trunk/src/orxonox/objects/worldentities/Camera.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc

    r2087 r2171  
    5252        this->client_overwrite_ = 0;
    5353        this->player_ = 0;
    54         this->playerID_ = network::OBJECTID_UNKNOWN;
     54        this->playerID_ = OBJECTID_UNKNOWN;
    5555        this->hud_ = 0;
    5656        this->camera_ = 0;
     
    165165                this->client_overwrite_ = this->server_overwrite_;
    166166COUT(0) << "CE: bidirectional synchronization" << std::endl;
    167                 this->setObjectMode(network::direction::bidirectional);
     167                this->setObjectMode(direction::bidirectional);
    168168            }
    169169        }
     
    176176
    177177        this->player_ = 0;
    178         this->playerID_ = network::OBJECTID_UNKNOWN;
     178        this->playerID_ = OBJECTID_UNKNOWN;
    179179        this->bControlled_ = false;
    180         this->setObjectMode(network::direction::toclient);
     180        this->setObjectMode(direction::toclient);
    181181
    182182        if (this->bDestroyWhenPlayerLeft_)
     
    187187    {
    188188        // just do this in case the entity wasn't yet synchronized when the corresponding PlayerInfo got our objectID
    189         if (this->playerID_ != network::OBJECTID_UNKNOWN)
    190         {
    191             this->player_ = dynamic_cast<PlayerInfo*>(network::Synchronisable::getSynchronisable(this->playerID_));
     189        if (this->playerID_ != OBJECTID_UNKNOWN)
     190        {
     191            this->player_ = dynamic_cast<PlayerInfo*>(Synchronisable::getSynchronisable(this->playerID_));
    192192            if (this->player_ && (this->player_->getControllableEntity() != this))
    193193                this->player_->startControl(this);
     
    248248    void ControllableEntity::registerVariables()
    249249    {
    250         REGISTERSTRING(this->cameraPositionTemplate_, network::direction::toclient);
    251 
    252         REGISTERDATA(this->server_position_,    network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
    253         REGISTERDATA(this->server_velocity_,    network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerVelocity));
    254         REGISTERDATA(this->server_orientation_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
    255 
    256         REGISTERDATA(this->server_overwrite_,   network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
    257         REGISTERDATA(this->client_overwrite_,   network::direction::toserver);
    258 
    259         REGISTERDATA(this->client_position_,    network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
    260         REGISTERDATA(this->client_velocity_,    network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientVelocity));
    261         REGISTERDATA(this->client_orientation_, network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
    262 
    263 
    264         REGISTERDATA(this->playerID_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID));
     250        REGISTERSTRING(this->cameraPositionTemplate_, direction::toclient);
     251
     252        REGISTERDATA(this->client_overwrite_,   direction::toserver);
     253       
     254        REGISTERDATA(this->server_position_,    direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
     255        REGISTERDATA(this->server_velocity_,    direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerVelocity));
     256        REGISTERDATA(this->server_orientation_, direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
     257        REGISTERDATA(this->server_overwrite_,   direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
     258
     259        REGISTERDATA(this->client_position_,    direction::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
     260        REGISTERDATA(this->client_velocity_,    direction::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientVelocity));
     261        REGISTERDATA(this->client_orientation_, direction::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
     262
     263
     264        REGISTERDATA(this->playerID_, direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID));
    265265    }
    266266
  • code/trunk/src/orxonox/objects/worldentities/Light.cc

    r2087 r2171  
    7979    void Light::registerVariables()
    8080    {
    81         REGISTERDATA(this->type_, network::direction::toclient, new network::NetworkCallback<Light>(this, &Light::changedType));
    82         REGISTERDATA(this->light_->getDiffuseColour(), network::direction::toclient);
    83         REGISTERDATA(this->light_->getSpecularColour(), network::direction::toclient);
    84         REGISTERDATA(this->light_->getDirection(), network::direction::toclient);
     81        REGISTERDATA(this->type_, direction::toclient, new NetworkCallback<Light>(this, &Light::changedType));
     82        REGISTERDATA(this->light_->getDiffuseColour(), direction::toclient);
     83        REGISTERDATA(this->light_->getSpecularColour(), direction::toclient);
     84        REGISTERDATA(this->light_->getDirection(), direction::toclient);
    8585    }
    8686
  • code/trunk/src/orxonox/objects/worldentities/Model.cc

    r2087 r2171  
    6161    void Model::registerVariables()
    6262    {
    63         REGISTERSTRING(this->meshSrc_,    network::direction::toclient, new network::NetworkCallback<Model>(this, &Model::changedMesh));
    64         REGISTERDATA(this->bCastShadows_, network::direction::toclient, new network::NetworkCallback<Model>(this, &Model::changedShadows));
     63        REGISTERSTRING(this->meshSrc_,    direction::toclient, new NetworkCallback<Model>(this, &Model::changedMesh));
     64        REGISTERDATA(this->bCastShadows_, direction::toclient, new NetworkCallback<Model>(this, &Model::changedShadows));
    6565    }
    6666
  • code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc

    r2087 r2171  
    8484    void MovableEntity::registerVariables()
    8585    {
    86         REGISTERDATA(this->velocity_.x, network::direction::toclient);
    87         REGISTERDATA(this->velocity_.y, network::direction::toclient);
    88         REGISTERDATA(this->velocity_.z, network::direction::toclient);
     86        REGISTERDATA(this->velocity_.x, direction::toclient);
     87        REGISTERDATA(this->velocity_.y, direction::toclient);
     88        REGISTERDATA(this->velocity_.z, direction::toclient);
    8989
    90         REGISTERDATA(this->rotationAxis_.x, network::direction::toclient);
    91         REGISTERDATA(this->rotationAxis_.y, network::direction::toclient);
    92         REGISTERDATA(this->rotationAxis_.z, network::direction::toclient);
     90        REGISTERDATA(this->rotationAxis_.x, direction::toclient);
     91        REGISTERDATA(this->rotationAxis_.y, direction::toclient);
     92        REGISTERDATA(this->rotationAxis_.z, direction::toclient);
    9393
    94         REGISTERDATA(this->rotationRate_, network::direction::toclient);
     94        REGISTERDATA(this->rotationRate_, direction::toclient);
    9595
    96         REGISTERDATA(this->overwrite_position_,    network::direction::toclient, new network::NetworkCallback<MovableEntity>(this, &MovableEntity::overwritePosition));
    97         REGISTERDATA(this->overwrite_orientation_, network::direction::toclient, new network::NetworkCallback<MovableEntity>(this, &MovableEntity::overwriteOrientation));
     96        REGISTERDATA(this->overwrite_position_,    direction::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwritePosition));
     97        REGISTERDATA(this->overwrite_orientation_, direction::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwriteOrientation));
    9898    }
    9999
  • code/trunk/src/orxonox/objects/worldentities/MovableEntity.h

    r2087 r2171  
    3838namespace orxonox
    3939{
    40     class _OrxonoxExport MovableEntity : public WorldEntity, public Tickable, public network::ClientConnectionListener
     40    class _OrxonoxExport MovableEntity : public WorldEntity, public Tickable, public ClientConnectionListener
    4141    {
    4242        public:
  • code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc

    r2087 r2171  
    2828
    2929/**
    30 * @file ParticleInterface.cc
     30* @file
    3131* @brief class to control praticle effects
    3232*/
     
    3737
    3838#include "tools/ParticleInterface.h"
     39#include "util/Exception.h"
    3940#include "core/CoreIncludes.h"
    4041#include "core/XMLPort.h"
     
    4950        RegisterObject(ParticleEmitter);
    5051
    51         assert(this->getScene());
    52         assert(this->getScene()->getSceneManager());
     52        if (!this->getScene() || !this->getScene()->getSceneManager())
     53            ThrowException(AbortLoading, "Can't create Camera, no scene or no scene manager given.");
    5354
    5455        this->particles_ = 0;
     
    7475    void ParticleEmitter::registerVariables()
    7576    {
    76         REGISTERSTRING(this->source_, network::direction::toclient, new network::NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));
    77         REGISTERDATA  (this->LOD_,    network::direction::toclient, new network::NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));
     77        REGISTERSTRING(this->source_, direction::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));
     78        REGISTERDATA  (this->LOD_,    direction::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));
    7879    }
    7980
  • code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/trunk/src/orxonox/objects/worldentities/PositionableEntity.cc

    r2087 r2171  
    4848    void PositionableEntity::registerVariables()
    4949    {
    50         REGISTERDATA(this->getPosition().x, network::direction::toclient);
    51         REGISTERDATA(this->getPosition().y, network::direction::toclient);
    52         REGISTERDATA(this->getPosition().z, network::direction::toclient);
     50        REGISTERDATA(this->getPosition().x, direction::toclient);
     51        REGISTERDATA(this->getPosition().y, direction::toclient);
     52        REGISTERDATA(this->getPosition().z, direction::toclient);
    5353
    54         REGISTERDATA(this->getOrientation().w, network::direction::toclient);
    55         REGISTERDATA(this->getOrientation().x, network::direction::toclient);
    56         REGISTERDATA(this->getOrientation().y, network::direction::toclient);
    57         REGISTERDATA(this->getOrientation().z, network::direction::toclient);
     54        REGISTERDATA(this->getOrientation().w, direction::toclient);
     55        REGISTERDATA(this->getOrientation().x, direction::toclient);
     56        REGISTERDATA(this->getOrientation().y, direction::toclient);
     57        REGISTERDATA(this->getOrientation().z, direction::toclient);
    5858    }
    5959}
  • code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc

    r2087 r2171  
    3636#include "core/XMLPort.h"
    3737#include "util/Convert.h"
     38#include "util/Exception.h"
    3839
    3940#include "objects/Scene.h"
     
    4849    const Vector3 WorldEntity::UP    = Vector3::UNIT_Y;
    4950
    50     WorldEntity::WorldEntity(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
     51    WorldEntity::WorldEntity(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
    5152    {
    5253        RegisterObject(WorldEntity);
    5354
    54         assert(this->getScene());
    55         assert(this->getScene()->getRootSceneNode());
     55        if (!this->getScene() || !this->getScene()->getRootSceneNode())
     56            ThrowException(AbortLoading, "Can't create WorldEntity, no scene or no root-scenenode given.");
    5657
    5758        this->node_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
    5859
    5960        this->parent_ = 0;
    60         this->parentID_ = (unsigned int)-1;
     61        this->parentID_ = OBJECTID_UNKNOWN;
    6162
    6263        this->node_->setPosition(Vector3::ZERO);
     
    9596    void WorldEntity::registerVariables()
    9697    {
    97         REGISTERDATA(this->bActive_,  network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity));
    98         REGISTERDATA(this->bVisible_, network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility));
     98        REGISTERDATA(this->bActive_,  direction::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity));
     99        REGISTERDATA(this->bVisible_, direction::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility));
    99100
    100         REGISTERDATA(this->getScale3D().x, network::direction::toclient);
    101         REGISTERDATA(this->getScale3D().y, network::direction::toclient);
    102         REGISTERDATA(this->getScale3D().z, network::direction::toclient);
     101        REGISTERDATA(this->getScale3D().x, direction::toclient);
     102        REGISTERDATA(this->getScale3D().y, direction::toclient);
     103        REGISTERDATA(this->getScale3D().z, direction::toclient);
    103104
    104         REGISTERDATA(this->parentID_, network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::updateParent));
     105        REGISTERDATA(this->parentID_, direction::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::updateParent));
    105106    }
    106107
    107108    void WorldEntity::updateParent()
    108109    {
    109         WorldEntity* parent = dynamic_cast<WorldEntity*>(Synchronisable::getSynchronisable(this->parentID_));
    110         if (parent)
    111             this->attachToParent(parent);
     110        if (this->parentID_ != OBJECTID_UNKNOWN)
     111        {
     112            WorldEntity* parent = dynamic_cast<WorldEntity*>(Synchronisable::getSynchronisable(this->parentID_));
     113            if (parent)
     114                this->attachToParent(parent);
     115        }
    112116    }
    113117
     
    134138        this->children_.erase(object);
    135139        object->parent_ = 0;
    136         object->parentID_ = (unsigned int)-1;
     140        object->parentID_ = OBJECTID_UNKNOWN;
    137141
    138142//        this->getScene()->getRootSceneNode()->addChild(object->node_);
  • code/trunk/src/orxonox/objects/worldentities/WorldEntity.h

    r2087 r2171  
    4242namespace orxonox
    4343{
    44     class _OrxonoxExport WorldEntity : public BaseObject, public network::Synchronisable
     44    class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable
    4545    {
    4646        public:
  • code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2106 r2171  
    8080    void Pawn::registerVariables()
    8181    {
    82         REGISTERDATA(this->bAlive_, network::direction::toclient);
    83         REGISTERDATA(this->health_, network::direction::toclient);
     82        REGISTERDATA(this->bAlive_, direction::toclient);
     83        REGISTERDATA(this->health_, direction::toclient);
    8484    }
    8585
  • code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc

    r2087 r2171  
    8282    void SpaceShip::registerVariables()
    8383    {
    84         REGISTERDATA(this->maxSpeed_,                network::direction::toclient);
    85         REGISTERDATA(this->maxSecondarySpeed_,       network::direction::toclient);
    86         REGISTERDATA(this->maxRotation_,             network::direction::toclient);
    87         REGISTERDATA(this->translationAcceleration_, network::direction::toclient);
    88         REGISTERDATA(this->rotationAcceleration_,    network::direction::toclient);
    89         REGISTERDATA(this->translationDamping_,      network::direction::toclient);
     84        REGISTERDATA(this->maxSpeed_,                direction::toclient);
     85        REGISTERDATA(this->maxSecondarySpeed_,       direction::toclient);
     86        REGISTERDATA(this->maxRotation_,             direction::toclient);
     87        REGISTERDATA(this->translationAcceleration_, direction::toclient);
     88        REGISTERDATA(this->rotationAcceleration_,    direction::toclient);
     89        REGISTERDATA(this->translationDamping_,      direction::toclient);
    9090    }
    9191
  • code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc

    r2087 r2171  
    6262        this->greetingFlare_ = new BillboardSet();
    6363        this->greetingFlare_->setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 1.0, 0.8), Vector3(0, 20, 0), 1);
    64         this->getNode()->attachObject(this->greetingFlare_->getBillboardSet());
     64        if (this->greetingFlare_->getBillboardSet())
     65            this->getNode()->attachObject(this->greetingFlare_->getBillboardSet());
    6566        this->greetingFlare_->setVisible(false);
    6667        this->bGreetingFlareVisible_ = false;
     
    7677            if (this->greetingFlare_)
    7778            {
    78                 this->getNode()->detachObject(this->greetingFlare_->getBillboardSet());
     79                if (this->greetingFlare_->getBillboardSet())
     80                    this->getNode()->detachObject(this->greetingFlare_->getBillboardSet());
    7981                delete this->greetingFlare_;
    8082            }
     
    8486    void Spectator::registerVariables()
    8587    {
    86         REGISTERDATA(this->bGreetingFlareVisible_, network::direction::toclient, new network::NetworkCallback<Spectator>(this, &Spectator::changedFlareVisibility));
    87         REGISTERDATA(this->bGreeting_,             network::direction::toserver, new network::NetworkCallback<Spectator>(this, &Spectator::changedGreeting));
    88         REGISTERDATA(this->hudmode_,               network::direction::toclient);
     88        REGISTERDATA(this->bGreetingFlareVisible_, direction::toclient, new NetworkCallback<Spectator>(this, &Spectator::changedFlareVisibility));
     89        REGISTERDATA(this->bGreeting_,             direction::toserver, new NetworkCallback<Spectator>(this, &Spectator::changedGreeting));
     90        REGISTERDATA(this->hudmode_,               direction::toclient);
    8991    }
    9092
     
    129131        ControllableEntity::setPlayer(player);
    130132
    131 //        this->setObjectMode(network::direction::toclient);
     133//        this->setObjectMode(direction::toclient);
    132134    }
    133135
     
    203205                {
    204206                    if (this->getGametype()->isStartCountdownRunning())
    205                         this->hudmode_ = 2 + 10*ceil(this->getGametype()->getStartCountdown());
     207                        this->hudmode_ = 2 + 10*(int)ceil(this->getGametype()->getStartCountdown());
    206208                    else
    207209                        this->hudmode_ = 3;
  • code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc

    r2103 r2171  
    6969      this->debugBillboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
    7070      this->debugBillboard_.setVisible(false);
    71     }
    72 
    73     this->getNode()->attachObject(this->debugBillboard_.getBillboardSet());
     71
     72      if (this->debugBillboard_.getBillboardSet())
     73        this->getNode()->attachObject(this->debugBillboard_.getBillboardSet());
     74    }
     75
    7476    this->setObjectMode(0x0);
    7577  }
     
    310312  void Trigger::setBillboardColour(const ColourValue& colour)
    311313  {
    312     this->debugBillboard_.getBillboardSet()->getBillboard(0)->setColour(colour);
     314    this->debugBillboard_.setColour(colour);
    313315  }
    314316
  • code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc

    r2087 r2171  
    4040#include <OgrePanelOverlayElement.h>
    4141#include "util/Convert.h"
     42#include "util/Exception.h"
    4243#include "util/String.h"
     44#include "core/Core.h"
    4345#include "core/CoreIncludes.h"
    4446#include "core/XMLPort.h"
     
    5860    {
    5961        RegisterObject(OrxonoxOverlay);
     62
     63        if (!Core::showsGraphics())
     64            ThrowException(NoGraphics, "Can't create OrxonoxOverlay, graphics engine not initialized");
    6065
    6166        // add this overlay to the static map of OrxonoxOverlays
  • code/trunk/src/orxonox/overlays/hud/ChatOverlay.cc

    r2087 r2171  
    3838#include "network/ClientInformation.h"
    3939
    40 #include "LevelManager.h"
     40#include "PlayerManager.h"
    4141#include "objects/infos/PlayerInfo.h"
    4242#include "overlays/console/InGameConsole.h"
     
    7272        std::string text;
    7373
    74         if (senderID != network::CLIENTID_UNKNOWN)
     74        if (senderID != CLIENTID_UNKNOWN)
    7575        {
    7676            std::string name = "unknown";
    7777
    78             PlayerInfo* player = LevelManager::getInstance().getClient(senderID);
     78            PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
    7979            if (player)
    8080                name = player->getName();
  • code/trunk/src/orxonox/overlays/hud/ChatOverlay.h

    r2087 r2171  
    3939namespace orxonox
    4040{
    41     class _OrxonoxExport ChatOverlay : public OverlayText, public network::ChatListener
     41    class _OrxonoxExport ChatOverlay : public OverlayText, public ChatListener
    4242    {
    4343        public:
  • code/trunk/src/orxonox/tools/BillboardSet.cc

    r2087 r2171  
    3636#include <OgreBillboard.h>
    3737
     38#include "core/Core.h"
    3839#include "util/Convert.h"
    3940#include "util/String.h"
     
    7071        try
    7172        {
    72             this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count);
    73             this->billboardSet_->createBillboard(position);
    74             this->billboardSet_->setMaterialName(file);
     73            if (Core::showsGraphics())
     74            {
     75                this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count);
     76                this->billboardSet_->createBillboard(position);
     77                this->billboardSet_->setMaterialName(file);
     78            }
    7579        }
    7680        catch (...)
    7781        {
    7882            COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl;
     83            this->billboardSet_ = 0;
    7984        }
    8085
     
    8994        try
    9095        {
    91             this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count);
    92             this->billboardSet_->createBillboard(position, colour);
    93             this->billboardSet_->setMaterialName(file);
     96            if (Core::showsGraphics())
     97            {
     98                this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count);
     99                this->billboardSet_->createBillboard(position, colour);
     100                this->billboardSet_->setMaterialName(file);
     101            }
    94102        }
    95103        catch (...)
    96104        {
    97105            COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl;
     106            this->billboardSet_ = 0;
    98107        }
    99108
     
    105114        if (this->billboardSet_ && this->scenemanager_)
    106115            this->scenemanager_->destroyBillboardSet(this->billboardSet_);
     116        this->billboardSet_ = 0;
    107117    }
    108118
  • code/trunk/src/orxonox/tools/Mesh.cc

    r2087 r2171  
    7373            {
    7474                COUT(1) << "Error: Couln't load mesh \"" << meshsource << "\"" << std::endl;
     75                this->entity_ = 0;
    7576            }
    7677        }
  • code/trunk/src/orxonox/tools/ParticleInterface.cc

    r2087 r2171  
    2828
    2929/**
    30 * @file ParticleInterface.cc
     30* @file
    3131* @brief class to control praticle effects
    3232*/
     
    4141
    4242#include "GraphicsEngine.h"
     43#include "core/Core.h"
    4344#include "core/CoreIncludes.h"
    4445#include "util/Convert.h"
     
    5758        this->scenemanager_ = scenemanager;
    5859        this->sceneNode_ = 0;
     60        this->particleSystem_ = 0;
    5961
    6062        this->bEnabled_ = true;
     
    6264        this->bAllowedByLOD_ = true;
    6365
    64         this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName);
    65         this->particleSystem_->setSpeedFactor(1.0f);
    66         //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor());
     66        if (Core::showsGraphics())
     67        {
     68            try
     69            {
     70                this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName);
     71                this->particleSystem_->setSpeedFactor(1.0f);
     72//                this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor());
     73            }
     74            catch (...)
     75            {
     76                COUT(1) << "Error: Couln't load particle system \"" << templateName << "\"" << std::endl;
     77                this->particleSystem_ = 0;
     78            }
     79        }
    6780
    6881        this->setDetailLevel((unsigned int)detaillevel);
     
    7184    ParticleInterface::~ParticleInterface()
    7285    {
    73         this->particleSystem_->removeAllEmitters();
    74         this->detachFromSceneNode();
    75         this->scenemanager_->destroyParticleSystem(particleSystem_);
     86        if (this->particleSystem_)
     87        {
     88            this->particleSystem_->removeAllEmitters();
     89            this->detachFromSceneNode();
     90            this->scenemanager_->destroyParticleSystem(this->particleSystem_);
     91        }
    7692    }
    7793
     
    8197            this->detachFromSceneNode();
    8298
    83         this->sceneNode_ = sceneNode;
    84         this->sceneNode_->attachObject(this->particleSystem_);
     99        if (this->particleSystem_)
     100        {
     101            this->sceneNode_ = sceneNode;
     102            this->sceneNode_->attachObject(this->particleSystem_);
     103        }
    85104    }
    86105
     
    89108        if (this->sceneNode_)
    90109        {
    91             this->sceneNode_->detachObject(this->particleSystem_);
     110            if (this->particleSystem_)
     111                this->sceneNode_->detachObject(this->particleSystem_);
    92112            this->sceneNode_ = 0;
    93113        }
     
    96116    Ogre::ParticleEmitter* ParticleInterface::createNewEmitter()
    97117    {
    98         if (this->particleSystem_->getNumEmitters() > 0)
     118        if (this->particleSystem_ && this->particleSystem_->getNumEmitters() > 0)
    99119        {
    100120            Ogre::ParticleEmitter* newemitter = this->particleSystem_->addEmitter(this->particleSystem_->getEmitter(0)->getType());
     
    107127    Ogre::ParticleEmitter* ParticleInterface::getEmitter(unsigned int emitterNr) const
    108128    {
    109         if (emitterNr < this->particleSystem_->getNumEmitters())
     129        if (this->particleSystem_ && (emitterNr < this->particleSystem_->getNumEmitters()))
    110130            return this->particleSystem_->getEmitter(emitterNr);
    111131        else
     
    114134    void ParticleInterface::removeEmitter(unsigned int emitterNr)
    115135    {
    116         if (emitterNr < this->particleSystem_->getNumEmitters())
     136        if (this->particleSystem_ && (emitterNr < this->particleSystem_->getNumEmitters()))
    117137            this->particleSystem_->removeEmitter(emitterNr);
    118138    }
    119139    void ParticleInterface::removeAllEmitters()
    120140    {
    121         this->particleSystem_->removeAllEmitters();
     141        if (this->particleSystem_)
     142            this->particleSystem_->removeAllEmitters();
    122143    }
    123144    unsigned int ParticleInterface::getNumEmitters() const
    124145    {
    125         return this->particleSystem_->getNumEmitters();
     146        if (this->particleSystem_)
     147            return this->particleSystem_->getNumEmitters();
     148        else
     149            return 0;
    126150    }
    127151
    128152    Ogre::ParticleAffector* ParticleInterface::addAffector(const std::string& name)
    129153    {
    130         return this->particleSystem_->addAffector(name);
     154        if (this->particleSystem_)
     155            return this->particleSystem_->addAffector(name);
     156        else
     157            return 0;
    131158    }
    132159    Ogre::ParticleAffector* ParticleInterface::getAffector(unsigned int affectorNr) const
    133160    {
    134         if (affectorNr < this->particleSystem_->getNumAffectors())
     161        if (this->particleSystem_ && (affectorNr < this->particleSystem_->getNumAffectors()))
    135162            return this->particleSystem_->getAffector(affectorNr);
    136163        else
     
    139166    void ParticleInterface::removeAffector(unsigned int affectorNr)
    140167    {
    141         if (affectorNr < this->particleSystem_->getNumAffectors())
     168        if (this->particleSystem_ && (affectorNr < this->particleSystem_->getNumAffectors()))
    142169            this->particleSystem_->removeAffector(affectorNr);
    143170    }
    144171    void ParticleInterface::removeAllAffectors()
    145172    {
    146         this->particleSystem_->removeAllAffectors();
     173        if (this->particleSystem_)
     174            this->particleSystem_->removeAllAffectors();
    147175    }
    148176    unsigned int ParticleInterface::getNumAffectors() const
    149177    {
    150         return this->particleSystem_->getNumAffectors();
     178        if (this->particleSystem_)
     179            return this->particleSystem_->getNumAffectors();
     180        else
     181            return 0;
    151182    }
    152183
     
    155186        this->bEnabled_ = enable;
    156187
    157         for (unsigned int i = 0; i < this->particleSystem_->getNumEmitters(); i++)
    158             this->particleSystem_->getEmitter(i)->setEnabled(this->bEnabled_ && this->bAllowedByLOD_);
     188        if (this->particleSystem_)
     189            for (unsigned int i = 0; i < this->particleSystem_->getNumEmitters(); i++)
     190                this->particleSystem_->getEmitter(i)->setEnabled(this->bEnabled_ && this->bAllowedByLOD_);
    159191    }
    160192
     
    163195        this->bVisible_ = visible;
    164196
    165         this->particleSystem_->setVisible(this->bVisible_ && this->bAllowedByLOD_);
     197        if (this->particleSystem_)
     198            this->particleSystem_->setVisible(this->bVisible_ && this->bAllowedByLOD_);
    166199    }
    167200
     
    169202    {
    170203        this->detaillevel_ = level;
    171         this->detailLevelChanged(GraphicsEngine::getInstance().getDetailLevelParticle());
     204        if (GraphicsEngine::getInstancePtr())
     205            this->detailLevelChanged(GraphicsEngine::getInstance().getDetailLevelParticle());
    172206    }
    173207
     
    190224    void ParticleInterface::setSpeedFactor(float factor)
    191225    {
    192         //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor);
    193         this->particleSystem_->setSpeedFactor(1.0f * factor);
     226        if (this->particleSystem_)
     227        {
     228//            this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor);
     229            this->particleSystem_->setSpeedFactor(1.0f * factor);
     230        }
    194231    }
    195232    float ParticleInterface::getSpeedFactor() const
    196233    {
    197         //return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor());
    198         return (this->particleSystem_->getSpeedFactor() / 1.0f);
     234        if (this->particleSystem_)
     235        {
     236//            return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor());
     237            return (this->particleSystem_->getSpeedFactor() / 1.0f);
     238        }
     239        else
     240            return 1.0f;
    199241    }
    200242
    201243    bool ParticleInterface::getKeepParticlesInLocalSpace() const
    202244    {
    203         return this->particleSystem_->getKeepParticlesInLocalSpace();
     245        if (this->particleSystem_)
     246            return this->particleSystem_->getKeepParticlesInLocalSpace();
     247        else
     248            return false;
    204249    }
    205250    void ParticleInterface::setKeepParticlesInLocalSpace(bool keep)
    206251    {
    207         this->particleSystem_->setKeepParticlesInLocalSpace(keep);
     252        if (this->particleSystem_)
     253            this->particleSystem_->setKeepParticlesInLocalSpace(keep);
    208254    }
    209255}
  • code/trunk/src/orxonox/tools/Timer.h

    r2087 r2171  
    2828
    2929/*!
    30     @file Timer.h
     30    @file
    3131    @brief Definition and Implementation of the Timer class.
    3232
Note: See TracChangeset for help on using the changeset viewer.