Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2015, 9:12:21 PM (9 years ago)
Author:
landauf
Message:

merged branch core7 back to trunk

Location:
code/trunk
Files:
4 deleted
74 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

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

    r10216 r10624  
    2929  Main.cc
    3030  MoodManager.cc
    31   PawnManager.cc
    3231  PlayerManager.cc
    33   ShipPartManager.cc
    3432  Radar.cc
    3533#  Test.cc
  • code/trunk/src/orxonox/CameraManager.cc

    r9667 r10624  
    3535#include <OgreCompositorManager.h>
    3636
    37 #include "util/ScopedSingletonManager.h"
    3837#include "core/GameMode.h"
    3938#include "core/GraphicsManager.h"
    4039#include "core/object/ObjectList.h"
     40#include "core/singleton/ScopedSingletonIncludes.h"
    4141#include "tools/Shader.h"
    4242#include "graphics/Camera.h"
     
    4444namespace orxonox
    4545{
    46     ManageScopedSingleton(CameraManager, ScopeID::Graphics, false);
     46    ManageScopedSingleton(CameraManager, ScopeID::GRAPHICS, false);
    4747
    4848    CameraManager::CameraManager()
  • code/trunk/src/orxonox/Level.cc

    r9667 r10624  
    3535#include "core/XMLFile.h"
    3636#include "core/XMLPort.h"
     37#include "core/module/PluginReference.h"
    3738
    3839#include "infos/PlayerInfo.h"
     
    4950        RegisterObject(Level);
    5051
     52        this->setLevel(WeakPtr<Level>(this)); // store a weak-pointer to itself (a strong-pointer would create a recursive dependency)
    5153
    5254        this->registerVariables();
     
    6365
    6466            if (this->xmlfile_)
    65                 Loader::unload(this->xmlfile_);
     67                Loader::getInstance().unload(this->xmlfile_);
     68
     69            this->unloadPlugins();
    6670        }
    6771    }
     
    7175        SUPER(Level, XMLPort, xmlelement, mode);
    7276
     77        XMLPortParam(Level, "plugins",  setPluginsString,  getPluginsString,  xmlelement, mode);
    7378        XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype");
    7479
     
    95100        this->xmlfile_ = new XMLFile(mask, this->xmlfilename_);
    96101
    97         Loader::open(this->xmlfile_);
     102        Loader::getInstance().load(this->xmlfile_);
    98103    }
    99104
     
    105110            Template::getTemplate(*it)->applyOn(this);
    106111        }
     112    }
     113
     114    void Level::setPluginsString(const std::string& pluginsString)
     115    {
     116        // unload old plugins
     117        this->unloadPlugins();
     118
     119        // load new plugins
     120        this->pluginsString_ = pluginsString;
     121        SubString tokens(pluginsString, ",");
     122        for (size_t i = 0; i < tokens.size(); ++i)
     123            this->plugins_.push_back(new PluginReference(tokens[i]));
     124    }
     125
     126    void Level::unloadPlugins()
     127    {
     128        // use destroyLater() - this ensures that plugins are not unloaded too early.
     129        // Note: When a level gets unloaded, the Level object is usually the last object that gets destroyed. This is because all other
     130        //       objects inside a level have a StrongPtr (in BaseObject) that references the Level object. This means that the Level
     131        //       object is only destroyed, when all StrongPtrs that pointed to it were destroyed. But at the time when the last StrongPtr
     132        //       is destroyed, the other object is not yet fully destroyed because the StrongPtr is destroyed in ~BaseObject (and this
     133        //       means that e.g. ~Identifiable was not yet called for this object). This means that technically there are still other
     134        //       objects alive when ~Level is called. This is the reason why we cannot directly destroy() the Plugins - instead we need
     135        //       to call destroyLater() to ensure that no instances from this plugin exist anymore.
     136        for (std::list<PluginReference*>::iterator it = this->plugins_.begin(); it != this->plugins_.end(); ++it)
     137            (*it)->destroyLater();
     138        this->plugins_.clear();
    107139    }
    108140
     
    121153
    122154        Gametype* rootgametype = orxonox_cast<Gametype*>(identifier->fabricate(this));
    123         this->setGametype(rootgametype);
    124 
    125         for (std::list<BaseObject*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
    126             (*it)->setGametype(rootgametype);
     155
     156        // store a weak-pointer to the gametype to avoid a circular dependency between this level and the gametype (which has a strong-reference on this level)
     157        this->setGametype(WeakPtr<Gametype>(rootgametype));
     158
     159        rootgametype->init(); // call init() AFTER the gametype was set
    127160
    128161        if (LevelManager::exists())
     
    134167    {
    135168        this->objects_.push_back(object);
    136         object->setGametype(this->getGametype());
    137         object->setLevel(this);
    138169    }
    139170
     
    170201    {
    171202        orxout(internal_info) << "player entered level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << endl;
    172         player->setGametype(this->getGametype());
     203        player->switchGametype(this->getGametype());
    173204    }
    174205
     
    176207    {
    177208        orxout(internal_info) << "player left level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << endl;
    178         player->setGametype(0);
     209        player->switchGametype(0);
    179210    }
    180211}
  • code/trunk/src/orxonox/Level.h

    r9667 r10624  
    6565//            MeshLodInformation* getLodInfo(unsigned int index) const;
    6666
     67            void setPluginsString(const std::string& pluginsString);
     68            inline const std::string& getPluginsString() const
     69                { return this->pluginsString_; }
     70
     71            void unloadPlugins();
     72
    6773            void setGametypeString(const std::string& gametype);
    6874            inline const std::string& getGametypeString() const
     
    7076
    7177            void networkcallback_applyXMLFile();
     78
     79            std::string                    pluginsString_;
     80            std::list<PluginReference*>    plugins_;
    7281
    7382            std::string                    gametype_;
  • code/trunk/src/orxonox/LevelManager.cc

    r10258 r10624  
    3636#include <map>
    3737
    38 #include "util/ScopedSingletonManager.h"
    39 #include "core/config/CommandLineParser.h"
     38#include "core/singleton/ScopedSingletonIncludes.h"
     39#include "core/commandline/CommandLineIncludes.h"
    4040#include "core/config/ConfigValueIncludes.h"
    4141#include "core/CoreIncludes.h"
     
    5151    SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)");
    5252
    53     ManageScopedSingleton(LevelManager, ScopeID::Root, false);
     53    ManageScopedSingleton(LevelManager, ScopeID::ROOT, false);
     54
     55    RegisterAbstractClass(LevelManager).inheritsFrom<Configurable>();
    5456
    5557    /**
     
    274276                // Load the LevelInfo object from the level file.
    275277                XMLFile file = XMLFile(*it);
    276                 Loader::load(&file, mask, false, true);
     278                Loader::getInstance().load(&file, mask, false, true);
    277279
    278280                // Find the LevelInfo object we've just loaded (if there was one)
     
    282284
    283285                // We don't need the loaded stuff anymore
    284                 Loader::unload(&file);
     286                Loader::getInstance().unload(&file);
    285287
    286288                if(info == NULL)
  • code/trunk/src/orxonox/Main.cc

    r9667 r10624  
    3636#include "Main.h"
    3737
    38 #include "core/config/CommandLineParser.h"
     38#include "core/commandline/CommandLineIncludes.h"
    3939#include "core/Game.h"
    4040#include "core/LuaState.h"
  • code/trunk/src/orxonox/MoodManager.cc

    r9667 r10624  
    2929#include "MoodManager.h"
    3030
    31 #include "util/ScopedSingletonManager.h"
     31#include "core/singleton/ScopedSingletonIncludes.h"
    3232#include "core/config/ConfigValueIncludes.h"
    3333#include "core/CoreIncludes.h"
     
    3636namespace orxonox
    3737{
    38     ManageScopedSingleton(MoodManager, ScopeID::Root, false);
     38    ManageScopedSingleton(MoodManager, ScopeID::ROOT, false);
    3939
    4040    // Note: I'm (Kevin Young) not entirely sure whether that's good code style:
    4141    const std::string MoodManager::defaultMood_ = "default";
     42
     43    RegisterAbstractClass(MoodListener).inheritsFrom<OrxonoxInterface>();
     44    RegisterAbstractClass(MoodManager).inheritsFrom<Configurable>();
    4245
    4346    MoodManager::MoodManager()
  • code/trunk/src/orxonox/OrxonoxPrereqs.h

    r10281 r10624  
    7373    class LevelInfoItem;
    7474    class LevelManager;
    75     class PawnManager;
    7675    class PlayerManager;
    7776    class Radar;
  • code/trunk/src/orxonox/PlayerManager.cc

    r9667 r10624  
    3131#include "core/CoreIncludes.h"
    3232#include "core/GameMode.h"
    33 #include "util/ScopedSingletonManager.h"
     33#include "core/singleton/ScopedSingletonIncludes.h"
    3434
    3535#include "Level.h"
     
    3939namespace orxonox
    4040{
    41     ManageScopedSingleton(PlayerManager, ScopeID::Root, false);
     41    ManageScopedSingleton(PlayerManager, ScopeID::ROOT, false);
     42
     43    RegisterAbstractClass(PlayerManager).inheritsFrom<ClientConnectionListener>();
    4244
    4345    PlayerManager::PlayerManager()
  • code/trunk/src/orxonox/Radar.cc

    r9667 r10624  
    3737
    3838//#include "util/Math.h"
     39#include "core/CoreIncludes.h"
    3940#include "core/object/ObjectList.h"
    4041#include "core/command/ConsoleCommand.h"
     
    4546namespace orxonox
    4647{
     48    RegisterAbstractClass(Radar).inheritsFrom<Tickable>();
    4749
    4850    Radar::Radar()
  • code/trunk/src/orxonox/Scene.cc

    r10316 r10624  
    4444#include "core/GUIManager.h"
    4545#include "core/XMLPort.h"
    46 #include "core/command/ConsoleCommand.h"
     46#include "core/command/ConsoleCommandIncludes.h"
    4747#include "tools/BulletConversions.h"
    4848#include "tools/BulletDebugDrawer.h"
     
    6262        RegisterObject(Scene);
    6363
    64         this->setScene(SmartPtr<Scene>(this, false), OBJECTID_UNKNOWN);
     64        this->setScene(WeakPtr<Scene>(this), this->getObjectID()); // store a weak-pointer to itself (a strong-pointer would create a recursive dependency)
     65
    6566        this->bShadows_ = true;
    6667        this->bDebugDrawPhysics_ = false;
    6768        this->debugDrawer_ = NULL;
    6869        this->soundReferenceDistance_ = 20.0;
     70        this->bIsUpdatingPhysics_ = false;
    6971
    7072        if (GameMode::showsGraphics())
     
    141143        registerVariable(this->bHasPhysics_,        VariableDirection::ToClient, new NetworkCallback<Scene>(this, &Scene::networkcallback_hasPhysics));
    142144        registerVariable(this->bShadows_,           VariableDirection::ToClient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyShadows));
    143         registerVariable(this->getLevel(),          VariableDirection::ToClient, new NetworkCallback<Scene>(this, &Scene::changedLevel));
    144145    }
    145146
     
    266267            // Note: 60 means that Bullet will do physics correctly down to 1 frames per seconds.
    267268            //       Under that mark, the simulation will "loose time" and get unusable.
    268             physicalWorld_->stepSimulation(dt, 60);
     269            this->bIsUpdatingPhysics_ = true;
     270            this->physicalWorld_->stepSimulation(dt, 60);
     271            this->bIsUpdatingPhysics_ = false;
    269272
    270273            if (this->bDebugDrawPhysics_)
    271                 physicalWorld_->debugDrawWorld();
     274                this->physicalWorld_->debugDrawWorld();
    272275        }
    273276    }
     
    313316    {
    314317        this->objects_.push_back(object);
    315         object->setScene(this, this->getObjectID());
    316318    }
    317319
     
    363365    {
    364366        // get the WorldEntity pointers
    365         SmartPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
    366         SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
     367        StrongPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
     368        StrongPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
    367369
    368370        // get the CollisionShape pointers
  • code/trunk/src/orxonox/Scene.h

    r10196 r10624  
    110110
    111111        public:
    112             inline bool hasPhysics()
     112            inline bool hasPhysics() const
    113113                { return this->physicalWorld_ != 0; }
    114114            void setPhysicalWorld(bool wantsPhysics);
     
    128128            void addPhysicalObject(WorldEntity* object);
    129129            void removePhysicalObject(WorldEntity* object);
     130
     131            inline bool isUpdatingPhysics() const
     132                { return this->bIsUpdatingPhysics_; }
    130133
    131134            void setDebugDrawPhysics(bool bDraw, bool bFill, float fillAlpha);
     
    163166            BulletDebugDrawer*                   debugDrawer_;
    164167            bool                                 bDebugDrawPhysics_;
     168            bool                                 bIsUpdatingPhysics_;
    165169    };
    166170}
  • code/trunk/src/orxonox/Test.cc

    r9667 r10624  
    2929#include "core/CoreIncludes.h"
    3030#include "core/config/ConfigValueIncludes.h"
    31 #include "core/command/ConsoleCommand.h"
    32 #include "network/NetworkFunction.h"
     31#include "core/command/ConsoleCommandIncludes.h"
     32#include "network/NetworkFunctionIncludes.h"
    3333#include "Test.h"
    3434#include "util/MultiType.h"
     
    105105  void Test::call(unsigned int clientID)
    106106    {
    107         callStaticNetworkFunction( &Test::printV1, clientID );
    108         callStaticNetworkFunction( &Test::printV1, clientID );
     107        callStaticNetworkFunction(&Test::printV1, clientID );
     108        callStaticNetworkFunction(&Test::printV1, clientID );
    109109    }
    110110
    111111    void Test::call2(unsigned int clientID, std::string s1, std::string s2, std::string s3, std::string s4)
    112112    {
    113         callMemberNetworkFunction( Test, printBlaBla, this->getObjectID(), clientID, s1, s2, s3, s4, s4 );
     113        callMemberNetworkFunction( &Test::printBlaBla, this->getObjectID(), clientID, s1, s2, s3, s4, s4 );
    114114    }
    115115
     
    130130    //     if(!Core::isMaster())
    131131    //       call2(0, "bal", "a", "n", "ce");
    132     //       callMemberNetworkFunction( Test, checkU1, this->getObjectID(), 0 );
     132    //       callMemberNetworkFunction( &Test::checkU1, this->getObjectID(), 0 );
    133133    }
    134134
  • code/trunk/src/orxonox/chat/ChatHistory.cc

    r9667 r10624  
    2828
    2929#include "ChatHistory.h"
    30 #include "util/ScopedSingletonManager.h"
     30#include "core/singleton/ScopedSingletonIncludes.h"
     31#include "core/ConfigurablePaths.h"
    3132
    3233#ifndef CHATTEST
     
    3435{
    3536  /* singleton */
    36   ManageScopedSingleton( ChatHistory, ScopeID::Root, false );
     37  ManageScopedSingleton( ChatHistory, ScopeID::ROOT, false );
     38
     39  RegisterAbstractClass(ChatHistory).inheritsFrom<ChatListener>();
     40
    3741#endif
    3842
     
    118122     */
    119123#ifndef CHATTEST
    120     this->hist_logfile.open( (PathConfig::getInstance().getLogPathString() +
     124    this->hist_logfile.open( (ConfigurablePaths::getLogPathString() +
    121125      "chatlog.log").c_str(),
    122126      std::fstream::out | std::fstream::app );
  • code/trunk/src/orxonox/chat/ChatHistory.h

    r8858 r10624  
    4141#include "util/Singleton.h"
    4242#include "core/BaseObject.h"
    43 #include "core/PathConfig.h"
    4443#include "chat/ChatListener.h"
    4544#include "infos/PlayerInfo.h"
  • code/trunk/src/orxonox/chat/ChatInputHandler.cc

    r9675 r10624  
    4747#endif
    4848
    49 #include "util/ScopedSingletonManager.h"
     49#include "core/singleton/ScopedSingletonIncludes.h"
    5050#include "core/CoreIncludes.h"
    5151#include "core/GUIManager.h"
    52 #include "core/command/ConsoleCommand.h"
     52#include "core/command/ConsoleCommandIncludes.h"
    5353#include "core/input/InputBuffer.h"
    5454#include "core/input/InputManager.h"
     
    6262{
    6363  /* singleton */
    64   ManageScopedSingleton( ChatInputHandler, ScopeID::Graphics, false );
     64  ManageScopedSingleton( ChatInputHandler, ScopeID::GRAPHICS, false );
    6565
    6666  /* add commands to console */
    6767  SetConsoleCommand( "startchat", &ChatInputHandler::activate_static );
    6868  SetConsoleCommand( "startchat_small", &ChatInputHandler::activate_small_static );
     69
     70  RegisterAbstractClass(ChatInputHandler).inheritsFrom<ChatListener>();
    6971
    7072  /* constructor */
  • code/trunk/src/orxonox/chat/ChatManager.cc

    r9667 r10624  
    3030#include "ChatListener.h"
    3131
    32 #include "util/ScopedSingletonManager.h"
    3332#include "core/CoreIncludes.h"
    34 #include "core/command/ConsoleCommand.h"
     33#include "core/singleton/ScopedSingletonIncludes.h"
     34#include "core/command/ConsoleCommandIncludes.h"
    3535#include "network/Host.h"
    3636
     
    4040namespace orxonox
    4141{
    42     ManageScopedSingleton(ChatManager, ScopeID::Root, false);
     42    ManageScopedSingleton(ChatManager, ScopeID::ROOT, false);
    4343
    4444    SetConsoleCommand("chat", &ChatManager::chat).defaultValue(1, NETWORK_PEER_ID_BROADCAST);
     45
     46    RegisterAbstractClass(ChatManager).inheritsFrom<NetworkChatListener>();
    4547
    4648    ChatManager::ChatManager()
     
    113115    // ChatListener                                                         //
    114116    //////////////////////////////////////////////////////////////////////////
    115     RegisterAbstractClass(ChatListener).inheritsFrom(Class(Listable));
     117    RegisterAbstractClass(ChatListener).inheritsFrom<Listable>();
    116118
    117119    ChatListener::ChatListener()
  • code/trunk/src/orxonox/collisionshapes/CollisionShape.cc

    r10216 r10624  
    4141#include "CompoundCollisionShape.h"
    4242#include "WorldEntityCollisionShape.h"
     43#include "Scene.h"
    4344
    4445namespace orxonox
    4546{
    46     RegisterAbstractClass(CollisionShape).inheritsFrom(Class(BaseObject)).inheritsFrom(Class(Synchronisable));
     47    RegisterAbstractClass(CollisionShape).inheritsFrom<BaseObject>().inheritsFrom<Synchronisable>();
    4748
    4849    /**
     
    7475    {
    7576        // Detach from parent CompoundCollisionShape.
    76         if (this->isInitialized() && this->parent_)
    77             this->parent_->detach(this);
     77        if (this->isInitialized())
     78        {
     79            if (this->getScene() && this->getScene()->isUpdatingPhysics())
     80                orxout(internal_error) << "Don't destroy collision shapes while the physics is updated! This will lead to crashes. Try to use destroyLater() instead" << endl;
     81
     82            if (this->parent_)
     83                this->parent_->detach(this);
     84
     85            if (this->collisionShape_)
     86                delete this->collisionShape_;
     87        }
    7888    }
    7989
  • code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc

    r9667 r10624  
    7171                it->first->notifyDetached();
    7272                it->first->destroy();
     73                if (this->collisionShape_ == it->second)
     74                    this->collisionShape_ = NULL; // don't destroy it twice
    7375            }
    7476
    7577            delete this->compoundShape_;
     78            if (this->collisionShape_ == this->compoundShape_)
     79                this->collisionShape_ = NULL; // don't destroy it twice
    7680        }
    7781    }
  • code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc

    r9667 r10624  
    3737namespace orxonox
    3838{
     39    RegisterClass(WorldEntityCollisionShape);
     40
    3941    WorldEntityCollisionShape::WorldEntityCollisionShape(Context* context) : CompoundCollisionShape(context)
    4042    {
     
    4446        // suppress synchronisation
    4547        this->setSyncMode(ObjectDirection::None);
    46     }
    47 
    48     WorldEntityCollisionShape::~WorldEntityCollisionShape()
    49     {
    50         // Called always by WE destructor
    5148    }
    5249
  • code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.h

    r9667 r10624  
    3939        public:
    4040            WorldEntityCollisionShape(Context* context);
    41             virtual ~WorldEntityCollisionShape();
    4241
    4342            inline void setWorldEntityOwner(WorldEntity* worldEntityOwner)
  • code/trunk/src/orxonox/controllers/ArtificialController.cc

    r10294 r10624  
    3030#include "core/CoreIncludes.h"
    3131#include "core/XMLPort.h"
    32 #include "core/command/ConsoleCommand.h"
     32#include "core/command/ConsoleCommandIncludes.h"
    3333#include "worldentities/pawns/Pawn.h"
    3434#include "worldentities/pawns/SpaceShip.h"
  • code/trunk/src/orxonox/controllers/FormationController.cc

    r10622 r10624  
    3333
    3434#include "core/XMLPort.h"
    35 #include "core/command/ConsoleCommand.h"
     35#include "core/command/ConsoleCommandIncludes.h"
    3636
    3737#include "worldentities/ControllableEntity.h"
  • code/trunk/src/orxonox/controllers/HumanController.cc

    r9979 r10624  
    3030
    3131#include "core/CoreIncludes.h"
    32 #include "core/command/ConsoleCommand.h"
     32#include "core/command/ConsoleCommandIncludes.h"
    3333#include "worldentities/ControllableEntity.h"
    3434#include "worldentities/pawns/Pawn.h"
     
    5959    SetConsoleCommand("HumanController", __CC_suicide_name,        &HumanController::suicide       ).addShortcut();
    6060    SetConsoleCommand("HumanController", "toggleGodMode",          &HumanController::toggleGodMode ).addShortcut();
    61     SetConsoleCommand("HumanController", "addBots",                &HumanController::addBots       ).addShortcut().defaultValues(1);
    62     SetConsoleCommand("HumanController", "killBots",               &HumanController::killBots      ).addShortcut().defaultValues(0);
    6361    SetConsoleCommand("HumanController", "cycleNavigationFocus",   &HumanController::cycleNavigationFocus).addShortcut();
    6462    SetConsoleCommand("HumanController", "releaseNavigationFocus", &HumanController::releaseNavigationFocus).addShortcut();
     
    318316    }
    319317
    320     void HumanController::addBots(unsigned int amount)
    321     {
    322         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_ && HumanController::localController_s->controllableEntity_->getGametype())
    323             HumanController::localController_s->controllableEntity_->getGametype()->addBots(amount);
    324     }
    325 
    326     void HumanController::killBots(unsigned int amount)
    327     {
    328         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_ && HumanController::localController_s->controllableEntity_->getGametype())
    329             HumanController::localController_s->controllableEntity_->getGametype()->killBots(amount);
    330     }
    331 
    332318    Pawn* HumanController::getLocalControllerEntityAsPawn()
    333319    {
  • code/trunk/src/orxonox/controllers/HumanController.h

    r9979 r10624  
    8383            static void FFChangeMode();
    8484
    85             static void addBots(unsigned int amount);
    86             static void killBots(unsigned int amount = 0);
    87 
    8885            static void pauseControl(); // tolua_export
    8986            static void resumeControl(); // tolua_export
  • code/trunk/src/orxonox/controllers/NewHumanController.cc

    r10216 r10624  
    3737
    3838#include "core/CoreIncludes.h"
    39 #include "core/command/ConsoleCommand.h"
     39#include "core/command/ConsoleCommandIncludes.h"
    4040#include "core/input/KeyBinder.h"
    4141#include "core/input/KeyBinderManager.h"
  • code/trunk/src/orxonox/gamestates/GSClient.cc

    r9667 r10624  
    3030
    3131#include "util/Exception.h"
    32 #include "core/config/CommandLineParser.h"
     32#include "core/commandline/CommandLineIncludes.h"
    3333#include "core/Game.h"
    3434#include "core/GameMode.h"
  • code/trunk/src/orxonox/gamestates/GSLevel.cc

    r10299 r10624  
    4444#include "core/Loader.h"
    4545#include "core/XMLFile.h"
    46 #include "core/command/ConsoleCommand.h"
     46#include "core/command/ConsoleCommandIncludes.h"
    4747
    4848#include "LevelManager.h"
     49#include "Level.h"
    4950#include "PlayerManager.h"
    5051#include "GSRoot.h"
     
    9596        }
    9697
     98        this->prepareObjectTracking();
     99
    97100        if (GameMode::isMaster())
    98101        {
     
    128131        if (GameMode::isMaster())
    129132            this->unloadLevel();
     133        else
     134            this->unloadLevelAsClient();
     135
     136        this->performObjectTracking();
    130137
    131138        if (GameMode::showsGraphics())
     
    161168    }
    162169
    163     void GSLevel::loadLevel()
     170    void GSLevel::prepareObjectTracking()
    164171    {
    165172        for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
    166173            this->staticObjects_.insert(*it);
    167 
    168         // call the loader
    169         startFile_ = new XMLFile(LevelManager::getInstance().getDefaultLevel());
    170         bool loaded = Loader::open(startFile_);
    171 
    172         Core::getInstance().updateLastLevelTimestamp();
    173         if(!loaded)
    174             GSRoot::delayedStartMainMenu();
    175     }
    176 
    177     void GSLevel::unloadLevel()
    178     {
    179         Loader::unload(startFile_);
    180         delete startFile_;
    181 
     174    }
     175
     176    void GSLevel::performObjectTracking()
     177    {
    182178        orxout(internal_info) << "Remaining objects:" << endl;
    183179        unsigned int i = 0;
     
    187183            if (find == this->staticObjects_.end())
    188184            {
    189                 orxout(internal_info) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << "), references: " << it->getReferenceCount() << endl;
     185                orxout(internal_warning) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << "), references: " << it->getReferenceCount() << endl;
    190186            }
    191187        }
     
    194190        else
    195191            orxout(internal_warning) << i << " objects remaining. Try harder!" << endl;
     192    }
     193
     194    void GSLevel::loadLevel()
     195    {
     196        // call the loader
     197        startFile_ = new XMLFile(LevelManager::getInstance().getDefaultLevel());
     198        bool loaded = Loader::getInstance().load(startFile_);
     199
     200        Core::getInstance().getConfig()->updateLastLevelTimestamp();
     201        if(!loaded)
     202            GSRoot::delayedStartMainMenu();
     203    }
     204
     205    void GSLevel::unloadLevel()
     206    {
     207        Loader::getInstance().unload(startFile_);
     208        delete startFile_;
     209    }
     210
     211    /**
     212     * Unloads a level when the game instance is (or was) a client in a multiplayer session.
     213     * In this case, cleanup after unloading a level is done differently because certain things (e.g. the xml file) are unknown.
     214     */
     215    void GSLevel::unloadLevelAsClient()
     216    {
     217        for (ObjectList<Level>::iterator it = ObjectList<Level>::begin(); it != ObjectList<Level>::end(); )
     218        {
     219            StrongPtr<Level> level = *(it++); // StrongPtr prevents that the Level gets destroyed while we loop over it
     220            for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(level); it != ObjectList<BaseObject>::end(level); )
     221                (it++)->destroy();
     222        }
     223
     224        for (ObjectList<Synchronisable>::iterator it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); )
     225        {
     226            if (it->getSyncMode() != 0x0)
     227                (it++)->destroy();
     228            else
     229                ++it;
     230        }
    196231    }
    197232
     
    252287    ///////////////////////////////////////////////////////////////////////////
    253288
    254     RegisterAbstractClass(GSLevelMemento).inheritsFrom(Class(OrxonoxInterface));
     289    RegisterAbstractClass(GSLevelMemento).inheritsFrom<OrxonoxInterface>();
    255290
    256291    GSLevelMemento::GSLevelMemento()
  • code/trunk/src/orxonox/gamestates/GSLevel.h

    r10281 r10624  
    5353        void reloadLevel();
    5454
    55     protected:
     55    private:
    5656        void loadLevel();
    5757        void unloadLevel();
     58        void unloadLevelAsClient();
     59
     60        void prepareObjectTracking();
     61        void performObjectTracking();
    5862
    5963        InputState*              gameInputState_;          //!< input state for normal ingame playing
  • code/trunk/src/orxonox/gamestates/GSMainMenu.cc

    r9944 r10624  
    3636#include "core/GraphicsManager.h"
    3737#include "core/GUIManager.h"
    38 #include "core/command/ConsoleCommand.h"
     38#include "core/command/ConsoleCommandIncludes.h"
    3939#include "core/input/KeyBinderManager.h"
    4040#include "network/Client.h"
     
    6363    SetConsoleCommand(__CC_setMainMenuSoundPath_name, &GSMainMenu::setMainMenuSoundPath).hide();
    6464
     65    RegisterAbstractClass(GSMainMenu).inheritsFrom<Configurable>();
     66
    6567    GSMainMenu::GSMainMenu(const GameStateInfo& info)
    6668        : GameState(info)
  • code/trunk/src/orxonox/gamestates/GSRoot.cc

    r9348 r10624  
    3333#include "core/Game.h"
    3434#include "core/GameMode.h"
    35 #include "core/command/ConsoleCommand.h"
    36 #include "network/NetworkFunction.h"
     35#include "core/command/ConsoleCommandIncludes.h"
     36#include "network/NetworkFunctionIncludes.h"
    3737#include "tools/Timer.h"
    3838#include "tools/interfaces/Tickable.h"
     
    6868    GSRoot::~GSRoot()
    6969    {
    70         NetworkFunctionBase::destroyAllNetworkFunctions();
    7170    }
    7271
  • code/trunk/src/orxonox/gamestates/GSServer.cc

    r10197 r10624  
    3030
    3131#include "util/Output.h"
    32 #include "core/config/CommandLineParser.h"
     32#include "core/commandline/CommandLineIncludes.h"
    3333#include "core/Game.h"
    3434#include "core/GameMode.h"
  • code/trunk/src/orxonox/gametypes/Dynamicmatch.cc

    r9945 r10624  
    310310        if (spaceship)
    311311        {
    312             WeakPtr<SpaceShip>* ptr = new WeakPtr<SpaceShip>(spaceship);
    313             if(ptr == NULL)
    314                 return;
    315312            spaceship->addSpeedFactor(5);
    316313            ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this));
    317             executor->setDefaultValue(0, ptr);
     314            executor->setDefaultValue(0, spaceship);
    318315            new Timer(10, false, executor, true);
    319316        }
     
    593590    }
    594591
    595     void Dynamicmatch::resetSpeedFactor(WeakPtr<SpaceShip>* ptr)// helper function
    596     {
    597         if (*ptr)
    598         {
    599             (*ptr)->addSpeedFactor(1.0f/5.0f);
    600         }
    601         delete ptr;
     592    void Dynamicmatch::resetSpeedFactor(SpaceShip* spaceship)// helper function
     593    {
     594        if (spaceship)
     595        {
     596            spaceship->addSpeedFactor(1.0f/5.0f);
     597        }
    602598    }
    603599
  • code/trunk/src/orxonox/gametypes/Dynamicmatch.h

    r9676 r10624  
    7777            virtual void rewardPig();
    7878            void grantPigBoost(SpaceShip* spaceship); // Grant the piggy a boost.
    79             void resetSpeedFactor(WeakPtr<SpaceShip>* ptr);
     79            void resetSpeedFactor(SpaceShip* spaceship);
    8080            void tick (float dt);// used to end the game
    8181            SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
  • code/trunk/src/orxonox/gametypes/Gametype.cc

    r10281 r10624  
    3434#include "core/config/ConfigValueIncludes.h"
    3535#include "core/GameMode.h"
    36 #include "core/command/ConsoleCommand.h"
     36#include "core/command/ConsoleCommandIncludes.h"
    3737#include "gamestates/GSLevel.h"
    3838
     
    4949namespace orxonox
    5050{
     51    static const std::string __CC_addBots_name  = "addBots";
     52    static const std::string __CC_killBots_name = "killBots";
     53
     54    SetConsoleCommand("Gametype", __CC_addBots_name,  &Gametype::addBots ).addShortcut().defaultValues(1);
     55    SetConsoleCommand("Gametype", __CC_killBots_name, &Gametype::killBots).addShortcut().defaultValues(0);
     56
    5157    RegisterUnloadableClass(Gametype);
    5258
     
    5561        RegisterObject(Gametype);
    5662
     63        this->setGametype(WeakPtr<Gametype>(this)); // store a weak-pointer to itself (a strong-pointer would create a recursive dependency)
     64
    5765        this->gtinfo_ = new GametypeInfo(context);
    5866
    59         this->setGametype(SmartPtr<Gametype>(this, false));
    60 
    6167        this->defaultControllableEntity_ = Class(Spectator);
     68        this->scoreboard_ = 0;
    6269
    6370        this->bAutoStart_ = false;
     
    7481        this->setConfigValues();
    7582
     83        ModifyConsoleCommand(__CC_addBots_name).setObject(this);
     84        ModifyConsoleCommand(__CC_killBots_name).setObject(this);
     85    }
     86
     87    Gametype::~Gametype()
     88    {
     89        if (this->isInitialized())
     90        {
     91            if (this->gtinfo_)
     92                this->gtinfo_->destroy();
     93
     94            ModifyConsoleCommand(__CC_addBots_name).setObject(NULL);
     95            ModifyConsoleCommand(__CC_killBots_name).setObject(NULL);
     96        }
     97    }
     98
     99    /**
     100     * @brief Initializes sub-objects of the Gametype. This must be called after the constructor.
     101     * At this point, the context is expected to have the current gametype. This allows to pass the current gametype to the sub-objects via constructor.
     102     */
     103    void Gametype::init()
     104    {
    76105        // load the corresponding score board
    77106        if (GameMode::showsGraphics() && !this->scoreboardTemplate_.empty())
    78107        {
    79             this->scoreboard_ = new OverlayGroup(context);
     108            this->scoreboard_ = new OverlayGroup(this->getContext());
    80109            this->scoreboard_->addTemplate(this->scoreboardTemplate_);
    81             this->scoreboard_->setGametype(this);
    82         }
    83         else
    84             this->scoreboard_ = 0;
    85 
    86         /* HACK HACK HACK */
    87         this->dedicatedAddBots_ = createConsoleCommand( "dedicatedAddBots", createExecutor( createFunctor(&Gametype::addBots, this) ) );
    88         this->dedicatedKillBots_ = createConsoleCommand( "dedicatedKillBots", createExecutor( createFunctor(&Gametype::killBots, this) ) );
    89         /* HACK HACK HACK */
    90     }
    91 
    92     Gametype::~Gametype()
    93     {
    94         if (this->isInitialized())
    95         {
    96             this->gtinfo_->destroy();
    97             if( this->dedicatedAddBots_ )
    98                 delete this->dedicatedAddBots_;
    99             if( this->dedicatedKillBots_ )
    100                 delete this->dedicatedKillBots_;
    101110        }
    102111    }
     
    406415                    {
    407416                        // If in developer's mode, there is no start countdown.
    408                         if(Core::getInstance().inDevMode())
     417                        if(Core::getInstance().getConfig()->inDevMode())
    409418                            this->start();
    410419                        else
  • code/trunk/src/orxonox/gametypes/Gametype.h

    r10281 r10624  
    7272            virtual ~Gametype();
    7373
     74            virtual void init();
     75
    7476            void setConfigValues();
    7577
     
    176178            virtual void importMementoState(const std::vector<GSLevelMementoState*>& states);
    177179
    178             SmartPtr<GametypeInfo> gtinfo_;
     180            WeakPtr<GametypeInfo> gtinfo_;
    179181
    180182            bool bAutoStart_;
     
    199201            std::string scoreboardTemplate_;
    200202
    201             /* HACK HACK HACK */
    202             ConsoleCommand* dedicatedAddBots_;
    203             ConsoleCommand* dedicatedKillBots_;
    204             /* HACK HACK HACK */
    205203            Timer showMenuTimer_;
    206204    };
  • code/trunk/src/orxonox/gametypes/Mission.cc

    r10258 r10624  
    3333
    3434#include "core/CoreIncludes.h"
    35 #include "core/command/ConsoleCommand.h"
     35#include "core/command/ConsoleCommandIncludes.h"
    3636#include "infos/PlayerInfo.h"
    3737#include "network/Host.h"
  • code/trunk/src/orxonox/infos/GametypeInfo.cc

    r9667 r10624  
    3737#include "core/GameMode.h"
    3838#include "network/Host.h"
    39 #include "network/NetworkFunction.h"
     39#include "network/NetworkFunctionIncludes.h"
    4040#include "util/Convert.h"
    4141
     
    369369                this->changedReadyToSpawn(ready);
    370370            else
    371                 callMemberNetworkFunction(GametypeInfo, changedReadyToSpawn, this->getObjectID(), player->getClientID(), ready);
     371                callMemberNetworkFunction(&GametypeInfo::changedReadyToSpawn, this->getObjectID(), player->getClientID(), ready);
    372372        }
    373373    }
     
    388388                    this->changedSpawned(spawned);
    389389            else
    390                 callMemberNetworkFunction(GametypeInfo, changedSpawned, this->getObjectID(), player->getClientID(), spawned);
     390                callMemberNetworkFunction(&GametypeInfo::changedSpawned, this->getObjectID(), player->getClientID(), spawned);
    391391        }
    392392    }
     
    399399        if (GameMode::isMaster())
    400400        {
    401             callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), NETWORK_PEER_ID_BROADCAST, message);
     401            callMemberNetworkFunction(&GametypeInfo::dispatchAnnounceMessage, this->getObjectID(), NETWORK_PEER_ID_BROADCAST, message);
    402402            this->dispatchAnnounceMessage(message);
    403403        }
     
    411411                this->dispatchAnnounceMessage(message);
    412412            else
    413                 callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), clientID, message);
     413                callMemberNetworkFunction(&GametypeInfo::dispatchAnnounceMessage, this->getObjectID(), clientID, message);
    414414        }
    415415    }
     
    422422                this->dispatchKillMessage(message);
    423423            else
    424                 callMemberNetworkFunction(GametypeInfo, dispatchKillMessage, this->getObjectID(), clientID, message);
     424                callMemberNetworkFunction(&GametypeInfo::dispatchKillMessage, this->getObjectID(), clientID, message);
    425425        }
    426426    }
     
    433433                this->dispatchDeathMessage(message);
    434434            else
    435                 callMemberNetworkFunction(GametypeInfo, dispatchDeathMessage, this->getObjectID(), clientID, message);
     435                callMemberNetworkFunction(&GametypeInfo::dispatchDeathMessage, this->getObjectID(), clientID, message);
    436436        }
    437437    }
     
    444444                this->dispatchStaticMessage(message, colour);
    445445            else
    446                 callMemberNetworkFunction(GametypeInfo, dispatchStaticMessage, this->getObjectID(), clientID, message, colour);
     446                callMemberNetworkFunction(&GametypeInfo::dispatchStaticMessage, this->getObjectID(), clientID, message, colour);
    447447        }
    448448    }
     
    455455                this->dispatchFadingMessage(message);
    456456            else
    457                 callMemberNetworkFunction(GametypeInfo, dispatchFadingMessage, this->getObjectID(), clientID, message);
     457                callMemberNetworkFunction(&GametypeInfo::dispatchFadingMessage, this->getObjectID(), clientID, message);
    458458        }
    459459    }
  • code/trunk/src/orxonox/infos/HumanPlayer.cc

    r9667 r10624  
    160160    }
    161161
    162     void HumanPlayer::changedGametype()
    163     {
    164         PlayerInfo::changedGametype();
     162    void HumanPlayer::switchGametype(Gametype* gametype)
     163    {
     164        PlayerInfo::switchGametype(gametype);
    165165
    166166        if (this->isInitialized() && this->isLocalPlayer())
  • code/trunk/src/orxonox/infos/HumanPlayer.h

    r9667 r10624  
    5151            void setClientID(unsigned int clientID);
    5252
    53             virtual void changedGametype();
     53            virtual void switchGametype(Gametype* gametype);
    5454
    5555            inline void setHumanHUDTemplate(const std::string& name)
  • code/trunk/src/orxonox/infos/PlayerInfo.cc

    r9945 r10624  
    4040namespace orxonox
    4141{
    42     RegisterAbstractClass(PlayerInfo).inheritsFrom(Class(Info));
     42    RegisterAbstractClass(PlayerInfo).inheritsFrom<Info>();
    4343
    4444    PlayerInfo::PlayerInfo(Context* context) : Info(context)
     
    5757        this->gtinfo_ = 0;
    5858        this->gtinfoID_ = OBJECTID_UNKNOWN;
    59         this->updateGametypeInfo();
     59        this->updateGametypeInfo(this->getGametype());
    6060
    6161        this->registerVariables();
     
    9595    }
    9696
    97     void PlayerInfo::changedGametype()
    98     {
    99         this->updateGametypeInfo();
     97    void PlayerInfo::switchGametype(Gametype* gametype)
     98    {
     99        Gametype* oldGametype = this->getGametype();
     100        this->setGametype(StrongPtr<Gametype>(gametype));
     101        Gametype* newGametype = this->getGametype();
     102
     103
     104        this->updateGametypeInfo(newGametype);
    100105
    101106        if (this->isInitialized())
    102107        {
    103             if (this->getOldGametype())
     108            if (oldGametype)
    104109            {
    105                 if (this->getGametype())
    106                     this->getOldGametype()->playerSwitched(this, this->getGametype());
     110                if (newGametype)
     111                    oldGametype->playerSwitched(this, newGametype);
    107112                else
    108                     this->getOldGametype()->playerLeft(this);
     113                    oldGametype->playerLeft(this);
    109114            }
    110115
    111             if (this->getGametype())
     116            if (newGametype)
    112117            {
    113                 if (this->getOldGametype())
    114                     this->getGametype()->playerSwitchedBack(this, this->getOldGametype());
     118                if (oldGametype)
     119                    newGametype->playerSwitchedBack(this, oldGametype);
    115120                else
    116                     this->getGametype()->playerEntered(this);
     121                    newGametype->playerEntered(this);
    117122            }
    118123        }
    119124    }
    120125
    121     void PlayerInfo::updateGametypeInfo()
     126    void PlayerInfo::updateGametypeInfo(Gametype* gametype)
    122127    {
    123128        this->gtinfo_ = 0;
    124129        this->gtinfoID_ = OBJECTID_UNKNOWN;
    125130
    126         if (this->getGametype() && this->getGametype()->getGametypeInfo())
    127         {
    128             this->gtinfo_ = this->getGametype()->getGametypeInfo();
     131        if (gametype && gametype->getGametypeInfo())
     132        {
     133            this->gtinfo_ = gametype->getGametypeInfo();
    129134            this->gtinfoID_ = this->gtinfo_->getObjectID();
    130135        }
     
    186191
    187192        this->controllableEntity_->destroyHud(); // HACK-ish
    188         this->previousControllableEntity_.push_back(WeakPtr<ControllableEntity>(this->controllableEntity_));
     193        this->previousControllableEntity_.push_back(this->controllableEntity_);
    189194        this->controllableEntity_ = entity;
    190195        this->controllableEntityID_ = entity->getObjectID();
  • code/trunk/src/orxonox/infos/PlayerInfo.h

    r9667 r10624  
    4545
    4646            virtual void changedName();
    47             virtual void changedGametype();
     47            virtual void switchGametype(Gametype* gametype);
    4848
    4949            virtual void changedController() {}
     
    9494            void networkcallback_changedcontrollableentityID();
    9595            void networkcallback_changedgtinfoID();
    96             void updateGametypeInfo();
     96            void updateGametypeInfo(Gametype* gametype);
    9797
    9898            bool bReadyToSpawn_;
  • code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc

    r9667 r10624  
    5050    // GametypeMessageListener
    5151    //----------------------------
    52     RegisterAbstractClass(GametypeMessageListener).inheritsFrom(Class(OrxonoxInterface));
     52    RegisterAbstractClass(GametypeMessageListener).inheritsFrom<OrxonoxInterface>();
    5353
    5454    GametypeMessageListener::GametypeMessageListener()
     
    6060    // PlayerTrigger
    6161    //----------------------------
    62     RegisterAbstractClass(PlayerTrigger).inheritsFrom(Class(OrxonoxInterface));
     62    RegisterAbstractClass(PlayerTrigger).inheritsFrom<OrxonoxInterface>();
    6363
    6464    PlayerTrigger::PlayerTrigger()
     
    7272    {
    7373        assert(pawn);
    74         this->pawn_ = WeakPtr<Pawn>(pawn);
     74        this->pawn_ = pawn;
    7575        if (pawn)
    76             this->player_ = WeakPtr<PlayerInfo>(pawn->getPlayer());
     76            this->player_ = pawn->getPlayer();
    7777    }
    7878
     
    8080    // RadarListener
    8181    //----------------------------
    82     RegisterAbstractClass(RadarListener).inheritsFrom(Class(OrxonoxInterface));
     82    RegisterAbstractClass(RadarListener).inheritsFrom<OrxonoxInterface>();
    8383
    8484    RadarListener::RadarListener()
     
    9090    // TeamColourable
    9191    //----------------------------
    92     RegisterAbstractClass(TeamColourable).inheritsFrom(Class(OrxonoxInterface));
     92    RegisterAbstractClass(TeamColourable).inheritsFrom<OrxonoxInterface>();
    9393
    9494    TeamColourable::TeamColourable()
     
    100100    // Rewardable
    101101    //----------------------------
    102     RegisterAbstractClass(Rewardable).inheritsFrom(Class(OrxonoxInterface));
     102    RegisterAbstractClass(Rewardable).inheritsFrom<OrxonoxInterface>();
    103103
    104104    Rewardable::Rewardable()
  • code/trunk/src/orxonox/interfaces/NotificationListener.cc

    r9667 r10624  
    3434#include "core/CoreIncludes.h"
    3535#include "network/Host.h"
    36 #include "network/NetworkFunction.h"
     36#include "network/NetworkFunctionIncludes.h"
    3737#include "util/SubString.h"
    3838
     
    5151    registerStaticNetworkFunction(NotificationListener::sendHelper);
    5252   
     53    RegisterAbstractClass(NotificationListener).inheritsFrom<OrxonoxInterface>();
     54
    5355    NotificationListener::NotificationListener()
    5456    {
     
    8284        else if(GameMode::isServer() && sendMode == notificationSendMode::network && Host::getPlayerID() != clientId)
    8385        {
    84             callStaticNetworkFunction(NotificationListener::sendHelper, clientId, message, sender, isCommand, (unsigned int)messageType);
     86            callStaticNetworkFunction(&NotificationListener::sendHelper, clientId, message, sender, isCommand, (unsigned int)messageType);
    8587        }
    8688        else if(GameMode::isServer() && sendMode == notificationSendMode::broadcast)
    8789        {
    8890            // TODO: Works as intended?
    89             callStaticNetworkFunction(NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, (unsigned int)messageType);
     91            callStaticNetworkFunction(&NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, (unsigned int)messageType);
    9092        }
    9193    }
  • code/trunk/src/orxonox/interfaces/PickupCarrier.cc

    r9667 r10624  
    4141namespace orxonox
    4242{
    43     RegisterAbstractClass(PickupCarrier).inheritsFrom(Class(OrxonoxInterface));
     43    RegisterAbstractClass(PickupCarrier).inheritsFrom<OrxonoxInterface>();
    4444
    4545    /**
  • code/trunk/src/orxonox/interfaces/PickupListener.cc

    r9667 r10624  
    4040namespace orxonox
    4141{
     42    RegisterAbstractClass(PickupListener).inheritsFrom<OrxonoxInterface>();
    4243
    4344    /**
  • code/trunk/src/orxonox/interfaces/Pickupable.cc

    r9667 r10624  
    4646namespace orxonox
    4747{
    48     RegisterAbstractClass(Pickupable).inheritsFrom(Class(OrxonoxInterface)).inheritsFrom(Class(Rewardable));
     48    RegisterAbstractClass(Pickupable).inheritsFrom<OrxonoxInterface>().inheritsFrom<Rewardable>();
    4949
    5050    /**
  • code/trunk/src/orxonox/interfaces/Pickupable.h

    r9667 r10624  
    187187
    188188    //! SUPER functions.
    189     SUPER_FUNCTION(10, Pickupable, changedUsed, false);
    190     SUPER_FUNCTION(11, Pickupable, changedCarrier, false);
    191     SUPER_FUNCTION(12, Pickupable, changedPickedUp, false);
     189    SUPER_FUNCTION(9, Pickupable, changedUsed, false);
     190    SUPER_FUNCTION(10, Pickupable, changedCarrier, false);
     191    SUPER_FUNCTION(11, Pickupable, changedPickedUp, false);
    192192}
    193193
  • code/trunk/src/orxonox/interfaces/PlayerTrigger.h

    r9667 r10624  
    6363        */
    6464        inline Pawn* getTriggeringPawn(void) const
    65             { return this->pawn_.get(); }
     65            { return this->pawn_; }
    6666
    6767        /**
  • code/trunk/src/orxonox/interfaces/RadarViewable.cc

    r9667 r10624  
    3838namespace orxonox
    3939{
    40     RegisterAbstractClass(RadarViewable).inheritsFrom(Class(OrxonoxInterface));
     40    RegisterAbstractClass(RadarViewable).inheritsFrom<OrxonoxInterface>();
    4141
    4242    /**
  • code/trunk/src/orxonox/interfaces/RadarViewable.h

    r9939 r10624  
    3737#include "util/Math.h"
    3838#include "core/class/OrxonoxInterface.h"
    39 #include "core/object/SmartPtr.h"
     39#include "core/object/StrongPtr.h"
    4040
    4141namespace orxonox
     
    163163        //Radar
    164164        const WorldEntity* wePtr_;
    165         SmartPtr<Radar> radar_;
     165        StrongPtr<Radar> radar_;
    166166        float radarObjectCamouflage_;
    167167        Shape radarObjectShape_;
  • code/trunk/src/orxonox/items/ShipPart.cc

    r10262 r10624  
    5050
    5151    ShipPart::ShipPart(Context* context)
    52         : Item(context)
     52        : Item(context), parent_(NULL)
    5353    {
    5454        RegisterObject(ShipPart);
    55         this->setAlive(true);
    56         this->setEventExecution(true);
     55        this->eventExecution_ = true;
    5756        this->healthMem_ = 100;
    5857    }
     
    6059    ShipPart::~ShipPart()
    6160    {
    62 
     61        if (this->parent_)
     62        {
     63            // Remove this ShipPart from the parent.
     64            this->parent_->removeShipPart(this);
     65        }
    6366    }
    6467
     
    8689    void ShipPart::death()
    8790    {
    88         //if (!(this->isAlive()))
    89             //return;
    90 
    9191        this->explode();
    92         this->setAlive(false);
    9392
    9493        if(eventExecution_)
     
    101100        }
    102101
    103         // Remove this ShipPart from the parent.
    104         this->parent_->removeShipPart(this);
    105         delete this;
     102        this->destroyLater();
    106103    }
    107104
     
    203200    {
    204201        this->health_ = health;
    205     }
    206 
    207     void ShipPart::setAlive(bool var)
    208     {
    209         this->alive_ = var;
    210         orxout() << "ShipPart " << this->getName() << " alive_: " << this->alive_ << endl;
    211202    }
    212203
     
    240231        }
    241232        if (this->health_ < 0)
    242             this->alive_ = false;
    243             //this->death();
     233            this->death();
    244234
    245235        // (Ugly) Chatoutput of health, until a GUI for modularspaceships-shipparts is implemented.
  • code/trunk/src/orxonox/items/ShipPart.h

    r10262 r10624  
    7272                { return this->parent_; }
    7373
    74             void setAlive(bool var);
    75             inline bool isAlive()
    76                 { return this->alive_; }
    77 
    7874            inline void setEventExecution(bool var)
    7975                { this->eventExecution_ = var; }
     
    121117            std::vector<PartDestructionEvent*> eventList_;  // The list of all PartDestructionEvent assigned to this ShipPart.
    122118
    123             bool alive_;
    124119            bool eventExecution_;
    125120
  • code/trunk/src/orxonox/overlays/InGameConsole.cc

    r9667 r10624  
    4545#include "util/Math.h"
    4646#include "util/DisplayStringConversions.h"
    47 #include "util/ScopedSingletonManager.h"
    4847#include "util/output/MemoryWriter.h"
    4948#include "util/output/OutputManager.h"
    5049#include "core/CoreIncludes.h"
    5150#include "core/config/ConfigValueIncludes.h"
    52 #include "core/command/ConsoleCommand.h"
     51#include "core/command/ConsoleCommandIncludes.h"
     52#include "core/singleton/ScopedSingletonIncludes.h"
    5353#include "core/GUIManager.h"
    5454#include "core/input/InputManager.h"
     
    6565    SetConsoleCommand("InGameConsole", "closeConsole", &InGameConsole::closeConsole);
    6666
    67     ManageScopedSingleton(InGameConsole, ScopeID::Graphics, false);
     67    ManageScopedSingleton(InGameConsole, ScopeID::GRAPHICS, false);
     68
     69    RegisterAbstractClass(InGameConsole).inheritsFrom<WindowEventListener>().inheritsFrom<UpdateListener>();
    6870
    6971    /**
  • code/trunk/src/orxonox/overlays/InGameConsole.h

    r8858 r10624  
    3939#include "core/WindowEventListener.h"
    4040#include "core/command/Shell.h"
     41#include "core/UpdateListener.h"
    4142
    4243namespace orxonox
    4344{
    44     class _OrxonoxExport InGameConsole : public Singleton<InGameConsole>, public ShellListener, public WindowEventListener
     45    class _OrxonoxExport InGameConsole : public Singleton<InGameConsole>, public ShellListener, public WindowEventListener, public UpdateListener
    4546    {
    4647        friend class Singleton<InGameConsole>;
     
    5354
    5455        void preUpdate(const Clock& time);
     56        void postUpdate(const Clock& time) { /*no action*/ }
    5557
    5658        static void openConsole();
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc

    r9667 r10624  
    4848#include "core/CoreIncludes.h"
    4949#include "core/XMLPort.h"
    50 #include "core/command/ConsoleCommand.h"
     50#include "core/command/ConsoleCommandIncludes.h"
    5151
    5252#include "OverlayGroup.h"
  • code/trunk/src/orxonox/overlays/OverlayGroup.cc

    r9667 r10624  
    3636#include "core/CoreIncludes.h"
    3737#include "core/XMLPort.h"
    38 #include "core/command/ConsoleCommand.h"
     38#include "core/command/ConsoleCommandIncludes.h"
    3939#include "OrxonoxOverlay.h"
     40#include "gametypes/Gametype.h"
    4041
    4142namespace orxonox
     
    6162    OverlayGroup::~OverlayGroup()
    6263    {
    63         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     64        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    6465            (*it)->destroy();
    6566        this->hudElements_.clear();
     
    8586    void OverlayGroup::setScale(const Vector2& scale)
    8687    {
    87         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     88        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    8889            (*it)->scale(scale / this->scale_);
    8990        this->scale_ = scale;
     
    9394    void OverlayGroup::setScroll(const Vector2& scroll)
    9495    {
    95         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     96        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    9697            (*it)->scroll(scroll - this->scroll_);
    9798        this->scroll_ = scroll;
     
    106107    void OverlayGroup::addElement(OrxonoxOverlay* element)
    107108    {
    108         hudElements_.insert(SmartPtr<OrxonoxOverlay>(element));
     109        hudElements_.insert(element);
    109110        element->setOverlayGroup( this );
    110111        if (this->owner_)
     
    122123    bool OverlayGroup::removeElement(OrxonoxOverlay* element)
    123124    {
    124         if(this->hudElements_.erase(SmartPtr<OrxonoxOverlay>(element)) == 0)
     125        if(this->hudElements_.erase(element) == 0)
    125126            return false;
    126127        return true;
     
    132133        if (index < this->hudElements_.size())
    133134        {
    134             std::set< SmartPtr<OrxonoxOverlay> >::const_iterator it = hudElements_.begin();
     135            std::set< StrongPtr<OrxonoxOverlay> >::const_iterator it = hudElements_.begin();
    135136            for (unsigned int i = 0; i != index; ++it, ++i)
    136137                ;
    137             return it->get();
     138            return *it;
    138139        }
    139140        else
     
    146147        SUPER( OverlayGroup, changedVisibility );
    147148
    148         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     149        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    149150            (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed
    150151    }
    151152
    152     //! Changes the gametype of all elements
    153     void OverlayGroup::changedGametype()
    154     {
    155         SUPER( OverlayGroup, changedGametype );
    156 
    157         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    158             (*it)->setGametype(this->getGametype());
    159     }
    160 
    161153    void OverlayGroup::setOwner(BaseObject* owner)
    162154    {
    163155        this->owner_ = owner;
    164156
    165         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     157        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    166158            (*it)->setOwner(owner);
    167159    }
  • code/trunk/src/orxonox/overlays/OverlayGroup.h

    r9667 r10624  
    6565        static void scrollGroup(const std::string& name, const Vector2& scroll);
    6666
    67         inline const std::set< SmartPtr<OrxonoxOverlay> >& getOverlays() const
     67        inline const std::set< StrongPtr<OrxonoxOverlay> >& getOverlays() const
    6868            { return this->hudElements_; }
    6969
    7070        virtual void changedVisibility();
    71         virtual void changedGametype();
    7271
    7372        void setOwner(BaseObject* owner);
     
    9291
    9392    private:
    94         std::set< SmartPtr<OrxonoxOverlay> > hudElements_;    //!< Contains all the OrxonoxOverlays of the this group.
     93        std::set< StrongPtr<OrxonoxOverlay> > hudElements_;    //!< Contains all the OrxonoxOverlays of the this group.
    9594        Vector2 scale_;                            //!< Current scale (independent of the elements).
    9695        Vector2 scroll_;                           //!< Current scrolling offset.
  • code/trunk/src/orxonox/sound/AmbientSound.cc

    r9939 r10624  
    3636namespace orxonox
    3737{
     38    RegisterAbstractClass(AmbientSound).inheritsFrom<BaseSound>().inheritsFrom<MoodListener>();
     39
    3840    AmbientSound::AmbientSound()
    3941        : bPlayOnLoad_(false)
     
    4951        if (GameMode::playsSound())
    5052        {
    51             // Smoothly fade out by keeping a SmartPtr
     53            // Smoothly fade out by keeping a StrongPtr
    5254            SoundManager::getInstance().unregisterAmbientSound(this);
    5355        }
  • code/trunk/src/orxonox/sound/BaseSound.cc

    r9939 r10624  
    4343namespace orxonox
    4444{
    45     RegisterAbstractClass(BaseSound).inheritsFrom(Class(Listable));
     45    RegisterAbstractClass(BaseSound).inheritsFrom<Listable>();
    4646
    4747    BaseSound::BaseSound()
  • code/trunk/src/orxonox/sound/SoundBuffer.h

    r6764 r10624  
    4646        friend class SoundManager;
    4747#if !defined(_MSC_VER) || _MSC_VER >= 1500
    48         // Make sure nobody deletes an instance (using smart pointers)
     48        // Make sure nobody deletes an instance (using strong pointers)
    4949        template <class T>
    5050        friend void boost::checked_delete(T*);
  • code/trunk/src/orxonox/sound/SoundManager.cc

    r9939 r10624  
    3838#include "util/Math.h"
    3939#include "util/Clock.h"
    40 #include "util/ScopedSingletonManager.h"
     40#include "core/singleton/ScopedSingletonIncludes.h"
    4141#include "core/config/ConfigValueIncludes.h"
    4242#include "core/CoreIncludes.h"
     
    5050namespace orxonox
    5151{
    52     ManageScopedSingleton(SoundManager, ScopeID::Graphics, true);
     52    ManageScopedSingleton(SoundManager, ScopeID::GRAPHICS, true);
    5353
    5454    std::string SoundManager::getALErrorString(ALenum code)
     
    6565        }
    6666    }
     67
     68    RegisterAbstractClass(SoundManager).inheritsFrom<Configurable>().inheritsFrom<UpdateListener>();
    6769
    6870    SoundManager::SoundManager()
     
    163165    SoundManager::~SoundManager()
    164166    {
    165         // Erase fade lists because of the smart pointers
     167        // Erase fade lists because of the strong pointers
    166168        this->bDestructorCalled_ = true;
    167169        this->fadeInList_.clear();
     
    417419    }
    418420
    419     void SoundManager::fadeIn(const SmartPtr<AmbientSound>& sound)
     421    void SoundManager::fadeIn(AmbientSound* sound)
    420422    {
    421423        // If we're already fading out --> remove that
    422         for (std::list<SmartPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++)
     424        for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++)
    423425        {
    424426            if (*it == sound)
     
    433435    }
    434436
    435     void SoundManager::fadeOut(const SmartPtr<AmbientSound>& sound)
     437    void SoundManager::fadeOut(AmbientSound* sound)
    436438    {
    437439        // If we're already fading in --> remove that
    438         for (std::list<SmartPtr<AmbientSound> >::iterator it = this->fadeInList_.begin(); it != this->fadeInList_.end(); it++)
     440        for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeInList_.begin(); it != this->fadeInList_.end(); it++)
    439441        {
    440442            if (*it == sound)
     
    459461
    460462        // FADE IN
    461         for (std::list<SmartPtr<AmbientSound> >::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); )
     463        for (std::list<StrongPtr<AmbientSound> >::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); )
    462464        {
    463465            if ((*it)->getVolume() + this->crossFadeStep_*dt > 1.0f)
     
    474476
    475477        // FADE OUT
    476         for (std::list<SmartPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); )
     478        for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); )
    477479        {
    478480            if ((*it)->getVolume() - this->crossFadeStep_*dt < 0.0f)
  • code/trunk/src/orxonox/sound/SoundManager.h

    r9667 r10624  
    4040#include "util/Singleton.h"
    4141#include "core/config/Configurable.h"
    42 #include "core/object/SmartPtr.h"
     42#include "core/object/StrongPtr.h"
     43#include "core/UpdateListener.h"
    4344
    4445// tolua_begin
     
    5960    class _OrxonoxExport SoundManager
    6061    // tolua_end
    61         : public Singleton<SoundManager>, public Configurable
     62        : public Singleton<SoundManager>, public Configurable, public UpdateListener
    6263    { // tolua_export
    6364        friend class Singleton<SoundManager>;
     
    6869
    6970        void preUpdate(const Clock& time);
     71        void postUpdate(const Clock& time) { /*no action*/ }
    7072        void setConfigValues();
    7173
     
    104106    private:
    105107        void processCrossFading(float dt);
    106         void fadeIn(const SmartPtr<AmbientSound>& sound);
    107         void fadeOut(const SmartPtr<AmbientSound>& sound);
     108        void fadeIn(AmbientSound* sound);
     109        void fadeOut(AmbientSound* sound);
    108110
    109111        void checkFadeStepValidity();
     
    127129        //! Absolute change per second (0.1 means 10% of the nominal volume) for cross fading
    128130        float                              crossFadeStep_;
    129         std::list<SmartPtr<AmbientSound> > fadeInList_;
    130         std::list<SmartPtr<AmbientSound> > fadeOutList_;
     131        std::list<StrongPtr<AmbientSound> > fadeInList_;
     132        std::list<StrongPtr<AmbientSound> > fadeOutList_;
    131133
    132134        // Volume related
  • code/trunk/src/orxonox/sound/WorldAmbientSound.cc

    r9945 r10624  
    3333#include "core/XMLPort.h"
    3434#include "AmbientSound.h"
    35 #include "core/command/ConsoleCommand.h"
     35#include "core/command/ConsoleCommandIncludes.h"
    3636#include <exception>
    3737
  • code/trunk/src/orxonox/weaponsystem/WeaponMode.cc

    r9939 r10624  
    4545namespace orxonox
    4646{
    47     RegisterAbstractClass(WeaponMode).inheritsFrom(Class(BaseObject));
     47    RegisterAbstractClass(WeaponMode).inheritsFrom<BaseObject>();
    4848
    4949    WeaponMode::WeaponMode(Context* context) : BaseObject(context)
  • code/trunk/src/orxonox/worldentities/ControllableEntity.cc

    r9799 r10624  
    3636#include "core/GameMode.h"
    3737#include "core/XMLPort.h"
    38 #include "network/NetworkFunction.h"
     38#include "network/NetworkFunctionIncludes.h"
    3939
    4040#include "Scene.h"
     
    108108                this->camera_->destroy();
    109109
    110             for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     110            for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    111111                (*it)->destroy();
    112112
     
    165165    {
    166166        unsigned int i = 0;
    167         for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     167        for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    168168        {
    169169            if (i == index)
     
    180180
    181181        unsigned int counter = 0;
    182         for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     182        for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    183183        {
    184184            if ((*it) == this->currentCameraPosition_)
     
    215215            {
    216216                this->cameraPositions_.front()->attachCamera(this->camera_);
    217                 this->currentCameraPosition_ = this->cameraPositions_.front().get();
     217                this->currentCameraPosition_ = this->cameraPositions_.front();
    218218            }
    219219            else if (this->cameraPositions_.size() > 0)
    220220            {
    221                 for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     221                for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    222222                {
    223223                    if ((*it) == this->camera_->getParent())
     
    307307        else
    308308        {
    309             callMemberNetworkFunction(ControllableEntity, fire, this->getObjectID(), 0, firemode);
     309            callMemberNetworkFunction(&ControllableEntity::fire, this->getObjectID(), 0, firemode);
    310310        }
    311311    }
     
    323323            if ( target != 0 )
    324324            {
    325                 callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, target->getObjectID() );
     325                callMemberNetworkFunction(&ControllableEntity::setTargetInternal, this->getObjectID(), 0, target->getObjectID() );
    326326            }
    327327           else
    328328           {
    329                 callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, OBJECTID_UNKNOWN );
     329                callMemberNetworkFunction(&ControllableEntity::setTargetInternal, this->getObjectID(), 0, OBJECTID_UNKNOWN );
    330330           }
    331331        }
     
    477477        if (parent)
    478478        {
    479             for (std::list<SmartPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     479            for (std::list<StrongPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    480480                if ((*it)->getIsAbsolute())
    481481                    parent->attach((*it));
  • code/trunk/src/orxonox/worldentities/ControllableEntity.h

    r10437 r10624  
    121121            void addCameraPosition(CameraPosition* position);
    122122            CameraPosition* getCameraPosition(unsigned int index) const;
    123             inline const std::list<SmartPtr<CameraPosition> >& getCameraPositions() const
     123            inline const std::list<StrongPtr<CameraPosition> >& getCameraPositions() const
    124124                { return this->cameraPositions_; }
    125125            unsigned int getCurrentCameraIndex() const;
     
    162162
    163163            inline Controller* getController() const
    164                 { return this->controller_.get(); }
     164                { return this->controller_; }
    165165            void setController(Controller* val);
    166166
     
    168168            virtual void setTarget( WorldEntity* target );
    169169            virtual WorldEntity* getTarget()
    170                 { return this->target_.get(); }
     170                { return this->target_; }
    171171            void setTargetInternal( uint32_t targetID );
    172172
     
    242242            bool bMouseLook_;
    243243            float mouseLookSpeed_;
    244             std::list<SmartPtr<CameraPosition> > cameraPositions_;
     244            std::list<StrongPtr<CameraPosition> > cameraPositions_;
    245245            CameraPosition* currentCameraPosition_;
    246246            std::string cameraPositionTemplate_;
  • code/trunk/src/orxonox/worldentities/WorldEntity.cc

    r10288 r10624  
    6161    BOOST_STATIC_ASSERT((int)Ogre::Node::TS_WORLD  == (int)WorldEntity::World);
    6262
    63     RegisterAbstractClass(WorldEntity).inheritsFrom(Class(BaseObject)).inheritsFrom(Class(Synchronisable));
     63    RegisterAbstractClass(WorldEntity).inheritsFrom<BaseObject>().inheritsFrom<Synchronisable>();
    6464
    6565    /**
     
    130130                WorldEntity* entity = *it;
    131131
    132                 // do this for all children, because even if getDeleteWithParent() returns true a child might still stay active due to smart pointers pointing to it
     132                // do this for all children, because even if getDeleteWithParent() returns true a child might still stay active due to strong pointers pointing to it
    133133                entity->setPosition(entity->getWorldPosition());
    134134                this->detach(entity); // detach also erases the element from the children set
  • code/trunk/src/orxonox/worldentities/pawns/Destroyer.cc

    r9667 r10624  
    4040        RegisterObject(Destroyer);
    4141
    42         UnderAttack* gametype = orxonox_cast<UnderAttack*>(this->getGametype().get());
     42        UnderAttack* gametype = orxonox_cast<UnderAttack*>(this->getGametype());
    4343        if (gametype)
    4444        {
  • code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc

    r10270 r10624  
    3737#include "util/Math.h"
    3838#include "gametypes/Gametype.h"
    39 #include "core/command/ConsoleCommand.h"
     39#include "core/command/ConsoleCommandIncludes.h"
    4040
    4141#include "items/ShipPart.h"
     
    6969        if (this->isInitialized())
    7070        {
    71 
     71            while (!this->partList_.empty())
     72                this->partList_[0]->destroy();
    7273        }
    7374    }
     
    177178            if (it->second->getName() == name)
    178179            {
    179                 it->second->setAlive(false);
     180                it->second->death();
    180181                return;
    181182            }
     
    196197            if (it->second->getName() == name)
    197198            {
    198                 it->second->setAlive(false);
     199                it->second->death();
    199200                return;
    200201            }
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r10622 r10624  
    326326        if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
    327327        {
    328             // Set bAlive_ to false and wait for PawnManager to do the destruction
     328            // Set bAlive_ to false and wait for destroyLater() to do the destruction
    329329            this->bAlive_ = false;
     330            this->destroyLater();
    330331
    331332            this->setDestroyWhenPlayerLeft(false);
  • code/trunk/src/orxonox/worldentities/pawns/Spectator.cc

    r9667 r10624  
    3434#include "core/GameMode.h"
    3535#include "core/command/CommandExecutor.h"
    36 #include "core/command/ConsoleCommand.h"
     36#include "core/command/ConsoleCommandIncludes.h"
    3737
    3838#include "tools/BillboardSet.h"
  • code/trunk/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc

    r9667 r10624  
    4545        this->state_ = BaseState::Uncontrolled;
    4646
    47         TeamBaseMatch* gametype = orxonox_cast<TeamBaseMatch*>(this->getGametype().get());
     47        TeamBaseMatch* gametype = orxonox_cast<TeamBaseMatch*>(this->getGametype());
    4848        if (gametype)
    4949        {
     
    5858        this->fireEvent();
    5959
    60         TeamDeathmatch* gametype = orxonox_cast<TeamDeathmatch*>(this->getGametype().get());
     60        TeamDeathmatch* gametype = orxonox_cast<TeamDeathmatch*>(this->getGametype());
    6161        if (!gametype)
    6262            return;
Note: See TracChangeset for help on using the changeset viewer.