Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/invader/Invader.cc

    r11052 r11071  
    6161        RegisterObject(Invader);
    6262        this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
    63         this->center_ = 0;
     63        this->center_ = nullptr;
    6464        bEndGame = false;
    6565        lives = 3;
     
    7878    {
    7979        level++;
    80         if (getPlayer() != NULL)
     80        if (getPlayer() != nullptr)
    8181        {
    8282            for (int i = 0; i < 7; i++)
     
    103103    InvaderShip* Invader::getPlayer()
    104104    {
    105         if (player == NULL)
     105        if (player == nullptr)
    106106        {
    107             for (ObjectList<InvaderShip>::iterator it = ObjectList<InvaderShip>::begin(); it != ObjectList<InvaderShip>::end(); ++it)
    108                 player = *it;
     107            for (InvaderShip* ship : ObjectList<InvaderShip>())
     108                player = ship;
    109109        }
    110110        return player;
     
    113113    void Invader::spawnEnemy()
    114114    {
    115         if (getPlayer() == NULL)
     115        if (getPlayer() == nullptr)
    116116            return;
    117117
     
    134134            newPawn->setPosition(player->getPosition() + Vector3(500.f + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200));
    135135        }
     136    }
     137
     138    void Invader::setCenterpoint(InvaderCenterPoint* center)
     139    {
     140        this->center_ = center;
    136141    }
    137142
     
    160165        this->bForceSpawn_ = true;
    161166
    162         if (this->center_ == NULL)  // abandon mission!
     167        if (this->center_ == nullptr)  // abandon mission!
    163168        {
    164169            orxout(internal_error) << "Invader: No Centerpoint specified." << endl;
  • code/trunk/src/modules/invader/Invader.h

    r10624 r11071  
    3939
    4040#include "gametypes/Deathmatch.h"
    41 
    42 #include "InvaderCenterPoint.h"
    43 
    4441#include "tools/Timer.h"
    4542
     
    5249            Invader(Context* context);
    5350
    54             virtual void start();
    55             virtual void end();
    56             virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command
     51            virtual void start() override;
     52            virtual void end() override;
     53            virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
    5754
    5855            void spawnEnemy();
    5956
    60             void setCenterpoint(InvaderCenterPoint* center)
    61             { this->center_ = center; }
     57            void setCenterpoint(InvaderCenterPoint* center);
    6258
    6359            int getLives(){return this->lives;}
  • code/trunk/src/modules/invader/InvaderCenterPoint.cc

    r10624 r11071  
    4949    }
    5050
    51     void InvaderCenterPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    52     {
    53         SUPER(InvaderCenterPoint, XMLPort, xmlelement, mode);
    54     }
    55 
    5651    void InvaderCenterPoint::checkGametype()
    5752    {
    58         if (this->getGametype() != NULL && this->getGametype()->isA(Class(Invader)))
     53        if (this->getGametype() != nullptr && this->getGametype()->isA(Class(Invader)))
    5954        {
    6055            Invader* InvaderGametype = orxonox_cast<Invader*>(this->getGametype());
  • code/trunk/src/modules/invader/InvaderCenterPoint.h

    r10624 r11071  
    4747            InvaderCenterPoint(Context* context); //checks whether the gametype is actually Invader.
    4848
    49             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    50 
    5149        private:
    5250            void checkGametype();
  • code/trunk/src/modules/invader/InvaderEnemy.cc

    r10625 r11071  
    3232*/
    3333
    34 #include "invader/InvaderPrereqs.h"
    3534#include "InvaderEnemy.h"
     35
     36#include "core/CoreIncludes.h"
     37#include "Invader.h"
    3638#include "InvaderShip.h"
    3739
     
    5456            removeHealth(2000);
    5557
    56         if (player != NULL)
     58        if (player != nullptr)
    5759        {
    5860            float newZ = 2/(pow(abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * (player->getPosition().z - getPosition().z);
     
    6264    }
    6365
    64     inline bool InvaderEnemy::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     66    inline bool InvaderEnemy::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
    6567    {
    6668        if(orxonox_cast<InvaderShip*>(otherObject))
     
    7173    Invader* InvaderEnemy::getGame()
    7274    {
    73         if (game == NULL)
     75        if (game == nullptr)
    7476        {
    75             for (ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)
    76                 game = *it;
     77            for (Invader* invader : ObjectList<Invader>())
     78                game = invader;
    7779        }
    7880        return game;
     
    8284    {
    8385        Pawn::damage(damage, healthdamage, shielddamage, originator, cs);
    84         if (getGame() && orxonox_cast<InvaderShip*>(originator) != NULL && getHealth() <= 0)
     86        if (getGame() && orxonox_cast<InvaderShip*>(originator) != nullptr && getHealth() <= 0)
    8587            getGame()->addPoints(42);
    8688    }
  • code/trunk/src/modules/invader/InvaderEnemy.h

    r10625 r11071  
    3737#include "invader/InvaderPrereqs.h"
    3838
    39 #include "worldentities/pawns/SpaceShip.h"
     39#include "worldentities/pawns/Pawn.h"
    4040
    4141namespace orxonox
     
    4646            InvaderEnemy(Context* context);
    4747
    48             virtual void tick(float dt);
    49             virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    50             virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs);
     48            virtual void tick(float dt) override;
     49            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
     50            virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) override;
    5151            virtual void setPlayer(InvaderShip* player){this->player = player;}
    5252
  • code/trunk/src/modules/invader/InvaderEnemyShooter.cc

    r10628 r11071  
    3232*/
    3333
    34 #include "invader/InvaderPrereqs.h"
    3534#include "InvaderEnemyShooter.h"
    36 // #include "worldentities/pawns/SpaceShip.h"
     35
     36#include "core/CoreIncludes.h"
     37#include "core/command/Executor.h"
     38#include "Invader.h"
     39#include "InvaderShip.h"
    3740
    3841namespace orxonox
     
    5659            removeHealth(2000);
    5760
    58         if (player != NULL)
     61        if (player != nullptr)
    5962        {
    6063            float distPlayer = player->getPosition().z - getPosition().z;
     
    7477    {
    7578        Pawn::damage(damage, healthdamage, shielddamage, originator, cs);
    76         if (getGame() && orxonox_cast<InvaderShip*>(originator) != NULL && getHealth() <= 0)
     79        if (getGame() && orxonox_cast<InvaderShip*>(originator) != nullptr && getHealth() <= 0)
    7780            getGame()->addPoints(3*42);
    7881    }
  • code/trunk/src/modules/invader/InvaderEnemyShooter.h

    r10626 r11071  
    4747            InvaderEnemyShooter(Context* context);
    4848
    49             virtual void tick(float dt);
    50             virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs);
     49            virtual void tick(float dt) override;
     50            virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) override;
    5151        protected:
    5252            void shoot();
  • code/trunk/src/modules/invader/InvaderHUDinfo.cc

    r10624 r11071  
    3030#include "core/XMLPort.h"
    3131#include "util/Convert.h"
    32 // #include "Invader.h"
     32#include "Invader.h"
    3333
    3434namespace orxonox
     
    4040        RegisterObject(InvaderHUDinfo);
    4141
    42         this->InvaderGame = 0;
     42        this->InvaderGame = nullptr;
    4343        this->bShowLives_ = false;
    4444        this->bShowLevel_ = false;
     
    132132        else
    133133        {
    134             this->InvaderGame = 0;
     134            this->InvaderGame = nullptr;
    135135        }
    136136    }
  • code/trunk/src/modules/invader/InvaderHUDinfo.h

    r9957 r11071  
    4040            InvaderHUDinfo(Context* context);
    4141
    42             virtual void tick(float dt);
    43             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    44             virtual void changedOwner();
     42            virtual void tick(float dt) override;
     43            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     44            virtual void changedOwner() override;
    4545
    4646            inline void setShowLives(bool value)
  • code/trunk/src/modules/invader/InvaderShip.cc

    r10624 r11071  
    3737#include "core/XMLPort.h"
    3838#include "Invader.h"
     39#include "InvaderEnemy.h"
     40#include "graphics/Camera.h"
     41#include "weapons/projectiles/Projectile.h"
    3942
    4043namespace orxonox
     
    9295        // Camera
    9396        Camera* camera = this->getCamera();
    94         if (camera != NULL)
     97        if (camera != nullptr)
    9598        {
    9699            camera->setPosition(Vector3(-pos.z, -posforeward, 0));
     
    139142        isFireing = bBoost;
    140143    }
    141     inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     144    void InvaderShip::rotateRoll(const Vector2& value)
     145    {
     146        if (getGame())
     147            if (getGame()->bEndGame)
     148                getGame()->end();
     149    }
     150    inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
    142151    {
    143152        // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint;
     
    145154        Projectile* shot = orxonox_cast<Projectile*>(otherObject);
    146155        // ensure that this gets only called once per enemy.
    147         if (enemy != NULL && lastEnemy != enemy)
     156        if (enemy != nullptr && lastEnemy != enemy)
    148157        {
    149158            lastEnemy = enemy;
     
    156165        }
    157166        // was shot, decrease multiplier
    158         else if (shot != NULL  && lastShot != shot)
     167        else if (shot != nullptr  && lastShot != shot)
    159168        {
    160             if (getGame() && orxonox_cast<InvaderEnemy*>(shot->getShooter()) != NULL)
     169            if (getGame() && orxonox_cast<InvaderEnemy*>(shot->getShooter()) != nullptr)
    161170            {
    162171                if (getGame()->multiplier > 1)
     
    173182    Invader* InvaderShip::getGame()
    174183    {
    175         if (game == NULL)
     184        if (game == nullptr)
    176185        {
    177             for (ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)
    178                 game = *it;
     186            for (Invader* invader : ObjectList<Invader>())
     187                game = invader;
    179188        }
    180189        return game;
  • code/trunk/src/modules/invader/InvaderShip.h

    r10624 r11071  
    3737#include "invader/InvaderPrereqs.h"
    3838
     39#include "weapons/WeaponsPrereqs.h"
    3940#include "worldentities/pawns/SpaceShip.h"
    40 #include "graphics/Camera.h"
    41 #include "weapons/projectiles/Projectile.h"
    4241
    4342namespace orxonox
     
    4847            InvaderShip(Context* context);
    4948
    50             virtual void tick(float dt);
     49            virtual void tick(float dt) override;
    5150
    5251            // overwrite for 2d movement
    53             virtual void moveFrontBack(const Vector2& value);
    54             virtual void moveRightLeft(const Vector2& value);
     52            virtual void moveFrontBack(const Vector2& value) override;
     53            virtual void moveRightLeft(const Vector2& value) override;
    5554
    5655            // Starts or stops fireing
    57             virtual void boost(bool bBoost);
     56            virtual void boost(bool bBoost) override;
    5857
    5958            //no rotation!
    60             virtual void rotateYaw(const Vector2& value){};
    61             virtual void rotatePitch(const Vector2& value){};
     59            virtual void rotateYaw(const Vector2& value) override{};
     60            virtual void rotatePitch(const Vector2& value) override{};
    6261            //return to main menu if game has ended.
    63             virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();};
     62            virtual void rotateRoll(const Vector2& value) override;
    6463
    6564            virtual void updateLevel();
    6665
    67             virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     66            virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    6867
    6968        protected:
    70             virtual void death();
     69            virtual void death() override;
    7170        private:
    7271            Invader* getGame();
  • code/trunk/src/modules/invader/InvaderWeapon.h

    r9943 r11071  
    3535#define _InvaderWeapon_H__
    3636
     37#include "invader/InvaderPrereqs.h"
     38
     39#include "weapons/WeaponsPrereqs.h"
    3740#include "weapons/weaponmodes/HsW01.h"
    38 #include "weapons/WeaponsPrereqs.h"
    39 
    40 #include "tools/Timer.h"
    4141
    4242namespace orxonox
     
    4848            virtual ~InvaderWeapon();
    4949        protected:
    50             virtual void shot();
     50            virtual void shot() override;
    5151            WeakPtr<Projectile> projectile;
    5252    };
  • code/trunk/src/modules/invader/InvaderWeaponEnemy.cc

    r9945 r11071  
    3434#include "InvaderWeaponEnemy.h"
    3535
     36#include "core/CoreIncludes.h"
     37#include "weapons/projectiles/Projectile.h"
     38
    3639namespace orxonox
    3740{
  • code/trunk/src/modules/invader/InvaderWeaponEnemy.h

    r9943 r11071  
    3535#define _InvaderWeaponEnemy_H__
    3636
    37 // #include "weapons/weaponmodes/HsW01.h"
    38 // #include "weapons/WeaponsPrereqs.h"
    39 #include "invader/InvaderWeapon.h"
     37#include "invader/InvaderPrereqs.h"
     38
     39#include "InvaderWeapon.h"
    4040#include "tools/Timer.h"
    4141
     
    4747            InvaderWeaponEnemy(Context* context);
    4848        protected:
    49             virtual void shot();
     49            virtual void shot() override;
    5050    };
    5151}
Note: See TracChangeset for help on using the changeset viewer.