[Orxonox-commit 6384] r11041 - code/branches/presentationHS15/src/modules/hover

landauf at orxonox.net landauf at orxonox.net
Mon Jan 4 18:19:07 CET 2016


Author: landauf
Date: 2016-01-04 18:19:07 +0100 (Mon, 04 Jan 2016)
New Revision: 11041

Modified:
   code/branches/presentationHS15/src/modules/hover/FlagHUD.cc
   code/branches/presentationHS15/src/modules/hover/FlagHUD.h
   code/branches/presentationHS15/src/modules/hover/Hover.cc
   code/branches/presentationHS15/src/modules/hover/Hover.h
   code/branches/presentationHS15/src/modules/hover/HoverFlag.cc
   code/branches/presentationHS15/src/modules/hover/HoverFlag.h
   code/branches/presentationHS15/src/modules/hover/HoverOrigin.h
   code/branches/presentationHS15/src/modules/hover/HoverPrereqs.h
   code/branches/presentationHS15/src/modules/hover/HoverShip.cc
   code/branches/presentationHS15/src/modules/hover/HoverShip.h
   code/branches/presentationHS15/src/modules/hover/HoverWall.cc
   code/branches/presentationHS15/src/modules/hover/HoverWall.h
   code/branches/presentationHS15/src/modules/hover/TimeHUD.cc
   code/branches/presentationHS15/src/modules/hover/TimeHUD.h
Log:
cleanup in hover module

Modified: code/branches/presentationHS15/src/modules/hover/FlagHUD.cc
===================================================================
--- code/branches/presentationHS15/src/modules/hover/FlagHUD.cc	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/FlagHUD.cc	2016-01-04 17:19:07 UTC (rev 11041)
@@ -35,8 +35,9 @@
 #include <OgreMaterialManager.h>
 #include <OgrePanelOverlayElement.h>
 
+#include "util/StringUtils.h"
 #include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
+#include "Hover.h"
 
 namespace orxonox
 {
@@ -46,6 +47,7 @@
     {
         RegisterObject(FlagHUD);
 
+        this->hoverGame_ = NULL;
         this->panel_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
             .createOverlayElement("Panel", "FlagHUD_Panel_" + getUniqueNumberString()));
         this->panel_->setMaterialName("Hover/Flag");
@@ -55,6 +57,14 @@
         setFlagCount(5);
     }
 
+    FlagHUD::~FlagHUD()
+    {
+        if (this->isInitialized())
+        {
+            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->panel_);
+        }
+    }
+
 /**
     @brief Sets the amount of flags displayed, once zero it does not reappear
     @param flagCount
@@ -77,8 +87,7 @@
     {
         SUPER(FlagHUD, tick, dt);
 
-            setFlagCount(this->hoverGame->getFlags());
-        
+        setFlagCount(this->hoverGame_->getFlags());
     }
 
     void FlagHUD::changedOwner()
@@ -87,19 +96,11 @@
 
         if (this->getOwner() && this->getOwner()->getGametype())
         {
-            this->hoverGame = orxonox_cast<Hover*>(this->getOwner()->getGametype());
+            this->hoverGame_ = orxonox_cast<Hover*>(this->getOwner()->getGametype());
         }
         else
         {
-            this->hoverGame = 0;
+            this->hoverGame_ = 0;
         }
     }
-
-    FlagHUD::~FlagHUD()
-    {
-        if (this->isInitialized())
-        {
-            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->panel_);
-        }
-    }
 }

Modified: code/branches/presentationHS15/src/modules/hover/FlagHUD.h
===================================================================
--- code/branches/presentationHS15/src/modules/hover/FlagHUD.h	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/FlagHUD.h	2016-01-04 17:19:07 UTC (rev 11041)
@@ -32,13 +32,11 @@
 #ifndef _FlagHUD_H__
 #define _FlagHUD_H__
 
-#include "overlays/OverlaysPrereqs.h"
+#include "HoverPrereqs.h"
 
-#include "util/Math.h"
 #include "util/OgreForwardRefs.h"
-#include "core/BaseObject.h"
 #include "overlays/OrxonoxOverlay.h"
-#include "Hover.h"
+#include "tools/interfaces/Tickable.h"
 
 namespace orxonox
 {
@@ -51,11 +49,10 @@
         virtual void tick(float dt);
         virtual void changedOwner();
 
-        virtual void setFlagCount(int flagCount);
+        void setFlagCount(int flagCount);
 
-
     private:
-        Hover* hoverGame;
+        Hover* hoverGame_;
         Ogre::PanelOverlayElement* panel_;
         int flagCount_;
     };

Modified: code/branches/presentationHS15/src/modules/hover/Hover.cc
===================================================================
--- code/branches/presentationHS15/src/modules/hover/Hover.cc	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/Hover.cc	2016-01-04 17:19:07 UTC (rev 11041)
@@ -33,8 +33,9 @@
 
 #include "Hover.h"
 
+#include "HoverOrigin.h"
 #include "HoverWall.h"
-#include "HoverFlag.h"  
+#include "HoverFlag.h"
 #include "MazeGenerator.h"
 #include "core/CoreIncludes.h"
 
@@ -44,7 +45,6 @@
 
     Hover::Hover(Context* context) : Gametype(context)
     {
-        
         RegisterObject(Hover);
 
         this->origin_ = NULL;
@@ -110,25 +110,4 @@
         }
         flags_ = flagVector_.size();
     }
-
-    int Hover::getFlags()
-    {
-        // Call start for the parent class.
-        return flags_;
-    }   
-
-    void Hover::start()
-    {
-        // Call start for the parent class.
-        Gametype::start();
-    }
-
-    void Hover::end()
-    {
-        // DON'T CALL THIS!
-        //      Deathmatch::end();
-        // It will misteriously crash the game!
-        // Instead startMainMenu, this won't crash.
-        GSLevel::startMainMenu();
-    }
 }

Modified: code/branches/presentationHS15/src/modules/hover/Hover.h
===================================================================
--- code/branches/presentationHS15/src/modules/hover/Hover.h	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/Hover.h	2016-01-04 17:19:07 UTC (rev 11041)
@@ -36,26 +36,12 @@
 #define _Hover_H__
 
 #include "HoverPrereqs.h"
-#include "HoverOrigin.h" 
 
-#include "gametypes/Gametype.h"
-#include "core/EventIncludes.h"
-#include "core/command/Executor.h"
-#include "core/config/ConfigValueIncludes.h"
-
-#include "gamestates/GSLevel.h"
-#include "chat/ChatManager.h"
 #include <vector>
 
-// ! HACK
-#include "infos/PlayerInfo.h"
+#include "gametypes/Gametype.h"
+#include "HoverOrigin.h"
 
-#include "core/command/ConsoleCommand.h"
-
-#include "tools/Timer.h"
-
-
-
 namespace orxonox
 {
     class _HoverExport Hover : public Gametype
@@ -63,15 +49,13 @@
        public:
             Hover(Context* context);
 
-            virtual void start();
-            virtual void end();
-
             virtual void tick(float dt);          
 
             void setOrigin(HoverOrigin* origin)
                 { this->origin_ = origin; }
 
-            int getFlags();
+            inline int getFlags() const
+                { return this->flags_; }
 
         private:
             WeakPtr<HoverOrigin> origin_;

Modified: code/branches/presentationHS15/src/modules/hover/HoverFlag.cc
===================================================================
--- code/branches/presentationHS15/src/modules/hover/HoverFlag.cc	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/HoverFlag.cc	2016-01-04 17:19:07 UTC (rev 11041)
@@ -35,13 +35,9 @@
 #include "HoverShip.h"
 
 #include "core/CoreIncludes.h"
-#include "core/GameMode.h"
-#include "graphics/Model.h"
-#include "gametypes/Gametype.h"
 
-
-
-
+#include "graphics/Model.h"
+#include "objects/collisionshapes/BoxCollisionShape.h"
 #include "core/XMLPort.h"
 
 namespace orxonox
@@ -99,12 +95,6 @@
 
     }
 
-    //xml port unused
-    void HoverFlag::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(HoverFlag, XMLPort, xmlelement, mode);
-    }
-
     /**
     @brief
         Checks if the Hovership collided with the flag
@@ -115,14 +105,4 @@
             collided_ = true;
         return false;
     }
-
-    bool HoverFlag::getCollided(){
-        return collided_;
-    }
-
-    void HoverFlag::setCollided(bool setValue){
-        collided_ = setValue;
-    }
-    
-    
 }

Modified: code/branches/presentationHS15/src/modules/hover/HoverFlag.h
===================================================================
--- code/branches/presentationHS15/src/modules/hover/HoverFlag.h	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/HoverFlag.h	2016-01-04 17:19:07 UTC (rev 11041)
@@ -36,12 +36,10 @@
 #define _HoverFlag_H__
 
 #include "HoverPrereqs.h"
-#include "util/Math.h"
+#include "objects/ObjectsPrereqs.h"
+
 #include "worldentities/StaticEntity.h"
-#include "graphics/Model.h"    
-#include "objects/collisionshapes/BoxCollisionShape.h"
 
-
 namespace orxonox
 {
     class _HoverExport HoverFlag : public StaticEntity
@@ -49,12 +47,15 @@
         public:
             HoverFlag(Context* context);
             HoverFlag(Context* context, int xCoordinate, int yCoordinate, int cellSize);
-            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint);            
             virtual ~HoverFlag();
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            bool getCollided();
-            void setCollided(bool setValue);
 
+            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint);            
+
+            inline bool getCollided() const
+                { return this->collided_; }
+            inline void setCollided(bool setValue)
+                { this->collided_ = setValue; }
+
         private:
             Model* model_;
             BoxCollisionShape* cs_;

Modified: code/branches/presentationHS15/src/modules/hover/HoverOrigin.h
===================================================================
--- code/branches/presentationHS15/src/modules/hover/HoverOrigin.h	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/HoverOrigin.h	2016-01-04 17:19:07 UTC (rev 11041)
@@ -31,10 +31,6 @@
 
 #include "HoverPrereqs.h"
 
-#include <string>
-
-#include <util/Math.h>
-
 #include "worldentities/StaticEntity.h"
 
 namespace orxonox

Modified: code/branches/presentationHS15/src/modules/hover/HoverPrereqs.h
===================================================================
--- code/branches/presentationHS15/src/modules/hover/HoverPrereqs.h	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/HoverPrereqs.h	2016-01-04 17:19:07 UTC (rev 11041)
@@ -67,11 +67,14 @@
 
 namespace orxonox
 {
+    class FlagHUD;
     class Hover;
+    class HoverFlag;
+    class HoverOrigin;
     class HoverShip;
     class HoverWall;
-    class HoverOrigin;
-    class HoverFlag;
+    class MazeGenerator;
+    class TimeHUD;
 }
 
 #endif /* _HoverPrereqs_H__*/

Modified: code/branches/presentationHS15/src/modules/hover/HoverShip.cc
===================================================================
--- code/branches/presentationHS15/src/modules/hover/HoverShip.cc	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/HoverShip.cc	2016-01-04 17:19:07 UTC (rev 11041)
@@ -31,7 +31,10 @@
 
 #include "HoverShip.h"
 #include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
 
+#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
+
 namespace orxonox
 {
     RegisterClass(HoverShip);
@@ -41,13 +44,9 @@
         RegisterObject(HoverShip);
         enableCollisionCallback();
         isFloor_ = false;
+        jumpBoost_ = 0;
     }
 
-    void HoverShip::tick(float dt)
-    {
-        SUPER(HoverShip, tick, dt);
-    }
-
     void HoverShip::moveFrontBack(const Vector2& value)
         { this->steering_.z -= value.x; }
 
@@ -73,26 +72,6 @@
 
     /**
     @brief
-        sets this ships jumpBoost
-    @param jumpBoost
-    */
-    void HoverShip::setJumpBoost(float jumpBoost)
-    {
-        this->jumpBoost_ = jumpBoost;
-    }
-
-    /**
-    @brief
-        returns this ships jumpBoost
-    @returns jumpBoost
-    */
-    float HoverShip::getJumpBoost()
-    {
-        return jumpBoost_;
-    }
-
-    /**
-    @brief
         Removed, does nothing.
     @param value
     */

Modified: code/branches/presentationHS15/src/modules/hover/HoverShip.h
===================================================================
--- code/branches/presentationHS15/src/modules/hover/HoverShip.h	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/HoverShip.h	2016-01-04 17:19:07 UTC (rev 11041)
@@ -32,34 +32,26 @@
 #ifndef _HoverShip_H__
 #define _HoverShip_H__
 
-#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
-
 #include "HoverPrereqs.h"
 
-#include "core/XMLPort.h"
 #include "worldentities/pawns/SpaceShip.h"
-#include "graphics/Camera.h"
-#include "core/class/Super.h"
 
 namespace orxonox
 {
     class _HoverExport HoverShip : public SpaceShip
     {
-    private:
-        float jumpBoost_;
-        bool isFloor_;
-
         public:
             HoverShip(Context* context);
 
-            virtual void tick(float dt);
-
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            virtual void setJumpBoost(float jumpBoost);
+            /// sets this ships jumpBoost
+            inline void setJumpBoost(float jumpBoost)
+                { this->jumpBoost_ = jumpBoost; }
+            /// returns this ships jumpBoost
+            inline float getJumpBoost() const
+                { return this->jumpBoost_; }
 
-            virtual float getJumpBoost();
-
             virtual void moveFrontBack(const Vector2& value);
 
             virtual void moveRightLeft(const Vector2& value);
@@ -76,6 +68,9 @@
 
             virtual void boost(bool bBoost);
 
+        private:
+            float jumpBoost_;
+            bool isFloor_;
     };
 }
 

Modified: code/branches/presentationHS15/src/modules/hover/HoverWall.cc
===================================================================
--- code/branches/presentationHS15/src/modules/hover/HoverWall.cc	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/HoverWall.cc	2016-01-04 17:19:07 UTC (rev 11041)
@@ -34,14 +34,9 @@
 #include "HoverWall.h"
 
 #include "core/CoreIncludes.h"
-#include "core/GameMode.h"
 #include "graphics/Model.h"
-#include "gametypes/Gametype.h"
+#include "objects/collisionshapes/BoxCollisionShape.h"
 
-
-
-#include "core/XMLPort.h"
-
 namespace orxonox
 {
     RegisterClass(HoverWall);
@@ -110,10 +105,4 @@
     {
 
     }
-
-    //xml port for loading height and width of the platform, unused
-    void HoverWall::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(HoverWall, XMLPort, xmlelement, mode);
-    }
 }

Modified: code/branches/presentationHS15/src/modules/hover/HoverWall.h
===================================================================
--- code/branches/presentationHS15/src/modules/hover/HoverWall.h	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/HoverWall.h	2016-01-04 17:19:07 UTC (rev 11041)
@@ -36,12 +36,10 @@
 #define _HoverWall_H__
 
 #include "HoverPrereqs.h"
-#include "util/Math.h"
+#include "objects/ObjectsPrereqs.h"
+
 #include "worldentities/StaticEntity.h"
-#include "graphics/Model.h"    
-#include "objects/collisionshapes/BoxCollisionShape.h"
 
-
 namespace orxonox
 {
     class _HoverExport HoverWall : public StaticEntity
@@ -50,12 +48,10 @@
             HoverWall(Context* context);            
             HoverWall(Context* context, int x, int y, int cellSize, int cellHeight, int orientation);
             virtual ~HoverWall();
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
         private:
             Model* model_;
             BoxCollisionShape* cs_;
-
     };
 }
 

Modified: code/branches/presentationHS15/src/modules/hover/TimeHUD.cc
===================================================================
--- code/branches/presentationHS15/src/modules/hover/TimeHUD.cc	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/TimeHUD.cc	2016-01-04 17:19:07 UTC (rev 11041)
@@ -33,7 +33,6 @@
 #include "TimeHUD.h"
 
 #include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
 #include "util/Convert.h"
 #include "Hover.h"
 
@@ -45,17 +44,12 @@
     {
         RegisterObject(TimeHUD);
 
-        this->_time = 0.0f;
-        this->_running = false;
-        this->hoverGame = 0;
+        this->time_ = 0.0f;
+        this->running_ = false;
+        this->hoverGame_ = 0;
         setRunning(true);
     }
 
-    void TimeHUD::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(TimeHUD, XMLPort, xmlelement, mode);
-    }
-
     inline std::string getTimeString(float time) {
         std::ostringstream ss;
 
@@ -81,14 +75,14 @@
     {
         SUPER(TimeHUD, tick, dt);
 
-        if(this->_running) {
-            this->_time += dt;
+        if(this->running_) {
+            this->time_ += dt;
         }
-        if (this->hoverGame)
+        if (this->hoverGame_)
         {
-            this->setCaption(getTimeString(this->_time));
+            this->setCaption(getTimeString(this->time_));
         }
-        if(this->hoverGame->getFlags() == 0)
+        if(this->hoverGame_->getFlags() == 0)
             setRunning(false);
         
     }
@@ -99,35 +93,16 @@
 
         if (this->getOwner() && this->getOwner()->getGametype())
         {
-            this->hoverGame = orxonox_cast<Hover*>(this->getOwner()->getGametype());
+            this->hoverGame_ = orxonox_cast<Hover*>(this->getOwner()->getGametype());
         }
         else
         {
-            this->hoverGame = 0;
+            this->hoverGame_ = 0;
         }
     }
 
-    /**
-    @brief
-        sets if the clock is running
-    @param running
-    */
-    void TimeHUD::setRunning(bool running) 
-    {
-        this->_running = running;
-    }
-
-    /**
-    @brief
-        returns if the clock is running
-    @returns running
-    */
-    bool TimeHUD::isRunning() {
-        return this->_running;
-    }
-
     void TimeHUD::reset()
     {
-        this->_time = 0;
+        this->time_ = 0;
     }
 }

Modified: code/branches/presentationHS15/src/modules/hover/TimeHUD.h
===================================================================
--- code/branches/presentationHS15/src/modules/hover/TimeHUD.h	2016-01-04 16:22:59 UTC (rev 11040)
+++ code/branches/presentationHS15/src/modules/hover/TimeHUD.h	2016-01-04 17:19:07 UTC (rev 11041)
@@ -32,7 +32,7 @@
 #ifndef _TimeHUD_H__
 #define _TimeHUD_H__
 
-#include "hover/HoverPrereqs.h"
+#include "HoverPrereqs.h"
 
 #include "tools/interfaces/Tickable.h"
 #include "overlays/OverlayText.h"
@@ -45,17 +45,21 @@
             TimeHUD(Context* context);
 
             virtual void tick(float dt);
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
             virtual void changedOwner();
 
-            virtual void setRunning(bool running);
-            virtual bool isRunning();
-            virtual void reset();
+            /// sets if the clock is running
+            inline void setRunning(bool running)
+                { this->running_ = running; }
+            /// returns if the clock is running
+            inline bool isRunning() const
+                { return this->running_; }
 
+            void reset();
+
         private:
-            Hover* hoverGame;
-            float _time;
-            bool _running;
+            Hover* hoverGame_;
+            float time_;
+            bool running_;
     };
 }
 #endif /* _TimeHUD_H__ */




More information about the Orxonox-commit mailing list