[Orxonox-commit 1404] r6122 - in code/branches/presentation2/src: libraries/core orxonox/controllers

rgrieder at orxonox.net rgrieder at orxonox.net
Mon Nov 23 20:10:03 CET 2009


Author: rgrieder
Date: 2009-11-23 20:10:03 +0100 (Mon, 23 Nov 2009)
New Revision: 6122

Modified:
   code/branches/presentation2/src/libraries/core/IOConsole.cc
   code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
Log:
Fixed dedicated problem in NHC and a memory leak on windows in the IOConsole.

Modified: code/branches/presentation2/src/libraries/core/IOConsole.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/IOConsole.cc	2009-11-23 17:19:58 UTC (rev 6121)
+++ code/branches/presentation2/src/libraries/core/IOConsole.cc	2009-11-23 19:10:03 UTC (rev 6122)
@@ -483,10 +483,10 @@
 
     IOConsole::~IOConsole()
     {
-/*
-        resetTerminalMode();
+//        resetTerminalMode();
         this->shell_->destroy();
 
+/*
         // Enable standard this->cout_ logging again
         OutputHandler::getInstance().enableCout();
 */

Modified: code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc	2009-11-23 17:19:58 UTC (rev 6121)
+++ code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc	2009-11-23 19:10:03 UTC (rev 6122)
@@ -51,17 +51,22 @@
 
     NewHumanController* NewHumanController::localController_s = 0;
 
-    NewHumanController::NewHumanController(BaseObject* creator) : HumanController(creator)
+    NewHumanController::NewHumanController(BaseObject* creator)
+        : HumanController(creator)
+        , crossHairOverlay_(NULL)
     {
         RegisterObject(NewHumanController);
 
         overlaySize_ = 0.08;
         controlMode_ = 0;
 
-        crossHairOverlay_ = new OrxonoxOverlay(this);
-        crossHairOverlay_->setBackgroundMaterial("Orxonox/Crosshair3");
-        crossHairOverlay_->setSize(Vector2(overlaySize_, overlaySize_));
-        crossHairOverlay_->show();
+        if (GameMode::showsGraphics())
+        {
+            crossHairOverlay_ = new OrxonoxOverlay(this);
+            crossHairOverlay_->setBackgroundMaterial("Orxonox/Crosshair3");
+            crossHairOverlay_->setSize(Vector2(overlaySize_, overlaySize_));
+            crossHairOverlay_->show();
+        }
 
         // HACK: Define which objects are targetable when considering the creator of an orxonox::Model
         this->targetMask_.exclude(ClassByString("BaseObject"));
@@ -75,19 +80,24 @@
     {
         if (this->isInitialized())
         {
+            if (this->crossHairOverlay_)
+                this->crossHairOverlay_->destroy();
         }
     }
 
     void NewHumanController::tick(float dt)
     {
-        if( this->controllableEntity_ && !this->controllableEntity_->isInMouseLook() )
+        if (GameMode::showsGraphics())
         {
-            this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5-overlaySize_/2));
-            this->crossHairOverlay_->show();
+            if( this->controllableEntity_ && !this->controllableEntity_->isInMouseLook() )
+            {
+                this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5-overlaySize_/2));
+                this->crossHairOverlay_->show();
+            }
+            else
+                this->crossHairOverlay_->hide();
+            // TODO: update aimPosition of Pawn
         }
-        else
-            this->crossHairOverlay_->hide();
-        // TODO: update aimPosition of Pawn
 
         HumanController::tick(dt);
     }




More information about the Orxonox-commit mailing list