[Orxonox-commit 1037] r5757 - in code/trunk: data/overlays src/modules/overlays
dafrick at orxonox.net
dafrick at orxonox.net
Sun Sep 20 21:58:59 CEST 2009
Author: dafrick
Date: 2009-09-20 21:58:59 +0200 (Sun, 20 Sep 2009)
New Revision: 5757
Modified:
code/trunk/data/overlays/hudtemplates3.oxo
code/trunk/src/modules/overlays/GUIOverlay.cc
Log:
Fixed issues with GUI. The problem was, that the Owner of the GUIOverlay is set properly only after it is constructed and thus was NULL. Now the player gets updated whenever toggleVisibility is called. Also getOwner() no longer returns a PlayerInfo* it returns a ControllableEntity*, so that had to be adjusted to as well.
Modified: code/trunk/data/overlays/hudtemplates3.oxo
===================================================================
--- code/trunk/data/overlays/hudtemplates3.oxo 2009-09-20 19:15:22 UTC (rev 5756)
+++ code/trunk/data/overlays/hudtemplates3.oxo 2009-09-20 19:58:59 UTC (rev 5757)
@@ -95,5 +95,10 @@
align = "center"
/>
+ <GUIOverlay
+ name = "QuestGUI"
+ guiname = "QuestGUI"
+ />
+
</OverlayGroup>
</Template>
Modified: code/trunk/src/modules/overlays/GUIOverlay.cc
===================================================================
--- code/trunk/src/modules/overlays/GUIOverlay.cc 2009-09-20 19:15:22 UTC (rev 5756)
+++ code/trunk/src/modules/overlays/GUIOverlay.cc 2009-09-20 19:58:59 UTC (rev 5757)
@@ -36,6 +36,7 @@
#include "core/GUIManager.h"
#include "core/XMLPort.h"
#include "infos/PlayerInfo.h"
+#include "worldentities/ControllableEntity.h"
namespace orxonox
{
@@ -61,6 +62,9 @@
{
SUPER(GUIOverlay, changedVisibility);
+ //Setting player now.
+ GUIManager::getInstance().setPlayer(this->guiName_, (orxonox_cast<ControllableEntity*>(this->getOwner()))->getPlayer());
+
if (this->isVisible())
{
std::string str;
@@ -82,6 +86,6 @@
void GUIOverlay::setGUIName(const std::string& name)
{
this->guiName_ = name;
- GUIManager::getInstance().setPlayer(name, orxonox_cast<PlayerInfo*>(this->getOwner()));
+ GUIManager::getInstance().setPlayer(name, orxonox_cast<PlayerInfo*>(this->getOwner())); //Set Player is going to be NULL, so it needs to be set in changedVisibility() as well.
}
}
More information about the Orxonox-commit
mailing list