Changeset 11071 for code/trunk/src/modules/invader
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/invader/Invader.cc
r11052 r11071 61 61 RegisterObject(Invader); 62 62 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 63 this->center_ = 0;63 this->center_ = nullptr; 64 64 bEndGame = false; 65 65 lives = 3; … … 78 78 { 79 79 level++; 80 if (getPlayer() != NULL)80 if (getPlayer() != nullptr) 81 81 { 82 82 for (int i = 0; i < 7; i++) … … 103 103 InvaderShip* Invader::getPlayer() 104 104 { 105 if (player == NULL)105 if (player == nullptr) 106 106 { 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; 109 109 } 110 110 return player; … … 113 113 void Invader::spawnEnemy() 114 114 { 115 if (getPlayer() == NULL)115 if (getPlayer() == nullptr) 116 116 return; 117 117 … … 134 134 newPawn->setPosition(player->getPosition() + Vector3(500.f + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200)); 135 135 } 136 } 137 138 void Invader::setCenterpoint(InvaderCenterPoint* center) 139 { 140 this->center_ = center; 136 141 } 137 142 … … 160 165 this->bForceSpawn_ = true; 161 166 162 if (this->center_ == NULL) // abandon mission!167 if (this->center_ == nullptr) // abandon mission! 163 168 { 164 169 orxout(internal_error) << "Invader: No Centerpoint specified." << endl; -
code/trunk/src/modules/invader/Invader.h
r10624 r11071 39 39 40 40 #include "gametypes/Deathmatch.h" 41 42 #include "InvaderCenterPoint.h"43 44 41 #include "tools/Timer.h" 45 42 … … 52 49 Invader(Context* context); 53 50 54 virtual void start() ;55 virtual void end() ;56 virtual void addBots(unsigned int amount) {} //<! overwrite function in order to bypass the addbots command51 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 57 54 58 55 void spawnEnemy(); 59 56 60 void setCenterpoint(InvaderCenterPoint* center) 61 { this->center_ = center; } 57 void setCenterpoint(InvaderCenterPoint* center); 62 58 63 59 int getLives(){return this->lives;} -
code/trunk/src/modules/invader/InvaderCenterPoint.cc
r10624 r11071 49 49 } 50 50 51 void InvaderCenterPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)52 {53 SUPER(InvaderCenterPoint, XMLPort, xmlelement, mode);54 }55 56 51 void InvaderCenterPoint::checkGametype() 57 52 { 58 if (this->getGametype() != NULL&& this->getGametype()->isA(Class(Invader)))53 if (this->getGametype() != nullptr && this->getGametype()->isA(Class(Invader))) 59 54 { 60 55 Invader* InvaderGametype = orxonox_cast<Invader*>(this->getGametype()); -
code/trunk/src/modules/invader/InvaderCenterPoint.h
r10624 r11071 47 47 InvaderCenterPoint(Context* context); //checks whether the gametype is actually Invader. 48 48 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);50 51 49 private: 52 50 void checkGametype(); -
code/trunk/src/modules/invader/InvaderEnemy.cc
r10625 r11071 32 32 */ 33 33 34 #include "invader/InvaderPrereqs.h"35 34 #include "InvaderEnemy.h" 35 36 #include "core/CoreIncludes.h" 37 #include "Invader.h" 36 38 #include "InvaderShip.h" 37 39 … … 54 56 removeHealth(2000); 55 57 56 if (player != NULL)58 if (player != nullptr) 57 59 { 58 60 float newZ = 2/(pow(abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * (player->getPosition().z - getPosition().z); … … 62 64 } 63 65 64 inline bool InvaderEnemy::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)66 inline bool InvaderEnemy::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 65 67 { 66 68 if(orxonox_cast<InvaderShip*>(otherObject)) … … 71 73 Invader* InvaderEnemy::getGame() 72 74 { 73 if (game == NULL)75 if (game == nullptr) 74 76 { 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; 77 79 } 78 80 return game; … … 82 84 { 83 85 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) 85 87 getGame()->addPoints(42); 86 88 } -
code/trunk/src/modules/invader/InvaderEnemy.h
r10625 r11071 37 37 #include "invader/InvaderPrereqs.h" 38 38 39 #include "worldentities/pawns/ SpaceShip.h"39 #include "worldentities/pawns/Pawn.h" 40 40 41 41 namespace orxonox … … 46 46 InvaderEnemy(Context* context); 47 47 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; 51 51 virtual void setPlayer(InvaderShip* player){this->player = player;} 52 52 -
code/trunk/src/modules/invader/InvaderEnemyShooter.cc
r10628 r11071 32 32 */ 33 33 34 #include "invader/InvaderPrereqs.h"35 34 #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" 37 40 38 41 namespace orxonox … … 56 59 removeHealth(2000); 57 60 58 if (player != NULL)61 if (player != nullptr) 59 62 { 60 63 float distPlayer = player->getPosition().z - getPosition().z; … … 74 77 { 75 78 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) 77 80 getGame()->addPoints(3*42); 78 81 } -
code/trunk/src/modules/invader/InvaderEnemyShooter.h
r10626 r11071 47 47 InvaderEnemyShooter(Context* context); 48 48 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; 51 51 protected: 52 52 void shoot(); -
code/trunk/src/modules/invader/InvaderHUDinfo.cc
r10624 r11071 30 30 #include "core/XMLPort.h" 31 31 #include "util/Convert.h" 32 //#include "Invader.h"32 #include "Invader.h" 33 33 34 34 namespace orxonox … … 40 40 RegisterObject(InvaderHUDinfo); 41 41 42 this->InvaderGame = 0;42 this->InvaderGame = nullptr; 43 43 this->bShowLives_ = false; 44 44 this->bShowLevel_ = false; … … 132 132 else 133 133 { 134 this->InvaderGame = 0;134 this->InvaderGame = nullptr; 135 135 } 136 136 } -
code/trunk/src/modules/invader/InvaderHUDinfo.h
r9957 r11071 40 40 InvaderHUDinfo(Context* context); 41 41 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; 45 45 46 46 inline void setShowLives(bool value) -
code/trunk/src/modules/invader/InvaderShip.cc
r10624 r11071 37 37 #include "core/XMLPort.h" 38 38 #include "Invader.h" 39 #include "InvaderEnemy.h" 40 #include "graphics/Camera.h" 41 #include "weapons/projectiles/Projectile.h" 39 42 40 43 namespace orxonox … … 92 95 // Camera 93 96 Camera* camera = this->getCamera(); 94 if (camera != NULL)97 if (camera != nullptr) 95 98 { 96 99 camera->setPosition(Vector3(-pos.z, -posforeward, 0)); … … 139 142 isFireing = bBoost; 140 143 } 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) 142 151 { 143 152 // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint; … … 145 154 Projectile* shot = orxonox_cast<Projectile*>(otherObject); 146 155 // ensure that this gets only called once per enemy. 147 if (enemy != NULL&& lastEnemy != enemy)156 if (enemy != nullptr && lastEnemy != enemy) 148 157 { 149 158 lastEnemy = enemy; … … 156 165 } 157 166 // was shot, decrease multiplier 158 else if (shot != NULL&& lastShot != shot)167 else if (shot != nullptr && lastShot != shot) 159 168 { 160 if (getGame() && orxonox_cast<InvaderEnemy*>(shot->getShooter()) != NULL)169 if (getGame() && orxonox_cast<InvaderEnemy*>(shot->getShooter()) != nullptr) 161 170 { 162 171 if (getGame()->multiplier > 1) … … 173 182 Invader* InvaderShip::getGame() 174 183 { 175 if (game == NULL)184 if (game == nullptr) 176 185 { 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; 179 188 } 180 189 return game; -
code/trunk/src/modules/invader/InvaderShip.h
r10624 r11071 37 37 #include "invader/InvaderPrereqs.h" 38 38 39 #include "weapons/WeaponsPrereqs.h" 39 40 #include "worldentities/pawns/SpaceShip.h" 40 #include "graphics/Camera.h"41 #include "weapons/projectiles/Projectile.h"42 41 43 42 namespace orxonox … … 48 47 InvaderShip(Context* context); 49 48 50 virtual void tick(float dt) ;49 virtual void tick(float dt) override; 51 50 52 51 // 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; 55 54 56 55 // Starts or stops fireing 57 virtual void boost(bool bBoost) ;56 virtual void boost(bool bBoost) override; 58 57 59 58 //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{}; 62 61 //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; 64 63 65 64 virtual void updateLevel(); 66 65 67 virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);66 virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 68 67 69 68 protected: 70 virtual void death() ;69 virtual void death() override; 71 70 private: 72 71 Invader* getGame(); -
code/trunk/src/modules/invader/InvaderWeapon.h
r9943 r11071 35 35 #define _InvaderWeapon_H__ 36 36 37 #include "invader/InvaderPrereqs.h" 38 39 #include "weapons/WeaponsPrereqs.h" 37 40 #include "weapons/weaponmodes/HsW01.h" 38 #include "weapons/WeaponsPrereqs.h"39 40 #include "tools/Timer.h"41 41 42 42 namespace orxonox … … 48 48 virtual ~InvaderWeapon(); 49 49 protected: 50 virtual void shot() ;50 virtual void shot() override; 51 51 WeakPtr<Projectile> projectile; 52 52 }; -
code/trunk/src/modules/invader/InvaderWeaponEnemy.cc
r9945 r11071 34 34 #include "InvaderWeaponEnemy.h" 35 35 36 #include "core/CoreIncludes.h" 37 #include "weapons/projectiles/Projectile.h" 38 36 39 namespace orxonox 37 40 { -
code/trunk/src/modules/invader/InvaderWeaponEnemy.h
r9943 r11071 35 35 #define _InvaderWeaponEnemy_H__ 36 36 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" 40 40 #include "tools/Timer.h" 41 41 … … 47 47 InvaderWeaponEnemy(Context* context); 48 48 protected: 49 virtual void shot() ;49 virtual void shot() override; 50 50 }; 51 51 }
Note: See TracChangeset
for help on using the changeset viewer.