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/modules
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/gametypes/SpaceRaceController.cc

    r11071 r11083  
    397397    bool SpaceRaceController::vergleicheQuader(const Vector3& pointToPoint, const Vector3& groesse)
    398398    {
    399         if(abs(pointToPoint.x) < groesse.x)
     399        if(std::abs(pointToPoint.x) < groesse.x)
    400400            return true;
    401         if(abs(pointToPoint.y) < groesse.y)
     401        if(std::abs(pointToPoint.y) < groesse.y)
    402402            return true;
    403         if(abs(pointToPoint.z) < groesse.z)
     403        if(std::abs(pointToPoint.z) < groesse.z)
    404404            return true;
    405405        return false;
  • code/trunk/src/modules/hover/TimeHUD.cc

    r11071 r11083  
    8282        {
    8383            this->setCaption(getTimeString(this->time_));
     84            if (this->hoverGame_->getNumberOfFlags() == 0)
     85                setRunning(false);
    8486        }
    85         if(this->hoverGame_->getNumberOfFlags() == 0)
    86             setRunning(false);
    8787       
    8888    }
  • code/trunk/src/modules/invader/Invader.cc

    r11071 r11083  
    129129                newPawn->addTemplate("enemyinvader");
    130130            }
    131             newPawn->setPlayer(player);
     131            newPawn->setInvaderPlayer(player);
    132132            newPawn->level = level;
    133133            // spawn enemy at random points in front of player.
  • code/trunk/src/modules/invader/InvaderEnemy.cc

    r11071 r11083  
    5858        if (player != nullptr)
    5959        {
    60             float newZ = 2/(pow(abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * (player->getPosition().z - getPosition().z);
     60            float newZ = 2/(pow(std::abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * (player->getPosition().z - getPosition().z);
    6161            setVelocity(Vector3(1000.f - level * 100 , 0, newZ));
    6262        }
  • code/trunk/src/modules/invader/InvaderEnemy.h

    r11071 r11083  
    4949            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    5050            virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) override;
    51             virtual void setPlayer(InvaderShip* player){this->player = player;}
     51            virtual void setInvaderPlayer(InvaderShip* player){this->player = player;}
    5252
    5353            int level;
  • code/trunk/src/modules/invader/InvaderEnemyShooter.cc

    r11071 r11083  
    6363            float distPlayer = player->getPosition().z - getPosition().z;
    6464            // orxout() << "i'm different!" << endl;
    65             float newZ = 2/(pow(abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * distPlayer;
    66             setVelocity(Vector3(950 - abs(distPlayer), 0, newZ));
     65            float newZ = 2/(pow(std::abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * distPlayer;
     66            setVelocity(Vector3(950 - std::abs(distPlayer), 0, newZ));
    6767        }
    6868        Pawn::tick(dt);
  • code/trunk/src/modules/objects/ForceField.cc

    r11071 r11083  
    6363        //Standard Values
    6464        this->setDirection(Vector3::ZERO);
    65         this->setVelocity(100);
     65        this->setFieldVelocity(100);
    6666        this->setDiameter(500);
    6767        this->setMassDiameter(0);   //! We allow point-masses
     
    8888        SUPER(ForceField, XMLPort, xmlelement, mode);
    8989
    90         XMLPortParam(ForceField, "velocity", setVelocity, getVelocity, xmlelement, mode).defaultValues(100);
     90        XMLPortParam(ForceField, "velocity", setFieldVelocity, getFieldVelocity, xmlelement, mode).defaultValues(100);
    9191        XMLPortParam(ForceField, "diameter", setDiameter, getDiameter, xmlelement, mode).defaultValues(500);
    9292        XMLPortParam(ForceField, "massDiameter", setMassDiameter, getMassDiameter, xmlelement, mode).defaultValues(0);
  • code/trunk/src/modules/objects/ForceField.h

    r11071 r11083  
    9898            @param vel The velocity to be set.
    9999            */
    100             inline void setVelocity(float vel)
     100            inline void setFieldVelocity(float vel)
    101101                { this->velocity_ = vel; }
    102102            /**
     
    104104            @return Returns the velocity of the ForceField.
    105105            */
    106             inline float getVelocity()
     106            inline float getFieldVelocity()
    107107                { return this->velocity_; }
    108108
  • code/trunk/src/modules/objects/SpaceBoundaries.cc

    r11071 r11083  
    221221                    }
    222222                }
    223                 if(/* humanItem &&*/ abs(this->maxDistance_ - distance) < this->showDistance_ )
     223                if(/* humanItem &&*/ std::abs(this->maxDistance_ - distance) < this->showDistance_ )
    224224                {
    225225                    this->displayBoundaries(currentPawn, 1.0f - fabs(this->maxDistance_ - distance) / this->showDistance_); // Show the boundary
  • code/trunk/src/modules/objects/triggers/DistanceTrigger.h

    r11071 r11083  
    9797            virtual ~DistanceTrigger();
    9898
    99             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); // Method for creating a DistanceTrigger object through XML.
     99            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; // Method for creating a DistanceTrigger object through XML.
    100100
    101101            void addTarget(const std::string& targets); // Add some target to the DistanceTrigger.
  • code/trunk/src/modules/objects/triggers/EventTrigger.h

    r11071 r11083  
    7373            virtual ~EventTrigger();
    7474
    75             virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode); // Creates an event port.
     75            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; // Creates an event port.
    7676
    7777            /**
  • code/trunk/src/modules/overlays/hud/ChatOverlay.cc

    r11071 r11083  
    7373        Timer* timer = new Timer();
    7474        this->timers_.insert(timer); // store the timer in a set to destroy it in the destructor
    75         const ExecutorPtr& executor = createExecutor(createFunctor(&ChatOverlay::dropMessage, this));
     75        const ExecutorPtr executor = createExecutor(createFunctor(&ChatOverlay::dropMessage, this));
    7676        executor->setDefaultValues(timer);
    7777        timer->setTimer(this->displayTime_, false, executor, true);
  • code/trunk/src/modules/pickup/items/ShrinkPickup.cc

    r11071 r11083  
    277277            {
    278278                Pawn* pawn = this->carrierToPawnHelper();
    279                 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     279                if (pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     280                {
    280281                    this->Pickupable::destroy();
     282                    return;
     283                }
    281284
    282285                this->timeRemainig_ -= dt;
  • code/trunk/src/modules/pong/Pong.cc

    r11071 r11083  
    326326    PlayerInfo* Pong::getLeftPlayer() const
    327327    {
    328         if (this->bat_ != nullptr && this->bat_[0] != nullptr)
     328        if (this->bat_[0] != nullptr)
    329329            return this->bat_[0]->getPlayer();
    330330        else
     
    340340    PlayerInfo* Pong::getRightPlayer() const
    341341    {
    342         if (this->bat_ != nullptr && this->bat_[1] != nullptr)
     342        if (this->bat_[1] != nullptr)
    343343            return this->bat_[1]->getPlayer();
    344344        else
  • code/trunk/src/modules/questsystem/QuestListener.cc

    r11071 r11083  
    8181        XMLPortParam(QuestListener, "mode", setMode, getMode, xmlelement, mode);
    8282
    83         if(this->quest_ != nullptr)
     83        std::string questid;
     84
     85        if (this->quest_ != nullptr)
     86        {
    8487            this->quest_->addListener(this); // Adds the QuestListener to the Quests list of listeners.
    85 
    86         orxout(verbose, context::quests) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << endl;
     88            questid = this->quest_->getId();
     89        }
     90
     91        orxout(verbose, context::quests) << "QuestListener created for quest: {" << questid << "} with mode '" << this->getMode() << "'." << endl;
    8792    }
    8893
  • code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.h

    r11071 r11083  
    6161            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a ChangeQuestStatus object through XML.
    6262
    63             virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect.
    64 
    6563        protected:
    6664            /**
  • code/trunk/src/modules/tetris/Tetris.cc

    r11071 r11083  
    140140            const Vector3& currentStonePosition = someStone->getPosition(); //!< Saves the position of the currentStone
    141141
    142             if((position.x == currentStonePosition.x) && abs(position.y-currentStonePosition.y) < this->center_->getStoneSize())
     142            if((position.x == currentStonePosition.x) && std::abs(position.y-currentStonePosition.y) < this->center_->getStoneSize())
    143143                return false;
    144144        }
     
    222222        if(position.y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level
    223223        {
    224             float baseOffset = abs(stone->getPosition().y);
     224            float baseOffset = std::abs(stone->getPosition().y);
    225225            if (this->activeBrick_->getRotationCount() == 1 || this->activeBrick_->getRotationCount() == 3)
    226                 baseOffset = abs(stone->getPosition().x);
     226                baseOffset = std::abs(stone->getPosition().x);
    227227            float yOffset = baseOffset + this->center_->getStoneSize()/2.0f;//calculate offset
    228228            if(yOffset < 0) //catch brake-throughs
  • code/trunk/src/modules/tetris/TetrisBrick.cc

    r11071 r11083  
    213213        {
    214214            const Vector3& position = this->getPosition();
    215             Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
     215            Vector3 newPos = Vector3(position.x+value.x/std::abs(value.x)*this->size_, position.y, position.z);
    216216            if(!this->isValidMove(newPos))
    217217                return;
  • code/trunk/src/modules/tetris/TetrisStone.cc

    r9667 r11083  
    9292        {
    9393            const Vector3& position = this->getPosition();
    94             Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
     94            Vector3 newPos = Vector3(position.x+value.x/std::abs(value.x)*this->size_, position.y, position.z);
    9595            if(!this->tetris_->isValidMove(this, newPos))
    9696                return;
  • code/trunk/src/modules/towerdefense/TDCoordinate.cc

    r10629 r11083  
    6666        float tileScale = 100;
    6767
    68         Vector3 *coord = new Vector3();
    69         coord->x= (_x-8) * tileScale;
    70         coord->y= (_y-8) * tileScale;
    71         coord->z=0;
     68        Vector3 coord;
     69        coord.x= (_x-8) * tileScale;
     70        coord.y= (_y-8) * tileScale;
     71        coord.z=0;
    7272
    73         return *coord;
     73        return coord;
    7474    }
    7575}
  • code/trunk/src/modules/towerdefense/TowerDefense.cc

    r11071 r11083  
    377377    {       
    378378        TowerDefenseField* thisField = fields_[thisCoord->GetX()][thisCoord->GetY()];
    379         TDCoordinate* nextCoord = new TDCoordinate(0,0);
    380379
    381380        if (thisField->getType() != TowerDefenseFieldType::STREET && thisField->getType() != TowerDefenseFieldType::START)
     
    384383        }
    385384
     385        TDCoordinate* nextCoord = new TDCoordinate(0, 0);
     386
    386387        if (thisField->getAngle() == 0)
    387388        {
     
    406407        }
    407408
     409        delete nextCoord;
    408410        return nullptr;
    409411    }
  • code/trunk/src/modules/weapons/projectiles/GravityBombField.cc

    r11071 r11083  
    3434        fieldExploded_ = false;
    3535
    36         setVelocity(FORCE_SPHERE_START_STRENGTH);
     36        setFieldVelocity(FORCE_SPHERE_START_STRENGTH);
    3737        setDiameter(2*FORCE_SPHERE_START_RADIUS);
    3838        setMode(modeSphere_s);
     
    158158       
    159159        setDiameter(forceSphereRadius_*2);
    160         setVelocity(forceStrength_);
     160        setFieldVelocity(forceStrength_);
    161161        if(lifetime_>0) particleSphere_->setScale(forceSphereRadius_/FORCE_SPHERE_START_RADIUS);
    162162        bombModel_->setScale(modelScaling_);
Note: See TracChangeset for help on using the changeset viewer.