Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 13, 2009, 5:05:17 PM (15 years ago)
Author:
dafrick
Message:

Hopefully merged trunk successfully into pickup branch.

Location:
code/branches/pickup
Files:
5 deleted
96 edited
28 copied

Legend:

Unmodified
Added
Removed
  • code/branches/pickup

  • code/branches/pickup/src/orxonox/CMakeLists.txt

    r5781 r5935  
    2525
    2626SET_SOURCE_FILES(ORXONOX_SRC_FILES
     27  Level.cc
     28  LevelManager.cc
    2729  Main.cc
    28 
    29   CameraManager.cc
    30   LevelManager.cc
    3130  PawnManager.cc
    3231  PlayerManager.cc
    33 
    34   Level.cc
    3532  Radar.cc
     33COMPILATION_BEGIN SceneCompilation.cc
     34  CameraManager.cc
    3635  Scene.cc
     36COMPILATION_END
    3737)
    3838
    3939ADD_SUBDIRECTORY(collisionshapes)
    4040ADD_SUBDIRECTORY(controllers)
     41ADD_SUBDIRECTORY(gamestates)
    4142ADD_SUBDIRECTORY(gametypes)
    4243ADD_SUBDIRECTORY(graphics)
  • code/branches/pickup/src/orxonox/CameraManager.cc

    r5781 r5935  
    2626 *
    2727 */
     28
    2829#include "CameraManager.h"
    2930
     
    3435#include "util/StringUtils.h"
    3536#include "core/GameMode.h"
     37#include "core/GraphicsManager.h"
    3638#include "core/GUIManager.h"
    3739#include "core/ObjectList.h"
     40#include "core/ScopedSingletonManager.h"
    3841#include "tools/Shader.h"
    3942#include "graphics/Camera.h"
     
    4346{
    4447    CameraManager* CameraManager::singletonPtr_s = 0;
     48    ManageScopedSingleton(CameraManager, ScopeID::Graphics, false);
    4549
    46     CameraManager::CameraManager(Ogre::Viewport* viewport)
    47         : viewport_(viewport)
     50    CameraManager::CameraManager()
     51        : viewport_(GraphicsManager::getInstance().getViewport())
    4852    {
    49         this->fallbackCamera_ = 0;
     53        assert(GameMode::showsGraphics());
    5054    }
    5155
    5256    CameraManager::~CameraManager()
    5357    {
    54         if (this->fallbackCamera_)
    55             this->fallbackCamera_->getSceneManager()->destroyCamera(this->fallbackCamera_);
     58        GUIManager::getInstance().setCamera(0);
    5659    }
    5760
    5861    Camera* CameraManager::getActiveCamera() const
    5962    {
    60         if (this->cameraList_.size() > 0)
     63        if (!this->cameraList_.empty())
    6164            return this->cameraList_.front();
    6265        else
     
    6669    void CameraManager::requestFocus(Camera* camera)
    6770    {
    68         if (!GameMode::showsGraphics())
    69             return;
    70 
    7171        // notify old camera (if it exists)
    72         if (this->cameraList_.size() > 0)
     72        if (!this->cameraList_.empty())
    7373            this->cameraList_.front()->removeFocus();
    74         else if (this->fallbackCamera_)
    75         {
    76             this->fallbackCamera_->getSceneManager()->destroyCamera(this->fallbackCamera_);
    77             this->fallbackCamera_ = 0;
    78         }
    7974
    8075        camera->setFocus();
    8176
    8277        // make sure we don't add it twice
    83         for (std::list<Camera*>::iterator it = this->cameraList_.begin(); it != this->cameraList_.end(); ++it)
     78        for (std::list<Camera*>::iterator it = this->cameraList_.begin(); it != this->cameraList_.end();)
    8479            if ((*it) == camera)
    85                 return;
    86 
     80                this->cameraList_.erase(it++);
     81            else
     82                ++it;
    8783        // add to list
    8884        this->cameraList_.push_front(camera);
     
    9187    void CameraManager::releaseFocus(Camera* camera)
    9288    {
    93         if (!GameMode::showsGraphics())
    94             return;
    95 
    9689        // notify the cam of releasing the focus
    97         if (this->cameraList_.front() == camera)
     90        if (!this->cameraList_.empty() && this->cameraList_.front() == camera)
    9891        {
    9992            camera->removeFocus();
     
    10194
    10295            // set new focus if possible
    103             if (this->cameraList_.size() > 0)
     96            if (!this->cameraList_.empty())
    10497                this->cameraList_.front()->setFocus();
    105             else
    106             {
    107                 // there are no more cameras, create a fallback
    108                 if (!this->fallbackCamera_)
    109                     this->fallbackCamera_ = camera->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
    110                 this->useCamera(this->fallbackCamera_);
    111             }
    11298        }
    11399        else
    114         {
    115100            this->cameraList_.remove(camera);
    116         }
    117101    }
    118102
  • code/branches/pickup/src/orxonox/CameraManager.h

    r5781 r5935  
    4242#include "util/OgreForwardRefs.h"
    4343#include "util/Singleton.h"
     44#include "core/OrxonoxClass.h"
     45#include "core/SmartPtr.h"
    4446
    4547namespace orxonox
    4648{
    47     class _OrxonoxExport CameraManager : public Singleton<CameraManager>
     49    class _OrxonoxExport CameraManager : public Singleton<CameraManager>, public OrxonoxClass
    4850    {
    4951            friend class Singleton<CameraManager>;
    5052        public:
    51             CameraManager(Ogre::Viewport* viewport);
     53            CameraManager();
    5254            ~CameraManager();
    5355
     
    6668            std::list<Camera*>    cameraList_;
    6769            Ogre::Viewport*       viewport_;
    68             Ogre::Camera*         fallbackCamera_;
    6970
    7071            static CameraManager* singletonPtr_s;
  • code/branches/pickup/src/orxonox/Level.cc

    r5781 r5935  
    3030
    3131#include "util/Math.h"
    32 #include "core/Core.h"
    3332#include "core/CoreIncludes.h"
    3433#include "core/Loader.h"
     
    4039#include "gametypes/Gametype.h"
    4140#include "overlays/OverlayGroup.h"
    42 #include "sound/SoundBase.h"
    4341#include "LevelManager.h"
    4442
     
    5351        this->registerVariables();
    5452        this->xmlfilename_ = this->getFilename();
     53        this->xmlfile_ = 0;
    5554    }
    5655
     
    6463            if (this->xmlfile_)
    6564                Loader::unload(this->xmlfile_);
    66 
    67             if(this->ambientsound_ != NULL)
    68                 delete this->ambientsound_;
    6965        }
    7066    }
     
    7672        XMLPortParam(Level, "description", setDescription, getDescription, xmlelement, mode);
    7773        XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype");
    78 
    79         XMLPortParamLoadOnly(Level, "ambientsound", loadAmbientSound, xmlelement, mode);
    8074
    8175        XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
     
    116110            this->gametype_ = gametype;
    117111
    118 std::cout << "Load Gametype: " << this->gametype_ << std::endl;
    119 
    120112        Gametype* rootgametype = orxonox_cast<Gametype*>(identifier->fabricate(this));
    121113        this->setGametype(rootgametype);
    122 
    123 std::cout << "root gametype: " << rootgametype->getIdentifier()->getName() << std::endl;
    124114
    125115        for (std::list<BaseObject*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
     
    149139    }
    150140
    151     void Level::loadAmbientSound(const std::string& filename)
    152     {
    153         if(filename == "") return;
    154         else
    155         {
    156             if(this->ambientsound_ == NULL)
    157             {
    158                 this->ambientsound_ = new SoundBase();
    159             }
    160 
    161             this->ambientsound_->loadFile(filename);
    162             this->ambientsound_->play(true);
    163         }
    164     }
    165 
    166141    void Level::playerEntered(PlayerInfo* player)
    167142    {
  • code/branches/pickup/src/orxonox/Level.h

    r5781 r5935  
    5353                { return this->description_; }
    5454
    55             void loadAmbientSound(const std::string& filename);
    56 
    5755            void playerEntered(PlayerInfo* player);
    5856            void playerLeft(PlayerInfo* player);
     
    7371            XMLFile*               xmlfile_;
    7472            std::list<BaseObject*> objects_;
    75 
    76             SoundBase*             ambientsound_;
    7773    };
    7874}
  • code/branches/pickup/src/orxonox/LevelManager.cc

    r5781 r5935  
    3434#include "core/CommandLine.h"
    3535#include "core/ConfigValueIncludes.h"
    36 #include "core/Core.h"
    3736#include "core/CoreIncludes.h"
    3837#include "core/Loader.h"
     38#include "core/ScopedSingletonManager.h"
    3939#include "PlayerManager.h"
    4040#include "Level.h"
    41 #include "infos/HumanPlayer.h"
    4241
    4342namespace orxonox
     
    4645
    4746    LevelManager* LevelManager::singletonPtr_s = 0;
     47    ManageScopedSingleton(LevelManager, ScopeID::Root, false);
    4848
    4949    LevelManager::LevelManager()
  • code/branches/pickup/src/orxonox/Main.cc

    r5781 r5935  
    3131@file
    3232@brief
    33     The main function of Orxonox.
     33    The main function of Orxonox (but not the entry point of the program!)
    3434*/
    3535
    3636#include "OrxonoxPrereqs.h"
    37 #include "SpecialConfig.h"
    3837
    39 #include "util/Exception.h"
    4038#include "core/CommandLine.h"
    4139#include "core/Game.h"
     
    5048SetCommandLineSwitch(dedicated).information("Start in dedicated server mode");
    5149SetCommandLineSwitch(standalone).information("Start in standalone mode");
     50SetCommandLineSwitch(dedicatedClient).information("Start in dedicated client mode");
    5251
    5352DeclareToluaInterface(Orxonox);
     
    5756    /**
    5857    @brief
    59         Main method. Game starts here (except for static initialisations).
     58        Starting point of orxonox (however not the entry point of the program!)
    6059    */
    6160    int main(const std::string& strCmdLine)
     
    6766        " graphics"
    6867        "  mainMenu"
    69         "  standalone"
     68        "  standalone,server,client"
    7069        "   level"
    71         "  server"
    72         "   level"
    73         "  client"
    74         "   level"
    75         " dedicated"
     70        " dedicated,dedicatedClient"
    7671        "  level"
    7772        " ioConsole"
     
    8984        else if (CommandLine::getValue("dedicated").getBool())
    9085            Game::getInstance().requestStates("dedicated, level");
     86        else if (CommandLine::getValue("dedicatedClient").getBool())
     87            Game::getInstance().requestStates("dedicatedClient, level");
    9188        else if (CommandLine::getValue("console").getBool())
    9289            Game::getInstance().requestStates("ioConsole");
  • code/branches/pickup/src/orxonox/OrxonoxPrereqs.h

    r5781 r5935  
    2828
    2929/**
    30   @file
    31   @brief Contains all the necessary forward declarations for all classes and structs.
     30@file
     31@brief
     32    Shared library macros, enums, constants and forward declarations for the orxonox library
    3233*/
    3334
     
    3637
    3738#include "OrxonoxConfig.h"
    38 
    3939#include "tools/ToolsPrereqs.h"
    4040
     
    4242// Shared library settings
    4343//-----------------------------------------------------------------------
     44
    4445#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
    4546#  ifdef ORXONOX_SHARED_BUILD
     
    6566{
    6667    class CameraManager;
     68    class Level;
    6769    class LevelManager;
    6870    class PawnManager;
    6971    class PlayerManager;
    70 
    71     class Level;
     72    class Radar;
    7273    class Scene;
    73     class Tickable;
     74
     75    // collisionshapes
     76    class CollisionShape;
     77    class CompoundCollisionShape;
     78    class WorldEntityCollisionShape;
     79
     80    // controllers
     81    class AIController;
     82    class ArtificialController;
     83    class Controller;
     84    class HumanController;
     85    class ScriptController;
     86    class WaypointController;
     87    class WaypointPatrolController;
     88
     89    // gametypes
     90    class Asteroids;
     91    class Deathmatch;
     92    class Gametype;
     93    class TeamBaseMatch;
     94    class TeamDeathmatch;
     95    class UnderAttack;
     96
     97    // graphics
     98    class Backlight;
     99    class Billboard;
     100    class BlinkingBillboard;
     101    class Camera;
     102    class FadingBillboard;
     103    class GlobalShader;
     104    class Light;
     105    class Model;
     106    class ParticleEmitter;
     107    class ParticleSpawner;
     108
     109    // infos
     110    class Bot;
     111    class GametypeInfo;
     112    class HumanPlayer;
     113    class Info;
     114    class PlayerInfo;
    74115
    75116    // interfaces
    76117    class GametypeMessageListener;
    77118    class NotificationListener;
    78     class PawnListener;
    79119    class PlayerTrigger;
    80120    class RadarListener;
    81121    class RadarViewable;
    82122    class Rewardable;
    83     class Teamcolourable;
    84 
    85     // worldentities
    86     class WorldEntity;
    87     class StaticEntity;
    88     class MobileEntity;
    89     class ControllableEntity;
    90     class MovableEntity;
    91 
    92     // graphics
    93     class Model;
    94     class Billboard;
    95     class BlinkingBillboard;
    96     class BigExplosion;
    97     class ExplosionChunk;
    98     class FadingBillboard;
    99     class GlobalShader;
    100     class Light;
    101     class Backlight;
    102     class ParticleEmitter;
    103     class ParticleSpawner;
    104     class Camera;
    105 
    106     // mixed
    107     class SpawnPoint;
    108     class TeamSpawnPoint;
    109 
    110     class CameraPosition;
    111     class Sublevel;
    112     class Radar;
    113 
    114     class Test;
    115 
    116     // pawns
    117     class Spectator;
    118     class Pawn;
    119     class SpaceShip;
    120     class TeamBaseMatchBase;
    121     class Destroyer;
    122 
    123     // gametypes
    124     class Gametype;
    125     class Deathmatch;
    126     class TeamDeathmatch;
    127     class Asteroids;
    128     class TeamBaseMatch;
    129     class UnderAttack;
    130 
    131     // pickups
     123    class TeamColourable;
     124
     125    // items
     126    class Engine;
     127    class Item;
     128    class MultiStateEngine;
     129
     130    // overlays
     131    class InGameConsole;
     132    class Map;
     133    class OrxonoxOverlay;
     134    class OverlayGroup;
     135
     136    // pickup
    132137    class BaseItem;
    133138    class DroppedItem;
     
    139144    class PickupSpawner;
    140145    class UsableItem;
    141 
     146    // pickup, items
     147    class HealthImmediate;
     148    class HealthUsable;
    142149    class Jump;
    143     class HealthUsable;
    144     class PassiveItem;
    145 
    146     // items
    147     class Item;
    148     class Engine;
    149     class MultiStateEngine;
    150     class RotatingEngine;
     150
     151    //sound
     152    class AmbientSound;
     153    class BaseSound;
     154    class SoundManager;
     155    class WorldSound;
    151156
    152157    // weaponsystem
    153     class WeaponSystem;
     158    class DefaultWeaponmodeLink;
     159    class Munition;
     160    class Weapon;
     161    class WeaponMode;
     162    class WeaponPack;
    154163    class WeaponSet;
    155164    class WeaponSlot;
    156     class WeaponPack;
    157     class Weapon;
    158     class WeaponMode;
    159     class DefaultWeaponmodeLink;
    160     class Munition;
    161 
    162     // controller
    163     class Controller;
    164     class HumanController;
    165     class ArtificialController;
    166     class AIController;
    167     class ScriptController;
    168     class WaypointController;
    169     class WaypointPatrolController;
    170 
    171     // infos
    172     class Info;
    173     class PlayerInfo;
    174     class HumanPlayer;
    175     class Bot;
    176     class GametypeInfo;
    177 
    178     // collision
    179     class CollisionShape;
    180     class CompoundCollisionShape;
    181     class WorldEntityCollisionShape;
    182 
    183     // overlays
    184     class OverlayGroup;
    185     class OrxonoxOverlay;
    186     class Notification;
    187     class NotificationManager;
    188     class InGameConsole;
    189     class Map;
    190 
    191     //sound
    192     class SoundBase;
    193     class SoundManager;
    194     class SoundMainMenu;
     165    class WeaponSystem;
     166
     167    // worldentities
     168    class BigExplosion;
     169    class CameraPosition;
     170    class ControllableEntity;
     171    class ExplosionChunk;
     172    class MobileEntity;
     173    class MovableEntity;
     174    class SpawnPoint;
     175    class StaticEntity;
     176    class TeamSpawnPoint;
     177    class WorldEntity;
     178    // worldentities, pawns
     179    class Destroyer;
     180    class Pawn;
     181    class SpaceShip;
     182    class Spectator;
     183    class TeamBaseMatchBase;
    195184}
    196185
  • code/branches/pickup/src/orxonox/PawnManager.cc

    r5781 r5935  
    5757        {
    5858            if (!it->isAlive())
    59                 delete (*(it++));
     59                (it++)->destroy();
    6060            else
    6161                ++it;
     
    6363
    6464        if (count == 0)
    65             delete this;
     65            this->destroy();
    6666    }
    6767}
  • code/branches/pickup/src/orxonox/PlayerManager.cc

    r5781 r5935  
    3131#include "core/CoreIncludes.h"
    3232#include "core/GameMode.h"
     33#include "core/ScopedSingletonManager.h"
    3334#include "Level.h"
    3435#include "infos/HumanPlayer.h"
     
    3839{
    3940    PlayerManager* PlayerManager::singletonPtr_s = 0;
     41    ManageScopedSingleton(PlayerManager, ScopeID::Root, false);
    4042
    4143    PlayerManager::PlayerManager()
     
    7476        if (GameMode::isMaster())
    7577        {
    76             COUT(3) << "client disconnected" << std::endl;
     78            if (clientID != 0)
     79                COUT(3) << "client disconnected" << std::endl;
    7780
    7881            // remove from clients-map
     
    8588            // delete PlayerInfo instance
    8689            if (player)
    87                 delete player;
     90                player->destroy();
    8891        }
    8992    }
  • code/branches/pickup/src/orxonox/PlayerManager.h

    r5781 r5935  
    5050                { return this->clients_; }
    5151
    52         private:
    5352            void clientConnected(unsigned int clientID);
    5453            void clientDisconnected(unsigned int clientID);
    5554
     55        private:
    5656            std::map<unsigned int, PlayerInfo*> clients_;
    5757
  • code/branches/pickup/src/orxonox/Radar.cc

    r5781 r5935  
    4343namespace orxonox
    4444{
    45     SetConsoleCommand(Radar, cycleNavigationFocus, true).accessLevel(AccessLevel::User);
    46     SetConsoleCommand(Radar, releaseNavigationFocus, true).accessLevel(AccessLevel::User);
    47 
    48     Radar* Radar::instance_s = 0;
    4945
    5046    Radar::Radar()
     
    5248        , objectTypeCounter_(0)
    5349    {
    54         assert(instance_s == 0);
    55         instance_s = this;
    56 
    5750        // TODO: make this mapping configurable. Maybe there's a possibility with self configured
    5851        //       configValues..
     
    7972    Radar::~Radar()
    8073    {
    81         instance_s = 0;
    8274    }
    8375
    8476    const RadarViewable* Radar::getFocus()
    8577    {
    86         return *(this->itFocus_);
     78        if (this->itFocus_)
     79            return *(this->itFocus_);
     80        else
     81            return 0;
    8782    }
    8883
     
    10196        SUPER(Radar, tick, dt);
    10297
    103         if (this->focus_ != *(this->itFocus_))
     98        if (this->itFocus_ && (this->focus_ != *(this->itFocus_)))
    10499        {
    105100            // focus object was deleted, release focus
     
    191186        }
    192187    }
    193 
    194 
    195     /*static*/ Radar& Radar::getInstance()
    196     {
    197         assert(instance_s);
    198         return *instance_s;
    199     }
    200 
    201     /*static*/ void Radar::cycleNavigationFocus()
    202     {
    203         // avoid using getInstance because of the assert().
    204         // User might call this fuction even if HUDNavigation doesn't exist.
    205         if (instance_s)
    206             instance_s->cycleFocus();
    207     }
    208 
    209     /*static*/ void Radar::releaseNavigationFocus()
    210     {
    211         // avoid using getInstance because of the assert().
    212         // User might call this fuction even if HUDNavigation doesn't exist.
    213         if (instance_s)
    214             instance_s->releaseFocus();
    215     }
    216188}
  • code/branches/pickup/src/orxonox/Radar.h

    r5781 r5935  
    4646namespace orxonox
    4747{
    48     /**
    49     @brief This class merely ensures that no one can inherit from Radar.
    50     */
    51     class _OrxonoxExport RadarBase
    52     {
    53     private:
    54         friend class Radar;
    55         RadarBase() { }
    56     };
    57 
    58     class _OrxonoxExport Radar : public Tickable, private virtual RadarBase
     48    class _OrxonoxExport Radar : public Tickable
    5949    {
    6050    public:
    6151        Radar();
    62         ~Radar();
     52        virtual ~Radar();
    6353
    6454        virtual void tick(float dt);
     
    6959        void listObjects() const;
    7060
    71         static Radar& getInstance();
    72         static Radar* getInstancePtr() { return instance_s; }
    73 
    74         static void cycleNavigationFocus();
    75         static void releaseNavigationFocus();
     61        void releaseFocus();
     62        void cycleFocus();
    7663
    7764    private:
    7865        Radar(Radar& instance);
    7966
    80         void releaseFocus();
    8167        void updateFocus();
    82         void cycleFocus();
    8368
    8469        ObjectListIterator<RadarViewable> itFocus_;
     
    8671        std::map<std::string, RadarViewable::Shape> objectTypes_;
    8772        int objectTypeCounter_;
    88 
    89         static Radar* instance_s;
    9073    };
    9174}
  • code/branches/pickup/src/orxonox/Scene.cc

    r5781 r5935  
    4242#include "core/CoreIncludes.h"
    4343#include "core/GameMode.h"
     44#include "core/GUIManager.h"
    4445#include "core/XMLPort.h"
    4546#include "tools/BulletConversions.h"
     47#include "Radar.h"
    4648#include "worldentities/WorldEntity.h"
    4749
     
    5456        RegisterObject(Scene);
    5557
    56         this->setScene(this);
     58        this->setScene(SmartPtr<Scene>(this, false), OBJECTID_UNKNOWN);
    5759        this->bShadows_ = true;
    5860
     
    6264            this->sceneManager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC);
    6365            this->rootSceneNode_ = this->sceneManager_->getRootSceneNode();
     66
     67            this->radar_ = new Radar();
    6468        }
    6569        else
     
    6872            this->sceneManager_ = new Ogre::DefaultSceneManager("");
    6973            this->rootSceneNode_ = this->sceneManager_->getRootSceneNode();
     74
     75            this->radar_ = 0;
    7076        }
    7177
     
    9298            else
    9399                delete this->sceneManager_;
     100
     101            if (this->radar_)
     102                this->radar_->destroy();
    94103
    95104            this->setPhysicalWorld(false);
     
    275284    {
    276285        this->objects_.push_back(object);
    277         object->setScene(this);
     286        object->setScene(this, this->getObjectID());
    278287    }
    279288
  • code/branches/pickup/src/orxonox/Scene.h

    r5781 r5935  
    7171                { return this->bShadows_; }
    7272
     73            inline Radar* getRadar()
     74                { return this->radar_; }
     75           
     76            inline virtual uint32_t getSceneID() const { return this->getObjectID(); }
     77
    7378            virtual void tick(float dt);
    7479
     
    9196            std::list<BaseObject*>   objects_;
    9297            bool                     bShadows_;
     98            Radar*                   radar_;
    9399
    94100
  • code/branches/pickup/src/orxonox/Test.cc

    r5781 r5935  
    6363    setConfigValues();
    6464    registerVariables();
    65                 setObjectMode(0x3);
     65                setSyncMode(0x3);
    6666        }
    6767
  • code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc

    r5781 r5935  
    5656                // make sure that the child doesn't want to detach itself --> speedup because of the missing update
    5757                it->first->notifyDetached();
    58                 delete it->first;
     58                it->first->destroy();
    5959            }
    6060
  • code/branches/pickup/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc

    r5781 r5935  
    4343        this->worldEntityOwner_ = creator;
    4444        // suppress synchronisation
    45         this->setObjectMode(0x0);
     45        this->setSyncMode(0x0);
    4646    }
    4747
  • code/branches/pickup/src/orxonox/controllers/AIController.cc

    r5781 r5935  
    4444        RegisterObject(AIController);
    4545
    46         this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&AIController::action)));
     46        this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&AIController::action, this)));
    4747    }
    4848
  • code/branches/pickup/src/orxonox/controllers/AIController.h

    r5781 r5935  
    5050
    5151        private:
    52             Timer<AIController> actionTimer_;
     52            Timer actionTimer_;
    5353    };
    5454}
  • code/branches/pickup/src/orxonox/controllers/ArtificialController.cc

    r5781 r5935  
    4646        this->bHasTargetPosition_ = false;
    4747        this->targetPosition_ = Vector3::ZERO;
     48       
     49        this->target_.setCallback(createFunctor(&ArtificialController::targetDied, this));
    4850    }
    4951
     
    162164    }
    163165
    164     void ArtificialController::destroyedPawn(Pawn* ship)
    165     {
    166         if (ship == this->target_)
    167         {
    168             this->forgetTarget();
    169             this->searchRandomTargetPosition();
    170         }
     166    void ArtificialController::abandonTarget(Pawn* target)
     167    {
     168        if (target == this->target_)
     169            this->targetDied();
     170    }
     171
     172    void ArtificialController::targetDied()
     173    {
     174        this->forgetTarget();
     175        this->searchRandomTargetPosition();
    171176    }
    172177
  • code/branches/pickup/src/orxonox/controllers/ArtificialController.h

    r5781 r5935  
    3333
    3434#include "util/Math.h"
    35 #include "interfaces/PawnListener.h"
    3635#include "Controller.h"
    3736
    3837namespace orxonox
    3938{
    40     class _OrxonoxExport ArtificialController : public Controller, public PawnListener
     39    class _OrxonoxExport ArtificialController : public Controller
    4140    {
    4241        public:
    4342            ArtificialController(BaseObject* creator);
    4443            virtual ~ArtificialController();
    45 
    46             virtual void destroyedPawn(Pawn* pawn);
     44           
     45            void abandonTarget(Pawn* target);
    4746
    4847        protected:
     48            void targetDied();
     49
    4950            void moveToPosition(const Vector3& target);
    5051            void moveToTargetPosition();
     
    6566            bool bHasTargetPosition_;
    6667            Vector3 targetPosition_;
    67             Pawn* target_;
     68            WeakPtr<Pawn> target_;
    6869            bool bShooting_;
    6970
  • code/branches/pickup/src/orxonox/controllers/HumanController.cc

    r5781 r5935  
    3636#include "infos/PlayerInfo.h"
    3737#include "overlays/Map.h"
     38#include "graphics/Camera.h"
     39#include "sound/SoundManager.h"
     40#include "Radar.h"
     41#include "Scene.h"
    3842
    3943namespace orxonox
     
    5660    SetConsoleCommand(HumanController, dropItems,     true);
    5761    SetConsoleCommand(HumanController, useItem,       true);
     62    SetConsoleCommand(HumanController, cycleNavigationFocus,   true);
     63    SetConsoleCommand(HumanController, releaseNavigationFocus, true);
    5864
    5965    CreateUnloadableFactory(HumanController);
     
    7177    {
    7278        HumanController::localController_s = 0;
     79    }
     80
     81    void HumanController::tick(float dt)
     82    {
     83        if (GameMode::playsSound() && HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     84        {
     85            // Update sound listener
     86            Camera* camera = HumanController::localController_s->controllableEntity_->getCamera();
     87            if (camera)
     88            {
     89                SoundManager::getInstance().setListenerPosition(camera->getWorldPosition());
     90                SoundManager::getInstance().setListenerOrientation(camera->getWorldOrientation());
     91            }
     92            else
     93                COUT(3) << "HumanController, Warning: Using a ControllableEntity without Camera" << std::endl;
     94        }
    7395    }
    7496
     
    200222            return NULL;
    201223    }
     224
     225    void HumanController::cycleNavigationFocus()
     226    {
     227        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     228            HumanController::localController_s->controllableEntity_->getScene()->getRadar()->cycleFocus();
     229    }
     230
     231    void HumanController::releaseNavigationFocus()
     232    {
     233        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     234            HumanController::localController_s->controllableEntity_->getScene()->getRadar()->releaseFocus();
     235    }
    202236}
  • code/branches/pickup/src/orxonox/controllers/HumanController.h

    r5781 r5935  
    3131
    3232#include "OrxonoxPrereqs.h"
     33
     34#include "tools/interfaces/Tickable.h"
    3335#include "Controller.h"
    3436
    3537namespace orxonox
    3638{
    37     class _OrxonoxExport HumanController : public Controller
     39    class _OrxonoxExport HumanController : public Controller, public Tickable
    3840    {
    3941        public:
    4042            HumanController(BaseObject* creator);
    4143            virtual ~HumanController();
     44
     45            virtual void tick(float dt);
    4246
    4347            static void moveFrontBack(const Vector2& value);
     
    5862            static void dropItems();
    5963            static void useItem();
     64            static void cycleNavigationFocus();
     65            static void releaseNavigationFocus();
    6066
    6167            static void suicide();
  • code/branches/pickup/src/orxonox/controllers/WaypointController.cc

    r5781 r5935  
    5050        {
    5151            for (size_t i = 0; i < this->waypoints_.size(); ++i)
    52                 delete this->waypoints_[i];
     52                this->waypoints_[i]->destroy();
    5353        }
    5454    }
  • code/branches/pickup/src/orxonox/controllers/WaypointPatrolController.cc

    r5781 r5935  
    4545        this->alertnessradius_ = 500;
    4646
    47         this->patrolTimer_.setTimer(rnd(), true, this, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy)));
     47        this->patrolTimer_.setTimer(rnd(), true, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy, this)));
    4848    }
    4949
  • code/branches/pickup/src/orxonox/controllers/WaypointPatrolController.h

    r5781 r5935  
    6161            int team_;
    6262            float alertnessradius_;
    63             Timer<WaypointPatrolController> patrolTimer_;
     63            Timer patrolTimer_;
    6464    };
    6565}
  • code/branches/pickup/src/orxonox/gametypes/Asteroids.cc

    r5781 r5935  
    5454        if (this->time_ < 0 && !this->hasEnded() && this->timerIsActive_)
    5555        {
    56             this->gtinfo_.sendAnnounceMessage("Time's up - you have lost the match!");
     56            this->gtinfo_->sendAnnounceMessage("Time's up - you have lost the match!");
    5757            this->end();
    5858        }
     
    6363        if (victim && victim->getPlayer())
    6464        {
    65             this->gtinfo_.sendAnnounceMessage("You're dead - you have lost the match!");
     65            this->gtinfo_->sendAnnounceMessage("You're dead - you have lost the match!");
    6666            this->end();
    6767        }
  • code/branches/pickup/src/orxonox/gametypes/Gametype.cc

    r5781 r5935  
    3333#include "core/ConfigValueIncludes.h"
    3434#include "core/GameMode.h"
     35#include "core/ConsoleCommand.h"
    3536
    3637#include "infos/PlayerInfo.h"
     
    4748    CreateUnloadableFactory(Gametype);
    4849
    49     Gametype::Gametype(BaseObject* creator) : BaseObject(creator), gtinfo_(creator)
     50    Gametype::Gametype(BaseObject* creator) : BaseObject(creator)
    5051    {
    5152        RegisterObject(Gametype);
    52 
    53         this->setGametype(this);
     53       
     54        this->gtinfo_ = new GametypeInfo(creator);
     55
     56        this->setGametype(SmartPtr<Gametype>(this, false));
    5457
    5558        this->defaultControllableEntity_ = Class(Spectator);
     
    7679        else
    7780            this->scoreboard_ = 0;
     81       
     82        /* HACK HACK HACK */
     83        this->hackAddBots_ = createConsoleCommand( createFunctor(&Gametype::addBots, this), "hackAddBots");
     84        this->hackKillBots_ = createConsoleCommand( createFunctor(&Gametype::killBots, this), "hackKillBots");
     85        CommandExecutor::addConsoleCommandShortcut( this->hackAddBots_ );
     86        CommandExecutor::addConsoleCommandShortcut( this->hackKillBots_ );
     87        /* HACK HACK HACK */
     88    }
     89   
     90    Gametype::~Gametype()
     91    {
     92        if (this->isInitialized())
     93        {
     94            this->gtinfo_->destroy();
     95            if( this->hackAddBots_ )
     96                delete this->hackAddBots_;
     97            if( this->hackKillBots_ )
     98                delete this->hackKillBots_;
     99        }
    78100    }
    79101
     
    100122        }
    101123
    102         if (this->gtinfo_.bStartCountdownRunning_ && !this->gtinfo_.bStarted_)
    103             this->gtinfo_.startCountdown_ -= dt;
    104 
    105         if (!this->gtinfo_.bStarted_)
     124        if (this->gtinfo_->bStartCountdownRunning_ && !this->gtinfo_->bStarted_)
     125            this->gtinfo_->startCountdown_ -= dt;
     126
     127        if (!this->gtinfo_->bStarted_)
    106128            this->checkStart();
    107         else if (!this->gtinfo_.bEnded_)
     129        else if (!this->gtinfo_->bEnded_)
    108130            this->spawnDeadPlayersIfRequested();
    109131
     
    115137        this->addBots(this->numberOfBots_);
    116138
    117         this->gtinfo_.bStarted_ = true;
     139        this->gtinfo_->bStarted_ = true;
    118140
    119141        this->spawnPlayersIfRequested();
     
    122144    void Gametype::end()
    123145    {
    124         this->gtinfo_.bEnded_ = true;
     146        this->gtinfo_->bEnded_ = true;
    125147
    126148        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     
    130152                ControllableEntity* oldentity = it->first->getControllableEntity();
    131153
    132                 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(oldentity->getCreator());
     154                ControllableEntity* entity = this->defaultControllableEntity_.fabricate(oldentity);
    133155                if (oldentity->getCamera())
    134156                {
     
    243265
    244266                        if (killer->getPlayer()->getClientID() != CLIENTID_UNKNOWN)
    245                             this->gtinfo_.sendKillMessage("You killed " + victim->getPlayer()->getName(), killer->getPlayer()->getClientID());
     267                            this->gtinfo_->sendKillMessage("You killed " + victim->getPlayer()->getName(), killer->getPlayer()->getClientID());
    246268                        if (victim->getPlayer()->getClientID() != CLIENTID_UNKNOWN)
    247                             this->gtinfo_.sendDeathMessage("You were killed by " + killer->getPlayer()->getName(), victim->getPlayer()->getClientID());
     269                            this->gtinfo_->sendDeathMessage("You were killed by " + killer->getPlayer()->getName(), victim->getPlayer()->getClientID());
    248270                    }
    249271                }
     
    308330                it->second.state_ = PlayerState::Dead;
    309331
    310                 if (!it->first->isReadyToSpawn() || !this->gtinfo_.bStarted_)
     332                if (!it->first->isReadyToSpawn() || !this->gtinfo_->bStarted_)
    311333                {
    312334                    this->spawnPlayerAsDefaultPawn(it->first);
     
    319341    void Gametype::checkStart()
    320342    {
    321         if (!this->gtinfo_.bStarted_)
    322         {
    323             if (this->gtinfo_.bStartCountdownRunning_)
    324             {
    325                 if (this->gtinfo_.startCountdown_ <= 0)
    326                 {
    327                     this->gtinfo_.bStartCountdownRunning_ = false;
    328                     this->gtinfo_.startCountdown_ = 0;
     343        if (!this->gtinfo_->bStarted_)
     344        {
     345            if (this->gtinfo_->bStartCountdownRunning_)
     346            {
     347                if (this->gtinfo_->startCountdown_ <= 0)
     348                {
     349                    this->gtinfo_->bStartCountdownRunning_ = false;
     350                    this->gtinfo_->startCountdown_ = 0;
    329351                    this->start();
    330352                }
     
    349371                    if (allplayersready && hashumanplayers)
    350372                    {
    351                         this->gtinfo_.startCountdown_ = this->initialStartCountdown_;
    352                         this->gtinfo_.bStartCountdownRunning_ = true;
     373                        this->gtinfo_->startCountdown_ = this->initialStartCountdown_;
     374                        this->gtinfo_->bStartCountdownRunning_ = true;
    353375                    }
    354376                }
     
    419441            if (it->getGametype() == this)
    420442            {
    421                 delete (*(it++));
     443                (it++)->destroy();
    422444                ++i;
    423445            }
     446            else
     447                ++it;
    424448        }
    425449    }
  • code/branches/pickup/src/orxonox/gametypes/Gametype.h

    r5781 r5935  
    3737
    3838#include "core/BaseObject.h"
    39 #include "core/Identifier.h"
     39#include "core/SubclassIdentifier.h"
    4040#include "tools/interfaces/Tickable.h"
    4141#include "infos/GametypeInfo.h"
     
    6868        public:
    6969            Gametype(BaseObject* creator);
    70             virtual ~Gametype() {}
     70            virtual ~Gametype();
    7171
    7272            void setConfigValues();
     
    7575
    7676            inline const GametypeInfo* getGametypeInfo() const
    77                 { return &this->gtinfo_; }
     77                { return this->gtinfo_; }
    7878
    7979            inline bool hasStarted() const
    80                 { return this->gtinfo_.bStarted_; }
     80                { return this->gtinfo_->bStarted_; }
    8181            inline bool hasEnded() const
    82                 { return this->gtinfo_.bEnded_; }
     82                { return this->gtinfo_->bEnded_; }
    8383
    8484            virtual void start();
     
    114114
    115115            inline bool isStartCountdownRunning() const
    116                 { return this->gtinfo_.bStartCountdownRunning_; }
     116                { return this->gtinfo_->bStartCountdownRunning_; }
    117117            inline float getStartCountdown() const
    118                 { return this->gtinfo_.startCountdown_; }
     118                { return this->gtinfo_->startCountdown_; }
    119119
    120120            inline void setHUDTemplate(const std::string& name)
    121                 { this->gtinfo_.hudtemplate_ = name; }
     121                { this->gtinfo_->hudtemplate_ = name; }
    122122            inline const std::string& getHUDTemplate() const
    123                 { return this->gtinfo_.hudtemplate_; }
     123                { return this->gtinfo_->hudtemplate_; }
    124124
    125125            void addBots(unsigned int amount);
     
    163163            virtual void spawnDeadPlayersIfRequested();
    164164
    165             GametypeInfo gtinfo_;
     165            SmartPtr<GametypeInfo> gtinfo_;
    166166
    167167            bool bAutoStart_;
     
    184184            // Config Values
    185185            std::string scoreboardTemplate_;
     186           
     187            /* HACK HACK HACK */
     188            ConsoleCommand* hackAddBots_;
     189            ConsoleCommand* hackKillBots_;
     190            /* HACK HACK HACK */
    186191    };
    187192}
  • code/branches/pickup/src/orxonox/gametypes/TeamBaseMatch.cc

    r5781 r5935  
    4242        RegisterObject(TeamBaseMatch);
    4343
    44         this->scoreTimer_.setTimer(10, true, this, createExecutor(createFunctor(&TeamBaseMatch::winPoints)));
    45         this->outputTimer_.setTimer(10, true, this, createExecutor(createFunctor(&TeamBaseMatch::showPoints)));
     44        this->scoreTimer_.setTimer(10, true, createExecutor(createFunctor(&TeamBaseMatch::winPoints, this)));
     45        this->outputTimer_.setTimer(10, true, createExecutor(createFunctor(&TeamBaseMatch::showPoints, this)));
    4646
    4747        this->pointsTeam1_ = 0;
     
    6767                {
    6868                    base->setState(BaseState::ControlTeam1);
    69                     this->gtinfo_.sendAnnounceMessage("The red team captured a base");
     69                    this->gtinfo_->sendAnnounceMessage("The red team captured a base");
    7070                }
    7171                if (teamnr == 1)
    7272                {
    7373                    base->setState(BaseState::ControlTeam2);
    74                     this->gtinfo_.sendAnnounceMessage("The blue team captured a base");
     74                    this->gtinfo_->sendAnnounceMessage("The blue team captured a base");
    7575                }
    7676            }
     
    194194
    195195                if (it->second == winningteam)
    196                     this->gtinfo_.sendAnnounceMessage("You have won the match!", it->first->getClientID());
     196                    this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
    197197                else
    198                     this->gtinfo_.sendAnnounceMessage("You have lost the match!", it->first->getClientID());
     198                    this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
    199199            }
    200200
  • code/branches/pickup/src/orxonox/gametypes/TeamBaseMatch.h

    r5781 r5935  
    6565
    6666            std::set<TeamBaseMatchBase*> bases_;
    67             Timer<TeamBaseMatch> scoreTimer_;
    68             Timer<TeamBaseMatch> outputTimer_;
     67            Timer scoreTimer_;
     68            Timer outputTimer_;
    6969
    7070            //points for each team
  • code/branches/pickup/src/orxonox/gametypes/TeamDeathmatch.cc

    r5781 r5935  
    9393
    9494        if (valid_player)
    95             this->players_.erase(player);
     95            this->teamnumbers_.erase(player);
    9696
    9797        return valid_player;
     
    100100    bool TeamDeathmatch::allowPawnHit(Pawn* victim, Pawn* originator)
    101101    {
    102         return (!this->pawnsAreInTheSameTeam(victim, originator));
     102        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
    103103    }
    104104
    105105    bool TeamDeathmatch::allowPawnDamage(Pawn* victim, Pawn* originator)
    106106    {
    107         return (!this->pawnsAreInTheSameTeam(victim, originator));
     107        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
    108108    }
    109109
    110110    bool TeamDeathmatch::allowPawnDeath(Pawn* victim, Pawn* originator)
    111111    {
    112         return (!this->pawnsAreInTheSameTeam(victim, originator));
     112        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
    113113    }
    114114
  • code/branches/pickup/src/orxonox/gametypes/UnderAttack.cc

    r5781 r5935  
    4646        this->teams_ = 2;
    4747        this->destroyer_ = 0;
     48        this->destroyer_.setCallback(createFunctor(&UnderAttack::killedDestroyer, this));
    4849        this->gameEnded_ = false;
    4950
     
    6566
    6667
    67     void UnderAttack::destroyedPawn(Pawn* pawn)
     68    void UnderAttack::killedDestroyer()
    6869    {
    69         if (pawn == this->destroyer_)
     70        this->end(); //end gametype
     71        std::string message = "Ship destroyed! Team 0 has won!";
     72        COUT(0) << message << std::endl;
     73        Host::Broadcast(message);
     74        this->gameEnded_ = true;
     75
     76        for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    7077        {
    71             this->end(); //end gametype
    72             std::string message = "Ship destroyed! Team 0 has won!";
    73             COUT(0) << message << std::endl;
    74             Host::Broadcast(message);
    75             this->gameEnded_ = true;
     78            if (it->first->getClientID() == CLIENTID_UNKNOWN)
     79                continue;
    7680
    77             for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    78             {
    79                 if (it->first->getClientID() == CLIENTID_UNKNOWN)
    80                     continue;
    81 
    82                 if (it->second == 0)
    83                     this->gtinfo_.sendAnnounceMessage("You have won the match!", it->first->getClientID());
    84                 else
    85                     this->gtinfo_.sendAnnounceMessage("You have lost the match!", it->first->getClientID());
    86             }
     81            if (it->second == 0)
     82                this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
     83            else
     84                this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
    8785        }
    8886    }
     
    164162
    165163                    if (it->second == 1)
    166                         this->gtinfo_.sendAnnounceMessage("You have won the match!", it->first->getClientID());
     164                        this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
    167165                    else
    168                         this->gtinfo_.sendAnnounceMessage("You have lost the match!", it->first->getClientID());
     166                        this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
    169167                }
    170168            }
     
    178176                Host::Broadcast(message);
    179177*/
    180                 this->gtinfo_.sendAnnounceMessage(message);
     178                this->gtinfo_->sendAnnounceMessage(message);
    181179
    182180                if (timesequence_ >= 30 && timesequence_ <= 60)
  • code/branches/pickup/src/orxonox/gametypes/UnderAttack.h

    r5781 r5935  
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include "interfaces/PawnListener.h"
    3534#include "TeamDeathmatch.h"
    3635
    3736namespace orxonox
    3837{
    39     class _OrxonoxExport UnderAttack : public TeamDeathmatch, public PawnListener
     38    class _OrxonoxExport UnderAttack : public TeamDeathmatch
    4039    {
    4140        public:
     
    5453
    5554        protected:
    56             virtual void destroyedPawn(Pawn* pawn);
     55            virtual void killedDestroyer();
    5756
    58             Destroyer* destroyer_;
     57            WeakPtr<Destroyer> destroyer_;
    5958            unsigned int teams_;
    6059            float gameTime_;
  • code/branches/pickup/src/orxonox/graphics/CMakeLists.txt

    r5781 r5935  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    2   Backlight.cc
    32  Billboard.cc
    43  BlinkingBillboard.cc
    5   Camera.cc
    64  FadingBillboard.cc
    75  GlobalShader.cc
    8   Light.cc
    96  Model.cc
    107  ParticleEmitter.cc
    118  ParticleSpawner.cc
     9COMPILATION_BEGIN GraphicsCompilation.cc
     10  Backlight.cc
     11  Camera.cc
     12  Light.cc
     13COMPILATION_END
    1214)
  • code/branches/pickup/src/orxonox/graphics/Camera.cc

    r5781 r5935  
    3838#include "core/CoreIncludes.h"
    3939#include "core/ConfigValueIncludes.h"
     40#include "core/GameMode.h"
     41#include "core/GUIManager.h"
    4042#include "Scene.h"
    4143#include "CameraManager.h"
     
    4951        RegisterObject(Camera);
    5052
     53        if (!GameMode::showsGraphics())
     54            ThrowException(AbortLoading, "Can't create Camera, no graphics.");
    5155        if (!this->getScene())
    5256            ThrowException(AbortLoading, "Can't create Camera, no scene.");
     
    6569        this->nearClipDistance_ = 1;
    6670
    67         this->setObjectMode(0x0);
     71        this->setSyncMode(0x0);
    6872
    6973        this->setConfigValues();
     
    7579        if (this->isInitialized())
    7680        {
     81            if (GUIManager::getInstance().getCamera() == this->camera_)
     82                GUIManager::getInstance().setCamera(NULL);
    7783            this->releaseFocus();
    7884
  • code/branches/pickup/src/orxonox/graphics/FadingBillboard.cc

    r5781 r5935  
    103103        {
    104104            this->changedirection_ = 1;
    105             this->turnonofftimer_.setTimer(this->turnontime_, false, this, createExecutor(createFunctor(&FadingBillboard::stopturnonoff)));
     105            this->turnonofftimer_.setTimer(this->turnontime_, false, createExecutor(createFunctor(&FadingBillboard::stopturnonoff, this)));
    106106
    107107            if (this->isVisible())
     
    111111        {
    112112            this->changedirection_ = -1;
    113             this->turnonofftimer_.setTimer(this->turnofftime_, false, this, createExecutor(createFunctor(&FadingBillboard::stopturnonoff)));
     113            this->turnonofftimer_.setTimer(this->turnofftime_, false, createExecutor(createFunctor(&FadingBillboard::stopturnonoff, this)));
    114114        }
    115115    }
     
    126126            this->fadedColour_ = ColourValue::ZERO;
    127127            this->getBillboardSet().setColour(this->fadedColour_);
    128             this->turnonofftimer_.setTimer(this->postprocessingtime_, false, this, createExecutor(createFunctor(&FadingBillboard::poststopturnonoff)));
     128            this->turnonofftimer_.setTimer(this->postprocessingtime_, false, createExecutor(createFunctor(&FadingBillboard::poststopturnonoff, this)));
    129129        }
    130130        this->changedirection_ = 0;
  • code/branches/pickup/src/orxonox/graphics/FadingBillboard.h

    r5781 r5935  
    7474            float turnofftime_;
    7575            float postprocessingtime_;
    76             Timer<FadingBillboard> turnonofftimer_;
     76            Timer turnonofftimer_;
    7777            char changedirection_;
    7878            ColourValue fadedColour_;
  • code/branches/pickup/src/orxonox/graphics/ParticleEmitter.cc

    r5781 r5935  
    6363        {
    6464            this->detachOgreObject(this->particles_->getParticleSystem());
    65             delete this->particles_;
     65            this->particles_->destroy();
    6666        }
    6767    }
     
    101101        if (this->particles_)
    102102        {
    103             delete this->particles_;
     103            this->particles_->destroy();
    104104            this->particles_ = 0;
    105105        }
  • code/branches/pickup/src/orxonox/graphics/ParticleSpawner.cc

    r5781 r5935  
    7171    }
    7272
    73     void ParticleSpawner::processEvent(Event& event)
     73    void ParticleSpawner::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
    7474    {
    75         SUPER(ParticleSpawner, processEvent, event);
     75        SUPER(ParticleSpawner, XMLEventPort, xmlelement, mode);
    7676
    77         ORXONOX_SET_EVENT(ParticleSpawner, "spawn", spawn, event);
     77        XMLPortEventState(ParticleSpawner, BaseObject, "spawn", spawn, xmlelement, mode);
    7878    }
    7979
     
    8888    void ParticleSpawner::startParticleSpawner()
    8989    {
    90         if (!this->particles_)
    91             return;
    92 
    9390        this->setActive(false);
    9491
    9592        if (this->bForceDestroy_ || this->bSuppressStart_)
     93        {
     94            this->timer_.stopTimer();
    9695            return;
     96        }
    9797
    98         this->timer_.setTimer(this->startdelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::fireParticleSpawner)));
     98        this->timer_.setTimer(this->startdelay_, false, createExecutor(createFunctor(&ParticleSpawner::fireParticleSpawner, this)));
    9999    }
    100100
     
    103103        this->setActive(true);
    104104        if (this->lifetime_ != 0)
    105             this->timer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&ParticleSpawner::stopParticleSpawner)));
     105            this->timer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&ParticleSpawner::stopParticleSpawner, this)));
    106106    }
    107107
     
    116116
    117117            if (!this->timer_.isActive() || this->timer_.getRemainingTime() > this->destroydelay_)
    118                 this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));
     118                this->timer_.setTimer(this->destroydelay_, false, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner, this)));
    119119        }
    120120        else if (this->bLoop_)
    121121        {
    122             this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::startParticleSpawner)));
     122            this->timer_.setTimer(this->destroydelay_, false, createExecutor(createFunctor(&ParticleSpawner::startParticleSpawner, this)));
    123123        }
    124124    }
     
    126126    void ParticleSpawner::destroyParticleSpawner()
    127127    {
    128         delete this;
     128        this->destroy();
    129129    }
    130130}
  • code/branches/pickup/src/orxonox/graphics/ParticleSpawner.h

    r5781 r5935  
    4444
    4545            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    46             virtual void processEvent(Event& event);
     46            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    4747
    48             inline void destroy()
    49                 { this->bForceDestroy_ = true; this->stopParticleSpawner(); }
     48            inline void stop(bool bDestroy)
     49                { this->bForceDestroy_ = bDestroy; this->stopParticleSpawner(); }
    5050            inline void spawn()
    5151                { this->bSuppressStart_ = false; this->startParticleSpawner(); }
     
    8989            void destroyParticleSpawner();
    9090
    91             Timer<ParticleSpawner> timer_;
     91            Timer timer_;
    9292
    9393            bool  bSuppressStart_;
  • code/branches/pickup/src/orxonox/infos/HumanPlayer.cc

    r5781 r5935  
    6464        {
    6565            if (this->humanHud_)
    66                 delete this->humanHud_;
     66                this->humanHud_->destroy();
    6767
    6868            if (this->gametypeHud_)
    69                 delete this->gametypeHud_;
     69                this->gametypeHud_->destroy();
    7070        }
    7171    }
     
    116116
    117117            if (!GameMode::isMaster())
    118                 this->setObjectMode(ObjectDirection::Bidirectional);
     118                this->setSyncMode(ObjectDirection::Bidirectional);
    119119            else
    120120                this->setName(this->nick_);
     
    162162
    163163        if (this->isInitialized() && this->isLocalPlayer())
    164             if (this->getGametype()->getHUDTemplate() != "")
     164        {
     165            if (this->getGametype() && this->getGametype()->getHUDTemplate() != "")
    165166                this->setGametypeHUDTemplate(this->getGametype()->getHUDTemplate());
     167            else
     168                this->setGametypeHUDTemplate("");
     169        }
    166170    }
    167171
     
    170174        if (this->humanHud_)
    171175        {
    172             delete this->humanHud_;
     176            this->humanHud_->destroy();
    173177            this->humanHud_ = 0;
    174178        }
    175179
    176         if (this->isLocalPlayer() && this->humanHudTemplate_ != "")
     180        if (this->isLocalPlayer() && this->humanHudTemplate_ != "" && GameMode::showsGraphics())
    177181        {
    178182            this->humanHud_ = new OverlayGroup(this);
     
    186190        if (this->gametypeHud_)
    187191        {
    188             delete this->gametypeHud_;
     192            this->gametypeHud_->destroy();
    189193            this->gametypeHud_ = 0;
    190194        }
  • code/branches/pickup/src/orxonox/infos/PlayerInfo.cc

    r5781 r5935  
    3535#include "gametypes/Gametype.h"
    3636#include "worldentities/ControllableEntity.h"
     37#include "controllers/Controller.h"
    3738
    3839namespace orxonox
     
    6667            if (this->controller_)
    6768            {
    68                 delete this->controller_;
     69                this->controller_->destroy();
    6970                this->controller_ = 0;
    7071            }
     
    131132        if (this->controller_)
    132133        {
    133             delete this->controller_;
     134            this->controller_->destroy();
    134135            this->controller_ = 0;
    135136        }
  • code/branches/pickup/src/orxonox/infos/PlayerInfo.h

    r5781 r5935  
    3333
    3434#include "Info.h"
    35 #include "core/Identifier.h"
    36 #include "controllers/Controller.h"
     35#include "core/SubclassIdentifier.h"
    3736
    3837namespace orxonox
  • code/branches/pickup/src/orxonox/interfaces/InterfaceCompilation.cc

    r5781 r5935  
    3434
    3535#include "GametypeMessageListener.h"
    36 #include "PawnListener.h"
    3736#include "PlayerTrigger.h"
    3837#include "RadarListener.h"
     
    5150    {
    5251        RegisterRootObject(GametypeMessageListener);
    53     }
    54 
    55     //----------------------------
    56     // PawnListener
    57     //----------------------------
    58     /**
    59         @brief Constructor for the PawnListener.
    60     */
    61     PawnListener::PawnListener()
    62     {
    63         RegisterRootObject(PawnListener);
    6452    }
    6553
  • code/branches/pickup/src/orxonox/interfaces/NotificationListener.h

    r5781 r5935  
    4545namespace orxonox
    4646{
     47    class Notification;
     48
    4749    class _OrxonoxExport NotificationListener : virtual public OrxonoxClass
    4850    {
  • code/branches/pickup/src/orxonox/interfaces/RadarViewable.cc

    r5781 r5935  
    3838#include "worldentities/WorldEntity.h"
    3939#include "Radar.h"
     40#include "Scene.h"
    4041#include "overlays/Map.h"
    4142
     
    135136    void RadarViewable::setRadarObjectDescription(const std::string& str)
    136137    {
    137         Radar* radar = Radar::getInstancePtr();
     138        Radar* radar = this->getWorldEntity()->getScene()->getRadar();
    138139        if (radar)
    139140            this->radarObjectShape_ = radar->addObjectDescription(str);
  • code/branches/pickup/src/orxonox/items/Engine.cc

    r5781 r5935  
    3737#include "pickup/ModifierType.h"
    3838#include "tools/Shader.h"
    39 #include "sound/SoundBase.h"
    4039
    4140namespace orxonox
     
    6867        this->setConfigValues();
    6968        this->registerVariables();
    70 
    71         this->sound_ = NULL;
    7269    }
    7370
     
    7976
    8077            if (this->boostBlur_)
    81                 delete this->boostBlur_;
    82 
    83             if(this->sound_ != NULL)
    84                 delete this->sound_;
     78                this->boostBlur_->destroy();
    8579        }
    8680    }
     
    10296        XMLPortParam(Engine, "accelerationleftright", setAccelerationLeftRight, setAccelerationLeftRight, xmlelement, mode);
    10397        XMLPortParam(Engine, "accelerationupdown",    setAccelerationUpDown,    setAccelerationUpDown,    xmlelement, mode);
    104 
    105         XMLPortParamLoadOnly(Engine, "sound", loadSound, xmlelement, mode);
    10698    }
    10799
     
    237229            if (this->boostBlur_)
    238230            {
    239                 delete this->boostBlur_;
     231                this->boostBlur_->destroy();
    240232                this->boostBlur_ = 0;
    241233            }
    242 
    243             if(this->sound_ != NULL)
    244                 this->sound_->attachToEntity(ship);
    245234        }
    246235    }
     
    253242            return Vector3::ZERO;
    254243    }
    255 
    256     void Engine::loadSound(const std::string filename)
    257     {
    258         if(filename == "") return;
    259         else
    260         {
    261             if(this->sound_ == NULL)
    262             {
    263                 this->sound_ = new SoundBase(this->ship_);
    264             }
    265 
    266             this->sound_->loadFile(filename);
    267             this->sound_->play(true);
    268         }
    269     }
    270244}
  • code/branches/pickup/src/orxonox/items/Engine.h

    r5781 r5935  
    130130            Shader* boostBlur_;
    131131            float blurStrength_;
    132 
    133             SoundBase* sound_;
    134132    };
    135133}
  • code/branches/pickup/src/orxonox/items/MultiStateEngine.cc

    r5781 r5935  
    6060            // We have no ship, so the effects are not attached and won't be destroyed automatically
    6161            for (std::list<WorldEntity*>::const_iterator it = this->activeEffects_.begin(); it != this->activeEffects_.end(); ++it)
    62                 delete (*it);
     62                (*it)->destroy();
    6363            for (std::list<WorldEntity*>::const_iterator it = this->forwardEffects_.begin(); it != this->forwardEffects_.end(); ++it)
    64                 delete (*it);
     64                (*it)->destroy();
    6565            for (std::list<WorldEntity*>::const_iterator it = this->boostEffects_.begin(); it != this->boostEffects_.end(); ++it)
    66                 delete (*it);
     66                (*it)->destroy();
    6767            for (std::list<WorldEntity*>::const_iterator it = this->brakeEffects_.begin(); it != this->brakeEffects_.end(); ++it)
    68                 delete (*it);
     68                (*it)->destroy();
    6969        }
    7070    }
     
    9191            if (this->getShip()->hasLocalController())
    9292            {
    93                 this->setObjectMode(ObjectDirection::Bidirectional);
     93                this->setSyncMode(ObjectDirection::Bidirectional);
    9494
    9595                const Vector3& direction = this->getDirection();
  • code/branches/pickup/src/orxonox/overlays/CMakeLists.txt

    r5781 r5935  
    33  OverlayGroup.cc
    44
     5COMPILATION_BEGIN OverlayCompilation.cc
    56  InGameConsole.cc
    67  Map.cc
     8COMPILATION_END
    79)
  • code/branches/pickup/src/orxonox/overlays/InGameConsole.cc

    r5781 r5935  
    4141#include <OgreFont.h>
    4242
     43#include "util/Clock.h"
     44#include "util/Convert.h"
    4345#include "util/Math.h"
    44 #include "util/Convert.h"
    4546#include "util/UTFStringConversions.h"
    46 #include "core/Clock.h"
    4747#include "core/CoreIncludes.h"
    4848#include "core/ConfigValueIncludes.h"
    4949#include "core/ConsoleCommand.h"
     50#include "core/ScopedSingletonManager.h"
    5051#include "core/input/InputManager.h"
    5152#include "core/input/InputState.h"
     
    6162
    6263    InGameConsole* InGameConsole::singletonPtr_s = 0;
     64    ManageScopedSingleton(InGameConsole, ScopeID::Graphics, false);
    6365
    6466    /**
     
    8587
    8688        this->setConfigValues();
     89        this->initialise();
    8790    }
    8891
  • code/branches/pickup/src/orxonox/overlays/InGameConsole.h

    r5781 r5935  
    5050
    5151        void initialise();
    52         void destroy();
    5352        void setConfigValues();
    5453
  • code/branches/pickup/src/orxonox/overlays/Map.cc

    r5781 r5935  
    290290       for(ObjectList<orxonox::RadarViewable>::iterator it = ObjectList<orxonox::RadarViewable>::begin();
    291291            it!=ObjectList<orxonox::RadarViewable>::end();
    292             it++)
     292            ++it)
    293293        {
    294294            //COUT(0) << "Radar_Position: " << it->getRVWorldPosition() << std::endl;
     
    392392        for(ObjectList<orxonox::Map>::iterator it = ObjectList<orxonox::Map>::begin();
    393393            it!=ObjectList<orxonox::Map>::end();
    394             it++)
     394            ++it)
    395395        {
    396396        //Map * m = it->getMap();
  • code/branches/pickup/src/orxonox/overlays/OrxonoxOverlay.h

    r5781 r5935  
    213213  };
    214214
    215   SUPER_FUNCTION(7, OrxonoxOverlay, changedOwner, false);
    216   SUPER_FUNCTION(8, OrxonoxOverlay, changedOverlayGroup, false);
     215  SUPER_FUNCTION(6, OrxonoxOverlay, changedOwner, false);
     216  SUPER_FUNCTION(7, OrxonoxOverlay, changedOverlayGroup, false);
    217217}
    218218
  • code/branches/pickup/src/orxonox/overlays/OverlayGroup.cc

    r5781 r5935  
    6161    {
    6262        for (std::set<OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    63             delete (*it);
     63            (*it)->destroy();
    6464    }
    6565
  • code/branches/pickup/src/orxonox/pickup/DroppedItem.cc

    r5902 r5935  
    7575        if (this->item_)
    7676        {
    77             for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); it++) //!< Iterate through all Pawns.
     77            for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) //!< Iterate through all Pawns.
    7878            {
    7979                Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
     
    9393        {
    9494            COUT(3) << "DroppedItem '" << this->item_->getPickupIdentifier() << "' picked up." << std::endl;
    95             delete this;
     95            this->destroy();
    9696        }
    9797    }
     
    106106        if (this->timeToLive_ > 0)
    107107        {
    108             ExecutorMember<DroppedItem>* exec = createExecutor(createFunctor(&DroppedItem::timerCallback));
    109             this->timer_.setTimer(this->timeToLive_, false, this, exec, false);
     108            this->timer_.setTimer(this->timeToLive_, false, createExecutor(createFunctor(&DroppedItem::timerCallback, this)), false);
    110109        }
    111110    }
     
    123122        {
    124123            COUT(3) << "Delete DroppedItem with '" << this->item_->getPickupIdentifier() << "'" << std::endl;
    125             delete this->item_;
     124            this->item_->destroy();
    126125        }
    127126
    128         delete this;
     127        this->destroy();
    129128    }
    130129
  • code/branches/pickup/src/orxonox/pickup/DroppedItem.h

    r5902 r5935  
    8686        BaseItem* item_;
    8787
    88         Timer<DroppedItem> timer_;
     88        Timer timer_;
    8989    };
    9090}
  • code/branches/pickup/src/orxonox/pickup/ModifierPickup.cc

    r5902 r5935  
    116116            if (this->duration_ > 0.0f)
    117117            {
    118                 ExecutorMember<ModifierPickup>* executor = createExecutor(createFunctor(&ModifierPickup::timerCallback));
     118                Executor* executor = createExecutor(createFunctor(&ModifierPickup::timerCallback, this));
    119119                executor->setDefaultValues(pawn);
    120                 this->timer_.setTimer(this->duration_, false, this, executor);
     120                this->timer_.setTimer(this->duration_, false, executor);
    121121            }
    122122
     
    157157                this->timer_.stopTimer();
    158158
    159             delete this;
     159            this->destroy();
    160160
    161161            return true;
  • code/branches/pickup/src/orxonox/pickup/ModifierPickup.h

    r5902 r5935  
    152152
    153153            float duration_;                                                        //!< Duration of this pickup's effect (0 for unlimited).
    154             Timer<ModifierPickup> timer_;                                           //!< Timer used if the pickup's effect has a time limit.
     154            Timer timer_;                                           //!< Timer used if the pickup's effect has a time limit.
    155155    };
    156156}
  • code/branches/pickup/src/orxonox/pickup/PickupSpawner.cc

    r5902 r5935  
    103103            asItem->addTemplate(this->itemTemplate_);
    104104            PickupInventory::getImageForItem(asItem);
    105             delete newObject;
     105            newObject->destroy();
    106106        }
    107107
     
    148148        if (this->isActive())
    149149        {
    150             for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); it++)
     150            for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
    151151            {
    152152                Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
     
    189189                    if (this->respawnTime_ > 0.0f)
    190190                    {
    191                         ExecutorMember<PickupSpawner>* executor = createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback));
    192                         this->respawnTimer_.setTimer(this->respawnTime_, false, this, executor);
     191                        this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this)));
    193192
    194193                        this->setActive(false);
     
    197196                }
    198197                else
    199                     delete newObject;
     198                    newObject->destroy();
    200199            }
    201200        }
  • code/branches/pickup/src/orxonox/pickup/PickupSpawner.h

    r5902 r5935  
    115115
    116116            float respawnTime_;                     //!< Time after which this gets re-actived.
    117             Timer<PickupSpawner> respawnTimer_;     //!< Timer used for re-activating.
     117            Timer respawnTimer_;     //!< Timer used for re-activating.
    118118    };
    119119}
  • code/branches/pickup/src/orxonox/pickup/items/HealthImmediate.cc

    r5902 r5935  
    6868        {
    6969            pawn->addHealth(this->recoveredHealth_);
    70             delete this;
     70            this->destroy();
    7171        }
    7272
  • code/branches/pickup/src/orxonox/pickup/items/HealthUsable.cc

    r5902 r5935  
    8787
    8888            this->removeFrom(pawn);
    89             delete this;
     89            this->destroy();
    9090        }
    9191    }
  • code/branches/pickup/src/orxonox/pickup/items/Jump.cc

    r5781 r5935  
    8484        {
    8585            this->removeFrom(pawn);
    86             delete this;
     86            this->destroy();
    8787        }
    8888    }
  • code/branches/pickup/src/orxonox/sound/CMakeLists.txt

    r5781 r5935  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
     2    AmbientSound.cc
     3    BaseSound.cc
    24    SoundManager.cc
    3     SoundBase.cc
    4     SoundMainMenu.cc
     5    WorldSound.cc
    56)
    67
  • code/branches/pickup/src/orxonox/sound/SoundManager.cc

    r5781 r5935  
    3131#include <AL/alut.h>
    3232
     33#include "util/Exception.h"
    3334#include "util/Math.h"
    34 #include "CameraManager.h"
    35 #include "graphics/Camera.h"
    36 #include "SoundBase.h"
     35#include "util/ScopeGuard.h"
     36#include "core/GameMode.h"
     37#include "core/ScopedSingletonManager.h"
    3738
    3839namespace orxonox
    3940{
    4041    SoundManager* SoundManager::singletonPtr_s = NULL;
     42    ManageScopedSingleton(SoundManager, ScopeID::Graphics, true);
    4143
    42     /**
    43      * Default constructor
    44      */
    4544    SoundManager::SoundManager()
    4645    {
    47         this->device_ = NULL;
    48         this->soundavailable_ = true;
    49         if(!alutInitWithoutContext(NULL,NULL))
     46        if (!alutInitWithoutContext(NULL,NULL))
     47            ThrowException(InitialisationFailed, "OpenAL ALUT error: " << alutGetErrorString(alutGetError()));
     48        Loki::ScopeGuard alutExitGuard = Loki::MakeGuard(&alutExit);
     49
     50        COUT(3) << "OpenAL: Opening sound device..." << std::endl;
     51        this->device_ = alcOpenDevice(NULL);
     52        if (this->device_ == NULL)
    5053        {
    51             COUT(2) << "Sound: OpenAL ALUT: " << alutGetErrorString(alutGetError()) << std::endl;
    52             this->soundavailable_ = false;
     54            COUT(0) << "OpenaAL: Could not open sound device. Have you installed OpenAL?" << std::endl;
     55#ifdef ORXONOX_PLATFORM_WINDOWS
     56            COUT(0) << "Just getting the DLL with the dependencies is not enough for Windows (esp. Windows 7)!" << std::endl;
     57#endif
     58            ThrowException(InitialisationFailed, "OpenAL error: Could not open sound device.");
    5359        }
     60        Loki::ScopeGuard closeDeviceGuard = Loki::MakeGuard(&alcCloseDevice, this->device_);
     61
     62        COUT(3) << "OpenAL: Sound device opened" << std::endl;
     63        this->context_ = alcCreateContext(this->device_, NULL);
     64        if (this->context_ == NULL)
     65            ThrowException(InitialisationFailed, "OpenAL error: Could not create sound context");
     66        Loki::ScopeGuard desroyContextGuard = Loki::MakeGuard(&alcDestroyContext, this->context_);
     67
     68        if (alcMakeContextCurrent(this->context_) == AL_TRUE)
     69            COUT(3) << "OpenAL: Context " << this->context_ << " loaded" << std::endl;
     70
     71        COUT(4) << "Sound: OpenAL ALUT version: " << alutGetMajorVersion() << "." << alutGetMinorVersion() << std::endl;
     72
     73        const char* str = alutGetMIMETypes(ALUT_LOADER_BUFFER);
     74        if (str == NULL)
     75            COUT(2) << "OpenAL ALUT error: " << alutGetErrorString(alutGetError()) << std::endl;
    5476        else
    55         {
    56             assert(this->device_ == NULL);
    57             COUT(3) << "Sound: OpenAL: Open sound device..." << std::endl;
    58             this->device_ = alcOpenDevice(NULL);
     77            COUT(4) << "OpenAL ALUT supported MIME types: " << str << std::endl;
    5978
    60             if(this->device_ == NULL)
    61             {
    62                 COUT(2) << "Sound: OpenAL: Could not open sound device" << std::endl;
    63                 this->soundavailable_ = false;
    64             }
    65             else
    66             {
    67                 COUT(3) << "Sound: OpenAL: Sound device opened" << std::endl;
    68                 this->context_ = alcCreateContext(this->device_, NULL);
    69                 if(this->context_ == NULL)
    70                 {
    71                     COUT(2) << "Sound: OpenAL: Could not create sound context" << std::endl;
    72                     this->soundavailable_ = false;
    73                 }
    74                 else
    75                 {
    76                     if(alcMakeContextCurrent(this->context_) == AL_TRUE)
    77                         COUT(3) << "Sound: OpenAL: Context " << this->context_ << " loaded" << std::endl;
    78 
    79                     COUT(4) << "Sound: OpenAL ALUT version: " << alutGetMajorVersion() << "." << alutGetMinorVersion() << std::endl;
    80                     const char* str = alutGetMIMETypes(ALUT_LOADER_BUFFER);
    81                     if (str == NULL)
    82                         COUT(2) << "Sound: OpenAL ALUT: " << alutGetErrorString(alutGetError()) << std::endl;
    83                     else
    84                         COUT(4) << "Sound: OpenAL ALUT supported MIME types: " << str << std::endl;
    85                 }
    86             }
    87         }
     79        GameMode::setPlaysSound(true);
     80        // Disarm guards
     81        alutExitGuard.Dismiss();
     82        closeDeviceGuard.Dismiss();
     83        desroyContextGuard.Dismiss();
    8884    }
    8985
    9086    SoundManager::~SoundManager()
    9187    {
     88        GameMode::setPlaysSound(false);
    9289        alcDestroyContext(this->context_);
    9390        alcCloseDevice(this->device_);
     
    9592    }
    9693
    97     /**
    98      * Add a SoundBase object to the list. Every SoundBase object should be in
    99      * this list.
    100      *
    101      * @param sound Pointer to the SoundBase object to add
    102      */
    103     void SoundManager::addSound(SoundBase* sound)
     94    void SoundManager::setListenerPosition(const Vector3& position)
    10495    {
    105         this->soundlist_.push_back(sound);
     96        alListener3f(AL_POSITION, position.x, position.y, position.z);
     97        ALenum error = alGetError();
     98        if (error == AL_INVALID_VALUE)
     99            COUT(2) << "Sound: OpenAL: Invalid listener position" << std::endl;
    106100    }
    107101
    108     /**
    109      * Remove a SoundBase object from the list and destroy it.
    110      */
    111     void SoundManager::removeSound(SoundBase* sound)
     102    void SoundManager::setListenerOrientation(const Quaternion& orientation)
    112103    {
    113         std::list<SoundBase*>::iterator pos = this->soundlist_.end();
    114         for(std::list<SoundBase*>::iterator i = this->soundlist_.begin(); i != this->soundlist_.end(); i++)
    115         {
    116             if((*i) == sound)
    117                 pos = i;
    118         }
     104        // update listener orientation
     105        Vector3 up = orientation.xAxis(); // just a wild guess
     106        Vector3 at = orientation.zAxis();
    119107
    120         delete (*pos);
    121         this->soundlist_.erase(pos);
    122     }
     108        ALfloat orient[6] = { at.x, at.y, at.z,
     109                              up.x, up.y, up.z };
    123110
    124     /**
    125      * Tick function, updates listener and registred SoundBase objects
    126      *
    127      * @param dt @see Orxonox::Tickable
    128      */
    129     void SoundManager::tick(float dt)
    130     {
    131         if (!CameraManager::getInstancePtr())
    132             return;
    133 
    134         // update listener position
    135         Camera* camera = CameraManager::getInstance().getActiveCamera();
    136         if(camera == NULL) return;
    137         Vector3 pos = camera->getPosition();
    138         alListener3f(AL_POSITION, pos.x, pos.y, pos.z);
     111        alListenerfv(AL_POSITION, orient);
    139112        ALenum error = alGetError();
    140         if(error == AL_INVALID_VALUE)
    141             COUT(2) << "Sound: OpenAL: Invalid listener position" << std::endl;
    142 
    143         // update listener orientation
    144         const Quaternion& orient = camera->getOrientation();
    145         Vector3 up = orient.xAxis(); // just a wild guess
    146         Vector3 at = orient.zAxis();
    147 
    148         ALfloat orientation[6] = { at.x, at.y, at.z,
    149                                  up.x, up.y, up.z };
    150 
    151         alListenerfv(AL_POSITION, orientation);
    152         error = alGetError();
    153         if(error == AL_INVALID_VALUE)
     113        if (error == AL_INVALID_VALUE)
    154114            COUT(2) << "Sound: OpenAL: Invalid listener orientation" << std::endl;
    155 
    156         // update sounds
    157         for(std::list<SoundBase*>::iterator i = this->soundlist_.begin(); i != this->soundlist_.end(); i++)
    158             (*i)->update();
    159     }
    160 
    161     /**
    162     * Check if sound is available
    163     */
    164     bool SoundManager::isSoundAvailable()
    165     {
    166         return this->soundavailable_;
    167115    }
    168116}
  • code/branches/pickup/src/orxonox/sound/SoundManager.h

    r5781 r5935  
    3939    /**
    4040     * The SoundManager class manages the OpenAL device, context and listener
    41      * position. It has a list of all SoundBase objects and calls their update
    42      * function every tick. It is a singleton.
     41     * position. It is a singleton.
    4342     *
    4443     */
    45     class _OrxonoxExport SoundManager : public Singleton<SoundManager>, public Tickable
     44    class _OrxonoxExport SoundManager : public Singleton<SoundManager>
    4645    {
    4746        friend class Singleton<SoundManager>;
     
    4948        SoundManager();
    5049        ~SoundManager();
    51         void addSound(SoundBase* sound);
    52         void removeSound(SoundBase* sound);
    53         void tick(float dt);
    54         bool isSoundAvailable();
     50
     51        void setListenerPosition(const Vector3& position);
     52        void setListenerOrientation(const Quaternion& orientation);
    5553
    5654    private:
    5755        ALCdevice* device_;
    5856        ALCcontext* context_;
    59         std::list<SoundBase*> soundlist_;
    60         bool soundavailable_;
    6157
    6258        static SoundManager* singletonPtr_s;
    63     }; // class SoundManager
    64 } // namespace orxonox
     59    };
     60}
    6561
    6662#endif /* _SoundManager_H__ */
  • code/branches/pickup/src/orxonox/weaponsystem/Munition.cc

    r5781 r5935  
    461461        if (bUseReloadTime && (munition->reloadTime_ > 0 || munition->bStackMunition_))
    462462        {
    463             ExecutorMember<Magazine>* executor = createExecutor(createFunctor(&Magazine::loaded));
     463            Executor* executor = createExecutor(createFunctor(&Magazine::loaded, this));
    464464            executor->setDefaultValues(munition);
    465465
    466             this->loadTimer_.setTimer(munition->reloadTime_, false, this, executor);
     466            this->loadTimer_.setTimer(munition->reloadTime_, false, executor);
    467467        }
    468468        else
  • code/branches/pickup/src/orxonox/weaponsystem/Munition.h

    r5781 r5935  
    4747
    4848                unsigned int munition_;
    49                 Timer<Magazine> loadTimer_;
     49                Timer loadTimer_;
    5050                bool bLoaded_;
    5151
  • code/branches/pickup/src/orxonox/weaponsystem/Weapon.cc

    r5781 r5935  
    5050        this->reloadingWeaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
    5151
    52         this->reloadTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&Weapon::reloaded)));
     52        this->reloadTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&Weapon::reloaded, this)));
    5353        this->reloadTimer_.stopTimer();
    5454    }
     
    6262
    6363            for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    64                 delete it->second;
     64                it->second->destroy();
    6565        }
    6666    }
  • code/branches/pickup/src/orxonox/weaponsystem/Weapon.h

    r5781 r5935  
    7171            std::multimap<unsigned int, WeaponMode*> weaponmodes_;
    7272
    73             Timer<Weapon> reloadTimer_;
     73            Timer reloadTimer_;
    7474            bool bReloading_;
    7575            unsigned int reloadingWeaponmode_;
  • code/branches/pickup/src/orxonox/weaponsystem/WeaponMode.cc

    r5781 r5935  
    5757        this->bParallelReload_ = true;
    5858
    59         this->reloadTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&WeaponMode::reloaded)));
     59        this->reloadTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&WeaponMode::reloaded, this)));
    6060        this->reloadTimer_.stopTimer();
    6161
  • code/branches/pickup/src/orxonox/weaponsystem/WeaponMode.h

    r5781 r5935  
    3636#include "util/Math.h"
    3737#include "core/BaseObject.h"
    38 #include "core/Identifier.h"
     38#include "core/SubclassIdentifier.h"
    3939#include "tools/Timer.h"
    4040
     
    150150            std::string munitionname_;
    151151
    152             Timer<WeaponMode> reloadTimer_;
     152            Timer reloadTimer_;
    153153            bool bReloading_;
    154154    };
  • code/branches/pickup/src/orxonox/weaponsystem/WeaponPack.cc

    r5781 r5935  
    5454
    5555            while (!this->weapons_.empty())
    56                 delete (*this->weapons_.begin());
     56                (*this->weapons_.begin())->destroy();
    5757
    5858            for (std::set<DefaultWeaponmodeLink*>::iterator it = this->links_.begin(); it != this->links_.end(); )
    59                 delete (*(it++));
     59                (*(it++))->destroy();
    6060        }
    6161    }
  • code/branches/pickup/src/orxonox/weaponsystem/WeaponSlot.cc

    r5781 r5935  
    4646        this->weapon_ = 0;
    4747
    48         this->setObjectMode(0x0);
     48        this->setSyncMode(0x0);
    4949    }
    5050
  • code/branches/pickup/src/orxonox/weaponsystem/WeaponSystem.cc

    r5781 r5935  
    6262
    6363            while (!this->weaponSets_.empty())
    64                 delete (this->weaponSets_.begin()->second);
     64                this->weaponSets_.begin()->second->destroy();
    6565
    6666            while (!this->weaponPacks_.empty())
    67                 delete (*this->weaponPacks_.begin());
     67                (*this->weaponPacks_.begin())->destroy();
    6868
    6969            while (!this->weaponSlots_.empty())
    70                 delete (*this->weaponSlots_.begin());
     70                (*this->weaponSlots_.begin())->destroy();
    7171
    7272            while (!this->munitions_.empty())
    73                 { delete (this->munitions_.begin()->second); this->munitions_.erase(this->munitions_.begin()); }
     73                { this->munitions_.begin()->second->destroy(); this->munitions_.erase(this->munitions_.begin()); }
    7474        }
    7575    }
  • code/branches/pickup/src/orxonox/worldentities/BigExplosion.cc

    r5781 r5935  
    9090            this->setVelocity(velocity);
    9191
    92             this->destroyTimer_.setTimer(rnd(2, 4), false, this, createExecutor(createFunctor(&BigExplosion::stop)));
     92            this->destroyTimer_.setTimer(rnd(2, 4), false, createExecutor(createFunctor(&BigExplosion::stop, this)));
    9393        }
    9494        this->registerVariables();
     
    226226            {
    227227                this->debris1_->detachOgreObject(this->debrisFire1_->getParticleSystem());
    228                 delete this->debrisFire1_;
     228                this->debrisFire1_->destroy();
    229229            }
    230230            if (this->debrisSmoke1_)
    231231            {
    232232                this->debris1_->detachOgreObject(this->debrisSmoke1_->getParticleSystem());
    233                 delete this->debrisSmoke1_;
     233                this->debrisSmoke1_->destroy();
    234234            }
    235235
     
    237237            {
    238238                this->debris2_->detachOgreObject(this->debrisFire2_->getParticleSystem());
    239                 delete this->debrisFire2_;
     239                this->debrisFire2_->destroy();
    240240            }
    241241            if (this->debrisSmoke2_)
    242242            {
    243243                this->debris2_->detachOgreObject(this->debrisSmoke2_->getParticleSystem());
    244                 delete this->debrisSmoke2_;
     244                this->debrisSmoke2_->destroy();
    245245            }
    246246
     
    248248            {
    249249                this->debris3_->detachOgreObject(this->debrisFire3_->getParticleSystem());
    250                 delete this->debrisFire3_;
     250                this->debrisFire3_->destroy();
    251251            }
    252252            if (this->debrisSmoke3_)
    253253            {
    254254                this->debris3_->detachOgreObject(this->debrisSmoke3_->getParticleSystem());
    255                 delete this->debrisSmoke3_;
     255                this->debrisSmoke3_->destroy();
    256256            }
    257257
     
    259259            {
    260260                this->debris4_->detachOgreObject(this->debrisFire4_->getParticleSystem());
    261                 delete this->debrisFire4_;
     261                this->debrisFire4_->destroy();
    262262            }
    263263            if (this->debrisSmoke4_)
    264264            {
    265265                this->debris4_->detachOgreObject(this->debrisSmoke4_->getParticleSystem());
    266                 delete this->debrisSmoke4_;
     266                this->debrisSmoke4_->destroy();
    267267            }
    268268        }
     
    329329        {
    330330            this->bStop_ = true;
    331             this->destroyTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&BigExplosion::destroy)));
    332         }
    333     }
    334 
    335     void BigExplosion::destroy()
    336     {
    337         delete this;
     331            this->destroyTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&BigExplosion::destroy, this)));
     332        }
    338333    }
    339334
  • code/branches/pickup/src/orxonox/worldentities/BigExplosion.h

    r5781 r5935  
    5757            void checkStop();
    5858            void stop();
    59             void destroy();
    6059            void init();
    6160            void initZero();
     
    9897            ParticleInterface*    explosionFire_;
    9998
    100             LODParticle::Value      LOD_;
    101             Timer<BigExplosion> destroyTimer_;
     99            LODParticle::Value    LOD_;
     100            Timer                destroyTimer_;
    102101    };
    103102}
  • code/branches/pickup/src/orxonox/worldentities/CameraPosition.cc

    r5781 r5935  
    4646        this->bRenderCamera_ = false;
    4747
    48         this->setObjectMode(0x0);
     48        this->setSyncMode(0x0);
    4949    }
    5050
  • code/branches/pickup/src/orxonox/worldentities/ControllableEntity.cc

    r5781 r5935  
    9696
    9797            if (this->xmlcontroller_)
    98                 delete this->xmlcontroller_;
     98                this->xmlcontroller_->destroy();
    9999
    100100            if (this->hud_)
    101                 delete this->hud_;
     101                this->hud_->destroy();
    102102
    103103            if (this->camera_)
    104                 delete this->camera_;
    105 
    106             for (std::list<CameraPosition*>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    107                 delete (*it);
     104                this->camera_->destroy();
     105
     106            for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     107                (*it)->destroy();
    108108
    109109            if (this->getScene()->getSceneManager())
     
    153153    {
    154154        unsigned int i = 0;
    155         for (std::list<CameraPosition*>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     155        for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    156156        {
    157157            if (i == index)
     
    172172            else if (this->cameraPositions_.size() > 0)
    173173            {
    174                 for (std::list<CameraPosition*>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     174                for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    175175                {
    176176                    if ((*it) == this->camera_->getParent())
     
    238238            {
    239239                this->client_overwrite_ = this->server_overwrite_;
    240                 this->setObjectMode(ObjectDirection::Bidirectional);
     240                this->setSyncMode(ObjectDirection::Bidirectional);
    241241            }
    242242        }
     
    254254        this->bHasLocalController_ = false;
    255255        this->bHasHumanController_ = false;
    256         this->setObjectMode(ObjectDirection::ToClient);
     256        this->setSyncMode(ObjectDirection::ToClient);
    257257
    258258        this->changedPlayer();
    259259
    260260        if (this->bDestroyWhenPlayerLeft_)
    261             delete this;
     261            this->destroy();
    262262    }
    263263
     
    275275    void ControllableEntity::startLocalHumanControl()
    276276    {
    277         if (!this->camera_)
     277        if (!this->camera_ && GameMode::showsGraphics())
    278278        {
    279279            this->camera_ = new Camera(this);
     
    287287        }
    288288
    289         if (!this->hud_)
     289        if (!this->hud_ && GameMode::showsGraphics())
    290290        {
    291291            if (this->hudtemplate_ != "")
     
    303303        {
    304304            this->camera_->detachFromParent();
    305             delete this->camera_;
     305            this->camera_->destroy();
    306306            this->camera_ = 0;
    307307        }
     
    309309        if (this->hud_)
    310310        {
    311             delete this->hud_;
     311            this->hud_->destroy();
    312312            this->hud_ = 0;
    313313        }
     
    333333        if (parent)
    334334        {
    335             for (std::list<CameraPosition*>::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     335            for (std::list<SmartPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    336336                if ((*it)->getIsAbsolute())
    337337                    parent->attach((*it));
  • code/branches/pickup/src/orxonox/worldentities/ControllableEntity.h

    r5781 r5935  
    104104            void addCameraPosition(CameraPosition* position);
    105105            CameraPosition* getCameraPosition(unsigned int index) const;
    106             inline const std::list<CameraPosition*>& getCameraPositions() const
     106            inline const std::list<SmartPtr<CameraPosition> >& getCameraPositions() const
    107107                { return this->cameraPositions_; }
    108108
     
    198198            float mouseLookSpeed_;
    199199            Ogre::SceneNode* cameraPositionRootNode_;
    200             std::list<CameraPosition*> cameraPositions_;
     200            std::list<SmartPtr<CameraPosition> > cameraPositions_;
    201201            std::string cameraPositionTemplate_;
    202202            Controller* xmlcontroller_;
  • code/branches/pickup/src/orxonox/worldentities/ExplosionChunk.cc

    r5781 r5935  
    7979            this->setVelocity(velocity);
    8080
    81             this->destroyTimer_.setTimer(rnd(1, 2), false, this, createExecutor(createFunctor(&ExplosionChunk::stop)));
     81            this->destroyTimer_.setTimer(rnd(1, 2), false, createExecutor(createFunctor(&ExplosionChunk::stop, this)));
    8282        }
    8383
     
    9292            {
    9393                this->detachOgreObject(this->fire_->getParticleSystem());
    94                 delete this->fire_;
     94                this->fire_->destroy();
    9595            }
    9696            if (this->smoke_)
    9797            {
    9898                this->detachOgreObject(this->smoke_->getParticleSystem());
    99                 delete this->smoke_;
     99                this->smoke_->destroy();
    100100            }
    101101        }
     
    132132        {
    133133            this->bStop_ = true;
    134             this->destroyTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&ExplosionChunk::destroy)));
     134            this->destroyTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&ExplosionChunk::destroy, this)));
    135135        }
    136     }
    137 
    138     void ExplosionChunk::destroy()
    139     {
    140         delete this;
    141136    }
    142137
  • code/branches/pickup/src/orxonox/worldentities/ExplosionChunk.h

    r5781 r5935  
    5555            void checkStop();
    5656            void stop();
    57             void destroy();
    5857
    5958            bool                  bStop_;
    6059            ParticleInterface*    fire_;
    6160            ParticleInterface*    smoke_;
    62             LODParticle::Value      LOD_;
    63             Timer<ExplosionChunk> destroyTimer_;
     61            LODParticle::Value    LOD_;
     62            Timer                destroyTimer_;
    6463    };
    6564}
  • code/branches/pickup/src/orxonox/worldentities/MovableEntity.cc

    r5781 r5935  
    6161        if (this->isInitialized())
    6262            if (this->continuousResynchroTimer_)
    63                 delete this->continuousResynchroTimer_;
     63                this->continuousResynchroTimer_->destroy();
    6464    }
    6565
     
    9898    void MovableEntity::clientConnected(unsigned int clientID)
    9999    {
    100         this->resynchronizeTimer_.setTimer(rnd() * MAX_RESYNCHRONIZE_TIME, false, this, createExecutor(createFunctor(&MovableEntity::resynchronize)));
     100        this->resynchronizeTimer_.setTimer(rnd() * MAX_RESYNCHRONIZE_TIME, false, createExecutor(createFunctor(&MovableEntity::resynchronize, this)));
    101101    }
    102102
     
    110110        {
    111111            // Resynchronise every few seconds because we only work with velocities (no positions)
    112             continuousResynchroTimer_ = new Timer<MovableEntity>(CONTINUOUS_SYNCHRONIZATION_TIME + rnd(-1, 1),
    113                 true, this, createExecutor(createFunctor(&MovableEntity::resynchronize)), false);
     112            continuousResynchroTimer_ = new Timer(CONTINUOUS_SYNCHRONIZATION_TIME + rnd(-1, 1),
     113                true, createExecutor(createFunctor(&MovableEntity::resynchronize, this)), false);
    114114        }
    115115
  • code/branches/pickup/src/orxonox/worldentities/MovableEntity.h

    r5781 r5935  
    9696            Quaternion overwrite_orientation_;
    9797
    98             Timer<MovableEntity> resynchronizeTimer_;
    99             Timer<MovableEntity>* continuousResynchroTimer_;
     98            Timer resynchronizeTimer_;
     99            Timer* continuousResynchroTimer_;
    100100
    101101            Pawn* owner_;
  • code/branches/pickup/src/orxonox/worldentities/SpawnPoint.cc

    r5781 r5935  
    5050            COUT(1) << "Error: SpawnPoint has no Gametype" << std::endl;
    5151
    52         this->setObjectMode(0x0);
     52        this->setSyncMode(0x0);
    5353    }
    5454
  • code/branches/pickup/src/orxonox/worldentities/SpawnPoint.h

    r5781 r5935  
    3333
    3434#include <string>
    35 #include "core/Identifier.h"
     35#include "core/SubclassIdentifier.h"
    3636#include "worldentities/StaticEntity.h"
    3737
  • code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc

    r5781 r5935  
    119119            {
    120120                if ((*it)->getDeleteWithParent())
    121                     delete (*(it++));
     121                    (*(it++))->destroy();
    122122                else
    123123                {
     
    132132                delete this->physicalBody_;
    133133            }
    134             delete this->collisionShape_;
     134            this->collisionShape_->destroy();
    135135
    136136            this->node_->detachAllObjects();
     
    175175    void WorldEntity::registerVariables()
    176176    {
    177         registerVariable(this->mainStateName_,  VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedMainState));
     177        registerVariable(this->mainStateName_,  VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedMainStateName));
    178178
    179179        registerVariable(this->bActive_,        VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity));
  • code/branches/pickup/src/orxonox/worldentities/pawns/Destroyer.cc

    r5781 r5935  
    4040        RegisterObject(Destroyer);
    4141
    42         UnderAttack* gametype = orxonox_cast<UnderAttack*>(this->getGametype());
     42        UnderAttack* gametype = orxonox_cast<UnderAttack*>(this->getGametype().get());
    4343        if (gametype)
    4444        {
  • code/branches/pickup/src/orxonox/worldentities/pawns/Pawn.cc

    r5781 r5935  
    3636#include "network/NetworkFunction.h"
    3737
    38 #include "interfaces/PawnListener.h"
    3938#include "PawnManager.h"
    4039#include "infos/PlayerInfo.h"
     
    9392        if (this->isInitialized())
    9493        {
    95             for (ObjectList<PawnListener>::iterator it = ObjectList<PawnListener>::begin(); it != ObjectList<PawnListener>::end(); ++it)
    96                 it->destroyedPawn(this);
    97 
    9894            if (this->weaponSystem_)
    99                 delete this->weaponSystem_;
     95                this->weaponSystem_->destroy();
    10096        }
    10197    }
  • code/branches/pickup/src/orxonox/worldentities/pawns/SpaceShip.cc

    r5781 r5935  
    7575    {
    7676        if (this->isInitialized() && this->engine_)
    77             delete this->engine_;
     77            this->engine_->destroy();
    7878    }
    7979
     
    207207                    else
    208208                    {
    209                         delete object;
     209                        object->destroy();
    210210                    }
    211211                }
  • code/branches/pickup/src/orxonox/worldentities/pawns/Spectator.cc

    r5781 r5935  
    145145        ControllableEntity::setPlayer(player);
    146146
    147 //        this->setObjectMode(ObjectDirection::ToClient);
     147//        this->setSyncMode(ObjectDirection::ToClient);
    148148    }
    149149
  • code/branches/pickup/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc

    r5781 r5935  
    3131
    3232#include "core/CoreIncludes.h"
    33 #include "interfaces/PawnListener.h"
     33#include "controllers/ArtificialController.h"
    3434#include "interfaces/TeamColourable.h"
    3535#include "gametypes/TeamBaseMatch.h"
     
    4545        this->state_ = BaseState::Uncontrolled;
    4646
    47         TeamBaseMatch* gametype = orxonox_cast<TeamBaseMatch*>(this->getGametype());
     47        TeamBaseMatch* gametype = orxonox_cast<TeamBaseMatch*>(this->getGametype().get());
    4848        if (gametype)
    4949        {
     
    5858        this->fireEvent();
    5959
    60         TeamDeathmatch* gametype = orxonox_cast<TeamDeathmatch*>(this->getGametype());
     60        TeamDeathmatch* gametype = orxonox_cast<TeamDeathmatch*>(this->getGametype().get());
    6161        if (!gametype)
    6262            return;
     
    9292
    9393        // Call this so bots stop shooting at the base after they converted it
    94         for (ObjectList<PawnListener>::iterator it = ObjectList<PawnListener>::begin(); it != ObjectList<PawnListener>::end(); ++it)
    95             it->destroyedPawn(this);
     94        for (ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it != ObjectList<ArtificialController>::end(); ++it)
     95            it->abandonTarget(this);
    9696    }
    9797}
Note: See TracChangeset for help on using the changeset viewer.