Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 19, 2018, 10:32:12 PM (7 years ago)
Author:
landauf
Message:

[Waypoints_HS17] removed lots of copy-paste- and otherwise unnecessary code

Location:
code/branches/Presentation_HS17_merge/src/orxonox/controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Presentation_HS17_merge/src/orxonox/controllers/ArrowController.cc

    r11774 r11777  
    2121 *
    2222 *   Author:
    23  *      Oli Scheuss
     23 *      jostoffe
    2424 *   Co-authors:
    25  *      Damian 'Mozork' Frick
     25 *      ...
    2626 *
    2727 */
     
    2929#include "ArrowController.h"
    3030#include "HumanController.h"
    31 #include "worldentities/WorldEntity.h"
    32    
    33 #include "worldentities/Arrow.h"
     31#include "worldentities/ControllableEntity.h"
     32
     33#include "core/CoreIncludes.h"
    3434#include "util/Math.h"
    3535
     
    3939    RegisterClass(ArrowController);
    4040
    41 
    42 
    43     /**
    44     @brief
    45         Constructor.
    46     */
    4741    ArrowController::ArrowController(Context* context) : Controller(context)
    4842    {
     
    5246        this->currentGPSPoint_ = 0;
    5347        this->accuracy_ = 1000.0f;
     48    }
    5449
    55         arrow = nullptr;
     50    ArrowController::~ArrowController()
     51    {
     52      for (WorldEntity* gpspoint : this->gpspoints_)
     53        {
     54            if(gpspoint)
     55                gpspoint->destroy();
     56        }
    5657
    57         for(Arrow* a: ObjectList<Arrow>())
    58             arrow = a;
     58    }
    5959
    60         assert(arrow != nullptr);
    61         this->setControllableEntity(arrow);
    62 
    63         orxout() << "constructor aufgerufen" << endl;
    64     }
    65    
    6660    //Set the distance you need to reach before the next waypoint will be selected
    6761    void ArrowController::setAccuracy(float accuracy){
     
    8579            return nullptr;
    8680    }
    87     /**
    88     @brief
    89         Destructor.
    90     */
    91 
    92     ArrowController::~ArrowController()
    93     {
    94       for (WorldEntity* gpspoint : this->gpspoints_)
    95         {
    96             if(gpspoint)
    97                 gpspoint->destroy();
    98         }
    99 
    100     }
    101 
    10281
    10382    void ArrowController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
  • code/branches/Presentation_HS17_merge/src/orxonox/controllers/ArrowController.h

    r11774 r11777  
    2121 *
    2222 *   Author:
    23  *      Oli Scheuss
     23 *      jostoffe
    2424 *   Co-authors:
    25  *      Damian 'Mozork' Frick
     25 *      ...
    2626 *
    2727 */
     
    3838namespace orxonox
    3939{
    40     /**
    41     @brief
    42         Controller for the Arrow of the PPS tutorial.
    43     @author
    44         Oli Scheuss
    45     */
    4640    class _OrxonoxExport ArrowController : public Controller, public Tickable
    4741    {
     
    5953            virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick.
    6054
    61         protected:
    62 
     55        private:
    6356            std::vector<WeakPtr<WorldEntity>> gpspoints_;
    6457            size_t currentGPSPoint_;
    6558            float accuracy_;
    66             WorldEntity* defaultGPSpoint_;
    67 
    68         private:
    69             Arrow *arrow;
    7059    };
    7160}
Note: See TracChangeset for help on using the changeset viewer.