Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2015, 11:22:03 PM (9 years ago)
Author:
landauf
Message:

use actual types instead of 'auto'. only exception is for complicated template types, e.g. when iterating over a map

Location:
code/branches/cpp11_v2/src/libraries/core/input
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/input/Button.cc

    r10821 r10916  
    196196
    197197                    // add command to the buffer if not yet existing
    198                     for (auto & elem : *paramCommandBuffer_)
    199                     {
    200                         if (elem->evaluation_.getConsoleCommand()
     198                    for (BufferedParamCommand* command : *paramCommandBuffer_)
     199                    {
     200                        if (command->evaluation_.getConsoleCommand()
    201201                            == eval.getConsoleCommand())
    202202                        {
    203203                            // already in list
    204                             cmd->paramCommand_ = elem;
     204                            cmd->paramCommand_ = command;
    205205                            break;
    206206                        }
  • code/branches/cpp11_v2/src/libraries/core/input/InputBuffer.cc

    r10821 r10916  
    110110    void InputBuffer::insert(const std::string& input, bool update)
    111111    {
    112         for (auto & elem : input)
    113         {
    114             this->insert(elem, false);
     112        for (const char& inputChar : input)
     113        {
     114            this->insert(inputChar, false);
    115115
    116116            if (update)
    117                 this->updated(elem, false);
     117                this->updated(inputChar, false);
    118118        }
    119119
     
    170170    void InputBuffer::updated()
    171171    {
    172         for (auto & elem : this->listeners_)
    173         {
    174             if ((elem)->bListenToAllChanges_)
    175                 (elem)->callFunction();
     172        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     173        {
     174            if (listener->bListenToAllChanges_)
     175                listener->callFunction();
    176176        }
    177177    }
     
    179179    void InputBuffer::updated(const char& update, bool bSingleInput)
    180180    {
    181         for (auto & elem : this->listeners_)
    182         {
    183             if ((!(elem)->trueKeyFalseChar_) && ((elem)->bListenToAllChanges_ || ((elem)->char_ == update)) && (!(elem)->bOnlySingleInput_ || bSingleInput))
    184                 (elem)->callFunction();
     181        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     182        {
     183            if ((!listener->trueKeyFalseChar_) && (listener->bListenToAllChanges_ || (listener->char_ == update)) && (!listener->bOnlySingleInput_ || bSingleInput))
     184                listener->callFunction();
    185185        }
    186186    }
     
    201201            return;
    202202
    203         for (auto & elem : this->listeners_)
    204         {
    205             if ((elem)->trueKeyFalseChar_ && ((elem)->key_ == evt.getKeyCode()))
    206                 (elem)->callFunction();
     203        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     204        {
     205            if (listener->trueKeyFalseChar_ && (listener->key_ == evt.getKeyCode()))
     206                listener->callFunction();
    207207        }
    208208
  • code/branches/cpp11_v2/src/libraries/core/input/InputDevice.h

    r10845 r10916  
    158158
    159159            // Call all the states with the held button event
    160             for (auto & button : pressedButtons_)
    161                 for (auto & state : inputStates_)
     160            for (ButtonType& button : pressedButtons_)
     161                for (InputState* state : inputStates_)
    162162                    state->template buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>(
    163163                        this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    164164
    165165            // Call states with device update events
    166             for (auto & elem : inputStates_)
    167                 elem->update(time.getDeltaTime(), this->getDeviceID());
     166            for (InputState* state : inputStates_)
     167                state->update(time.getDeltaTime(), this->getDeviceID());
    168168
    169169            static_cast<DeviceClass*>(this)->updateImpl(time);
     
    196196
    197197            // Call states
    198             for (auto & elem : inputStates_)
    199                 elem->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
     198            for (InputState* state : inputStates_)
     199                state->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    200200        }
    201201
     
    218218
    219219            // Call states
    220             for (auto & elem : inputStates_)
    221                 elem->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
     220            for (InputState* state : inputStates_)
     221                state->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    222222        }
    223223
  • code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc

    r10821 r10916  
    373373        // check whether a state has changed its EMPTY situation
    374374        bool bUpdateRequired = false;
    375         for (auto & elem : activeStates_)
    376         {
    377             if (elem.second->hasExpired())
    378             {
    379                 elem.second->resetExpiration();
     375        for (auto& mapEntry : activeStates_)
     376        {
     377            if (mapEntry.second->hasExpired())
     378            {
     379                mapEntry.second->resetExpiration();
    380380                bUpdateRequired = true;
    381381            }
     
    391391
    392392        // Collect function calls for the update
    393         for (auto & elem : activeStatesTicked_)
    394             elem->update(time.getDeltaTime());
     393        for (InputState* state : activeStatesTicked_)
     394            state->update(time.getDeltaTime());
    395395
    396396        // Execute all cached function calls in order
     
    401401        // If we delay the calls, then OIS and and the InputStates are not anymore
    402402        // in the call stack and can therefore be edited.
    403         for (auto & elem : this->callBuffer_)
    404             elem();
     403        for (auto& function : this->callBuffer_)
     404            function();
    405405
    406406        this->callBuffer_.clear();
     
    437437        // Using an std::set to avoid duplicates
    438438        std::set<InputState*> tempSet;
    439         for (auto & elem : devices_)
    440             if (elem != nullptr)
    441                 for (unsigned int iState = 0; iState < elem->getStateListRef().size(); ++iState)
    442                     tempSet.insert(elem->getStateListRef()[iState]);
     439        for (InputDevice* device : devices_)
     440            if (device != nullptr)
     441                for (unsigned int iState = 0; iState < device->getStateListRef().size(); ++iState)
     442                    tempSet.insert(device->getStateListRef()[iState]);
    443443
    444444        // Copy the content of the std::set back to the actual vector
    445445        activeStatesTicked_.clear();
    446         for (const auto & elem : tempSet)
    447             activeStatesTicked_.push_back(elem);
     446        for (InputState* state : tempSet)
     447            activeStatesTicked_.push_back(state);
    448448
    449449        // Check whether we have to change the mouse mode
  • code/branches/cpp11_v2/src/libraries/core/input/JoyStick.cc

    r10821 r10916  
    186186    void JoyStick::clearBuffersImpl()
    187187    {
    188         for (auto & elem : povStates_)
    189             elem = 0;
     188        for (int& state : povStates_)
     189            state = 0;
    190190    }
    191191
  • code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc

    r10821 r10916  
    153153    void KeyBinder::buttonThresholdChanged()
    154154    {
    155         for (auto & elem : allHalfAxes_)
    156             if (!elem->bButtonThresholdUser_)
    157                 elem->buttonThreshold_ = this->buttonThreshold_;
     155        for (HalfAxis* halfAxis : allHalfAxes_)
     156            if (!halfAxis->bButtonThresholdUser_)
     157                halfAxis->buttonThreshold_ = this->buttonThreshold_;
    158158    }
    159159
     
    383383            it->second->clear();
    384384
    385         for (auto & elem : paramCommandBuffer_)
    386             delete elem;
     385        for (BufferedParamCommand* command : paramCommandBuffer_)
     386            delete command;
    387387        paramCommandBuffer_.clear();
    388388    }
     
    394394    {
    395395        // iterate over all buttons
    396         for (const auto & elem : this->allButtons_)
    397         {
    398             Button* button = elem.second;
     396        for (const auto& mapEntry : this->allButtons_)
     397        {
     398            Button* button = mapEntry.second;
    399399
    400400            // iterate over all modes
     
    465465        this->mousePosition_[1] = 0.0f;
    466466
    467         for (auto & elem : mouseAxes_)
    468             elem.reset();
     467        for (HalfAxis& axis : mouseAxes_)
     468            axis.reset();
    469469    }
    470470
     
    505505        }
    506506
    507         for (auto & elem : mouseAxes_)
     507        for (HalfAxis& axis : mouseAxes_)
    508508        {
    509509            // Why dividing relative value by dt? The reason lies in the simple fact, that when you
     
    515515            {
    516516                // just ignore if dt == 0.0 because we have multiplied by 0.0 anyway..
    517                 elem.relVal_ /= dt;
    518             }
    519 
    520             tickHalfAxis(elem);
     517                axis.relVal_ /= dt;
     518            }
     519
     520            tickHalfAxis(axis);
    521521        }
    522522    }
  • code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.h

    r10845 r10916  
    226226    {
    227227        // execute all buffered bindings (additional parameter)
    228         for (auto & elem : paramCommandBuffer_)
     228        for (BufferedParamCommand* command : paramCommandBuffer_)
    229229        {
    230             elem->rel_ *= dt;
    231             elem->execute();
     230            command->rel_ *= dt;
     231            command->execute();
    232232        }
    233233
    234234        // always reset the relative movement of the mouse
    235         for (auto & elem : mouseAxes_)
    236             elem.relVal_ = 0.0f;
     235        for (HalfAxis& axis : mouseAxes_)
     236            axis.relVal_ = 0.0f;
    237237    }
    238238}// tolua_export
  • code/branches/cpp11_v2/src/libraries/core/input/Mouse.cc

    r10821 r10916  
    8282            IntVector2 rel(e.state.X.rel, e.state.Y.rel);
    8383            IntVector2 clippingSize(e.state.width, e.state.height);
    84             for (auto & elem : inputStates_)
    85                 elem->mouseMoved(abs, rel, clippingSize);
     84            for (InputState* state : inputStates_)
     85                state->mouseMoved(abs, rel, clippingSize);
    8686        }
    8787
     
    8989        if (e.state.Z.rel != 0)
    9090        {
    91             for (auto & elem : inputStates_)
    92                 elem->mouseScrolled(e.state.Z.abs, e.state.Z.rel);
     91            for (InputState* state : inputStates_)
     92                state->mouseScrolled(e.state.Z.abs, e.state.Z.rel);
    9393        }
    9494
Note: See TracChangeset for help on using the changeset viewer.