[Orxonox-commit 4324] r8995 - in code/branches/presentation2011/src: modules/overlays/hud orxonox/controllers orxonox/gametypes
jo at orxonox.net
jo at orxonox.net
Sat Dec 17 23:49:37 CET 2011
Author: jo
Date: 2011-12-17 23:49:36 +0100 (Sat, 17 Dec 2011)
New Revision: 8995
Modified:
code/branches/presentation2011/src/modules/overlays/hud/HUDEnemyHealthBar.cc
code/branches/presentation2011/src/orxonox/controllers/FormationController.cc
code/branches/presentation2011/src/orxonox/gametypes/TeamGametype.cc
Log:
check to prevent crashes.
Modified: code/branches/presentation2011/src/modules/overlays/hud/HUDEnemyHealthBar.cc
===================================================================
--- code/branches/presentation2011/src/modules/overlays/hud/HUDEnemyHealthBar.cc 2011-12-17 00:03:45 UTC (rev 8994)
+++ code/branches/presentation2011/src/modules/overlays/hud/HUDEnemyHealthBar.cc 2011-12-17 22:49:36 UTC (rev 8995)
@@ -118,9 +118,11 @@
pos.x = -pos.x;
// get mouse position
- currentYaw = dynamic_cast<NewHumanController*>(dynamic_cast<ControllableEntity*>(this->getOwner())->getController())->getCurrentYaw();
- currentPitch = dynamic_cast<NewHumanController*>(dynamic_cast<ControllableEntity*>(this->getOwner())->getController())->getCurrentPitch();
-
+ if(this->getOwner() && dynamic_cast<ControllableEntity*>(this->getOwner())->getController() && dynamic_cast<NewHumanController*>(dynamic_cast<ControllableEntity*>(this->getOwner())->getController()))
+ {
+ currentYaw = dynamic_cast<NewHumanController*>(dynamic_cast<ControllableEntity*>(this->getOwner())->getController())->getCurrentYaw();
+ currentPitch = dynamic_cast<NewHumanController*>(dynamic_cast<ControllableEntity*>(this->getOwner())->getController())->getCurrentPitch();
+ }
// Compare cursor position to object position
if ( fabs(pos.x - currentYaw) < sens_ && fabs(pos.y - currentPitch) < sens_ )
{
Modified: code/branches/presentation2011/src/orxonox/controllers/FormationController.cc
===================================================================
--- code/branches/presentation2011/src/orxonox/controllers/FormationController.cc 2011-12-17 00:03:45 UTC (rev 8994)
+++ code/branches/presentation2011/src/orxonox/controllers/FormationController.cc 2011-12-17 22:49:36 UTC (rev 8995)
@@ -39,7 +39,7 @@
#include "worldentities/pawns/TeamBaseMatchBase.h"
#include "gametypes/TeamDeathmatch.h"
#include "gametypes/Dynamicmatch.h"
-#include "gametypes/Mission.h" TODO: include mission after merging
+#include "gametypes/Mission.h"
#include "gametypes/Gametype.h"
#include "controllers/WaypointPatrolController.h"
#include "controllers/NewHumanController.h"
@@ -88,7 +88,7 @@
this->bHasTargetOrientation_=false;
this->speedCounter_ = 0.2f;
this->targetPosition_ = Vector3::ZERO;
- //this->team_=-1;
+ this->team_=-1;
this->target_.setCallback(createFunctor(&FormationController::targetDied, this));
}
Modified: code/branches/presentation2011/src/orxonox/gametypes/TeamGametype.cc
===================================================================
--- code/branches/presentation2011/src/orxonox/gametypes/TeamGametype.cc 2011-12-17 00:03:45 UTC (rev 8994)
+++ code/branches/presentation2011/src/orxonox/gametypes/TeamGametype.cc 2011-12-17 22:49:36 UTC (rev 8995)
@@ -310,7 +310,7 @@
void TeamGametype::colourPawn(Pawn* pawn, int teamNr)
{// catch no-colouring-case and wrong input
- if(teamNr < 0 || pawn == NULL) return;
+ if(teamNr < 0 || teamNr+1 > this->teamcolours_.size() ||pawn == NULL) return;
pawn->setRadarObjectColour(this->teamcolours_[teamNr]);
std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
More information about the Orxonox-commit
mailing list