[Orxonox-commit 6649] r11287 - code/branches/QuestGuide_HS16/src/modules/waypoints
ooguz at orxonox.net
ooguz at orxonox.net
Mon Nov 14 15:57:03 CET 2016
Author: ooguz
Date: 2016-11-14 15:57:03 +0100 (Mon, 14 Nov 2016)
New Revision: 11287
Modified:
code/branches/QuestGuide_HS16/src/modules/waypoints/CMakeLists.txt
code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc
code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h
code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc
code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h
code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc
code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.h
Log:
Bugs fixed
Modified: code/branches/QuestGuide_HS16/src/modules/waypoints/CMakeLists.txt
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/CMakeLists.txt 2016-11-14 14:52:10 UTC (rev 11286)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/CMakeLists.txt 2016-11-14 14:57:03 UTC (rev 11287)
@@ -1,7 +1,17 @@
-ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+ADD_SOURCE_FILES(WAYPOINTS_SRC_FILES
Waypointarrow.cc
Waypoint.cc
WaypointGroup.cc
)
+
+ORXONOX_ADD_LIBRARY(waypoints
+ MODULE
+ FIND_HEADER_FILES
+ LINK_LIBRARIES
+ orxonox
+ overlays
+ objects
+ SOURCE_FILES ${WAYPOINTS_SRC_FILES}
+)
Modified: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc 2016-11-14 14:52:10 UTC (rev 11286)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc 2016-11-14 14:57:03 UTC (rev 11287)
@@ -4,8 +4,12 @@
#include <BulletDynamics/Dynamics/btRigidBody.h>
#include "util/OrxAssert.h"
#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
namespace orxonox
+
+
{
RegisterClass(Waypoint);
@@ -36,7 +40,8 @@
void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){
SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
- XMLPortParam(Waypoint, "order", getOrder, setOrder, xmlelement, mode);
+
+ XMLPortParam(Waypoint, "order", setOrder, getOrder, xmlelement, mode);
}
Modified: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h 2016-11-14 14:52:10 UTC (rev 11286)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h 2016-11-14 14:57:03 UTC (rev 11287)
@@ -4,9 +4,9 @@
#define _Waypoint_H__
#include "OrxonoxPrereqs.h"
-#include "StaticEntity.h"
+#include "worldentities/StaticEntity.h"
#include "graphics/Model.h"
-#include "modules/objects/triggers/DistanceTrigger.h"
+#include "objects/triggers/DistanceTrigger.h"
#include <map>
#include <string>
@@ -42,9 +42,12 @@
this->waypoint_actived = true;
}
+ inline void setOrder(int number){
+ this->order = number;
+ }
inline int getOrder(){
- return order;
+ return this->order;
}
Modified: code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc 2016-11-14 14:52:10 UTC (rev 11286)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc 2016-11-14 14:57:03 UTC (rev 11287)
@@ -3,26 +3,29 @@
#include <OgreSceneNode.h>
#include <BulletDynamics/Dynamics/btRigidBody.h>
#include "util/OrxAssert.h"
+#include "WaypointGroup.h"
#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
namespace orxonox
{
RegisterClass(WaypointGroup);
WaypointGroup::WaypointGroup(Context* context) : StaticEntity(context)
{
- /*RegisterObject(Waypoint);
- model = new Model(this->getContext());
- model->setMeshSource("cube.mesh"); // Name of the arrow file for now bottle
- this->attach(model);
- model->setScale(3);
+ RegisterObject(WaypointGroup);
+ //model = new Model(this->getContext());
+ //model->setMeshSource("cube.mesh"); // Name of the arrow file for now bottle
+ //is->attach(model);
+ //model->setScale(3);
//model->setOrientation(Vector3(0,0,-1));
- model->setPosition(Vector3(0.0,0.0,0.0)); // this is wrong, it has to be triggered
- waypoint_active = false;
- distancetrigger = new DistanceTrigger(this->getContext());
- distancetrigger->setDistance(100);
- this->attach(distancetrigger);
- */
+ //model->setPosition(Vector3(0.0,0.0,0.0)); // this is wrong, it has to be triggered
+ //waypoint_active = false;
+ //distancetrigger = new DistanceTrigger(this->getContext());
+ //distancetrigger->setDistance(100);
+ //this->attach(distancetrigger);
+
}
WaypointGroup::~WaypointGroup()
@@ -34,41 +37,46 @@
//WorldEntity::getPosition()
//setOrientation()
- Waypoint* WaypointGroup::getWaypoint(){
- for (Waypoint* waypoint : this->waypoints_){
- if(!(waypoint->waypoint_actived)){
- waypoint->enable_waypoint();
- return waypoint;
- }
- }
- }
+
Waypoint* WaypointGroup::getWaypoint(unsigned int index)
{
unsigned int i = 0;
- for (Waypoint* waypoint : this->waypoints_)
+ for (Waypoint* child : this->waypoints_)
{
-
if (i == index)
- return waypoint;
+ return child;
++i;
}
return nullptr;
}
- void WaypointGroup::addWaypoint(Waypoint* object)
+ void WaypointGroup::setWaypoint(Waypoint* object)
{
this->waypoints_.insert(object);
}
+ Waypoint* WaypointGroup::getActive(){
+ for (Waypoint* object : this->waypoints_){
+ if(!(object->waypoint_actived)){
+ object->enable_waypoint();
+ return object;
+ }
+ }
+ }
- void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){
- SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
- XMLPortObject(WaypointGroup, Waypoint, "waypoints", addWaypoint, getWaypoint, xmlelement, mode);
+
+
+
+ void WaypointGroup::XMLPort(Element& xmlelement, XMLPort::Mode mode){
+ SUPER(WaypointGroup, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
+ XMLPortObject(WaypointGroup, Waypoint, "waypoints", setWaypoint, getWaypoint, xmlelement, mode);
+
}
+
}
Modified: code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h 2016-11-14 14:52:10 UTC (rev 11286)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h 2016-11-14 14:57:03 UTC (rev 11287)
@@ -1,19 +1,19 @@
-#ifndef _Waypoint_H__
-#define _Waypoint_H__
+#ifndef _WaypointGroup_H__
+#define _WaypointGroup_H__
#include "OrxonoxPrereqs.h"
-#include "StaticEntity.h"
+#include "worldentities/StaticEntity.h"
#include "graphics/Model.h"
-#include "modules/objects/triggers/DistanceTrigger.h"
+#include "objects/triggers/DistanceTrigger.h"
#include <map>
#include <string>
+#include "core/CoreIncludes.h"
#include "util/OgreForwardRefs.h"
-#include "tools/interfaces/Tickable.h"
-#include "Waypoints.h"
+#include "Waypoint.h"
namespace orxonox
{
@@ -39,11 +39,14 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+ //Waypoint* getWaypoint();
Waypoint* getWaypoint(unsigned int index);
+ void setWaypoint(Waypoint* object);
- Way
+
+
@@ -53,7 +56,7 @@
//virtual bool isCollisionTypeLegal(CollisionType type) const override;
- std::set<Waypoint*> waypoints;
+ std::set<Waypoint*> waypoints_;
// network callbacks
};
Modified: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc 2016-11-14 14:52:10 UTC (rev 11286)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc 2016-11-14 14:57:03 UTC (rev 11287)
@@ -13,11 +13,12 @@
{
RegisterObject(Waypointarrow);
model = new Model(this->getContext());
- model->setMeshSource("Arrow.mesh"); // Name of the arrow file for now bottle
+ model->setMeshSource("cokebottle.mesh"); // Name of the arrow file for now bottle
this->attach(model);
model->setScale(3);
- model->setOrientation(Vector3(0,0,-1));
+ // model->setOrientation(Vector3(0,0,-1));
model->setPosition(Vector3(0,15,0));
+
}
Waypointarrow::~Waypointarrow()
Modified: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.h
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.h 2016-11-14 14:52:10 UTC (rev 11286)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.h 2016-11-14 14:57:03 UTC (rev 11287)
@@ -1,20 +1,21 @@
-#ifndef _Waypoint_H__
-#define _Waypoint_H__
+#ifndef _Waypointarrow_H__
+#define _Waypointarrow_H__
#include "OrxonoxPrereqs.h"
-#include "StaticEntity.h"
+#include "worldentities/StaticEntity.h"
#include "graphics/Model.h"
-#include <map>
#include <string>
#include "util/OgreForwardRefs.h"
#include "tools/interfaces/Tickable.h"
#include "interfaces/RadarListener.h"
#include "WaypointGroup.h"
+#include "core/XMLPort.h"
+
namespace orxonox
{
/**
More information about the Orxonox-commit
mailing list