[Orxonox-commit 6205] r10863 - in code/branches/campaignHS15/src/orxonox: controllers worldentities
gania at orxonox.net
gania at orxonox.net
Wed Nov 25 22:07:49 CET 2015
Author: gania
Date: 2015-11-25 22:07:48 +0100 (Wed, 25 Nov 2015)
New Revision: 10863
Added:
code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.cc
code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.h
Removed:
code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.cc
code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.h
Modified:
code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc
Log:
Modified: code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc 2015-11-25 20:01:05 UTC (rev 10862)
+++ code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc 2015-11-25 21:07:48 UTC (rev 10863)
@@ -38,6 +38,11 @@
#include "controllers/NewHumanController.h"
#include "controllers/DroneController.h"
+//Today, on 25th of November, 2015, I hereby officially declare my code a huge pack of bullshit that I do not understand.
+//#Almost2KLines
+//#SpaghettiCode
+//#ISworeiWouldNever
+//#ItAllStartedSoWell
namespace orxonox
{
Deleted: code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.cc 2015-11-25 20:01:05 UTC (rev 10862)
+++ code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.cc 2015-11-25 21:07:48 UTC (rev 10863)
@@ -1,131 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "Actionpoint.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- RegisterClass(Actionpoint);
-
- Actionpoint::Actionpoint(Context* context) : StaticEntity(context)
- {
- RegisterObject(Actionpoint);
-
- }
- //usage:
- // <DivisionController team=12>
- // <Actionpoints>
- // <Actionpoint position="12,34,56" action="FIGHT" enemy="enemyName" />, position irrelevant
- // <Actionpoint position="12,34,56" action="PROTECT" protect="protectName" />, position irrelevant
- // <Actionpoint position="12,34,56" action="FLY" />, position relevant: makes ship fly to the position of Actionpoint
- // </Actionpoints>
- // </DivisonController>
- //DivisionController will firstly fight enemy that it will find by name "enemyName", if finds nothing or when beats enemy,
- //it will protect ship that it will find by name "protectName", when it's dead or if it doesn't find the ship,
- //it will fly towards "12,34,56"
- //when it finishes all, it stays at that location.
- //At all the times it will check if there are enemies near DivisionController, if yes, it will fight them
- //another usage:
- // <DivisionController team=12>
- // <Actionpoints>
- // <Actionpoint position="12,34,56" action="PROTECT" protectMe=true />, position irrelevant
- // <Actionpoint position="12,34,56" action="FIGHT" fightAll=true />, position irrelevant
- // </Actionpoints>
- // </DivisonController>
- //DivisionController will protect the first NewHumanController it finds, when it dies or if no controller found,
- //it will fight closest enemies one after another
- void Actionpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(Actionpoint, XMLPort, xmlelement, mode);
-
- XMLPortParam( Actionpoint, "action", setActionXML, getActionXML, xmlelement, mode );
- XMLPortParam( Actionpoint, "protect", setProtectXML, getProtectXML, xmlelement, mode );
- XMLPortParam( Actionpoint, "enemy", setEnemyXML, getEnemyXML, xmlelement, mode );
- XMLPortParam( Actionpoint, "protectMe", setProtectMeXML, getProtectMeXML, xmlelement, mode ).defaultValues(false);
- XMLPortParam( Actionpoint, "fightAll", setFightAllXML, getFightAllXML, xmlelement, mode ).defaultValues(false);
- XMLPortParam( Actionpoint, "loopStart", setLoopStart, getLoopStart, xmlelement, mode ).defaultValues(false);
- XMLPortParam( Actionpoint, "loopEnd", setLoopEnd, getLoopEnd, xmlelement, mode ).defaultValues(false);
-
- }
- void Actionpoint::setActionXML( std::string val)
- {
- this->actionName_ = getUppercase( val );
- orxout(internal_error) << "action = " << this->actionName_ << endl;
- }
-
- std::string Actionpoint::getActionXML()
- {
- return this->actionName_;
- }
- void Actionpoint::setProtectXML( std::string val)
- {
- this->protectName_ = getUppercase( val );
- }
-
- std::string Actionpoint::getProtectXML()
- {
- return this->protectName_;
- }
- void Actionpoint::setEnemyXML( std::string val)
- {
- this->enemyName_ = getUppercase( val );
- }
-
- std::string Actionpoint::getEnemyXML()
- {
- return this->enemyName_;
- }
- void Actionpoint::setProtect( ControllableEntity* protect)
- {
- this->protect_ = protect;
- }
- ControllableEntity* Actionpoint::getProtect()
- {
- return this->protect_;
- }
- void Actionpoint::setEnemy( ControllableEntity* enemy)
- {
- this->enemy_ = enemy;
- }
- ControllableEntity* Actionpoint::getEnemy()
- {
- return this->enemy_;
- }
- void Actionpoint::setTargetPosition(const Vector3& target)
- {
- this->targetPosition_ = target;
- }
- Vector3 Actionpoint::getTargetPosition ()
- {
- return this->targetPosition_;
- }
-
-}
Deleted: code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.h 2015-11-25 20:01:05 UTC (rev 10862)
+++ code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.h 2015-11-25 21:07:48 UTC (rev 10863)
@@ -1,141 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file Attacher.h
- @brief Definition of the Attacher class.
- @ingroup Objects
-*/
-
-#ifndef _Actionpoint_H__
-#define _Actionpoint_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <list>
-#include <string>
-#include "core/XMLNameListener.h"
-#include "worldentities/StaticEntity.h"
-namespace orxonox
-{
-
- class _OrxonoxExport Actionpoint : public StaticEntity
- {
- public:
- Actionpoint(Context* context);
- virtual ~Actionpoint() {}
-
- //----[XML data]----
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- //----[Action data]----
- void setActionXML( std::string val);
- std::string getActionXML();
- //----[/Action data]----
- //----[Protect data]----
- void setProtectXML( std::string val);
- std::string getProtectXML();
- //----[/Protect data]----
- //----[Enemy data]----
- void setEnemyXML( std::string val);
- std::string getEnemyXML();
- //----[/Enemy data]----
- //----[ProtectMe data]----
- inline void setProtectMeXML(bool c)
- {
- this->bProtectMe_ = c;
- }
- inline bool getProtectMeXML ()
- {
- return this->bProtectMe_;
- }
-
- //----[/ProtectMe data]----
- //----[FightAll data]----
- inline void setFightAllXML(bool c)
- {
- this->bFightAll_ = c;
- }
- inline bool getFightAllXML ()
- {
- return this->bFightAll_;
- }
- //----[/FightAll data]----
- //----[/XML data]----
- void setProtect( ControllableEntity* protect);
- ControllableEntity* getProtect();
- void setEnemy( ControllableEntity* enemy);
- ControllableEntity* getEnemy();
- std::string getName()
- {
- if (actionName_ != "")
- return actionName_;
- else if (protectName_ != "")
- return protectName_;
- else if (enemyName_ != "")
- return enemyName_;
- else
- return "";
- }
- void setLoopStart(bool value)
- {
- this->bLoopStart_ = value;
- }
- void setLoopEnd (bool value)
- {
- this->bLoopEnd_ = value;
- }
- //----["Waypoints" data]----
- void setTargetPosition(const Vector3& target);
- Vector3 getTargetPosition ();
- //----[/"Waypoints" data]----
-
- bool getLoopStart()
- {
- return this->bLoopStart_;
- }
- bool getLoopEnd();
- {
- return this->bLoopEnd_;
- }
- private:
-
- std::string actionName_;
- std::string protectName_;
- std::string enemyName_;
- WeakPtr<ControllableEntity> protect_;
- WeakPtr<ControllableEntity> enemy_;
-
- bool bLoopStart_;
- bool bLoopEnd_;
- bool bProtectMe_;
- bool bFightAll_;
- Vector3 targetPosition_;
- };
-}
-
-#endif /* _Actionpoint_H__ */
Added: code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.cc (rev 0)
+++ code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.cc 2015-11-25 21:07:48 UTC (rev 10863)
@@ -0,0 +1,94 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Actionpoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(Actionpoint);
+
+ Actionpoint::Actionpoint(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(Actionpoint);
+
+ }
+
+ void Actionpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(Actionpoint, XMLPort, xmlelement, mode);
+
+ XMLPortParam( Actionpoint, "action", setActionXML, getActionXML, xmlelement, mode );
+ XMLPortParam( Actionpoint, "protect", setProtectXML, getProtectXML, xmlelement, mode );
+ XMLPortParam( Actionpoint, "attack", setAttackXML, getAttackXML, xmlelement, mode );
+ XMLPortParam( Actionpoint, "protectMe", setProtectMeXML, getProtectMeXML, xmlelement, mode ).defaultValues(false);
+ XMLPortParam( Actionpoint, "loopStart", setLoopStart, getLoopStart, xmlelement, mode ).defaultValues(false);
+ XMLPortParam( Actionpoint, "loopEnd", setLoopEnd, getLoopEnd, xmlelement, mode ).defaultValues(false);
+
+ }
+ void Actionpoint::setActionXML( std::string val)
+ {
+ this->actionName_ = getUppercase( val );
+ orxout(internal_error) << "action = " << this->actionName_ << endl;
+ }
+
+ std::string Actionpoint::getActionXML()
+ {
+ return this->actionName_;
+ }
+ void Actionpoint::setProtectXML( std::string val)
+ {
+ this->protectName_ = val;
+ }
+
+ std::string Actionpoint::getProtectXML()
+ {
+ return this->protectName_;
+ }
+ void Actionpoint::setAttackXML( std::string val)
+ {
+ this->attackName_ = val;
+ }
+
+ std::string Actionpoint::getAttackXML()
+ {
+ return this->attackName_;
+ }
+
+ void Actionpoint::setTargetPosition(const Vector3& target)
+ {
+ this->targetPosition_ = target;
+ }
+ Vector3 Actionpoint::getTargetPosition ()
+ {
+ return this->targetPosition_;
+ }
+
+}
Added: code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.h (rev 0)
+++ code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.h 2015-11-25 21:07:48 UTC (rev 10863)
@@ -0,0 +1,127 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file Attacher.h
+ @brief Definition of the Attacher class.
+ @ingroup Objects
+*/
+
+#ifndef _Actionpoint_H__
+#define _Actionpoint_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <list>
+#include <string>
+#include "core/XMLNameListener.h"
+#include "worldentities/StaticEntity.h"
+namespace orxonox
+{
+
+ class _OrxonoxExport Actionpoint : public StaticEntity
+ {
+ public:
+ Actionpoint(Context* context);
+ virtual ~Actionpoint() {}
+
+ //----[XML data]----
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ //----[Action data]----
+ void setActionXML( std::string val);
+ std::string getActionXML();
+ //----[/Action data]----
+ //----[Protect data]----
+ void setProtectXML( std::string val);
+ std::string getProtectXML();
+ //----[/Protect data]----
+ //----[Attack data]----
+ void setAttackXML( std::string val);
+ std::string getAttackXML();
+ //----[/Attack data]----
+ //----[ProtectMe data]----
+ inline void setProtectMeXML(bool c)
+ {
+ this->bProtectMe_ = c;
+ }
+ inline bool getProtectMeXML ()
+ {
+ return this->bProtectMe_;
+ }
+
+ //----[/ProtectMe data]----
+
+ //----[/XML data]----
+
+ std::string getName()
+ {
+ if (protectName_ != "")
+ return protectName_;
+ else if (attackName_ != "")
+ return attackName_;
+ else if (bProtectMe_)
+ return "reservedKeyword:human";
+ else
+ return "";
+ }
+ void setLoopStart(bool value)
+ {
+ this->bLoopStart_ = value;
+ }
+ void setLoopEnd (bool value)
+ {
+ this->bLoopEnd_ = value;
+ }
+ //----["Waypoints" data]----
+ void setTargetPosition(const Vector3& target);
+ Vector3 getTargetPosition ();
+ //----[/"Waypoints" data]----
+
+ bool getLoopStart()
+ {
+ return this->bLoopStart_;
+ }
+ bool getLoopEnd()
+ {
+ return this->bLoopEnd_;
+ }
+ private:
+
+ std::string actionName_;
+ std::string protectName_;
+ std::string attackName_;
+
+
+ bool bLoopStart_;
+ bool bLoopEnd_;
+ bool bProtectMe_;
+ Vector3 targetPosition_;
+ };
+}
+
+#endif /* _Actionpoint_H__ */
More information about the Orxonox-commit
mailing list