Initialize buttontext in UI_KEYPAD constructor

This commit is contained in:
Kp 2014-12-20 04:36:10 +00:00
parent 0bf2a6eb80
commit c53a8cc30f
2 changed files with 9 additions and 7 deletions

View file

@ -44,6 +44,7 @@ struct grs_font;
struct UI_KEYPAD {
typedef array<char, 100> buttontext_element_t;
typedef array<buttontext_element_t, 17> buttontext_t;
UI_KEYPAD();
unsigned numkeys;
array<char, 100> description;
array<short, 100> keycode;

View file

@ -289,6 +289,14 @@ void ui_pad_goto_prev()
ui_pad_set_active(i);
}
UI_KEYPAD::UI_KEYPAD() :
numkeys(0)
{
description[0] = 0;
range_for (auto &i, buttontext)
i[0] = 0;
}
void ui_pad_read( int n, const char * filename )
{
char * ptr;
@ -303,13 +311,6 @@ void ui_pad_read( int n, const char * filename )
return;
}
auto &kpn = *(KeyPad[n] = make_unique<UI_KEYPAD>());
kpn.numkeys = 0;
for (int i=0; i<100; i++ )
{
kpn.keycode[i] = -1;
kpn.function_number[i] = 0;
}
PHYSFSX_gets_line_t<100> buffer;
while ( linenumber < 22)