Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 6, 2008, 2:32:19 PM (16 years ago)
Author:
rgrieder
Message:
  • feature: Automatic key repetition in InputBuffer, configurable in orxonox.ini
  • replaced std::list and std::map with std::vector in InputManager where necessary
  • new mouseWheelTurned event
  • some renaming
  • OIS:: calls only necessary in InputManager now
File:
1 edited

Legend:

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

    r1219 r1236  
    3030  @file
    3131  @brief Implementation of the InputManager that captures all the input from OIS
    32          and redirects it to handlers if necessary.
     32         and redirects it to handlers.
    3333 */
    3434
     
    5252  InputManager::InputManager() :
    5353      inputSystem_(0), keyboard_(0), mouse_(0),
    54       state_(IS_UNINIT), stateRequest_(IS_UNINIT)
     54      state_(IS_UNINIT), stateRequest_(IS_UNINIT),
     55      joySticksSize_(0)
    5556  {
    5657    RegisterObject(InputManager);
    5758
    58     this->joySticks_.reserve(5);
     59    //this->joySticks_.reserve(5);
    5960    //this->activeJoyStickHandlers_.reserve(10);
    6061    this->activeKeyHandlers_.reserve(10);
     
    234235  bool InputManager::_initialiseJoySticks()
    235236  {
    236     if (joySticks_.size() > 0)
     237    if (joySticksSize_ > 0)
    237238    {
    238239      CCOUT(2) << "Warning: Joy sticks already initialised, skipping." << std::endl;
     
    265266      return false;
    266267    }
     268    joySticksSize_ = joySticks_.size();
    267269    return success;
    268270  }
     
    336338  void InputManager::_destroyJoySticks()
    337339  {
    338     if (joySticks_.size() > 0)
     340    if (joySticksSize_ > 0)
    339341    {
    340342      // note: inputSystem_ can never be 0, or else the code is mistaken
    341       for (unsigned int i = 0; i < joySticks_.size(); i++)
     343      for (unsigned int i = 0; i < joySticksSize_; i++)
    342344        if (joySticks_[i] != 0)
    343345          inputSystem_->destroyInputObject(joySticks_[i]);
    344346
    345347      joySticks_.clear();
     348      joySticksSize_ = 0;
    346349      activeJoyStickHandlers_.clear();
    347350      joyStickButtonsDown_.clear();
     
    382385          activeMouseHandlers_.push_back(mouseHandlers_["keybinder"]);
    383386          activeMouseHandlers_.push_back(mouseHandlers_["SpaceShip"]);
    384           for (std::vector<OIS::JoyStick*>::const_iterator it = joySticks_.begin();
    385                 it != joySticks_.end(); it++)
    386             activeJoyStickHandlers_[*it].push_back(joyStickHandlers_["keybinder"]);
     387          for (unsigned int i = 0; i < joySticksSize_; i++)
     388            activeJoyStickHandlers_[i].push_back(joyStickHandlers_["keybinder"]);
    387389          break;
    388390
     
    393395        case IS_CONSOLE:
    394396          activeMouseHandlers_.push_back(mouseHandlers_["keybinder"]);
    395           for (std::vector<OIS::JoyStick*>::const_iterator it = joySticks_.begin();
    396                 it != joySticks_.end(); it++)
    397             activeJoyStickHandlers_[*it].push_back(joyStickHandlers_["keybinder"]);
     397          activeMouseHandlers_.push_back(mouseHandlers_["SpaceShip"]);
     398          for (unsigned int i = 0; i < joySticksSize_; i++)
     399            activeJoyStickHandlers_[i].push_back(joyStickHandlers_["keybinder"]);
    398400
    399401          activeKeyHandlers_.push_back(keyHandlers_["buffer"]);
     
    415417
    416418    // call all the handlers for the held key events
    417     for (std::list<OIS::KeyCode>::const_iterator itKey = keysDown_.begin();
    418           itKey != keysDown_.end(); itKey++)
    419     {
    420       OIS::KeyEvent keyArg(keyboard_, *itKey, 0);
    421       for (unsigned int i = 0; i < activeKeyHandlers_.size(); i++)
    422         activeKeyHandlers_[i]->keyHeld(keyArg);
    423     }
     419    for (unsigned int iKey = 0; iKey < keysDown_.size(); iKey++)
     420      for (unsigned int iHandler = 0; iHandler < activeKeyHandlers_.size(); iHandler++)
     421        activeKeyHandlers_[iHandler]->keyHeld(KeyEvent(keysDown_[iKey], keyboardModifiers_));
    424422
    425423    // call all the handlers for the held mouse button events
    426     for (std::list<OIS::MouseButtonID>::const_iterator itMouseButton = mouseButtonsDown_.begin();
    427           itMouseButton != mouseButtonsDown_.end(); itMouseButton++)
    428     {
    429       OIS::MouseEvent mouseButtonArg(mouse_, mouse_->getMouseState());
    430       for (unsigned int i = 0; i < activeMouseHandlers_.size(); i++)
    431         activeMouseHandlers_[i]->mouseHeld(mouseButtonArg, *itMouseButton);
    432     }
     424    for (unsigned int iButton = 0; iButton < mouseButtonsDown_.size(); iButton++)
     425      for (unsigned int iHandler = 0; iHandler < activeMouseHandlers_.size(); iHandler++)
     426        activeMouseHandlers_[iHandler]->mouseButtonHeld(mouse_->getMouseState(), mouseButtonsDown_[iButton]);
    433427
    434428    // call all the handlers for the held joy stick button events
    435     for (std::map< OIS::JoyStick*, std::list <int> >::const_iterator itJoyStick = joyStickButtonsDown_.begin();
    436           itJoyStick != joyStickButtonsDown_.end(); itJoyStick++)
    437     {
    438       OIS::JoyStick* joyStick = (*itJoyStick).first;
    439       for (std::list<int>::const_iterator itJoyStickButton = (*itJoyStick).second.begin();
    440             itJoyStickButton != (*itJoyStick).second.end(); itJoyStickButton++)
    441       {
    442         OIS::JoyStickEvent joyStickButtonArg(joyStick, joyStick->getJoyStickState());
    443         for (unsigned int i = 0; i < activeJoyStickHandlers_[joyStick].size(); i++)
    444           activeJoyStickHandlers_[joyStick][i]->buttonHeld(i, joyStickButtonArg, *itJoyStickButton);
    445       }
    446     }
    447   }
    448 
     429    for (unsigned int iJoyStick  = 0; iJoyStick < joySticksSize_; iJoyStick++)
     430      for (unsigned int iButton   = 0; iButton   < joyStickButtonsDown_.size(); iButton++)
     431        for (unsigned int iHandler = 0; iHandler  < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
     432          activeJoyStickHandlers_[iJoyStick][iHandler]->joyStickButtonHeld(
     433              JoyStickState(joySticks_[iJoyStick]->getJoyStickState(), iJoyStick), joyStickButtonsDown_[iJoyStick][iButton]);
     434  }
    449435
    450436  // ###### Key Events ######
     
    457443  {
    458444    // check whether the key already is in the list (can happen when focus was lost)
    459     for (std::list<OIS::KeyCode>::iterator it = keysDown_.begin(); it != keysDown_.end(); it++)
    460     {
    461       if (*it == e.key)
    462       {
    463         keysDown_.erase(it);
    464         break;
    465       }
    466     }
    467     keysDown_.push_back(e.key);
     445    unsigned int iKey = 0;
     446    while (iKey < keysDown_.size() && keysDown_[iKey].key != e.key)
     447      iKey++;
     448    if (iKey == keysDown_.size())
     449      keysDown_.push_back(Key(e));
     450
     451    // update modifiers
     452    if(e.key == OIS::KC_RMENU    || e.key == OIS::KC_LMENU)
     453      keyboardModifiers_ |= KeyboardModifier::Alt;   // alt key
     454    if(e.key == OIS::KC_RCONTROL || e.key == OIS::KC_LCONTROL)
     455      keyboardModifiers_ |= KeyboardModifier::Ctrl;  // ctrl key
     456    if(e.key == OIS::KC_RSHIFT   || e.key == OIS::KC_LSHIFT)
     457      keyboardModifiers_ |= KeyboardModifier::Shift; // shift key
    468458
    469459    for (unsigned int i = 0; i < activeKeyHandlers_.size(); i++)
    470       activeKeyHandlers_[i]->keyPressed(e);
     460      activeKeyHandlers_[i]->keyPressed(KeyEvent(e, keyboardModifiers_));
    471461
    472462    return true;
     
    480470  {
    481471    // remove the key from the keysDown_ list
    482     for (std::list<OIS::KeyCode>::iterator it = keysDown_.begin(); it != keysDown_.end(); it++)
    483     {
    484       if (*it == e.key)
    485       {
    486         keysDown_.erase(it);
     472    for (unsigned int iKey = 0; iKey < keysDown_.size(); iKey++)
     473    {
     474      if (keysDown_[iKey].key == e.key)
     475      {
     476        keysDown_.erase(keysDown_.begin() + iKey);
    487477        break;
    488478      }
    489479    }
    490480
     481    // update modifiers
     482    if(e.key == OIS::KC_RMENU    || e.key == OIS::KC_LMENU)
     483      keyboardModifiers_ &= ~KeyboardModifier::Alt;   // alt key
     484    if(e.key == OIS::KC_RCONTROL || e.key == OIS::KC_LCONTROL)
     485      keyboardModifiers_ &= ~KeyboardModifier::Ctrl;  // ctrl key
     486    if(e.key == OIS::KC_RSHIFT   || e.key == OIS::KC_LSHIFT)
     487      keyboardModifiers_ &= ~KeyboardModifier::Shift; // shift key
     488
    491489    for (unsigned int i = 0; i < activeKeyHandlers_.size(); i++)
    492       activeKeyHandlers_[i]->keyReleased(e);
     490      activeKeyHandlers_[i]->keyReleased(KeyEvent(e, keyboardModifiers_));
    493491
    494492    return true;
     
    504502  bool InputManager::mouseMoved(const OIS::MouseEvent &e)
    505503  {
    506     for (unsigned int i = 0; i < activeMouseHandlers_.size(); i++)
    507       activeMouseHandlers_[i]->mouseMoved(e);
     504    // check for actual moved event
     505    if (e.state.X.rel != 0 || e.state.Y.rel != 0)
     506    {
     507      for (unsigned int i = 0; i < activeMouseHandlers_.size(); i++)
     508        activeMouseHandlers_[i]->mouseMoved(e.state);
     509    }
     510
     511    // check for mouse wheel turned event
     512    if (e.state.Z.rel != 0)
     513    {
     514      for (unsigned int i = 0; i < activeMouseHandlers_.size(); i++)
     515        activeMouseHandlers_[i]->mouseWheelTurned(e.state);
     516    }
    508517
    509518    return true;
     
    518527  {
    519528    // check whether the button already is in the list (can happen when focus was lost)
    520     for (std::list<OIS::MouseButtonID>::iterator it = mouseButtonsDown_.begin(); it != mouseButtonsDown_.end(); it++)
    521     {
    522       if (*it == id)
    523       {
    524         mouseButtonsDown_.erase(it);
    525         break;
    526       }
    527     }
    528     mouseButtonsDown_.push_back(id);
     529    unsigned int iButton = 0;
     530    while (iButton < mouseButtonsDown_.size() && mouseButtonsDown_[iButton] != id)
     531      iButton++;
     532    if (iButton == mouseButtonsDown_.size())
     533      mouseButtonsDown_.push_back((MouseButton::Enum)id);
    529534
    530535    for (unsigned int i = 0; i < activeMouseHandlers_.size(); i++)
    531       activeMouseHandlers_[i]->mousePressed(e, id);
     536      activeMouseHandlers_[i]->mouseButtonPressed(e.state, (MouseButton::Enum)id);
    532537
    533538    return true;
     
    542547  {
    543548    // remove the button from the keysDown_ list
    544     for (std::list<OIS::MouseButtonID>::iterator it = mouseButtonsDown_.begin(); it != mouseButtonsDown_.end(); it++)
    545     {
    546       if (*it == id)
    547       {
    548         mouseButtonsDown_.erase(it);
     549    for (unsigned int iButton = 0; iButton < mouseButtonsDown_.size(); iButton++)
     550    {
     551      if (mouseButtonsDown_[iButton] == id)
     552      {
     553        mouseButtonsDown_.erase(mouseButtonsDown_.begin() + iButton);
    549554        break;
    550555      }
     
    552557
    553558    for (unsigned int i = 0; i < activeMouseHandlers_.size(); i++)
    554       activeMouseHandlers_[i]->mouseReleased(e, id);
     559      activeMouseHandlers_[i]->mouseButtonReleased(e.state, (MouseButton::Enum)id);
    555560
    556561    return true;
     
    562567  bool InputManager::buttonPressed(const OIS::JoyStickEvent &arg, int button)
    563568  {
     569    // use the device to identify which one called the method
    564570    OIS::JoyStick* joyStick = (OIS::JoyStick*)arg.device;
     571    unsigned int iJoyStick = 0;
     572    while (joySticks_[iJoyStick] != joyStick)
     573      iJoyStick++;
    565574
    566575    // check whether the button already is in the list (can happen when focus was lost)
    567     std::list<int>& buttonsDownList = joyStickButtonsDown_[joyStick];
    568     for (std::list<int>::iterator it = buttonsDownList.begin(); it != buttonsDownList.end(); it++)
    569     {
    570       if (*it == button)
    571       {
    572         buttonsDownList.erase(it);
     576    std::vector<int> buttonsDown = joyStickButtonsDown_[iJoyStick];
     577    unsigned int iButton = 0;
     578    while (iButton < buttonsDown.size() && buttonsDown[iButton] != button)
     579      iButton++;
     580    if (iButton == buttonsDown.size())
     581      buttonsDown.push_back(button);
     582
     583    for (unsigned int iHandler = 0; iHandler < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
     584      activeJoyStickHandlers_[iJoyStick][iHandler]->joyStickButtonPressed(JoyStickState(arg.state, iJoyStick), button);
     585
     586    return true;
     587  }
     588
     589  bool InputManager::buttonReleased(const OIS::JoyStickEvent &arg, int button)
     590  {
     591    // use the device to identify which one called the method
     592    OIS::JoyStick* joyStick = (OIS::JoyStick*)arg.device;
     593    unsigned int iJoyStick = 0;
     594    while (joySticks_[iJoyStick] != joyStick)
     595      iJoyStick++;
     596
     597    // remove the button from the joyStickButtonsDown_ list
     598    std::vector<int> buttonsDown = joyStickButtonsDown_[iJoyStick];
     599    for (unsigned int iButton = 0; iButton < buttonsDown.size(); iButton++)
     600    {
     601      if (buttonsDown[iButton] == button)
     602      {
     603        buttonsDown.erase(buttonsDown.begin() + iButton);
    573604        break;
    574605      }
    575606    }
    576     joyStickButtonsDown_[joyStick].push_back(button);
    577 
    578     for (unsigned int i = 0; i < activeJoyStickHandlers_[joyStick].size(); i++)
    579       activeJoyStickHandlers_[joyStick][i]->buttonPressed(i, arg, button);
    580 
    581     return true;
    582   }
    583 
    584   bool InputManager::buttonReleased(const OIS::JoyStickEvent &arg, int button)
    585   {
     607
     608    for (unsigned int iHandler = 0; iHandler < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
     609      activeJoyStickHandlers_[iJoyStick][iHandler]->joyStickButtonReleased(JoyStickState(arg.state, iJoyStick), button);
     610
     611    return true;
     612  }
     613
     614  bool InputManager::axisMoved(const OIS::JoyStickEvent &arg, int axis)
     615  {
     616    // use the device to identify which one called the method
    586617    OIS::JoyStick* joyStick = (OIS::JoyStick*)arg.device;
    587 
    588     // remove the button from the joyStickButtonsDown_ list
    589     std::list<int>& buttonsDownList = joyStickButtonsDown_[joyStick];
    590     for (std::list<int>::iterator it = buttonsDownList.begin(); it != buttonsDownList.end(); it++)
    591     {
    592       if (*it == button)
    593       {
    594         buttonsDownList.erase(it);
    595         break;
    596       }
    597     }
    598 
    599     for (unsigned int i = 0; i < activeJoyStickHandlers_[joyStick].size(); i++)
    600       activeJoyStickHandlers_[joyStick][i]->buttonReleased(i, arg, button);
    601 
    602     return true;
    603   }
    604 
    605   bool InputManager::axisMoved(const OIS::JoyStickEvent &arg, int axis)
    606   {
     618    unsigned int iJoyStick = 0;
     619    while (joySticks_[iJoyStick] != joyStick)
     620      iJoyStick++;
     621
     622    for (unsigned int iHandler = 0; iHandler < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
     623      activeJoyStickHandlers_[iJoyStick][iHandler]->joyStickAxisMoved(JoyStickState(arg.state, iJoyStick), axis);
     624
     625    return true;
     626  }
     627
     628  bool InputManager::sliderMoved(const OIS::JoyStickEvent &arg, int id)
     629  {
     630    // use the device to identify which one called the method
    607631    OIS::JoyStick* joyStick = (OIS::JoyStick*)arg.device;
    608     for (unsigned int i = 0; i < activeJoyStickHandlers_[joyStick].size(); i++)
    609       activeJoyStickHandlers_[joyStick][i]->axisMoved(i, arg, axis);
    610 
    611     return true;
    612   }
    613 
    614   bool InputManager::sliderMoved(const OIS::JoyStickEvent &arg, int id)
    615   {
     632    unsigned int iJoyStick = 0;
     633    while (joySticks_[iJoyStick] != joyStick)
     634      iJoyStick++;
     635
     636    for (unsigned int iHandler = 0; iHandler < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
     637      activeJoyStickHandlers_[iJoyStick][iHandler]->joyStickSliderMoved(JoyStickState(arg.state, iJoyStick), id);
     638
     639    return true;
     640  }
     641
     642  bool InputManager::povMoved(const OIS::JoyStickEvent &arg, int id)
     643  {
     644    // use the device to identify which one called the method
    616645    OIS::JoyStick* joyStick = (OIS::JoyStick*)arg.device;
    617     for (unsigned int i = 0; i < activeJoyStickHandlers_[joyStick].size(); i++)
    618       activeJoyStickHandlers_[joyStick][i]->sliderMoved(i, arg, id);
    619 
    620     return true;
    621   }
    622 
    623   bool InputManager::povMoved(const OIS::JoyStickEvent &arg, int id)
    624   {
     646    unsigned int iJoyStick = 0;
     647    while (joySticks_[iJoyStick] != joyStick)
     648      iJoyStick++;
     649
     650    for (unsigned int iHandler = 0; iHandler < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
     651      activeJoyStickHandlers_[iJoyStick][iHandler]->joyStickPovMoved(JoyStickState(arg.state, iJoyStick), id);
     652
     653    return true;
     654  }
     655
     656  bool InputManager::vector3Moved(const OIS::JoyStickEvent &arg, int id)
     657  {
     658    // use the device to identify which one called the method
    625659    OIS::JoyStick* joyStick = (OIS::JoyStick*)arg.device;
    626     for (unsigned int i = 0; i < activeJoyStickHandlers_[joyStick].size(); i++)
    627       activeJoyStickHandlers_[joyStick][i]->povMoved(i, arg, id);
    628 
    629     return true;
    630   }
    631 
    632   bool InputManager::vector3Moved(const OIS::JoyStickEvent &arg, int id)
    633   {
    634     OIS::JoyStick* joyStick = (OIS::JoyStick*)arg.device;
    635     for (unsigned int i = 0; i < activeJoyStickHandlers_[joyStick].size(); i++)
    636       activeJoyStickHandlers_[joyStick][i]->vector3Moved(i, arg, id);
     660    unsigned int iJoyStick = 0;
     661    while (joySticks_[iJoyStick] != joyStick)
     662      iJoyStick++;
     663
     664    for (unsigned int iHandler = 0; iHandler < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
     665      activeJoyStickHandlers_[iJoyStick][iHandler]->joyStickVector3Moved(JoyStickState(arg.state, iJoyStick), id);
    637666
    638667    return true;
     
    685714  int InputManager::numberOfJoySticks()
    686715  {
    687     return _getSingleton().joySticks_.size();
     716    return _getSingleton().joySticksSize_;
     717  }
     718
     719  bool InputManager::isKeyDown(KeyCode::Enum key)
     720  {
     721    if (_getSingleton().keyboard_)
     722      return _getSingleton().keyboard_->isKeyDown((OIS::KeyCode)key);
     723    else
     724      return false;
     725  }
     726
     727  bool InputManager::isModifierDown(KeyboardModifier::Enum modifier)
     728  {
     729    if (_getSingleton().keyboard_)
     730      return isModifierDown(modifier);
     731    else
     732      return false;
     733  }
     734
     735  const MouseState InputManager::getMouseState()
     736  {
     737    if (_getSingleton().mouse_)
     738      return _getSingleton().mouse_->getMouseState();
     739    else
     740      return MouseState();
     741  }
     742
     743  const JoyStickState InputManager::getJoyStickState(unsigned int ID)
     744  {
     745    if (ID < _getSingleton().joySticksSize_)
     746      return JoyStickState(_getSingleton().joySticks_[ID]->getJoyStickState(), ID);
     747    else
     748      return JoyStickState();
    688749  }
    689750
     
    10611122    @return False if name or id was not found, true otherwise.
    10621123  */
    1063   bool InputManager::enableJoyStickHandler(const std::string& name, const int ID)
     1124  bool InputManager::enableJoyStickHandler(const std::string& name, unsigned int ID)
    10641125  {
    10651126    // get handler pointer from the map with all stored handlers
     
    10691130
    10701131    // check for existence of the ID
    1071     if ((unsigned int)ID >= _getSingleton().joySticks_.size())
    1072       return false;
    1073     OIS::JoyStick* joyStick = _getSingleton().joySticks_[ID];
     1132    if (ID >= _getSingleton().joySticksSize_)
     1133      return false;
    10741134
    10751135    // see whether the handler already is in the list
    1076     for (std::vector<JoyStickHandler*>::iterator it = _getSingleton().activeJoyStickHandlers_[joyStick].begin();
    1077           it != _getSingleton().activeJoyStickHandlers_[joyStick].end(); it++)
     1136    for (std::vector<JoyStickHandler*>::iterator it = _getSingleton().activeJoyStickHandlers_[ID].begin();
     1137          it != _getSingleton().activeJoyStickHandlers_[ID].end(); it++)
    10781138    {
    10791139      if ((*it) == (*handlerIt).second)
     
    10831143      }
    10841144    }
    1085     _getSingleton().activeJoyStickHandlers_[joyStick].push_back((*handlerIt).second);
     1145    _getSingleton().activeJoyStickHandlers_[ID].push_back((*handlerIt).second);
    10861146    _getSingleton().stateRequest_ = IS_CUSTOM;
    10871147    return true;
     
    10931153    @return False if name or id was not found, true otherwise.
    10941154  */
    1095   bool InputManager::disableJoyStickHandler(const std::string &name, int ID)
     1155  bool InputManager::disableJoyStickHandler(const std::string &name, unsigned int ID)
    10961156  {
    10971157    // get handler pointer from the map with all stored handlers
     
    11011161
    11021162    // check for existence of the ID
    1103     if ((unsigned int)ID >= _getSingleton().joySticks_.size())
    1104       return false;
    1105     OIS::JoyStick* joyStick = _getSingleton().joySticks_[ID];
     1163    if (ID >= _getSingleton().joySticksSize_)
     1164      return false;
    11061165
    11071166    // look for the handler in the list
    1108     for (std::vector<JoyStickHandler*>::iterator it = _getSingleton().activeJoyStickHandlers_[joyStick].begin();
    1109           it != _getSingleton().activeJoyStickHandlers_[joyStick].end(); it++)
     1167    for (std::vector<JoyStickHandler*>::iterator it = _getSingleton().activeJoyStickHandlers_[ID].begin();
     1168          it != _getSingleton().activeJoyStickHandlers_[ID].end(); it++)
    11101169    {
    11111170      if ((*it) == (*handlerIt).second)
    11121171      {
    1113         _getSingleton().activeJoyStickHandlers_[joyStick].erase(it);
     1172        _getSingleton().activeJoyStickHandlers_[ID].erase(it);
    11141173        _getSingleton().stateRequest_ = IS_CUSTOM;
    11151174        return true;
     
    11241183    @return False if key handler is not active or doesn't exist, true otherwise.
    11251184  */
    1126   bool InputManager::isJoyStickHandlerActive(const std::string& name, const int ID)
     1185  bool InputManager::isJoyStickHandlerActive(const std::string& name, unsigned int ID)
    11271186  {
    11281187    // get handler pointer from the map with all stored handlers
     
    11321191
    11331192    // check for existence of the ID
    1134     if ((unsigned int)ID >= _getSingleton().joySticks_.size())
    1135       return false;
    1136     OIS::JoyStick* joyStick = _getSingleton().joySticks_[ID];
     1193    if (ID >= _getSingleton().joySticksSize_)
     1194      return false;
    11371195
    11381196    // see whether the handler already is in the list
    1139     for (std::vector<JoyStickHandler*>::iterator it = _getSingleton().activeJoyStickHandlers_[joyStick].begin();
    1140           it != _getSingleton().activeJoyStickHandlers_[joyStick].end(); it++)
     1197    for (std::vector<JoyStickHandler*>::iterator it = _getSingleton().activeJoyStickHandlers_[ID].begin();
     1198          it != _getSingleton().activeJoyStickHandlers_[ID].end(); it++)
    11411199    {
    11421200      if ((*it) == (*handlerIt).second)
Note: See TracChangeset for help on using the changeset viewer.