[Orxonox-commit 773] r3300 - in trunk/src: core orxonox/gamestates orxonox/interfaces orxonox/objects/gametypes orxonox/objects/infos orxonox/objects/pickup orxonox/objects/worldentities orxonox/objects/worldentities/pawns orxonox/overlays orxonox/overlays/console orxonox/overlays/hud orxonox/overlays/map orxonox/tools util

rgrieder at orxonox.net rgrieder at orxonox.net
Fri Jul 17 23:53:36 CEST 2009


Author: rgrieder
Date: 2009-07-17 23:53:35 +0200 (Fri, 17 Jul 2009)
New Revision: 3300

Modified:
   trunk/src/core/CommandLine.h
   trunk/src/core/Game.cc
   trunk/src/core/Shell.cc
   trunk/src/core/TclThreadManager.cc
   trunk/src/orxonox/gamestates/GSDedicated.cc
   trunk/src/orxonox/interfaces/RadarViewable.cc
   trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc
   trunk/src/orxonox/objects/gametypes/UnderAttack.cc
   trunk/src/orxonox/objects/infos/Bot.cc
   trunk/src/orxonox/objects/pickup/PickupCollection.cc
   trunk/src/orxonox/objects/worldentities/ParticleEmitter.h
   trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
   trunk/src/orxonox/overlays/GUIOverlay.cc
   trunk/src/orxonox/overlays/OrxonoxOverlay.cc
   trunk/src/orxonox/overlays/console/InGameConsole.cc
   trunk/src/orxonox/overlays/hud/GametypeStatus.cc
   trunk/src/orxonox/overlays/hud/HUDBar.cc
   trunk/src/orxonox/overlays/hud/HUDHealthBar.cc
   trunk/src/orxonox/overlays/hud/HUDTimer.cc
   trunk/src/orxonox/overlays/map/Map.cc
   trunk/src/orxonox/tools/TextureGenerator.cc
   trunk/src/orxonox/tools/Timer.h
   trunk/src/util/Math.h
   trunk/src/util/StringUtils.cc
Log:
Found a few more C-Style casts.

Modified: trunk/src/core/CommandLine.h
===================================================================
--- trunk/src/core/CommandLine.h	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/core/CommandLine.h	2009-07-17 21:53:35 UTC (rev 3300)
@@ -195,7 +195,7 @@
     template <>
     inline void CommandLine::getValue<std::string>(const std::string& name, std::string* value)
     {
-        *value = (std::string)(getArgument(name)->getValue().getString());
+        *value = getArgument(name)->getValue().getString();
     }
 
     /**

Modified: trunk/src/core/Game.cc
===================================================================
--- trunk/src/core/Game.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/core/Game.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -286,7 +286,7 @@
                 std::list<StatisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin();
                 assert(it != this->statisticsTickTimes_.end());
                 int64_t lastTime = currentTime - this->configuration_->statisticsAvgLength_;
-                if ((int64_t)it->tickTime < lastTime)
+                if (static_cast<int64_t>(it->tickTime) < lastTime)
                 {
                     do
                     {
@@ -294,7 +294,7 @@
                         this->periodTickTime_ -= it->tickLength;
                         ++it;
                         assert(it != this->statisticsTickTimes_.end());
-                    } while ((int64_t)it->tickTime < lastTime);
+                    } while (static_cast<int64_t>(it->tickTime) < lastTime);
                     this->statisticsTickTimes_.erase(this->statisticsTickTimes_.begin(), it);
                 }
 

Modified: trunk/src/core/Shell.cc
===================================================================
--- trunk/src/core/Shell.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/core/Shell.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -128,7 +128,7 @@
         this->inputBuffer_->registerListener(this, &Shell::hintandcomplete, '\t', true);
         this->inputBuffer_->registerListener(this, &Shell::backspace, '\b', true);
         this->inputBuffer_->registerListener(this, &Shell::deletechar, KeyCode::Delete);
-        this->inputBuffer_->registerListener(this, &Shell::exit, (char)27, true);
+        this->inputBuffer_->registerListener(this, &Shell::exit, static_cast<char>(27), true);
         this->inputBuffer_->registerListener(this, &Shell::cursor_right, KeyCode::Right);
         this->inputBuffer_->registerListener(this, &Shell::cursor_left, KeyCode::Left);
         this->inputBuffer_->registerListener(this, &Shell::cursor_end, KeyCode::End);
@@ -148,9 +148,9 @@
     {
         Shell& instance = Shell::getInstance();
 
-        for (int i = instance.historyOffset_; i < (int)instance.commandHistory_.size(); ++i)
+        for (unsigned int i = instance.historyOffset_; i < instance.commandHistory_.size(); ++i)
             instance.addLine(instance.commandHistory_[i], -1);
-        for (int i =  0; i < (int)instance.historyOffset_; ++i)
+        for (unsigned int i =  0; i < instance.historyOffset_; ++i)
             instance.addLine(instance.commandHistory_[i], -1);
     }
 

Modified: trunk/src/core/TclThreadManager.cc
===================================================================
--- trunk/src/core/TclThreadManager.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/core/TclThreadManager.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -576,11 +576,11 @@
                     {
                         this->debug("TclThread_query: " + command);
                         try
-                        {   output = (std::string)target->interpreter_->eval(command);   }
+                        {   output = static_cast<std::string>(target->interpreter_->eval(command));   }
                         catch (Tcl::tcl_error const &e)
-                        {   this->error("Tcl error: " + (std::string)e.what());   }
+                        {   this->error("Tcl error: " + static_cast<std::string>(e.what()));   }
                         catch (std::exception const &e)
-                        {   this->error("Error while executing Tcl: " + (std::string)e.what());   }
+                        {   this->error("Error while executing Tcl: " + static_cast<std::string>(e.what()));   }
                     }
                     else
                     {

Modified: trunk/src/orxonox/gamestates/GSDedicated.cc
===================================================================
--- trunk/src/orxonox/gamestates/GSDedicated.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/gamestates/GSDedicated.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -118,7 +118,7 @@
         {
             msleep(static_cast<unsigned int>((NETWORK_PERIOD - timeSinceLastUpdate_)*1000));
             msleep(static_cast<unsigned int>(NETWORK_PERIOD*1000)); // NOTE: this is to throttle the non-network framerate
-//            COUT(0) << "sleeping for " << (int)((NETWORK_PERIOD - timeSinceLastUpdate_) * 1000 * 1000) << " usec" << endl;
+//            COUT(0) << "sleeping for " << static_cast<int>((NETWORK_PERIOD - timeSinceLastUpdate_) * 1000 * 1000) << " usec" << endl;
         }
         processQueue();
         printLine();

Modified: trunk/src/orxonox/interfaces/RadarViewable.cc
===================================================================
--- trunk/src/orxonox/interfaces/RadarViewable.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/interfaces/RadarViewable.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -121,7 +121,7 @@
         if( this->MapNode_ )
         {
             this->MapNode_->setPosition( this->getRVWorldPosition() );
-            this->MapNode_->translate( this->getRVOrientedVelocity(), (Ogre::Node::TransformSpace)3 );
+            this->MapNode_->translate( this->getRVOrientedVelocity(), static_cast<Ogre::Node::TransformSpace>(3) );
             this->MapNode_->setOrientation( this->getWorldEntity()->getOrientation() );
 //Vector3 v = this->getRVWorldPosition();
             //this->line_->setPoint(1, Vector3(0,v.y,0) );

Modified: trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc
===================================================================
--- trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -70,7 +70,7 @@
         std::vector<unsigned int> playersperteam(this->teams_, 0);
 
         for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
-            if (it->second < (int)this->teams_ && it->second >= 0)
+            if (it->second < static_cast<int>(this->teams_) && it->second >= 0)
                 playersperteam[it->second]++;
 
         unsigned int minplayers = (unsigned int)-1;
@@ -126,7 +126,7 @@
             if ((*it)->isA(Class(TeamSpawnPoint)))
             {
                 TeamSpawnPoint* tsp = dynamic_cast<TeamSpawnPoint*>(*it);
-                if (tsp && (int)tsp->getTeamNumber() != desiredTeamNr)
+                if (tsp && static_cast<int>(tsp->getTeamNumber()) != desiredTeamNr)
                 {
                     teamSpawnPoints.erase(it++);
                     continue;
@@ -159,7 +159,7 @@
 
         // Set the team colour
         std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);
-        if (it_player != this->teamnumbers_.end() && it_player->second >= 0 && it_player->second < (int)this->teamcolours_.size())
+        if (it_player != this->teamnumbers_.end() && it_player->second >= 0 && it_player->second < static_cast<int>(this->teamcolours_.size()))
         {
             if (pawn)
             {

Modified: trunk/src/orxonox/objects/gametypes/UnderAttack.cc
===================================================================
--- trunk/src/orxonox/objects/gametypes/UnderAttack.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/objects/gametypes/UnderAttack.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -50,7 +50,7 @@
         this->setHUDTemplate("UnderAttackHUD");
 
         this->setConfigValues();
-        this->timesequence_ = (int) this->gameTime_;
+        this->timesequence_ = static_cast<this->gameTime_);
     }
 
     void UnderAttack::setConfigValues()

Modified: trunk/src/orxonox/objects/infos/Bot.cc
===================================================================
--- trunk/src/orxonox/objects/infos/Bot.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/objects/infos/Bot.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -51,7 +51,7 @@
 
         this->setConfigValues();
 
-        this->setName(this->names_[(size_t)(rnd() * this->names_.size())]);
+        this->setName(this->names_[static_cast<size_t>(rnd() * this->names_.size())]);
 
         if (this->getGametype())
             this->getGametype()->playerEntered(this);

Modified: trunk/src/orxonox/objects/pickup/PickupCollection.cc
===================================================================
--- trunk/src/orxonox/objects/pickup/PickupCollection.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/objects/pickup/PickupCollection.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -85,7 +85,7 @@
     */
     bool PickupCollection::checkSlot(BaseItem* item)
     {
-        return ((int)this->items_.count(item->getPickupIdentifier()) < item->getMaxCarryAmount());
+        return (static_cast<int>(this->items_.count(item->getPickupIdentifier())) < item->getMaxCarryAmount());
     }
     /**
         @brief

Modified: trunk/src/orxonox/objects/worldentities/ParticleEmitter.h
===================================================================
--- trunk/src/orxonox/objects/worldentities/ParticleEmitter.h	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/objects/worldentities/ParticleEmitter.h	2009-07-17 21:53:35 UTC (rev 3300)
@@ -63,7 +63,7 @@
 
         protected:
             inline void setLODxml(unsigned int level)
-                { this->LOD_ = (LODParticle::Value)level; this->LODchanged(); }
+                { this->LOD_ = static_cast<LODParticle::Value>(level); this->LODchanged(); }
             inline unsigned int getLODxml() const
                 { return (unsigned int)this->LOD_; }
 

Modified: trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -280,7 +280,7 @@
         }
         else
         {
-            callMemberNetworkFunction(Pawn, doFire, this->getObjectID(), 0, ((uint8_t)firemode));
+            callMemberNetworkFunction(Pawn, doFire, this->getObjectID(), 0, firemode);
             if (this->weaponSystem_)
                 this->weaponSystem_->fire(firemode);
         }

Modified: trunk/src/orxonox/overlays/GUIOverlay.cc
===================================================================
--- trunk/src/orxonox/overlays/GUIOverlay.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/overlays/GUIOverlay.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -66,7 +66,7 @@
         {
             std::string str;
             std::stringstream out;
-            out << (long)this;
+            out << static_cast<long>(this);
             str = out.str();
             GUIManager::getInstance().executeCode("showCursor()");
             InputManager::getInstance().requestEnterState("guiMouseOnly");

Modified: trunk/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- trunk/src/orxonox/overlays/OrxonoxOverlay.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/overlays/OrxonoxOverlay.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -214,7 +214,7 @@
             float angle = this->angle_.valueDegrees();
             if (angle < 0.0)
                 angle = -angle;
-            angle -= 180.0f * (int)(angle / 180.0);
+            angle -= 180.0f * static_caste<int>(angle / 180.0);
 
             // take the reverse if angle is about 90 degrees
             float tempAspect;
@@ -276,7 +276,7 @@
         float angle = this->angle_.valueRadians();
         if (angle < 0.0)
             angle = -angle;
-        angle -= Ogre::Math::PI * (int)(angle / (Ogre::Math::PI));
+        angle -= Ogre::Math::PI * static_cast<int>(angle / (Ogre::Math::PI));
         if (angle > Ogre::Math::PI * 0.5)
             angle = Ogre::Math::PI - angle;
 

Modified: trunk/src/orxonox/overlays/console/InGameConsole.cc
===================================================================
--- trunk/src/orxonox/overlays/console/InGameConsole.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/overlays/console/InGameConsole.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -331,7 +331,7 @@
             pos = maxCharsPerLine_;
 
         this->consoleOverlayCursor_->setCaption(std::string(pos,' ') + cursorSymbol_);
-        this->consoleOverlayCursor_->setTop((int) this->windowH_ * this->relativeHeight - 24);
+        this->consoleOverlayCursor_->setTop(static_cast<int>(this->windowH_ * this->relativeHeight) - 24);
     }
 
     /**
@@ -415,24 +415,24 @@
     {
         this->windowW_ = newWidth;
         this->windowH_ = newHeight;
-        this->consoleOverlayBorder_->setWidth((int) this->windowW_* this->relativeWidth);
-        this->consoleOverlayBorder_->setHeight((int) this->windowH_ * this->relativeHeight);
-        this->consoleOverlayNoise_->setWidth((int) this->windowW_ * this->relativeWidth - 10);
-        this->consoleOverlayNoise_->setHeight((int) this->windowH_ * this->relativeHeight - 5);
+        this->consoleOverlayBorder_->setWidth(static_cast<int>(this->windowW_* this->relativeWidth));
+        this->consoleOverlayBorder_->setHeight(static_cast<int>(this->windowH_ * this->relativeHeight));
+        this->consoleOverlayNoise_->setWidth(static_cast<int>(this->windowW_ * this->relativeWidth) - 10);
+        this->consoleOverlayNoise_->setHeight(static_cast<int>(this->windowH_ * this->relativeHeight) - 5);
         this->consoleOverlayNoise_->setTiling(consoleOverlayNoise_->getWidth() / (50.0f * this->noiseSize_), consoleOverlayNoise_->getHeight() / (50.0f * this->noiseSize_));
 
         // now adjust the text lines...
-        this->desiredTextWidth_ = (int) (this->windowW_ * this->relativeWidth) - 12;
+        this->desiredTextWidth_ = static_cast<int>(this->windowW_ * this->relativeWidth) - 12;
 
         if (LINES > 0)
-            this->maxCharsPerLine_ = std::max((unsigned int)10, (unsigned int) ((float)this->desiredTextWidth_ / CHAR_WIDTH));
+            this->maxCharsPerLine_ = std::max(10U, static_cast<unsigned int>(static_cast<float>(this->desiredTextWidth_) / CHAR_WIDTH));
         else
             this->maxCharsPerLine_ = 10;
 
         for (int i = 0; i < LINES; i++)
         {
             this->consoleOverlayTextAreas_[i]->setWidth(this->desiredTextWidth_);
-            this->consoleOverlayTextAreas_[i]->setTop((int) this->windowH_ * this->relativeHeight - 24 - 14*i);
+            this->consoleOverlayTextAreas_[i]->setTop(static_cast<int>(this->windowH_ * this->relativeHeight) - 24 - 14*i);
         }
 
         this->linesChanged();

Modified: trunk/src/orxonox/overlays/hud/GametypeStatus.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/GametypeStatus.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/overlays/hud/GametypeStatus.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -69,7 +69,7 @@
             else if (!gtinfo->hasEnded())
             {
                 if (gtinfo->isStartCountdownRunning())
-                    this->setCaption(multi_cast<std::string>((int)ceil(gtinfo->getStartCountdown())));
+                    this->setCaption(multi_cast<std::string>(static_cast<int>(ceil(gtinfo->getStartCountdown()))));
                 else if (ce->isA(Class(Spectator)))
                     this->setCaption("Press [Fire] to respawn");
                 else

Modified: trunk/src/orxonox/overlays/hud/HUDBar.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/HUDBar.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/overlays/hud/HUDBar.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -72,7 +72,7 @@
 
         // create new material
         std::string materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++);
-        Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General");
+        Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialname, "General"));
         material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
         this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState();
         this->textureUnitState_->setTextureName("bar2.tga");

Modified: trunk/src/orxonox/overlays/hud/HUDHealthBar.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/HUDHealthBar.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/overlays/hud/HUDHealthBar.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -82,7 +82,7 @@
         if (this->owner_)
         {
             this->setValue(this->owner_->getHealth() / this->owner_->getInitialHealth());
-            this->textoverlay_->setCaption(multi_cast<std::string>((int)this->owner_->getHealth()));
+            this->textoverlay_->setCaption(multi_cast<std::string>(static_cast<int>(this->owner_->getHealth())));
         }
 
         if (this->bUseBarColour_)

Modified: trunk/src/orxonox/overlays/hud/HUDTimer.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/HUDTimer.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/overlays/hud/HUDTimer.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -58,7 +58,7 @@
         {
             if (gametype->getTimerIsActive())
             {
-                this->setCaption(multi_cast<std::string>((int)gametype->getTime() + 1));
+                this->setCaption(multi_cast<std::string>(static_cast<int>(gametype->getTime()) + 1));
             }
         }
     }

Modified: trunk/src/orxonox/overlays/map/Map.cc
===================================================================
--- trunk/src/orxonox/overlays/map/Map.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/overlays/map/Map.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -331,7 +331,7 @@
                 //this->CamNodeHelper_ = this->CamNode_->createChildSceneNode();
                 //this->CamNodeHelper_->attachObject(this->Cam_);
                     this->Cam_->setPosition(0, 0, DISTANCE);
-                    this->Cam_->pitch( (Degree)PITCH );
+                    this->Cam_->pitch( static_cast<Degree>(PITCH) );
                     this->Cam_->lookAt(Vector3(0,0,0));
                 //this->Cam_->setAutoTracking(true, this->playerShipNode_);
                 }
@@ -424,25 +424,25 @@
             return;
 
 /*
-        singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(1) ));
+        singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(1) ));
 
         Map::singletonMap_s->CamNodeHelper_->setDirection(Vector3::UNIT_Y, Ogre::Node::TS_PARENT, Vector3::UNIT_Y);
         Map::singletonMap_s->CamNodeHelper_->lookAt(Vector3(0,0,0), Ogre::Node::TS_PARENT);
 */
-        singletonMap_s->CamNode_->yaw( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_PARENT);
+        singletonMap_s->CamNode_->yaw( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_PARENT);
     }
 
     void Map::rotatePitch(const Vector2& value)
     {
         if(!( Map::singletonMap_s && Map::singletonMap_s->CamNode_ ))
             return;
-            //singletonMap_s->Cam_->setOrientation(singletonMap_s->Cam_->getOrientation() * Quaternion( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_) , Vector3::UNIT_X));
-/*        singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(0) ));
+            //singletonMap_s->Cam_->setOrientation(singletonMap_s->Cam_->getOrientation() * Quaternion( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_) , Vector3::UNIT_X));
+/*        singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(0) ));
 
         Map::singletonMap_s->CamNodeHelper_->setDirection(Vector3::UNIT_Y, Ogre::Node::TS_PARENT, Vector3::UNIT_Y);
         Map::singletonMap_s->CamNodeHelper_->lookAt(Vector3(0,0,0), Ogre::Node::TS_PARENT);
 */
-        singletonMap_s->CamNode_->pitch( (Degree)(value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
+        singletonMap_s->CamNode_->pitch( static_cast<Degree>(value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
 
     }
 

Modified: trunk/src/orxonox/tools/TextureGenerator.cc
===================================================================
--- trunk/src/orxonox/tools/TextureGenerator.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/tools/TextureGenerator.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -72,7 +72,7 @@
         if (it == colourMap.end())
         {
             std::string materialName = textureName + "_Material_" + multi_cast<std::string>(materialCount_s++);
-            Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialName, "General");
+            Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialName, "General"));
             material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
             Ogre::TextureUnitState* textureUnitState = material->getTechnique(0)->getPass(0)->createTextureUnitState();
             textureUnitState->setTextureName(textureName);

Modified: trunk/src/orxonox/tools/Timer.h
===================================================================
--- trunk/src/orxonox/tools/Timer.h	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/orxonox/tools/Timer.h	2009-07-17 21:53:35 UTC (rev 3300)
@@ -99,7 +99,7 @@
                 { return this->bActive_; }
             /** @brief Returns the remaining time until the Timer calls the function. @return The remaining time */
             inline float getRemainingTime() const
-                { return (float)this->time_ / 1000000.0f; }
+                { return static_cast<float>(this->time_ / 1000000.0f); }
             /** @brief Gives the Timer some extra time. @param time The amount of extra time in seconds */
             inline void addTime(float time)
                 { if (time > 0.0f) this->time_ += (long long)(time * 1000000.0f); }

Modified: trunk/src/util/Math.h
===================================================================
--- trunk/src/util/Math.h	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/util/Math.h	2009-07-17 21:53:35 UTC (rev 3300)
@@ -121,7 +121,7 @@
     template <typename T>
     inline int round(T x)
     {
-        return (int)(x + 0.5);
+        return static_cast<int>(x + 0.5);
     }
 
     /**

Modified: trunk/src/util/StringUtils.cc
===================================================================
--- trunk/src/util/StringUtils.cc	2009-07-14 21:05:04 UTC (rev 3299)
+++ trunk/src/util/StringUtils.cc	2009-07-17 21:53:35 UTC (rev 3300)
@@ -81,7 +81,7 @@
     std::string removeTrailingWhitespaces(const std::string& str)
     {
         size_t pos1 = 0;
-        int pos2 = (int)(str.size() - 1);
+        int pos2 = static_cast<int>(str.size() - 1);
         for (; pos1 < str.size() && (str[pos1] == ' ' || str[pos1] == '\t' || str[pos1] == '\n'); pos1++);
         for (; pos2 > 0         && (str[pos2] == ' ' || str[pos2] == '\t' || str[pos2] == '\n'); pos2--);
         return str.substr(pos1, pos2 - pos1 + 1);
@@ -351,7 +351,7 @@
     {
         for (size_t i = 0; i < str->size(); ++i)
         {
-            (*str)[i] = (char)tolower((*str)[i]);
+            (*str)[i] = static_cast<char>(tolower((*str)[i]));
         }
     }
 
@@ -375,7 +375,7 @@
     {
         for (size_t i = 0; i < str->size(); ++i)
         {
-            (*str)[i] = (char)toupper((*str)[i]);
+            (*str)[i] = static_cast<char>(toupper((*str)[i]));
         }
     }
 




More information about the Orxonox-commit mailing list