1) Replaced m_wiimote_max with m_wiimote_raw_maw (default

needs to be changed from 90 to 25 for r14301 to work
   properly).
2) Some code cleanup (removed global constant).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14305 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2013-10-25 05:25:33 +00:00
parent ca23d7623d
commit 00018ebe68
3 changed files with 16 additions and 12 deletions

View File

@ -46,6 +46,9 @@ static PtrVector<UserConfigParam, REF> all_params;
#include "utils/string_utils.hpp"
#include "utils/translation.hpp"
const int UserConfig::m_current_config_version = 8;
// ----------------------------------------------------------------------------
UserConfigParam::~UserConfigParam()
{
@ -649,13 +652,14 @@ bool UserConfig::loadConfig()
}
// ---- Read config file version
int configFileVersion = CURRENT_CONFIG_VERSION;
if(root->get("version", &configFileVersion) < 1)
int config_file_version = m_current_config_version;
if(root->get("version", &config_file_version) < 1)
{
GUIEngine::showMessage( _("Your config file was malformed, so it was deleted and a new one will be created."), 10.0f);
std::cerr << "Warning, malformed user config file! Contains no version\n";
Log::error("UserConfig",
"Warning, malformed user config file! Contains no version");
}
if (configFileVersion < CURRENT_CONFIG_VERSION)
if (config_file_version < m_current_config_version)
{
// current version (8) is 100% incompatible with other versions (which were lisp)
// so we just delete the old config. in the future, for smaller updates, we can
@ -713,7 +717,6 @@ bool UserConfig::loadConfig()
return true;
} // loadConfig
// ----------------------------------------------------------------------------
/** Write settings to config file. */
void UserConfig::saveConfig()
@ -732,7 +735,8 @@ void UserConfig::saveConfig()
XMLWriter configfile(filename.c_str());
configfile << L"<?xml version=\"1.0\"?>\n";
configfile << L"<stkconfig version=\"" << CURRENT_CONFIG_VERSION << L"\" >\n\n";
configfile << L"<stkconfig version=\"" << m_current_config_version
<< L"\" >\n\n";
const int paramAmount = all_params.size();
for(int i=0; i<paramAmount; i++)

View File

@ -37,8 +37,6 @@
cause an undefined game action now
6: Added stick configurations.
*/
const int CURRENT_CONFIG_VERSION = 8;
#include <string>
#include <map>
#include <vector>
@ -351,10 +349,10 @@ namespace UserConfigParams
PARAM_PREFIX GroupUserConfigParam m_wiimote_group
PARAM_DEFAULT( GroupUserConfigParam("WiiMote",
"Settings for the wiimote") );
PARAM_PREFIX FloatUserConfigParam m_wiimote_max
PARAM_DEFAULT( FloatUserConfigParam(90.0f, "wiimote-max",
PARAM_PREFIX FloatUserConfigParam m_wiimote_raw_max
PARAM_DEFAULT( FloatUserConfigParam(25.0f, "wiimote-raw-max",
&m_wiimote_group,
"At what angle (0-128) maximum steering is reached.") );
"At what raw input value maximum steering is reached (between 1 and 25).") );
PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_linear
PARAM_DEFAULT( FloatUserConfigParam(0.2f, "wiimote-weight-linear",
@ -704,6 +702,8 @@ private:
std::string m_filename;
irr::core::stringw m_warning;
static const int m_current_config_version;
public:
/** Create the user config object; does not actually load it,
* UserConfig::loadConfig needs to be called. */

View File

@ -77,7 +77,7 @@ void Wiimote::resetIrrEvent()
void Wiimote::update()
{
float normalized_angle = -(m_wiimote_handle->accel.y-128)
/ UserConfigParams::m_wiimote_max;
/ UserConfigParams::m_wiimote_raw_max;
#ifdef DEBUG
if(UserConfigParams::m_wiimote_debug)