Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 14, 2016, 3:57:03 PM (8 years ago)
Author:
ooguz
Message:

Bugs fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc

    r11274 r11287  
    44#include <BulletDynamics/Dynamics/btRigidBody.h>
    55#include "util/OrxAssert.h"
     6#include "WaypointGroup.h"
    67#include "core/CoreIncludes.h"
     8#include "core/XMLPort.h"
     9
    710
    811namespace orxonox
     
    1215    WaypointGroup::WaypointGroup(Context* context) : StaticEntity(context)
    1316    {
    14         /*RegisterObject(Waypoint);
    15         model = new Model(this->getContext());
    16         model->setMeshSource("cube.mesh");  // Name of the arrow file for now bottle
    17         this->attach(model);
    18         model->setScale(3);
     17        RegisterObject(WaypointGroup);
     18        //model = new Model(this->getContext());
     19        //model->setMeshSource("cube.mesh");  // Name of the arrow file for now bottle
     20        //is->attach(model);
     21        //model->setScale(3);
    1922        //model->setOrientation(Vector3(0,0,-1));
    20         model->setPosition(Vector3(0.0,0.0,0.0));        // this is wrong, it has to be triggered
    21         waypoint_active = false;
    22         distancetrigger = new DistanceTrigger(this->getContext());   
    23         distancetrigger->setDistance(100);
    24         this->attach(distancetrigger);
    25         */
     23        //model->setPosition(Vector3(0.0,0.0,0.0));        // this is wrong, it has to be triggered
     24        //waypoint_active = false;
     25        //distancetrigger = new DistanceTrigger(this->getContext());   
     26        //distancetrigger->setDistance(100);
     27        //this->attach(distancetrigger);
     28       
    2629    }
    2730
     
    3538     //setOrientation()
    3639
    37     Waypoint* WaypointGroup::getWaypoint(){
    38         for (Waypoint* waypoint : this->waypoints_){
    39             if(!(waypoint->waypoint_actived)){
    40                 waypoint->enable_waypoint();
    41                 return waypoint;
     40 
     41
     42
     43    Waypoint* WaypointGroup::getWaypoint(unsigned int index)
     44    {
     45        unsigned int i = 0;
     46        for (Waypoint* child : this->waypoints_)
     47        {
     48            if (i == index)
     49                return child;
     50            ++i;
     51        }
     52        return nullptr;
     53    }
     54
     55    void WaypointGroup::setWaypoint(Waypoint* object)
     56    {
     57        this->waypoints_.insert(object);
     58    }
     59
     60
     61    Waypoint* WaypointGroup::getActive(){
     62          for (Waypoint* object : this->waypoints_){
     63            if(!(object->waypoint_actived)){
     64                object->enable_waypoint();
     65                return object;
    4266            }
    4367        }
     
    4569
    4670
    47     Waypoint* WaypointGroup::getWaypoint(unsigned int index)
    48     {
    49         unsigned int i = 0;
    50         for (Waypoint* waypoint : this->waypoints_)
    51         {
    52    
    53             if (i == index)
    54                 return waypoint;
    55             ++i;
    56         }
    57         return nullptr;
    58     }
    5971
    60     void WaypointGroup::addWaypoint(Waypoint* object)
    61     {
    62         this->waypoints_.insert(object);
     72   
     73
     74    void WaypointGroup::XMLPort(Element& xmlelement, XMLPort::Mode mode){
     75        SUPER(WaypointGroup, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
     76        XMLPortObject(WaypointGroup, Waypoint, "waypoints", setWaypoint, getWaypoint, xmlelement, mode);
     77
    6378    }
    6479
    6580
    6681
    67     void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){
    68         SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
    69         XMLPortObject(WaypointGroup, Waypoint, "waypoints", addWaypoint, getWaypoint, xmlelement, mode);
    70 
    71     }
    72 
    73 
    7482}
Note: See TracChangeset for help on using the changeset viewer.