[Orxonox-commit 4008] r8682 - in code/branches/presentation/src/orxonox: infos worldentities
dafrick at orxonox.net
dafrick at orxonox.net
Mon May 30 10:20:27 CEST 2011
Author: dafrick
Date: 2011-05-30 10:20:27 +0200 (Mon, 30 May 2011)
New Revision: 8682
Modified:
code/branches/presentation/src/orxonox/infos/PlayerInfo.cc
code/branches/presentation/src/orxonox/worldentities/ControllableEntity.cc
code/branches/presentation/src/orxonox/worldentities/ControllableEntity.h
Log:
Hack-ish Hack to just have one HUD at a time.
Modified: code/branches/presentation/src/orxonox/infos/PlayerInfo.cc
===================================================================
--- code/branches/presentation/src/orxonox/infos/PlayerInfo.cc 2011-05-30 07:58:19 UTC (rev 8681)
+++ code/branches/presentation/src/orxonox/infos/PlayerInfo.cc 2011-05-30 08:20:27 UTC (rev 8682)
@@ -175,7 +175,8 @@
{
if (!entity)
return;
-
+
+ this->controllableEntity_->destroyHud(); // HACK-ish
this->previousControllableEntity_.push_back(WeakPtr<ControllableEntity>(this->controllableEntity_));
this->controllableEntity_ = entity;
this->controllableEntityID_ = entity->getObjectID();
@@ -233,6 +234,7 @@
return;
this->controllableEntity_->setController(0);
+ this->controllableEntity_->destroyHud(); // HACK-ish
// this->controllableEntity_ = this->previousControllableEntity_.back();
do {
@@ -244,6 +246,10 @@
if ( this->controllableEntity_ != NULL && this->controller_ != NULL)
this->controller_->setControllableEntity(this->controllableEntity_);
+ // HACK-ish
+ if(this->controllableEntity_ != NULL)
+ this->controllableEntity_->createHud();
+
if ( GameMode::isMaster() )
entity->removePlayer();
Modified: code/branches/presentation/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/branches/presentation/src/orxonox/worldentities/ControllableEntity.cc 2011-05-30 07:58:19 UTC (rev 8681)
+++ code/branches/presentation/src/orxonox/worldentities/ControllableEntity.cc 2011-05-30 08:20:27 UTC (rev 8682)
@@ -405,6 +405,12 @@
}
}
+ this->createHud();
+ }
+
+ // HACK-ish
+ void ControllableEntity::createHud(void)
+ {
if (!this->hud_ && GameMode::showsGraphics())
{
if (!this->hudtemplate_.empty())
@@ -416,6 +422,15 @@
}
}
+ void ControllableEntity::destroyHud(void)
+ {
+ if (this->hud_ != NULL)
+ {
+ this->hud_->destroy();
+ this->hud_ = NULL;
+ }
+ }
+
void ControllableEntity::stopLocalHumanControl()
{
if (this->camera_)
Modified: code/branches/presentation/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- code/branches/presentation/src/orxonox/worldentities/ControllableEntity.h 2011-05-30 07:58:19 UTC (rev 8681)
+++ code/branches/presentation/src/orxonox/worldentities/ControllableEntity.h 2011-05-30 08:20:27 UTC (rev 8682)
@@ -175,6 +175,9 @@
inline void setHudTemplate(const std::string& name)
{ this->hudtemplate_ = name; }
+ // HACK-ish
+ void createHud(void);
+ void destroyHud(void);
Ogre::SceneNode* cameraPositionRootNode_;
More information about the Orxonox-commit
mailing list