[Orxonox-commit 4585] r9256 - code/trunk/src/orxonox/controllers
landauf at orxonox.net
landauf at orxonox.net
Mon May 28 09:06:02 CEST 2012
Author: landauf
Date: 2012-05-28 09:06:02 +0200 (Mon, 28 May 2012)
New Revision: 9256
Modified:
code/trunk/src/orxonox/controllers/FormationController.cc
code/trunk/src/orxonox/controllers/FormationController.h
code/trunk/src/orxonox/controllers/HumanController.cc
code/trunk/src/orxonox/controllers/HumanController.h
Log:
I think this implementation of the hit() function rather belongs to FormationController than to HumanController
Modified: code/trunk/src/orxonox/controllers/FormationController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/FormationController.cc 2012-05-27 22:21:45 UTC (rev 9255)
+++ code/trunk/src/orxonox/controllers/FormationController.cc 2012-05-28 07:06:02 UTC (rev 9256)
@@ -251,7 +251,14 @@
}
}
- void FormationController::removeFromFormation()
+ //used, when slaves are in DEFEND mode.
+ void FormationController::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
+ {
+ if (!this->formationFlight_ || this->state_!=MASTER || this->formationMode_!=DEFEND) return;
+ this->masterAttacked(originator);
+ }
+
+ void FormationController::removeFromFormation()
{
if (this->state_ == SLAVE || this->myMaster_) // slaves can also be temporary free, so check if myMaster_ is set
this->unregisterSlave();
Modified: code/trunk/src/orxonox/controllers/FormationController.h
===================================================================
--- code/trunk/src/orxonox/controllers/FormationController.h 2012-05-27 22:21:45 UTC (rev 9255)
+++ code/trunk/src/orxonox/controllers/FormationController.h 2012-05-28 07:06:02 UTC (rev 9256)
@@ -95,7 +95,9 @@
inline FormationMode getFormationMode() const
{ return this->formationMode_; }
- protected:
+ virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
+
+ protected:
bool formationFlight_;
bool passive_;
int team_;
Modified: code/trunk/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/HumanController.cc 2012-05-27 22:21:45 UTC (rev 9255)
+++ code/trunk/src/orxonox/controllers/HumanController.cc 2012-05-28 07:06:02 UTC (rev 9256)
@@ -84,7 +84,7 @@
HumanController::~HumanController()
{
- if (HumanController::localController_s)
+ if (HumanController::localController_s)
{
HumanController::localController_s->removeFromFormation();
}
@@ -196,7 +196,7 @@
if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
HumanController::localController_s->keepBoosting();
}
-
+
/**
@brief
Starts, or keeps the boosting mode.
@@ -301,7 +301,7 @@
HumanController::localController_s->takeLeadOfFormation();
orxout(message) <<"FormationFlight enabled "<< endl;
}
-
+
}
}
@@ -331,14 +331,6 @@
}
}
-
- //used, when slaves are in DEFEND mode.
- void HumanController::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
- {
- if (!this->formationFlight_ || this->state_!=MASTER || this->formationMode_!=DEFEND) return;
- this->masterAttacked(originator);
- }
-
void HumanController::addBots(unsigned int amount)
{
if (HumanController::localController_s && HumanController::localController_s->controllableEntity_ && HumanController::localController_s->controllableEntity_->getGametype())
Modified: code/trunk/src/orxonox/controllers/HumanController.h
===================================================================
--- code/trunk/src/orxonox/controllers/HumanController.h 2012-05-27 22:21:45 UTC (rev 9255)
+++ code/trunk/src/orxonox/controllers/HumanController.h 2012-05-28 07:06:02 UTC (rev 9256)
@@ -73,8 +73,8 @@
{ return this->boosting_; }
void keepBoosting(void);
void terminateBoosting(void);
-
+
static void greet();
static void switchCamera();
static void mouseLook();
@@ -87,9 +87,7 @@
static void toggleFormationFlight();
static void FFChangeMode();
- virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
-
static void addBots(unsigned int amount);
static void killBots(unsigned int amount = 0);
@@ -107,7 +105,7 @@
protected:
static HumanController* localController_s;
bool controlPaused_;
-
+
private:
bool boosting_; // Whether the HumanController is in boosting mode or not.
Timer boostingTimeout_; // A timer to check whether the player is no longer boosting.
More information about the Orxonox-commit
mailing list