Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 16, 2010, 11:22:36 AM (14 years ago)
Author:
rgrieder
Message:

Merged revisions 6430-6440 from the gamestate branch to the trunk.
This adds keybindings merging functionality.

(from log of r6437)
When running development builds, the keybinder will merge the local file and the one from the data folder.
Catch: if you want to remove a binding, you'll have to write "NoBinding" (not case sensitive) to override the default command

The keybind command already does that for you though.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/input/Button.cc

    r6428 r6536  
    4242#include "core/CommandEvaluation.h"
    4343#include "core/CommandExecutor.h"
     44#include "core/ConfigFileManager.h"
    4445
    4546namespace orxonox
     
    8182    }
    8283
    83     void Button::readBinding(ConfigFileType type)
    84     {
    85         const std::string& binding = ConfigFileManager::getInstance().getValue(type, groupName_, name_, "", true);
     84    void Button::readBinding(ConfigFile* configFile, ConfigFile* fallbackFile)
     85    {
     86        std::string binding = configFile->getOrCreateValue(groupName_, name_, "", true);
     87        if (binding.empty() && fallbackFile)
     88            binding = fallbackFile->getValue(groupName_, name_, true);
    8689        this->parse(binding);
    8790    }
    8891
    89     void Button::setBinding(ConfigFileType type, const std::string& binding, bool bTemporary)
     92    void Button::setBinding(ConfigFile* configFile, ConfigFile* fallbackFile, const std::string& binding, bool bTemporary)
    9093    {
    9194        if (!bTemporary)
    92             ConfigFileManager::getInstance().setValue(type, groupName_, name_, binding, true);
     95            configFile->setValue(groupName_, name_, binding, true);
    9396        this->parse(binding);
    9497    }
     
    103106        this->bindingString_ = binding;
    104107
    105         if (isEmpty(bindingString_))
     108        if (isEmpty(bindingString_) || removeTrailingWhitespaces(getLowercase(binding)) == "nobinding")
    106109            return;
    107110
Note: See TracChangeset for help on using the changeset viewer.