void CommandMapper::buildCommandMapping()
    {
        ConfigurationManager* cfgMgr = ConfigurationManager::getSingletonPtr();
        InputManager* inputMgr = InputManager::getSingletonPtr();

        // First get the movement commands
        const NameValuePairList& commands = cfgMgr->getSettings("Movement keys");

        for (NameValuePairList::const_iterator it = commands.begin(); it != commands.end(); it++)
        {
            // Split the path at the ',' character
            StringVector keys = Ogre::StringUtil::split(it->second, ",");

            for (size_t i = 0; i < keys.size(); i++)
            {
                mMovementCommands[inputMgr->getScanCode(keys[i])] = getMovement(it->first);
                LOG_MESSAGE(Logger::UI,
                    Ogre::String("Key ") + keys[i] + " ("
                    + StringConverter::toString(inputMgr->getScanCode(keys[i]))
                    + ") is assigned to movement " + it->first +" ("
                    + StringConverter::toString(getMovement(it->first))+")");
            }
        }

        buildCommandMap(mKeyGlobalActions, cfgMgr->getSettings("Action keys"));
        buildCommandMap(mKeyMovementControlState, cfgMgr->getSettings("MovementController keys"));
        buildCommandMap(mKeyFreeflightControlState, cfgMgr->getSettings("FreeflightController keys"));
        buildCommandMap(mKeyDialogControlState, cfgMgr->getSettings("DialogController keys"));
        buildCommandMap(mKeyCombatControlState, cfgMgr->getSettings("CombatController keys"));
        buildCommandMap(mKeyCutsceneControlState, cfgMgr->getSettings("CutsceneController keys"));
    }