Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 21, 2016, 1:59:04 PM (9 years ago)
Author:
muemart
Message:

Fix some clang-tidy warnings.
Also, Serialise.h was doing some C-style casts that ended up being const casts. I moved those const casts as close to the source as possible and changed the loadAndIncrease functions to not do that.

Location:
code/trunk/src/orxonox/worldentities
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/worldentities/StaticEntity.cc

    r11071 r11083  
    5454    void StaticEntity::registerVariables()
    5555    {
    56         registerVariable(this->getPosition(),    VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::positionChanged));
    57         registerVariable(this->getOrientation(), VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::orientationChanged));
     56        // Ugly const casts, but are valid because position and orientation are not actually const
     57        registerVariable(const_cast<Vector3&>(this->getPosition()),    VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::positionChanged));
     58        registerVariable(const_cast<Quaternion&>(this->getOrientation()), VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::orientationChanged));
    5859    }
    5960
  • code/trunk/src/orxonox/worldentities/WorldEntity.cc

    r11071 r11083  
    190190        registerVariable(this->bVisible_,       VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility));
    191191
    192         registerVariable(this->getScale3D(),    VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::scaleChanged));
     192        // Ugly const cast, but is valid because the scale is not actually const
     193        registerVariable(const_cast<Vector3&>(this->getScale3D()),    VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::scaleChanged));
    193194
    194195        // Physics stuff
  • code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.h

    r11071 r11083  
    4646            virtual ~FpsPlayer();
    4747
    48             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    49             virtual void tick(float dt);
     48            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     49            virtual void tick(float dt) override;
    5050            void registerVariables();
    5151            void setConfigValues();
    5252
    53             virtual void moveFrontBack(const Vector2& value);
    54             virtual void moveRightLeft(const Vector2& value);
    55             virtual void moveUpDown(const Vector2& value);
     53            virtual void moveFrontBack(const Vector2& value) override;
     54            virtual void moveRightLeft(const Vector2& value) override;
     55            virtual void moveUpDown(const Vector2& value) override;
    5656
    57             virtual void rotateYaw(const Vector2& value);
    58             virtual void rotatePitch(const Vector2& value);
    59             virtual void rotateRoll(const Vector2& value);
     57            virtual void rotateYaw(const Vector2& value) override;
     58            virtual void rotatePitch(const Vector2& value) override;
     59            virtual void rotateRoll(const Vector2& value) override;
    6060
    6161
     
    6565                { return this->meshSrc_; }
    6666
    67             void boost(bool bBoost); //acctually jump
     67            void boost(bool bBoost) override; //actually jump
    6868
    6969            virtual void fire();
     
    7171            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    7272
    73             virtual void addedWeaponPack(WeaponPack* wPack);
     73            virtual void addedWeaponPack(WeaponPack* wPack) override;
    7474
    7575        protected:
    76             virtual void setPlayer(PlayerInfo* player);
    77             virtual void startLocalHumanControl();
     76            virtual void setPlayer(PlayerInfo* player) override;
     77            virtual void startLocalHumanControl() override;
    7878            bool bInvertYAxis_;
    7979
     
    8989
    9090        private:
    91             virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
     91            virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const override;
    9292            float speed_;
    9393
  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc

    r11071 r11083  
    235235
    236236        // This function call adds a lift to the ship when it is rotating to make it's movement more "realistic" and enhance the feeling.
    237         if (this->getLocalVelocity().z < 0 && abs(this->getLocalVelocity().z) < stallSpeed_)
    238             this->moveRightLeft(-lift_ / 5.0f * value * sqrt(abs(this->getLocalVelocity().z)));
     237        if (this->getLocalVelocity().z < 0 && std::abs(this->getLocalVelocity().z) < stallSpeed_)
     238            this->moveRightLeft(-lift_ / 5.0f * value * sqrt(std::abs(this->getLocalVelocity().z)));
    239239    }
    240240
     
    257257
    258258        // This function call adds a lift to the ship when it is pitching to make it's movement more "realistic" and enhance the feeling.
    259         if (this->getLocalVelocity().z < 0 && abs(this->getLocalVelocity().z) < stallSpeed_)
    260             this->moveUpDown(lift_ / 5.0f * pitch * sqrt(abs(this->getLocalVelocity().z)));
     259        if (this->getLocalVelocity().z < 0 && std::abs(this->getLocalVelocity().z) < stallSpeed_)
     260            this->moveUpDown(lift_ / 5.0f * pitch * sqrt(std::abs(this->getLocalVelocity().z)));
    261261    }
    262262
     
    505505            this->shakeDt_ += dt;
    506506
    507             float frequency = this->shakeFrequency_ * (square(abs(this->getLocalVelocity().z)));
     507            float frequency = this->shakeFrequency_ * (square(std::abs(this->getLocalVelocity().z)));
    508508
    509509            if (this->shakeDt_ >= 1.0f/frequency)
Note: See TracChangeset for help on using the changeset viewer.