Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 28, 2008, 11:56:31 PM (15 years ago)
Author:
rgrieder
Message:
  • Fixed a bug in ConfigFileManager::getVectorSize(). If there were no entries, 1 was returned instead of 0.
  • Added getSctionName to the ConfigValueContainer
  • Bugfix in Button::clear()
  • Renamed some joy stick buttons and axes to have them sorted corrected in the config file
  • Removed annoying and useless "Key_084=" from keybindings.ini file (there were about a hundred of them)
  • Bugfix in KeyBinder: All the axes were inverted (which was then corrected in the ini file)
  • Also inverted rotateYaw in SpaceShip and Spectator because that actually corrected the bug from above ;)
  • Some small performance optimisation in InputManager
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/core/input/InputManager.cc

    r2103 r2543  
    6565    SetCommandLineSwitch(keyboard_no_grab);
    6666
    67     std::string InputManager::bindingCommmandString_s = "";
    6867    EmptyHandler InputManager::EMPTY_HANDLER;
    6968    InputManager* InputManager::singletonRef_s = 0;
     
    174173            if (joyStickSupport)
    175174                _initialiseJoySticks();
    176             // Do this anyway to also inform everyone if a joystick was detached.
     175            // Do this anyway to also inform everything when a joystick was detached.
    177176            _configureNumberOfJoySticks();
    178177
     
    492491            }
    493492        }
    494         singletonRef_s = 0;
     493
     494        singletonRef_s = 0;
    495495    }
    496496
     
    660660    /**
    661661    @brief
    662         Updates the InputManager. Tick is called by the Core class.
     662        Updates the states and the InputState situation.
    663663    @param dt
    664664        Delta time
     
    676676
    677677        // check for states to leave
    678         for (std::set<InputState*>::reverse_iterator rit = stateLeaveRequests_.rbegin();
    679             rit != stateLeaveRequests_.rend(); ++rit)
    680         {
    681             (*rit)->onLeave();
    682             // just to be sure that the state actually is registered
    683             assert(inputStatesByName_.find((*rit)->getName()) != inputStatesByName_.end());
    684 
    685             activeStates_.erase((*rit)->getPriority());
    686             _updateActiveStates();
    687         }
    688         stateLeaveRequests_.clear();
     678        if (!stateLeaveRequests_.empty())
     679        {
     680            for (std::set<InputState*>::reverse_iterator rit = stateLeaveRequests_.rbegin();
     681                rit != stateLeaveRequests_.rend(); ++rit)
     682            {
     683                (*rit)->onLeave();
     684                // just to be sure that the state actually is registered
     685                assert(inputStatesByName_.find((*rit)->getName()) != inputStatesByName_.end());
     686
     687                activeStates_.erase((*rit)->getPriority());
     688                _updateActiveStates();
     689            }
     690            stateLeaveRequests_.clear();
     691        }
    689692
    690693        // check for states to enter
    691         for (std::set<InputState*>::reverse_iterator rit = stateEnterRequests_.rbegin();
    692             rit != stateEnterRequests_.rend(); ++rit)
    693         {
    694             // just to be sure that the state actually is registered
    695             assert(inputStatesByName_.find((*rit)->getName()) != inputStatesByName_.end());
    696 
    697             activeStates_[(*rit)->getPriority()] = (*rit);
    698             _updateActiveStates();
    699             (*rit)->onEnter();
    700         }
    701         stateEnterRequests_.clear();
     694        if (!stateEnterRequests_.empty())
     695        {
     696            for (std::set<InputState*>::reverse_iterator rit = stateEnterRequests_.rbegin();
     697                rit != stateEnterRequests_.rend(); ++rit)
     698            {
     699                // just to be sure that the state actually is registered
     700                assert(inputStatesByName_.find((*rit)->getName()) != inputStatesByName_.end());
     701
     702                activeStates_[(*rit)->getPriority()] = (*rit);
     703                _updateActiveStates();
     704                (*rit)->onEnter();
     705            }
     706            stateEnterRequests_.clear();
     707        }
    702708
    703709        // check for states to destroy
    704         for (std::set<InputState*>::reverse_iterator rit = stateDestroyRequests_.rbegin();
    705             rit != stateDestroyRequests_.rend(); ++rit)
    706         {
    707             _destroyState((*rit));
    708         }
    709         stateDestroyRequests_.clear();
     710        if (!stateDestroyRequests_.empty())
     711        {
     712            for (std::set<InputState*>::reverse_iterator rit = stateDestroyRequests_.rbegin();
     713                rit != stateDestroyRequests_.rend(); ++rit)
     714            {
     715                _destroyState((*rit));
     716            }
     717            stateDestroyRequests_.clear();
     718        }
    710719
    711720        // check whether a state has changed its EMPTY_HANDLER situation
     
    11241133
    11251134        // keep in mind that the first 8 axes are reserved for the sliders
    1126         _fireAxis(iJoyStick, axis + 8, arg.state.mAxes[axis].abs);
     1135        _fireAxis(iJoyStick, axis + sliderAxes, arg.state.mAxes[axis].abs);
    11271136
    11281137        return true;
Note: See TracChangeset for help on using the changeset viewer.