Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 17, 2009, 11:53:35 PM (15 years ago)
Author:
rgrieder
Message:

Found a few more C-Style casts.

Location:
code/trunk/src/orxonox/overlays
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/overlays/GUIOverlay.cc

    r3196 r3300  
    6767            std::string str;
    6868            std::stringstream out;
    69             out << (long)this;
     69            out << static_cast<long>(this);
    7070            str = out.str();
    7171            GUIManager::getInstance().executeCode("showCursor()");
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc

    r3280 r3300  
    215215            if (angle < 0.0)
    216216                angle = -angle;
    217             angle -= 180.0f * (int)(angle / 180.0);
     217            angle -= 180.0f * static_caste<int>(angle / 180.0);
    218218
    219219            // take the reverse if angle is about 90 degrees
     
    277277        if (angle < 0.0)
    278278            angle = -angle;
    279         angle -= Ogre::Math::PI * (int)(angle / (Ogre::Math::PI));
     279        angle -= Ogre::Math::PI * static_cast<int>(angle / (Ogre::Math::PI));
    280280        if (angle > Ogre::Math::PI * 0.5)
    281281            angle = Ogre::Math::PI - angle;
  • code/trunk/src/orxonox/overlays/console/InGameConsole.cc

    r3280 r3300  
    332332
    333333        this->consoleOverlayCursor_->setCaption(std::string(pos,' ') + cursorSymbol_);
    334         this->consoleOverlayCursor_->setTop((int) this->windowH_ * this->relativeHeight - 24);
     334        this->consoleOverlayCursor_->setTop(static_cast<int>(this->windowH_ * this->relativeHeight) - 24);
    335335    }
    336336
     
    416416        this->windowW_ = newWidth;
    417417        this->windowH_ = newHeight;
    418         this->consoleOverlayBorder_->setWidth((int) this->windowW_* this->relativeWidth);
    419         this->consoleOverlayBorder_->setHeight((int) this->windowH_ * this->relativeHeight);
    420         this->consoleOverlayNoise_->setWidth((int) this->windowW_ * this->relativeWidth - 10);
    421         this->consoleOverlayNoise_->setHeight((int) this->windowH_ * this->relativeHeight - 5);
     418        this->consoleOverlayBorder_->setWidth(static_cast<int>(this->windowW_* this->relativeWidth));
     419        this->consoleOverlayBorder_->setHeight(static_cast<int>(this->windowH_ * this->relativeHeight));
     420        this->consoleOverlayNoise_->setWidth(static_cast<int>(this->windowW_ * this->relativeWidth) - 10);
     421        this->consoleOverlayNoise_->setHeight(static_cast<int>(this->windowH_ * this->relativeHeight) - 5);
    422422        this->consoleOverlayNoise_->setTiling(consoleOverlayNoise_->getWidth() / (50.0f * this->noiseSize_), consoleOverlayNoise_->getHeight() / (50.0f * this->noiseSize_));
    423423
    424424        // now adjust the text lines...
    425         this->desiredTextWidth_ = (int) (this->windowW_ * this->relativeWidth) - 12;
     425        this->desiredTextWidth_ = static_cast<int>(this->windowW_ * this->relativeWidth) - 12;
    426426
    427427        if (LINES > 0)
    428             this->maxCharsPerLine_ = std::max((unsigned int)10, (unsigned int) ((float)this->desiredTextWidth_ / CHAR_WIDTH));
     428            this->maxCharsPerLine_ = std::max(10U, static_cast<unsigned int>(static_cast<float>(this->desiredTextWidth_) / CHAR_WIDTH));
    429429        else
    430430            this->maxCharsPerLine_ = 10;
     
    433433        {
    434434            this->consoleOverlayTextAreas_[i]->setWidth(this->desiredTextWidth_);
    435             this->consoleOverlayTextAreas_[i]->setTop((int) this->windowH_ * this->relativeHeight - 24 - 14*i);
     435            this->consoleOverlayTextAreas_[i]->setTop(static_cast<int>(this->windowH_ * this->relativeHeight) - 24 - 14*i);
    436436        }
    437437
  • code/trunk/src/orxonox/overlays/hud/GametypeStatus.cc

    r3280 r3300  
    7070            {
    7171                if (gtinfo->isStartCountdownRunning())
    72                     this->setCaption(multi_cast<std::string>((int)ceil(gtinfo->getStartCountdown())));
     72                    this->setCaption(multi_cast<std::string>(static_cast<int>(ceil(gtinfo->getStartCountdown()))));
    7373                else if (ce->isA(Class(Spectator)))
    7474                    this->setCaption("Press [Fire] to respawn");
  • code/trunk/src/orxonox/overlays/hud/HUDBar.cc

    r3280 r3300  
    7373        // create new material
    7474        std::string materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++);
    75         Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General");
     75        Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialname, "General"));
    7676        material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
    7777        this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState();
  • code/trunk/src/orxonox/overlays/hud/HUDHealthBar.cc

    r3280 r3300  
    8383        {
    8484            this->setValue(this->owner_->getHealth() / this->owner_->getInitialHealth());
    85             this->textoverlay_->setCaption(multi_cast<std::string>((int)this->owner_->getHealth()));
     85            this->textoverlay_->setCaption(multi_cast<std::string>(static_cast<int>(this->owner_->getHealth())));
    8686        }
    8787
  • code/trunk/src/orxonox/overlays/hud/HUDTimer.cc

    r3280 r3300  
    5959            if (gametype->getTimerIsActive())
    6060            {
    61                 this->setCaption(multi_cast<std::string>((int)gametype->getTime() + 1));
     61                this->setCaption(multi_cast<std::string>(static_cast<int>(gametype->getTime()) + 1));
    6262            }
    6363        }
  • code/trunk/src/orxonox/overlays/map/Map.cc

    r3196 r3300  
    332332                //this->CamNodeHelper_->attachObject(this->Cam_);
    333333                    this->Cam_->setPosition(0, 0, DISTANCE);
    334                     this->Cam_->pitch( (Degree)PITCH );
     334                    this->Cam_->pitch( static_cast<Degree>(PITCH) );
    335335                    this->Cam_->lookAt(Vector3(0,0,0));
    336336                //this->Cam_->setAutoTracking(true, this->playerShipNode_);
     
    425425
    426426/*
    427         singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(1) ));
     427        singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(1) ));
    428428
    429429        Map::singletonMap_s->CamNodeHelper_->setDirection(Vector3::UNIT_Y, Ogre::Node::TS_PARENT, Vector3::UNIT_Y);
    430430        Map::singletonMap_s->CamNodeHelper_->lookAt(Vector3(0,0,0), Ogre::Node::TS_PARENT);
    431431*/
    432         singletonMap_s->CamNode_->yaw( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_PARENT);
     432        singletonMap_s->CamNode_->yaw( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_PARENT);
    433433    }
    434434
     
    437437        if(!( Map::singletonMap_s && Map::singletonMap_s->CamNode_ ))
    438438            return;
    439             //singletonMap_s->Cam_->setOrientation(singletonMap_s->Cam_->getOrientation() * Quaternion( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_) , Vector3::UNIT_X));
    440 /*        singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(0) ));
     439            //singletonMap_s->Cam_->setOrientation(singletonMap_s->Cam_->getOrientation() * Quaternion( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_) , Vector3::UNIT_X));
     440/*        singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(0) ));
    441441
    442442        Map::singletonMap_s->CamNodeHelper_->setDirection(Vector3::UNIT_Y, Ogre::Node::TS_PARENT, Vector3::UNIT_Y);
    443443        Map::singletonMap_s->CamNodeHelper_->lookAt(Vector3(0,0,0), Ogre::Node::TS_PARENT);
    444444*/
    445         singletonMap_s->CamNode_->pitch( (Degree)(value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
     445        singletonMap_s->CamNode_->pitch( static_cast<Degree>(value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
    446446
    447447    }
Note: See TracChangeset for help on using the changeset viewer.