Made m_enabled in DeviceConfig private.

This commit is contained in:
hiker
2014-10-29 15:44:05 +11:00
parent 29f5b14e45
commit 721c8bfa88
4 changed files with 26 additions and 9 deletions

View File

@@ -278,11 +278,16 @@ bool DeviceConfig::doGetAction(Input::InputType type,
} // doGetAction
//------------------------------------------------------------------------------
/** Saves the configuration to a file.
/** Saves the configuration to a file. The calling node must have written
* the beginning of the xml node, so that this function can immediately
* start writing attributes.
* \param stream The stream to save to.
*/
void DeviceConfig::save (std::ofstream& stream)
{
stream << "enabled=\""
<< (m_enabled ? "true\">\n" : "false\">\n");
for(int n = 0; n < PA_COUNT; n++) // Start at 0?
{
stream << " "

View File

@@ -45,6 +45,12 @@ public:
DEVICE_CONFIG_TYPE_GAMEPAD,
DEVICE_CONFIG_TYPE_KEYBOARD
};
private:
/** If set to false, this device will be ignored.
* Currently for gamepads only. */
bool m_enabled;
protected:
Binding m_bindings[PA_COUNT];
@@ -52,10 +58,6 @@ protected:
/** How many devices connected to the system which uses this config? */
int m_plugged;
/** If set to false, this device will be ignored.
* Currently for gamepads only. */
bool m_enabled;
/** Name of this configuratiom. */
std::string m_name;

View File

@@ -70,11 +70,16 @@ bool GamepadConfig::load(const XMLNode *config)
} // load
// ----------------------------------------------------------------------------
/** Saves the configuration to a file. It writes the name for a gamepad
* config, saves the device specific parameters, and calls
* DeviceConfig::save() to save the rest.
* \param stream The stream to save to.
*/
void GamepadConfig::save (std::ofstream& stream)
{
stream << "<gamepad name =\"" << m_name.c_str() << "\" enabled=\""
<< (m_enabled ? "true\"\n" : "false\"\n");
stream << " deadzone=\""<<m_deadzone << "\">\n";
stream << "<gamepad name =\"" << m_name.c_str()
<<"\" deadzone=\""<<m_deadzone << "\"\n";
stream << " ";
DeviceConfig::save(stream);
stream << "</gamepad>\n\n";
} // save

View File

@@ -37,9 +37,14 @@ KeyboardConfig::KeyboardConfig() : DeviceConfig(DEVICE_CONFIG_TYPE_KEYBOARD)
} // KeyboardConfig
// ----------------------------------------------------------------------------
/** Saves the configuration to a file. It writes the name for a gamepad
* config, saves the device specific parameters, and calls
* DeviceConfig::save() to save the rest.
* \param stream The stream to save to.
*/
void KeyboardConfig::save(std::ofstream& stream)
{
stream << "<keyboard>\n";
stream << "<keyboard ";
DeviceConfig::save(stream);
stream << "</keyboard>\n\n";
} // save