Remove unneeded character saving, we always get it from translated string if needed
It causes undefined behavior in C++20, see #4735
This commit is contained in:
parent
dcdc66b8f5
commit
c63faf395f
@ -32,11 +32,6 @@ void Binding::save(std::ofstream& stream) const
|
||||
stream << "event=\"" << m_type << "\" ";
|
||||
stream << "id=\"" << m_id << "\" ";
|
||||
|
||||
if (m_type == Input::IT_KEYBOARD)
|
||||
{
|
||||
stream << "character=\"" << m_character << "\" ";
|
||||
}
|
||||
|
||||
// Only serialize the direction and the range for stick motions
|
||||
if (m_type == Input::IT_STICKMOTION)
|
||||
{
|
||||
@ -58,12 +53,6 @@ bool Binding::load(const XMLNode *action)
|
||||
// Default settings for button
|
||||
m_range = Input::AR_HALF;
|
||||
m_dir = Input::AD_NEUTRAL;
|
||||
m_character = 0;
|
||||
// XMLNode only supports stringw, not wchar_t*
|
||||
core::stringw s;
|
||||
action->get("character", &s);
|
||||
if(s.size()>0)
|
||||
m_character = s[0];
|
||||
|
||||
// If the action is not a stick motion (button or key)
|
||||
if (m_type == Input::IT_STICKMOTION)
|
||||
@ -97,9 +86,6 @@ irr::core::stringw Binding::getAsString() const
|
||||
break;
|
||||
case Input::IT_KEYBOARD:
|
||||
s = "?";
|
||||
if(m_character)
|
||||
s[0]=m_character;
|
||||
|
||||
switch(m_id)
|
||||
{
|
||||
//I18N: input configuration screen: mouse button
|
||||
|
@ -40,7 +40,6 @@ private:
|
||||
int m_id;
|
||||
Input::AxisDirection m_dir;
|
||||
Input::AxisRange m_range;
|
||||
wchar_t m_character;
|
||||
public:
|
||||
/** Returns the type of device this binding is using. */
|
||||
Input::InputType getType() const {return m_type; }
|
||||
@ -57,10 +56,9 @@ public:
|
||||
/** Defines all values of this binding. */
|
||||
void set(Input::InputType type, int id,
|
||||
Input::AxisDirection dir,
|
||||
Input::AxisRange range,
|
||||
wchar_t character)
|
||||
Input::AxisRange range)
|
||||
{
|
||||
m_type = type; m_id=id; m_dir=dir; m_range=range; m_character=character;
|
||||
m_type = type; m_id=id; m_dir=dir; m_range=range;
|
||||
} // set
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -179,10 +179,9 @@ void DeviceConfig::setBinding ( const PlayerAction action,
|
||||
const Input::InputType type,
|
||||
const int id,
|
||||
Input::AxisDirection direction,
|
||||
Input::AxisRange range,
|
||||
wchar_t character)
|
||||
Input::AxisRange range)
|
||||
{
|
||||
m_bindings[action].set(type, id, direction, range, character);
|
||||
m_bindings[action].set(type, id, direction, range);
|
||||
} // setBinding
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -89,8 +89,7 @@ public:
|
||||
const Input::InputType type,
|
||||
const int id,
|
||||
Input::AxisDirection direction = Input::AD_NEUTRAL,
|
||||
Input::AxisRange range = Input::AR_HALF,
|
||||
wchar_t character=0);
|
||||
Input::AxisRange range = Input::AR_HALF);
|
||||
bool getMenuAction(Input::InputType type,
|
||||
const int id,
|
||||
int* value,
|
||||
|
@ -563,8 +563,6 @@ void DeviceManager::save()
|
||||
configfile << "<!--\n"
|
||||
<< "Event 1 : Keyboard button press\n"
|
||||
<< " 'id' indicates which button, as defined by irrlicht's EKEY_CODE enum\n"
|
||||
<< " 'character' contains the associated unicode character.\n"
|
||||
<< " Only used as fallback when displaying special characters in the UI.\n"
|
||||
<< "Event 2 : Gamepad stick motion\n"
|
||||
<< " 'id' indicates which stick, starting from 0\n"
|
||||
<< " 'direction' 0 means negative, 1 means positive\n"
|
||||
|
@ -436,8 +436,7 @@ void OptionsScreenDevice::gotSensedInput(const Input& sensed_input)
|
||||
KeyboardConfig* keyboard = (KeyboardConfig*)m_config;
|
||||
keyboard->setBinding(binding_to_set, Input::IT_KEYBOARD,
|
||||
sensed_input.m_button_id, Input::AD_NEUTRAL,
|
||||
Input::AR_HALF,
|
||||
sensed_input.m_character);
|
||||
Input::AR_HALF);
|
||||
|
||||
// refresh display
|
||||
updateInputButtons();
|
||||
@ -495,8 +494,7 @@ void OptionsScreenDevice::gotSensedInput(const Input& sensed_input)
|
||||
KeyboardConfig* keyboard = (KeyboardConfig*)m_config;
|
||||
keyboard->setBinding(binding_to_set, Input::IT_NONE,
|
||||
sensed_input.m_button_id, Input::AD_NEUTRAL,
|
||||
Input::AR_HALF,
|
||||
sensed_input.m_character);
|
||||
Input::AR_HALF);
|
||||
|
||||
// refresh display
|
||||
updateInputButtons();
|
||||
|
Loading…
Reference in New Issue
Block a user